Update classify-dataset.py
#7
by
mit-ra
- opened
- classify-dataset.py +4 -3
classify-dataset.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
# /// script
|
| 3 |
-
# requires-python = "
|
| 4 |
# dependencies = [
|
| 5 |
-
# "
|
|
|
|
| 6 |
# "typer>=0.12,<1",
|
| 7 |
# "datasets",
|
| 8 |
# "huggingface-hub[hf_transfer]",
|
|
@@ -406,7 +407,7 @@ def classify(
|
|
| 406 |
zeroshot_tag = "zero-shot-classification"
|
| 407 |
# Explicitly designed for zero-shot classification: build directly as pipeline.
|
| 408 |
if info.pipeline_tag == zeroshot_tag or zeroshot_tag in set(info.tags or []):
|
| 409 |
-
logger.info("Initializing zero-shot
|
| 410 |
model = transformers.pipeline(zeroshot_tag, model=model, device=device)
|
| 411 |
# Otherwise: build Outlines model around it to enforce structured generation.
|
| 412 |
else:
|
|
|
|
| 1 |
#!/usr/bin/env python3
|
| 2 |
# /// script
|
| 3 |
+
# requires-python = "==3.12"
|
| 4 |
# dependencies = [
|
| 5 |
+
# "transformers[torch]>=4.35",
|
| 6 |
+
# "sieves[engines]>=0.17.4,<19",
|
| 7 |
# "typer>=0.12,<1",
|
| 8 |
# "datasets",
|
| 9 |
# "huggingface-hub[hf_transfer]",
|
|
|
|
| 407 |
zeroshot_tag = "zero-shot-classification"
|
| 408 |
# Explicitly designed for zero-shot classification: build directly as pipeline.
|
| 409 |
if info.pipeline_tag == zeroshot_tag or zeroshot_tag in set(info.tags or []):
|
| 410 |
+
logger.info("Initializing zero-shot classification pipeline.")
|
| 411 |
model = transformers.pipeline(zeroshot_tag, model=model, device=device)
|
| 412 |
# Otherwise: build Outlines model around it to enforce structured generation.
|
| 413 |
else:
|