Skip to content

Commit

Permalink
docs: fix python example for ColPali
Browse files Browse the repository at this point in the history
  • Loading branch information
tonywu71 committed Nov 2, 2024
1 parent 9d2fb85 commit 5daf5e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/transformers/models/colpali/modeling_colpali.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,11 @@ def _init_weights(self, module):
import torch
from PIL import Image
from transformers import ColPali, ColPaliProcessor
from transformers import ColPaliForRetrieval, ColPaliProcessor
model_name = "vidore/colpali-v1.2-hf"
model = ColPali.from_pretrained(
model = ColPaliForRetrieval.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="cuda:0", # or "mps" if on Apple Silicon
Expand Down
4 changes: 2 additions & 2 deletions src/transformers/models/colpali/modular_colpali.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,11 +548,11 @@ class ColPaliForRetrievalOutput(ModelOutput):
import torch
from PIL import Image
from transformers import ColPali, ColPaliProcessor
from transformers import ColPaliForRetrieval, ColPaliProcessor
model_name = "vidore/colpali-v1.2-hf"
model = ColPali.from_pretrained(
model = ColPaliForRetrieval.from_pretrained(
model_name,
torch_dtype=torch.bfloat16,
device_map="cuda:0", # or "mps" if on Apple Silicon
Expand Down

0 comments on commit 5daf5e6

Please sign in to comment.