This is a LLM for code that is focussed on generating bug fixes using infilling.
Use the code below to get started with the model.
1# pip install -q transformers
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4checkpoint = "lambdasec/santafixer"
5device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
6
7tokenizer = AutoTokenizer.from_pretrained(checkpoint)
8model = AutoModelForCausalLM.from_pretrained(checkpoint,
9 trust_remote_code=True).to(device)
10
11input_text = "<fim-prefix>def print_hello_world():\n
12 <fim-suffix>\n print('Hello world!')
13 <fim-middle>"
14inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
15outputs = model.generate(inputs)
16print(tokenizer.decode(outputs[0]))
The model was fine-tuned on the
CVE single line fixes dataset