





"""simple docstring"""
from __future__ import annotations

import unittest

from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
				import numpy as np
				import tensorflow as tf

				from transformers import (
				    TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
				    FlaubertConfig,
				    TFFlaubertForMultipleChoice,
				    TFFlaubertForQuestionAnsweringSimple,
				    TFFlaubertForSequenceClassification,
				    TFFlaubertForTokenClassification,
				    TFFlaubertModel,
				    TFFlaubertWithLMHeadModel,
				)





class      __A     :





							'''simple docstring'''

							def __init__(				self							:      Union[str, Any]		,       UpperCAmelCase_							:      Any		,       )					->List[Any]:



														"""simple docstring"""



														snake_case_           =		parent
														snake_case_           =		13
														snake_case_           =		7
														snake_case_           =		True
														snake_case_           =		True
														snake_case_           =		True
														snake_case_           =		True
														snake_case_           =		True
														snake_case_           =		False
														snake_case_           =		False
														snake_case_           =		False
														snake_case_           =		2
														snake_case_           =		99
														snake_case_           =		0
														snake_case_           =		32
														snake_case_           =		2
														snake_case_           =		4
														snake_case_           =		0.1
														snake_case_           =		0.1
														snake_case_           =		512
														snake_case_           =		16
														snake_case_           =		2
														snake_case_           =		0.02
														snake_case_           =		3
														snake_case_           =		4
														snake_case_           =		"""last"""
														snake_case_           =		True
														snake_case_           =		None
														snake_case_           =		0



							def 		lowerCAmelCase       (				self							:      int       )					->Tuple:



														"""simple docstring"""



														snake_case_           =		ids_tensor([self.batch_size, self.seq_length]		,       self.vocab_size       )
														snake_case_           =		random_attention_mask([self.batch_size, self.seq_length]		,       dtype=tf.floataa       )

														snake_case_           =		None
														if self.use_input_lengths:
																					snake_case_           =		(
																					    ids_tensor([self.batch_size]		,       vocab_size=2       ) + self.seq_length - 2
																					)  # small variation of seq_length

														snake_case_           =		None
														if self.use_token_type_ids:
																					snake_case_           =		ids_tensor([self.batch_size, self.seq_length]		,       self.n_langs       )

														snake_case_           =		None
														snake_case_           =		None
														snake_case_           =		None
														if self.use_labels:
																					snake_case_           =		ids_tensor([self.batch_size]		,       self.type_sequence_label_size       )
																					snake_case_           =		ids_tensor([self.batch_size, self.seq_length]		,       self.num_labels       )
																					snake_case_           =		ids_tensor([self.batch_size]		,       2		,       dtype=tf.floataa       )
																					snake_case_           =		ids_tensor([self.batch_size]		,       self.num_choices       )

														snake_case_           =		FlaubertConfig(
														    vocab_size=self.vocab_size		,       n_special=self.n_special		,       emb_dim=self.hidden_size		,       n_layers=self.num_hidden_layers		,       n_heads=self.num_attention_heads		,       dropout=self.hidden_dropout_prob		,       attention_dropout=self.attention_probs_dropout_prob		,       gelu_activation=self.gelu_activation		,       sinusoidal_embeddings=self.sinusoidal_embeddings		,       asm=self.asm		,       causal=self.causal		,       n_langs=self.n_langs		,       max_position_embeddings=self.max_position_embeddings		,       initializer_range=self.initializer_range		,       summary_type=self.summary_type		,       use_proj=self.use_proj		,       bos_token_id=self.bos_token_id		,       )

														return (
														    config,
														    input_ids,
														    token_type_ids,
														    input_lengths,
														    sequence_labels,
														    token_labels,
														    is_impossible_labels,
														    choice_labels,
														    input_mask,
														)



							def 		lowerCAmelCase       (				self							:      Tuple		,       UpperCAmelCase_							:      Optional[int]		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      Optional[Any]		,       UpperCAmelCase_							:      Union[str, Any]		,       UpperCAmelCase_							:      Optional[Any]		,       UpperCAmelCase_							:      Tuple		,       UpperCAmelCase_							:      int		,       UpperCAmelCase_							:      Tuple		,       UpperCAmelCase_							:      Optional[int]		,       )					->Optional[Any]:



														"""simple docstring"""



														snake_case_           =		TFFlaubertModel(config=_SCREAMING_SNAKE_CASE       )
														snake_case_           =		{"""input_ids""": input_ids, """lengths""": input_lengths, """langs""": token_type_ids}
														snake_case_           =		model(_SCREAMING_SNAKE_CASE       )

														snake_case_           =		[input_ids, input_mask]
														snake_case_           =		model(_SCREAMING_SNAKE_CASE       )
														self.parent.assertEqual(result.last_hidden_state.shape		,       (self.batch_size, self.seq_length, self.hidden_size)       )



							def 		lowerCAmelCase       (				self							:      Union[str, Any]		,       UpperCAmelCase_							:      Any		,       UpperCAmelCase_							:      Tuple		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      List[Any]		,       UpperCAmelCase_							:      int		,       UpperCAmelCase_							:      Dict		,       UpperCAmelCase_							:      Dict		,       UpperCAmelCase_							:      Tuple		,       UpperCAmelCase_							:      int		,       )					->Tuple:



														"""simple docstring"""



														snake_case_           =		TFFlaubertWithLMHeadModel(_SCREAMING_SNAKE_CASE       )

														snake_case_           =		{"""input_ids""": input_ids, """lengths""": input_lengths, """langs""": token_type_ids}
														snake_case_           =		model(_SCREAMING_SNAKE_CASE       )

														self.parent.assertEqual(result.logits.shape		,       (self.batch_size, self.seq_length, self.vocab_size)       )



							def 		lowerCAmelCase       (				self							:      Union[str, Any]		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      Union[str, Any]		,       UpperCAmelCase_							:      Optional[int]		,       UpperCAmelCase_							:      List[Any]		,       UpperCAmelCase_							:      List[str]		,       UpperCAmelCase_							:      Optional[Any]		,       UpperCAmelCase_							:      Tuple		,       UpperCAmelCase_							:      Dict		,       UpperCAmelCase_							:      str		,       )					->Tuple:



														"""simple docstring"""



														snake_case_           =		TFFlaubertForQuestionAnsweringSimple(_SCREAMING_SNAKE_CASE       )

														snake_case_           =		{"""input_ids""": input_ids, """lengths""": input_lengths}

														snake_case_           =		model(_SCREAMING_SNAKE_CASE       )

														self.parent.assertEqual(result.start_logits.shape		,       (self.batch_size, self.seq_length)       )
														self.parent.assertEqual(result.end_logits.shape		,       (self.batch_size, self.seq_length)       )



							def 		lowerCAmelCase       (				self							:      Optional[int]		,       UpperCAmelCase_							:      Optional[Any]		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      int		,       UpperCAmelCase_							:      Optional[Any]		,       UpperCAmelCase_							:      int		,       UpperCAmelCase_							:      Tuple		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      Optional[Any]		,       UpperCAmelCase_							:      Optional[int]		,       )					->Union[str, Any]:



														"""simple docstring"""



														snake_case_           =		TFFlaubertForSequenceClassification(_SCREAMING_SNAKE_CASE       )

														snake_case_           =		{"""input_ids""": input_ids, """lengths""": input_lengths}

														snake_case_           =		model(_SCREAMING_SNAKE_CASE       )

														self.parent.assertEqual(result.logits.shape		,       (self.batch_size, self.type_sequence_label_size)       )



							def 		lowerCAmelCase       (				self							:      Any		,       UpperCAmelCase_							:      List[str]		,       UpperCAmelCase_							:      List[str]		,       UpperCAmelCase_							:      List[Any]		,       UpperCAmelCase_							:      List[str]		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      List[str]		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      List[Any]		,       UpperCAmelCase_							:      str		,       )					->Tuple:



														"""simple docstring"""



														snake_case_           =		self.num_labels
														snake_case_           =		TFFlaubertForTokenClassification(config=_SCREAMING_SNAKE_CASE       )
														snake_case_           =		{"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}
														snake_case_           =		model(_SCREAMING_SNAKE_CASE       )
														self.parent.assertEqual(result.logits.shape		,       (self.batch_size, self.seq_length, self.num_labels)       )



							def 		lowerCAmelCase       (				self							:      List[Any]		,       UpperCAmelCase_							:      List[str]		,       UpperCAmelCase_							:      List[Any]		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      int		,       UpperCAmelCase_							:      Any		,       UpperCAmelCase_							:      List[Any]		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      Optional[Any]		,       UpperCAmelCase_							:      Dict		,       )					->Any:



														"""simple docstring"""



														snake_case_           =		self.num_choices
														snake_case_           =		TFFlaubertForMultipleChoice(config=_SCREAMING_SNAKE_CASE       )
														snake_case_           =		tf.tile(tf.expand_dims(_SCREAMING_SNAKE_CASE		,       1       )		,       (1, self.num_choices, 1)       )
														snake_case_           =		tf.tile(tf.expand_dims(_SCREAMING_SNAKE_CASE		,       1       )		,       (1, self.num_choices, 1)       )
														snake_case_           =		tf.tile(tf.expand_dims(_SCREAMING_SNAKE_CASE		,       1       )		,       (1, self.num_choices, 1)       )
														snake_case_           =		{
														    """input_ids""": multiple_choice_inputs_ids,
														    """attention_mask""": multiple_choice_input_mask,
														    """token_type_ids""": multiple_choice_token_type_ids,
														}
														snake_case_           =		model(_SCREAMING_SNAKE_CASE       )
														self.parent.assertEqual(result.logits.shape		,       (self.batch_size, self.num_choices)       )



							def 		lowerCAmelCase       (				self							:      int       )					->int:



														"""simple docstring"""



														snake_case_           =		self.prepare_config_and_inputs()
														(
														    (
														    snake_case_		
														)       ,						(
														    snake_case_		
														)       ,						(
														    snake_case_		
														)       ,						(
														    snake_case_		
														)       ,						(
														    snake_case_		
														)       ,						(
														    snake_case_		
														)       ,						(
														    snake_case_		
														)       ,						(
														    snake_case_		
														)       ,						(
														    snake_case_		
														)       ,								
														)           =		config_and_inputs
														snake_case_           =		{
														    """input_ids""": input_ids,
														    """token_type_ids""": token_type_ids,
														    """langs""": token_type_ids,
														    """lengths""": input_lengths,
														}
														return config, inputs_dict





@require_tf
class      __A     (snake_case__						,		snake_case__						,		unittest.TestCase):





							'''simple docstring'''

							__lowercase:		List[Any]							      =    (
							    (
							        TFFlaubertModel,
							        TFFlaubertWithLMHeadModel,
							        TFFlaubertForSequenceClassification,
							        TFFlaubertForQuestionAnsweringSimple,
							        TFFlaubertForTokenClassification,
							        TFFlaubertForMultipleChoice,
							    )
							    if is_tf_available()
							    else ()
							)
							__lowercase:		Dict							      =    (
							    (TFFlaubertWithLMHeadModel,) if is_tf_available() else ()
							)  # TODO (PVP): Check other models whether language generation is also applicable
							__lowercase:		Union[str, Any]							      =    (
							    {
							        """feature-extraction""": TFFlaubertModel,
							        """fill-mask""": TFFlaubertWithLMHeadModel,
							        """question-answering""": TFFlaubertForQuestionAnsweringSimple,
							        """text-classification""": TFFlaubertForSequenceClassification,
							        """token-classification""": TFFlaubertForTokenClassification,
							        """zero-shot""": TFFlaubertForSequenceClassification,
							    }
							    if is_tf_available()
							    else {}
							)
							__lowercase:		Any							      =    False
							__lowercase:		Optional[Any]							      =    False



							def 		lowerCAmelCase       (				self							:      str		,       UpperCAmelCase_							:      Union[str, Any]		,       UpperCAmelCase_							:      int		,       UpperCAmelCase_							:      Optional[Any]		,       UpperCAmelCase_							:      Tuple		,       UpperCAmelCase_							:      List[Any]       )					->Optional[int]:



														"""simple docstring"""



														if (
														    pipeline_test_casse_name == "QAPipelineTests"
														    and tokenizer_name is not None
														    and not tokenizer_name.endswith("""Fast"""       )
														):
																					# `QAPipelineTests` fails for a few models when the slower tokenizer are used.
																					# (The slower tokenizers were never used for pipeline tests before the pipeline testing rework)
																					# TODO: check (and possibly fix) the `QAPipelineTests` with slower tokenizer
																					return True

														return False



							def 		lowerCAmelCase       (				self							:      List[Any]       )					->Dict:



														"""simple docstring"""



														snake_case_           =		TFFlaubertModelTester(self       )
														snake_case_           =		ConfigTester(self		,       config_class=_SCREAMING_SNAKE_CASE		,       emb_dim=37       )



							def 		lowerCAmelCase       (				self							:      Union[str, Any]       )					->Union[str, Any]:



														"""simple docstring"""



														self.config_tester.run_common_tests()



							def 		lowerCAmelCase       (				self							:      Optional[int]       )					->Optional[int]:



														"""simple docstring"""



														snake_case_           =		self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_flaubert_model(*_SCREAMING_SNAKE_CASE       )



							def 		lowerCAmelCase       (				self							:      List[Any]       )					->List[str]:



														"""simple docstring"""



														snake_case_           =		self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_flaubert_lm_head(*_SCREAMING_SNAKE_CASE       )



							def 		lowerCAmelCase       (				self							:      Tuple       )					->Optional[Any]:



														"""simple docstring"""



														snake_case_           =		self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_flaubert_qa(*_SCREAMING_SNAKE_CASE       )



							def 		lowerCAmelCase       (				self							:      Any       )					->Any:



														"""simple docstring"""



														snake_case_           =		self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_flaubert_sequence_classif(*_SCREAMING_SNAKE_CASE       )



							def 		lowerCAmelCase       (				self							:      List[Any]       )					->int:



														"""simple docstring"""



														snake_case_           =		self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_flaubert_for_token_classification(*_SCREAMING_SNAKE_CASE       )



							def 		lowerCAmelCase       (				self							:      List[str]       )					->str:



														"""simple docstring"""



														snake_case_           =		self.model_tester.prepare_config_and_inputs()
														self.model_tester.create_and_check_flaubert_for_multiple_choice(*_SCREAMING_SNAKE_CASE       )



							@slow
							def 		lowerCAmelCase       (				self							:      List[Any]       )					->Optional[int]:



														"""simple docstring"""



														for model_name in TF_FLAUBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
																					snake_case_           =		TFFlaubertModel.from_pretrained(_SCREAMING_SNAKE_CASE       )
																					self.assertIsNotNone(_SCREAMING_SNAKE_CASE       )





@require_tf
@require_sentencepiece
@require_tokenizers
class      __A     (unittest.TestCase):





							'''simple docstring'''

							@slow
							def 		lowerCAmelCase       (				self							:      Union[str, Any]       )					->Any:



														"""simple docstring"""



														snake_case_           =		TFFlaubertModel.from_pretrained("""jplu/tf-flaubert-small-cased"""       )

														snake_case_           =		tf.convert_to_tensor(
														    [[0, 158, 735, 2_592, 1_424, 6_727, 82, 1]]		,       dtype=tf.intaa		,       )  # "J'aime flaubert !"

														snake_case_           =		model(_SCREAMING_SNAKE_CASE       )[0]
														snake_case_           =		tf.TensorShape((1, 8, 512)       )
														self.assertEqual(output.shape		,       _SCREAMING_SNAKE_CASE       )
														# compare the actual values for a slice.
														snake_case_           =		tf.convert_to_tensor(
														    [
														        [
														            [-1.8_768_773, -1.566_555, 0.27_072_418],
														            [-1.6_920_038, -0.5_873_505, 1.9_329_599],
														            [-2.9_563_985, -1.6_993_835, 1.7_972_052],
														        ]
														    ]		,       dtype=tf.floataa		,       )

														self.assertTrue(np.allclose(output[:, :3, :3].numpy()		,       expected_slice.numpy()		,       atol=1E-4       )       )







"""simple docstring"""
# XXX: we want transformers master here - in the absense of conftest manipulating sys.path:
# hack it in for now:
import sys
from pathlib import Path


__SCREAMING_SNAKE_CASE							:    Union[str, Any]		=    Path(__file__).resolve().parents[3] / 'src'
sys.path.insert(1, str(git_repo_path))

import dataclasses  # noqa
import io  # noqa
import itertools  # noqa
import json  # noqa
import os  # noqa
import unittest  # noqa
from copy import deepcopy  # noqa

from parameterized import parameterized  # noqa
from transformers import TrainingArguments, is_torch_available  # noqa
from transformers.deepspeed import is_deepspeed_available  # noqa
from transformers.file_utils import WEIGHTS_NAME  # noqa
from transformers.testing_utils import (  # noqa
    CaptureLogger,
    ExtendSysPath,
    TestCasePlus,
    execute_subprocess_async,
    get_gpu_count,
    mockenv_context,
    require_deepspeed,
    require_torch_gpu,
    require_torch_multi_gpu,
    slow,
)
from transformers.trainer_utils import set_seed  # noqa


set_seed(42)

__SCREAMING_SNAKE_CASE							:    Dict		=    {'base': 'patrickvonplaten/wav2vec2_tiny_random', 'robust': 'patrickvonplaten/wav2vec2_tiny_random_robust'}

__SCREAMING_SNAKE_CASE							:    Dict		=    'zero2'
__SCREAMING_SNAKE_CASE							:    List[Any]		=    'zero3'
__SCREAMING_SNAKE_CASE							:    int		=    [ZEROa, ZEROa]







def 						_a				(      _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				, _SCREAMING_SNAKE_CASE				)    ->				Union[str, Any]:
							# customize the test name generator function as we want both params to appear in the sub-test
							# name, as by default it shows only the first param
							snake_case_           =		parameterized.to_safe_name("""_""".join(str(_SCREAMING_SNAKE_CASE				) for x in param.args				)				)
							return f"""{func.__name__}_{param_based_name}"""


# Cartesian-product of zero stages with models to test
__SCREAMING_SNAKE_CASE							:    Dict		=    list(itertools.product(stages, models.keys()))





@slow
@require_deepspeed
@require_torch_gpu
class      __A     (snake_case__):





							'''simple docstring'''

							@parameterized.expand(UpperCAmelCase_		,       name_func=UpperCAmelCase_       )
							def 		lowerCAmelCase       (				self							:      Union[str, Any]		,       UpperCAmelCase_							:      Dict		,       UpperCAmelCase_							:      Union[str, Any]       )					->Any:



														"""simple docstring"""



														self.run_and_check(
														    stage=UpperCAmelCase_		,       model=UpperCAmelCase_		,       distributed=UpperCAmelCase_		,       fpaa=UpperCAmelCase_		,       )



							@require_torch_multi_gpu
							@parameterized.expand(UpperCAmelCase_		,       name_func=UpperCAmelCase_       )
							def 		lowerCAmelCase       (				self							:      Optional[int]		,       UpperCAmelCase_							:      List[Any]		,       UpperCAmelCase_							:      Optional[Any]       )					->Optional[Any]:



														"""simple docstring"""



														self.run_and_check(
														    stage=UpperCAmelCase_		,       model=UpperCAmelCase_		,       distributed=UpperCAmelCase_		,       fpaa=UpperCAmelCase_		,       )



							@parameterized.expand(UpperCAmelCase_		,       name_func=UpperCAmelCase_       )
							def 		lowerCAmelCase       (				self							:      Tuple		,       UpperCAmelCase_							:      Dict		,       UpperCAmelCase_							:      Optional[int]       )					->List[str]:



														"""simple docstring"""



														self.run_and_check(
														    stage=UpperCAmelCase_		,       model=UpperCAmelCase_		,       distributed=UpperCAmelCase_		,       fpaa=UpperCAmelCase_		,       )



							@require_torch_multi_gpu
							@parameterized.expand(UpperCAmelCase_		,       name_func=UpperCAmelCase_       )
							def 		lowerCAmelCase       (				self							:      Dict		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      List[Any]       )					->Optional[int]:



														"""simple docstring"""



														self.run_and_check(
														    stage=UpperCAmelCase_		,       model=UpperCAmelCase_		,       distributed=UpperCAmelCase_		,       fpaa=UpperCAmelCase_		,       )



							def 		lowerCAmelCase       (				self							:      Optional[int]		,       UpperCAmelCase_							:      Union[str, Any]       )					->Optional[int]:



														"""simple docstring"""



														pass



							def 		lowerCAmelCase       (				self							:      Any		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      int = 10		,       UpperCAmelCase_							:      bool = True		,       UpperCAmelCase_							:      bool = True		,       UpperCAmelCase_							:      bool = True		,       )					->List[str]:



														"""simple docstring"""



														snake_case_           =		models[model]

														snake_case_           =		self.run_trainer(
														    stage=UpperCAmelCase_		,       model_name=UpperCAmelCase_		,       eval_steps=UpperCAmelCase_		,       num_train_epochs=1		,       distributed=UpperCAmelCase_		,       fpaa=UpperCAmelCase_		,       )

														self.do_checks(UpperCAmelCase_       )

														return output_dir



							def 		lowerCAmelCase       (				self							:      Union[str, Any]		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      str		,       UpperCAmelCase_							:      int = 10		,       UpperCAmelCase_							:      int = 1		,       UpperCAmelCase_							:      bool = True		,       UpperCAmelCase_							:      bool = True		,       )					->List[str]:



														"""simple docstring"""



														snake_case_           =		self.get_auto_remove_tmp_dir("""./xxx"""		,       after=UpperCAmelCase_       )
														snake_case_           =		F"""
            --model_name_or_path {model_name}
            --dataset_name hf-internal-testing/librispeech_asr_dummy
            --dataset_config_name clean
            --train_split_name validation
            --validation_split_name validation
            --output_dir {output_dir}
            --num_train_epochs {str(UpperCAmelCase_       )}
            --per_device_train_batch_size 2
            --per_device_eval_batch_size 2
            --evaluation_strategy steps
            --learning_rate 5e-4
            --warmup_steps 8
            --orthography timit
            --preprocessing_num_workers 1
            --group_by_length
            --freeze_feature_extractor
            --report_to none
            --save_steps 0
            --eval_steps {eval_steps}
            --report_to none
        """.split()

														if fpaa:
																					args.extend(["""--fp16"""]       )

														# currently ds_config_wav2vec2_zero.json requires "zero_optimization.find_unused_parameters": true,
														# hence the separate config files
														snake_case_           =		F"""--deepspeed {self.test_file_dir_str}/ds_config_wav2vec2_{stage}.json""".split()
														snake_case_           =		[F"""{self.examples_dir_str}/research_projects/wav2vec2/run_asr.py"""]
														snake_case_           =		self.get_launcher(UpperCAmelCase_       )

														snake_case_           =		launcher + script + args + ds_args
														# keep for quick debug
														# print(" ".join([f"\nPYTHONPATH={self.src_dir_str}"] +cmd)); die
														execute_subprocess_async(UpperCAmelCase_		,       env=self.get_env()       )

														return output_dir



							def 		lowerCAmelCase       (				self							:      Union[str, Any]		,       UpperCAmelCase_							:      Any=False       )					->Tuple:



														"""simple docstring"""



														snake_case_           =		min(2		,       get_gpu_count()       ) if distributed else 1
														return F"""deepspeed --num_nodes 1 --num_gpus {num_gpus}""".split()



