






'''simple docstring'''
from __future__ import annotations

import unittest

from transformers import FunnelConfig, is_tf_available
from transformers.testing_utils import require_tf

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 tensorflow as tf

 from transformers import (
     TFFunnelBaseModel,
     TFFunnelForMaskedLM,
     TFFunnelForMultipleChoice,
     TFFunnelForPreTraining,
     TFFunnelForQuestionAnswering,
     TFFunnelForSequenceClassification,
     TFFunnelForTokenClassification,
     TFFunnelModel,
 )


class 							_UpperCAmelCase    :




    def __init__(      self	:							int	,  a	:							int	,  a	:							Tuple=1_3	,  a	:							Tuple=7	,  a	:							Union[str, Any]=True	,  a	:							Tuple=True	,  a	:							Dict=True	,  a	:							Optional[int]=True	,  a	:							str=9_9	,  a	:							Optional[Any]=[1, 1, 2]	,  a	:							int=1	,  a	:							int=3_2	,  a	:							List[Any]=4	,  a	:							Optional[Any]=8	,  a	:							List[Any]=3_7	,  a	:							Optional[int]="gelu_new"	,  a	:							str=0.1	,  a	:							List[Any]=0.1	,  a	:							List[Any]=0.0	,  a	:							str=5_1_2	,  a	:							Tuple=3	,  a	:							List[str]=0.02	,  a	:							Any=3	,  a	:							Optional[Any]=4	,  a	:							List[Any]=None	,  a	:							Dict=False	,  ):






       '''simple docstring'''






       lowercase_						:     str							     =  parent
       lowercase_						:     Optional[Any]							     =  batch_size
       lowercase_						:     Dict							     =  seq_length
       lowercase_						:     Dict							     =  is_training
       lowercase_						:     Tuple							     =  use_input_mask
       lowercase_						:     Union[str, Any]							     =  use_token_type_ids
       lowercase_						:     int							     =  use_labels
       lowercase_						:     int							     =  vocab_size
       lowercase_						:     str							     =  block_sizes
       lowercase_						:     Tuple							     =  num_decoder_layers
       lowercase_						:     List[str]							     =  d_model
       lowercase_						:     Optional[Any]							     =  n_head
       lowercase_						:     int							     =  d_head
       lowercase_						:     Any							     =  d_inner
       lowercase_						:     Any							     =  hidden_act
       lowercase_						:     List[str]							     =  hidden_dropout
       lowercase_						:     Optional[Any]							     =  attention_dropout
       lowercase_						:     int							     =  activation_dropout
       lowercase_						:     Any							     =  max_position_embeddings
       lowercase_						:     int							     =  type_vocab_size
       lowercase_						:     Union[str, Any]							     =  2
       lowercase_						:     Optional[Any]							     =  num_labels
       lowercase_						:     Union[str, Any]							     =  num_choices
       lowercase_						:     List[Any]							     =  scope
       lowercase_						:     str							     =  initializer_std

       # Used in the tests to check the size of the first attention layer
       lowercase_						:     List[Any]							     =  n_head
       # Used in the tests to check the size of the first hidden state
       lowercase_						:     Dict							     =  self.d_model
       # Used in the tests to check the number of output hidden states/attentions
       lowercase_						:     int							     =  sum(self.block_sizes      ) + (0 if base else self.num_decoder_layers)
       # FunnelModel adds two hidden layers: input embeddings and the sum of the upsampled encoder hidden state with
       # the last hidden state of the first block (which is the first hidden state of the decoder).
       if not base:
          lowercase_						:     Tuple							     =  self.num_hidden_layers + 2




    def 					lowerCAmelCase__					(      self	:							int      ):






       '''simple docstring'''






       lowercase_						:     List[Any]							     =  ids_tensor([self.batch_size, self.seq_length]	,  self.vocab_size      )

       lowercase_						:     Optional[int]							     =  None
       if self.use_input_mask:
          lowercase_						:     Union[str, Any]							     =  random_attention_mask([self.batch_size, self.seq_length]      )

       lowercase_						:     Optional[Any]							     =  None
       if self.use_token_type_ids:
          lowercase_						:     int							     =  ids_tensor([self.batch_size, self.seq_length]	,  self.type_vocab_size      )

       lowercase_						:     int							     =  None
       lowercase_						:     List[Any]							     =  None
       lowercase_						:     Dict							     =  None
       if self.use_labels:
          lowercase_						:     Dict							     =  ids_tensor([self.batch_size]	,  self.type_sequence_label_size      )
          lowercase_						:     Optional[int]							     =  ids_tensor([self.batch_size, self.seq_length]	,  self.num_labels      )
          lowercase_						:     List[Any]							     =  ids_tensor([self.batch_size]	,  self.num_choices      )

       lowercase_						:     Optional[Any]							     =  FunnelConfig(
           vocab_size=self.vocab_size	,  block_sizes=self.block_sizes	,  num_decoder_layers=self.num_decoder_layers	,  d_model=self.d_model	,  n_head=self.n_head	,  d_head=self.d_head	,  d_inner=self.d_inner	,  hidden_act=self.hidden_act	,  hidden_dropout=self.hidden_dropout	,  attention_dropout=self.attention_dropout	,  activation_dropout=self.activation_dropout	,  max_position_embeddings=self.max_position_embeddings	,  type_vocab_size=self.type_vocab_size	,  initializer_std=self.initializer_std	,  )

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




    def 					lowerCAmelCase__					(      self	:							List[Any]	,  a	:							Union[str, Any]	,  a	:							str	,  a	:							int	,  a	:							List[Any]	,  a	:							Dict	,  a	:							Union[str, Any]	,  a	:							Dict	,  ):






       '''simple docstring'''






       lowercase_						:     Dict							     =  TFFunnelModel(config=a      )
       lowercase_						:     List[str]							     =  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
       lowercase_						:     Dict							     =  model(a      )

       lowercase_						:     Any							     =  [input_ids, input_mask]
       lowercase_						:     Union[str, Any]							     =  model(a      )

       lowercase_						:     List[str]							     =  model(a      )
       self.parent.assertEqual(result.last_hidden_state.shape	,  (self.batch_size, self.seq_length, self.d_model)      )

       lowercase_						:     List[str]							     =  False
       lowercase_						:     List[Any]							     =  TFFunnelModel(config=a      )
       lowercase_						:     List[Any]							     =  model(a      )
       self.parent.assertEqual(result.last_hidden_state.shape	,  (self.batch_size, self.seq_length, self.d_model)      )

       lowercase_						:     List[Any]							     =  False
       lowercase_						:     str							     =  TFFunnelModel(config=a      )
       lowercase_						:     Union[str, Any]							     =  model(a      )
       self.parent.assertEqual(result.last_hidden_state.shape	,  (self.batch_size, self.seq_length, self.d_model)      )




    def 					lowerCAmelCase__					(      self	:							str	,  a	:							Union[str, Any]	,  a	:							str	,  a	:							int	,  a	:							List[Any]	,  a	:							List[str]	,  a	:							Any	,  a	:							Dict	,  ):






       '''simple docstring'''






       lowercase_						:     Optional[Any]							     =  TFFunnelBaseModel(config=a      )
       lowercase_						:     Optional[Any]							     =  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
       lowercase_						:     List[str]							     =  model(a      )

       lowercase_						:     str							     =  [input_ids, input_mask]
       lowercase_						:     Optional[Any]							     =  model(a      )

       lowercase_						:     List[Any]							     =  model(a      )
       self.parent.assertEqual(result.last_hidden_state.shape	,  (self.batch_size, 2, self.d_model)      )

       lowercase_						:     Optional[Any]							     =  False
       lowercase_						:     Tuple							     =  TFFunnelBaseModel(config=a      )
       lowercase_						:     Tuple							     =  model(a      )
       self.parent.assertEqual(result.last_hidden_state.shape	,  (self.batch_size, 3, self.d_model)      )

       lowercase_						:     Any							     =  False
       lowercase_						:     int							     =  TFFunnelBaseModel(config=a      )
       lowercase_						:     Union[str, Any]							     =  model(a      )
       self.parent.assertEqual(result.last_hidden_state.shape	,  (self.batch_size, 2, self.d_model)      )




    def 					lowerCAmelCase__					(      self	:							int	,  a	:							Dict	,  a	:							Dict	,  a	:							int	,  a	:							List[Any]	,  a	:							Union[str, Any]	,  a	:							Any	,  a	:							Tuple	,  ):






       '''simple docstring'''






       lowercase_						:     List[Any]							     =  TFFunnelForPreTraining(config=a      )
       lowercase_						:     Tuple							     =  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
       lowercase_						:     List[Any]							     =  model(a      )
       self.parent.assertEqual(result.logits.shape	,  (self.batch_size, self.seq_length)      )




    def 					lowerCAmelCase__					(      self	:							Any	,  a	:							List[Any]	,  a	:							Optional[int]	,  a	:							str	,  a	:							Optional[Any]	,  a	:							Tuple	,  a	:							Dict	,  a	:							Optional[int]	,  ):






       '''simple docstring'''






       lowercase_						:     Union[str, Any]							     =  TFFunnelForMaskedLM(config=a      )
       lowercase_						:     Any							     =  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
       lowercase_						:     List[Any]							     =  model(a      )
       self.parent.assertEqual(result.logits.shape	,  (self.batch_size, self.seq_length, self.vocab_size)      )




    def 					lowerCAmelCase__					(      self	:							List[str]	,  a	:							Optional[int]	,  a	:							Tuple	,  a	:							str	,  a	:							Tuple	,  a	:							Optional[Any]	,  a	:							Optional[int]	,  a	:							List[Any]	,  ):






       '''simple docstring'''






       lowercase_						:     str							     =  self.num_labels
       lowercase_						:     List[Any]							     =  TFFunnelForSequenceClassification(config=a      )
       lowercase_						:     str							     =  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
       lowercase_						:     List[str]							     =  model(a      )
       self.parent.assertEqual(result.logits.shape	,  (self.batch_size, self.num_labels)      )




    def 					lowerCAmelCase__					(      self	:							List[Any]	,  a	:							Tuple	,  a	:							Dict	,  a	:							Union[str, Any]	,  a	:							str	,  a	:							str	,  a	:							Union[str, Any]	,  a	:							List[str]	,  ):






       '''simple docstring'''






       lowercase_						:     List[Any]							     =  self.num_choices
       lowercase_						:     Dict							     =  TFFunnelForMultipleChoice(config=a      )
       lowercase_						:     Union[str, Any]							     =  tf.tile(tf.expand_dims(a	,  1      )	,  (1, self.num_choices, 1)      )
       lowercase_						:     str							     =  tf.tile(tf.expand_dims(a	,  1      )	,  (1, self.num_choices, 1)      )
       lowercase_						:     Optional[int]							     =  tf.tile(tf.expand_dims(a	,  1      )	,  (1, self.num_choices, 1)      )
       lowercase_						:     Tuple							     =  {
           "input_ids": multiple_choice_inputs_ids,
           "attention_mask": multiple_choice_input_mask,
           "token_type_ids": multiple_choice_token_type_ids,
       }
       lowercase_						:     List[str]							     =  model(a      )
       self.parent.assertEqual(result.logits.shape	,  (self.batch_size, self.num_choices)      )




    def 					lowerCAmelCase__					(      self	:							Tuple	,  a	:							Dict	,  a	:							Tuple	,  a	:							Dict	,  a	:							str	,  a	:							Optional[Any]	,  a	:							int	,  a	:							str	,  ):






       '''simple docstring'''






       lowercase_						:     List[Any]							     =  self.num_labels
       lowercase_						:     Dict							     =  TFFunnelForTokenClassification(config=a      )
       lowercase_						:     List[str]							     =  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
       lowercase_						:     Dict							     =  model(a      )
       self.parent.assertEqual(result.logits.shape	,  (self.batch_size, self.seq_length, self.num_labels)      )




    def 					lowerCAmelCase__					(      self	:							List[str]	,  a	:							List[Any]	,  a	:							Optional[int]	,  a	:							int	,  a	:							str	,  a	:							Tuple	,  a	:							str	,  a	:							Union[str, Any]	,  ):






       '''simple docstring'''






       lowercase_						:     Tuple							     =  TFFunnelForQuestionAnswering(config=a      )
       lowercase_						:     Optional[Any]							     =  {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}
       lowercase_						:     Union[str, Any]							     =  model(a      )
       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	:							Union[str, Any]      ):






       '''simple docstring'''






       lowercase_						:     List[str]							     =  self.prepare_config_and_inputs()
       (
           (
           lowercase_
       )     ,		(
           lowercase_
       )     ,		(
           lowercase_
       )     ,		(
           lowercase_
       )     ,		(
           lowercase_
       )     ,		(
           lowercase_
       )     ,		(
           lowercase_
       )     ,		
       )						:     List[Any]							     =  config_and_inputs
       lowercase_						:     List[str]							     =  {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
       return config, inputs_dict


@require_tf
class 							_UpperCAmelCase    (		snake_case					,       snake_case					,       unittest.TestCase      ):
    __lowerCamelCase: Optional[Any]									=     (
        (
            TFFunnelModel,
            TFFunnelForMaskedLM,
            TFFunnelForPreTraining,
            TFFunnelForQuestionAnswering,
            TFFunnelForTokenClassification,
        )
        if is_tf_available()
        else ()
    )
    __lowerCamelCase: Dict									=     (
        {
            'feature-extraction': (TFFunnelBaseModel, TFFunnelModel),
            'fill-mask': TFFunnelForMaskedLM,
            'question-answering': TFFunnelForQuestionAnswering,
            'text-classification': TFFunnelForSequenceClassification,
            'token-classification': TFFunnelForTokenClassification,
            'zero-shot': TFFunnelForSequenceClassification,
        }
        if is_tf_available()
        else {}
    )
    __lowerCamelCase: str									=     False
    __lowerCamelCase: Tuple									=     False




    def 					lowerCAmelCase__					(      self	:							Tuple      ):






       '''simple docstring'''






       lowercase_						:     str							     =  TFFunnelModelTester(self      )
       lowercase_						:     Optional[Any]							     =  ConfigTester(self	,  config_class=a      )




    def 					lowerCAmelCase__					(      self	:							Dict      ):






       '''simple docstring'''






       self.config_tester.run_common_tests()




    def 					lowerCAmelCase__					(      self	:							Dict      ):






       '''simple docstring'''






       lowercase_						:     Any							     =  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_model(*a      )




    def 					lowerCAmelCase__					(      self	:							List[str]      ):






       '''simple docstring'''






       lowercase_						:     List[str]							     =  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_pretraining(*a      )




    def 					lowerCAmelCase__					(      self	:							Optional[Any]      ):






       '''simple docstring'''






       lowercase_						:     Any							     =  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_masked_lm(*a      )




    def 					lowerCAmelCase__					(      self	:							Dict      ):






       '''simple docstring'''






       lowercase_						:     List[Any]							     =  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_token_classification(*a      )





    def 					lowerCAmelCase__					(      self	:							str      ):






       '''simple docstring'''






       lowercase_						:     int							     =  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_question_answering(*a      )


@require_tf
class 							_UpperCAmelCase    (		snake_case					,       unittest.TestCase      ):
    __lowerCamelCase: str									=     (
        (TFFunnelBaseModel, TFFunnelForMultipleChoice, TFFunnelForSequenceClassification) if is_tf_available() else ()
    )
    __lowerCamelCase: Any									=     False
    __lowerCamelCase: List[Any]									=     False




    def 					lowerCAmelCase__					(      self	:							Dict      ):






       '''simple docstring'''






       lowercase_						:     Optional[Any]							     =  TFFunnelModelTester(self	,  base=a      )
       lowercase_						:     str							     =  ConfigTester(self	,  config_class=a      )




    def 					lowerCAmelCase__					(      self	:							List[Any]      ):






       '''simple docstring'''






       self.config_tester.run_common_tests()




    def 					lowerCAmelCase__					(      self	:							List[Any]      ):






       '''simple docstring'''






       lowercase_						:     Optional[Any]							     =  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_base_model(*a      )




    def 					lowerCAmelCase__					(      self	:							Union[str, Any]      ):






       '''simple docstring'''






       lowercase_						:     int							     =  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_sequence_classification(*a      )





    def 					lowerCAmelCase__					(      self	:							str      ):






       '''simple docstring'''






       lowercase_						:     Union[str, Any]							     =  self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_multiple_choice(*a      )












'''simple docstring'''
import inspect
import os
import unittest
from pathlib import Path

import torch

import accelerate
from accelerate.test_utils import execute_subprocess_async
from accelerate.test_utils.testing import run_command


class 							_UpperCAmelCase    (		unittest.TestCase      ):
    __lowerCamelCase: List[Any]									=     inspect.getfile(accelerate.test_utils      )
    __lowerCamelCase: List[Any]									=     os.path.sep.join(mod_file.split(os.path.sep      )[:-1] + ['scripts', 'test_cli.py']      )

    __lowerCamelCase: Optional[Any]									=     ['accelerate', 'launch']
    __lowerCamelCase: List[str]									=     Path.home() / '.cache/huggingface/accelerate'
    __lowerCamelCase: Dict									=     'default_config.yaml'
    __lowerCamelCase: Union[str, Any]									=     config_folder / config_file
    __lowerCamelCase: Tuple									=     config_folder / '_default_config.yaml'

    __lowerCamelCase: Union[str, Any]									=     Path('tests/test_configs'      )




    @classmethod
    def 					lowerCAmelCase__					(      cls	:							List[Any]      ):






       '''simple docstring'''






       if cls.config_path.is_file():
          cls.config_path.rename(cls.changed_path      )




    @classmethod
    def 					lowerCAmelCase__					(      cls	:							str      ):






       '''simple docstring'''






       if cls.changed_path.is_file():
          cls.changed_path.rename(cls.config_path      )




    def 					lowerCAmelCase__					(      self	:							Dict      ):






       '''simple docstring'''






       lowercase_						:     List[str]							     =  self.base_cmd
       if torch.cuda.is_available() and (torch.cuda.device_count() > 1):
          cmd += ["--multi_gpu"]
       execute_subprocess_async(cmd + [self.test_file_path]	,  env=os.environ.copy()      )




    def 					lowerCAmelCase__					(      self	:							Optional[int]      ):






       '''simple docstring'''






       for config in sorted(self.test_config_path.glob("**/*.yaml"      )      ):
          with self.subTest(config_file=a      ):
             execute_subprocess_async(
                 self.base_cmd + ["--config_file", str(a      ), self.test_file_path]	,  env=os.environ.copy()      )





    def 					lowerCAmelCase__					(      self	:							List[str]      ):






       '''simple docstring'''






       execute_subprocess_async(["accelerate", "test"]	,  env=os.environ.copy()      )


class 							_UpperCAmelCase    (		unittest.TestCase      ):
    __lowerCamelCase: Tuple									=     'test-tpu'
    __lowerCamelCase: Dict									=     'us-central1-a'
    __lowerCamelCase: List[str]									=     'ls'
    __lowerCamelCase: Optional[int]									=     ['accelerate', 'tpu-config']
    __lowerCamelCase: Optional[Any]									=     'cd /usr/share'
    __lowerCamelCase: Any									=     'tests/test_samples/test_command_file.sh'
    __lowerCamelCase: Tuple									=     'Running gcloud compute tpus tpu-vm ssh'




    def 					lowerCAmelCase__					(      self	:							Tuple      ):






       '''simple docstring'''






       lowercase_						:     str							     =  run_command(
           self.cmd
           + ["--command", self.command, "--tpu_zone", self.tpu_zone, "--tpu_name", self.tpu_name, "--debug"]	,  return_stdout=a	,  )
       self.assertIn(
           f"""{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls --worker all"""	,  a	,  )




    def 					lowerCAmelCase__					(      self	:							Optional[Any]      ):






       '''simple docstring'''






       lowercase_						:     Optional[int]							     =  run_command(
           self.cmd
           + [
               "--config_file",
               "tests/test_configs/0_12_0.yaml",
               "--command",
               self.command,
               "--tpu_zone",
               self.tpu_zone,
               "--tpu_name",
               self.tpu_name,
               "--debug",
           ]	,  return_stdout=a	,  )
       self.assertIn(
           f"""{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls --worker all"""	,  a	,  )




    def 					lowerCAmelCase__					(      self	:							int      ):






       '''simple docstring'''






       lowercase_						:     Union[str, Any]							     =  run_command(
           self.cmd + ["--config_file", "tests/test_configs/latest.yaml", "--debug"]	,  return_stdout=a      )
       self.assertIn(
           f"""{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; echo \"hello world\"; echo \"this is a second command\" --worker all"""	,  a	,  )




    def 					lowerCAmelCase__					(      self	:							Optional[int]      ):






       '''simple docstring'''






       lowercase_						:     Any							     =  run_command(
           self.cmd + ["--config_file", "tests/test_configs/latest.yaml", "--command", self.command, "--debug"]	,  return_stdout=a	,  )
       self.assertIn(
           f"""{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls --worker all"""	,  a	,  )




    def 					lowerCAmelCase__					(      self	:							Optional[Any]      ):






       '''simple docstring'''






       lowercase_						:     Optional[Any]							     =  run_command(
           self.cmd
           + [
               "--config_file",
               "tests/test_configs/latest.yaml",
               "--command",
               self.command,
               "--command",
               "echo \"Hello World\"",
               "--debug",
           ]	,  return_stdout=a	,  )
       self.assertIn(
           f"""{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; ls; echo \"Hello World\" --worker all"""	,  a	,  )




    def 					lowerCAmelCase__					(      self	:							Any      ):






       '''simple docstring'''






       lowercase_						:     Optional[Any]							     =  run_command(
           self.cmd
           + ["--config_file", "tests/test_configs/latest.yaml", "--command_file", self.command_file, "--debug"]	,  return_stdout=a	,  )
       self.assertIn(
           f"""{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; echo \"hello world\"; echo \"this is a second command\" --worker all"""	,  a	,  )




    def 					lowerCAmelCase__					(      self	:							Dict      ):






       '''simple docstring'''






       lowercase_						:     List[Any]							     =  run_command(
           self.cmd
           + [
               "--config_file",
               "tests/test_configs/0_12_0.yaml",
               "--command_file",
               self.command_file,
               "--tpu_zone",
               self.tpu_zone,
               "--tpu_name",
               self.tpu_name,
               "--debug",
           ]	,  return_stdout=a	,  )
       self.assertIn(
           f"""{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; echo \"hello world\"; echo \"this is a second command\" --worker all"""	,  a	,  )




    def 					lowerCAmelCase__					(      self	:							Dict      ):






       '''simple docstring'''






       lowercase_						:     Union[str, Any]							     =  run_command(
           self.cmd + ["--config_file", "tests/test_configs/latest.yaml", "--install_accelerate", "--debug"]	,  return_stdout=a	,  )
       self.assertIn(
           f"""{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; pip install accelerate -U; echo \"hello world\"; echo \"this is a second command\" --worker all"""	,  a	,  )





    def 					lowerCAmelCase__					(      self	:							Optional[int]      ):






       '''simple docstring'''






       lowercase_						:     Optional[Any]							     =  run_command(
           self.cmd
           + [
               "--config_file",
               "tests/test_configs/latest.yaml",
               "--install_accelerate",
               "--accelerate_version",
               "12.0.0",
               "--debug",
           ]	,  return_stdout=a	,  )
       self.assertIn(
           f"""{self.gcloud} test-tpu --zone us-central1-a --command {self.base_output}; pip install accelerate==12.0.0; echo \"hello world\"; echo \"this is a second command\" --worker all"""	,  a	,  )




