Downloads · 30 days
9
33% of all-time downloads
Talha01/LLMModel
LLMModel is a text generation model from Talha01. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
1. Model Summary 2. Limitations 3. Training 4. License 5. Citation
Downloads · 30 days
9
33% of all-time downloads
All-time downloads
27
Public
Parameters
135M
1.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.onnx1.3 GB · 83%
From the Hugging Face model README
pip install transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
checkpoint = "HuggingFaceTB/SmolLM2-135M-Instruct"
device = "cuda" # for GPU usage or "cpu" for CPU usage
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
# for multiple GPUs install accelerate and do `model = AutoModelForCausalLM.from_pretrained(checkpoint, device_map="auto")`
model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
messages = [{"role": "user", "content": "What is gravity?"}]
input_text=tokenizer.apply_chat_template(messages, tokenize=False)
print(input_text)
inputs = tokenizer.encode(input_text, return_tensors="pt").to(device)
outputs = model.generate(inputs, max_new_tokens=50, temperature=0.2, top_p=0.9, do_sample=True)
print(tokenizer.decode(outputs[0]))