Blip: Deprecate BlipModel (#31235)

* deprecate blip

* mention deprecation on docs
This commit is contained in:
Younes Belkada
2024-06-04 18:29:45 +02:00
committed by GitHub
parent fd3238b4b0
commit 485d913dfb
2 changed files with 12 additions and 1 deletions

View File

@@ -66,6 +66,8 @@ The original code can be found [here](https://github.com/salesforce/BLIP).
## BlipModel
`BlipModel` is going to be deprecated in future versions, please use `BlipForConditionalGeneration`, `BlipForImageTextRetrieval` or `BlipForQuestionAnswering` depending on your usecase.
[[autodoc]] BlipModel
- forward
- get_text_features

View File

@@ -742,7 +742,12 @@ class BlipVisionModel(BlipPreTrainedModel):
return self.embeddings
@add_start_docstrings(BLIP_START_DOCSTRING)
@add_start_docstrings(
"""
This model is going to be deprecated in future versions. Please use `BlipForConditionalGeneration`, `BlipForQuestionAnswering` or `BlipForImageTextRetrieval` depending on your usecase.
""",
BLIP_START_DOCSTRING,
)
class BlipModel(BlipPreTrainedModel):
config_class = BlipConfig
@@ -775,6 +780,10 @@ class BlipModel(BlipPreTrainedModel):
self.text_projection = nn.Linear(self.text_embed_dim, self.projection_dim, bias=False)
self.logit_scale = nn.Parameter(torch.tensor(self.config.logit_scale_init_value))
logger.warning(
"`BlipModel` is going to be deprecated in future release, please use `BlipForConditionalGeneration`, `BlipForQuestionAnswering` or `BlipForImageTextRetrieval` depending on your usecase."
)
# Initialize weights and apply final processing
self.post_init()