Views
No views yet


trust_remote_code=True is required.1import torch
2from huggingface_hub import hf_hub_download
3from sentencepiece import SentencePieceProcessor
4from transformers import AutoModelForCausalLM
5
6repo_id = "ni-co-la-s/gemmeh-it"
7
8model = AutoModelForCausalLM.from_pretrained(
9 "ni-co-la-s/gemmeh-it",
10 trust_remote_code=True,
11 torch_dtype="bfloat16",
12)
13model.eval()
14print("Model loaded")
15
16# Load tokenizer
17sp_path = hf_hub_download(
18 repo_id="ni-co-la-s/gemmeh-it",
19 filename="tokenizer.model",
20 token=True,
21)
22sp = SentencePieceProcessor()
23sp.Load(sp_path)
24print("Tokenizer loaded")
25
26# Test generation
27def generate(question, max_new_tokens=40, temperature=0.0):
28 prompt = (
29 f"<start_of_turn>user\n{question}\n<end_of_turn>\n"
30 "<start_of_turn>model\n"
31 )
32 ids = sp.Encode(prompt, out_type=int)
33 input_ids = torch.tensor([ids], dtype=torch.long)
34 with torch.no_grad():
35 for _ in range(max_new_tokens):
36 out = model(input_ids)
37 next_logits = out.logits[0, -1, :]
38 if temperature == 0:
39 next_id = next_logits.argmax().item()
40 else:
41 probs = torch.softmax(next_logits / temperature, dim=-1)
42 next_id = torch.multinomial(probs, 1).item()
43 if next_id == sp.eos_id():
44 break
45 input_ids = torch.cat([input_ids, torch.tensor([[next_id]])], dim=1)
46 return sp.Decode(input_ids[0][len(ids):].tolist())
47
48print(generate("What is the capital of France?", max_new_tokens=40, temperature=0.0))| Parameters | 1.1B |
| Architecture | Gemma 3-inspired |
| Vocab | 32,768 (SentencePiece BPE, English-only) |
| Context | 4,096 |
| Pretraining data | FineWeb-Edu sample, 20B tokens |
| Knowledge cutoff | Pre-2024 (intentional) |
| Finetuning | LoRA rank 16 on OpenHermes (250M assistant tokens) |
| Benchmark | Metric | Gemmeh 1B (base) | Gemmeh-IT 1B | Gemma 3 1B IT (local) |
|---|---|---|---|---|
| PIQA | 0-shot | 70.2 | 71.4 | 72.8 |
| ARC-Challenge | 25-shot | 38.4 | 40.4 | 40.3 |
| ARC-Easy | 0-shot | 57.3 | 57.6 | 63.4 |
| WinoGrande | 5-shot | 52.2 | 54.0 | 55.1 |
| TruthfulQA | mc2, 0-shot | 37.8 | 44.8 | 38.9 |