Views
No views yet
8 |
| Evaluation batch size | 8 |
| Learning rate | 1e-4 |
| Max length input | 200 |
| Max length target | 3 |
| Number workers | 4 |
| Epoch | 2 |
| | |0.0479 |96.49% |
| BLeU | 96.49% |1from transformers import T5ForConditionalGeneration, T5Tokenizer
2
3model_name="Hezam/ArabicT5_Classification"
4model = T5ForConditionalGeneration.from_pretrained(model_name)
5tokenizer = T5Tokenizer.from_pretrained(model_name)
6
7text = "الزين فيك القناه الاولي المغربيه الزين فيك القناه الاولي المغربيه اخبارنا المغربيه متابعه تفاجا زوار موقع القناه الاولي المغربي"
8tokens=tokenizer(text, max_length=200,
9 truncation=True,
10 padding="max_length",
11 return_tensors="pt"
12 )
13
14output= model.generate(tokens['input_ids'],
15 max_length=3,
16 length_penalty=10)
17
18output = [tokenizer.decode(ids, skip_special_tokens=True,clean_up_tokenization_spaces=True)for ids in output]
19output
20['5']