


'''simple docstring'''



import unittest

from transformers import load_tool
from transformers.utils import is_torch_available


if is_torch_available():
		import torch

from transformers.testing_utils import require_torch

from .test_tools_common import ToolTesterMixin


@require_torch
class 		_snake_case					(     unittest.TestCase       ,   a__	):




					def 				snake_case__						(      self):
								UpperCAmelCase__  :					List[str]        =     load_tool("""text-to-speech""")
								self.tool.setup()




					def 				snake_case__						(      self):
								torch.manual_seed(0)
								UpperCAmelCase__  :					Any        =     self.tool("""hey""")
								UpperCAmelCase__  :					List[str]        =     result.to_raw()
								self.assertTrue(
								    torch.allclose(
								        resulting_tensor[:3]							,							torch.tensor([-0.0005966668832115829, -0.0003657640190795064, -0.00013439502799883485])							,							))




					def 				snake_case__						(      self):
								torch.manual_seed(0)
								UpperCAmelCase__  :					Optional[Any]        =     self.tool("""hey""")
								UpperCAmelCase__  :					Union[str, Any]        =     result.to_raw()
								self.assertTrue(
								    torch.allclose(
								        resulting_tensor[:3]							,							torch.tensor([-0.0005966668832115829, -0.0003657640190795064, -0.00013439502799883485])							,							))



'''simple docstring'''



from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_torch_available,
)


__A	={
    'configuration_encodec': [
        'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'EncodecConfig',
    ],
    'feature_extraction_encodec': ['EncodecFeatureExtractor'],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__A	=[
		    'ENCODEC_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'EncodecModel',
		    'EncodecPreTrainedModel',
		]

if TYPE_CHECKING:
		from .configuration_encodec import (
		    ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP,
		    EncodecConfig,
		)
		from .feature_extraction_encodec import EncodecFeatureExtractor

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_encodec import (
				    ENCODEC_PRETRAINED_MODEL_ARCHIVE_LIST,
				    EncodecModel,
				    EncodecPreTrainedModel,
				)

else:
		import sys

		__A	=_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)