File size: 710 Bytes
c3fcd8a
798e894
293f78e
c3fcd8a
798e894
293f78e
 
c3fcd8a
 
293f78e
 
 
c3fcd8a
293f78e
c3fcd8a
293f78e
 
c3fcd8a
293f78e
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import streamlit as st
from transformers import AutoModelForCausalLM

# TO-DD: ??? λΆ€λΆ„μ˜ μ½”λ“œλ₯Ό μ™„μ„±ν•˜μ‹œμ˜€
AutoModelForCausalLM = AutoModelForCausalLM.from_pretrained(task="translation", model="maywell/Synatra-7B-v0.3-Translation", tokenizer="maywell/Synatra-7B-v0.3-Translation")

device = "cuda" # the device to load the model onto


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])