codertrish commited on
Commit
2e8c6e0
·
verified ·
1 Parent(s): f7dbde1

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +81 -0
README.md ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ license: gemma
4
+ tags:
5
+ - gemma-3
6
+ - chess
7
+ - instruction-tuning
8
+ - sft
9
+ - lora
10
+ - merged
11
+ - unsloth
12
+ - trl
13
+ - small-model
14
+ base_model: unsloth/gemma-3-270m-it
15
+ library_name: transformers
16
+ pipeline_tag: text-generation
17
+ datasets:
18
+ - Thytu/ChessInstruct
19
+ model-index:
20
+ - name: Finetuned-gemma3-270m-chess-merged
21
+ results: []
22
+ ---
23
+
24
+ # Gemma-3 270M — Chess Coach (Merged FP16)
25
+
26
+ **Author:** [@codertrish](https://huggingface.co/codertrish)
27
+ **Base model:** [`unsloth/gemma-3-270m-it`](https://huggingface.co/unsloth/gemma-3-270m-it)
28
+ **Type:** *Merged* FP16 checkpoint (LoRA deltas baked into base — no adapters needed)
29
+ **Task:** Conversational chess tutoring (rules, beginner principles, simple reasoning)
30
+
31
+ ---
32
+
33
+ ## TL;DR
34
+
35
+ - This is a **plug-and-play** Gemma-3 (270M) checkpoint specialized for **chess coaching**.
36
+ - It was fine-tuned via **LoRA** on a subset of **`Thytu/ChessInstruct`**, then **merged to FP16**.
37
+ - Load directly with `transformers` and chat using the **Gemma-3 chat template**.
38
+
39
+ ---
40
+
41
+ ## ✨ Intended Use
42
+
43
+ - **Direct use:** Explain chess rules, beginner opening principles, basic tactics, and high-level strategy in **plain text**.
44
+ - **Downstream use:** As a small assistant embedded in notebooks, tutorials, or beginner-level chess learning tools.
45
+
46
+ **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.
47
+
48
+ ---
49
+
50
+ ## 🔧 How to Use
51
+
52
+ > The model expects **Gemma-3 chat formatting**. Use `apply_chat_template` before generation.
53
+
54
+ ### Minimal example (Transformers)
55
+ ```python
56
+ from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline
57
+
58
+ REPO = "codertrish/Finetuned-gemma3-270m-chess-merged"
59
+
60
+ tok = AutoTokenizer.from_pretrained(REPO)
61
+ model = AutoModelForCausalLM.from_pretrained(REPO, torch_dtype="bfloat16", device_map="auto")
62
+
63
+ pipe = pipeline("text-generation", model=model, tokenizer=tok, return_full_text=False)
64
+
65
+ def chat(messages, **gen_kwargs):
66
+ prompt = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
67
+ eot_id = tok.convert_tokens_to_ids("<end_of_turn>")
68
+ out = pipe(
69
+ prompt,
70
+ eos_token_id=eot_id,
71
+ max_new_tokens=200,
72
+ do_sample=False, # deterministic; set True for sampling
73
+ **gen_kwargs,
74
+ )[0]["generated_text"]
75
+ return out.strip()
76
+
77
+ messages = [
78
+ {"role":"system","content":"You are a helpful chess coach. Answer in plain text, 3 concise bullets."},
79
+ {"role":"user","content":"What are the main opening principles?"},
80
+ ]
81
+ print(chat(messages))