Ejemplo de traducción de texto a SQL con transformadores Huggingface

May 01 2023
Reentrenamiento del modelo base T5 con el conjunto de datos WikiSQL en la GPU NVIDIA TESLA P100 de Kaggle
En este artículo, sigo de cerca el cuaderno detallado de Manuel Romero con ajustes menores, como reemplazar el modelo pequeño T5 con el modelo base T5 (aumentando así la cantidad de parámetros entrenables de 60M a aproximadamente 223M). Los detalles completos del análisis se pueden encontrar en este cuaderno público de Kaggle.
Foto de Caspar Camille Rubin en Unsplash

En este artículo, sigo de cerca el cuaderno detallado de Manuel Romero con ajustes menores, como reemplazar el modelo pequeño T5 con el modelo base T5 (aumentando así la cantidad de parámetros entrenables de 60M a aproximadamente 223M ). Los detalles completos del análisis se pueden encontrar en este cuaderno público de Kaggle .

Como resultado del entrenamiento durante 5 épocas (tomando alrededor de 2 horas de GPU NVIDIA TESLA P100 disponible para usuarios de Kaggle ), el Fscore ROUGE2 correspondiente es de aproximadamente 0.7904 , o 2.86 puntos porcentuales más alto que el obtenido en el portátil inicial :

Fuente: autor, text2sql_T5_retrain | Kaggle

Algunos de los ejemplos predichos de traducción de texto a SQL realizados por el modelo entrenado, junto con las consultas SQL esperadas:

translate to SQL: What is terrence ross' nationality
Predicted: SELECT Nationality FROM table WHERE Player = Terrence Ross
Expected: SELECT Nationality FROM table WHERE Player = Terrence Ross

translate to SQL: how many schools or teams had jalen rose
Predicted: SELECT COUNT School/Club Team FROM table WHERE Player = Jalen Rose
Expected: SELECT COUNT School/Club Team FROM table WHERE Player = Jalen Rose

translate to SQL: What was the date of the race in Misano?
Predicted: SELECT Date FROM table WHERE Location = misano
Expected: SELECT Date FROM table WHERE Circuit = Misano

translate to SQL: How many different college/junior/club teams provided a player to the Washington Capitals NHL Team?
Predicted: SELECT COUNT College/junior/club team FROM table WHERE NHL Team = Washington Capitals
Expected: SELECT COUNT College/junior/club team FROM table WHERE NHL team = Washington Capitals

translate to SQL: What is the nationality of the player from Vancouver Canucks?
Predicted: SELECT Nationality FROM table WHERE NHL team = Vancouver Canucks
Expected: SELECT Nationality FROM table WHERE NHL team = Vancouver Canucks

translate to SQL: List the # for ships commissioned on december 18, 1965.
Predicted: SELECT # FROM table WHERE Commissioned = December 18, 1965
Expected: SELECT # FROM table WHERE Commissioned = December 18, 1965

translate to SQL:  What could a spanish coronel be addressed as in the commonwealth military?
Predicted: SELECT Address FROM table WHERE Country = commonwealth military AND Language = spanish coronel
Expected: SELECT Commonwealth equivalent FROM table WHERE Rank in Spanish = Coronel

translate to SQL: If you're a major general in the US air force then what ranking will you receive in the commonwealth's air force?
Predicted: SELECT Air Force Ranking FROM table WHERE Major General = US Air Force
Expected: SELECT Commonwealth equivalent FROM table WHERE US Air Force equivalent = Major General

Espero que estos resultados te puedan ser de utilidad. En caso de preguntas/comentarios, no dude en escribir en los comentarios a continuación o comuníquese conmigo directamente a través de LinkedIn o Twitter .

También puedes suscribirte a mis nuevos artículos o convertirte en un miembro recomendado de Medium .