Instructions to use codertrish/Finetuned-gemma3-270m-chess-merged with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use codertrish/Finetuned-gemma3-270m-chess-merged with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="codertrish/Finetuned-gemma3-270m-chess-merged") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("codertrish/Finetuned-gemma3-270m-chess-merged") model = AutoModelForCausalLM.from_pretrained("codertrish/Finetuned-gemma3-270m-chess-merged") 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 codertrish/Finetuned-gemma3-270m-chess-merged with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "codertrish/Finetuned-gemma3-270m-chess-merged" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codertrish/Finetuned-gemma3-270m-chess-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/codertrish/Finetuned-gemma3-270m-chess-merged
- SGLang
How to use codertrish/Finetuned-gemma3-270m-chess-merged 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 "codertrish/Finetuned-gemma3-270m-chess-merged" \ --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": "codertrish/Finetuned-gemma3-270m-chess-merged", "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 "codertrish/Finetuned-gemma3-270m-chess-merged" \ --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": "codertrish/Finetuned-gemma3-270m-chess-merged", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio
How to use codertrish/Finetuned-gemma3-270m-chess-merged with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for codertrish/Finetuned-gemma3-270m-chess-merged to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for codertrish/Finetuned-gemma3-270m-chess-merged to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for codertrish/Finetuned-gemma3-270m-chess-merged to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="codertrish/Finetuned-gemma3-270m-chess-merged", max_seq_length=2048, ) - Docker Model Runner
How to use codertrish/Finetuned-gemma3-270m-chess-merged with Docker Model Runner:
docker model run hf.co/codertrish/Finetuned-gemma3-270m-chess-merged
Gemma-3 270M — Chess Coach (Merged FP16)
Author: @codertrish
Base model: unsloth/gemma-3-270m-it
Type: Merged FP16 checkpoint (LoRA deltas baked into base — no adapters needed)
Task: Conversational chess tutoring (rules, beginner principles, simple reasoning)
TL;DR
- This is a plug-and-play Gemma-3 (270M) checkpoint specialized for chess coaching.
- It was fine-tuned via LoRA on a subset of
Thytu/ChessInstruct, then merged to FP16. - Load directly with
transformersand chat using the Gemma-3 chat template.
✨ Intended Use
- Direct use: Explain chess rules, beginner opening principles, basic tactics, and high-level strategy in plain text.
- Downstream use: As a small assistant embedded in notebooks, tutorials, or beginner-level chess learning tools.
Out-of-scope: Engine-level move search, advanced calculation, or authoritative evaluations of complex positions. For serious analysis, use a dedicated chess engine (e.g., Stockfish) and verify claims.
🔧 How to Use
The model expects Gemma-3 chat formatting. Use
apply_chat_templatebefore generation.
Minimal example (Transformers)
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
REPO = "codertrish/Finetuned-gemma3-270m-chess-merged"
tok = AutoTokenizer.from_pretrained(REPO)
model = AutoModelForCausalLM.from_pretrained(REPO, torch_dtype="bfloat16", device_map="auto")
pipe = pipeline("text-generation", model=model, tokenizer=tok, return_full_text=False)
def chat(messages, **gen_kwargs):
prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
eot_id = tok.convert_tokens_to_ids("<end_of_turn>")
out = pipe(
prompt,
eos_token_id=eot_id,
max_new_tokens=200,
do_sample=False, # deterministic; set True for sampling
**gen_kwargs,
)[0]["generated_text"]
return out.strip()
messages = [
{"role":"system","content":"You are a helpful chess coach. Answer in plain text, 3 concise bullets."},
{"role":"user","content":"What are the main opening principles?"},
]
print(chat(messages))
- Downloads last month
- 3