felixwangg/codenet-c-cpp-stage1-4k
Viewer • Updated • 3.8k • 58
How to use felixwangg/Qwen2.5-Coder-7B-func-stage1-4k-ep2 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-4k-ep2")How to use felixwangg/Qwen2.5-Coder-7B-func-stage1-4k-ep2 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-4k-ep2")
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-4k-ep2")
model = AutoModelForCausalLM.from_pretrained("felixwangg/Qwen2.5-Coder-7B-func-stage1-4k-ep2")
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-4k-ep2 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "felixwangg/Qwen2.5-Coder-7B-func-stage1-4k-ep2"
# 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-4k-ep2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/felixwangg/Qwen2.5-Coder-7B-func-stage1-4k-ep2
How to use felixwangg/Qwen2.5-Coder-7B-func-stage1-4k-ep2 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-4k-ep2" \
--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-4k-ep2",
"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-4k-ep2" \
--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-4k-ep2",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use felixwangg/Qwen2.5-Coder-7B-func-stage1-4k-ep2 with Docker Model Runner:
docker model run hf.co/felixwangg/Qwen2.5-Coder-7B-func-stage1-4k-ep2
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-4k
type: chat_template
split: train
test_datasets:
- path: felixwangg/codenet-c-cpp-stage1-4k
type: chat_template
split: validation
dataset_prepared_path: /u901/t577wang/SecSteer-v2/axolotl-datasets/lora/Qwen2.5-Coder-7B/func-stage1-4k
val_set_size: 0
output_dir: /u901/t577wang/SecSteer-v2/axolotl-outputs/lora/Qwen2.5-Coder-7B-func-stage1-4k-ep2
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-4k
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: 2
warmup_ratio: 0.1
early_stopping_patience: 1000
eval_steps: 15
save_steps: 15
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-4k 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.6374 | 1.8916 | 37.83 | 37.83 | 41.81 |
| 0.5964 | 0.2804 | 15 | 0.6105 | 1.8413 | 38.14 | 38.14 | 54.2 |
| 0.5270 | 0.5607 | 30 | 0.5679 | 1.7646 | 38.14 | 38.14 | 54.2 |
| 0.5420 | 0.8411 | 45 | 0.5589 | 1.7487 | 38.14 | 38.14 | 54.2 |
| 0.4953 | 1.1121 | 60 | 0.5538 | 1.7398 | 38.14 | 38.14 | 54.2 |
| 0.5211 | 1.3925 | 75 | 0.5504 | 1.7339 | 38.14 | 38.14 | 54.2 |
| 0.5713 | 1.6729 | 90 | 0.5484 | 1.7305 | 38.14 | 38.14 | 54.21 |
| 0.5435 | 1.9533 | 105 | 0.5481 | 1.7300 | 38.14 | 38.14 | 54.21 |
| 0.5058 | 1.9907 | 107 | 0.5481 | 1.7299 | 38.14 | 38.14 | 54.2 |