resize_token_embeddings warning should provide more context and be easier to squelch
Author: keturn
Pull request: no

### System Info

- `transformers` version: 4.33.2
- Platform: Linux-5.15.0-84-generic-x86_64-with-glibc2.35
- Python version: 3.11.5
- Huggingface_hub version: 0.17.2
- Safetensors version: 0.3.1
- Accelerate version: 0.23.0
- Accelerate config:    - compute_environment: LOCAL_MACHINE
        - distributed_type: NO
        - mixed_precision: bf16
        - use_cpu: False
        - debug: False
        - num_processes: 1
        - machine_rank: 0
        - num_machines: 1
        - gpu_ids: cuda:0
        - rdzv_backend: static
        - same_network: True
        - main_training_function: main
        - downcast_bf16: no
        - tpu_use_cluster: False
        - tpu_use_sudo: False
        - tpu_env: []
- PyTorch version (GPU?): 2.1.0+cu121 (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?: no

### Who can help?

@ArthurZucker 

### 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

call ClipTextEncoder.resize_token_embeddings

and it spews
> You are resizing the embedding layer without providing a pad_to_multiple_of parameter. This means that the new embedding dimension will be None. This might induce some performance reduction as Tensor Cores will not be available. For more details about this, or help on choosing the correct value for resizing, refer to this guide: […]

added in #25088.

### Expected behavior

wow that's a big message that happens at a high logging level (`WARNING`) on some code that gets called fairly frequently.

A couple things would help:
- I had no idea where this was coming from. It would be nice if it used a logger that provided more context (e.g. the class that was emitting the warning), or a `repr(self)`, or stack information.
- Use [`warnings.warn`](https://docs.python.org/3/library/warnings.html#warnings.warn) instead of `logger.warning`. This allows it to be reported _once_ instead of on every call, makes it easier for an application author to filter these warnings from the end user, and there's an argument `stacklevel` which can be a more concise way of providing relevant caller information than feeding `stack_info` to a `logger`.

Comments:
Hey! On 1. Sur this si something that can be added. 
2. No, we can use `logger.warning_once` however.

Would you like to open a PR for both? 🤗 

That is something I could do! You should be able to find my application in the collection 🤗 has collected via Workable.

I don't know if it's safe or not, but I added pad_to_multiple_of=32 on line 1039 of env/lib/python3.10/site-packages/diffusers/loaders.py, and the warning disappeared.

from: `text_encoder.resize_token_embeddings(len(tokenizer) + len(tokens))` to `text_encoder.resize_token_embeddings(len(tokenizer) + len(tokens), pad_to_multiple_of=32)`

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the [contributing guidelines](https://github.com/huggingface/transformers/blob/main/CONTRIBUTING.md) are likely to be ignored.


the 'pad_to_multiple_of' is an parameter which is used for padding to resize the embedding layer to use tensor cores for better performance

if you don't pass the arg it will give you the warning
"You are resizing the embedding layer without providing a pad_to_multiple_of parameter. This means that the new embedding dimension will be 268525. This might induce some performance reduction as Tensor Cores will not be available.

it uses int input EX: 4 (TF32) / 8 (FP16) / 16 (INT8) 32 (TF32) / 64 (FP16) / 128 (INT8)
it depends on the GPU architecture
for easy way
32 (TF32) / 64 (FP16) / 128 (INT8) is for high end GPU like A100

for more info visit this article by Nvidia:https://docs.nvidia.com/deeplearning/performance/dl-performance-matrix-multiplication/index.html#

you can use this args in you code to resize the embedings as model.resize_token_embeddings(original_vocab_size,pad_to_multiple_of = 8)