Views
No views yet
1model = T5ForConditionalGeneration.from_pretrained("motasem/T_ETA")
2tokenizer = T5Tokenizer.from_pretrained("motasem/T_ETA")
3
4# Test the model
5input_text = "Jordan, an Arab nation on the east bank of the Jordan River, is defined by ancient monuments, nature reserves and seaside resorts, It's home to the famed archaeological site of Petra, the Nabatean capital dating to around 300 BC, Set in a narrow valley with tombs, temples and monuments carved into the surrounding pink sandstone cliffs, Petra earns its nickname, the Rose City."
6input_ids = tokenizer.encode("SR: "+ input_text, return_tensors="pt",max_length=1024,truncation=True)
7output_ids = model.generate(input_ids,
8 max_length=1024,
9 num_beams=3,
10 no_repeat_ngram_size=6,
11 pad_token_id = tokenizer.eos_token_id,
12 num_return_sequences=1,
13 early_stopping=True)
14
15output_text = tokenizer.decode(output_ids[0],
16 max_length=1024,
17 truncation=True,
18 skip_special_tokens=False,
19 clean_up_tokenization_space=True,
20 padding=True)
21print(output_text)
22