Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
802984ad
Unverified
Commit
802984ad
authored
Mar 14, 2022
by
Omar Sanseviero
Committed by
GitHub
Mar 14, 2022
Browse files
Fix and document Zero Shot Image Classification (#16079)
parent
6e1e88fd
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
2 deletions
+4
-2
docs/source/main_classes/pipelines.mdx
docs/source/main_classes/pipelines.mdx
+1
-0
src/transformers/pipelines/__init__.py
src/transformers/pipelines/__init__.py
+2
-1
src/transformers/pipelines/zero_shot_image_classification.py
src/transformers/pipelines/zero_shot_image_classification.py
+1
-1
No files found.
docs/source/main_classes/pipelines.mdx
View file @
802984ad
...
@@ -39,6 +39,7 @@ There are two categories of pipeline abstractions to be aware about:
...
@@ -39,6 +39,7 @@ There are two categories of pipeline abstractions to be aware about:
- [`TokenClassificationPipeline`]
- [`TokenClassificationPipeline`]
- [`TranslationPipeline`]
- [`TranslationPipeline`]
- [`ZeroShotClassificationPipeline`]
- [`ZeroShotClassificationPipeline`]
- [`ZeroShotImageClassificationPipeline`]
## The pipeline abstraction
## The pipeline abstraction
...
...
src/transformers/pipelines/__init__.py
View file @
802984ad
...
@@ -245,7 +245,7 @@ SUPPORTED_TASKS = {
...
@@ -245,7 +245,7 @@ SUPPORTED_TASKS = {
"impl"
:
ZeroShotImageClassificationPipeline
,
"impl"
:
ZeroShotImageClassificationPipeline
,
"tf"
:
(
TFAutoModel
,)
if
is_tf_available
()
else
(),
"tf"
:
(
TFAutoModel
,)
if
is_tf_available
()
else
(),
"pt"
:
(
AutoModel
,)
if
is_torch_available
()
else
(),
"pt"
:
(
AutoModel
,)
if
is_torch_available
()
else
(),
"default"
:
{
"pt"
:
"openai/clip-vit-base-patch32"
,
"tf"
:
"openai/clip-vit-base-patch32"
},
"default"
:
{
"model"
:
{
"pt"
:
"openai/clip-vit-base-patch32"
,
"tf"
:
"openai/clip-vit-base-patch32"
}
}
,
"type"
:
"multimodal"
,
"type"
:
"multimodal"
,
},
},
"conversational"
:
{
"conversational"
:
{
...
@@ -346,6 +346,7 @@ def check_task(task: str) -> Tuple[Dict, Any]:
...
@@ -346,6 +346,7 @@ def check_task(task: str) -> Tuple[Dict, Any]:
- `"translation_xx_to_yy"`
- `"translation_xx_to_yy"`
- `"summarization"`
- `"summarization"`
- `"zero-shot-classification"`
- `"zero-shot-classification"`
- `"zero-shot-image-classification"`
Returns:
Returns:
(task_defaults`dict`, task_options: (`tuple`, None)) The actual dictionary required to initialize the pipeline
(task_defaults`dict`, task_options: (`tuple`, None)) The actual dictionary required to initialize the pipeline
...
...
src/transformers/pipelines/zero_shot_image_classification.py
View file @
802984ad
...
@@ -35,7 +35,7 @@ class ZeroShotImageClassificationPipeline(ChunkPipeline):
...
@@ -35,7 +35,7 @@ class ZeroShotImageClassificationPipeline(ChunkPipeline):
`"zero-shot-image-classification"`.
`"zero-shot-image-classification"`.
See the list of available models on
See the list of available models on
[huggingface.co/models](https://huggingface.co/models?filter=zer-shot-image-classification).
[huggingface.co/models](https://huggingface.co/models?filter=zer
o
-shot-image-classification).
"""
"""
def
__init__
(
self
,
**
kwargs
):
def
__init__
(
self
,
**
kwargs
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment