RLHFlow/RLHFlow-SFT-Dataset-ver2
Viewer • Updated • 2.32M • 54 • 5
How to use dtiapkin/gemma3-1b-sft with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="dtiapkin/gemma3-1b-sft")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("dtiapkin/gemma3-1b-sft")
model = AutoModelForCausalLM.from_pretrained("dtiapkin/gemma3-1b-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 dtiapkin/gemma3-1b-sft with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "dtiapkin/gemma3-1b-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": "dtiapkin/gemma3-1b-sft",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/dtiapkin/gemma3-1b-sft
How to use dtiapkin/gemma3-1b-sft with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "dtiapkin/gemma3-1b-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": "dtiapkin/gemma3-1b-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 "dtiapkin/gemma3-1b-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": "dtiapkin/gemma3-1b-sft",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use dtiapkin/gemma3-1b-sft with Docker Model Runner:
docker model run hf.co/dtiapkin/gemma3-1b-sft
axolotl version: 0.13.0.dev0
# =========================
# Axolotl SFT config (Gemma3 1B PT, full finetune, bf16, no grad ckpt)
# =========================
# ---- Model ----
base_model: google/gemma-3-1b-pt
model_type: AutoModelForCausalLM
tokenizer_type: AutoTokenizer
trust_remote_code: true
strict: false
# Quantization OFF (full finetune)
load_in_8bit: false
load_in_4bit: false
# ---- Chat formatting ----
chat_template: gemma3
# ---- Dataset ----
datasets:
- path: RLHFlow/RLHFlow-SFT-Dataset-ver2
type: chat_template
field_messages: conversations
roles_to_train: ["assistant"]
split: train
train_on_split: train
val_set_size: 0.01
train_on_inputs: false # only learn on assistant tokens
# ---- Tokenization / packing ----
sequence_len: 8192
sample_packing: true
pad_to_sequence_len: true
# Cache the prepared dataset (put on $WORK on Jean Zay)
dataset_prepared_path: ./prepared/gemma3-1b-8192
dataset_processes: 32 # adjust to cpus-per-task; 32 is fine on JZ A100 nodes
dataloader_pin_memory: true
dataloader_num_workers: 8
dataloader_prefetch_factor: 2
# ---- Output / logging ----
output_dir: ./outputs/gemma3-1b-sft
save_safetensors: true
logging_steps: 10
save_strategy: "epoch"
save_total_limit: 5
# Optional W&B
wandb_project: gemma3-sft
wandb_name: gemma3-1b-pt_seq8192_lr3e-5_bs128
wandb_watch:
wandb_log_model:
# ---- Precision / speed ----
bf16: true
fp16: false
tf32: true
flash_attention: true
xformers_attention:
# ---- Training hyperparams ----
num_epochs: 3 # start with 1 epoch to validate end-to-end; then increase
micro_batch_size: 1
gradient_accumulation_steps: 16 # with 8 GPUs => effective batch = 1*16*8 = 128
optimizer: adamw_torch_fused
lr_scheduler: cosine
learning_rate: 3.0e-5 # good starting point for 1B full finetune
warmup_ratio: 0.05
weight_decay: 0.0
max_grad_norm: 1.0
group_by_length: false
# ---- Memory knobs ----
gradient_checkpointing: false # you asked: OFF for the beginning
# ---- Distributed ----
# When you launch with torchrun, Axolotl will use DDP.
# Keep these empty so you do NOT enable ZeRO/FSDP.
ddp:
deepspeed:
fsdp:
fsdp_config:
# ---- Debug ----
debug:
This model is a fine-tuned version of google/gemma-3-1b-pt on the RLHFlow/RLHFlow-SFT-Dataset-ver2 dataset.
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
Base model
google/gemma-3-1b-pt