heegyu's picture
Update README.md
25f4b57 verified
|
raw
history blame
607 Bytes
metadata
library_name: transformers
license: apache-2.0
datasets:
  - GAIR/lima
from transformers import AutoTokenizer, AutoModelForCausalLM

model_id = "heegyu/Mistral-7B-v0.1-lima"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)

chat = [
    { "role": "user", "content": "Write a hello world program in Rust" },
]
inputs = tokenizer.apply_chat_template(chat, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(input_ids=inputs, max_new_tokens=256)
print(tokenizer.decode(outputs[0]))