o
    -i
                     @   s   d dl mZ d dlmZmZ d dlZd dlmZmZ d dl	m
Z
 d dlmZ d dlmZ ed Zee
ed	d
dG dd dZdS )    )field)AnyLiteralN)
ConfigDictSkipValidation)	dataclass)config)	safe_hash)autocudacputpuxpuT)arbitrary_types_allowedc                   @   sX   e Zd ZU dZdZeeejB dB  ed< 	 e	ddZ
eed< 	 defd	d
Zdd ZdS )DeviceConfigz7Configuration for the device to use for vLLM execution.r
   NdeviceF)initdevice_typereturnc                 C   s    g }t t| dd }|S )a  
        WARNING: Whenever a new field is added to this config,
        ensure that it is included in the factors list if
        it affects the computation graph.

        Provide a hash that uniquely identifies all the configs
        that affect the structure of the computation
        graph from input ids/embeddings to the final hidden states,
        excluding anything before input ids/embeddings and after
        the final hidden states.
        F)usedforsecurity)r	   strencode	hexdigest)selffactorshash_str r   O/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/vllm/config/device.pycompute_hash    s   zDeviceConfig.compute_hashc                 C   s   | j dkrddlm} |j| _| jstdnt| j tr"| j | _nt| j tj r.| j j| _| jdv r8d | _ d S t | j| _ d S )Nr
   r   )current_platformzFailed to infer device type, please set the environment variable `VLLM_LOGGING_LEVEL=DEBUG` to turn on verbose logging to help debug the issue.)r   )	r   vllm.platformsr   r   RuntimeError
isinstancer   torchtype)r   r   r   r   r   __post_init__3   s   




zDeviceConfig.__post_init__)__name__
__module____qualname____doc__r   r   Devicer#   __annotations__r   r   r   r   r%   r   r   r   r   r      s   
 r   )dataclassesr   typingr   r   r#   pydanticr   r   pydantic.dataclassesr   vllm.config.utilsr   vllm.utils.hashingr	   r*   r   r   r   r   r   <module>   s   