Run this model with HF Jobs
Run HuggingFaceM4/tiny-random-siglip on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/HuggingFaceM4/tiny-random-siglip. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/HuggingFaceM4/tiny-random-siglip on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use HuggingFaceM4/tiny-random-siglip with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use HuggingFaceM4/tiny-random-siglip with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("zero-shot-image-classification", model="HuggingFaceM4/tiny-random-siglip", trust_remote_code=True) pipe( "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png", candidate_labels=["animals", "humans", "landscape"], )# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForZeroShotImageClassification processor = AutoProcessor.from_pretrained("HuggingFaceM4/tiny-random-siglip", trust_remote_code=True) model = AutoModelForZeroShotImageClassification.from_pretrained("HuggingFaceM4/tiny-random-siglip", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Commit ·
2ca24ef
1
Parent(s): 9947e3f
ops in fp16
Browse files94 unmodified lines9596979898991001011011021031041052 unmodified lines108109110111112113110114115116117118119120618 unmodified lines73974074173574274374474594 unmodified lines
# Use inverse cdf transform for normal distribution to get truncated # standard normal if tensor.dtype == torch.bfloat16: if tensor.dtype == torch.float16: # The `erfinv_` op is not (yet?) defined in float16 tensor = tensor.to(torch.float32) tensor.erfinv_() tensor = tensor.to(torch.bfloat16) tensor = tensor.to(torch.float16) else: tensor.erfinv_()
2 unmodified lines tensor.add_(mean)
# Clamp to ensure it's in the proper range if tensor.dtype == torch.float16: # The `clamp_` op is not (yet?) defined in float16 tensor = tensor.to(torch.float32) tensor.clamp_(min=a, max=b) tensor.clamp_(min=a, max=b) tensor = tensor.to(torch.float16) else: tensor.clamp_(min=a, max=b)
def trunc_normal_tf_(618 unmodified lines nn.init.normal_(module.attention.in_proj_weight.data) nn.init.zeros_(module.attention.in_proj_bias.data) elif isinstance(module, SiglipModel): logit_scale_init = torch.log(torch.tensor(1.0)) logit_scale_init = torch.tensor(0.0) module.logit_scale.data.fill_(logit_scale_init) module.logit_bias.data.zero_() elif isinstance(module, (nn.Linear, nn.Conv2d)):modeling_siglip.py+11-4