felixwangg/codenet-c-cpp-stage1-4k
Viewer • Updated • 3.8k • 76
How to use felixwangg/Qwen2.5-Coder-7B-func-stage1-4k 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")How to use felixwangg/Qwen2.5-Coder-7B-func-stage1-4k 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")
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")
model = AutoModelForCausalLM.from_pretrained("felixwangg/Qwen2.5-Coder-7B-func-stage1-4k")
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 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "felixwangg/Qwen2.5-Coder-7B-func-stage1-4k"
# 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",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/felixwangg/Qwen2.5-Coder-7B-func-stage1-4k
How to use felixwangg/Qwen2.5-Coder-7B-func-stage1-4k 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" \
--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",
"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" \
--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",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use felixwangg/Qwen2.5-Coder-7B-func-stage1-4k with Docker Model Runner:
docker model run hf.co/felixwangg/Qwen2.5-Coder-7B-func-stage1-4k
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
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: 1
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.6381 | 1.8928 | 37.83 | 37.83 | 41.81 |
| 0.5167 | 0.2804 | 15 | 0.6047 | 1.8306 | 38.15 | 38.15 | 54.2 |
| 0.5853 | 0.5607 | 30 | 0.5688 | 1.7661 | 38.15 | 38.15 | 54.2 |
| 0.5147 | 0.8411 | 45 | 0.5632 | 1.7563 | 38.15 | 38.15 | 54.2 |
| 0.6076 | 1.0 | 54 | 0.5630 | 1.756 | 38.14 | 38.14 | 54.21 |