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

[BUG] Fix some bugs in OpenMoE Implementation #5267

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Orion-Zheng
Copy link
Contributor

📌 Checklist before creating the PR

  • I have created an issue for this PR for traceability
  • The title follows the standard format: [doc/gemini/tensor/...]: A concise description
  • I have added relevant tags if possible for us to better distinguish different PRs

🚨 Issue number

Link this PR to your issue with words like fixed to automatically close the linked issue upon merge

📝 What does this PR do?

  1. The original positional encoding during inference is inconsistent with flaxformer implementation.
image
  1. The original implementation will raise some bugs when running on CPU. So I modified the colossalai/moe/layers.py to avoid importing LoadBalancer when unnecessary.

  2. The original convert_openmoe_checkpoint.py is very memory-consuming(almost taking up 3x model weights space), which cause it inconvenient to convert 34B version(requiring ~500GB memory). I added init_empty_weights and remove the unnecessary model loading code to save up memory in the conversion process. Now it can use ~170GB memory to convert 34B version on CPU.

  3. Update the inference example/script to allow multi-GPUs inference(using HuggingFace library) and provide an inference demo on Colab, which can be seen in the new README.md.

  4. Update the model config of base and 8B versions, also add config file of 34B model.

To test the correctness of this PR, you can run the Colab notebook here to test all of my modifications.
https://colab.research.google.com/drive/1Je0oAm3o9ZyZC5Yp7fJmWUn-qrsrASSc?usp=sharing

💥 Checklist before requesting a review

  • I have linked my PR to an issue (instruction)
  • My issue clearly describes the problem/feature/proposal, with diagrams/charts/table/code if possible
  • I have performed a self-review of my code
  • I have added thorough tests.
  • I have added docstrings for all the functions/methods I implemented

⭐️ Do you enjoy contributing to Colossal-AI?

  • 🌝 Yes, I do.
  • 🌚 No, I don't.

Tell us more if you don't enjoy contributing to Colossal-AI.

@Orion-Zheng Orion-Zheng requested a review from a team as a code owner January 14, 2024 10:23
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

Successfully merging this pull request may close these issues.

None yet

1 participant