[fix]: fix moe.hpp load from file bug.#1780
Conversation
Summary of ChangesHello @ouqingliang, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a bug in Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes a bug related to loading from a file in moe.hpp by changing the prefix variable from a class member to a local variable. This correctly resolves an issue where the member variable was used without being initialized in some code paths. The changes are logical and address the bug effectively. I have a couple of suggestions to improve maintainability and code consistency.
| std::filesystem::path prefix = config_.path; | ||
| prefix = prefix / ("_layer_" + std::to_string(config_.layer_idx)) / ("_numa_" + std::to_string(tp_part_idx)); |
There was a problem hiding this comment.
This logic to construct the prefix path is duplicated from lines 145-146 within the same function. To improve maintainability and avoid redundancy, consider defining and initializing the prefix variable once at the beginning of the load_weights function, before the if (config_.quant_config.bits == 0) block.
kt-kernel/operators/amx/moe.hpp
Outdated
| this->weights_loaded = true; | ||
| } else if (config.path != "") { | ||
| printf("TP Load from file\n"); | ||
| printf("TP Load from file %s\n", config.path.c_str()); |
There was a problem hiding this comment.
* fix pypi cuda install (#1763) * Update release-pypi.yml (#1764) * fix cuda wheel build (#1766) * Cli (#1765) * [feat]: add custom option for kt run * [feat]: depth 3 * [docs]: add kt-cli doc and update corresponding website (#1768) * Remove kt-kernel-cuda, kt-kernel uses the version with cuda (#1769) * Update release-pypi.yml (#1770) * bump to 0.5.0.post1 (#1771) * [ci]: Patch ci (#1772) * [docs]: add kt-cli doc and update corresponding website * [feat]: update issue template * [fix]: fix moe hpp bug. (#1780) fix moe hpp init bug. * Fix moe bug. (#1783) * [fix]: fix moe.hpp load from file bug. * [fix]: fix all moe hpp init bug. * [fix]: fix moe & awq-moe ug. * [feat](kt-sft-refactor): load from huggingface safetensor file * [fix]: fix bugs for activation, sft forward and backward --------- Co-authored-by: Jianwei Dong <dongjw24@mails.tsinghua.edu.cn> Co-authored-by: ErvinXie <ervinxie@qq.com> Co-authored-by: ZiWei Yuan <yzwliam@126.com> Co-authored-by: Oql <1692110604@qq.com> Co-authored-by: mrhaoxx <mr.haoxx@gmail.com>
What does this PR do?
Fixes # (issue)
Before submitting