Model: fyerfyer/finetune-jina-transformers-v1
Author: fyerfyer
Pipeline: sentence-similarity
Library: sentence-transformers
Tags: sentence-transformers, safetensors, bert, sentence-similarity, feature-extraction, dense, generated_from_trainer, dataset_size:15019, loss:MultipleNegativesRankingLoss, custom_code, arxiv:1908.10084, arxiv:1705.00652, base_model:jinaai/jina-embeddings-v2-base-en, base_model:finetune:jinaai/jina-embeddings-v2-base-en, text-embeddings-inference, endpoints_compatible, region:us
Base models (finetune): id: jinaai/jina-embeddings-v2-base-en
Card metadata: tags: sentence-transformers, sentence-similarity, feature-extraction, dense, generated_from_trainer, dataset_size:15019, loss:MultipleNegativesRankingLoss
base_model: jinaai/jina-embeddings-v2-base-en
widget: source_sentence: What is the role of the `cache_implementation="static"` parameter in the model.generate() method for PaliGemma?
sentences: Context: PaliGemma > Pipeline > AutoModel

#### AutoModel

```py
import torch
import requests
from PIL import Image
from transformers import AutoProcessor, PaliGemmaForConditionalGeneration

model = PaliGemmaForConditionalGeneration.from_pretrained(
    "google/paligemma2-3b-mix-224",
    dtype=torch.bfloat16,
    device_map="auto",
    attn_implementation="sdpa"
)
processor = AutoProcessor.from_pretrained(
    "google/paligemma2-3b-mix-224",
)

prompt = "What is in this image?"
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
image = Image.open(requests.get(url, stream=True).raw)
inputs = processor(image, prompt, return_tensors="pt").to(model.device)

output = model.generate(**inputs, max_new_tokens=50, cache_implementation="static")
print(processor.decode(output0, skip_special_tokens=True))
```

Quantization reduces the memory burden of large models by representing the weights in a lower precision. Refer to the Quantization overview for more available quantization backends.

The example below uses torchao to only quantize the weights to int4.

```py
# pip install torchao
import torch
import requests
from PIL import Image
from transformers import TorchAoConfig, AutoProcessor, PaliGemmaForConditionalGeneration

quantization_config = TorchAoConfig("int4_weight_only", group_size=128)
model = PaliGemmaForConditionalGeneration.from_pretrained(
    "google/paligemma2-28b-mix-224",
    dtype=torch.bfloat16,
    device_map="auto",
    quantization_config=quantization_config
)
processor = AutoProcessor.from_pretrained(
    "google/paligemma2-28b-mix-224",
)

prompt = "What is in this image?"
url = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
image = Image.open(requests.get(url, stream=True).raw)
inputs = processor(image, prompt, return_tensors="pt").to(model.device)

output = model.generate(**inputs, max_new_tokens=50, cache_implementation="static")
print(processor.decode(output0, skip_special_tokens=True))
```, Context: PaliGemma

# PaliGemma

PaliGemma(https://huggingface.co/papers/2407.07726) is a family of vision-language models (VLMs), combining SigLIP with the Gemma 2B model. PaliGemma is available in 3B, 10B, and 28B parameters. The main purpose of PaliGemma is to provide an adaptable base VLM that is easy to transfer to other tasks. The SigLIP vision encoder is a "shape optimized" contrastively pretrained ViT that converts an image into a sequence of tokens and prepended to an optional prompt. The Gemma 2B model is used as the decoder. PaliGemma uses full attention on all image and text tokens to maximize its capacity.

PaliGemma 2(https://huggingface.co/papers/2412.03555) improves on the first model by using Gemma 2 (2B, 9B, and 27B parameter variants) as the decoder. These are available as **pt** or **mix** variants. The **pt** checkpoints are intended for further fine-tuning and the **mix** checkpoints are ready for use out of the box.

You can find all the original PaliGemma checkpoints under the PaliGemma(https://huggingface.co/collections/google/paligemma-release-6643a9ffbf57de2ae0448dda), PaliGemma 2(https://huggingface.co/collections/google/paligemma-2-release-67500e1e1dbfdd4dee27ba48), and PaliGemma 2 Mix(https://huggingface.co/collections/google/paligemma-2-mix-67ac6a251aaf3ee73679dcc4) collections.

> !TIP
> Click on the PaliGemma models in the right sidebar for more examples of how to apply PaliGemma to different vision and language tasks.

The example below demonstrates how to generate text based on an image with `Pipeline` or the `AutoModel` class., Context: Installation > Python > Editable install

### Editable install

An editable install(https://pip.pypa.io/en/stable/topics/local-project-installs/#editable-installs) is useful if you're developing locally with Transformers. It links your local copy of Transformers to the Transformers repository(https://github.com/huggingface/transformers) instead of copying the files. The files are added to Python's import path.

```bash
git clone https://github.com/huggingface/transformers.git
cd transformers
uv pip install -e .
```

> !WARNING
> You must keep the local Transformers folder to keep using it.

Update your local version of Transformers with the latest changes in the main repository with the following command.

```bash
cd ~/transformers/
git pull
```, source_sentence: How do I use or implement 'transformers CLI' according to the provided text?
sentences: Context: Checks on a Pull Request > Repository consistency > Check copies

> **Tip**
> If the replacements change the formatting (if you replace a short name by a very long name for instance), the copy is checked after applying the auto-formatter.

Another way when the patterns are just different casings of the same replacement (with an uppercased and a lowercased variants) is just to add the option `all-casing`. Here(https://github.com/huggingface/transformers/blob/15082a9dc6950ecae63a0d3e5060b2fc7f15050a/src/transformers/models/mobilebert/modeling_mobilebert.py#L1237) is an example in `MobileBertForSequenceClassification` with the comment:

```py
# Copied from transformers.models.bert.modeling_bert.BertForSequenceClassification with Bert->MobileBert all-casing
```

In this case, the code is copied from `BertForSequenceClassification` by replacing:

- `Bert` by `MobileBert` (for instance when using `MobileBertModel` in the init)
- `bert` by `mobilebert` (for instance when defining `self.mobilebert`)
- `BERT` by `MOBILEBERT` (in the constant `MOBILEBERT_INPUTS_DOCSTRING`), Context: Chat basics > chat CLI

## chat CLI

After you've installed Transformers, you can chat with a model directly from the command line. The command below launches an interactive session with a model, with a few base commands listed at the start of the session.

```bash
transformers chat Qwen/Qwen2.5-0.5B-Instruct
```

Asset path: https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/transformers-chat-cli.png, Caption: Image: transformers-chat-cli.png

You can launch the CLI with arbitrary `generate` flags, with the format `arg_1=value_1 arg_2=value_2 ...`

```bash
transformers chat Qwen/Qwen2.5-0.5B-Instruct do_sample=False max_new_tokens=10
```

For a full list of options, run the command below.

```bash
transformers chat -h
```

The chat is implemented on top of the AutoClass, using tooling from text generation and chat. It uses the `transformers serve` CLI under the hood (docs(transformers-endocs/serving#serve-cli))., Context: Encoder Decoder Models > Pipeline > AutoModel > transformers CLI

#### transformers CLI

```bash
echo -e "Plants create energy through a process known as photosynthesis. This involves capturing sunlight and converting carbon dioxide and water into glucose and oxygen." | transformers run --task summarization --model "patrickvonplaten/bert2bert-cnn_dailymail-fp16" --device 0
```, source_sentence: How do I use or implement 'Qwen3MoeConfig' according to the provided text?
sentences: Context: Configuration

# Configuration

The base class `PreTrainedConfig` implements the common methods for loading/saving a configuration
either from a local file or directory, or from a pretrained model configuration provided by the library (downloaded
from HuggingFace's AWS S3 repository).

Each derived config class implements model specific attributes. Common attributes present in all config classes are:
`hidden_size`, `num_attention_heads`, and `num_hidden_layers`. Text models further implement:
`vocab_size`., Context: Phi4 Multimodal > Phi4MultimodalAudioModel

## Phi4MultimodalAudioModel

[autodoc] Phi4MultimodalAudioModel, Context: Qwen3MoE > Qwen3MoeConfig

## Qwen3MoeConfig

[autodoc] Qwen3MoeConfig, source_sentence: What does the documentation say about 'PerceiverForMultimodalAutoencoding'?
sentences: Context: Glossary > N > Natural language processing (NLP)

### Natural language processing (NLP)

A generic way to say "deal with texts"., Context: Perceiver > PerceiverForMultimodalAutoencoding

## PerceiverForMultimodalAutoencoding

[autodoc] PerceiverForMultimodalAutoencoding
    - forward, Context: DistilBERT > DistilBertConfig

## DistilBertConfig

[autodoc] DistilBertConfig, source_sentence: How can I generate text with OLMo3 directly from the command line?
sentences: Context: Text generation

# Text generation

[open-in-colab]

Text generation is the most popular application for large language models (LLMs). A LLM is trained to generate the next word (token) given some initial text (prompt) along with its own generated outputs up to a predefined length or when it reaches an end-of-sequence (`EOS`) token.

In Transformers, the `~GenerationMixin.generate` API handles text generation, and it is available for all models with generative capabilities. This guide will show you the basics of text generation with `~GenerationMixin.generate` and some common pitfalls to avoid.

> !TIP
> You can also chat with a model directly from the command line. (reference(transformers-endocs/conversations#transformers))
>
> ```shell
> transformers chat Qwen/Qwen2.5-0.5B-Instruct
> ```, Context: SAM2 > Sam2HieraDetModel

## Sam2HieraDetModel

[autodoc] Sam2HieraDetModel
    - forward, Context: OLMo3

# OLMo3

Olmo3 is an improvement on OLMo2. More details will be released on *soon*.

> !TIP
> Click on the OLMo3 models in the right sidebar for more examples of how to apply OLMo3 to different language tasks.

The example below demonstrates how to generate text with `Pipeline`, `AutoModel` and from the command line.
pipeline_tag: sentence-similarity
library_name: sentence-transformers
Likes: 0 | All-time downloads: 55
Created: 2025-11-27 01:14:34