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