File size: 498 Bytes
79e5945 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
---
license: artistic-2.0
---
pip install transformers torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("EleutherAI/gpt-j-6B")
model = AutoModelForCausalLM.from_pretrained("EleutherAI/gpt-j-6B")
input_text = "Xin chào! Bạn có thể giúp gì cho tôi?"
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
outputs = model.generate(input_ids, max_length=100)
print(tokenizer.decode(outputs[0], skip_special_tokens=True)) |