Instructions to use biswadeep2004/gpt2-medium-sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use biswadeep2004/gpt2-medium-sft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="biswadeep2004/gpt2-medium-sft") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("biswadeep2004/gpt2-medium-sft") model = AutoModelForCausalLM.from_pretrained("biswadeep2004/gpt2-medium-sft", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use biswadeep2004/gpt2-medium-sft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "biswadeep2004/gpt2-medium-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": "biswadeep2004/gpt2-medium-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/biswadeep2004/gpt2-medium-sft
- SGLang
How to use biswadeep2004/gpt2-medium-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 "biswadeep2004/gpt2-medium-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": "biswadeep2004/gpt2-medium-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 "biswadeep2004/gpt2-medium-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": "biswadeep2004/gpt2-medium-sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use biswadeep2004/gpt2-medium-sft with Docker Model Runner:
docker model run hf.co/biswadeep2004/gpt2-medium-sft
Qwen3-0.6B-Base SFT
Qwen3-0.6B-Base fine-tuned with supervised fine-tuning (SFT) on banghua/DL-SFT-Dataset.
Built as a learning exercise to compare the raw base model's output before and after SFT.
Model Details
- Developed by: biswadeep2004
- Model type: Causal language model (Qwen3, 0.6B params)
- Language(s): Mostly English
- License: Apache 2.0 (inherited from the base model)
- Finetuned from: Qwen/Qwen3-0.6B-Base
Intended Use
Experimentation and learning about SFT. Not intended for production use or for factual or safety-critical answers.
Limitations
Small model trained on a small dataset (~3k examples). SFT teaches response format and style, not new knowledge, so it can hallucinate and make arithmetic or factual mistakes.
How to Use
from transformers import AutoTokenizer, AutoModelForCausalLM
repo = "biswadeep2004/<your-repo-name>"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)
msgs = [{"role": "user", "content": "Why is the sky blue?"}]
prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
inputs = tok(prompt, return_tensors="pt", add_special_tokens=False)
out = model.generate(**inputs, max_new_tokens=200, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Training Details
- Data: banghua/DL-SFT-Dataset (single-turn user/assistant conversations)
- Format: ChatML (
<|im_start|>/<|im_end|>), with loss computed on assistant tokens only (assistant_only_loss=True) - Method: Full fine-tuning with TRL
SFTTrainer - Hyperparameters: learning rate 1e-5 (cosine, 20 warmup steps), 2 epochs, per-device batch size 1 ร 16 gradient accumulation, max length 1024, fp16 mixed precision, gradient checkpointing
- Hardware: 1ร NVIDIA T4 (Google Colab)
- Final training loss:
Evaluation
Qualitative only: informal before/after comparison on a handful of prompts. No benchmark scores.
- Downloads last month
- 208
Model tree for biswadeep2004/gpt2-medium-sft
Base model
Qwen/Qwen3-0.6B-Base