
    &`is              
          d dl Z d dlZd dlZd dlZd dlmZ d dlm	Z	  ej
        e          Z	 d dlZdZn"# e$ r e                    d           dZY nw xY we	d             Ze	d             Ze	d	             Ze	d
             Ze	d             Ze	d             Zedk    rQdZ ej        e                              d          Zd Z ej                    Z ej                    ez
  dk     r& ee           edz  Z ej                    ez
  dk     & ee          Z ed                     eez  dz  dz                        ed                      e!edz   e"e          z  d                               d Z ej                    Z ej                    ez
  dk     r& ee           edz  Z ej                    ez
  dk     & ed                     eez  dz  dz                       dS dS )    N)cloudpickle)DeveloperAPITzlz4 not available, disabling sample compression. This will significantly impact RLlib performance. To install lz4, run `pip install lz4`.Fc                      t           S N)LZ4_ENABLED     o/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/rllib/utils/compression.pycompression_supportedr      s    r	   c                     t           rZt          j        |           } t          j                            |           } t          j        |                               d          } | S )Nascii)	r   pickledumpslz4framecompressbase64	b64encodedecodedatas    r
   packr      sS     6|D!!y!!$'' %%,,W55Kr	   c                 X    t          | t          j                  rt          |           } | S r   )
isinstancenpndarrayr   r   s    r
   pack_if_neededr   )   s&    $
## DzzKr	   c                     t           rGt          j        |           } t          j                            |           } t          j        |           } | S r   )r   r   	b64decoder   r   
decompressr   loadsr   s    r
   unpackr"   0   sC     "%%y##D))|D!!Kr	   c                 B    t          |           rt          |           } | S r   )is_compressedr"   r   s    r
   unpack_if_neededr%   9   s"    T d||Kr	   c                 V    t          | t                    pt          | t                    S r   )r   bytesstrr   s    r
   r$   r$   @   s!    dE"";js&;&;;r	   __main__i  )    P   r+         zCompression speed: {} MB/sr,   g    .AzCompression ratio: {}   zDecompression speed: {} MB/s)#r   loggingtimenumpyr   rayr   r   ray.rllib.utils.annotationsr   	getLogger__name__logger	lz4.framer   r   ImportErrorwarningr   r   r   r"   r%   r$   sizeonesreshaper   countstart
compressedprintformatroundlenr   r	   r
   <module>rD      s          % % % % % % 4 4 4 4 4 4		8	$	$
KK   
NN	1  
 KKK                < < < zD274==  11DEDIKKE
$)++

!
!T



 $)++

!
! dJ	E
&
-
-edlQ.>.D
E
EFFF	E
!
(
(tax##j///I1)M)M
N
NOOOEDIKKE
$)++

!
!z
 $)++

!
! 
E
(
/
/q0@30F
G
GHHHHH% s   5 AA