英文

SantaFixer 模型卡片

这是一个专注于使用补充填充生成错误修复的 LLM 模型。

模型详情

模型描述

如何开始使用模型

使用下面的代码开始使用模型。

# pip install -q transformers
from transformers import AutoModelForCausalLM, AutoTokenizer

checkpoint = "lambdasec/santafixer"
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint,
              trust_remote_code=True).to(device)

input_text = "<fim-prefix>def print_hello_world():\n
              <fim-suffix>\n print('Hello world!')
              <fim-middle>"
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0]))

训练详情

  • GPU:Tesla P100
  • 时间:约 5 小时

训练数据

模型在 CVE single line fixes dataset 上进行了细调。

训练过程

监督微调(SFT)

训练超参数
  • 优化器:adafactor
  • 梯度累积步数:4
  • 梯度检查点:true
  • fp16:false

评估

模型使用 GitHub top 1000 projects vulnerabilities dataset 进行了测试。