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

Add support for MiniMax's MiniMax-Text-01 #35831

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3a046a4
end-to-end architecture
geetu040 Jan 22, 2025
519eda3
lightning-attn: refactor, clean, optimize
geetu040 Jan 23, 2025
c54f804
put minimax_text_01 in other files
geetu040 Jan 24, 2025
d8d3c40
use latest __init__ standards and auto-generate modular
geetu040 Jan 27, 2025
8d654d8
support attention_mask for lightning-attn
geetu040 Jan 27, 2025
70b787c
Merge branch 'main' into minimax-text-01
geetu040 Jan 27, 2025
5b40a5c
Revert "use latest __init__ standards and auto-generate modular"
geetu040 Jan 27, 2025
a93ee3f
fix modular conversion
geetu040 Jan 27, 2025
92f7963
pass both attention masks instead of tuple
geetu040 Jan 27, 2025
ecdc0eb
formatting
geetu040 Jan 27, 2025
0027c0e
Updated Dynamic Cache
Shakib-IO Jan 30, 2025
e117d26
created MiniMaxText01Cache
geetu040 Jan 31, 2025
7d7ae06
fix hardcoded slope_rate
geetu040 Feb 1, 2025
d209bd3
update attn_type_list in config
geetu040 Feb 1, 2025
d6eb561
fix lightning when use_cache=False
geetu040 Feb 1, 2025
99db3a0
Merge branch 'main' into minimax-text-01
geetu040 Feb 7, 2025
e459521
copy tests from mixtral
geetu040 Feb 7, 2025
866ba89
(checkpoint) all tests pass for normal attention
geetu040 Feb 7, 2025
1a6f086
fix all unittests
geetu040 Feb 10, 2025
e27af34
Merge branch 'main' into minimax-text-01
geetu040 Feb 10, 2025
5ba152b
fix import sorting
geetu040 Feb 10, 2025
8fd17ca
fix consistency and formatting tests
geetu040 Feb 10, 2025
d907633
fix config
geetu040 Feb 12, 2025
09b07ea
Merge branch 'main' into minimax-text-01
geetu040 Feb 12, 2025
c08a619
update tests, since changes in main
geetu040 Feb 12, 2025
8117b2d
fix seq_len error
geetu040 Feb 13, 2025
2f9dc21
create dummy docs
geetu040 Feb 13, 2025
299e707
fix checkpoint
geetu040 Feb 13, 2025
33e4157
add checkpoint in config docstring
geetu040 Feb 13, 2025
852ce2e
Merge branch 'main' into minimax-text-01
geetu040 Feb 13, 2025
85b3dcb
run modular_conversion
geetu040 Feb 13, 2025
cdaa09b
update docs
geetu040 Feb 13, 2025
4eb7a08
Merge branch 'main' into minimax-text-01
geetu040 Feb 14, 2025
1f63bbb
fix checkpoint path and update tests
geetu040 Feb 15, 2025
d95ea2d
fix ruff
geetu040 Feb 16, 2025
2150a5f
Merge branch 'main' into minimax-text-01
geetu040 Feb 16, 2025
720fd4f
remove repeated expected_slice
geetu040 Feb 16, 2025
c527d34
update docs
geetu040 Feb 16, 2025
3603b4d
Merge branch 'main' into minimax-text-01
geetu040 Feb 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/source/ar/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,8 @@
# title: Mistral
# - local: model_doc/mixtral
# title: Mixtral
# - local: model_doc/minimax_text_01
# title: MiniMaxText01
# - local: model_doc/mluke
# title: mLUKE
# - local: model_doc/mobilebert
Expand Down
2 changes: 1 addition & 1 deletion docs/source/ar/conversations.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,4 @@ pipe = pipeline("text-generation", "meta-llama/Meta-Llama-3-8B-Instruct", device

لذلك، إذا كنت تريد تحسين سرعة توليد النص، فإن الحل الأسهل هو إما تقليل حجم النموذج في الذاكرة (عادةً عن طريق التكميم)، أو الحصول على عتاد بسرعة أكبر في الذاكرة. بالنسبة للمستخدمين المتقدمين، هناك عدة تقنيات أخرى للتغلب على هذه القيود. الأكثر شيوعًا هي المتغيرات على [التوليد بمساعدة](https://huggingface.co/blog/assisted-generation)، المعروف أيضًا باسم "العينات التخمينية (speculative sampling)". تحاول هذه التقنيات تخمين عدة رموز مستقبلية في وقت واحد، غالبًا باستخدام نموذج "مسودة (draft model)" أصغر، ثم تأكيد هذه التوليدات باستخدام نموذج الدردشة. إذا تم التحقق من صحة التخمينات بواسطة نموذج الدردشة، فيمكن إنشاء أكثر من رمز واحد لكل تمرير للأمام، مما يخفف بشكل كبير من القيود المتعلقة بالسعة ويحسن سرعة التوليد.

أخيرًا، يجب أن نلاحظ أيضًا تأثير نماذج "مزيج الخبراء" "Mixture of Experts" (MoE) هنا. العديد من نماذج المحادثة الشهيرة، مثل Mixtral وQwen-MoE وDBRX، هي نماذج MoE. في هذه النماذج، لا تكون كل معلمة نشطة لكل رمز يتم إنشاؤه. ونتيجة لذلك، فإن نماذج MoE لديها عمومًا متطلبات ذاكرة أقل بكثير، على الرغم من أن حجمها الإجمالي يمكن أن يكون كبيرًا جدًا. لذلك يمكن أن تكون أسرع عدة مرات من نموذج "كثيف" عادي بنفس الحجم. ومع ذلك، فإن التقنيات مثل التوليد المساعد غير فعالة بشكل عام لهذه النماذج لأن المزيد من المعلمات ستصبح نشطة مع كل رمز جديد يتم التكهن به، والذي سيبطل فوائد السعة والسرعة التي توفرها بنية MoE.
أخيرًا، يجب أن نلاحظ أيضًا تأثير نماذج "مزيج الخبراء" "Mixture of Experts" (MoE) هنا. العديد من نماذج المحادثة الشهيرة، مثل Mixtral وMiniMaxText01وQwen-MoE وDBRX، هي نماذج MoE. في هذه النماذج، لا تكون كل معلمة نشطة لكل رمز يتم إنشاؤه. ونتيجة لذلك، فإن نماذج MoE لديها عمومًا متطلبات ذاكرة أقل بكثير، على الرغم من أن حجمها الإجمالي يمكن أن يكون كبيرًا جدًا. لذلك يمكن أن تكون أسرع عدة مرات من نموذج "كثيف" عادي بنفس الحجم. ومع ذلك، فإن التقنيات مثل التوليد المساعد غير فعالة بشكل عام لهذه النماذج لأن المزيد من المعلمات ستصبح نشطة مع كل رمز جديد يتم التكهن به، والذي سيبطل فوائد السعة والسرعة التي توفرها بنية MoE.
1 change: 1 addition & 0 deletions docs/source/ar/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
| [MGP-STR](model_doc/mgp-str) | ✅ | ❌ | ❌ |
| [Mistral](model_doc/mistral) | ✅ | ✅ | ✅ |
| [Mixtral](model_doc/mixtral) | ✅ | ❌ | ❌ |
| [MiniMaxText01](model_doc/minimax_text_01) | ✅ | ❌ | ❌ |
| [mLUKE](model_doc/mluke) | ✅ | ❌ | ❌ |
| [MMS](model_doc/mms) | ✅ | ✅ | ✅ |
| [MobileBERT](model_doc/mobilebert) | ✅ | ✅ | ❌ |
Expand Down
2 changes: 1 addition & 1 deletion docs/source/ar/trainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ training_args = TrainingArguments(
)
```

تدعم النواة معماريات نماذج Llama و Gemma و Mistral و Mixtral. يُمكن العثور على أحدث قائمة بالنمائج المدعومة [هنا](https://github.com/linkedin/Liger-Kernel). عندما يتم تعيين `use_liger_kernel` إلى `True`، سيتم تصحيح الطبقات المُقابلة في النموذج الأصلي باستخدام تطبيق Liger الفعال، لذلك لا تحتاج إلى فعل أي شيء إضافي بخلاف تعيين قيمة المعامل.
تدعم النواة معماريات نماذج Llama و Gemma و Mistral و Mixtralو MiniMaxText01. يُمكن العثور على أحدث قائمة بالنمائج المدعومة [هنا](https://github.com/linkedin/Liger-Kernel). عندما يتم تعيين `use_liger_kernel` إلى `True`، سيتم تصحيح الطبقات المُقابلة في النموذج الأصلي باستخدام تطبيق Liger الفعال، لذلك لا تحتاج إلى فعل أي شيء إضافي بخلاف تعيين قيمة المعامل.

## المُحسِّنات
يمكنك اختيار مُحسِّن مدمج للتدريب باستخدام:
Expand Down
2 changes: 2 additions & 0 deletions docs/source/en/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@
title: MegatronBERT
- local: model_doc/megatron_gpt2
title: MegatronGPT2
- local: model_doc/minimax_text_01
title: MiniMaxText01
- local: model_doc/mistral
title: Mistral
- local: model_doc/mixtral
Expand Down
2 changes: 1 addition & 1 deletion docs/source/en/conversations.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ confirm these generations with the chat model. If the guesses are validated by t
be generated per forward pass, which greatly alleviates the bandwidth bottleneck and improves generation speed.

Finally, we should also note the impact of "Mixture of Experts" (MoE) models here. Several popular chat models,
such as Mixtral, Qwen-MoE and DBRX, are MoE models. In these models, not every parameter is active for every token generated.
such as Mixtral, MiniMaxText01, Qwen-MoE and DBRX, are MoE models. In these models, not every parameter is active for every token generated.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humm, it's okay to modify that, but please add your model name at the end of the list then 🤗 And for all languages

As a result, MoE models generally have much lower memory bandwidth requirements, even though their total size
can be quite large. They can therefore be several times faster than a normal "dense" model of the same size. However,
techniques like assisted generation are generally ineffective for these models because more parameters will become
Expand Down
1 change: 1 addition & 0 deletions docs/source/en/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ Flax), PyTorch, and/or TensorFlow.
| [Megatron-GPT2](model_doc/megatron_gpt2) | ✅ | ✅ | ✅ |
| [MGP-STR](model_doc/mgp-str) | ✅ | ❌ | ❌ |
| [Mimi](model_doc/mimi) | ✅ | ❌ | ❌ |
| [MiniMaxText01](model_doc/minimax_text_01) | ✅ | ❌ | ❌ |
| [Mistral](model_doc/mistral) | ✅ | ✅ | ✅ |
| [Mixtral](model_doc/mixtral) | ✅ | ❌ | ❌ |
| [Mllama](model_doc/mllama) | ✅ | ❌ | ❌ |
Expand Down
Loading