

from dataclasses import dataclass
from typing import Any, Dict, Optional

import torch
import torch.nn.functional as F
from torch import nn

from ..configuration_utils import ConfigMixin, register_to_config
from ..models.embeddings import ImagePositionalEmbeddings
from ..utils import BaseOutput, deprecate
from .attention import BasicTransformerBlock
from .embeddings import PatchEmbed
from .modeling_utils import ModelMixin
@dataclass
class 	_A						(					UpperCamelCase_):
  SCREAMING_SNAKE_CASE      : torch.FloatTensor

class 	_A						(					UpperCamelCase_				,       UpperCamelCase_):

  @register_to_config
  def __init__(			self	,   _SCREAMING_SNAKE_CASE = 16	,   _SCREAMING_SNAKE_CASE = 88	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = 1	,   _SCREAMING_SNAKE_CASE = 0.0	,   _SCREAMING_SNAKE_CASE = 32	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = False	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = "geglu"	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = False	,   _SCREAMING_SNAKE_CASE = False	,   _SCREAMING_SNAKE_CASE = False	,   _SCREAMING_SNAKE_CASE = "layer_norm"	,   _SCREAMING_SNAKE_CASE = True	,   ):





        """simple docstring"""







        super().__init__()
        SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       use_linear_projection
        SCREAMING_SNAKE_CASE_			:					Any          =       num_attention_heads
        SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       attention_head_dim
        SCREAMING_SNAKE_CASE_			:					Optional[Any]          =       num_attention_heads * attention_head_dim

        # 1. Transformer2DModel can process both standard continuous images of shape `(batch_size, num_channels, width, height)` as well as quantized image embeddings of shape `(batch_size, num_image_vectors)`
        # Define whether input is continuous or discrete depending on configuration
        SCREAMING_SNAKE_CASE_			:					Any          =       (in_channels is not None) and (patch_size is None)
        SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       num_vector_embeds is not None
        SCREAMING_SNAKE_CASE_			:					str          =       in_channels is not None and patch_size is not None

        if norm_type == "layer_norm" and num_embeds_ada_norm is not None:
              SCREAMING_SNAKE_CASE_			:					int          =       (
                  f"The configuration file of this model: {self.__class__} is outdated. `norm_type` is either not set or"
                  ' incorrectly set to `\'layer_norm\'`.Make sure to set `norm_type` to `\'ada_norm\'` in the config.'
                  ' Please make sure to update the config accordingly as leaving `norm_type` might led to incorrect'
                  ' results in future versions. If you have downloaded this checkpoint from the Hugging Face Hub, it'
                  ' would be very nice if you could open a Pull request for the `transformer/config.json` file'
              )
              deprecate('norm_type!=num_embeds_ada_norm'	,   '1.0.0'	,   __SCREAMING_SNAKE_CASE	,   standard_warn=__SCREAMING_SNAKE_CASE   )
              SCREAMING_SNAKE_CASE_			:					int          =       'ada_norm'

        if self.is_input_continuous and self.is_input_vectorized:
              raise ValueError(
                  f"Cannot define both `in_channels`: {in_channels} and `num_vector_embeds`: {num_vector_embeds}. Make"
                  ' sure that either `in_channels` or `num_vector_embeds` is None.'   )
        elif self.is_input_vectorized and self.is_input_patches:
              raise ValueError(
                  f"Cannot define both `num_vector_embeds`: {num_vector_embeds} and `patch_size`: {patch_size}. Make"
                  ' sure that either `num_vector_embeds` or `num_patches` is None.'   )
        elif not self.is_input_continuous and not self.is_input_vectorized and not self.is_input_patches:
              raise ValueError(
                  f"Has to define `in_channels`: {in_channels}, `num_vector_embeds`: {num_vector_embeds}, or patch_size:"
                  f" {patch_size}. Make sure that `in_channels`, `num_vector_embeds` or `num_patches` is not None."   )

        # 2. Define input layers
        if self.is_input_continuous:
              SCREAMING_SNAKE_CASE_			:					Tuple          =       in_channels

              SCREAMING_SNAKE_CASE_			:					int          =       torch.nn.GroupNorm(num_groups=__SCREAMING_SNAKE_CASE	,   num_channels=__SCREAMING_SNAKE_CASE	,   eps=1e-6	,   affine=__SCREAMING_SNAKE_CASE   )
              if use_linear_projection:
                    SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       nn.Linear(__SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE   )
              else:
                    SCREAMING_SNAKE_CASE_			:					Dict          =       nn.Convad(__SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE	,   kernel_size=1	,   stride=1	,   padding=0   )
        elif self.is_input_vectorized:
              assert sample_size is not None, "Transformer2DModel over discrete input must provide sample_size"
              assert num_vector_embeds is not None, "Transformer2DModel over discrete input must provide num_embed"

              SCREAMING_SNAKE_CASE_			:					Tuple          =       sample_size
              SCREAMING_SNAKE_CASE_			:					Optional[int]          =       sample_size
              SCREAMING_SNAKE_CASE_			:					Dict          =       num_vector_embeds
              SCREAMING_SNAKE_CASE_			:					List[Any]          =       self.height * self.width

              SCREAMING_SNAKE_CASE_			:					Tuple          =       ImagePositionalEmbeddings(
                  num_embed=__SCREAMING_SNAKE_CASE	,   embed_dim=__SCREAMING_SNAKE_CASE	,   height=self.height	,   width=self.width   )
        elif self.is_input_patches:
              assert sample_size is not None, "Transformer2DModel over patched input must provide sample_size"

              SCREAMING_SNAKE_CASE_			:					int          =       sample_size
              SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       sample_size

              SCREAMING_SNAKE_CASE_			:					str          =       patch_size
              SCREAMING_SNAKE_CASE_			:					str          =       PatchEmbed(
                  height=__SCREAMING_SNAKE_CASE	,   width=__SCREAMING_SNAKE_CASE	,   patch_size=__SCREAMING_SNAKE_CASE	,   in_channels=__SCREAMING_SNAKE_CASE	,   embed_dim=__SCREAMING_SNAKE_CASE	,   )

        # 3. Define transformers blocks
        SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       nn.ModuleList(
            [
                BasicTransformerBlock(
                    __SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE	,   dropout=__SCREAMING_SNAKE_CASE	,   cross_attention_dim=__SCREAMING_SNAKE_CASE	,   activation_fn=__SCREAMING_SNAKE_CASE	,   num_embeds_ada_norm=__SCREAMING_SNAKE_CASE	,   attention_bias=__SCREAMING_SNAKE_CASE	,   only_cross_attention=__SCREAMING_SNAKE_CASE	,   upcast_attention=__SCREAMING_SNAKE_CASE	,   norm_type=__SCREAMING_SNAKE_CASE	,   norm_elementwise_affine=__SCREAMING_SNAKE_CASE	,   )
                for d in range(__SCREAMING_SNAKE_CASE   )
            ]   )

        # 4. Define output layers
        SCREAMING_SNAKE_CASE_			:					Optional[int]          =       in_channels if out_channels is None else out_channels
        if self.is_input_continuous:
              # TODO: should use out_channels for continuous projections
              if use_linear_projection:
                    SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       nn.Linear(__SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE   )
              else:
                    SCREAMING_SNAKE_CASE_			:					Any          =       nn.Convad(__SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE	,   kernel_size=1	,   stride=1	,   padding=0   )
        elif self.is_input_vectorized:
              SCREAMING_SNAKE_CASE_			:					str          =       nn.LayerNorm(__SCREAMING_SNAKE_CASE   )
              SCREAMING_SNAKE_CASE_			:					int          =       nn.Linear(__SCREAMING_SNAKE_CASE	,   self.num_vector_embeds - 1   )
        elif self.is_input_patches:
              SCREAMING_SNAKE_CASE_			:					Optional[int]          =       nn.LayerNorm(__SCREAMING_SNAKE_CASE	,   elementwise_affine=__SCREAMING_SNAKE_CASE	,   eps=1e-6   )
              SCREAMING_SNAKE_CASE_			:					Any          =       nn.Linear(__SCREAMING_SNAKE_CASE	,   2 * inner_dim   )
              SCREAMING_SNAKE_CASE_			:					str          =       nn.Linear(__SCREAMING_SNAKE_CASE	,   patch_size * patch_size * self.out_channels   )



  def 	UpperCAmelCase      (			self	,   _SCREAMING_SNAKE_CASE	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = None	,   _SCREAMING_SNAKE_CASE = True	,   ):





        """simple docstring"""







        if attention_mask is not None and attention_mask.ndim == 2:
              # assume that mask is expressed as:
              #   (1 = keep,      0 = discard)
              # convert mask into a bias that can be added to attention scores:
              #       (keep = +0,     discard = -10000.0)
              SCREAMING_SNAKE_CASE_			:					Optional[int]          =       (1 - attention_mask.to(hidden_states.dtype   )) * -1_0000.0
              SCREAMING_SNAKE_CASE_			:					int          =       attention_mask.unsqueeze(1   )

        # convert encoder_attention_mask to a bias the same way we do for attention_mask
        if encoder_attention_mask is not None and encoder_attention_mask.ndim == 2:
              SCREAMING_SNAKE_CASE_			:					Optional[int]          =       (1 - encoder_attention_mask.to(hidden_states.dtype   )) * -1_0000.0
              SCREAMING_SNAKE_CASE_			:					Dict          =       encoder_attention_mask.unsqueeze(1   )

        # 1. Input
        if self.is_input_continuous:
              SCREAMING_SNAKE_CASE_    ,  SCREAMING_SNAKE_CASE_    ,  SCREAMING_SNAKE_CASE_    ,  SCREAMING_SNAKE_CASE_			:					int          =       hidden_states.shape
              SCREAMING_SNAKE_CASE_			:					Dict          =       hidden_states

              SCREAMING_SNAKE_CASE_			:					Tuple          =       self.norm(__SCREAMING_SNAKE_CASE   )
              if not self.use_linear_projection:
                    SCREAMING_SNAKE_CASE_			:					Dict          =       self.proj_in(__SCREAMING_SNAKE_CASE   )
                    SCREAMING_SNAKE_CASE_			:					str          =       hidden_states.shape[1]
                    SCREAMING_SNAKE_CASE_			:					Optional[Any]          =       hidden_states.permute(0	,   2	,   3	,   1   ).reshape(__SCREAMING_SNAKE_CASE	,   height * width	,   __SCREAMING_SNAKE_CASE   )
              else:
                    SCREAMING_SNAKE_CASE_			:					Any          =       hidden_states.shape[1]
                    SCREAMING_SNAKE_CASE_			:					Dict          =       hidden_states.permute(0	,   2	,   3	,   1   ).reshape(__SCREAMING_SNAKE_CASE	,   height * width	,   __SCREAMING_SNAKE_CASE   )
                    SCREAMING_SNAKE_CASE_			:					Tuple          =       self.proj_in(__SCREAMING_SNAKE_CASE   )
        elif self.is_input_vectorized:
              SCREAMING_SNAKE_CASE_			:					Dict          =       self.latent_image_embedding(__SCREAMING_SNAKE_CASE   )
        elif self.is_input_patches:
              SCREAMING_SNAKE_CASE_			:					Dict          =       self.pos_embed(__SCREAMING_SNAKE_CASE   )

        # 2. Blocks
        for block in self.transformer_blocks:
              SCREAMING_SNAKE_CASE_			:					int          =       block(
                  __SCREAMING_SNAKE_CASE	,   attention_mask=__SCREAMING_SNAKE_CASE	,   encoder_hidden_states=__SCREAMING_SNAKE_CASE	,   encoder_attention_mask=__SCREAMING_SNAKE_CASE	,   timestep=__SCREAMING_SNAKE_CASE	,   cross_attention_kwargs=__SCREAMING_SNAKE_CASE	,   class_labels=__SCREAMING_SNAKE_CASE	,   )

        # 3. Output
        if self.is_input_continuous:
              if not self.use_linear_projection:
                    SCREAMING_SNAKE_CASE_			:					Optional[int]          =       hidden_states.reshape(__SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE   ).permute(0	,   3	,   1	,   2   ).contiguous()
                    SCREAMING_SNAKE_CASE_			:					Optional[Any]          =       self.proj_out(__SCREAMING_SNAKE_CASE   )
              else:
                    SCREAMING_SNAKE_CASE_			:					Dict          =       self.proj_out(__SCREAMING_SNAKE_CASE   )
                    SCREAMING_SNAKE_CASE_			:					int          =       hidden_states.reshape(__SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE   ).permute(0	,   3	,   1	,   2   ).contiguous()

              SCREAMING_SNAKE_CASE_			:					Tuple          =       hidden_states + residual
        elif self.is_input_vectorized:
              SCREAMING_SNAKE_CASE_			:					Optional[Any]          =       self.norm_out(__SCREAMING_SNAKE_CASE   )
              SCREAMING_SNAKE_CASE_			:					int          =       self.out(__SCREAMING_SNAKE_CASE   )
              # (batch, self.num_vector_embeds - 1, self.num_latent_pixels)
              SCREAMING_SNAKE_CASE_			:					str          =       logits.permute(0	,   2	,   1   )

              # log(p(x_0))
              SCREAMING_SNAKE_CASE_			:					List[Any]          =       F.log_softmax(logits.double()	,   dim=1   ).float()
        elif self.is_input_patches:
              # TODO: cleanup!
              SCREAMING_SNAKE_CASE_			:					Tuple          =       self.transformer_blocks[0].norma.emb(
                  __SCREAMING_SNAKE_CASE	,   __SCREAMING_SNAKE_CASE	,   hidden_dtype=hidden_states.dtype   )
              SCREAMING_SNAKE_CASE_    ,  SCREAMING_SNAKE_CASE_			:					str          =       self.proj_out_a(F.silu(__SCREAMING_SNAKE_CASE   )   ).chunk(2	,   dim=1   )
              SCREAMING_SNAKE_CASE_			:					List[Any]          =       self.norm_out(__SCREAMING_SNAKE_CASE   ) * (1 + scale[:, None]) + shift[:, None]
              SCREAMING_SNAKE_CASE_			:					List[Any]          =       self.proj_out_a(__SCREAMING_SNAKE_CASE   )

              # unpatchify
              SCREAMING_SNAKE_CASE_			:					Any          =       int(hidden_states.shape[1] ** 0.5   )
              SCREAMING_SNAKE_CASE_			:					Any          =       hidden_states.reshape(
                  shape=(-1, height, width, self.patch_size, self.patch_size, self.out_channels)   )
              SCREAMING_SNAKE_CASE_			:					int          =       torch.einsum('nhwpqc->nchpwq'	,   __SCREAMING_SNAKE_CASE   )
              SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       hidden_states.reshape(
                  shape=(-1, self.out_channels, height * self.patch_size, width * self.patch_size)   )

        if not return_dict:
              return (output,)

        return TransformeraDModelOutput(sample=__SCREAMING_SNAKE_CASE   )



import json
import os
import subprocess
import sys
import warnings
from argparse import ArgumentParser
from contextlib import AbstractContextManager
from typing import Dict, List, Optional

import requests

from ..utils import logging
from . import BaseTransformersCLICommand


lowerCAmelCase       :				Optional[int]         =					logging.get_logger(__name__)  # pylint: disable=invalid-name


lowerCAmelCase       :				Any         =					'lfs-multipart-upload'
class 	_A						(					__magic_name__):

  @staticmethod
  def 	UpperCAmelCase      (			_SCREAMING_SNAKE_CASE   ):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       parser.add_parser(
            'lfs-enable-largefiles'	,   help=(
                'Deprecated: use `huggingface-cli` instead. Configure your repository to enable upload of files > 5GB.'
            )	,   )
        enable_parser.add_argument('path'	,   type=_SCREAMING_SNAKE_CASE	,   help='Local path to repository you want to configure.'   )
        enable_parser.set_defaults(func=lambda _SCREAMING_SNAKE_CASE   : LfsEnableCommand(_SCREAMING_SNAKE_CASE   )   )

        SCREAMING_SNAKE_CASE_			:					str          =       parser.add_parser(
            _SCREAMING_SNAKE_CASE	,   help=(
                'Deprecated: use `huggingface-cli` instead. '
                'Command will get called by git-lfs, do not call it directly.'
            )	,   )
        upload_parser.set_defaults(func=lambda _SCREAMING_SNAKE_CASE   : LfsUploadCommand(_SCREAMING_SNAKE_CASE   )   )

class 	_A						:

  def __init__(			self	,   _SCREAMING_SNAKE_CASE   ):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_			:					str          =       args



  def 	UpperCAmelCase      (			self   ):





        """simple docstring"""







        warnings.warn(
            'Managing repositories through transformers-cli is deprecated. Please use `huggingface-cli` instead.'   )
        SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       os.path.abspath(self.args.path   )
        if not os.path.isdir(_SCREAMING_SNAKE_CASE   ):
              print('This does not look like a valid git repo.'   )
              exit(1   )
        subprocess.run(
            'git config lfs.customtransfer.multipart.path transformers-cli'.split()	,   check=_SCREAMING_SNAKE_CASE	,   cwd=_SCREAMING_SNAKE_CASE   )
        subprocess.run(
            f"git config lfs.customtransfer.multipart.args {LFS_MULTIPART_UPLOAD_COMMAND}".split()	,   check=_SCREAMING_SNAKE_CASE	,   cwd=_SCREAMING_SNAKE_CASE	,   )
        print('Local repo set up for largefiles'   )

def 				A_					(							a					):

      """simple docstring"""



      SCREAMING_SNAKE_CASE_			:					Any          =       json.dumps(a					) + '\n'
      sys.stdout.write(a					)
      sys.stdout.flush()

def 				A_					(							):

      """simple docstring"""



      SCREAMING_SNAKE_CASE_			:					List[Any]          =       json.loads(sys.stdin.readline().strip()					)

      if "terminate" in (msg.get('type'					), msg.get('event'					)):
            # terminate message received
            return None

      if msg.get('event'					) not in ("download", "upload"):
            logger.critical('Received unexpected message'					)
            sys.exit(1					)

      return msg
class 	_A						(					__magic_name__):

  def __init__(			self	,   _SCREAMING_SNAKE_CASE	,   _SCREAMING_SNAKE_CASE	,   _SCREAMING_SNAKE_CASE   ):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_			:					Optional[Any]          =       filepath
        SCREAMING_SNAKE_CASE_			:					Tuple          =       seek_from
        SCREAMING_SNAKE_CASE_			:					Tuple          =       read_limit
        SCREAMING_SNAKE_CASE_			:					int          =       0

  def __enter__(			self   ):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       open(self.filepath	,   'rb'   )
        self.f.seek(self.seek_from   )
        return self

  def __len__(			self   ):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_			:					Tuple          =       os.fstat(self.f.fileno()   ).st_size
        return min(self.read_limit	,   total_length - self.seek_from   )

  def 	UpperCAmelCase      (			self	,   _SCREAMING_SNAKE_CASE=-1   ):





        """simple docstring"""







        if self.n_seen >= self.read_limit:
              return b""
        SCREAMING_SNAKE_CASE_			:					str          =       self.read_limit - self.n_seen
        SCREAMING_SNAKE_CASE_			:					Any          =       self.f.read(remaining_amount if n < 0 else min(_SCREAMING_SNAKE_CASE	,   _SCREAMING_SNAKE_CASE   )   )
        self.n_seen += len(_SCREAMING_SNAKE_CASE   )
        return data

  def __iter__(			self   ):





        """simple docstring"""







        yield self.read(n=4 * 1024 * 1024   )



  def __exit__(			self	,   *_SCREAMING_SNAKE_CASE   ):





        """simple docstring"""







        self.f.close()

class 	_A						:

  def __init__(			self	,   _SCREAMING_SNAKE_CASE   ):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_			:					List[Any]          =       args



  def 	UpperCAmelCase      (			self   ):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_			:					List[Any]          =       json.loads(sys.stdin.readline().strip()   )
        if not (init_msg.get('event'   ) == "init" and init_msg.get('operation'   ) == "upload"):
              write_msg({'error': {'code': 32, 'message': 'Wrong lfs init operation'}}   )
              sys.exit(1   )

        # The transfer process should use the information it needs from the
        # initiation structure, and also perform any one-off setup tasks it
        # needs to do. It should then respond on stdout with a simple empty
        # confirmation structure, as follows:
        write_msg({}   )

        # After the initiation exchange, git-lfs will send any number of
        # transfer requests to the stdin of the transfer process, in a serial sequence.
        while True:
              SCREAMING_SNAKE_CASE_			:					str          =       read_msg()
              if msg is None:
                    # When all transfers have been processed, git-lfs will send
                    # a terminate event to the stdin of the transfer process.
                    # On receiving this message the transfer process should
                    # clean up and terminate. No response is expected.
                    sys.exit(0   )

              SCREAMING_SNAKE_CASE_			:					int          =       msg['oid']
              SCREAMING_SNAKE_CASE_			:					int          =       msg['path']
              SCREAMING_SNAKE_CASE_			:					Union[str, Any]          =       msg['action']['href']
              SCREAMING_SNAKE_CASE_			:					str          =       msg['action']['header']
              SCREAMING_SNAKE_CASE_			:					Any          =       int(header.pop('chunk_size'   )   )
              SCREAMING_SNAKE_CASE_			:					List[str]          =       list(header.values()   )

              SCREAMING_SNAKE_CASE_			:					List[str]          =       []
              for i, presigned_url in enumerate(_SCREAMING_SNAKE_CASE   ):
                    with FileSlice(_SCREAMING_SNAKE_CASE	,   seek_from=i * chunk_size	,   read_limit=_SCREAMING_SNAKE_CASE   ) as data:
                          SCREAMING_SNAKE_CASE_			:					int          =       requests.put(_SCREAMING_SNAKE_CASE	,   data=_SCREAMING_SNAKE_CASE   )
                          r.raise_for_status()
                          parts.append(
                              {
                                  'etag': r.headers.get('etag'   ),
                                  'partNumber': i + 1,
                              }   )
                          # In order to support progress reporting while data is uploading / downloading,
                          # the transfer process should post messages to stdout
                          write_msg(
                              {
                                  'event': 'progress',
                                  'oid': oid,
                                  'bytesSoFar': (i + 1) * chunk_size,
                                  'bytesSinceLast': chunk_size,
                              }   )
                          # Not precise but that's ok.

              SCREAMING_SNAKE_CASE_			:					Dict          =       requests.post(
                  _SCREAMING_SNAKE_CASE	,   json={
                      'oid': oid,
                      'parts': parts,
                  }	,   )
              r.raise_for_status()

              write_msg({'event': 'complete', 'oid': oid}   )






