

import argparse
import os

import evaluate
import torch
from datasets import load_dataset
from torch.optim import AdamW
from torch.utils.data import DataLoader
from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed

from accelerate import Accelerator, DistributedType
from accelerate.local_sgd import LocalSGD


########################################################################
# This is a fully working simple example to use Accelerate
# with LocalSGD, which is a method to synchronize model
# parameters every K batches. It is different, but complementary
# to gradient accumulation.
#
# This example trains a Bert base model on GLUE MRPC
# in any of the following settings (with the same script):
#   - single CPU or single GPU
#   - multi GPUS (using PyTorch distributed mode)
#   - (multi) TPUs
#   - fp16 (mixed-precision) or fp32 (normal precision)
#
# To run it in each of these various modes, follow the instructions
# in the readme for examples:
# https://github.com/huggingface/accelerate/tree/main/examples
#
########################################################################


lowerCAmelCase							:  str            =						16
lowerCAmelCase							:  Any            =						32







def       A_				(   _UpperCAmelCase    ,     _UpperCAmelCase = 16   ):
						SCREAMING_SNAKE_CASE_:			List[str]  		=	AutoTokenizer.from_pretrained("bert-base-cased"   )
						SCREAMING_SNAKE_CASE_:			List[Any]  		=	load_dataset("glue"    ,     "mrpc"   )

						def tokenize_function(_UpperCAmelCase   ):
												# max_length=None => use the model max length (it's actually the default)
												SCREAMING_SNAKE_CASE_:			List[str]  		=	tokenizer(examples["sentence1"]    ,     examples["sentence2"]    ,     truncation=_UpperCAmelCase    ,     max_length=_UpperCAmelCase   )
												return outputs

						# Apply the method we just defined to all the examples in all the splits of the dataset
						# starting with the main process first:
						with accelerator.main_process_first():
												SCREAMING_SNAKE_CASE_:			int  		=	datasets.map(
												    _UpperCAmelCase    ,     batched=_UpperCAmelCase    ,     remove_columns=["idx", "sentence1", "sentence2"]    ,     )

						# We also rename the 'label' column to 'labels' which is the expected name for labels by the models of the
						# transformers library
						SCREAMING_SNAKE_CASE_:			List[str]  		=	tokenized_datasets.rename_column("label"    ,     "labels"   )

						def collate_fn(_UpperCAmelCase   ):
												# On TPU it's best to pad everything to the same length or training will be very slow.
												SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	1_28 if accelerator.distributed_type == DistributedType.TPU else None
												# When using mixed precision we want round multiples of 8/16
												if accelerator.mixed_precision == "fp8":
																		SCREAMING_SNAKE_CASE_:			Any  		=	16
												elif accelerator.mixed_precision != "no":
																		SCREAMING_SNAKE_CASE_:			Any  		=	8
												else:
																		SCREAMING_SNAKE_CASE_:			Dict  		=	None

												return tokenizer.pad(
												    _UpperCAmelCase    ,     padding="longest"    ,     max_length=_UpperCAmelCase    ,     pad_to_multiple_of=_UpperCAmelCase    ,     return_tensors="pt"    ,     )

						# Instantiate dataloaders.
						SCREAMING_SNAKE_CASE_:			Any  		=	DataLoader(
						    tokenized_datasets["train"]    ,     shuffle=_UpperCAmelCase    ,     collate_fn=_UpperCAmelCase    ,     batch_size=_UpperCAmelCase   )
						SCREAMING_SNAKE_CASE_:			Tuple  		=	DataLoader(
						    tokenized_datasets["validation"]    ,     shuffle=_UpperCAmelCase    ,     collate_fn=_UpperCAmelCase    ,     batch_size=_UpperCAmelCase   )

						return train_dataloader, eval_dataloader


# For testing only
if os.environ.get("""TESTING_MOCKED_DATALOADERS""", None) == "1":
						from accelerate.test_utils.training import mocked_dataloaders

						lowerCAmelCase							:  List[Any]            =						mocked_dataloaders  # noqa: F811







def       A_				(   _UpperCAmelCase    ,     _UpperCAmelCase   ):
						# For testing only
						if os.environ.get("TESTING_MOCKED_DATALOADERS"    ,     _UpperCAmelCase   ) == "1":
												SCREAMING_SNAKE_CASE_:			Dict  		=	2
						# New Code #
						SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	int(args.gradient_accumulation_steps   )
						SCREAMING_SNAKE_CASE_:			Dict  		=	int(args.local_sgd_steps   )
						# Initialize accelerator
						SCREAMING_SNAKE_CASE_:			int  		=	Accelerator(
						    cpu=args.cpu    ,     mixed_precision=args.mixed_precision    ,     gradient_accumulation_steps=_UpperCAmelCase   )
						if accelerator.distributed_type not in [DistributedType.NO, DistributedType.MULTI_CPU, DistributedType.MULTI_GPU]:
												raise NotImplementedError("LocalSGD is supported only for CPUs and GPUs (no DeepSpeed or MegatronLM)"   )
						# Sample hyper-parameters for learning rate, batch size, seed and a few other HPs
						SCREAMING_SNAKE_CASE_:			str  		=	config["lr"]
						SCREAMING_SNAKE_CASE_:			Optional[int]  		=	int(config["num_epochs"]   )
						SCREAMING_SNAKE_CASE_:			List[str]  		=	int(config["seed"]   )
						SCREAMING_SNAKE_CASE_:			int  		=	int(config["batch_size"]   )

						SCREAMING_SNAKE_CASE_:			str  		=	evaluate.load("glue"    ,     "mrpc"   )

						set_seed(_UpperCAmelCase   )
						SCREAMING_SNAKE_CASE_:			Optional[int]  		=	get_dataloaders(_UpperCAmelCase    ,     _UpperCAmelCase   )
						# Instantiate the model (we build the model here so that the seed also control new weights initialization)
						SCREAMING_SNAKE_CASE_:			Any  		=	AutoModelForSequenceClassification.from_pretrained("bert-base-cased"    ,     return_dict=_UpperCAmelCase   )

						# We could avoid this line since the accelerator is set with `device_placement=True` (default value).
						# Note that if you are placing tensors on devices manually, this line absolutely needs to be before the optimizer
						# creation otherwise training will not work on TPU (`accelerate` will kindly throw an error to make us aware of that).
						SCREAMING_SNAKE_CASE_:			Any  		=	model.to(accelerator.device   )

						# Instantiate optimizer
						SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	AdamW(params=model.parameters()    ,     lr=_UpperCAmelCase   )

						# Instantiate scheduler
						SCREAMING_SNAKE_CASE_:			Optional[int]  		=	get_linear_schedule_with_warmup(
						    optimizer=_UpperCAmelCase    ,     num_warmup_steps=1_00    ,     num_training_steps=(len(_UpperCAmelCase   ) * num_epochs)    ,     )

						# Prepare everything
						# There is no specific order to remember, we just need to unpack the objects in the same order we gave them to the
						# prepare method.
						SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	accelerator.prepare(
						    _UpperCAmelCase    ,     _UpperCAmelCase    ,     _UpperCAmelCase    ,     _UpperCAmelCase    ,     _UpperCAmelCase   )

						# Now we train the model
						for epoch in range(_UpperCAmelCase   ):
												model.train()
												with LocalSGD(
												    accelerator=_UpperCAmelCase    ,     model=_UpperCAmelCase    ,     local_sgd_steps=_UpperCAmelCase    ,     enabled=local_sgd_steps is not None   ) as local_sgd:
																		for step, batch in enumerate(_UpperCAmelCase   ):
																								# We could avoid this line since we set the accelerator with `device_placement=True`.
																								batch.to(accelerator.device   )
																								# New code #
																								# We use the new `accumulate` context manager to perform gradient accumulation
																								# We also currently do not support TPUs nor advise it as bugs were found on the XLA side when running our tests.
																								with accelerator.accumulate(_UpperCAmelCase   ):
																														SCREAMING_SNAKE_CASE_:			Union[str, Any]  		=	model(**_UpperCAmelCase   )
																														SCREAMING_SNAKE_CASE_:			Dict  		=	output.loss
																														accelerator.backward(_UpperCAmelCase   )
																														optimizer.step()
																														lr_scheduler.step()
																														optimizer.zero_grad()
																														# LocalSGD-specific line
																														local_sgd.step()

												model.eval()
												for step, batch in enumerate(_UpperCAmelCase   ):
																		# We could avoid this line since we set the accelerator with `device_placement=True`.
																		batch.to(accelerator.device   )
																		with torch.no_grad():
																								SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	model(**_UpperCAmelCase   )
																		SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	outputs.logits.argmax(dim=-1   )
																		SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	accelerator.gather_for_metrics((predictions, batch["labels"])   )
																		metric.add_batch(
																		    predictions=_UpperCAmelCase    ,     references=_UpperCAmelCase    ,     )

												SCREAMING_SNAKE_CASE_:			Any  		=	metric.compute()
												# Use accelerator.print to print only on the main process.
												accelerator.print(f"epoch {epoch}:"    ,     _UpperCAmelCase   )







def       A_				(   ):
						SCREAMING_SNAKE_CASE_:			List[Any]  		=	argparse.ArgumentParser(description="Simple example of training script."   )
						parser.add_argument(
						    "--mixed_precision"    ,     type=_UpperCAmelCase    ,     default=_UpperCAmelCase    ,     choices=["no", "fp16", "bf16", "fp8"]    ,     help="Whether to use mixed precision. Choose"
						    "between fp16 and bf16 (bfloat16). Bf16 requires PyTorch >= 1.10."
						    "and an Nvidia Ampere GPU."    ,     )
						# New Code #
						parser.add_argument(
						    "--gradient_accumulation_steps"    ,     type=_UpperCAmelCase    ,     default=1    ,     help="The number of minibatches to be ran before gradients are accumulated."    ,     )
						parser.add_argument(
						    "--local_sgd_steps"    ,     type=_UpperCAmelCase    ,     default=8    ,     help="Number of local SGD steps or None to disable local SGD"   )
						parser.add_argument("--cpu"    ,     action="store_true"    ,     help="If passed, will train on the CPU."   )
						SCREAMING_SNAKE_CASE_:			Optional[int]  		=	parser.parse_args()
						SCREAMING_SNAKE_CASE_:			int  		=	{"lr": 2e-5, "num_epochs": 3, "seed": 42, "batch_size": 16}
						training_function(_UpperCAmelCase    ,     _UpperCAmelCase   )


if __name__ == "__main__":
						main()









import re
from typing import Callable, List, Optional, Union

import tensorflow as tf


try:
						from tensorflow.keras.optimizers.legacy import Adam
except ImportError:
						from tensorflow.keras.optimizers import Adam



class   __lowercase    (			tf.keras.optimizers.schedules.LearningRateSchedule     ):




			"""simple docstring"""







			def __init__(			self  :					List[Any]       ,						lowerCAmelCase__  :					float       ,						lowerCAmelCase__  :					Callable       ,						lowerCAmelCase__  :					int       ,						lowerCAmelCase__  :					float = 1.0       ,						lowerCAmelCase__  :					str = None       ,						):
									super().__init__()
									SCREAMING_SNAKE_CASE_:			str  		=	initial_learning_rate
									SCREAMING_SNAKE_CASE_:			Dict  		=	warmup_steps
									SCREAMING_SNAKE_CASE_:			Any  		=	power
									SCREAMING_SNAKE_CASE_:			int  		=	decay_schedule_fn
									SCREAMING_SNAKE_CASE_:			Union[str, Any]  		=	name



			def __call__(			self  :					Optional[Any]       ,						lowerCAmelCase__  :					Any):
									with tf.name_scope(self.name or "WarmUp") as name:
															# Implements polynomial warmup. i.e., if global_step < warmup_steps, the
															# learning rate will be `global_step/num_warmup_steps * init_lr`.
															SCREAMING_SNAKE_CASE_:			Any  		=	tf.cast(lowerCAmelCase__       ,						tf.floataa)
															SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	tf.cast(self.warmup_steps       ,						tf.floataa)
															SCREAMING_SNAKE_CASE_:			Optional[int]  		=	global_step_float / warmup_steps_float
															SCREAMING_SNAKE_CASE_:			Union[str, Any]  		=	self.initial_learning_rate * tf.math.pow(lowerCAmelCase__       ,						self.power)
															return tf.cond(
															    global_step_float < warmup_steps_float       ,						lambda: warmup_learning_rate       ,						lambda: self.decay_schedule_fn(step - self.warmup_steps)       ,						name=lowerCAmelCase__       ,						)




			def 	_SCREAMING_SNAKE_CASE      (			self  :					Tuple):
									return {
									    "initial_learning_rate": self.initial_learning_rate,
									    "decay_schedule_fn": self.decay_schedule_fn,
									    "warmup_steps": self.warmup_steps,
									    "power": self.power,
									    "name": self.name,
									}







def       A_				(   _UpperCAmelCase    ,     _UpperCAmelCase    ,     _UpperCAmelCase    ,     _UpperCAmelCase = 0.0    ,     _UpperCAmelCase = 0.9    ,     _UpperCAmelCase = 0.9_9_9    ,     _UpperCAmelCase = 1e-8    ,     _UpperCAmelCase = None    ,     _UpperCAmelCase = None    ,     _UpperCAmelCase = 0.0    ,     _UpperCAmelCase = 1.0    ,     _UpperCAmelCase = None    ,     ):
						SCREAMING_SNAKE_CASE_:			Optional[int]  		=	tf.keras.optimizers.schedules.PolynomialDecay(
						    initial_learning_rate=_UpperCAmelCase    ,     decay_steps=num_train_steps - num_warmup_steps    ,     end_learning_rate=init_lr * min_lr_ratio    ,     power=_UpperCAmelCase    ,     )
						if num_warmup_steps:
												SCREAMING_SNAKE_CASE_:			Tuple  		=	WarmUp(
												    initial_learning_rate=_UpperCAmelCase    ,     decay_schedule_fn=_UpperCAmelCase    ,     warmup_steps=_UpperCAmelCase    ,     )
						if weight_decay_rate > 0.0:
												SCREAMING_SNAKE_CASE_:			List[str]  		=	AdamWeightDecay(
												    learning_rate=_UpperCAmelCase    ,     weight_decay_rate=_UpperCAmelCase    ,     beta_a=_UpperCAmelCase    ,     beta_a=_UpperCAmelCase    ,     epsilon=_UpperCAmelCase    ,     clipnorm=_UpperCAmelCase    ,     global_clipnorm=_UpperCAmelCase    ,     exclude_from_weight_decay=["LayerNorm", "layer_norm", "bias"]    ,     include_in_weight_decay=_UpperCAmelCase    ,     )
						else:
												SCREAMING_SNAKE_CASE_:			int  		=	tf.keras.optimizers.Adam(
												    learning_rate=_UpperCAmelCase    ,     beta_a=_UpperCAmelCase    ,     beta_a=_UpperCAmelCase    ,     epsilon=_UpperCAmelCase    ,     clipnorm=_UpperCAmelCase    ,     global_clipnorm=_UpperCAmelCase    ,     )
						# We return the optimizer and the LR scheduler in order to better track the
						# evolution of the LR independently of the optimizer.
						return optimizer, lr_schedule



class   __lowercase    (			UpperCAmelCase_     ):




			"""simple docstring"""







			def __init__(			self  :					List[Any]       ,						lowerCAmelCase__  :					Union[float, tf.keras.optimizers.schedules.LearningRateSchedule] = 0.001       ,						lowerCAmelCase__  :					float = 0.9       ,						lowerCAmelCase__  :					float = 0.999       ,						lowerCAmelCase__  :					float = 1E-7       ,						lowerCAmelCase__  :					bool = False       ,						lowerCAmelCase__  :					float = 0.0       ,						lowerCAmelCase__  :					Optional[List[str]] = None       ,						lowerCAmelCase__  :					Optional[List[str]] = None       ,						lowerCAmelCase__  :					str = "AdamWeightDecay"       ,						**lowerCAmelCase__  :					int       ,						):
									super().__init__(lowerCAmelCase__       ,						lowerCAmelCase__       ,						lowerCAmelCase__       ,						lowerCAmelCase__       ,						lowerCAmelCase__       ,						lowerCAmelCase__       ,						**lowerCAmelCase__)
									SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	weight_decay_rate
									SCREAMING_SNAKE_CASE_:			List[Any]  		=	include_in_weight_decay
									SCREAMING_SNAKE_CASE_:			List[Any]  		=	exclude_from_weight_decay



			@classmethod
			def 	_SCREAMING_SNAKE_CASE      (			cls  :					Dict       ,						lowerCAmelCase__  :					Dict):
									SCREAMING_SNAKE_CASE_:			List[str]  		=	{"WarmUp": WarmUp}
									return super(lowerCAmelCase__       ,						cls).from_config(lowerCAmelCase__       ,						custom_objects=lowerCAmelCase__)



			def 	_SCREAMING_SNAKE_CASE      (			self  :					List[str]       ,						lowerCAmelCase__  :					List[str]       ,						lowerCAmelCase__  :					List[Any]       ,						lowerCAmelCase__  :					Optional[int]):
									super(lowerCAmelCase__       ,						self)._prepare_local(lowerCAmelCase__       ,						lowerCAmelCase__       ,						lowerCAmelCase__)
									SCREAMING_SNAKE_CASE_:			Optional[int]  		=	tf.constant(
									    self.weight_decay_rate       ,						name="adam_weight_decay_rate")



			def 	_SCREAMING_SNAKE_CASE      (			self  :					Optional[Any]       ,						lowerCAmelCase__  :					str       ,						lowerCAmelCase__  :					Any       ,						lowerCAmelCase__  :					Tuple):
									SCREAMING_SNAKE_CASE_:			str  		=	self._do_use_weight_decay(var.name)
									if do_decay:
															return var.assign_sub(
															    learning_rate * var * apply_state[(var.device, var.dtype.base_dtype)]["weight_decay_rate"]       ,						use_locking=self._use_locking       ,						)
									return tf.no_op()



			def 	_SCREAMING_SNAKE_CASE      (			self  :					Dict       ,						lowerCAmelCase__  :					Optional[int]       ,						lowerCAmelCase__  :					Optional[Any]=None       ,						**lowerCAmelCase__  :					List[str]):
									SCREAMING_SNAKE_CASE_		,   SCREAMING_SNAKE_CASE_:			Any  		=	list(zip(*lowerCAmelCase__))
									return super(lowerCAmelCase__       ,						self).apply_gradients(zip(lowerCAmelCase__       ,						lowerCAmelCase__)       ,						name=lowerCAmelCase__       ,						**lowerCAmelCase__)



			def 	_SCREAMING_SNAKE_CASE      (			self  :					Optional[int]       ,						lowerCAmelCase__  :					Any       ,						lowerCAmelCase__  :					Tuple       ,						lowerCAmelCase__  :					Tuple):
									if apply_state is None:
															return self._decayed_lr_t[var_dtype], {}

									SCREAMING_SNAKE_CASE_:			Dict  		=	apply_state or {}
									SCREAMING_SNAKE_CASE_:			List[str]  		=	apply_state.get((var_device, var_dtype))
									if coefficients is None:
															SCREAMING_SNAKE_CASE_:			Optional[int]  		=	self._fallback_apply_state(lowerCAmelCase__       ,						lowerCAmelCase__)
															SCREAMING_SNAKE_CASE_:			Any  		=	coefficients

									return coefficients["lr_t"], {"apply_state": apply_state}



			def 	_SCREAMING_SNAKE_CASE      (			self  :					str       ,						lowerCAmelCase__  :					List[Any]       ,						lowerCAmelCase__  :					Dict       ,						lowerCAmelCase__  :					Tuple=None):
									SCREAMING_SNAKE_CASE_		,   SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	self._get_lr(var.device       ,						var.dtype.base_dtype       ,						lowerCAmelCase__)
									SCREAMING_SNAKE_CASE_:			Optional[int]  		=	self._decay_weights_op(lowerCAmelCase__       ,						lowerCAmelCase__       ,						lowerCAmelCase__)
									with tf.control_dependencies([decay]):
															return super(lowerCAmelCase__       ,						self)._resource_apply_dense(lowerCAmelCase__       ,						lowerCAmelCase__       ,						**lowerCAmelCase__)



			def 	_SCREAMING_SNAKE_CASE      (			self  :					Union[str, Any]       ,						lowerCAmelCase__  :					List[str]       ,						lowerCAmelCase__  :					Dict       ,						lowerCAmelCase__  :					Dict       ,						lowerCAmelCase__  :					Dict=None):
									SCREAMING_SNAKE_CASE_		,   SCREAMING_SNAKE_CASE_:			List[str]  		=	self._get_lr(var.device       ,						var.dtype.base_dtype       ,						lowerCAmelCase__)
									SCREAMING_SNAKE_CASE_:			Any  		=	self._decay_weights_op(lowerCAmelCase__       ,						lowerCAmelCase__       ,						lowerCAmelCase__)
									with tf.control_dependencies([decay]):
															return super(lowerCAmelCase__       ,						self)._resource_apply_sparse(lowerCAmelCase__       ,						lowerCAmelCase__       ,						lowerCAmelCase__       ,						**lowerCAmelCase__)



			def 	_SCREAMING_SNAKE_CASE      (			self  :					Optional[Any]):
									SCREAMING_SNAKE_CASE_:			List[str]  		=	super().get_config()
									config.update({"weight_decay_rate": self.weight_decay_rate})
									return config




			def 	_SCREAMING_SNAKE_CASE      (			self  :					Union[str, Any]       ,						lowerCAmelCase__  :					Tuple):
									if self.weight_decay_rate == 0:
															return False

									if self._include_in_weight_decay:
															for r in self._include_in_weight_decay:
																					if re.search(lowerCAmelCase__       ,						lowerCAmelCase__) is not None:
																											return True

									if self._exclude_from_weight_decay:
															for r in self._exclude_from_weight_decay:
																					if re.search(lowerCAmelCase__       ,						lowerCAmelCase__) is not None:
																											return False
									return True







class   __lowercase    (			UpperCAmelCase_     ):




			"""simple docstring"""







			def __init__(			self  :					Optional[Any]):
									SCREAMING_SNAKE_CASE_:			Any  		=	[]
									SCREAMING_SNAKE_CASE_:			Any  		=	None



			@property
			def 	_SCREAMING_SNAKE_CASE      (			self  :					int):
									if self._accum_steps is None:
															SCREAMING_SNAKE_CASE_:			Tuple  		=	tf.Variable(
															    tf.constant(0       ,						dtype=tf.intaa)       ,						trainable=lowerCAmelCase__       ,						synchronization=tf.VariableSynchronization.ON_READ       ,						aggregation=tf.VariableAggregation.ONLY_FIRST_REPLICA       ,						)

									return self._accum_steps.value()



			@property
			def 	_SCREAMING_SNAKE_CASE      (			self  :					Tuple):
									if not self._gradients:
															raise ValueError("The accumulator should be called first to initialize the gradients")
									return [gradient.value() if gradient is not None else gradient for gradient in self._gradients]



			def __call__(			self  :					str       ,						lowerCAmelCase__  :					Tuple):
									if not self._gradients:
															SCREAMING_SNAKE_CASE_:			Optional[Any]  		=	self.step  # Create the step variable.
															self._gradients.extend(
															    [
															        tf.Variable(
															            tf.zeros_like(lowerCAmelCase__)       ,						trainable=lowerCAmelCase__       ,						synchronization=tf.VariableSynchronization.ON_READ       ,						aggregation=tf.VariableAggregation.ONLY_FIRST_REPLICA       ,						)
															        if gradient is not None
															        else gradient
															        for gradient in gradients
															    ])
									if len(lowerCAmelCase__) != len(self._gradients):
															raise ValueError(F"Expected {len(self._gradients)} gradients, but got {len(lowerCAmelCase__)}")

									for accum_gradient, gradient in zip(self._gradients       ,						lowerCAmelCase__):
															if accum_gradient is not None and gradient is not None:
																					accum_gradient.assign_add(lowerCAmelCase__)

									self._accum_steps.assign_add(1)




			def 	_SCREAMING_SNAKE_CASE      (			self  :					int):
									if not self._gradients:
															return
									self._accum_steps.assign(0)
									for gradient in self._gradients:
															if gradient is not None:
																					gradient.assign(tf.zeros_like(lowerCAmelCase__))






