Skip to content

Commit

Permalink
Blip: Deprecate BlipModel (#31235)
Browse files Browse the repository at this point in the history
* deprecate blip

* mention deprecation on docs
  • Loading branch information
younesbelkada authored Jun 4, 2024
1 parent fd3238b commit 485d913
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/source/en/model_doc/blip.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion src/transformers/models/blip/modeling_blip.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,12 @@ def get_input_embeddings(self):
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

Expand Down Expand Up @@ -775,6 +780,10 @@ def __init__(self, config: BlipConfig):
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()

Expand Down

0 comments on commit 485d913

Please sign in to comment.