-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
colpali_engine/models/paligemma/colpali_2/publish_base_colpali_2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from typing import cast | ||
|
||
import typer | ||
from transformers.models.paligemma.configuration_paligemma import PaliGemmaConfig | ||
|
||
from colpali_engine.models.paligemma.colpali_2.configuration_colpali_2 import ColPali2Config | ||
from colpali_engine.models.paligemma.colpali_2.modeling_colpali_2 import ColPali2 | ||
|
||
|
||
def main(): | ||
vlm_backbone_model_name = "google/paligemma-3b-mix-448" | ||
base_colpali_2_name = "vidore/colpali-v2.0" | ||
|
||
model_config = ColPali2Config( | ||
vlm_backbone_config=cast(PaliGemmaConfig, PaliGemmaConfig.from_pretrained(vlm_backbone_model_name)), | ||
single_vector_projector_dim=128, | ||
single_vector_pool_strategy="mean", | ||
multi_vector_projector_dim=128, | ||
) | ||
|
||
model = ColPali2(config=model_config) | ||
|
||
model.push_to_hub(base_colpali_2_name, private=True) | ||
|
||
return | ||
|
||
|
||
if __name__ == "__main__": | ||
typer.run(main) |