


def   _UpperCamelCase				(						lowerCAmelCase_   )						->str:
   return "".join([hex(lowerCAmelCase_   )[2:].zfill(2   ).upper() for byte in list(lowerCAmelCase_   )]   )
def   _UpperCamelCase				(						lowerCAmelCase_   )						->bytes:
   # Check data validity, following RFC3548
   # https://www.ietf.org/rfc/rfc3548.txt
   if (len(lowerCAmelCase_   ) % 2) != 0:
      raise ValueError(
          """Base16 encoded data is invalid:
Data does not have an even number of hex digits."""   )
   # Check the character set - the standard base16 alphabet
   # is uppercase according to RFC3548 section 6
   if not set(lowerCAmelCase_   ) <= set("""0123456789ABCDEF"""   ):
      raise ValueError(
          """Base16 encoded data is invalid:
Data is not uppercase hex or it contains invalid characters."""   )
   # For every two hexadecimal digits (= a byte), turn it into an integer.
   # Then, string the result together into bytes, and return it.
   return bytes(int(data[i] + data[i + 1]  ,						1_6   ) for i in range(0  ,						len(lowerCAmelCase_   )  ,						2   )   )


if __name__ == "__main__":
     import doctest

     doctest.testmod()







import pickle
import unittest

import torch

from accelerate import Accelerator
from accelerate.state import AcceleratorState
from accelerate.test_utils import require_cpu






@require_cpu
class   __lowercase				(  unittest.TestCase  ):





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






         """simple docstring"""







         UpperCAmelCase							=     torch.nn.Linear(1_0					,       1_0       )
         UpperCAmelCase							=     torch.optim.SGD(model.parameters()					,       0.1       )
         UpperCAmelCase							=     Accelerator()
         UpperCAmelCase							=     accelerator.prepare(__lowerCamelCase       )
         try:
            pickle.loads(pickle.dumps(__lowerCamelCase       )       )
         except Exception as e:
            self.fail(F"""Accelerated optimizer pickling failed with {e}"""       )
         AcceleratorState._reset_state()



