Downloads · 30 days
0
crpatel/DeepSeek-V3-SmolLm2
DeepSeek-V3-SmolLm2 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 integrade DeepSeek Architecture Components Like MultiHeadLatentAtt…
Downloads · 30 days
0
Access
Public
Updated Mar 10, 2025
Repo size
1.5 GB
Likes
0
Public
Click a slice to open those files.
.pt1.5 GB · 100%
From the Hugging Face model README
import torch
from transformers import AutoTokenizer
from huggingface_hub import hf_hub_download
from deepseek_v3 import DeepSeekV3Model
import yaml
# Download the model file
model_path = hf_hub_download(
repo_id="crpatel/DeepSeek-V3-SmolLm2",
filename="model.pt"
)
# Load configuration
config = yaml.load(open('config_smollm2_135M.yaml', "r"), Loader=yaml.FullLoader)
# Initialize model
model = DeepSeekV3Model(config['model'])
model.load_state_dict(torch.load(model_path, map_location='cpu'))
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("HuggingFaceTB/cosmo2-tokenizer")
# Encode input text
encoded_text = tokenizer.encode('Once Upon time ', return_tensors="pt").to('cpu')
print(encoded_text)
# Generate text
generated_text = 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'
)
# Decode and print the generated text
decoded_text = tokenizer.decode(generated_text.squeeze(0))
print(decoded_text)