Deep Learning para texto con PyTorch
Shubham Jain
Instructor
"- Las tareas de generación de texto crean texto similar al humano
"
{{1}}"
"- Compara el texto generado y el texto de referencia
"`python
from torchmetrics.text import BLEUScore
----CODE_GLUE---- ```python generated_text = ['the cat is on the mat'] real_text = [['there is a cat on the mat', 'a cat is on the mat']]bleu = BLEUScore() bleu_metric = bleu(generated_text, real_text) print(\"BLEU Score: \", bleu_metric.item())
out
BLEU Score: tensor(0.7598){{4}}"
"- Compara un texto generado con un texto de referencia de dos maneras
from torchmetrics.text import ROUGEScoregenerated_text='Hola, ¿cómo estás?' real_text= "Hola, ¿cómo estás?"rouge = ROUGEScore()rouge_score = rouge([generated_text], [[real_text]]) print("Puntuación ROUGE:", rouge_score)
"`out
Puntuación ROUGE: {'rouge1_fmeasure': tensor(0.8889),
'rouge1_precision': tensor(0.8000),
'rouge1_recall': tensor(1.),
----CODE_GLUE---- ```out 'rouge2_fmeasure': tensor(0.8571), 'rouge2_precision': tensor(0.7500), 'rouge2_recall': tensor(1.),'rougeL_fmeasure': tensor(0.8889), 'rougeL_precision': tensor(0.8000), 'rougeL_recall': tensor(1.),
----CODE_GLUE----
out
'rougeLsum_fmeasure': tensor(0.8889),
'rougeLsum_precision': tensor(0.8000),
'rougeLsum_recall': tensor(1.)}{{4}}"
"- Evalúa la presencia de palabras, no la comprensión semántica
Deep Learning para texto con PyTorch