File size: 564 Bytes
b14eeac
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from transformers import AutoTokenizer, AutoModelForCausalLM

tokenizer = AutoTokenizer.from_pretrained("./")
model = AutoModelForCausalLM.from_pretrained("./")
#prompt = f"""பாடல்:
#நின்றன நின்றன நில்லா"""
prompt = f"""இன்னாமை வேண்டின்"""
input_ids = tokenizer(prompt, return_tensors="pt").input_ids

generation_output = model.generate(
    input_ids=input_ids, max_new_tokens=256, repetition_penalty=1.4, temperature=0.01, do_sample=False
)
print(tokenizer.decode(generation_output[0]))