DINOv2 not support bf16
Author: Richar-Du
Pull request: no

### System Info

- `transformers` version: 4.36.2
- Platform: Linux-4.18.0-147.mt20200626.413.el8_1.x86_64-x86_64-with-glibc2.17
- Python version: 3.8.18
- Huggingface_hub version: 0.20.3
- Safetensors version: 0.3.1
- Accelerate version: 0.21.0
- Accelerate config:    not found
- PyTorch version (GPU?): 2.0.1+cu117 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Using GPU in script?: Yes
- Using distributed or parallel set-up in script?: Yes

### Who can help?

@amyeroberts

### Information

- [ ] The official example scripts
- [X] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

I use the training script of LLaVA and I would like to change the vision encoder from CLIP to DINOv2. Following is the training script:
```
#!/bin/bash
gpu_vis=0,1,2,3,4,5,6,7

OMP_NUM_THREADS=20 deepspeed --include localhost:$gpu_vis \
    llava/train/train_mem.py \
    --deepspeed ./scripts/zero2.json \
    --model_name_or_path /lmsys/vicuna-7b-v1.5 \
    --version plain \
    --data_path ./playground/data/LLaVA-Pretrain/blip_laion_cc_sbu_558k.json \
    --image_folder ./playground/data/LLaVA-Pretrain/images \
    --vision_tower facebook/dinov2-large \
    --mm_projector_type mlp2x_gelu \
    --tune_mm_mlp_adapter True \
    --mm_vision_select_layer -2 \
    --mm_use_im_start_end False \
    --mm_use_im_patch_token False \
    --bf16 True \
    --output_dir ./checkpoints/llava-v1.5-7b-pretrain \
    --num_train_epochs 1 \
    --per_device_train_batch_size 32 \
    --per_device_eval_batch_size 4 \
    --gradient_accumulation_steps 1 \
    --evaluation_strategy "no" \
    --save_strategy "steps" \
    --save_steps 30 \
    --save_total_limit 1 \
    --learning_rate 1e-3 \
    --weight_decay 0. \
    --warmup_ratio 0.03 \
    --lr_scheduler_type "cosine" \
    --logging_steps 1 \
    --tf32 True \
    --model_max_length 2048 \
    --gradient_checkpointing True \
    --dataloader_num_workers 4 \
    --lazy_preprocess True \
    --report_to wandb
```
And the error is:
```
  File "LLaVA/llava/model/llava_arch.py", line 141, in encode_images
    image_features = self.get_model().get_vision_tower()(images)
  File "miniconda3/envs/llava/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "miniconda3/envs/llava/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "LLaVA/llava/model/multimodal_encoder/dino_encoder.py", line 53, in forward
    image_forward_outs = self.vision_tower(images.to(device=self.device, dtype=self.dtype), output_hidden_states=True)
  File "miniconda3/envs/llava/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "miniconda3/envs/llava/lib/python3.8/site-packages/transformers/models/dinov2/modeling_dinov2.py", line 635, in forward
    embedding_output = self.embeddings(pixel_values, bool_masked_pos=bool_masked_pos)
  File "miniconda3/envs/llava/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
    return forward_call(*args, **kwargs)
  File "miniconda3/envs/llava/lib/python3.8/site-packages/transformers/models/dinov2/modeling_dinov2.py", line 131, in forward
    embeddings = embeddings + self.interpolate_pos_encoding(embeddings, height, width)
  File "miniconda3/envs/llava/lib/python3.8/site-packages/transformers/models/dinov2/modeling_dinov2.py", line 106, in interpolate_pos_encoding
    patch_pos_embed = nn.functional.interpolate(
  File "miniconda3/envs/llava/lib/python3.8/site-packages/torch/nn/functional.py", line 3967, in interpolate
    return torch._C._nn.upsample_bicubic2d(input, output_size, align_corners, scale_factors)
RuntimeError: "upsample_bicubic2d_out_frame" not implemented for 'BFloat16'
```

### Expected behavior

How to solve this problem?

Comments:
Hi @Richar-Du, thanks for raising this issue! 

The issue is arising because torch's implementation of `upsample_bicubic2d` doesn't support bf16. If you'd like to have this supported, I'd suggest opening a feature request on the pytorch repo. 

Thanks for your reply, I'll try to open a feature request on the Pytorch repo :)