while loading with WhisperForConditionalGeneration, an error is thrown:
Traceback (most recent call last):
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\pipelines\base.py", line 289, in infer_framework_load_model
model = model_class.from_pretrained(model, **kwargs)
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\modeling_utils.py", line 3913, in from_pretrained
raise EnvironmentError(
OSError: openai/whisper-large-v3 does not appear to have a file named pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt or flax_model.msgpack.
Assistant
The error message you are encountering suggests that the model 'openai/whisper-large-v3' could not be found or does not contain the expected model files like pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt, or flax_model.msgpack.
Here are some steps you can take to address this issue:
User
Assistant
The error message you are seeing indicates two potential issues. Let's address each one:
Symlink Warning on Windows with huggingface_hub:
This is a warning indicating that your machine doesn't support symlinks by default, which can lead to more disk space being used for caching models.
To resolve this, you can either:
Enable Developer Mode in Windows, which allows symlink creation without requiring administrator privileges.
Run your Python script as an administrator to allow the creation of symlinks.
Ignore the warning if disk space is not a concern, as the functionality will otherwise work normally.
You can also suppress this warning by setting the environment variable:
User
dimelo en español
Assistant
Claro, aquí te explico los problemas que estás enfrentando y cómo resolverlos:
Advertencia sobre Symlinks en Windows con huggingface_hub:
Esta advertencia indica que tu máquina no admite enlaces simbólicos (symlinks) por defecto, lo que puede llevar a un mayor uso de espacio en disco para el almacenamiento en caché de los modelos.
Para resolver esto, puedes:
Activar el Modo de Desarrollador en Windows, lo que permite la creación de enlaces simbólicos sin privilegios de administrador. Puedes hacerlo siguiendo .
User
C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\pyannote\audio\core\io.py:43: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call.
torchaudio.set_audio_backend("soundfile")
Traceback (most recent call last):
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return .py", line 926, in pipeline
framework, model = infer_framework_load_model(
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\pipelines\base.py", line 289, in infer_framework_load_model
model = model_class.from_pretrained(model, **kwargs)
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\models\auto\auto_factory.py", line 564, in from_pretrained
return model_class.from_pretrained(
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\modeling_utils.py", line 4091, in from_pretrained
config = cls._autoset_attn_implementation(
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\modeling_utils.py", line 1617, in _autoset_attn_implementation
cls._check_and_enable_flash_attn_2(
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\modeling_utils.py", line 1747, in _check_and_enable_flash_attn_2
raise ImportError(f"{preface} the package flash_attn seems to be not installed. {install_message}")
ImportError: FlashAttention2 has been toggled on, but it cannot be used due to the following error: the package flash_attn seems to be not installed. Please refer to the documentation of to install Flash Attention 2.
Assistant
Parece que estás enfrentando dos problemas en tu ejecución de Python. Vamos a abordarlos uno por uno:
Advertencia de torchaudio:
La advertencia que ves sobre torchaudio.set_audio_backend("soundfile") indica que el uso de esta función ha sido deprecado. Esto significa que no es necesario y puede ser eliminado de tu código.
Si esta advertencia viene de una dependencia como pyannote, y no de tu propio código, lo mejor es asegurarte de tener la última versión de esa librería, ya que el problema podría haber sido solucionado en actualizaciones recientes.
Error de Importación de FlashAttention2:
Este error se debe a que el entorno intenta usar FlashAttention2, una optimización de rendimiento, pero la librería no está instalada.
Verify Model Identifier: Double-check the model identifier openai/whisper-large-v3 to ensure that it is correct. Sometimes a typo can lead to this error.
Available Models: Ensure that openai/whisper-large-v3 is a valid model available on the Hugging Face Model Hub. You can do this by visiting the Hugging Face Model Hub and searching for the model.
Cache and Re-download: If the model exists, but there's a cache issue, try removing the cached files. By default, Hugging Face caches model files in the ~/.cache/huggingface/transformers directory on your system. You can delete this directory or the specific model folder within it, which will force the library to download a fresh copy of the model.
Internet Connection: Ensure you have a stable internet connection as the model files need to be downloaded from the Model Hub.
Transformers Library Version: Ensure that you are using the latest version of the transformers library. There may be updates and fixes related to model downloading. You can update the library using pip:
pip install --upgrade transformers
Check for Specific Files: If you are working with a custom model or your own checkpoint, ensure it includes one of the required files (pytorch_model.bin for PyTorch, etc.).
Load Alternative Format: If your model files are in a different format (e.g., safetensors), make sure your environment is configured to handle it. You might need the safetensors library installed if you are using that format.
By following these steps, you should be able to resolve the issue with loading the model. If the problem persists, more detailed information or context about your setup could help diagnose the issue further.
C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\huggingface_hub\file_download.py:139: UserWarning: huggingface_hub cache-system uses symlinks by default to efficiently store duplicated files but your machine does not support them in C:\Users\Eurobloke.cache\huggingface\hub\models--openai--whisper-large-v3. Caching files will still work but in a degraded version that might require more space on your disk. This warning can be disabled by setting the HF_HUB_DISABLE_SYMLINKS_WARNING environment variable. For more details, see https://huggingface.co/docs/huggingface_hub/how-to-cache#limitations.
To support symlinks on Windows, you either need to activate Developer Mode or to run Python as an administrator. In order to activate developer mode, see this article: https://docs.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development
warnings.warn(message)
Traceback (most recent call last):
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main
return run_code(code, main_globals, None,
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\Scripts\insanely-fast-whisper.exe_main.py", line 7, in
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\insanely_fast_whisper\cli.py", line 130, in main
pipe = pipeline(
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\pipelines_init.py", line 926, in pipeline
framework, model = infer_framework_load_model(
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\pipelines\base.py", line 289, in infer_framework_load_model
model = model_class.from_pretrained(model, **kwargs)
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\models\auto\auto_factory.py", line 564, in from_pretrained
return model_class.from_pretrained(
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\modeling_utils.py", line 4091, in from_pretrained
config = cls._autoset_attn_implementation(
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\modeling_utils.py", line 1617, in _autoset_attn_implementation
cls._check_and_enable_flash_attn_2(
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\modeling_utils.py", line 1747, in _check_and_enable_flash_attn_2
raise ImportError(f"{preface} the package flash_attn seems to be not installed. {install_message}")
ImportError: FlashAttention2 has been toggled on, but it cannot be used due to the following error: the package flash_attn seems to be not installed. Please refer to the documentation of https://huggingface.co/docs/transformers/perf_infer_gpu_one#flashattention-2 to install Flash Attention 2.
HF_HUB_DISABLE_SYMLINKS_WARNING
set HF_HUB_DISABLE_SYMLINKS_WARNING=true
FlashAttention2 ImportError:
FlashAttention2 is a performance optimization feature. It seems that your setup attempts to use it, but it is missing installation.
To resolve this, you need to install the flash_attn library. Follow the instructions given in the Hugging Face documentation linked in the error or use the following general command to install the FlashAttention library:
pip install flash_attn
If FlashAttention2 is not necessary for your application, you can try disabling this optimization or find options in the model configuration (from_pretrained) that prevent its use.
By addressing the symlink warning and installing the missing flash_attn package, you should be able to get past these errors and successfully load and run your model.
Ejecutar tu script de Python como administrador para permitir la creación de symlinks.
Ignorar la advertencia si el espacio en disco no es un problema, ya que la funcionalidad en general seguirá funcionando.
También puedes suprimir esta advertencia configurando la variable de entorno HF_HUB_DISABLE_SYMLINKS_WARNING:
set HF_HUB_DISABLE_SYMLINKS_WARNING=true
Error de Importación de FlashAttention2:
FlashAttention2 es una característica de optimización de rendimiento. Parece que tu configuración intenta usarla, pero falta su instalación.
Para resolver esto, necesitas instalar la librería flash_attn. Sigue las instrucciones proporcionadas en la documentación de Hugging Face enlazada en el error, o utiliza el siguiente comando general para instalar la librería FlashAttention:
pip install flash_attn
Si FlashAttention2 no es necesario para tu aplicación, puedes intentar desactivar esta optimización o buscar opciones en la configuración del modelo (from_pretrained) para evitar su uso.
Al abordar la advertencia sobre los symlinks y al instalar el paquete flash_attn, deberías poder superar estos errores y cargar y ejecutar exitosamente tu modelo.
run_code(code, main_globals, None,
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\Scripts\insanely-fast-whisper.exe_main.py", line 7, in
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\insanely_fast_whisper\cli.py", line 130, in main
pipe = pipeline(
File "C:\Users\Eurobloke\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\pipelines_init
Para solucionar este problema, necesitas instalar el paquete flash_attn para permitir que FlashAttention2 funcione correctamente. Puedes hacerlo con el siguiente comando:
pip install flash_attn
Si FlashAttention2 no es crucial para tu caso de uso, podrías investigar en la documentación o en la configuración del modelo (from_pretrained) para ver si puedes desactivar esta optimización.
Con estos pasos, deberías poder resolver las advertencias y errores y ejecutar tu modelo de manera exitosa. Si después de hacer estos cambios los problemas persisten, podrías necesitar más detalles sobre las versiones específicas de las bibliotecas involucradas y considerar verificar su documentación para pasos adicionales.