Fix/flux lora quantization compute embeddings (#15144)
* Fix compute_embeddings.py for current transformers release
T5EncoderModel.from_pretrained no longer accepts the load_in_8bit
shorthand kwarg; pass a BitsAndBytesConfig instead. Also cast
embeddings to float32 before calling .numpy(), since bf16 tensors
(the dtype transformers now returns here) cannot be converted to
numpy directly. Both crash the script as published, regardless of
accelerator.
* Use device-agnostic max_memory_allocated in compute_embeddings.py
torch.cuda.max_memory_allocated() silently reports 0 GB on
non-CUDA accelerators. torch.accelerator.max_memory_allocated()
reports correctly across backends.
---------
Co-authored-by: Sayak Paul <spsayakpaul@gmail.com>