CoolFace
Modelpublic

latent-artist/f142c54d3ea54565a5ce95f881497e41

sourceHugging Faceapache-2.0updated 9d agoView on Hugging Face
0likes2.6kdownloads
Model Card

Instruction-Tuned Causal Language Model

This repository provides an instruction-tuned causal language model for text generation and chat-style prompts.

The configured snapshot destination is available here.

Quickstart

Use a current release of transformers to load the model and tokenizer:

python
from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "latent-artist/f142c54d3ea54565a5ce95f881497e41"

model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained(model_name)

messages = [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Give me a short introduction to large language models."},
]
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]
print(response)

For long inputs, use context settings supported by the installed runtime and account for available memory. See LICENSE for the applicable terms.