Downloads · 30 days
0
crpatel/SmolLM2-135M-cosmopedia2-70kSteps
SmolLM2-135M-cosmopedia2-70kSteps is a machine learning model from crpatel. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as mit.
- SmolLM2-135M is a 135M parameter model based on the Llama 3 architecture. - It is trained on the Cosmopedia-2 dataset. - Purpose of this model is to train SmolLm2 Transformer model from scratch, I trained for 10 hou…
Downloads · 30 days
0
Access
Public
Updated Jan 31, 2025
Repo size
538 MB
Likes
0
Public
Click a slice to open those files.
.pt538 MB · 100%
From the Hugging Face model README
import torch
from transformers import AutoTokenizer
from huggingface_hub import hf_hub_download
from SmolLm3 import LlamaModel
import yaml
# Download the model file
model_path = hf_hub_download(
repo_id="crpatel/SmolLM2-135M-cosmopedia2-70kSteps",
filename="model.pt"
)
config = yaml.load(open('config_smollm2_135M.yaml', "r"), Loader=yaml.FullLoader)
model = LlamaModel(config['model'])
model.load_state_dict(torch.load(model_path, map_location='cpu'))
tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/cosmo2-tokenizer")
# cpu = torch.device('cpu')
encoded_text = tokenizer.encode('Once Upon time ', return_tensors="pt").to('cpu')
print(encoded_text)
generated_text2=model.generate(idx=encoded_text, max_new_tokens=100, context_length=50,
temperature=0.9,
top_k=2, eos_token=tokenizer.eos_token_id,
device='cpu')
decoded_text2=tokenizer.decode(generated_text2.squeeze(0))
print(decoded_text2)