winglian/codeforces-cot-16k-context-topk64-prepared
Viewer • Updated • 19.7k • 292
How to use winglian/codeforces-cot-distill-7b-v1 with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="winglian/codeforces-cot-distill-7b-v1")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("winglian/codeforces-cot-distill-7b-v1")
model = AutoModelForCausalLM.from_pretrained("winglian/codeforces-cot-distill-7b-v1")
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 winglian/codeforces-cot-distill-7b-v1 with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "winglian/codeforces-cot-distill-7b-v1"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "winglian/codeforces-cot-distill-7b-v1",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/winglian/codeforces-cot-distill-7b-v1
How to use winglian/codeforces-cot-distill-7b-v1 with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "winglian/codeforces-cot-distill-7b-v1" \
--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": "winglian/codeforces-cot-distill-7b-v1",
"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 "winglian/codeforces-cot-distill-7b-v1" \
--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": "winglian/codeforces-cot-distill-7b-v1",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use winglian/codeforces-cot-distill-7b-v1 with Docker Model Runner:
docker model run hf.co/winglian/codeforces-cot-distill-7b-v1
axolotl version: 0.10.0.dev0
base_model: Qwen/Qwen2.5-Coder-7B-Instruct
plugins:
- axolotl.integrations.kd.KDPlugin
- axolotl.integrations.liger.LigerPlugin
liger_rms_norm: true
liger_glu_activation: true
# torch_compile: true
strict: false
chat_template_jinja: "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0]['role'] == 'system' %}\n {{- messages[0]['content'] }}\n {%- else %}\n {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}\n {%- endif %}\n {{- \"\\n\\n# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0]['role'] == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0]['content'] + '<|im_end|>\\n' }}\n {%- else %}\n {{- '<|im_start|>system\\nYou are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) or (message.role == \"assistant\" and not message.tool_calls) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role }}\n {%- if message.content %}\n {{- '\\n' + message.content }}\n {%- endif %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '\\n<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n<think>' }}\n{%- endif %}\n"
kd_trainer: true
kd_ce_alpha: 0.1
kd_alpha: 0.8
kd_temperature: 2.0
dataloader_prefetch_factor: 256
dataloader_num_workers: 4
dataloader_pin_memory: true
gc_steps: -1 # gc at the end of each epoch
datasets:
- field_messages: messages
message_field_content: content
message_field_role: role
logprobs_field: target_logprobs
path: winglian/codeforces-cot-16k-context-topk64-prepared
type: axolotl.integrations.kd.chat_template
split: train
temperature: 1.0
dataset_prepared_path: last_run_prepared
val_set_size: 0.0
output_dir: ./outputs/out-kd-7b
skip_prepare_dataset: false
sequence_len: 16384
sample_packing: true
pad_to_sequence_len: true
wandb_project: kd-7b-codeforces
wandb_entity: axolotl-ai
wandb_watch:
wandb_name:
wandb_log_model:
gradient_accumulation_steps: 2
micro_batch_size: 4
num_epochs: 4
optimizer: adamw_torch_fused
lr_scheduler: rex
learning_rate: 4e-5
save_safetensors: true
train_on_inputs: false
group_by_length: false
bf16: true
fp16:
tf32: true
gradient_checkpointing: true
gradient_checkpointing_kwargs:
use_reentrant: false
early_stopping_patience:
resume_from_checkpoint:
logging_steps: 1
xformers_attention:
flash_attention: true
warmup_steps: 120
evals_per_epoch:
eval_table_size:
saves_per_epoch: 1
debug:
weight_decay: 0.0
special_tokens:
pad_token: <|endoftext|>
deepspeed: deepspeed_configs/zero2_torch_compile.json
This model is a fine-tuned version of Qwen/Qwen2.5-Coder-7B-Instruct on the winglian/codeforces-cot-16k-context-topk64-prepared dataset.
More information needed
More information needed
More information needed
The following hyperparameters were used during training: