felixwangg/codenet-c-cpp-stage1
Viewer • Updated • 1k • 125
How to use felixwangg/Qwen2.5-Coder-7B-func-stage1 with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-7B-Instruct")
model = PeftModel.from_pretrained(base_model, "felixwangg/Qwen2.5-Coder-7B-func-stage1")How to use felixwangg/Qwen2.5-Coder-7B-func-stage1 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="felixwangg/Qwen2.5-Coder-7B-func-stage1")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("felixwangg/Qwen2.5-Coder-7B-func-stage1")
model = AutoModelForCausalLM.from_pretrained("felixwangg/Qwen2.5-Coder-7B-func-stage1")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use felixwangg/Qwen2.5-Coder-7B-func-stage1 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "felixwangg/Qwen2.5-Coder-7B-func-stage1"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "felixwangg/Qwen2.5-Coder-7B-func-stage1",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/felixwangg/Qwen2.5-Coder-7B-func-stage1
How to use felixwangg/Qwen2.5-Coder-7B-func-stage1 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "felixwangg/Qwen2.5-Coder-7B-func-stage1" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "felixwangg/Qwen2.5-Coder-7B-func-stage1",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "felixwangg/Qwen2.5-Coder-7B-func-stage1" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "felixwangg/Qwen2.5-Coder-7B-func-stage1",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use felixwangg/Qwen2.5-Coder-7B-func-stage1 with Docker Model Runner:
docker model run hf.co/felixwangg/Qwen2.5-Coder-7B-func-stage1
axolotl version: 0.16.1
base_model: Qwen/Qwen2.5-Coder-7B-Instruct
model_type: Qwen2ForCausalLM
tokenizer_type: AutoTokenizer
load_in_8bit: false
load_in_4bit: false
datasets:
- path: felixwangg/codenet-c-cpp-stage1
type: chat_template
split: train
test_datasets:
- path: felixwangg/codenet-c-cpp-stage1
type: chat_template
split: validation
dataset_prepared_path: /home/tkwang/scratch/SecSteer-v2/axolotl-datasets/lora/Qwen2.5-Coder-7B/func-stage1
val_set_size: 0
output_dir: /home/tkwang/scratch/SecSteer-v2/axolotl-outputs/lora/Qwen2.5-Coder-7B-func-stage1
sequence_len: 4096
sample_packing: false
eval_sample_packing: false
pad_to_sequence_len: true
adapter: lora
lora_model_dir:
lora_r: 16
lora_alpha: 16
lora_dropout: 0.05
lora_target_linear: true
merge_lora: true
wandb_project: sft-primevul-sweep-ctx-0
wandb_entity: wtkuan
wandb_watch: "false"
wandb_name: Qwen2.5-Coder-7B-func-stage1
wandb_log_model: "false"
gradient_accumulation_steps: 8
micro_batch_size: 4
optimizer: adamw_torch
lr_scheduler: cosine
learning_rate: 4e-5
bf16: true
tf32: false
train_on_inputs: false
roles_to_train: ['assistant']
gradient_checkpointing: true
resume_from_checkpoint:
logging_steps: 1
flash_attention: true
num_epochs: 1
warmup_ratio: 0.1
early_stopping_patience: 1000
eval_steps: 5
save_steps: 5
save_total_limit: 1000
load_best_model_at_end: true
weight_decay: 0.02
special_tokens:
plugins:
This model is a fine-tuned version of Qwen/Qwen2.5-Coder-7B-Instruct on the felixwangg/codenet-c-cpp-stage1 dataset. It achieves the following results on the evaluation set:
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
| Training Loss | Epoch | Step | Validation Loss | Ppl | Active (gib) | Allocated (gib) | Reserved (gib) |
|---|---|---|---|---|---|---|---|
| No log | 0 | 0 | 0.6554 | 1.9259 | 37.85 | 37.85 | 41.82 |
| 0.5850 | 0.3540 | 5 | 0.6517 | 1.9189 | 38.19 | 38.19 | 51.31 |
| 0.6071 | 0.7080 | 10 | 0.6357 | 1.8884 | 38.19 | 38.19 | 52.47 |
| 0.6697 | 1.0 | 15 | 0.6311 | 1.8797 | 38.19 | 38.19 | 52.47 |