Text Generation
Transformers
Safetensors
qwen2
Generated from Trainer
conversational
text-generation-inference
Instructions to use Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT") model = AutoModelForCausalLM.from_pretrained("Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT
- SGLang
How to use Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT" \ --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": "Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT" \ --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": "Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT with Docker Model Runner:
docker model run hf.co/Physics-Synthetic-Data/Qwen2.5-coder-7B-Dec20-SFT
See axolotl config
axolotl version: 0.10.0
# ---------------- 核心模型路径 ----------------
base_model: /nfs/data/johnsonk/mllm_models/RAFT/Oct2/lr1e-5_epoch4_warm0.03_training_6k_GPU_0_1_2_3_20251001_172635/trained_model
# output_dir: /work/nvme/bckr/wli18/RAFT/exp_1
dataset_prepared_path: last_run_prepared
# --------------- 数据集 ----------------------
datasets:
# 训练集
- path: /home/johnsonk/RAFT/1exp/exp_1.0.2_questionize_high_school_physics_861_img/result/merged_physics_tikz_dataset.jsonl
type: chat_template
split: train
field_messages: messages
message_property_mappings:
role: role
content: content
val_set_size: 0.05
# --------------- 训练超参 ---------------------
sequence_len: 2048
micro_batch_size: 1
gradient_accumulation_steps: 8
num_epochs: 3
learning_rate: 1e-5
optimizer: adamw_torch
lr_scheduler: cosine
warmup_ratio: 0.03
weight_decay: 0.01
# max_steps: 100 # <--- 新增此行,强制运行100步
# --------------- 精度 / 显存 ------------------
bf16: auto
tf32: true
gradient_checkpointing: true
# gradient_checkpointing_kwargs:
# use_reentrant: false
# --------------- DeepSpeed --------------------
deepspeed: /home/johnsonk/RAFT/configs/deepspeed_stage3.json
# ----------- 关闭所有 LoRA / 量化 -------------
# (配置已为全参数训练)
# load_in_4bit: true
# adapter: qlora
# lora_r: 16
# lora_alpha: 32
# lora_target_modules:
# - q_proj
# - k_proj
# - v_proj
# - o_proj
# - down_proj
# - up_proj
# lora_mlp_kernel: true
# lora_qkv_kernel: true
# lora_o_kernel: true
# -------------- 其它杂项 ----------------------
strict: false
chat_template: qwen_25
save_steps: 100000 # 每50个step保存一次
# [关键] 设置最多只保留2个最新的checkpoint,自动删除旧的
save_total_limit: 0
evals_per_epoch: 1
# saves_per_epoch: 100
logging_steps: 1
flash_attention: true
### WandB ###
report_to: wandb
wandb_project: test_axolotl
wandb_entity: johnson0213-ucla
wandb_name: Qwen2.5-Coder-7B-TikZ-SFT-860-v1-3epoch-grad_acc8-lr1e-5
nfs/data/johnsonk/mllm_models/RAFT/Dec20/lr5e-6_epoch16_warm0.03_training_860_GPU_0_1_2_3_20251220_021048/trained_model
This model was trained from scratch on the /home/johnsonk/RAFT/1exp/exp_1.0.2_questionize_high_school_physics_861_img/result/merged_physics_tikz_dataset.jsonl dataset. It achieves the following results on the evaluation set:
- Loss: 0.3683
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 1e-05
- train_batch_size: 1
- eval_batch_size: 1
- seed: 42
- distributed_type: multi-GPU
- num_devices: 4
- gradient_accumulation_steps: 8
- total_train_batch_size: 32
- total_eval_batch_size: 4
- optimizer: Use OptimizerNames.ADAMW_TORCH with betas=(0.9,0.999) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: cosine
- lr_scheduler_warmup_steps: 2
- training_steps: 77
Training results
| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| No log | 0 | 0 | 1.6350 |
| 0.2283 | 1.0 | 26 | 0.3596 |
| 0.1082 | 2.0 | 52 | 0.3683 |
Framework versions
- Transformers 4.52.3
- Pytorch 2.5.1
- Datasets 3.6.0
- Tokenizers 0.21.2
- Downloads last month
- 2