Downloads · 30 days
18
14% of all-time downloads
QuietImpostor/OpenELM-270M-Instruct-SonnOpus
OpenELM-270M-Instruct-SonnOpus is a text generation model from QuietImpostor. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apple-ascl.
- Model Name: Fine-tuned OpenELM-270M - Model Type: Causal Language Model - Base Model: Apple/OpenELM-270M-Instruct - Model Architecture: Transformer-based language model - Parameters: 270 million - Language(s): English
Downloads · 30 days
18
14% of all-time downloads
All-time downloads
130
Public
Parameters
272M
1.1 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors1.1 GB · 100%
From the Hugging Face model README
OpenELM-270M is based on the transformer architecture, specifically designed for efficient language modeling. It uses a 270 million parameter configuration, which is relatively small compared to many modern language models.
This model is fine-tuned for general conversation and task completion. It is designed to engage in dialogue and provide information across a wide range of topics.
The model was fine-tuned on a synthetic dataset derived from GPT-4 (for user queries) and Claude 3 Opus and Claude 3.5 Sonnet (for responses). This high-quality synthetic dataset covers a wide range of topics and task types.
Detailed evaluation results are not available, but the model showed consistent improvement in loss throughout training.
<|begin_of_text|>
<|start_header_id|>system<|end_header_id|>[system_message]<|eot_id|>
<|start_header_id|>user<|end_header_id|>[user_input]<|eot_id|>
<|start_header_id|>assistant<|end_header_id|>
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_path = "QuietImpostor/OpenELM-270M-Instruct-SonnOpus"
model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.float16, trust_remote_code=True)
tokenizer = AutoTokenizer.from_pretrained(model_path)
def generate_response(prompt, max_length=256):
inputs = tokenizer(prompt, return_tensors="pt", padding=True, truncation=True)
with torch.no_grad():
output = model.generate(
**inputs,
max_length=max_length,
num_return_sequences=1,
temperature=0.7,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(output[0], skip_special_tokens=True)
return response.strip()
# Example usage
system_msg = "You are a helpful AI assistant."
user_input = "Hello, how are you?"
prompt = f"<|begin_of_text|><|start_header_id|>system<|end_header_id|>{system_msg}<|eot_id|><|start_header_id|>user<|end_header_id|>{user_input}<|eot_id|><|start_header_id|>assistant<|end_header_id|>"
response = generate_response(prompt)
print(response)