Closed tonywu71 closed 1 month ago
It looks like most of the issues are fixed if we define
class ColPaliForConditionalGeneration(PaliGemmaForConditionalGeneration):
Instead of
class ColPaliForRetrieval(PaliGemmaForConditionalGeneration):
Of course this is not what we want here. Is this expected with the current state of modular @ArthurZucker ? If it is, it would be great if we could support task-specific models inheriting from other task-specific (but different task) models. It's a bit weird but I think it can make sense, as the example of ColPali here shows.
Hey! This will be partly adressed by #33859!
One issue is that if your model name is ColPali
, and the original name is PaliGemma
, the converter has to guess the renaming patterns (PaliGemmaAttention -> ColPaliAttention) based only on the name!
Will test that, thanks for testing and reporting π€
System Info
transformers
version: 4.46.0.dev0Who can help?
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Given the
src/transformers/models/colpali/modular_colpali.py
file below:@dataclass class ColPaliForRetrievalOutput(ModelOutput): """ Base class for ColPali embeddings output.
@add_start_docstrings( """ ColPali leverages Vision Language Models (VLMs) to construct efficient multi-vector embeddings in the visual space for document retrieval. By feeding the ViT output patches from PaliGemma-3B to a linear projection, we create a multi-vector representation of documents. The model is trained to maximize the similarity between these document embeddings and the query embeddings, following the ColBERT method.
) class ColPaliForRetrieval(PaliGemmaForConditionalGeneration): main_input_name: ClassVar[str] = "doc_input_ids" # transformers-related
I obtain the following
src/transformers/models/colpali/modeling_colpali.py
file.Expected behavior
Issues
There are 2 problems in the resulting file:
from ..colpali import ColPaliConfig
.ColPaliForRetrievalOutput
is missing.My initial investigation
After debugging the
modular_model_converter.py
script part with:I observed that the 2 elements mentioned above are already missing from
node.code
.Could I get some help on this issue please? Thanks in advance! π