Spaces:
Paused
Paused
from transformers import AutoTokenizer, AutoModelForCausalLM, pipeline | |
import torch | |
tokenizer = AutoTokenizer.from_pretrained("lightblue/ao-karasu-72B") | |
model = AutoModelForCausalLM.from_pretrained("lightblue/ao-karasu-72B", device_map="auto") | |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer) | |
messages = [{"role": "system", "content": "あなたはAIアシスタントです。"}] | |
messages.append({"role": "user", "content": "イギリスの首相は誰ですか?"}) | |
prompt = tokenizer.apply_chat_template(conversation=messages, add_generation_prompt=True, tokenize=False) | |
pipe(prompt, max_new_tokens=100, do_sample=False, temperature=0.0, return_full_text=False) | |