|
import streamlit as st |
|
from transformers import AutoModelForCausalLM |
|
|
|
|
|
AutoModelForCausalLM = AutoModelForCausalLM.from_pretrained(task="translation", model="maywell/Synatra-7B-v0.3-Translation", tokenizer="maywell/Synatra-7B-v0.3-Translation") |
|
|
|
device = "cuda" |
|
|
|
|
|
messages = [ |
|
{"role": "user", "content": "λ°λλλ μλ νμμμ΄μΌ?"}, |
|
] |
|
|
|
encodeds = tokenizer.apply_chat_template(messages, return_tensors="pt") |
|
|
|
model_inputs = encodeds.to(device) |
|
model.to(device) |
|
|
|
generated_ids = model.generate(model_inputs, max_new_tokens=1000, do_sample=True) |
|
decoded = tokenizer.batch_decode(generated_ids) |
|
print(decoded[0]) |