Views
No views yet
| parameters | precision |
|---|---|
| 229.12 M | BF16 |
transformers library.
It utilizes a custom architecture and requires the Cirilla package to run.| Model Name | Type | Precision | Link |
|---|---|---|---|
| Cirilla 0.3B 4E | Instruct post-trained | BF16 | Hugging Face |
| Cirilla 0.3B 4E GRPO | GRPO post-trained | BF16 | Hugging Face |
| Cirilla 0.3B 4E GRPO ICL | GRPO-ICL post-trained | BF16 | Hugging Face |
uv add Cirillauv run python -m cirilla.cli1from cirilla.Cirilla_model import Cirilla, Args
2from cirilla.Cirilla_model import CirillaTokenizer
3hf_model_id = 'AnthonyPa57/Cirilla-0.3B-4E'
4# You can materialize directly on cpu instead
5# args = Args()
6# args.device = 'cpu'
7# model = Cirilla(args)
8model = Cirilla()
9model.pull_model_from_hub(hf_model_id, inference_mode=True)#, map_device='cpu')
10tokenizer = CirillaTokenizer(hub_url=hf_model_id)
11prompts = [
12 "Which two kings did Dethmold serve in The Witcher 2: Assassins of Kings?",
13 "How much does Geralt's inventory capacity increase with the Ofieri saddlebags?",
14 "In which book does the story of Ciri entering a portal and becoming trapped in a different world first appear?"
15]
16for p in prompts:
17 # you can generate with kv cache
18 # x = tokenizer.apply_chat_template([{"role": "user", "content": p}],
19 # padding='do_not_pad', add_generation_prompt=True)
20 # out = model.generate_kv_cache([x], termination_tokens=[tokenizer.convert_tokens_to_ids('<eos>'), tokenizer.convert_tokens_to_ids('<|user|>')])
21 # or in eager mode
22 x = tokenizer.apply_chat_template([{"role": "user", "content": p}],
23 return_tensors='pt', padding='do_not_pad', add_generation_prompt=True)
24 out = model.generate_naive(x.to(model.args.device), top_k=3, n_beams=3, termination_tokens=[tokenizer.convert_tokens_to_ids('<eos>'), tokenizer.convert_tokens_to_ids('<|user|>')])
25 print(tokenizer.decode(out[0]))
26batch_prompts = [[{"role": "user", "content": p}] for p in prompts]
27x = tokenizer.apply_chat_template(batch_prompts, padding='do_not_pad', add_generation_prompt=True)
28out = model.generate_kv_cache(x, termination_tokens=[tokenizer.convert_tokens_to_ids('<eos>'), tokenizer.convert_tokens_to_ids('<|user|>')])
29for o in out:
30 print(tokenizer.decode(o).replace('<pad>', ''))
31model.clear_cache() # clears the kv cache
32# generate as parallel search with kv cache
33batch_prompts = [[{"role": "user", "content": "Who is Geralt?"}] for _ in range(3)]
34x = tokenizer.apply_chat_template(batch_prompts, padding='do_not_pad', add_generation_prompt=True)
35out = model.generate_kv_cache(x, termination_tokens=[tokenizer.convert_tokens_to_ids('<eos>'), tokenizer.convert_tokens_to_ids('<|user|>')], beam_search=True, top_p=0.3)
36print(tokenizer.decode(out).replace('<pad>', ''))