Add type annotations for CLIP (torch) (#16059)
Author: jacobdineen
Pull request: yes

# What does this PR do?

Added type annotations to CLIP per the guidelines. Ran make fixup and ran tests before creating PR.

#16059 

## Before submitting
- [x] Did you read the [contributor guideline](https://github.com/huggingface/transformers/blob/master/CONTRIBUTING.md#start-contributing-pull-requests),
      Pull Request section?
- [x] Was this discussed/approved via a Github issue or the [forum](https://discuss.huggingface.co/)? Please add a link
      to it if that's the case. [link here](https://github.com/huggingface/transformers/issues/16059)


Comments:
No emails

I’m about to report you people for harassment 

Stop fucking emailing me !!!!!!!!!!

Fucking Assholes

Sent from my iPhone

> On Mar 12, 2022, at 9:58 AM, Jacob Dineen ***@***.***> wrote:
> 
> ﻿
> What does this PR do?
> 
> Added type annotations to CLIP per the guidelines. Ran make fixup and ran tests before creating PR.
> 
> Fixes # (16059)
> 
> Before submitting
> 
>  Did you read the contributor guideline,
> Pull Request section?
>  Was this discussed/approved via a Github issue or the forum? Please add a link
> to it if that's the case. link here
> You can view, comment on, or merge this pull request online at:
> 
>   https://github.com/huggingface/transformers/pull/16106
> 
> Commit Summary
> 
> 14f00db clip typhinting #16059
> File Changes  (1 file)
> M src/transformers/models/clip/modeling_clip.py (125)
> Patch Links:
> 
> https://github.com/huggingface/transformers/pull/16106.patch
> https://github.com/huggingface/transformers/pull/16106.diff
> —
> Reply to this email directly, view it on GitHub, or unsubscribe.
> Triage notifications on the go with GitHub Mobile for iOS or Android. 
> You are receiving this because you are subscribed to this thread.


_The documentation is not available anymore as the PR was closed or merged._

@debtriche I'm afraid that's not our fault - I'm guessing you've accidentally "watched" the Transformers repo! If you unselect that, you should stop receiving that stream of e-mails. Alternatively, you may have become subscribed to this thread somehow. If so, you can select the 'unsubscribe' button to stop that.
![image](https://user-images.githubusercontent.com/12866554/158023440-3f2c8ec9-8206-460f-8452-129c8c2dc145.png)


Thank:)

I’ve been trying everything, it’s absolutely been driving me mad

Sent from my iPhone

> On Mar 12, 2022, at 10:13 AM, Matt ***@***.***> wrote:
> 
> ﻿
> @Rocketknight1 commented on this pull request.
> 
> In src/transformers/models/clip/modeling_clip.py:
> 
> > +    logits_per_image: Optional[torch.FloatTensor] = None
> +    logits_per_text: Optional[torch.FloatTensor] = None
> +    text_embeds: Optional[torch.FloatTensor] = None
> +    image_embeds: Optional[torch.FloatTensor] = None
> +    text_model_output: Optional[BaseModelOutputWithPooling] = None
> +    vision_model_output: Optional[BaseModelOutputWithPooling] = None
> I don't think the Optional type is necessary for dataclass definitions, just function headers!
> 
> —
> Reply to this email directly, view it on GitHub, or unsubscribe.
> Triage notifications on the go with GitHub Mobile for iOS or Android. 
> You are receiving this because you were mentioned.