Views
No views yet

1# pip install -q transformers
2from transformers import AutoModelForCausalLM, AutoTokenizer
3
4model = "HuggingFaceTB/FineMath-Llama-3B"
5device = "cuda" # for GPU usage or "cpu" for CPU usage
6
7tokenizer = AutoTokenizer.from_pretrained(model)
8model = AutoModelForCausalLM.from_pretrained(model).to(device)
9
10inputs = tokenizer.encode("Machine Learning is", return_tensors="pt").to(device)
11outputs = model.generate(inputs)
12print(tokenizer.decode(outputs[0]))lighteval. You can find the details here: https://github.com/huggingface/smollm/tree/main/evaluation#smollm2-base-models1@misc{allal2025smollm2smolgoesbig,
2 title={SmolLM2: When Smol Goes Big -- Data-Centric Training of a Small Language Model},
3 author={Loubna Ben Allal and Anton Lozhkov and Elie Bakouch and Gabriel Martín Blázquez and Guilherme Penedo and Lewis Tunstall and Andrés Marafioti and Hynek Kydlíček and Agustín Piqueres Lajarín and Vaibhav Srivastav and Joshua Lochner and Caleb Fahlgren and Xuan-Son Nguyen and Clémentine Fourrier and Ben Burtenshaw and Hugo Larcher and Haojun Zhao and Cyril Zakka and Mathieu Morlon and Colin Raffel and Leandro von Werra and Thomas Wolf},
4 year={2025},
5 eprint={2502.02737},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2502.02737},
9}