Skip to content

Commit 7e30e49

Browse files
chore: bumped version
fix: resolved failing tests zero-shot
1 parent 58fb254 commit 7e30e49

6 files changed

Lines changed: 1591 additions & 1273 deletions

File tree

.pre-commit-config.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@ repos:
77
rev: 22.3.0
88
hooks:
99
- id: black
10-
# Execute isort on all changed files (make sure the version is the same as in pyproject)
11-
- repo: https://github.com/pycqa/isort
12-
rev: 5.10.1
13-
hooks:
14-
- id: isort
10+
1511
# Execute flake8 on all changed files (make sure the version is the same as in pyproject)
1612
- repo: https://github.com/pycqa/flake8
1713
rev: 4.0.1

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Classy Classification
2-
Have you every struggled with needing a [Spacy TextCategorizer](https://spacy.io/api/textcategorizer) but didn't have the time to train one from scratch? Classy Classification is the way to go! For few-shot classification using [sentence-transformers](https://github.com/UKPLab/sentence-transformers) or [spaCy models](https://spacy.io/usage/models), provide a dictionary with labels and examples, or just provide a list of labels for zero shot-classification with [Hugginface zero-shot classifiers](https://huggingface.co/models?pipeline_tag=zero-shot-classification).
2+
Have you ever struggled with needing a [Spacy TextCategorizer](https://spacy.io/api/textcategorizer) but didn't have the time to train one from scratch? Classy Classification is the way to go! For few-shot classification using [sentence-transformers](https://github.com/UKPLab/sentence-transformers) or [spaCy models](https://spacy.io/usage/models), provide a dictionary with labels and examples, or just provide a list of labels for zero shot-classification with [Hugginface zero-shot classifiers](https://huggingface.co/models?pipeline_tag=zero-shot-classification).
33

44
[![Current Release Version](https://img.shields.io/github/release/pandora-intelligence/classy-classification.svg?style=flat-square&logo=github)](https://github.com/pandora-intelligence/classy-classification/releases)
55
[![pypi Version](https://img.shields.io/pypi/v/classy-classification.svg?style=flat-square&logo=pypi&logoColor=white)](https://pypi.org/project/classy-classification/)
@@ -9,7 +9,7 @@ Have you every struggled with needing a [Spacy TextCategorizer](https://spacy.io
99
# Install
1010
``` pip install classy-classification```
1111

12-
or install with faster inference using onnx.
12+
Or, install with faster inference using ONNX.
1313

1414
``` pip install classy-classification[onnx]```
1515

@@ -19,6 +19,7 @@ or install with faster inference using onnx.
1919

2020
ONNX does show some issues when pickling the data.
2121
### M1
22+
2223
Some [installation issues](https://github.com/onnx/onnx/issues/3129) might occur, which can be fixed by these commands.
2324

2425
```

classy_classification/classifiers/classy_skeleton.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ def __init__(
5252

5353
self.multi_label = multi_label
5454

55-
self.data = collections.OrderedDict(sorted(data.items()))
55+
if isinstance(data, dict):
56+
self.data = collections.OrderedDict(sorted(data.items()))
57+
elif isinstance(data, list): # in case of zero-shot classification
58+
self.data = data
5659

5760
self.name = name
5861
self.nlp = nlp

classy_classification/classifiers/classy_standalone.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ def __init__(
6060
}.
6161
"""
6262
self.multi_label = multi_label
63-
self.data = collections.OrderedDict(sorted(data.items()))
63+
if isinstance(data, dict):
64+
self.data = collections.OrderedDict(sorted(data.items()))
65+
elif isinstance(data, list): # in case of zero-shot classification
66+
self.data = data
6467
self.model = model
6568
self.device = device
6669
self.verbose = verbose

0 commit comments

Comments
 (0)