Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rkllm_run_async 无效 #208

Open
skiptomylou86 opened this issue Mar 4, 2025 · 4 comments
Open

rkllm_run_async 无效 #208

skiptomylou86 opened this issue Mar 4, 2025 · 4 comments

Comments

@skiptomylou86
Copy link

参考llm_demo,在RK3588平台上,初始化参数RKLLMParam的is_async设置为true,调用rkllm_run_async,

`
RKLLMInput rkllm_input;
RKLLMInferParam rkllm_infer_params;
memset(&rkllm_infer_params, 0, sizeof(RKLLMInferParam));
rkllm_infer_params.mode = RKLLM_INFER_GENERATE;
rkllm_input.input_type = RKLLM_INPUT_PROMPT;
rkllm_input.prompt_input = (char *)text.c_str();
rkllm_run_async(llmHandle, &rkllm_input, &rkllm_infer_params, NULL);

`

在初始化的回调函数(callback(RKLLMResult *result, void *userdata, LLMCallState state))中,没有收到任何数据,请问还有什么参数需要设置吗?

@waydong
Copy link
Collaborator

waydong commented Mar 7, 2025

你好,不使用异步时能否正常推理呢。

@fungizhang
Copy link

/rknn-llm-main/rkllm-runtime/Linux/librkllm_api/include/rkllm.h

int rkllm_run(LLMHandle handle, RKLLMInput* rkllm_input, RKLLMInferParam* rkllm_infer_params, void* userdata);

/**

  • @brief Runs an LLM inference task asynchronously.
  • @param handle LLM handle.
  • @param rkllm_input Input data for the LLM.
  • @param rkllm_infer_params Parameters for the inference task.
  • @param userdata Pointer to user data for the callback.
  • @return Status code (0 for success, non-zero for failure).
    /
    int rkllm_run_async(LLMHandle handle, RKLLMInput
    rkllm_input, RKLLMInferParam* rkllm_infer_params, void* userdata);

/**

  • @brief Aborts an ongoing LLM task.
  • @param handle LLM handle.
  • @return Status code (0 for success, non-zero for failure).
    */

我看rkllm_run_async函数实际上是Aborts an ongoing LLM task。rkllm_run虽然可以正常推理,但是无法并行,以提升npu利用率

@skiptomylou86
Copy link
Author

你好,不使用异步时能否正常推理呢。

你好,不使用异步时可以正常推理,callback有回调

@lzw12138
Copy link

我也遇到了 解决了嘛大佬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants