Actualmente, el motor de NLP de MindsDB está impulsado por Hugging Face y OpenAI. Pero planeamos expandirnos a otras opciones de NLP en el futuro, ¡así que estén atentos!
El motor de Hugging Face de MindsDB es extensible. Estamos trabajando activamente en agregar más tareas y modelos.
Si tienes una tarea o modelo específico en mente, háganoslo saber en la Comunidad de MindsDB.
Ejemplos de Hugging Face
Aquí están las tareas soportadas por MindsDB y Hugging Face:- Clasificación de Texto
- Clasificación Zero-Shot
- Traducción
- Resumen
Clasificación de Texto
Spam
Spam
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_spam
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'mariagrandury/roberta-base-finetuned-sms-spam-detection',
input_column = 'text',
labels = ['spam', 'ham'];
Report incorrect code
Copy
Ask AI
DESCRIBE hf_spam;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_spam
WHERE text = 'I like you. I love you.';
Report incorrect code
Copy
Ask AI
+----+--------------------------------------------------------+-----------------------+
|PRED|PRED_explain |text |
+----+--------------------------------------------------------+-----------------------+
|spam|{"ham":0.00020051795581821352,"spam":0.9997995495796204}|I like you. I love you.|
+----+--------------------------------------------------------+-----------------------+
Sentimiento
Sentimiento
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_sentiment
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'cardiffnlp/twitter-roberta-base-sentiment',
input_column = 'text',
labels = ['neg', 'neu', 'pos'];
Report incorrect code
Copy
Ask AI
DESCRIBE hf_sentiment;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_sentiment
WHERE text = 'I like you. I love you.';
Report incorrect code
Copy
Ask AI
+----+--------------------------------------------------------------------------------+-----------------------+
|PRED|PRED_explain |text |
+----+--------------------------------------------------------------------------------+-----------------------+
|pos |{"neg":0.003046575468033552,"neu":0.021965451538562775,"pos":0.9749879240989685}|I like you. I love you.|
+----+--------------------------------------------------------------------------------+-----------------------+
Sentimiento (Finanzas)
Sentimiento (Finanzas)
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_sentiment_finance
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'ProsusAI/finbert',
input_column = 'text';
Report incorrect code
Copy
Ask AI
DESCRIBE hf_sentiment_finance;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_sentiment_finance
WHERE text = 'Stocks rallied and the British pound gained.';
Report incorrect code
Copy
Ask AI
+--------+-------------------------------------------------------------------------------------------+--------------------------------------------+
|PRED |PRED_explain |text |
+--------+-------------------------------------------------------------------------------------------+--------------------------------------------+
|positive|{"negative":0.0344734713435173,"neutral":0.06716493517160416,"positive":0.8983616232872009}|Stocks rallied and the British pound gained.|
+--------+-------------------------------------------------------------------------------------------+--------------------------------------------+
Emociones (6)
Emociones (6)
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_emotions_6
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'j-hartmann/emotion-english-distilroberta-base',
input_column = 'text';
Report incorrect code
Copy
Ask AI
DESCRIBE hf_emotions_6;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_emotions_6
WHERE text = 'Oh Happy Day';
Report incorrect code
Copy
Ask AI
+----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
|PRED|PRED_explain |text |
+----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
|joy |{"anger":0.0028446922078728676,"disgust":0.0009613594156689942,"fear":0.0007112706662155688,"joy":0.7692911624908447,"neutral":0.037753619253635406,"sadness":0.015293814241886139,"surprise":0.17314413189888}|Oh Happy Day|
+----+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
Toxicidad
Toxicidad
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_toxicity
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'SkolkovoInstitute/roberta_toxicity_classifier',
input_column = 'text';
Report incorrect code
Copy
Ask AI
DESCRIBE hf_toxicity;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_toxicity
WHERE text = 'I like you. I love you.';
Report incorrect code
Copy
Ask AI
+-------+-------------------------------------------------------------+-----------------------+
|PRED |PRED_explain |text |
+-------+-------------------------------------------------------------+-----------------------+
|neutral|{"neutral":0.9999547004699707,"toxic":0.00004535282641882077}|I like you. I love you.|
+-------+-------------------------------------------------------------+-----------------------+
ESG (6)
ESG (6)
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_esg_6
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'yiyanghkust/finbert-esg',
input_column = 'text';
Report incorrect code
Copy
Ask AI
DESCRIBE hf_esg_6;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT * FROM mindsdb.hf_esg_6
WHERE text = 'Rhonda has been volunteering for several years for a variety of charitable community programs.';
Report incorrect code
Copy
Ask AI
+------+---------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+
|PRED |PRED_explain |text |
+------+---------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+
|Social|{"Environmental":0.0034267122391611338,"Governance":0.004729956854134798,"None":0.001239194767549634,"Social":0.9906041026115417}|Rhonda has been volunteering for several years for a variety of charitable community programs.|
+------+---------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------+
ESG (26)
ESG (26)
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_esg_26
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'yiyanghkust/finbert-esg',
input_column = 'text';
Report incorrect code
Copy
Ask AI
DESCRIBE hf_esg_26;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_esg_26
WHERE text = 'We believe it is essential to establish validated conflict-free sources of 3TG within the Democratic Republic of the Congo (the “DRC”) and adjoining countries (together, with the DRC, the “Covered Countries”), so that these minerals can be procured in a way that contributes to economic growth and development in the region. To aid in this effort, we have established a conflict minerals policy and an internal team to implement the policy.';
Report incorrect code
Copy
Ask AI
+------+-----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|PRED |PRED_explain |text |
+------+-----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|Social|{"Environmental":0.2031959593296051,"Governance":0.08251894265413284,"None":0.050893042236566544,"Social":0.6633920073509216}|We believe it is essential to establish validated conflict-free sources of 3TG within the Democratic Republic of the Congo (the “DRC”) and adjoining countries (together, with the DRC, the “Covered Countries”), so that these minerals can be procured in a way that contributes to economic growth and development in the region. To aid in this effort, we have established a conflict minerals policy and an internal team to implement the policy.|
+------+-----------------------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Discurso de Odio
Discurso de Odio
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_hate
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'Hate-speech-CNERG/bert-base-uncased-hatexplain',
input_column = 'text';
Report incorrect code
Copy
Ask AI
DESCRIBE hf_hate;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_hate
WHERE text = 'I like you. I love you.';
Report incorrect code
Copy
Ask AI
+------+-----------------------------------------------------------------------------------------------+-----------------------+
|PRED |PRED_explain |text |
+------+-----------------------------------------------------------------------------------------------+-----------------------+
|normal|{"hate speech":0.03551718592643738,"normal":0.7747423648834229,"offensive":0.18974047899246216}|I like you. I love you.|
+------+-----------------------------------------------------------------------------------------------+-----------------------+
Señales de Compra de Criptomonedas
Señales de Compra de Criptomonedas
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_crypto
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'ElKulako/cryptobert',
input_column = 'text';
Report incorrect code
Copy
Ask AI
DESCRIBE hf_crypto;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_crypto
WHERE text = 'BTC is killing it right now';
Report incorrect code
Copy
Ask AI
+-------+------------------------------------------------------------------------------------------+---------------------------+
|PRED |PRED_explain |text |
+-------+------------------------------------------------------------------------------------------+---------------------------+
|Bullish|{"Bearish":0.0002816587220877409,"Bullish":0.559426486492157,"Neutral":0.4402918517589569}|BTC is killing it right now|
+-------+------------------------------------------------------------------------------------------+---------------------------+
Partido Político de EE.UU.
Partido Político de EE.UU.
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_us_party
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'm-newhauser/distilbert-political-tweets',
input_column = 'text';
Report incorrect code
Copy
Ask AI
DESCRIBE hf_us_party;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_us_party
WHERE text = 'This pandemic has shown us clearly the vulgarity of our healthcare system. Highest costs in the world, yet not enough nurses or doctors. Many millions uninsured, while insurance company profits soar. The struggle continues. Healthcare is a human right. Medicare for all.';
Report incorrect code
Copy
Ask AI
+--------+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|PRED |PRED_explain |text |
+--------+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|Democrat|{"Democrat":0.9999973773956299,"Republican":0.00000261212517216336}|This pandemic has shown us clearly the vulgarity of our healthcare system. Highest costs in the world, yet not enough nurses or doctors. Many millions uninsured, while insurance company profits soar. The struggle continues. Healthcare is a human right. Medicare for all.|
+--------+-------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Detección de Preguntas
Detección de Preguntas
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_question
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'shahrukhx01/bert-mini-finetune-question-detection',
input_column = 'text',
labels = ['question', 'query'];
Report incorrect code
Copy
Ask AI
DESCRIBE hf_question;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_question
WHERE text = 'Where can I buy electronics in London';
Report incorrect code
Copy
Ask AI
+-----+--------------------------------------------------------------+-------------------------------------+
|PRED |PRED_explain |text |
+-----+--------------------------------------------------------------+-------------------------------------+
|query|{"query":0.9997773766517639,"question":0.00022261829872149974}|Where can I buy electronics in London|
+-----+--------------------------------------------------------------+-------------------------------------+
Industria
Industria
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_industry
PREDICT PRED
USING
engine = 'huggingface',
task = 'text-classification',
model_name = 'sampathkethineedi/industry-classification',
input_column = 'text';
Report incorrect code
Copy
Ask AI
DESCRIBE hf_industry;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_industry
WHERE text = 'Low latency is one of our best cloud features';
Report incorrect code
Copy
Ask AI
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
|PRED |PRED_explain |text |
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
|Systems Software|{"Advertising":0.000006795735771447653,"Aerospace & Defense":0.00001537964453746099,"Apparel Retail":5.350161131900677e-7,"Apparel, Accessories & Luxury Goods":0.000002604161181807285,"Application Software":0.009111878462135792,"Asset Management & Custody Banks":0.00003155150625389069,"Auto Parts & Equipment":0.000015504940165556036,"Biotechnology":6.533917940032552e-8,"Building Products":7.348538133555849e-8,"Casinos & Gaming":0.000013775999832432717,"Commodity Chemicals":0.0000010432338513055583,"Communications Equipment":0.000019887389498762786,"Construction & Engineering":0.000001826199536480999,"Construction Machinery & Heavy Trucks":0.000009827364920056425,"Consumer Finance":0.0000018292046206624946,"Data Processing & Outsourced Services":0.0000010666744856280275,"Diversified Metals & Mining":0.000006960767223063158,"Diversified Support Services":0.000016824227714096196,"Electric Utilities":0.000003896044290740974,"Electrical Components & Equipment":0.000001626394464437908,"Electronic Equipment & Instruments":0.00003863943129545078,"Environmental & Facilities Services":0.000736175337806344,"Gold":0.00002220332135038916,"Health Care Equipment":4.6927588925882446e-8,"Health Care Facilities":7.432880124724761e-7,"Health Care Services":6.929263918209472e-7,"Health Care Supplies":2.1007431882935634e-7,"Health Care Technology":0.000003907185146090342,"Homebuilding":3.903339234057057e-7,"Hotels, Resorts & Cruise Lines":6.0527639789143e-7,"Human Resource & Employment Services":5.48697983049351e-7,"IT Consulting & Other Services":0.0000723653138265945,"Industrial Machinery":7.230253231682582e-7,"Integrated Telecommunication Services":2.8266379104024963e-7,"Interactive Media & Services":0.00003454017496551387,"Internet & Direct Marketing Retail":0.000003871373337460682,"Internet Services & Infrastructure":0.0007196652004495263,"Investment Banking & Brokerage":0.0000040634336073708255,"Leisure Products":0.000002158361439796863,"Life Sciences Tools & Services":0.000002861268058040878,"Movies & Entertainment":0.000007286199888767442,"Oil & Gas Equipment & Services":0.000004376991455501411,"Oil & Gas Exploration & Production":0.000005569149834627751,"Oil & Gas Refining & Marketing":0.000012647416951949708,"Oil & Gas Storage & Transportation":0.000005852583853993565,"Packaged Foods & Meats":0.0000011130315442642313,"Personal Products":0.00000970239307207521,"Pharmaceuticals":0.0000037546726616710657,"Property & Casualty Insurance":0.000006116194072092185,"Real Estate Operating Companies":0.00001882187461887952,"Regional Banks":0.0000011669454806906288,"Research & Consulting Services":0.000024276219846797176,"Restaurants":8.598511840318679e-7,"Semiconductors":0.0000021006283077440457,"Specialty Chemicals":0.000004160017397225602,"Specialty Stores":2.644004553076229e-7,"Steel":0.0000013566890402216814,"Systems Software":0.9889177083969116,"Technology Distributors":0.00001339179198112106,"Technology Hardware, Storage & Peripherals":0.00004790363891515881,"Thrifts & Mortgage Finance":3.924862141957419e-7,"Trading Companies & Distributors":0.0000035233156268077437}|Low latency is one of our best cloud features|
+----------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------+
Clasificación Zero-Shot
Bart
Bart
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_zs_bart
PREDICT PRED
USING
engine = 'huggingface',
task = 'zero-shot-classification',
model_name = 'facebook/bart-large-mnli',
input_column = 'text',
candidate_labels = ['Books', 'Household', 'Clothing & Accessories', 'Electronics'];
Report incorrect code
Copy
Ask AI
DESCRIBE hf_zs_bart;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_zs_bart
WHERE text = 'Paper Plane Design Framed Wall Hanging Motivational Office Decor Art Prints';
Report incorrect code
Copy
Ask AI
+---------+------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|PRED |PRED_explain |text |
+---------+------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
|Household|{"Books":0.1876104772090912,"Clothing & Accessories":0.08688066899776459,"Electronics":0.14785148203372955,"Household":0.5776574015617371}|Paper Plane Design Framed Wall Hanging Motivational Office Decor Art Prints|
+---------+------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------------------------------------------+
Traducción
Inglés a Francés (T5)
Inglés a Francés (T5)
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_t5_en_fr
PREDICT PRED
USING
engine = 'huggingface',
task = 'translation',
model_name = 't5-base',
input_column = 'text',
lang_input = 'en',
lang_output = 'fr';
Report incorrect code
Copy
Ask AI
DESCRIBE hf_t5_en_fr;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_t5_en_fr
WHERE text = 'The monkey is on the branch';
Report incorrect code
Copy
Ask AI
+---------------------------+---------------------------+
|PRED |text |
+---------------------------+---------------------------+
|Le singe est sur la branche|The monkey is on the branch|
+---------------------------+---------------------------+
Resumen
Bart
Bart
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_bart_sum_20
PREDICT PRED
USING
engine = 'huggingface',
task = 'summarization',
model_name = 'sshleifer/distilbart-cnn-12-6',
input_column = 'text',
min_output_length = 5,
max_output_length = 20;
Report incorrect code
Copy
Ask AI
DESCRIBE hf_bart_sum_20;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_bart_sum_20
WHERE text = 'The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.';
Report incorrect code
Copy
Ask AI
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|PRED |text |
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|The tower is 324 metres (1,063 ft) tall, about the same|The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.|
+-------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Google Pegasus
Google Pegasus
Vamos a crear un modelo.Y comprobemos su estado.Una vez que el estado es Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.hf_peg_sum_20
PREDICT PRED
USING
engine = 'huggingface',
task = 'summarization',
model_name = 'google/pegasus-xsum',
input_column = 'text',
min_output_length = 5,
max_output_length = 20;
Report incorrect code
Copy
Ask AI
DESCRIBE hf_peg_sum_20;
complete, podemos consultar para obtener predicciones.Report incorrect code
Copy
Ask AI
SELECT *
FROM mindsdb.hf_peg_sum_20
WHERE text = 'The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.';
Report incorrect code
Copy
Ask AI
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|PRED |text |
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|The Eiffel Tower is a landmark in Paris, France.|The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 metres. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 metres (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct.|
+------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Ejemplos de OpenAI
Aquí están las tareas soportadas por MindsDB y OpenAI:- Responder Preguntas sin Contexto
- Responder Preguntas con Contexto
- Completar Prompt
Sigue esta instrucción para configurar la integración de OpenAI en MindsDB.
Responder Preguntas sin Contexto
Responder Preguntas sin Contexto
Responder Preguntas sin Contexto
Vamos a crear un modelo.Al ejecutar, obtenemos:Ahora podemos consultar para obtener respuestas.Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL project_a.openai_test_a
PREDICT answer
USING
engine = 'openai',
question_column = 'question';
Report incorrect code
Copy
Ask AI
Query successfully completed
Report incorrect code
Copy
Ask AI
SELECT question, answer
FROM project_a.openai_test_a
WHERE question = 'Where is Stockholm located?';
Report incorrect code
Copy
Ask AI
+---------------------------+-------------------------------+
|question |answer |
+---------------------------+-------------------------------+
|Where is Stockholm located?|Stockholm is located in Sweden.|
+---------------------------+-------------------------------+
Responder Preguntas con Contexto
Responder Preguntas con Contexto
Responder Preguntas con Contexto
Vamos a crear un modelo.Al ejecutar, obtenemos:Ahora podemos consultar para obtener respuestas.Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL project_a.openai_test_b
PREDICT answer
USING
engine = 'openai',
question_column = 'question',
context_column = 'context';
Report incorrect code
Copy
Ask AI
Query successfully completed
Report incorrect code
Copy
Ask AI
SELECT context, question, answer
FROM project_a.openai_test_b
WHERE context = 'Answer with a joke'
AND question = 'How to cook soup?';
Report incorrect code
Copy
Ask AI
+-------------------+------------------+---------------------------------------------------------+
|context |question |answer |
+-------------------+------------------+---------------------------------------------------------+
|Answer with a joke |How to cook soup? |How do you cook soup? You put it in a pot and heat it up!|
+-------------------+------------------+---------------------------------------------------------+
Completar Prompt
Completar Prompt con Parámetros Proporcionados en el Momento de la Creación
Completar Prompt con Parámetros Proporcionados en el Momento de la Creación
Vamos a crear un modelo.Veamos un ejemplo que utiliza parámetros proporcionados en el momento de la creación del modelo.Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL project_a.openai_test_c
PREDICT answer
USING
engine = 'openai',
prompt_template = 'Context: {{context}}. Question: {{question}}. Answer:',
max_tokens = 100,
temperature = 0.3;
Report incorrect code
Copy
Ask AI
SELECT context, question, answer
FROM project_a.openai_test_c
WHERE context = 'Answer accurately'
AND question = 'How many planets exist in the solar system?';
Report incorrect code
Copy
Ask AI
+-------------------+-------------------------------------------+----------------------------------------------+
|context |question |answer |
+-------------------+-------------------------------------------+----------------------------------------------+
|Answer accurately |How many planets exist in the solar system?| There are eight planets in the solar system. |
+-------------------+-------------------------------------------+----------------------------------------------+
Completar Prompt con Parámetros Proporcionados en el Momento de la Predicción
Completar Prompt con Parámetros Proporcionados en el Momento de la Predicción
Vamos a crear un modelo.Veamos un ejemplo que anula los parámetros en el momento de la predicción.Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL project_a.openai_test_c
PREDICT answer
USING
engine = 'openai',
prompt_template = 'Context: {{context}}. Question: {{question}}. Answer:',
max_tokens = 100,
temperature = 0.3;
Report incorrect code
Copy
Ask AI
SELECT instruction, answer
FROM project_a.openai_test_c
WHERE instruction = 'Speculate extensively'
USING
prompt_template = '{{instruction}}. What does Tom Hanks like?',
max_tokens = 100,
temperature = 0.5;
Report incorrect code
Copy
Ask AI
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|instruction |answer |
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|Speculate extensively |Some people speculate that Tom Hanks likes to play golf, while others believe that he enjoys acting and directing. It is also speculated that he likes to spend time with his family and friends, and that he enjoys traveling.|
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
Clasificación de Sentimiento
Clasificación de Sentimiento
Vamos a crear un modelo.Ahora podemos consultar para obtener predicciones.Al ejecutar, obtenemos:
Report incorrect code
Copy
Ask AI
CREATE MODEL mindsdb.sentiment_classifier
PREDICT sentiment
USING
engine = 'openai',
prompt_template = 'predict the sentiment of the text:{{review}} exactly as either positive or negative or neutral';
Report incorrect code
Copy
Ask AI
SELECT output.sentiment, input.review
FROM example_db.demo_data.amazon_reviews AS input
JOIN mindsdb.sentiment_classifier AS output
LIMIT 3;
Report incorrect code
Copy
Ask AI
+----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| sentiment | review |
+----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| positive | Late gift for my grandson. He is very happy with it. Easy for him (9yo ). |
| The sentiment of the text is positive. | I'm not super thrilled with the proprietary OS on this unit, but it does work okay and does what I need it to do. Appearance is very nice, price is very good and I can't complain too much - just wish it were easier (or at least more obvious) to port new apps onto it. For now, it helps me see things that are too small on my phone while I'm traveling. I'm a happy buyer.|
| positive | I purchased this Kindle Fire HD 8 was purchased for use by 5 and 8 yer old grandchildren. They basically use it to play Amazon games that you download. |
+----------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
¿Qué sigue?
¡Diviértete mientras lo pruebas tú mismo!- Marca como favorito el repositorio de MindsDB en GitHub.
- Regístrese para obtener una cuenta gratuita de MindsDB.
- Interactúe con la comunidad de MindsDB en Slack o GitHub para hacer preguntas y compartir sus ideas y pensamientos.