Zero-Shot Image Classification
Transformers
Safetensors
tipsv2
feature-extraction
vision
image-text
contrastive-learning
zero-shot
custom_code
Instructions to use google/tipsv2-b14 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/tipsv2-b14 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-image-classification", model="google/tipsv2-b14", trust_remote_code=True) pipe( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png", candidate_labels=["animals", "humans", "landscape"], )# Load model directly from transformers import AutoProcessor, AutoModel processor = AutoProcessor.from_pretrained("google/tipsv2-b14", trust_remote_code=True) model = AutoModel.from_pretrained("google/tipsv2-b14", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Support sentencepiece 0.2.2 in text tokenizer
Browse files- text_encoder.py +0 -2
text_encoder.py
CHANGED
|
@@ -29,8 +29,6 @@ class Tokenizer(object):
|
|
| 29 |
|
| 30 |
def __init__(self, tokenizer_path: str):
|
| 31 |
self.sp = spm.SentencePieceProcessor(model_file=tokenizer_path)
|
| 32 |
-
# Match tensorflow_text.SentencepieceTokenizer(add_bos=False, add_eos=False)
|
| 33 |
-
self.sp.SetEncodeExtraOptions("")
|
| 34 |
# Explicitly disable BOS/EOS to match the reference Colab implementation.
|
| 35 |
self._add_bos = False
|
| 36 |
self._add_eos = False
|
|
|
|
| 29 |
|
| 30 |
def __init__(self, tokenizer_path: str):
|
| 31 |
self.sp = spm.SentencePieceProcessor(model_file=tokenizer_path)
|
|
|
|
|
|
|
| 32 |
# Explicitly disable BOS/EOS to match the reference Colab implementation.
|
| 33 |
self._add_bos = False
|
| 34 |
self._add_eos = False
|