You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+60-22Lines changed: 60 additions & 22 deletions
Original file line number
Diff line number
Diff line change
@@ -188,6 +188,7 @@ SELECT pgml.transform(
188
188
## Text Classification
189
189
190
190
Text classification involves assigning a label or category to a given text. Common use cases include sentiment analysis, natural language inference, and the assessment of grammatical correctness.
@@ -217,7 +218,7 @@ The default <a href="https://huggingface.co/distilbert-base-uncased-finetuned-ss
217
218
218
219
*Using specific model*
219
220
220
-
To use one of the over 19,000 models available on Hugging Face, include the name of the desired model and its associated task as a JSONB object in the SQL query. For example, if you want to use a RoBERTa <ahref="https://huggingface.co/models?pipeline_tag=text-classification"target="_blank">model</a> trained on around 40,000 English tweets and that has POS (positive), NEG (negative), and NEU (neutral) labels for its classes, include this information in the JSONB object when making your query.
221
+
To use one of the over 19,000 models available on Hugging Face, include the name of the desired model and `text-classification` task as a JSONB object in the SQL query. For example, if you want to use a RoBERTa <ahref="https://huggingface.co/models?pipeline_tag=text-classification"target="_blank">model</a> trained on around 40,000 English tweets and that has POS (positive), NEG (negative), and NEU (neutral) labels for its classes, include this information in the JSONB object when making your query.
221
222
222
223
```sql
223
224
SELECTpgml.transform(
@@ -276,7 +277,7 @@ NLI, or Natural Language Inference, is a type of model that determines the relat
276
277
277
278
The GLUE dataset is the benchmark dataset for evaluating NLI models. There are different variants of NLI models, such as Multi-Genre NLI, Question NLI, and Winograd NLI.
278
279
279
-
If you want to use an NLI model, you can find them on the :hugs: Hugging Face model hub. Look for models with "nli" or "mnli".
280
+
If you want to use an NLI model, you can find them on the :hugs: Hugging Face model hub. Look for models with "mnli".
280
281
281
282
```sql
282
283
SELECTpgml.transform(
@@ -324,7 +325,7 @@ SELECT pgml.transform(
324
325
### Quora Question Pairs (QQP)
325
326
The Quora Question Pairs model is designed to evaluate whether two given questions are paraphrases of each other. This model takes the two questions and assigns a binary value as output. LABEL_0 indicates that the questions are paraphrases of each other and LABEL_1 indicates that the questions are not paraphrases. The benchmark dataset used for this task is the Quora Question Pairs dataset within the GLUE benchmark, which contains a collection of question pairs and their corresponding labels.
326
327
327
-
If you want to use an QQP model, you can find them on the :hugs: Hugging Face model hub. Look for models with "qqp".
328
+
If you want to use an QQP model, you can find them on the :hugs: Hugging Face model hub. Look for models with `qqp`.
328
329
329
330
```sql
330
331
SELECTpgml.transform(
@@ -349,7 +350,7 @@ SELECT pgml.transform(
349
350
### Grammatical Correctness
350
351
Linguistic Acceptability is a task that involves evaluating the grammatical correctness of a sentence. The model used for this task assigns one of two classes to the sentence, either "acceptable" or "unacceptable". LABEL_0 indicates acceptable and LABEL_1 indicates unacceptable. The benchmark dataset used for training and evaluating models for this task is the Corpus of Linguistic Acceptability (CoLA), which consists of a collection of texts along with their corresponding labels.
351
352
352
-
If you want to use a grammatical correctness model, you can find them on the :hugs: Hugging Face model hub. Look for models with "cola".
353
+
If you want to use a grammatical correctness model, you can find them on the :hugs: Hugging Face model hub. Look for models with `cola`.
353
354
354
355
```sql
355
356
SELECTpgml.transform(
@@ -369,23 +370,60 @@ SELECT pgml.transform(
369
370
{"label": "LABEL_1", "score": 0.9576480388641356}
370
371
]
371
372
```
372
-
### Token Classification
373
-
### Table Question Answering
374
-
### Question Answering
375
-
### Zero-Shot Classification
376
-
### Translation
377
-
### Summarization
378
-
### Conversational
379
-
### Text Generation
380
-
### Text2Text Generation
381
-
### Fill-Mask
382
-
### Sentence Similarity
383
-
384
-
## Regression
385
-
## Classification
386
-
387
-
## Applications
388
-
### Text
373
+
374
+
## Zero-Shot Classification
375
+
Zero Shot Classification is a task where the model predicts a class that it hasn't seen during the training phase. This task leverages a pre-trained language model and is a type of transfer learning. Transfer learning involves using a model that was initially trained for one task in a different application. Zero Shot Classification is especially helpful when there is a scarcity of labeled data available for the specific task at hand.
In the example provided below, we will demonstrate how to classify a given sentence into a class that the model has not encountered before. To achieve this, we make use of `args` in the SQL query, which allows us to provide `candidate_labels`. You can customize these labels to suit the context of your task. We will use `facebook/bart-large-mnli` model.
380
+
381
+
Look for models with `mnli` to use a zero-shot classification model on the :hugs: Hugging Face model hub.
382
+
383
+
```sql
384
+
SELECTpgml.transform(
385
+
inputs => ARRAY[
386
+
'I have a problem with my iphone that needs to be resolved asap!!'
0 commit comments