CoolFace
Apppublic

declare-lab/tango2

sourceHugging Faceupdated 2y agoView on Hugging Face
92likes
import_utils.cpython-39.pyc173 linesDownload Raw Back to __pycache__
1a

2��'d�O�@s.3dZddlZddlZddlZddlZddlmZddl	m4Z5ddlmZddl
mZddlmZmZdd	lmZejd6kr�ddlZnddlmZe�e�Zhd�Ze�dh�Zej�d
d�� �Z!ej�dd�� �Z"ej�dd�� �Z#ej�dd�� �Z$ej%ej&ej'ej(ej)ej*d�Z+dZ,e"ev�r�e!ev�r�ej-�.d�duZ/e/�r�z e�d�Z,e�0de,�d��Wnej1�y|dZ/Yn0ne�0d�dZ/dZ2e!ev�rNe"ev�rNej-�.d�duZ3e3�rdZ4dZ2e4D]4Z5ze�e5�Z2W�q�Wnej1�y�Yn0�q�e2duZ3e3�r\e�e2�e�d�k�r:e�0de2�d��dZ3ne�0de2�d��ne�0d�dZ3dZ6dZ7e#ev�r�ej-�.d�du�o�ej-�.d �duZ8e8�r�z0e�d�Z6e�d �Z7e�0d!e6�d"e7�d��Wnej1�y�dZ8Yn0ndZ8e$ev�rFej-�.d#�duZ9e9�rTz e�d#�Z:e�0d$e:�d��Wnej1�yBdZ9Yn0ne�0d%�dZ9ej-�.d&�duZ;ze�d&�Z<e�=d'e<���Wnej1�y�dZ;Yn0ej-�.d(�duZ>ze�d(�Z?e�=d)e?���Wnej1�y�dZ>Yn0ej-�.d*�duZ@ze�d*�ZAe�=d+eA���Wnej1�y0dZ@Yn0dZBej-�.d,�duZCeC�r�d-Z4dZBe4D]4Z5ze�e5�ZBW�q�Wnej1�y�Yn0�qXeBduZCeC�r�e�=d.eB���zdd/Z4dZDe4D]4Z5ze�e5�ZDW�q�Wnej1�y�Yn0�q�eDduZEeE�re�=d0eD���Wnej1�y*dZEYn0ej-�.d1�duZFze�d1�ZGe�=d2eG���Wnej1�ytdZFYn0ej-�.d3�duZHze�d3�ZIe�=d4eI���Wnej1�y�dZHYn0ej-�.d5�duZJze�d5�ZKe�=d6eK���Wnej1�ydZJYn0ej-�.d7�duZLzLe�d7�ZMe/�rTddlNZNe�eNjO�e�d8�k�rTePd9��e�=d:eM���Wnej1�y�dZLYn0ej-�.d;�duZQze�d;�ZRe�=d<eR���Wnej1�y�dZQYn0ej-�.d=�duZSze�d=�ZTe�=d>eT���Wnej1�ydZSYn0ej-�.d?�duZUze�d?�ZVe�=d@eV���Wnej1�y^dZUYn0ej-�.dA�duZWze�dA�ZXe�=dBeX���Wnej1�y�dZWYn0ej-�.dC�ZYze�dC�ZZe�=dDeZ���Wnej1�y�dZYYn0ej-�.dE�Z[ze�dE�Z\e�=dFe\���Wnej1�y4dZ[Yn0dGdH�Z]dIdJ�Z^dKdL�Z_dMdN�Z`dOdP�ZadQdR�ZbdSdT�ZcdUdV�ZddWdX�ZedYdZ�Zfd[d\�Zgd]d^�Zhd_d`�Zidadb�Zjdcdd�Zkdedf�Zldgdh�Zmdidj�Zndkdl�ZodmZpdnZqdoZrdpZsdqZtdrZudsZvdtZwduZxdvZydwZzdxZ{dyZ|dzZ}d{Z~ed e`epffd(ebeqffd|edesffd}eeetffd1efeuffde]erffd&eaewffd*ecexffd3egevffd;ejeyffd=ekezffd?ele{ffdAeme|ffdCeYe}ffdEe[e~ffg�Zd~d�Z�Gd�d��d�e��Z�e7e�efe�e�d��d�d��Z�e�e�d��d�d��Z�e�e�d��d�d��Z�e�e�d��d�d��Z�e�e�d��d�d��Z�Gd�d��d�e��Z�dS)�zD8Import utilities: Utilities related to imports and our lazy inits.9�N)�OrderedDict)�Union)�is_jinja_available)�version)�Version�parse�)�logging)��>�TRUE�ON�YES�1�AUTO�USE_TF�	USE_TORCHZUSE_FLAX�USE_SAFETENSORS)�>z>=z==z!=z<=�<zN/A�torchzPyTorch version z available.Fz*Disabling PyTorch because USE_TORCH is set�10tensorflow)rztensorflow-cpuztensorflow-gpuz11tf-nightlyztf-nightly-cpuztf-nightly-gpuzintel-tensorflowzintel-tensorflow-avx512ztensorflow-rocmztensorflow-macosztensorflow-aarch64�2z"TensorFlow found but with version z'. Diffusers requires version 2 minimum.zTensorFlow version z-Disabling Tensorflow because USE_TORCH is setZjaxZflaxzJAX version z, Flax version ZsafetensorszSafetensors version z+Disabling Safetensors because USE_TF is set�transformersz+Successfully imported transformers version Zinflectz&Successfully imported inflect version Z	unidecodez(Successfully imported unidecode version �onnxruntime)rzonnxruntime-gpuZort_nightly_gpuzonnxruntime-directmlzonnxruntime-openvinoZort_nightly_directmlzonnxruntime-rocmzonnxruntime-trainingz*Successfully imported onnxruntime version )z
opencv-pythonzopencv-contrib-pythonzopencv-python-headlesszopencv-contrib-python-headlessz"Successfully imported cv2 version �scipyz$Successfully imported scipy version Zlibrosaz&Successfully imported librosa version �12acceleratez)Successfully imported accelerate version Zxformersz1.12zPyTorch should be >= 1.12z'Successfully imported xformers version Zk_diffusionz*Successfully imported k-diffusion version Znote_seqz'Successfully imported note-seq version Zwandbz$Successfully imported wandb version �	omegaconfz(Successfully imported omegaconf version Ztensorboardz*Successfully imported tensorboard version Zcompelz%Successfully imported compel version cCstS�N)�_torch_available�r r �Q/home/deep/Projects/audio_diffusion/diffusers/src/diffusers/utils/import_utils.py�is_torch_availablesr"cCstSr)�_safetensors_availabler r r r!�is_safetensors_availablesr$cCstSr)�
_tf_availabler r r r!�is_tf_availablesr&cCstSr)�_flax_availabler r r r!�is_flax_availablesr(cCstSr)�_transformers_availabler r r r!�is_transformers_available"sr*cCstSr)�_inflect_availabler r r r!�is_inflect_available&sr,cCstSr)�_unidecode_availabler r r r!�is_unidecode_available*sr.cCstSr)�_onnx_availabler r r r!�is_onnx_available.sr0cCstSr)�_opencv_availabler r r r!�is_opencv_available2sr2cCstSr)�_scipy_availabler r r r!�is_scipy_available6sr4cCstSr)�_librosa_availabler r r r!�is_librosa_available:sr6cCstSr)�_xformers_availabler r r r!�is_xformers_available>sr8cCstSr)�_accelerate_availabler r r r!�is_accelerate_availableBsr:cCstSr)�_k_diffusion_availabler r r r!�is_k_diffusion_availableFsr<cCstSr)�_note_seq_availabler r r r!�is_note_seq_availableJsr>cCstSr)�_wandb_availabler r r r!�is_wandb_availableNsr@cCstSr)�_omegaconf_availabler r r r!�is_omegaconf_availableRsrBcCstSr)�_tensorboard_availabler r r r!�is_tensorboard_availableVsrDcCstSr)�_compel_availabler r r r!�is_compel_availableZsrFz�13{0} requires the FLAX library but it was not found in your environment. Checkout the instructions on the14installation page: https://github.com/google/flax and follow the ones that match your environment.15z16{0} requires the inflect library but it was not found in your environment. You can install it with pip: `pip install17inflect`18z�19{0} requires the PyTorch library but it was not found in your environment. Checkout the instructions on the20installation page: https://pytorch.org/get-started/locally/ and follow the ones that match your environment.21z�22{0} requires the onnxruntime library but it was not found in your environment. You can install it with pip: `pip23install onnxruntime`24z�25{0} requires the OpenCV library but it was not found in your environment. You can install it with pip: `pip26install opencv-python`27z{28{0} requires the scipy library but it was not found in your environment. You can install it with pip: `pip install29scipy`30z�31{0} requires the librosa library but it was not found in your environment.  Checkout the instructions on the32installation page: https://librosa.org/doc/latest/install.html and follow the ones that match your environment.33z�34{0} requires the transformers library but it was not found in your environment. You can install it with pip: `pip35install transformers`36z�37{0} requires the unidecode library but it was not found in your environment. You can install it with pip: `pip install38Unidecode`39z�40{0} requires the k-diffusion library but it was not found in your environment. You can install it with pip: `pip41install k-diffusion`42z�43{0} requires the note-seq library but it was not found in your environment. You can install it with pip: `pip44install note-seq`45z{46{0} requires the wandb library but it was not found in your environment. You can install it with pip: `pip47install wandb`48z�49{0} requires the omegaconf library but it was not found in your environment. You can install it with pip: `pip50install omegaconf`51z�52{0} requires the tensorboard library but it was not found in your environment. You can install it with pip: `pip53install tensorboard`54z}55{0} requires the compel library but it was not found in your environment. You can install it with pip: `pip install compel`56ZonnxZopencvcs�t|ttf�s|g}t|d�r$|jn|jj�dd�|D�}�fdd�|D�}|r^td�|����dvr�tdd	�r�td57��d����dvr�tdd
�r�td��d���dS)N�__name__css|]}t|VqdSr)�BACKENDS_MAPPING)�.0�backendr r r!�	<genexpr>��z$requires_backends.<locals>.<genexpr>cs g|]\}}|�s|����qSr )�format)rI�	available�msg��namer r!�58<listcomp>�rLz%requires_backends.<locals>.<listcomp>�)�%VersatileDiffusionTextToImagePipeline�VersatileDiffusionPipeline�$VersatileDiffusionDualGuidedPipeline�%StableDiffusionImageVariationPipeline�UnCLIPPipelinerz4.25.0z9You need to install `transformers>=4.25` in order to use z/: 59```60 pip install --upgrade transformers 61```)� StableDiffusionDepth2ImgPipeline�"StableDiffusionPix2PixZeroPipelinez4.26.0z9You need to install `transformers>=4.26` in order to use )	�62isinstance�list�tuple�hasattrrG�	__class__�ImportError�join�is_transformers_version)�obj�backends�checks�failedr rPr!�requires_backends�s&�63�64�65�rgcs eZdZdZ�fdd�Z�ZS)�DummyObjectz�66    Metaclass for the dummy objects. Any class inheriting from it will return the ImportError generated by67    `requires_backend` each time a user tries to access any method of that class.68    cs(|�d�rt��||�St||j�dS)N�_)�69startswith�super�__getattr__rgZ	_backends)�cls�key�r_r r!rl�s70zDummyObject.__getattr__)rG�71__module__�__qualname__�__doc__rl�
__classcell__r r ror!rh�srh�Zlibrary_or_version�	operationZrequirement_versioncCsV|t��vr(tdtt����d|����t|}t|t�rHtt�|��}||t|��S)a�72    Args:73    Compares a library version to some requirement using a given operation.74        library_or_version (`str` or `packaging.version.Version`):75            A library name or a version to check.76        operation (`str`):77            A string representation of an operator, such as `">"` or `"<="`.78        requirement_version (`str`):79            The version to compare the library version against80    z`operation` must be one of z, received )	�STR_OPERATION_TO_FUNC�keys�81ValueErrorr\r[�strr�importlib_metadatarrtr r r!�compare_versions�s82r{�rurcCsttt�||�S)a83    Args:84    Compares the current PyTorch version to a given reference with an operation.85        operation (`str`):86            A string representation of an operator, such as `">"` or `"<="`87        version (`str`):88            A string version of PyTorch89    )r{r�_torch_versionr|r r r!�is_torch_version
s	r~cCstsdSttt�||�S)a90    Args:91    Compares the current Transformers version to a given reference with an operation.92        operation (`str`):93            A string representation of an operator, such as `">"` or `"<="`94        version (`str`):95            A version string96    F)r)r{r�_transformers_versionr|r r r!rbs	rbcCstsdSttt�||�S)a97    Args:98    Compares the current Accelerate version to a given reference with an operation.99        operation (`str`):100            A string representation of an operator, such as `">"` or `"<="`101        version (`str`):102            A version string103    F)r9r{r�_accelerate_versionr|r r r!�is_accelerate_version's	r�cCstsdSttt�||�S)a104    Args:105    Compares the current k-diffusion version to a given reference with an operation.106        operation (`str`):107            A string representation of an operator, such as `">"` or `"<="`108        version (`str`):109            A version string110    F)r;r{r�_k_diffusion_versionr|r r r!�is_k_diffusion_version5s	r�c@seZdZdZdS)�OptionalDependencyNotAvailablez^An error indicating that an optional dependency of Diffusers was not found in the environment.N)rGrprqrrr r r r!r�Csr�)�rr�importlib.util�	importlib�operator�op�os�sys�collectionsr�typingr�huggingface_hub.utilsr�	packagingr�packaging.versionrrrSr	�version_inforz�importlib.metadata�metadata�111get_loggerrG�logger�ENV_VARS_TRUE_VALUES�union�ENV_VARS_TRUE_AND_AUTO_VALUES�environ�get�upperrr�USE_JAXr�gt�ge�eq�ne�le�ltrvr}�util�	find_specr�info�PackageNotFoundErrorZ_tf_versionr%�112candidates�pkgZ_jax_versionZ
_flax_versionr'r#Z_safetensors_versionr)r�debugr+Z_inflect_versionr-Z_unidecode_versionZ_onnxruntime_versionr/Z_opencv_versionr1r3Z_scipy_versionr5Z_librosa_versionr9r�r7Z_xformers_versionr�__version__rxr;r�r=Z_note_seq_versionr?Z_wandb_versionrAZ_omegaconf_versionrCZ_tensorboard_versionrEZ_compel_versionr"r$r&r(r*r,r.r0r2r4r6r8r:r<r>r@rBrDrFZFLAX_IMPORT_ERRORZINFLECT_IMPORT_ERRORZPYTORCH_IMPORT_ERRORZONNX_IMPORT_ERRORZOPENCV_IMPORT_ERRORZSCIPY_IMPORT_ERRORZLIBROSA_IMPORT_ERRORZTRANSFORMERS_IMPORT_ERRORZUNIDECODE_IMPORT_ERRORZK_DIFFUSION_IMPORT_ERRORZNOTE_SEQ_IMPORT_ERRORZWANDB_IMPORT_ERRORZOMEGACONF_IMPORT_ERRORZTENSORBOARD_IMPORT_ERRORZCOMPEL_IMPORT_ERRORrHrg�typerhryr{r~rbr�r��
BaseExceptionr�r r r r!�<module>s�113114115116117
118119120121"122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173��