sima_utils.transformer.devkit.utils =================================== .. py:module:: sima_utils.transformer.devkit.utils Attributes ---------- .. autoapisummary:: sima_utils.transformer.devkit.utils.VLM_EVAL_PRINT_INOUTS sima_utils.transformer.devkit.utils.VLM_EVAL_PROFILE sima_utils.transformer.devkit.utils.mla_rt_api Classes ------- .. autoapisummary:: sima_utils.transformer.devkit.utils.MLAGpio sima_utils.transformer.devkit.utils.MLABuffer sima_utils.transformer.devkit.utils.MLAModel Functions --------- .. autoapisummary:: sima_utils.transformer.devkit.utils.connect_mla_rt_api sima_utils.transformer.devkit.utils.disconnect_mla_rt_api Module Contents --------------- .. py:data:: VLM_EVAL_PRINT_INOUTS .. py:data:: VLM_EVAL_PROFILE .. py:data:: mla_rt_api :type: mla_rt_service.devkit_python_api.Mla_rt_apis | None :value: None .. py:function:: connect_mla_rt_api(lib_mla_rt_path: pathlib.Path | None) .. py:function:: disconnect_mla_rt_api() .. py:class:: MLAGpio(lib_mla_rt_path: pathlib.Path) .. py:attribute:: lib_mla_rt_path .. py:attribute:: mla_poke_path .. py:method:: mla_control_gpio(pin: int, value: int) -> None .. py:method:: mla_read_reg(reg_addr: str) -> int .. py:method:: mla_write_reg(reg_addr: str, value: str) -> None .. py:class:: MLABuffer A wrapper around the Mla_buffer defined in devkit apis with additional buffer properties. .. py:attribute:: name :type: str .. py:attribute:: shape :type: tuple[int, Ellipsis] .. py:attribute:: dtype :type: str .. py:attribute:: align_last_dim :type: bool :value: True .. py:attribute:: mla_buffer :type: mla_rt_service.devkit_python_api.Mla_buffer | None :value: None .. py:property:: itemsize :type: int Returns the size of the buffer item in bytes. .. py:property:: size :type: int Returns the size of the buffer in bytes. .. py:method:: allocate() Creates and allocates the buffer. .. py:method:: free() Frees the buffer if it is allocated. .. py:method:: upload(data: numpy.ndarray) Uploads the data to the buffer. .. py:method:: download(begin: tuple[int, Ellipsis] | None = None, shape: tuple[int, Ellipsis] | None = None) -> numpy.ndarray Downloads the data from the buffer. .. py:method:: get_buf_addr_len(begin: tuple[int, Ellipsis] | None = None, shape: tuple[int, Ellipsis] | None = None) -> mla_rt_service.devkit_python_api.DADDR_LEN Creates a DADDR_LEN object for the slice of the buffer defined by begin and shape. .. py:class:: MLAModel Model definition with buffers for ifms and ofms. .. py:attribute:: model_path :type: pathlib.Path .. py:attribute:: ifms :type: list[MLABuffer | tuple[MLABuffer, tuple[int, Ellipsis] | None, tuple[int, Ellipsis] | None]] .. py:attribute:: ofms :type: list[MLABuffer | tuple[MLABuffer, tuple[int, Ellipsis] | None, tuple[int, Ellipsis] | None]] .. py:attribute:: ifm_buffer_addr_lens :type: list[mla_rt_service.devkit_python_api.DADDR_LEN | None] :value: [] .. py:attribute:: ofm_buffer_addr_lens :type: list[mla_rt_service.devkit_python_api.DADDR_LEN] :value: [] .. py:attribute:: unique_models :type: ClassVar[dict[pathlib.Path, Any | None]] .. py:method:: load() -> Any Loads the model and caches the model object so that the model is only loaded once. .. py:method:: free() Frees the model if it is loaded. .. py:method:: run(update_ifm_addr_len_dict: dict[int, Any] | None = None) -> float Loads and runs the model. Updates the ifm addr_len if needed. Returns the runtime of the model. .. py:method:: load_all_models(do_parallel_load: bool = False, elf_dir: pathlib.Path | None = None) :classmethod: