Instruction-Tuned Language Model
This repository contains an instruction-tuned causal language model for text generation and chat-style prompts.
Model details
- Type: causal language model
- Parameters: approximately 1.54 billion
- Non-embedding parameters: approximately 1.31 billion
- Layers: 28
- Architecture: rotary position embeddings, gated feed-forward layers, RMS normalization, attention query/key/value bias, and tied word embeddings
- Attention: grouped-query attention with 12 query heads and 2 key/value heads
- Context length: 32,768 tokens, with generation up to 8,192 tokens
- Languages: multilingual text generation
Requirements
Use a recent version of transformers that supports this model architecture.
Quickstart
The following example loads the model from this repository and generates a response.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "latent-artist/66c200392ff148279a5995ef1455d3de"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Give me a short introduction to large language models."
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]