lambdasec/cve-single-line-fixes
Viewer • Updated • 435 • 21 • 3
How to use lambdasec/santafixer with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="lambdasec/santafixer", trust_remote_code=True) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("lambdasec/santafixer", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("lambdasec/santafixer", trust_remote_code=True)How to use lambdasec/santafixer with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "lambdasec/santafixer"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "lambdasec/santafixer",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/lambdasec/santafixer
How to use lambdasec/santafixer with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "lambdasec/santafixer" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "lambdasec/santafixer",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "lambdasec/santafixer" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "lambdasec/santafixer",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use lambdasec/santafixer with Docker Model Runner:
docker model run hf.co/lambdasec/santafixer
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.
# 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]))
The model was fine-tuned on the CVE single line fixes dataset
Supervised Fine Tuning (SFT)
The model was tested with the GitHub top 1000 projects vulnerabilities dataset