jadshaker/fine-tuning
Viewer • Updated • 6.2k • 23
How to use jadshaker/tutorbot-sft with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-R1-Distill-Qwen-7B")
model = PeftModel.from_pretrained(base_model, "jadshaker/tutorbot-sft")How to use jadshaker/tutorbot-sft with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="jadshaker/tutorbot-sft")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("jadshaker/tutorbot-sft")
model = AutoModelForCausalLM.from_pretrained("jadshaker/tutorbot-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]:]))How to use jadshaker/tutorbot-sft with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "jadshaker/tutorbot-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": "jadshaker/tutorbot-sft",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/jadshaker/tutorbot-sft
How to use jadshaker/tutorbot-sft with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "jadshaker/tutorbot-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": "jadshaker/tutorbot-sft",
"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 "jadshaker/tutorbot-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": "jadshaker/tutorbot-sft",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use jadshaker/tutorbot-sft with Docker Model Runner:
docker model run hf.co/jadshaker/tutorbot-sft
axolotl version: 0.13.0.dev0
adapter: lora
base_model: deepseek-ai/DeepSeek-R1-Distill-Qwen-7B
bf16: auto
datasets:
- path: /workspace/data/train.jsonl
type: completion
field: text
gradient_accumulation_steps: 16
gradient_checkpointing: true
learning_rate: 0.0002
load_in_8bit: true
lora_alpha: 16
lora_dropout: 0.05
lora_r: 8
lora_target_modules:
- q_proj
- v_proj
- k_proj
- o_proj
- gate_proj
- down_proj
- up_proj
micro_batch_size: 1
num_epochs: 1
optimizer: adamw_bnb_8bit
output_dir: /workspace/fine-tuning/outputs/mymodel
sequence_len: 1024
train_on_inputs: false
hub_model_id: jadshaker/tutorbot-sft
hub_strategy: end
This model is a fine-tuned version of deepseek-ai/DeepSeek-R1-Distill-Qwen-7B on the /workspace/data/train.jsonl dataset.
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
Base model
deepseek-ai/DeepSeek-R1-Distill-Qwen-7B