模型:

VietAI/gpt-neo-1.3B-vietnamese-news

英文

GPT-Neo 1.3B在越南新闻中的应用

详细信息即将发布。

欲了解更多信息,请联系 anhduongng.1001@gmail.com(Dương)/ imthanhlv@gmail.com(Thành)/ nguyenvulebinh@gmail.com(Bình)。

如何使用

from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("VietAI/gpt-neo-1.3B-vietnamese-news")
model = AutoModelForCausalLM.from_pretrained("VietAI/gpt-neo-1.3B-vietnamese-news", low_cpu_mem_usage=True)

device = torch.device("cuda" if torch.cuda.is_available() else "cpu") 
model.to(device)

prompt = "Tiềm năng của trí tuệ nhân tạo" # your input sentence
input_ids = tokenizer(prompt, return_tensors="pt")['input_ids'].to(device)

gen_tokens = model.generate(
        input_ids,
        max_length=max_length,
        do_sample=True,
        temperature=0.9,
        top_k=20,
    )

gen_text = tokenizer.batch_decode(gen_tokens)[0]
print(gen_text)