diff --git a/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LLMEngine.rst b/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LLMEngine.rst index 0a1f8340c354e586e14dc8bafe407ba83697a99a..098ba3f5c6dc34eedec8e0331a6fc0faaed06f68 100644 --- a/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LLMEngine.rst +++ b/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LLMEngine.rst @@ -14,7 +14,7 @@ mindspore_lite.LLMEngine - **TypeError** - `role` 不是LLMRole类型。 - **TypeError** - `cluster_id` 不是int类型。 - .. py:method:: add_model(self, model_paths: Union[Tuple[str], List[str]], options: Dict[str, str], postprocess_model_path=None) + .. py:method:: add_model(model_paths: Union[Tuple[str], List[str]], options: Dict[str, str], postprocess_model_path=None) 在LLMEngine中添加一个模型。 @@ -28,7 +28,7 @@ mindspore_lite.LLMEngine - **TypeError** - `model_paths` 是list或者tuple,但其中的元素不是str类型。 - **TypeError** - `options` 不是dict。 - **RuntimeError** - 添加模型失败。 - + .. py:method:: batch_mode :property: @@ -74,7 +74,7 @@ mindspore_lite.LLMEngine 异常: - **TypeError** - `options` 不是dict。 - **RuntimeError** - 初始化LLMEngine失败。 - + .. py:method:: link_clusters(clusters: Union[List[LLMClusterInfo], Tuple[LLMClusterInfo]], timeout=-1) 连接集群。 diff --git a/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LLMReq.rst b/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LLMReq.rst index d23d27a0a435ed78b06b5992b1828dbc35d3262e..699cf4855c93a626e42083799716bea5c844994d 100644 --- a/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LLMReq.rst +++ b/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LLMReq.rst @@ -10,35 +10,36 @@ mindspore_lite.LLMReq - **req_id** (int) - 该推理任务的请求id。 - **prompt_length** (int) - 该推理任务的提示词长度。 - .. py:method:: next_req_id - - 获取下一个请求id。 - - .. py:method:: req_id + .. py:method:: decoder_cluster_id :property: - 该推理任务的请求id。 + LLMEngine中该推理任务的解码器集群id。 - .. py:method:: prompt_length - :property: + .. py:method:: next_req_id + :staticmethod: - 该推理任务的提示词长度。 + 获取下一个请求id。 .. py:method:: prompt_cluster_id :property: LLMEngine中该推理任务的提示词集群id。 - .. py:method:: decoder_cluster_id + .. py:method:: prompt_length :property: - LLMEngine中该推理任务的解码器集群id。 + 该推理任务的提示词长度。 .. py:method:: prefix_id :property: LLMEngine中该推理任务的解码器集群id前缀。 + .. py:method:: req_id + :property: + + 该推理任务的请求id。 + .. py:method:: sequence_length :property: diff --git a/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LiteInfer.rst b/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LiteInfer.rst index 18ad385fa010e9ab8c93b7736a087f16f3feba69..2cd516a013c9b676e87c6f45220b13c4e1c4c48f 100644 --- a/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LiteInfer.rst +++ b/docs/api/lite_api_python/mindspore_lite/mindspore_lite.LiteInfer.rst @@ -1,41 +1,41 @@ mindspore_lite.LiteInfer ============================= -.. py:class:: mindspore_lite.LiteInfer(model_or_net, *net_inputs, context=None, model_group_id=None, config=None) +.. py:class:: mindspore_lite.LiteInfer(model_or_net, *net_inputs, context=None, model_group_id=None, config: dict = None) `LiteInfer` 类接受训练模型作为输入直接执行推理。 - 参数: + 参数: - **model_or_net** (Model, Cell) - MindSpore模型或者MindSpore的nn.Cell。 - **net_inputs** (Union[Tensor, Dataset, List, Tuple, Number, Bool]) - 表示 `net` 的输入。如果网络有多个输入,则将它们设置在一起。当其类型为 `Dataset` 时,表示 `net` 的预处理行为,数据预处理操作将被序列化,此时需要手动调整数据集脚本的batch大小来影响 `net` 输入的batch大小。目前仅支持从数据集中解析“image”列。 - **context** (Context,可选) - 定义执行过程中用于传递选项的上下文,``None`` 表示使用CPU的上下文。默认值:``None``。 - **model_group_id** (int,可选) - 用于绑定模型id至模型群组。默认值:``None``。 - **config** (dict,可选) - 当后端为“lite”时使用。配置信息包含两部分,config_path('configPath',str)和config_item(str,dict)。config_item优先级高于config_path。设置用于推理的rank table文件,配置文件的内容如下: - .. code-block:: + .. code-block:: - [ascend_context] - rank_table_file=[path_a](storage initial path of the rank table file) + [ascend_context] + rank_table_file=[path_a](storage initial path of the rank table file) - 当设置了 + 当设置了 - .. code-block:: + .. code-block:: - config = {"ascend_context" : {"rank_table_file" : "path_b"}} + config = {"ascend_context" : {"rank_table_file" : "path_b"}} - 配置中的path_b将会被用于编译模型。默认值:``None``。 + 配置中的path_b将会被用于编译模型。默认值:``None``。 异常: - **ValueError** - `model_or_net` 不是MindSpore模型或者MindSpore的nn.Cell。 .. py:method:: get_inputs() - 获取模型的所有输入张量。详情见 :func:`mindspore_lite.model.get_inputs`。 + 获取模型的所有输入张量。详情见 :func:`mindspore_lite.Model.get_inputs`。 .. py:method:: predict(inputs) - 模型推理。详情见 :func:`mindspore_lite.model.predict`。 + 模型推理。详情见 :func:`mindspore_lite.Model.predict`。 .. py:method:: resize(inputs, dims) - 调整输入的形状。详情见 :func:`mindspore_lite.model.resize`。 + 调整输入的形状。详情见 :func:`mindspore_lite.Model.resize`。 diff --git a/docs/api/lite_api_python_en/mindspore_lite.rst b/docs/api/lite_api_python_en/mindspore_lite.rst index 4025c156f0f11b6f4a387e7b3573c8f6da4ef11f..14f20e6a182b74a2c0e0f05a08c6632660d3ad84 100644 --- a/docs/api/lite_api_python_en/mindspore_lite.rst +++ b/docs/api/lite_api_python_en/mindspore_lite.rst @@ -69,7 +69,7 @@ LLMEngine LiteInfer ---------- -.. mscnautosummary:: +.. autosummary:: :toctree: mindspore_lite mindspore_lite.LiteInfer diff --git a/mindspore-lite/python/api/lite_infer.py b/mindspore-lite/python/api/lite_infer.py index e86a910d745da3549f524f641b76f3dd9a8e8831..def62b4c43fdb6992bfa27337c46fb056d97bd5c 100644 --- a/mindspore-lite/python/api/lite_infer.py +++ b/mindspore-lite/python/api/lite_infer.py @@ -130,7 +130,7 @@ class LiteInfer(BaseModel): """ Obtains all input Tensors of the model. - See `mindspore_lite.model.get_inputs` for more details. + See `mindspore_lite.Model.get_inputs` for more details. """ # pylint: disable=useless-super-delegation return super(LiteInfer, self).get_inputs() @@ -139,7 +139,7 @@ class LiteInfer(BaseModel): """ Inference model. - See `mindspore_lite.model.predict` for more details. + See `mindspore_lite.Model.predict` for more details. """ # pylint: disable=useless-super-delegation return super(LiteInfer, self).predict(inputs) @@ -148,7 +148,7 @@ class LiteInfer(BaseModel): """ Resizes the shapes of inputs. - See `mindspore_lite.model.resize` for more details. + See `mindspore_lite.Model.resize` for more details. """ # pylint: disable=useless-super-delegation super(LiteInfer, self).resize(inputs, dims)