Update clip loss calculation (#13217)
Update clip loss calculation (#13217)

* Update clip loss calculation

Hello, I'm the author of the blog you took the snippet from. I think this way of calculating is possibly slightly more accurate for calculation.

* Apply suggestions from code review

Co-authored-by: Suraj Patil <e55124f2bc241ddfef100229e12a1887b326eb73@gmail.com>
huggingface/transformers,huggingface/transformers,huggingface/transformers,huggingface/transformers