WaveCut commited on
Commit
d05fb4b
·
verified ·
1 Parent(s): 50dd587

Add the loader, configs, model card and checksums

Browse files
.gitattributes CHANGED
@@ -33,3 +33,16 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/e01.jpg filter=lfs diff=lfs merge=lfs -text
37
+ assets/e03.jpg filter=lfs diff=lfs merge=lfs -text
38
+ assets/e06.jpg filter=lfs diff=lfs merge=lfs -text
39
+ assets/e08.jpg filter=lfs diff=lfs merge=lfs -text
40
+ assets/e10.jpg filter=lfs diff=lfs merge=lfs -text
41
+ assets/e12.jpg filter=lfs diff=lfs merge=lfs -text
42
+ assets/e13.jpg filter=lfs diff=lfs merge=lfs -text
43
+ assets/e16.jpg filter=lfs diff=lfs merge=lfs -text
44
+ assets/latency_and_memory.png filter=lfs diff=lfs merge=lfs -text
45
+ assets/s01-crop.jpg filter=lfs diff=lfs merge=lfs -text
46
+ assets/s01.jpg filter=lfs diff=lfs merge=lfs -text
47
+ assets/s02.jpg filter=lfs diff=lfs merge=lfs -text
48
+ assets/x01.jpg filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MiniMax-H3-Image COMMUNITY LICENSE AGREEMENT
2
+ MiniMax-H3-Image release date/License date: November 10, 2026.
3
+ The scope of this License Agreement (this “Agreement”) is expressly limited to the “Applicable Territory” as defined below.
4
+ By clicking to accept, or by using, reproducing, modifying, distributing, running, or displaying any portion or element of the MiniMax-H3-Image Works (including through any Hosted Service) in any manner, you acknowledge and accept the terms of this Agreement, and this Agreement shall take immediate effect upon the occurrence of such act.
5
+ I. Definitions
6
+ 1. “Acceptable Use Policy” means the policy published by MiniMax in Exhibit A.
7
+ 2. “Agreement” means the terms and conditions set forth herein that govern the use, reproduction, distribution, modification, running, and display of the MiniMax-H3-Image Works or any portion or element thereof.
8
+ 3. “Applicable Territory” means worldwide, excluding the Excluded Territories.
9
+ 4. “Documentation” means the specifications, manuals, and documentation concerning MiniMax-H3-Image that are publicly released by MiniMax.
10
+ 5. “Excluded Territories” means the European Union, the United Kingdom, the Republic of Korea and the United States of America.
11
+ 6. “MiniMax-H3-Image” means the image generation model, together with its software and algorithms, including trained model weights, parameters (including optimizer states), prompt-enhancement models, inference-supporting code, and other elements thereof made publicly available by Us, as released at https://huggingface.co/MiniMaxAI/MiniMax-H3-Image.
12
+ 7. “MiniMax-H3-Image Works” means (i) the Materials, (ii) the Model Derivatives, and (iii) all derivatives thereof.
13
+ 8. “Hosted Service” means a service through which MiniMax-H3-Image or its Model Derivatives is hosted or operated and its functionality is made available to Third Parties, including via application programming interfaces (APIs), web access, or any other electronic or remote means.
14
+ 9. “Licensee,” “you,” or “your” means the natural or legal person exercising rights and/or using the MiniMax-H3-Image Works for any purpose in any field of use under this Agreement.
15
+ 10. “Materials” means, collectively, MiniMax-H3-Image and the Documentation (and any portion thereof), in each case as made available by MiniMax under this Agreement and proprietary to MiniMax.
16
+ 11. “Model Derivatives” means all of the following: (i) any modification of MiniMax-H3-Image or any Model Derivative thereof; (ii) any work based on MiniMax-H3-Image or any Model Derivative thereof; or (iii) any other machine learning model created by transferring the patterns of the weights, parameters, operational patterns, or Outputs of MiniMax-H3-Image or any Model Derivative thereof to another model, such that the latter model exhibits behavior similar to MiniMax-H3-Image or its Model Derivatives, including by distillation methods, methods using intermediate data representations, or methods based on training using synthetic-data Outputs generated by MiniMax-H3-Image or its Model Derivatives. For the avoidance of doubt, Outputs are not deemed Model Derivatives.
17
+ 12. “Output” means any result of operating or otherwise using MiniMax-H3-Image or any Model Derivatives (including through Hosted Service).
18
+ 13. “Third Party” means any natural or legal person that is not under common control with us or with you.
19
+ 14. “Including” means “including but not limited to.”
20
+ 15. “We,” “Us” or “MiniMax” means Nanonoble Pte. Ltd..
21
+ II. Grant of Rights
22
+ Solely within the Applicable Territory, we grant you a non-exclusive, non-transferable, royalty-free, limited license to use, reproduce, distribute, create derivative works (including Model Derivatives), and modify the Materials in accordance with the terms of this Agreement and the Acceptable Use Policy, based on the intellectual property and other rights owned by MiniMax that are embodied in or used by the Materials. You shall not violate (or encourage or permit any person to violate) any term of this Agreement or the Acceptable Use Policy.
23
+ We will continuously evaluate the applicable laws, regulations and compliance requirements for the Excluded Territories. In the meantime, should any person in such Excluded Territories be interested in deploying our models, you are welcome to contact us about obtaining a license, which will be granted based on robust controls and guardrails for purposes of complying with the laws, regulations and compliance requirements of the Excluded Territories.
24
+ III. Distribution and Redistribution
25
+ Subject to and conditioned on your continuing compliance with this Agreement, including its territorial restrictions and the Acceptable Use Policy, and solely within the Applicable Territory, you may distribute or make available the MiniMax-H3-Image Works to Third Parties within the Applicable Territory; provided, that all of the following conditions are met:
26
+ 1. You must provide a copy of this Agreement to all such Third Parties who receive the MiniMax-H3-Image Works or use your products or services related thereto;
27
+ 2. You must cause any modified files to carry prominent notices stating that you have modified such files;
28
+ 3. You are encouraged to:
29
+ a. display a notice on any product or service developed using MiniMax-H3-Image indicating that the product or service is “Powered by MiniMax-H3-Image”;
30
+ b. add an AI-generation identifier to files produced using generative AI models including MiniMax-H3-Image; and
31
+ c. publish at least one technical blog post or a public statement describing your experience using MiniMax-H3-Image Works;
32
+ 4. All distributions to Third Parties (other than through Hosted Service) must be accompanied by a “NOTICE” text file containing the following notice:
33
+ “MiniMax-H3-Image is licensed under the MiniMax-H3-Image Community License Agreement, Copyright © 2026 MiniMax. All Rights Reserved.”
34
+ You may add your own copyright notices on your modifications; except as provided in this Section and in Section V, however, you may not impose additional or different terms and conditions on the use, reproduction, or distribution of your modifications or of any aggregate Model Derivatives, and your use, reproduction, modification, distribution, running, and display of the work must otherwise comply with the terms and conditions of this Agreement (including the provisions concerning the Applicable Territory). If you receive the MiniMax-H3-Image Works from a Licensee as part of an integrated end-user product, the provisions of Section III of this Agreement do not apply to you, but Section V and Exhibit A remain applicable.
35
+ IV. Additional Commercial Terms
36
+ 1. You shall obtain a separate, prior written authorization from MiniMax by sending a request through https://platform.minimax.io/license, if the Annualized Revenue of you and/or your affiliates exceeds 1 Million USD, or, you provide Hosted Service(s) to any Third Parties.
37
+ 2. You shall prominently display “MiniMax-H3-Image”on the user interface of commercial product or service that uses MiniMax-H3-Image or MiniMax-H3-Image Works.
38
+ V. Use Restrictions
39
+ 1. Your use of the MiniMax-H3-Image Works must comply with applicable laws and regulations (including trade-compliance laws and regulations) and must comply with the Acceptable Use Policy for the MiniMax-H3-Image Works, which is incorporated into this Agreement by reference.
40
+ 2. Before providing access to the MiniMax-H3-Image Works or any product, service, or Hosted Service incorporating them, you must bind each recipient or user to enforceable terms at least as protective as the use restrictions in this Section V and Exhibit A, and you must notify each recipient or user that those restrictions apply.
41
+ 3. You may not use the MiniMax-H3-Image Works or any of their Outputs or results to improve any other artificial intelligence model (other than MiniMax-H3-Image or its Model Derivatives).
42
+ 4. You may not use, reproduce, modify, distribute, or display the MiniMax-H3-Image Works or any of their Outputs or results outside the Applicable Territory. Any such use outside the Applicable Territory is not authorized by this Agreement.
43
+ 5. If you provide or make available to any Third Party a product, service, or Hosted Service that permits the generation of Outputs using MiniMax-H3-Image or any Model Derivative, you must, before making that product or service available and throughout its operation, implement, maintain, test, and periodically review reasonable and proportionate technical and organizational safeguards designed to prevent and mitigate access, uses, and Outputs that violate this Section V or Exhibit A, including uses or Outputs that infringe, misappropriate, or otherwise violate any Third Party’s intellectual-property or other rights. You must not knowingly disable, materially weaken, or permit the circumvention of those safeguards. You must maintain a reasonably accessible mechanism for reporting suspected violations. Upon receiving a good-faith report or otherwise obtaining actual knowledge of a violation, you must promptly investigate and take reasonable steps within your control to stop or mitigate the violation, including removing or disabling access to offending content or services and suspending or terminating repeat violators where appropriate. You are responsible for implementing and enforcing these requirements with respect to your products, services, systems, users, and downstream recipients.
44
+ VI. Intellectual Property
45
+ 1. Subject to MiniMax’s rights in the MiniMax-H3-Image Works (and the intellectual property therein), and to your compliance with the terms and conditions of this Agreement, as between you and MiniMax, you will own the derivative works and modifications of the Materials that you have created or had created, as well as any Model Derivatives.
46
+ 2. Except for the limited license expressly granted in this paragraph, no trademark license is granted under this Agreement; with respect to MiniMax-H3-Image Works, the Licensee may not use any name or mark owned by or associated with MiniMax or any of its affiliates, except as reasonably and customarily necessary to describe and distribute the MiniMax-H3-Image Works. MiniMax hereby grants you a license to use the “MiniMax-H3-Image” mark (the “Mark”) within the Applicable Territory solely for the purpose of complying with Section III.3; provided, that you comply with all applicable trademark-protection laws. All goodwill arising from your use of the Mark shall inure to the benefit of MiniMax.
47
+ 3. If you bring or assert any suit or other legal proceeding (including a cross-claim or counterclaim in any action) against us or any other natural or legal person alleging that the Materials, any Output, or any portion of the foregoing infringes any intellectual property right or other right owned by you or for which you can obtain a license, all licenses granted to you under this Agreement will terminate as of the date such suit or proceeding is filed. You shall defend, indemnify, and hold us harmless against any Third-Party claim arising out of or related to the use or distribution of the MiniMax-H3-Image Works by you or by any Third Party.
48
+ 4. MiniMax claims no rights over the Outputs you generate. You and your users are entirely responsible for the Outputs and any subsequent use thereof.
49
+ VII. Disclaimers and Limitations of Liability
50
+ 1. We have no obligation to support, update, provide training for, or develop any further version of the MiniMax-H3-Image Works, or to grant any license with respect thereto.
51
+ 2. UNLESS AND ONLY TO THE EXTENT REQUIRED BY APPLICABLE LAW, THE MiniMax-H3-Image WORKS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED “AS IS” WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND INCLUDING ANY WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, COURSE OF DEALING, USAGE OF TRADE, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING, REPRODUCING, MODIFYING, PERFORMING, DISPLAYING OR DISTRIBUTING ANY OF THE MiniMax-H3-Image WORKS OR OUTPUTS AND ASSUME ANY AND ALL RISKS ASSOCIATED WITH YOUR OR A THIRD PARTY’S USE OR DISTRIBUTION OF ANY OF THE MiniMax-H3-Image WORKS OR OUTPUTS AND YOUR EXERCISE OF RIGHTS AND PERMISSIONS UNDER THIS AGREEMENT.
52
+ 3. TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL MINIMAX OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, FOR ANY DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, EXEMPLARY, CONSEQUENTIAL OR PUNITIVE DAMAGES, OR LOST PROFITS OF ANY KIND ARISING FROM THIS AGREEMENT OR RELATED TO ANY OF THE MiniMax-H3-Image WORKS OR OUTPUTS, EVEN IF MINIMAX OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
53
+ VIII. Term and Termination
54
+ 1. This Agreement is effective from the moment you accept this Agreement or begin accessing the Materials, and, subject to your compliance with its terms and conditions, will remain in effect until terminated as provided herein.
55
+ 2. If you breach any term or condition of this Agreement, we have the right to terminate this Agreement. Upon termination, you must immediately cease accessing, using, and distributing the MiniMax-H3-Image Works; delete or destroy all copies within your possession or control; and notify each downstream recipient that your authorization has ended. The obligations in the preceding sentence and Sections VI.1, VI.3, VII, and IX survive termination.
56
+ IX. Governing Law and Jurisdiction
57
+ 1. This Agreement, and any dispute arising out of or related to this Agreement, shall be governed by the laws of the Hong Kong Special Administrative Region of the People’s Republic of China, without regard to its conflict-of-laws rules. The United Nations Convention on Contracts for the International Sale of Goods does not apply to this Agreement.
58
+ 2. Any dispute arising out of or related to this Agreement shall be subject to the exclusive jurisdiction of the courts of the Hong Kong Special Administrative Region of the People’s Republic of China with competent jurisdiction. Both MiniMax and the Licensee hereby consent to the exclusive jurisdiction of such courts for any such dispute.
59
+ Additional Note: Please note that the text-to-image prompt enhancer model (https://huggingface.co/MiniMaxAI/MiniMax-H3-Image-PE, "T2I PE Model") of MiniMax-H3-Image is derived from Qwen3.8-27B licensed under Apache 2.0 License: https://huggingface.co/Qwen/Qwen3.8-27B. The T2I PE Model is part of MiniMax-H3-Image and is accordingly subject to this Agreement for the avoidance of doubt.
60
+
61
+ Exhibit A — Acceptable Use Policy
62
+ MiniMax reserves the right to update this Acceptable Use Policy from time to time.
63
+ Last revised: November 10, 2026.
64
+ MiniMax is committed to promoting the safe and fair use of its tools and features, including MiniMax-H3-Image. You agree not to use MiniMax-H3-Image, any Model Derivatives, or any Output in any of the following ways:
65
+ 1. Use outside the Applicable Territory;
66
+ 2. Use in any manner that violates any applicable national, federal, state, local, or international law, regulation, or other legal requirement, or that infringes, misappropriates, or otherwise violates any Third Party’s intellectual-property or other proprietary rights, including through unauthorized reproduction, distribution, public display, public performance, or creation of derivative works;
67
+ 3. Use in any manner that may harm yourself or others;
68
+ 4. Use to repurpose or distribute the Outputs of MiniMax-H3-Image or any Model Derivatives in order to harm yourself or others;
69
+ 5. Use to circumvent or bypass any safety guardrails or safeguards we have implemented;
70
+ 6. Use in any manner that exploits or harms, or intends to exploit or harm, minors;
71
+ 7. Use to generate or disseminate verifiably false information and/or content for the purpose of harming others or influencing elections;
72
+ 8. Use to manufacture or facilitate false online engagement, including fake reviews and other means of false online engagement;
73
+ 9. Use to intentionally defame, disparage, or otherwise harass others;
74
+ 10. Use to generate and/or disseminate malware (including ransomware) or any other content intended to damage electronic systems;
75
+ 11. Use to generate or disseminate personally identifiable information for the purpose of harming others;
76
+ 12. Use to generate or disseminate information (including images, code, posts, or articles) in or to any public environment (including via bot tweets or similar means) without clearly and prominently disclosing that such information and/or content is machine-generated;
77
+ 13. Use to impersonate another person without that person’s consent, authorization, or lawful right to do so;
78
+ 14. Use to make high-risk automated decisions in critical domains that affect individual safety, rights, or well-being (such as law enforcement, immigration, healthcare or medical services, critical-infrastructure management, product-safety components, essential services, credit, employment, housing, education, social scoring, or insurance);
79
+ 15. Use in any manner that violates or disregards the social, ethical, or moral standards of other countries or regions;
80
+ 16. Use to carry out, assist, threaten, incite, plan, advocate for, or encourage violent extremism or terrorism;
81
+ 17. Use for any purpose intended to discriminate against, or harm, individuals or groups based on protected characteristics or categories, online or offline social behavior, or known or predicted personality traits;
82
+ 18. Use to intentionally exploit the vulnerabilities of specific populations based on age, social, physical, or psychological characteristics, so as to materially distort the behavior of a member of that group in a manner that causes, or is likely to cause, physical or psychological harm to that person or to others;
83
+ 19. Use for military purposes;
84
+ 20. Use to engage in any unauthorized or unlicensed professional activity, including but not limited to financial, legal, medical or healthcare, or other professional practice.
LICENSE-MiniMax-H3 ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MiniMax H3 COMMUNITY LICENSE AGREEMENT
2
+ MiniMax H3 release date/License date: August 2, 2026.
3
+ The scope of this License Agreement (this “Agreement”) is expressly limited to the “Applicable Territory” as defined below.
4
+ By clicking to accept, or by using, reproducing, modifying, distributing, running, or displaying any portion or element of the MiniMax H3 Works (including through any Hosted Services) in any manner, you acknowledge and accept the terms of this Agreement, and this Agreement shall take immediate effect upon the occurrence of such act.
5
+ I. Definitions
6
+ 1. “Acceptable Use Policy” means the policy published by MiniMax in Exhibit A.
7
+ 2. “Agreement” means the terms and conditions set forth herein that govern the use, reproduction, distribution, modification, running, and display of the MiniMax H3 Works or any portion or element thereof.
8
+ 3. “Applicable Territory” means worldwide, excluding the Excluded Territories.
9
+ 4. “Documentation” means the specifications, manuals, and documentation concerning MiniMax H3 that are publicly released by MiniMax.
10
+ 5. “Excluded Territories” means the European Union, the United Kingdom, the Republic of Korea and the United States of America.
11
+ 6. “MiniMax H3” means the video generation model, together with its software and algorithms, including trained model weights, parameters (including optimizer states), machine-learning model code, inference-supporting code, and other elements thereof made publicly available by Us, as released at https://huggingface.co/MiniMaxAI/MiniMax-H3.
12
+ 7. “MiniMax H3 Works” means (i) the Materials, (ii) the Model Derivatives, and (iii) all derivatives thereof.
13
+ 8. “Hosted Services” means hosted services provided via application programming interfaces (APIs), web access, or any other electronic or remote means.
14
+ 9. “Licensee,” “you,” or “your” means the natural or legal person exercising rights and/or using the MiniMax H3 Works for any purpose in any field of use under this Agreement.
15
+ 10. “Materials” means, collectively, MiniMax H3 and the Documentation (and any portion thereof), in each case as made available by MiniMax under this Agreement and proprietary to MiniMax.
16
+ 11. “Model Derivatives” means all of the following: (i) any modification of MiniMax H3 or any Model Derivative thereof; (ii) any work based on MiniMax H3 or any Model Derivative thereof; or (iii) any other machine learning model created by transferring the patterns of the weights, parameters, operational patterns, or Outputs of MiniMax H3 or any Model Derivative thereof to another model, such that the latter model exhibits behavior similar to MiniMax H3 or its Model Derivatives, including by distillation methods, methods using intermediate data representations, or methods based on training using synthetic-data Outputs generated by MiniMax H3 or its Model Derivatives. For the avoidance of doubt, Outputs are not deemed Model Derivatives.
17
+ 12. “Output” means any result of operating or otherwise using MiniMax H3 or any Model Derivatives (including through Hosted Services).
18
+ 13. “Third Party” means any natural or legal person that is not under common control with us or with you.
19
+ 14. “Including” means “including but not limited to.”
20
+ 15. “We,” “Us” or “MiniMax” means Nanonoble Pte. Ltd..
21
+ II. Grant of Rights
22
+ Solely within the Applicable Territory, we grant you a non-exclusive, non-transferable, royalty-free, limited license to use, reproduce, distribute, create derivative works (including Model Derivatives), and modify the Materials in accordance with the terms of this Agreement and the Acceptable Use Policy, based on the intellectual property and other rights owned by MiniMax that are embodied in or used by the Materials. You shall not violate (or encourage or permit any person to violate) any term of this Agreement or the Acceptable Use Policy.
23
+ We will continuously evaluate the applicable laws, regulations and compliance requirements for the Excluded Territories. In the meantime, should any person in such Excluded Territories be interested in deploying our models, you are welcome to contact us about obtaining a license, which will be granted based on robust controls and guardrails for purposes of complying with the laws, regulations and compliance requirements of the Excluded Territories.
24
+ III. Distribution and Redistribution
25
+ Subject to and conditioned on your continuing compliance with this Agreement, including its territorial restrictions and the Acceptable Use Policy, and solely within the Applicable Territory, you may distribute or make available the MiniMax H3 Works to Third Parties within the Applicable Territory; provided, that all of the following conditions are met:
26
+ 1. You must provide a copy of this Agreement to all such Third Parties who receive the MiniMax H3 Works or use your products or services related thereto;
27
+ 2. You must cause any modified files to carry prominent notices stating that you have modified such files;
28
+ 3. You are encouraged to:
29
+ a. display a notice on any product or service developed using MiniMax H3 indicating that the product or service is “Powered by MiniMax H3”;
30
+ b. add an AI-generation identifier to files produced using generative AI models including MiniMax H3; and
31
+ c. publish at least one technical blog post or a public statement describing your experience using MiniMax H3 Works;
32
+ 4. All distributions to Third Parties (other than through Hosted Services) must be accompanied by a “NOTICE” text file containing the following notice:
33
+ “MiniMax H3 is licensed under the MiniMax H3 Community License Agreement, Copyright © 2026 MiniMax. All Rights Reserved.”
34
+ You may add your own copyright notices on your modifications; except as provided in this Section and in Section V, however, you may not impose additional or different terms and conditions on the use, reproduction, or distribution of your modifications or of any aggregate Model Derivatives, and your use, reproduction, modification, distribution, running, and display of the work must otherwise comply with the terms and conditions of this Agreement (including the provisions concerning the Applicable Territory). If you receive the MiniMax H3 Works from a Licensee as part of an integrated end-user product, the provisions of Section III of this Agreement do not apply to you, but Section V and Exhibit A remain applicable.
35
+ IV. Additional Commercial Terms
36
+ 1. You shall obtain a separate, prior written authorization from MiniMax by contacting api@minimax.io with the subject line “MiniMax H3 licensing - authorization request”, if your commercial products and services generate more than 20 million US dollars (or equivalent in other currencies) in yearly revenue.
37
+ 2. You shall prominently display “MiniMax H3”on the user interface of commercial product or service that uses MiniMax H3 or MiniMax H3 Works.
38
+ V. Use Restrictions
39
+ 1. Your use of the MiniMax H3 Works must comply with applicable laws and regulations (including trade-compliance laws and regulations) and must comply with the Acceptable Use Policy for the MiniMax H3 Works, which is incorporated into this Agreement by reference.
40
+ 2. Before providing access to the MiniMax H3 Works or any product, service, or Hosted Service incorporating them, you must bind each recipient or user to enforceable terms at least as protective as the use restrictions in this Section V and Exhibit A, and you must notify each recipient or user that those restrictions apply.
41
+ 3. You may not use the MiniMax H3 Works or any of their Outputs or results to improve any other artificial intelligence model (other than MiniMax H3 or its Model Derivatives).
42
+ 4. You may not use, reproduce, modify, distribute, or display the MiniMax H3 Works or any of their Outputs or results outside the Applicable Territory. Any such use outside the Applicable Territory is not authorized by this Agreement.
43
+ 5. If you provide or make available to any Third Party a product, service, or Hosted Service that permits the generation of Outputs using MiniMax H3 or any Model Derivative, you must, before making that product or service available and throughout its operation, implement, maintain, test, and periodically review reasonable and proportionate technical and organizational safeguards designed to prevent and mitigate access, uses, and Outputs that violate this Section V or Exhibit A, including uses or Outputs that infringe, misappropriate, or otherwise violate any Third Party’s intellectual-property or other rights. You must not knowingly disable, materially weaken, or permit the circumvention of those safeguards. You must maintain a reasonably accessible mechanism for reporting suspected violations. Upon receiving a good-faith report or otherwise obtaining actual knowledge of a violation, you must promptly investigate and take reasonable steps within your control to stop or mitigate the violation, including removing or disabling access to offending content or services and suspending or terminating repeat violators where appropriate. You are responsible for implementing and enforcing these requirements with respect to your products, services, systems, users, and downstream recipients.
44
+ VI. Intellectual Property
45
+ 1. Subject to MiniMax’s rights in the MiniMax H3 Works (and the intellectual property therein), and to your compliance with the terms and conditions of this Agreement, as between you and MiniMax, you will own the derivative works and modifications of the Materials that you have created or had created, as well as any Model Derivatives.
46
+ 2. Except for the limited license expressly granted in this paragraph, no trademark license is granted under this Agreement; with respect to MiniMax H3 Works, the Licensee may not use any name or mark owned by or associated with MiniMax or any of its affiliates, except as reasonably and customarily necessary to describe and distribute the MiniMax H3 Works. MiniMax hereby grants you a license to use the “MiniMax H3” mark (the “Mark”) within the Applicable Territory solely for the purpose of complying with Section III.3; provided, that you comply with all applicable trademark-protection laws. All goodwill arising from your use of the Mark shall inure to the benefit of MiniMax.
47
+ 3. If you bring or assert any suit or other legal proceeding (including a cross-claim or counterclaim in any action) against us or any other natural or legal person alleging that the Materials, any Output, or any portion of the foregoing infringes any intellectual property right or other right owned by you or for which you can obtain a license, all licenses granted to you under this Agreement will terminate as of the date such suit or proceeding is filed. You shall defend, indemnify, and hold us harmless against any Third-Party claim arising out of or related to the use or distribution of the MiniMax H3 Works by you or by any Third Party.
48
+ 4. MiniMax claims no rights over the Outputs you generate. You and your users are entirely responsible for the Outputs and any subsequent use thereof.
49
+ VII. Disclaimers and Limitations of Liability
50
+ 1. We have no obligation to support, update, provide training for, or develop any further version of the MiniMax H3 Works, or to grant any license with respect thereto.
51
+ 2. UNLESS AND ONLY TO THE EXTENT REQUIRED BY APPLICABLE LAW, THE MINIMAX H3 WORKS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED “AS IS” WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES OF ANY KIND INCLUDING ANY WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, COURSE OF DEALING, USAGE OF TRADE, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING, REPRODUCING, MODIFYING, PERFORMING, DISPLAYING OR DISTRIBUTING ANY OF THE MINIMAX H3 WORKS OR OUTPUTS AND ASSUME ANY AND ALL RISKS ASSOCIATED WITH YOUR OR A THIRD PARTY’S USE OR DISTRIBUTION OF ANY OF THE MINIMAX H3 WORKS OR OUTPUTS AND YOUR EXERCISE OF RIGHTS AND PERMISSIONS UNDER THIS AGREEMENT.
52
+ 3. TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL MINIMAX OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, FOR ANY DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, EXEMPLARY, CONSEQUENTIAL OR PUNITIVE DAMAGES, OR LOST PROFITS OF ANY KIND ARISING FROM THIS AGREEMENT OR RELATED TO ANY OF THE MINIMAX H3 WORKS OR OUTPUTS, EVEN IF MINIMAX OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
53
+ VIII. Term and Termination
54
+ 1. This Agreement is effective from the moment you accept this Agreement or begin accessing the Materials, and, subject to your compliance with its terms and conditions, will remain in effect until terminated as provided herein.
55
+ 2. If you breach any term or condition of this Agreement, we have the right to terminate this Agreement. Upon termination, you must immediately cease accessing, using, and distributing the MiniMax H3 Works; delete or destroy all copies within your possession or control; and notify each downstream recipient that your authorization has ended. The obligations in the preceding sentence and Sections VI.1, VI.3, VII, and IX survive termination.
56
+ IX. Governing Law and Jurisdiction
57
+ 1. This Agreement, and any dispute arising out of or related to this Agreement, shall be governed by the laws of the Hong Kong Special Administrative Region of the People’s Republic of China, without regard to its conflict-of-laws rules. The United Nations Convention on Contracts for the International Sale of Goods does not apply to this Agreement.
58
+ 2. Any dispute arising out of or related to this Agreement shall be subject to the exclusive jurisdiction of the courts of the Hong Kong Special Administrative Region of the People’s Republic of China with competent jurisdiction. Both MiniMax and the Licensee hereby consent to the exclusive jurisdiction of such courts for any such dispute.
59
+ Additional Note: Please note that the encoder of MiniMax H3 uses Qwen3-VL-32B, which is licensed under Apache 2.0 License: https://github.com/QwenLM/Qwen3-VL/blob/main/LICENSE.
60
+
61
+ Exhibit A — Acceptable Use Policy
62
+ MiniMax reserves the right to update this Acceptable Use Policy from time to time.
63
+ Last revised: August 2, 2026.
64
+ MiniMax is committed to promoting the safe and fair use of its tools and features, including MiniMax H3. You agree not to use MiniMax H3, any Model Derivatives, or any Output in any of the following ways:
65
+ 1. Use outside the Applicable Territory;
66
+ 2. Use in any manner that violates any applicable national, federal, state, local, or international law, regulation, or other legal requirement, or that infringes, misappropriates, or otherwise violates any Third Party’s intellectual-property or other proprietary rights, including through unauthorized reproduction, distribution, public display, public performance, or creation of derivative works;
67
+ 3. Use in any manner that may harm yourself or others;
68
+ 4. Use to repurpose or distribute the Outputs of MiniMax H3 or any Model Derivatives in order to harm yourself or others;
69
+ 5. Use to circumvent or bypass any safety guardrails or safeguards we have implemented;
70
+ 6. Use in any manner that exploits or harms, or intends to exploit or harm, minors;
71
+ 7. Use to generate or disseminate verifiably false information and/or content for the purpose of harming others or influencing elections;
72
+ 8. Use to manufacture or facilitate false online engagement, including fake reviews and other means of false online engagement;
73
+ 9. Use to intentionally defame, disparage, or otherwise harass others;
74
+ 10. Use to generate and/or disseminate malware (including ransomware) or any other content intended to damage electronic systems;
75
+ 11. Use to generate or disseminate personally identifiable information for the purpose of harming others;
76
+ 12. Use to generate or disseminate information (including images, code, posts, or articles) in or to any public environment (including via bot tweets or similar means) without clearly and prominently disclosing that such information and/or content is machine-generated;
77
+ 13. Use to impersonate another person without that person’s consent, authorization, or lawful right to do so;
78
+ 14. Use to make high-risk automated decisions in critical domains that affect individual safety, rights, or well-being (such as law enforcement, immigration, healthcare or medical services, critical-infrastructure management, product-safety components, essential services, credit, employment, housing, education, social scoring, or insurance);
79
+ 15. Use in any manner that violates or disregards the social, ethical, or moral standards of other countries or regions;
80
+ 16. Use to carry out, assist, threaten, incite, plan, advocate for, or encourage violent extremism or terrorism;
81
+ 17. Use for any purpose intended to discriminate against, or harm, individuals or groups based on protected characteristics or categories, online or offline social behavior, or known or predicted personality traits;
82
+ 18. Use to intentionally exploit the vulnerabilities of specific populations based on age, social, physical, or psychological characteristics, so as to materially distort the behavior of a member of that group in a manner that causes, or is likely to cause, physical or psychological harm to that person or to others;
83
+ 19. Use for military purposes;
84
+ 20. Use to engage in any unauthorized or unlicensed professional activity, including but not limited to financial, legal, medical or healthcare, or other professional practice.
NOTICE ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ MiniMax-H3-Image is licensed under the MiniMax-H3-Image Community License Agreement, Copyright © 2026 MiniMax. All Rights Reserved.
2
+ MiniMax H3 is licensed under the MiniMax H3 Community License Agreement, Copyright © 2026 MiniMax. All Rights Reserved.
3
+
4
+ Modified files (WaveCut, 2026):
5
+ - transformer/: the MiniMax-H3-Image transformer converted to the Diffusers layout, with 4-bit OrbitQuant weights for the block and token-refiner projections; the AdaLN projections and the timestep MLP are replaced by their precomputed outputs (modulation.json lists the timesteps).
6
+ - text_encoder/: decoder layers 0-49 of the MiniMax-H3 Qwen3-VL text encoder with 4-bit OrbitQuant weights; layers 50-63 and the language-model head are removed. The vision tower is unchanged.
7
+ - vae/, scheduler/, modular_model_index.json: converted to the Diffusers layout (scripts/convert_minimax_h3_to_diffusers.py of Diffusers 79139736).
8
+ LICENSE is the MiniMax-H3-Image Community License Agreement; LICENSE-MiniMax-H3 is the MiniMax H3 Community License Agreement, which covers the text encoder.
README.md ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: minimax-h3-image-community-license-agreement
4
+ license_link: LICENSE
5
+ base_model: MiniMaxAI/MiniMax-H3-Image
6
+ base_model_relation: quantized
7
+ library_name: diffusers
8
+ pipeline_tag: text-to-image
9
+ language:
10
+ - en
11
+ tags:
12
+ - orbitquant
13
+ - w4a8
14
+ - 4-bit
15
+ - gptq
16
+ - quantized
17
+ - minimax-h3
18
+ - text-to-image
19
+ - image-editing
20
+ ---
21
+
22
+ # MiniMax-H3-Image — OrbitQuant W4A8
23
+
24
+ [OrbitQuant](https://github.com/iamwavecut/OrbitQuant) 4-bit weights for [MiniMax-H3-Image](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image), MiniMax's 33.1B text-to-image and image-editing model that makes images of up to 16 megapixels in 6 steps.
25
+ The diffusion transformer and the MiniMax-H3 Qwen3-VL text encoder both run 8-bit activations over 4-bit weights. The 4-bit codes were chosen with GPTQ rounding against calibration prompts that are not in the evaluation set.
26
+ The runtime is the official MiniMax-H3-Image modular pipeline of [Diffusers](https://github.com/huggingface/diffusers/pull/15230) with fused OrbitQuant kernels, and the [ComfyUI-OrbitQuant](https://github.com/iamwavecut/ComfyUI-OrbitQuant) nodes.
27
+ The download is 27.5 GB. The original needs 135.4 GB: the 66.3 GB transformer and the 66.7 GB text encoder of MiniMax-H3, which it downloads separately.
28
+
29
+ **On one RTX PRO 6000 a 4096×4096 image takes 13.5 s with a 29.8 GiB device peak, and a 2048×2048 image takes 2.4 s. The BF16 original needs 22.4 s and 4.4 s for the same work even when each of its models is resident alone. With model offload the release also runs in 23.4 GiB of free device memory (a simulated 24 GB card).**
30
+
31
+ ![Generation time, device memory peak and checkpoint size: BF16 original and OrbitQuant W4A8 on an RTX PRO 6000](assets/latency_and_memory.png)
32
+
33
+ Left: the BF16 original. Right: this release. Same prompt, seed and size; the panels are downscaled to 1024 pixels wide. LPIPS against the BF16 image is in parentheses (lower is closer, see [Quality](#quality)).
34
+
35
+ Portrait photograph, 2048×2048 (0.089):
36
+ ![Portrait photograph: BF16 original and OrbitQuant W4A8](assets/e01.jpg)
37
+
38
+ Art Deco travel poster, 1792×2368 (0.163):
39
+ ![Art Deco travel poster: BF16 original and OrbitQuant W4A8](assets/e03.jpg)
40
+
41
+ Chalkboard menu, 2048×2048 (0.238):
42
+ ![Chalkboard menu: BF16 original and OrbitQuant W4A8](assets/e06.jpg)
43
+
44
+ Moscow street with a Cyrillic shop sign, 2368×1792 (0.175):
45
+ ![Moscow street: BF16 original and OrbitQuant W4A8](assets/e08.jpg)
46
+
47
+ Fashion editorial, 1792×2368 (0.114):
48
+ ![Fashion editorial: BF16 original and OrbitQuant W4A8](assets/e10.jpg)
49
+
50
+ Infographic poster, 2368×1792 (0.129):
51
+ ![Infographic poster: BF16 original and OrbitQuant W4A8](assets/e13.jpg)
52
+
53
+ Four-panel comic page, 2048×2048 (0.230):
54
+ ![Comic page: BF16 original and OrbitQuant W4A8](assets/e16.jpg)
55
+
56
+ Editing with the example of the original card. Left to right: the reference, BF16, this release, 2048×2048 (0.015):
57
+ ![Edit: reference image, BF16 original and OrbitQuant W4A8](assets/x01.jpg)
58
+
59
+ 16 MP: the frog prompt at 4096×4096 (0.234) and the text-to-image example of the original card at 4736×3552 (0.221):
60
+ ![Frog at 4096x4096: BF16 original and OrbitQuant W4A8](assets/s01.jpg)
61
+ ![Original card example at 4736x3552: BF16 original and OrbitQuant W4A8](assets/s02.jpg)
62
+
63
+ A 1024×1024 crop of the 4096×4096 frog at full resolution:
64
+ ![Full-resolution crop of the 4096x4096 frog: BF16 original and OrbitQuant W4A8](assets/s01-crop.jpg)
65
+
66
+ ## Usage
67
+
68
+ Use Linux, Python 3.12 and an NVIDIA GPU. The tested stack is Torch 2.12.1 with CUDA 13.0 on an RTX PRO 6000 Blackwell.
69
+
70
+ ```bash
71
+ python3.12 -m venv .venv && . .venv/bin/activate
72
+ pip install torch==2.12.1 torchvision==0.27.1 --index-url https://download.pytorch.org/whl/cu130
73
+ pip install huggingface_hub
74
+ hf download WaveCut/MiniMax-H3-Image-OrbitQuant-W4A8 --local-dir minimax-h3-image-orbitquant
75
+ cd minimax-h3-image-orbitquant
76
+ pip install -r requirements.txt
77
+ ```
78
+
79
+ `requirements.txt` installs `orbitquant` 0.18.0 and Diffusers at the commit of the MiniMax-H3-Image pull request. The repository holds every component; nothing else is downloaded.
80
+
81
+ Text to image:
82
+
83
+ ```bash
84
+ python run_minimax_h3_image.py --prompt-file prompt.txt --size 4096x4096 --out image.png
85
+ ```
86
+
87
+ Image editing (the references are `<Picture 1>`, `<Picture 2>`, ... in the prompt, in the order of `--image`):
88
+
89
+ ```bash
90
+ python run_minimax_h3_image.py --prompt-file edit.txt --image reference1.png --size 4096x4096 --out edit.png
91
+ ```
92
+
93
+ Python, inside `minimax-h3-image-orbitquant`:
94
+
95
+ ```python
96
+ import torch
97
+ from minimax_h3_image_orbitquant import load_pipeline
98
+
99
+ pipe = load_pipeline(".") # offload=True keeps the models in host memory; attention="int8" for INT8 attention
100
+ image = pipe(prompt=open("prompt.txt").read(), height=4096, width=4096,
101
+ generator=torch.Generator().manual_seed(42), output="images")[0]
102
+ image.save("image.png")
103
+ ```
104
+
105
+ `load_pipeline` returns the official `ModularPipeline` with the W4A8 transformer and text encoder. Pass `image=` (one PIL image or a list) for editing. Options of `run_minimax_h3_image.py`:
106
+
107
+ - `--profile offload`: keep the models in host memory; each moves to the GPU for its own stage.
108
+ - `--profile int8-attention`: INT8 Q·K attention. At 4096×4096 it is 4 % faster (13.0 s against 13.5 s); the mean LPIPS against BF16 rises from 0.182 to 0.195 (see [Quality](#quality)).
109
+ - `--size WIDTHxHEIGHT` (multiples of 32), `--seed`, `--image` (repeat for more references, up to 16).
110
+
111
+ The model is distilled to 6 steps without classifier-free guidance; the release supports only that schedule (the transformer stores the modulation of its six timesteps, see [Components](#components)). Sizes follow the original: about 4 to 20 MP, best at about 16 MP (4096×4096, 4736×3552, 5024×3360, 5472×3072, 6272×2688 and their portrait versions).
112
+ The model expects a detailed English description of the whole image. Short prompts give plain images. The original card describes how to write one with the MiniMax API or the local [MiniMax-H3-Image-PE](https://huggingface.co/MiniMaxAI/MiniMax-H3-Image-PE) prompt expander.
113
+
114
+ ### ComfyUI
115
+
116
+ [ComfyUI-OrbitQuant](https://github.com/iamwavecut/ComfyUI-OrbitQuant) 0.11.0 or later lists this release as `WaveCut/MiniMax-H3-Image-OrbitQuant-W4A8`.
117
+ Connect **OrbitQuant Model Loader** to **OrbitQuant Generate Image** and save the result with the standard **Save Image** node. Connect up to 16 images to `reference_images` for editing.
118
+ The generator runs in the Python environment that `python_executable` selects. Install the packages of the Usage section there.
119
+
120
+ Checked through ComfyUI v0.44.0's queue on the RTX PRO 6000 (frog prompt, 6 steps). Device memory is the NVML total and includes the 1.2 GiB of the idle ComfyUI server; times include loading when a request starts the worker or changes the profile.
121
+
122
+ | Request | Profile, worker | Device memory peak | Time |
123
+ | --- | --- | ---: | ---: |
124
+ | Text to image, 2048×2048, first request | default, kept | 29.8 GiB | 16.2 s |
125
+ | Text to image, 2048×2048, next request | default, kept | 29.8 GiB | 5.1 s |
126
+ | Edit with one reference, 2048×2048 | default, kept | 34.6 GiB | 9.1 s |
127
+ | Text to image, 4096×4096 | default, kept | not separated | 24.2 s |
128
+ | Text to image, 2048×2048, profile change | int8-attention, kept | not separated | 11.1 s |
129
+ | Text to image, 2048×2048 | model-offload, new worker | not separated | 35.6 s |
130
+
131
+ ComfyUI times include the PNG encoding in the worker and in **Save Image**. The first text-to-image image, the edit and the `model-offload` image were pixel-identical to the output of `run_minimax_h3_image.py` for the same prompt, image and seed.
132
+
133
+ ## Quality
134
+
135
+ The evaluation set has 16 text-to-image prompts (photographs, posters and signs with Latin and Cyrillic text, an ink painting, pixel art, a 3D render, a comic page; 1792×2368 to 2752×1536) and 2 edits. None of them is a calibration prompt. Each case ran with the same prompt, seed and size through the BF16 original and through each quantized variant. LPIPS (AlexNet, both images resized to 1024 pixels wide) and PSNR (full resolution) compare each image with the BF16 image.
136
+
137
+ | Variant | Mean LPIPS ↓ | Mean PSNR, dB ↑ |
138
+ | --- | ---: | ---: |
139
+ | Round to nearest (the first proof of concept) | 0.302 | 16.93 |
140
+ | **GPTQ, this release** | **0.182** | **20.07** |
141
+ | GPTQ, INT8 attention | 0.195 | 19.72 |
142
+
143
+ GPTQ rounding lowered LPIPS on 17 of the 18 cases.
144
+ LPIPS against BF16 measures the distance from the original image, not the quality of the image. With six steps and no guidance, a small change early in sampling can move the composition. The largest value, 0.604, is e12 (pixel-art bedroom): the W4A8 image mirrors the layout of the room, and keeps its objects and the pixel-art style.
145
+
146
+ ![Pixel-art bedroom, the largest LPIPS of the set: BF16 original and OrbitQuant W4A8](assets/e12.jpg)
147
+
148
+ - Text: the Cyrillic shop sign of e08 («КНИЖНЫЙ МАГАЗИН») and the large headings of e13 render correctly in both images. The small captions under the icons of e13 are illegible in both the BF16 and the W4A8 image.
149
+ - Edits change least: LPIPS 0.015 and 0.025.
150
+ - 16 MP (4096×4096 and 4736×3552): LPIPS 0.234 and 0.221; with INT8 attention 0.208 and 0.266.
151
+ - INT8 attention moved e03 (the Art Deco poster) from 0.163 to 0.395; the other cases change by at most 0.03.
152
+
153
+ <details>
154
+ <summary>LPIPS / PSNR (dB) of every case against the BF16 original</summary>
155
+
156
+ | Case | Subject | Size | Round to nearest | GPTQ | GPTQ, INT8 attention |
157
+ | --- | --- | --- | ---: | ---: | ---: |
158
+ | e01 | Portrait photograph | 2048×2048 | 0.246 / 18.3 | 0.089 / 24.0 | 0.077 / 24.9 |
159
+ | e02 | Bookstore interior | 2368×1792 | 0.425 / 13.5 | 0.157 / 18.9 | 0.168 / 18.5 |
160
+ | e03 | Art Deco travel poster | 1792×2368 | 0.484 / 10.6 | 0.163 / 16.7 | 0.395 / 12.1 |
161
+ | e04 | Macro photograph of a frog | 2048×2048 | 0.323 / 14.9 | 0.203 / 17.3 | 0.217 / 17.0 |
162
+ | e05 | Astronaut on Mars | 2752×1536 | 0.164 / 22.3 | 0.114 / 24.2 | 0.096 / 25.0 |
163
+ | e06 | Chalkboard menu with lettering | 2048×2048 | 0.455 / 13.2 | 0.238 / 16.1 | 0.234 / 15.9 |
164
+ | e07 | Chinese ink painting | 1792×2368 | 0.362 / 15.3 | 0.186 / 19.4 | 0.186 / 19.3 |
165
+ | e08 | Moscow street, Cyrillic shop sign | 2368×1792 | 0.306 / 14.8 | 0.175 / 17.9 | 0.200 / 17.6 |
166
+ | e09 | Isometric 3D island | 2048×2048 | 0.268 / 17.6 | 0.228 / 18.8 | 0.228 / 18.4 |
167
+ | e10 | Fashion editorial | 1792×2368 | 0.505 / 11.8 | 0.114 / 22.7 | 0.121 / 21.6 |
168
+ | e11 | Highland cattle in mist | 2752×1536 | 0.149 / 20.4 | 0.124 / 21.0 | 0.122 / 21.1 |
169
+ | e12 | Pixel-art bedroom | 2048×2048 | 0.446 / 14.0 | 0.604 / 12.1 | 0.610 / 12.1 |
170
+ | e13 | Infographic poster with captions | 2368×1792 | 0.219 / 15.0 | 0.129 / 16.6 | 0.128 / 16.9 |
171
+ | e14 | Old woman knitting | 1792×2368 | 0.402 / 16.7 | 0.331 / 18.5 | 0.305 / 18.8 |
172
+ | e15 | Thunderstorm over a field | 2752×1536 | 0.241 / 20.2 | 0.159 / 21.8 | 0.167 / 21.6 |
173
+ | e16 | Four-panel comic page | 2048×2048 | 0.357 / 12.8 | 0.230 / 14.8 | 0.224 / 15.0 |
174
+ | x01 | Edit: the example of the original card | 2048×2048 | 0.037 / 29.8 | 0.015 / 32.8 | 0.018 / 31.3 |
175
+ | x02 | Edit of the bookstore image (e02) | 2368×1792 | 0.048 / 23.6 | 0.025 / 27.6 | 0.024 / 27.7 |
176
+
177
+ </details>
178
+
179
+ ## Performance
180
+
181
+ Setup: one RTX PRO 6000 Blackwell Server Edition (96 GB), Torch 2.12.1, CUDA 13.0, the frog prompt (e04, 123 text tokens), 6 steps. Each configuration ran in its own process: a warm-up image, then the best of 2–3 images. The time runs from the pipeline call to the finished image tensor on the GPU: prompt encoding, six transformer steps and VAE decoding. The conversion to a PIL image is excluded: on the rented machine, memory pressure from other tenants made host-side work on 16 MP arrays slow and irregular.
182
+
183
+ | Configuration | 2048×2048 | 4096×4096 | Device peak, 4096×4096 |
184
+ | --- | ---: | ---: | ---: |
185
+ | BF16 original, Diffusers model offload | 124.6 s | 136.5 s | 68.0 GiB |
186
+ | BF16 original, sum of the components resident alone | 4.38 s | 22.35 s | 66.4 GiB |
187
+ | **OrbitQuant W4A8** | **2.40 s** | **13.53 s** | **29.8 GiB** |
188
+ | OrbitQuant W4A8, INT8 attention | 2.43 s | 13.01 s | 29.8 GiB |
189
+ | OrbitQuant W4A8, simulated 32 GB card | 2.42 s | 13.64 s | 29.6 GiB |
190
+ | OrbitQuant W4A8, model offload, simulated 24 GB card | 13.95 s | 25.31 s | 17.2 GiB |
191
+
192
+ - The BF16 original does not fit the 96 GB card resident: its transformer and its text encoder hold 62 GiB each. "Model offload" is the `enable_auto_cpu_offload` of the Diffusers components manager. It copies each model to the GPU for its stage; on this machine the copies were slow, so the offload times are upper bounds.
193
+ - "Sum of the components" adds the times of the BF16 text encoder, six BF16 transformer steps and the original VAE decoding, each resident alone, without any copies. It is a lower bound for the original pipeline on this card. Its memory is the transformer's peak.
194
+ - The device peak is the NVML peak of the process and includes the CUDA context. The smaller cards are simulated on the RTX PRO 6000: the benchmark occupies device memory until 31.3 GiB (32 GB card) or 23.4 GiB (24 GB card) stay free. Their peaks exclude the occupied memory.
195
+ - Loading takes about 8 s from the page cache, 18–21 s with offload.
196
+
197
+ Components, each resident alone:
198
+
199
+ | Component | BF16 original | This release | Speed-up |
200
+ | --- | ---: | ---: | ---: |
201
+ | Transformer, 6 steps, 2048×2048 (4,219 tokens) | 3.59 s, 63.9 GiB | 2.16 s, 19.8 GiB | 1.66× |
202
+ | Transformer, 6 steps, 4096×4096 (16,507 tokens) | 19.62 s, 66.4 GiB | 12.99 s, 19.8 GiB | 1.51× |
203
+ | Transformer with INT8 attention, 2048×2048 / 4096×4096 | | 2.18 s / 12.36 s | 1.64× / 1.59× |
204
+ | Text encoder, 123 tokens | 0.065 s (64 layers) | 0.055 s (50 layers) | 1.17× |
205
+ | VAE decoding, 2048×2048 / 4096×4096 | 0.73 s / 2.66 s | 0.16 s / 0.58 s | 4.7× / 4.6× |
206
+ | VAE encoding of a reference, 2048×2048 / 4096×4096 | 1.15 s / 4.20 s | 0.41 s / 1.49 s | 2.8× / 2.8× |
207
+
208
+ The VAE weights are unchanged; the speed-up comes from the batched tiles of the loader (see [Components](#components)). The batched convolutions use other cuDNN algorithms, so the decoded pixels differ from the per-tile loop by at most 5–7 levels of 255 (about 11 % of the pixels change).
209
+
210
+ Editing (x01, one reference image):
211
+
212
+ | Configuration | Time | Device peak |
213
+ | --- | ---: | ---: |
214
+ | BF16 original, Diffusers model offload, 2048×2048 | 134.7 s | 66.6 GiB |
215
+ | OrbitQuant W4A8, 2048×2048 | 4.54 s | 33.2 GiB (29.9 GiB allocated) |
216
+ | OrbitQuant W4A8, 4096×4096, simulated 32 GB card | 17.23 s | 31.9 GiB |
217
+
218
+ On the 96 GB card the PyTorch allocator keeps freed blocks cached, so the NVML peak is above the allocated peak. On the simulated 32 GB card the allocator reuses them, and the 4096×4096 edit runs resident.
219
+
220
+ ## Components
221
+
222
+ | Component | Original | This release | Size |
223
+ | --- | --- | --- | ---: |
224
+ | Transformer | 33.1B parameters, BF16 | The 312 attention and feed-forward projections of the 50 blocks and the 2 token-refiner blocks: 4-bit OrbitQuant weights (RPBH rotation, Lloyd-Max codes, GPTQ rounding), INT8 activations. The per-block AdaLN projections, the timestep MLP and the output-norm projection (13.0B parameters) are replaced by their outputs for the 6 sampling timesteps and the reference-image noise level. Embedders, norms and the output heads stay BF16 or FP32. | 10.2 GB (66.3 GB) |
225
+ | Text encoder | MiniMax-H3 Qwen3-VL, 64 decoder layers, BF16 | The pipeline reads the hidden state after layer 49, so layers 50–63 and the language-model head are removed. Layers 0–49: 4-bit OrbitQuant weights with GPTQ rounding, INT8 activations. Token embeddings and the vision tower stay BF16. | 14.9 GB (66.7 GB) |
226
+ | VAE | BF16 | Unchanged weights. The loader runs its 256-pixel tiles in batches of 32 instead of one at a time, and the image encoder's causal 3D convolutions as 2D convolutions (one frame: the other kernel slices multiply zero padding). | 2.3 GB |
227
+ | Tokenizer, processor, scheduler | | Unchanged. | |
228
+
229
+ GPTQ used 90 transformer calls (12 text-to-image and 3 editing prompts at the six timesteps) and 72,619 text-encoder tokens (the calibration prompts and image captions). None of the calibration prompts is in the evaluation set.
230
+ The rounding lowered the mean relative output error of a projection group from 0.0059 (round to nearest) to 0.00081 in the transformer and from 0.0044 to 0.00095 in the text encoder (`quantization-report.json` in each folder). The text encoder's hidden state 50, which the transformer reads, differs from the BF16 original by 1.2–2.0 % (relative L2) on 8 evaluation prompts, against 4.3–4.8 % with round to nearest.
231
+
232
+ ## Files
233
+
234
+ - `transformer/`: the packed transformer (`model.safetensors`), its OrbitQuant configuration and manifest, `modulation.json` (the tabulated timesteps), the original `config.json` and `quantization-report.json` (the error of each projection group before and after GPTQ rounding).
235
+ - `text_encoder/`: the quantized MiniMax-H3 text encoder (decoder layers 0–49, the vision tower) and its `quantization-report.json`.
236
+ - `vae/`, `tokenizer/`, `processor/`, `scheduler/`, `modular_model_index.json`: the original components in the Diffusers layout.
237
+ - `minimax_h3_image_orbitquant.py`: the loader. `run_minimax_h3_image.py`: the command-line entry point. `requirements.txt`: the runtime pins.
238
+ - `manifest.json`: the components, the source revisions and the runtime pins. `SHA256SUMS`: the checksums of all files.
239
+ - `LICENSE`, `LICENSE-MiniMax-H3`, `NOTICE`: the license agreements and the notice of the modified files.
240
+ - `assets/`: the chart and images of this card.
241
+
242
+ ## Limits and license
243
+
244
+ - The release supports the six-step schedule only; another timestep raises an error.
245
+ - The fused blocks run one sample at a time.
246
+ - Tested on an RTX PRO 6000 Blackwell (96 GB) with Torch 2.12.1 and CUDA 13.0. 32 GB and 24 GB cards were simulated on the RTX PRO 6000 by occupying device memory until 31.3 GiB or 23.4 GiB stayed free: text to image and a one-reference edit at 4096×4096 ran resident in 31.3 GiB, and text to image at 4096×4096 ran with `--profile offload` in 23.4 GiB. Offloaded edits, edits with more reference images and real 32 GB or 24 GB cards were not tested. Other GPUs were not tested.
247
+
248
+ This release is a quantized version of MiniMax-H3-Image and of the MiniMax-H3 text encoder by MiniMax. MiniMax did not create, endorse or validate this release.
249
+ MiniMax-H3-Image is licensed under the MiniMax-H3-Image Community License Agreement, Copyright © 2026 MiniMax. All Rights Reserved.
250
+ MiniMax H3 is licensed under the MiniMax H3 Community License Agreement, Copyright © 2026 MiniMax. All Rights Reserved.
251
+ The agreements (`LICENSE`, `LICENSE-MiniMax-H3`) apply to this release unchanged. They cover use only outside the European Union, the United Kingdom, the Republic of Korea and the United States of America. A licensee with more than USD 1 million of annualized revenue, or one that offers a hosted service to third parties, needs a separate written authorization from MiniMax ([platform.minimax.io/license](https://platform.minimax.io/license)), and a commercial product must display "MiniMax-H3-Image" in its user interface. `NOTICE` lists the modified files.
SHA256SUMS ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ edfab8ece9d0ccd39106c4fe44105ce599b27ca7dd22601b736a8e9219cb4d26 LICENSE
2
+ 59b99642b95ea21630e311198ddbfffbfe05aadba0c2f5d884cbdf4efcc90f44 LICENSE-MiniMax-H3
3
+ 1e465a4dbc343d524371e1210a3631f1d2a34aeaa5e85022b88f1e0b232be7ed NOTICE
4
+ d3719b5ce15f0593a1a571e0b73f8ee940ea63fd077e9ca3809ac09b3e3293c7 README.md
5
+ c0951934d193eeb212cc962133b828fd7d435b15dc53199c77c6231ed3795610 assets/e01.jpg
6
+ 5968066c6f85cd3490f56ff9f58b2eb9a057af13b04ac1e7a1e705f579f87fa6 assets/e03.jpg
7
+ 0a09c1573b126004faad2608dab7f60ffdfe1f344f1f83194a86aaafbf688edd assets/e06.jpg
8
+ 24f45959f53d66220b7b1a95e5417384424be4e380844f7d499a844a2c410208 assets/e08.jpg
9
+ 590833b64f0be9dd5204467ffa7deb25c5e7bdcd53650c007d636139fa7a4baf assets/e10.jpg
10
+ 59c78dd40cd42d2551a4062306af53fd938e69c860472937fb0d0802ec885ba0 assets/e12.jpg
11
+ 2be488367911cd77ebe80943214ce61066270abb732e0905f78a7c831e8d63fc assets/e13.jpg
12
+ 6feefe80606b5755ffabb3f2df756c6800a2afb0b6bf3c38df4fc0f421bf36bf assets/e16.jpg
13
+ c9ff1719a7dc108f8a1297e04076c8e791bf975762502db345e65df01a78027a assets/latency_and_memory.png
14
+ 01df62652f6d23d6fc2ad864e380949af70e521f8950e579e4c5c0c114720c1c assets/s01-crop.jpg
15
+ 168a56c303e217cdd5b48b9cb4759175d09db3d7ab98bad7a3d55ca8c3c0860b assets/s01.jpg
16
+ 59abe1cbcec4b0c2b138bf76e8027245acc84e54be5786c4a64e2e77e6a49b55 assets/s02.jpg
17
+ dc5ca64a93dfc467df6f455a25b4e9af1f22b2747b4823d03163011d7b8861e2 assets/x01.jpg
18
+ 93a7a81c8d0212e35c07cca700f3d1186e0663da51a7de68002ba4609d92b2d9 manifest.json
19
+ ecdd38c37b60a572c44e8109926a8067340f47168dcf00b24965c13fa917cad4 minimax_h3_image_orbitquant.py
20
+ 2136d61adc81d176827b0156f4085517a11cd7c7d888db5f3de801a5d50570fd modular_model_index.json
21
+ 5c72a170d2a4a1a3bc5adad2e689ae28138a9700e5b8c96c0266331e86c0acce processor/chat_template.json
22
+ 599bab54075088774b1733fde865d5bd747cbcc7a547c5bc12610e874e26f5e3 processor/merges.txt
23
+ 27225450ac9c6529872ee1924fcb0962ff5634834f817040f444118116f4e516 processor/preprocessor_config.json
24
+ a5d85b6dcc535e6b93115a9ef287e6132fdbf30270da6218194ba742261173c7 processor/tokenizer.json
25
+ a07e942ac874baa13758de8d1fbdb186683cc03416b5589e1b6671c6b3057c68 processor/tokenizer_config.json
26
+ 7768af27c1fafa9cc9011c1dc20067e03f8915e03b63504550e11d5066986d13 processor/video_preprocessor_config.json
27
+ ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910 processor/vocab.json
28
+ 045cab255e151d3260a9f83bb794c08b68b6aebb8187932a04971b069c1dcd07 requirements.txt
29
+ 5ce43a36dfb89bfc6612301238ec137053d5947213c53a609d9071919479552d run_minimax_h3_image.py
30
+ ce1792ea34cef021fec782abf9f45125f6bf0438f7c424e567ce28b246ad0a08 scheduler/scheduler_config.json
31
+ e51d6d4b00b887e748a26170be37c5abf97d71b98c063320a5ea40a507f426a7 text_encoder/config.json
32
+ e596e4c0f270fdea7687981ff55a24b555fe30c426ff9582faa9e652c0a2e9f1 text_encoder/model.safetensors
33
+ 8dffc8879cb71d2e87407d2c3709512196a733d07da23af42c945978fd0ca06b text_encoder/quantization-report.json
34
+ 599bab54075088774b1733fde865d5bd747cbcc7a547c5bc12610e874e26f5e3 tokenizer/merges.txt
35
+ a5d85b6dcc535e6b93115a9ef287e6132fdbf30270da6218194ba742261173c7 tokenizer/tokenizer.json
36
+ a07e942ac874baa13758de8d1fbdb186683cc03416b5589e1b6671c6b3057c68 tokenizer/tokenizer_config.json
37
+ ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910 tokenizer/vocab.json
38
+ f8a1f3f87e708d0d4268d7c1abd040a7af9f2b7c435827f14e0a2d6fc260bcf9 transformer/config.json
39
+ f6a8096d8b5b24665d09fd4ed657dbec03cf61d38ec855316483a50364209ddc transformer/model.safetensors
40
+ 9bba26c9730950f076bfdd27da0dd1d75d8091e968f2352a3f949ff2d5cb5188 transformer/modulation.json
41
+ 7303d8172a4fbc0944bbad312748017e84c6b6b598b08159369c0c3a0de45e27 transformer/orbitquant_codebooks.safetensors
42
+ 5d056aba25f4ba578fd93c25ce695751e4914e5549f430bccd255edba71b9a30 transformer/orbitquant_manifest.json
43
+ e2ebb56fbec1c08c9589c977e32cc2851fee0d3c1d7ecfa8c4d95d131bed981b transformer/orbitquant_rotations.safetensors
44
+ ddc715b24883381634ae867eb3ef2cd57a843d759a997f8c5a526ee833d1d2e7 transformer/quantization-report.json
45
+ 5d3ea3c085536ade7ddd679f40bf838cdbc820ee54be9839d68ba70b3c44eb26 transformer/quantization_config.json
46
+ 6d809326cc9a46763e810777d71d2fdddbd5df820d5644e8fe778ea97d9913a4 vae/config.json
47
+ 5bb2809698c3989033f719ece2243f277fefedef1dd9a1d05f3d4136b2f93b35 vae/diffusion_pytorch_model.safetensors
assets/e01.jpg ADDED

Git LFS Details

  • SHA256: c0951934d193eeb212cc962133b828fd7d435b15dc53199c77c6231ed3795610
  • Pointer size: 131 Bytes
  • Size of remote file: 484 kB
assets/e03.jpg ADDED

Git LFS Details

  • SHA256: 5968066c6f85cd3490f56ff9f58b2eb9a057af13b04ac1e7a1e705f579f87fa6
  • Pointer size: 131 Bytes
  • Size of remote file: 525 kB
assets/e06.jpg ADDED

Git LFS Details

  • SHA256: 0a09c1573b126004faad2608dab7f60ffdfe1f344f1f83194a86aaafbf688edd
  • Pointer size: 131 Bytes
  • Size of remote file: 530 kB
assets/e08.jpg ADDED

Git LFS Details

  • SHA256: 24f45959f53d66220b7b1a95e5417384424be4e380844f7d499a844a2c410208
  • Pointer size: 131 Bytes
  • Size of remote file: 573 kB
assets/e10.jpg ADDED

Git LFS Details

  • SHA256: 590833b64f0be9dd5204467ffa7deb25c5e7bdcd53650c007d636139fa7a4baf
  • Pointer size: 131 Bytes
  • Size of remote file: 488 kB
assets/e12.jpg ADDED

Git LFS Details

  • SHA256: 59c78dd40cd42d2551a4062306af53fd938e69c860472937fb0d0802ec885ba0
  • Pointer size: 131 Bytes
  • Size of remote file: 576 kB
assets/e13.jpg ADDED

Git LFS Details

  • SHA256: 2be488367911cd77ebe80943214ce61066270abb732e0905f78a7c831e8d63fc
  • Pointer size: 131 Bytes
  • Size of remote file: 289 kB
assets/e16.jpg ADDED

Git LFS Details

  • SHA256: 6feefe80606b5755ffabb3f2df756c6800a2afb0b6bf3c38df4fc0f421bf36bf
  • Pointer size: 131 Bytes
  • Size of remote file: 481 kB
assets/latency_and_memory.png ADDED

Git LFS Details

  • SHA256: c9ff1719a7dc108f8a1297e04076c8e791bf975762502db345e65df01a78027a
  • Pointer size: 131 Bytes
  • Size of remote file: 247 kB
assets/s01-crop.jpg ADDED

Git LFS Details

  • SHA256: 01df62652f6d23d6fc2ad864e380949af70e521f8950e579e4c5c0c114720c1c
  • Pointer size: 131 Bytes
  • Size of remote file: 605 kB
assets/s01.jpg ADDED

Git LFS Details

  • SHA256: 168a56c303e217cdd5b48b9cb4759175d09db3d7ab98bad7a3d55ca8c3c0860b
  • Pointer size: 131 Bytes
  • Size of remote file: 510 kB
assets/s02.jpg ADDED

Git LFS Details

  • SHA256: 59abe1cbcec4b0c2b138bf76e8027245acc84e54be5786c4a64e2e77e6a49b55
  • Pointer size: 131 Bytes
  • Size of remote file: 774 kB
assets/x01.jpg ADDED

Git LFS Details

  • SHA256: dc5ca64a93dfc467df6f455a25b4e9af1f22b2747b4823d03163011d7b8861e2
  • Pointer size: 131 Bytes
  • Size of remote file: 762 kB
manifest.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "minimax-h3-image-orbitquant",
3
+ "base_model": "MiniMaxAI/MiniMax-H3-Image",
4
+ "base_revision": "7b6142f879bf7a973c449e1dea5480289736cdbd",
5
+ "text_encoder_source": {
6
+ "repo": "MiniMaxAI/MiniMax-H3",
7
+ "subfolder": "text_encoder",
8
+ "revision": "0919fb684102ef115126612f3fbb84d1027e7317"
9
+ },
10
+ "orbitquant": "0.18.0",
11
+ "diffusers": "79139736248f3cd1afb3c11559ccab6066d3fe81",
12
+ "weights": "4-bit OrbitQuant (GPTQ rounding), 8-bit activations at run time",
13
+ "components": {
14
+ "transformer": "orbitquant-w4a8",
15
+ "text_encoder": "orbitquant-w4a8",
16
+ "vae": "original",
17
+ "tokenizer": "original",
18
+ "processor": "original",
19
+ "scheduler": "original"
20
+ }
21
+ }
minimax_h3_image_orbitquant.py ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Load the MiniMax-H3-Image OrbitQuant W4A8 bundle into the diffusers modular pipeline.
2
+
3
+ The bundle replaces two components of the original model: the transformer (``transformer/``) and the MiniMax-H3
4
+ Qwen3-VL text encoder (``text_encoder/``). Both run 8-bit activations over 4-bit weights with the fused OrbitQuant
5
+ kernels. The transformer's AdaLN modulation is stored as a table for the model's six sampling timesteps (and the
6
+ reference-image noise level) instead of the 13-billion-parameter projections that compute it. The image VAE,
7
+ tokenizer, processor and scheduler are the original ones.
8
+
9
+ import torch
10
+ from minimax_h3_image_orbitquant import load_pipeline
11
+
12
+ pipe = load_pipeline(".")
13
+ image = pipe(prompt="The image is ...", height=4096, width=4096,
14
+ generator=torch.Generator().manual_seed(42), output="images")[0]
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import dataclasses
20
+ import json
21
+ from pathlib import Path
22
+
23
+ import torch
24
+
25
+
26
+ def load_transformer(path, *, attention="cudnn", device="cuda"):
27
+ """The packed W4A8 transformer with tabulated AdaLN modulation and fused blocks."""
28
+ import orbitquant # noqa: F401 (registers the OrbitQuant layers)
29
+ from diffusers import MiniMaxH3ImageTransformer2DModel
30
+ from orbitquant.artifacts.manifest import OrbitQuantManifest
31
+ from orbitquant.config import OrbitQuantConfig
32
+ from orbitquant.fused import fuse
33
+ from orbitquant.fused.families import minimax_h3 as family
34
+ from orbitquant.layers import OrbitQuantLinear
35
+ from orbitquant.modeling import _parent_and_child, _set_child
36
+ from safetensors.torch import load_file
37
+
38
+ path = Path(path)
39
+ config = OrbitQuantConfig.from_dict(json.loads((path / "quantization_config.json").read_text()))
40
+ manifest = OrbitQuantManifest.from_dict(json.loads((path / "orbitquant_manifest.json").read_text()))
41
+ timesteps = json.loads((path / "modulation.json").read_text())["timesteps"]
42
+ with torch.device("meta"):
43
+ model = MiniMaxH3ImageTransformer2DModel.from_config(MiniMaxH3ImageTransformer2DModel.load_config(str(path)))
44
+ family.add_modulation_tables(model, len(timesteps), device="meta")
45
+ for name in manifest.quantized_modules:
46
+ bits = manifest.module_bits.get(name)
47
+ layer_config = dataclasses.replace(config, weight_bits=bits) if bits and bits != config.weight_bits else config
48
+ parent, child = _parent_and_child(model, name)
49
+ _set_child(parent, child, OrbitQuantLinear.empty_from_linear(model.get_submodule(name), config=layer_config,
50
+ module_name=name))
51
+ model.load_state_dict(load_file(str(path / "model.safetensors"), device=str(device)), strict=True, assign=True)
52
+ rope = model.rope
53
+ if rope.inv_freq.is_meta: # a non-persistent buffer, a function of the config
54
+ dim, theta = rope.rope_freq_dim, model.config.rope_theta
55
+ inv_freq = 1.0 / (theta ** (torch.arange(0, 2 * dim, 2, dtype=torch.float32) / (2 * dim)))
56
+ rope.register_buffer("inv_freq", inv_freq, persistent=False)
57
+ model = model.to(device).eval()
58
+ fuse(model, config=config, attention=attention)
59
+ return model
60
+
61
+
62
+ class TextEncoder(torch.nn.Module):
63
+ """The W4A8 Qwen3-VL conditioner in the shape the pipeline calls: ``.model(...)``, ``.config``, ``.dtype``.
64
+
65
+ The checkpoint keeps decoder layers 0-49. The pipeline reads ``hidden_states[50]``, the output of layer 49
66
+ before the final norm, so the norm is an identity and the config reports one layer more than the stack holds
67
+ (the pipeline checks that the encoder is deeper than 50 layers)."""
68
+
69
+ def __init__(self, model):
70
+ super().__init__()
71
+ self.model = model
72
+
73
+ @property
74
+ def dtype(self):
75
+ return torch.bfloat16
76
+
77
+ @property
78
+ def config(self):
79
+ return self.model.config
80
+
81
+ @property
82
+ def device(self):
83
+ return self.model.language_model.embed_tokens.weight.device
84
+
85
+ def get_memory_footprint(self, return_buffers=True):
86
+ # The components manager sizes each model with this before it decides what to offload.
87
+ return self.model.get_memory_footprint(return_buffers=return_buffers)
88
+
89
+
90
+ def load_text_encoder(path, *, device="cuda"):
91
+ import orbitquant # noqa: F401
92
+ from orbitquant.fused import fuse_linears
93
+ from transformers import Qwen3VLModel
94
+
95
+ model = Qwen3VLModel.from_pretrained(str(path), dtype=torch.bfloat16, device_map={"": device}).eval()
96
+ from orbitquant.config import OrbitQuantConfig
97
+
98
+ config = model.config.quantization_config # stored on the top-level model, not on language_model
99
+ config = OrbitQuantConfig.from_dict(config) if isinstance(config, dict) else config
100
+ fuse_linears(model.language_model, activation_bits=8, config=config)
101
+ model.language_model.norm = torch.nn.Identity()
102
+ model.config.use_cache = False
103
+ model.config.text_config.num_hidden_layers = len(model.language_model.layers) + 1
104
+ return TextEncoder(model)
105
+
106
+
107
+ def _single_frame_conv(self, hidden_states):
108
+ """A causal 3D convolution of one frame as a 2D convolution with the kernel's last temporal slice.
109
+
110
+ The causal padding puts ``kernel_t - 1`` zero frames before the only frame, so the other temporal slices of the
111
+ kernel multiply zeros; the 2D convolution skips them (a third of the encoder's work)."""
112
+ if hidden_states.shape[2] != 1 or self.temporal_padding != self.kernel_size[0] - 1:
113
+ return type(self).forward(self, hidden_states)
114
+ frame = hidden_states[:, :, 0]
115
+ if self.spatial_padding > 0:
116
+ pad = self.spatial_padding
117
+ frame = torch.nn.functional.pad(frame, (pad, pad, pad, pad), mode=self.spatial_padding_mode)
118
+ out = torch.nn.functional.conv2d(frame, self.weight[:, :, -1], self.bias, stride=self.stride[1:],
119
+ dilation=self.dilation[1:])
120
+ return out[:, :, None]
121
+
122
+
123
+ def speed_up_vae(vae, tiles_per_batch=32):
124
+ """Run the VAE's tiles in batches instead of one at a time, and its image encoder with 2D convolutions.
125
+
126
+ The MiniMax-H3-Image VAE encodes and decodes in 256-pixel tiles (441 tiles at 4096x4096). One tile is too small
127
+ to keep the GPU busy, so the per-tile loop is bound by kernel launches. The batched version uses the same tiles,
128
+ the same per-sample layers and the same blending; only the batch size of each layer call changes."""
129
+ import types
130
+
131
+ for module in vae.encoder.modules():
132
+ if type(module).__name__ == "MiniMaxH3ImageCausalConv3d":
133
+ module.forward = types.MethodType(_single_frame_conv, module)
134
+
135
+ def grid(height, width):
136
+ ys = vae._split_tiles(height, vae.tile_sample_min_height, vae.tile_sample_min_overlap_height)
137
+ xs = vae._split_tiles(width, vae.tile_sample_min_width, vae.tile_sample_min_overlap_width)
138
+ return ys, xs
139
+
140
+ def run(fn, tiles, columns):
141
+ batch = tiles[0].shape[0]
142
+ out = []
143
+ for start in range(0, len(tiles), tiles_per_batch):
144
+ out.extend(fn(torch.cat(tiles[start : start + tiles_per_batch])).split(batch))
145
+ return [out[i : i + columns] for i in range(0, len(out), columns)]
146
+
147
+ def _decode(self, z):
148
+ if not self.use_tiling:
149
+ return self.decoder(self.post_quant_conv(z))
150
+ ratio = self.spatial_compression_ratio
151
+ (y_indices, y_lengths, y_overlaps), (x_indices, x_lengths, x_overlaps) = grid(
152
+ z.shape[-2] * ratio, z.shape[-1] * ratio
153
+ )
154
+ tiles = [
155
+ z[..., i // ratio : i // ratio + h // ratio, j // ratio : j // ratio + w // ratio]
156
+ for i, h in zip(y_indices, y_lengths)
157
+ for j, w in zip(x_indices, x_lengths)
158
+ ]
159
+ rows = run(lambda t: self.decoder(self.post_quant_conv(t)), tiles, len(x_indices))
160
+ return self._stitch_tiles(rows, y_overlaps, x_overlaps)
161
+
162
+ def _encode(self, x):
163
+ if not self.use_tiling:
164
+ return self.quant_conv(self.encoder(x[:, :, None]))[:, :, -1]
165
+ (y_indices, y_lengths, y_overlaps), (x_indices, x_lengths, x_overlaps) = grid(x.shape[-2], x.shape[-1])
166
+ tiles = [
167
+ x[..., i : i + h, j : j + w] for i, h in zip(y_indices, y_lengths) for j, w in zip(x_indices, x_lengths)
168
+ ]
169
+ rows = run(lambda t: self.quant_conv(self.encoder(t[:, :, None]))[:, :, -1], tiles, len(x_indices))
170
+ ratio = self.spatial_compression_ratio
171
+ return self._stitch_tiles(rows, [o // ratio for o in y_overlaps], [o // ratio for o in x_overlaps])
172
+
173
+ vae._decode = types.MethodType(_decode, vae)
174
+ vae._encode = types.MethodType(_encode, vae)
175
+ return vae
176
+
177
+
178
+ def load_pipeline(root=".", *, offload=False, attention="cudnn", device="cuda"):
179
+ """The diffusers ``ModularPipeline`` of the bundle with the W4A8 transformer and text encoder.
180
+
181
+ ``offload``: keep every model in host memory and move each to the GPU for its own stage.
182
+ ``attention``: "cudnn" (default), "flash", "sdpa" or "int8" (INT8 Q·K attention: faster at 16 MP, changes the
183
+ image slightly).
184
+ """
185
+ from diffusers import AutoencoderKLMiniMaxH3Image, ComponentsManager, MiniMaxH3Scheduler, ModularPipeline
186
+ from orbitquant.fused import release
187
+ from transformers import Qwen2TokenizerFast, Qwen3VLProcessor
188
+
189
+ root = Path(root)
190
+ manifest = json.loads((root / "manifest.json").read_text())
191
+ if manifest.get("format") != "minimax-h3-image-orbitquant":
192
+ raise ValueError(f"{root} is not a MiniMax-H3-Image OrbitQuant release")
193
+
194
+ def to_host(model, runtime_holder):
195
+ # offload: each model goes to host memory before the next one loads, so the load peak is one model
196
+ if offload:
197
+ release(runtime_holder) # drop the fused runtime's GPU work buffers before the move
198
+ model.to("cpu")
199
+ torch.cuda.empty_cache()
200
+ return model
201
+
202
+ transformer = load_transformer(root / "transformer", attention=attention, device=device)
203
+ transformer = to_host(transformer, transformer)
204
+ text_encoder = load_text_encoder(root / "text_encoder", device=device)
205
+ text_encoder = to_host(text_encoder, text_encoder.model.language_model)
206
+ manager = ComponentsManager()
207
+ pipe = ModularPipeline.from_pretrained(str(root), components_manager=manager)
208
+ pipe.update_components(
209
+ transformer=transformer,
210
+ text_encoder=text_encoder,
211
+ vae=speed_up_vae(AutoencoderKLMiniMaxH3Image.from_pretrained(str(root / "vae"), torch_dtype=torch.bfloat16)),
212
+ tokenizer=Qwen2TokenizerFast.from_pretrained(str(root / "tokenizer")),
213
+ processor=Qwen3VLProcessor.from_pretrained(str(root / "processor")),
214
+ scheduler=MiniMaxH3Scheduler.from_pretrained(str(root / "scheduler")),
215
+ )
216
+ if offload:
217
+ manager.enable_auto_cpu_offload(device=torch.device(device))
218
+ else:
219
+ for component in pipe.components.values():
220
+ if isinstance(component, torch.nn.Module):
221
+ component.to(device)
222
+ torch.cuda.empty_cache()
223
+ pipe.__dict__["_orbitquant_manager"] = manager
224
+ return pipe
modular_model_index.json ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "MiniMaxH3ImageModularPipeline",
3
+ "_diffusers_version": "0.42.0.dev0",
4
+ "_blocks_class_name": "MiniMaxH3ImageBlocks",
5
+ "sample_sigmas": [
6
+ 1.0,
7
+ 0.9675236940383911,
8
+ 0.8875485062599182,
9
+ 0.75,
10
+ 0.5327739119529724,
11
+ 0.23200887441635132,
12
+ 0.0
13
+ ],
14
+ "text_encoder": [
15
+ "transformers",
16
+ "Qwen3VLForConditionalGeneration",
17
+ {
18
+ "type_hint": [
19
+ "transformers",
20
+ "Qwen3VLForConditionalGeneration"
21
+ ],
22
+ "pretrained_model_name_or_path": "WaveCut/MiniMax-H3-Image-OrbitQuant-W4A8",
23
+ "subfolder": "text_encoder",
24
+ "variant": null,
25
+ "revision": null
26
+ }
27
+ ],
28
+ "tokenizer": [
29
+ "transformers",
30
+ "Qwen2TokenizerFast",
31
+ {
32
+ "type_hint": [
33
+ "transformers",
34
+ "Qwen2TokenizerFast"
35
+ ],
36
+ "pretrained_model_name_or_path": "WaveCut/MiniMax-H3-Image-OrbitQuant-W4A8",
37
+ "subfolder": "tokenizer",
38
+ "variant": null,
39
+ "revision": null
40
+ }
41
+ ],
42
+ "processor": [
43
+ "transformers",
44
+ "Qwen3VLProcessor",
45
+ {
46
+ "type_hint": [
47
+ "transformers",
48
+ "Qwen3VLProcessor"
49
+ ],
50
+ "pretrained_model_name_or_path": "WaveCut/MiniMax-H3-Image-OrbitQuant-W4A8",
51
+ "subfolder": "processor",
52
+ "variant": null,
53
+ "revision": null
54
+ }
55
+ ],
56
+ "vae": [
57
+ "diffusers",
58
+ "AutoencoderKLMiniMaxH3Image",
59
+ {
60
+ "type_hint": [
61
+ "diffusers",
62
+ "AutoencoderKLMiniMaxH3Image"
63
+ ],
64
+ "pretrained_model_name_or_path": "WaveCut/MiniMax-H3-Image-OrbitQuant-W4A8",
65
+ "subfolder": "vae",
66
+ "variant": null,
67
+ "revision": null
68
+ }
69
+ ],
70
+ "transformer": [
71
+ "diffusers",
72
+ "MiniMaxH3ImageTransformer2DModel",
73
+ {
74
+ "type_hint": [
75
+ "diffusers",
76
+ "MiniMaxH3ImageTransformer2DModel"
77
+ ],
78
+ "pretrained_model_name_or_path": "WaveCut/MiniMax-H3-Image-OrbitQuant-W4A8",
79
+ "subfolder": "transformer",
80
+ "variant": null,
81
+ "revision": null
82
+ }
83
+ ],
84
+ "scheduler": [
85
+ "diffusers",
86
+ "MiniMaxH3Scheduler",
87
+ {
88
+ "type_hint": [
89
+ "diffusers",
90
+ "MiniMaxH3Scheduler"
91
+ ],
92
+ "pretrained_model_name_or_path": "WaveCut/MiniMax-H3-Image-OrbitQuant-W4A8",
93
+ "subfolder": "scheduler",
94
+ "variant": null,
95
+ "revision": null
96
+ }
97
+ ]
98
+ }
processor/chat_template.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- for message in messages %}\n {%- if message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content_item in message.content %}\n {%- if 'text' in content_item %}\n {{- content_item.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and message.content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n"
3
+ }
processor/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
processor/preprocessor_config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "size": {
3
+ "longest_edge": 16777216,
4
+ "shortest_edge": 65536
5
+ },
6
+ "patch_size": 16,
7
+ "temporal_patch_size": 2,
8
+ "merge_size": 2,
9
+ "image_mean": [
10
+ 0.5,
11
+ 0.5,
12
+ 0.5
13
+ ],
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "processor_class": "Qwen3VLProcessor",
20
+ "image_processor_type": "Qwen2VLImageProcessorFast"
21
+ }
processor/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
processor/tokenizer_config.json ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>",
228
+ "<d>",
229
+ "</d>",
230
+ "<|cutoff|>",
231
+ "<|lyrics_start|>",
232
+ "<|lyrics_end|>",
233
+ "<|caption_start|>",
234
+ "<|caption_end|>"
235
+ ],
236
+ "bos_token": null,
237
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- for message in messages %}\n {%- if message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content_item in message.content %}\n {%- if 'text' in content_item %}\n {{- content_item.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and message.content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
238
+ "clean_up_tokenization_spaces": false,
239
+ "eos_token": "<|im_end|>",
240
+ "errors": "replace",
241
+ "model_max_length": 262144,
242
+ "pad_token": "<|endoftext|>",
243
+ "split_special_tokens": false,
244
+ "tokenizer_class": "Qwen2Tokenizer",
245
+ "unk_token": null
246
+ }
processor/video_preprocessor_config.json ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "size": {
3
+ "longest_edge": 25165824,
4
+ "shortest_edge": 4096
5
+ },
6
+ "patch_size": 16,
7
+ "temporal_patch_size": 2,
8
+ "merge_size": 2,
9
+ "image_mean": [
10
+ 0.5,
11
+ 0.5,
12
+ 0.5
13
+ ],
14
+ "image_std": [
15
+ 0.5,
16
+ 0.5,
17
+ 0.5
18
+ ],
19
+ "processor_class": "Qwen3VLProcessor",
20
+ "video_processor_type": "Qwen3VLVideoProcessor"
21
+ }
processor/vocab.json ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ orbitquant[hf]==0.18.0
2
+ diffusers @ git+https://github.com/huggingface/diffusers@79139736248f3cd1afb3c11559ccab6066d3fe81
3
+ transformers==5.22.2
4
+ accelerate
5
+ safetensors
6
+ huggingface_hub
7
+ pillow
8
+ torchvision
9
+ numpy
run_minimax_h3_image.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Generate or edit one image with the MiniMax-H3-Image OrbitQuant W4A8 bundle.
2
+
3
+ python run_minimax_h3_image.py --prompt "The image is ..." --size 4096x4096 --out image.png
4
+ python run_minimax_h3_image.py --prompt-file prompt.txt --image reference.png --size 2048x2048 --out edit.png
5
+
6
+ The model expects a detailed English description of the whole image (see the model card). --profile offload keeps
7
+ the models in host memory and moves each one to the GPU for its own stage.
8
+ """
9
+ import argparse
10
+ import time
11
+ from pathlib import Path
12
+
13
+ import torch
14
+ from minimax_h3_image_orbitquant import load_pipeline
15
+
16
+ ap = argparse.ArgumentParser()
17
+ ap.add_argument("--prompt", default=None)
18
+ ap.add_argument("--prompt-file", default=None)
19
+ ap.add_argument("--image", action="append", default=[], help="reference image (repeat for <Picture 2>, ...)")
20
+ ap.add_argument("--size", default="2048x2048", help="WIDTHxHEIGHT of the returned image")
21
+ ap.add_argument("--seed", type=int, default=42)
22
+ ap.add_argument("--profile", default="default", choices=["default", "offload", "int8-attention"])
23
+ ap.add_argument("--out", default="image.png")
24
+ args = ap.parse_args()
25
+
26
+ prompt = args.prompt if args.prompt is not None else Path(args.prompt_file).read_text().strip()
27
+ width, height = (int(v) for v in args.size.lower().split("x"))
28
+ pipe = load_pipeline(Path(__file__).parent, offload=args.profile == "offload",
29
+ attention="int8" if args.profile == "int8-attention" else "cudnn")
30
+ kwargs = dict(prompt=prompt, height=height, width=width, generator=torch.Generator().manual_seed(args.seed),
31
+ output="images")
32
+ if args.image:
33
+ from PIL import Image
34
+
35
+ images = [Image.open(p).convert("RGB") for p in args.image]
36
+ kwargs["image"] = images if len(images) > 1 else images[0]
37
+ torch.cuda.synchronize()
38
+ start = time.perf_counter()
39
+ image = pipe(**kwargs)[0]
40
+ torch.cuda.synchronize()
41
+ image.save(args.out)
42
+ print(f"{args.out}: {width}x{height} in {time.perf_counter() - start:.1f} s, "
43
+ f"peak {torch.cuda.max_memory_allocated() / 2**30:.1f} GiB allocated")
scheduler/scheduler_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_class_name": "MiniMaxH3Scheduler",
3
+ "_diffusers_version": "0.42.0.dev0",
4
+ "shift_provided_sigmas": false,
5
+ "euler_update_form": "velocity"
6
+ }
tokenizer/merges.txt ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer/tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer/tokenizer_config.json ADDED
@@ -0,0 +1,246 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_prefix_space": false,
4
+ "added_tokens_decoder": {
5
+ "151643": {
6
+ "content": "<|endoftext|>",
7
+ "lstrip": false,
8
+ "normalized": false,
9
+ "rstrip": false,
10
+ "single_word": false,
11
+ "special": true
12
+ },
13
+ "151644": {
14
+ "content": "<|im_start|>",
15
+ "lstrip": false,
16
+ "normalized": false,
17
+ "rstrip": false,
18
+ "single_word": false,
19
+ "special": true
20
+ },
21
+ "151645": {
22
+ "content": "<|im_end|>",
23
+ "lstrip": false,
24
+ "normalized": false,
25
+ "rstrip": false,
26
+ "single_word": false,
27
+ "special": true
28
+ },
29
+ "151646": {
30
+ "content": "<|object_ref_start|>",
31
+ "lstrip": false,
32
+ "normalized": false,
33
+ "rstrip": false,
34
+ "single_word": false,
35
+ "special": true
36
+ },
37
+ "151647": {
38
+ "content": "<|object_ref_end|>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false,
43
+ "special": true
44
+ },
45
+ "151648": {
46
+ "content": "<|box_start|>",
47
+ "lstrip": false,
48
+ "normalized": false,
49
+ "rstrip": false,
50
+ "single_word": false,
51
+ "special": true
52
+ },
53
+ "151649": {
54
+ "content": "<|box_end|>",
55
+ "lstrip": false,
56
+ "normalized": false,
57
+ "rstrip": false,
58
+ "single_word": false,
59
+ "special": true
60
+ },
61
+ "151650": {
62
+ "content": "<|quad_start|>",
63
+ "lstrip": false,
64
+ "normalized": false,
65
+ "rstrip": false,
66
+ "single_word": false,
67
+ "special": true
68
+ },
69
+ "151651": {
70
+ "content": "<|quad_end|>",
71
+ "lstrip": false,
72
+ "normalized": false,
73
+ "rstrip": false,
74
+ "single_word": false,
75
+ "special": true
76
+ },
77
+ "151652": {
78
+ "content": "<|vision_start|>",
79
+ "lstrip": false,
80
+ "normalized": false,
81
+ "rstrip": false,
82
+ "single_word": false,
83
+ "special": true
84
+ },
85
+ "151653": {
86
+ "content": "<|vision_end|>",
87
+ "lstrip": false,
88
+ "normalized": false,
89
+ "rstrip": false,
90
+ "single_word": false,
91
+ "special": true
92
+ },
93
+ "151654": {
94
+ "content": "<|vision_pad|>",
95
+ "lstrip": false,
96
+ "normalized": false,
97
+ "rstrip": false,
98
+ "single_word": false,
99
+ "special": true
100
+ },
101
+ "151655": {
102
+ "content": "<|image_pad|>",
103
+ "lstrip": false,
104
+ "normalized": false,
105
+ "rstrip": false,
106
+ "single_word": false,
107
+ "special": true
108
+ },
109
+ "151656": {
110
+ "content": "<|video_pad|>",
111
+ "lstrip": false,
112
+ "normalized": false,
113
+ "rstrip": false,
114
+ "single_word": false,
115
+ "special": true
116
+ },
117
+ "151657": {
118
+ "content": "<tool_call>",
119
+ "lstrip": false,
120
+ "normalized": false,
121
+ "rstrip": false,
122
+ "single_word": false,
123
+ "special": false
124
+ },
125
+ "151658": {
126
+ "content": "</tool_call>",
127
+ "lstrip": false,
128
+ "normalized": false,
129
+ "rstrip": false,
130
+ "single_word": false,
131
+ "special": false
132
+ },
133
+ "151659": {
134
+ "content": "<|fim_prefix|>",
135
+ "lstrip": false,
136
+ "normalized": false,
137
+ "rstrip": false,
138
+ "single_word": false,
139
+ "special": false
140
+ },
141
+ "151660": {
142
+ "content": "<|fim_middle|>",
143
+ "lstrip": false,
144
+ "normalized": false,
145
+ "rstrip": false,
146
+ "single_word": false,
147
+ "special": false
148
+ },
149
+ "151661": {
150
+ "content": "<|fim_suffix|>",
151
+ "lstrip": false,
152
+ "normalized": false,
153
+ "rstrip": false,
154
+ "single_word": false,
155
+ "special": false
156
+ },
157
+ "151662": {
158
+ "content": "<|fim_pad|>",
159
+ "lstrip": false,
160
+ "normalized": false,
161
+ "rstrip": false,
162
+ "single_word": false,
163
+ "special": false
164
+ },
165
+ "151663": {
166
+ "content": "<|repo_name|>",
167
+ "lstrip": false,
168
+ "normalized": false,
169
+ "rstrip": false,
170
+ "single_word": false,
171
+ "special": false
172
+ },
173
+ "151664": {
174
+ "content": "<|file_sep|>",
175
+ "lstrip": false,
176
+ "normalized": false,
177
+ "rstrip": false,
178
+ "single_word": false,
179
+ "special": false
180
+ },
181
+ "151665": {
182
+ "content": "<tool_response>",
183
+ "lstrip": false,
184
+ "normalized": false,
185
+ "rstrip": false,
186
+ "single_word": false,
187
+ "special": false
188
+ },
189
+ "151666": {
190
+ "content": "</tool_response>",
191
+ "lstrip": false,
192
+ "normalized": false,
193
+ "rstrip": false,
194
+ "single_word": false,
195
+ "special": false
196
+ },
197
+ "151667": {
198
+ "content": "<think>",
199
+ "lstrip": false,
200
+ "normalized": false,
201
+ "rstrip": false,
202
+ "single_word": false,
203
+ "special": false
204
+ },
205
+ "151668": {
206
+ "content": "</think>",
207
+ "lstrip": false,
208
+ "normalized": false,
209
+ "rstrip": false,
210
+ "single_word": false,
211
+ "special": false
212
+ }
213
+ },
214
+ "additional_special_tokens": [
215
+ "<|im_start|>",
216
+ "<|im_end|>",
217
+ "<|object_ref_start|>",
218
+ "<|object_ref_end|>",
219
+ "<|box_start|>",
220
+ "<|box_end|>",
221
+ "<|quad_start|>",
222
+ "<|quad_end|>",
223
+ "<|vision_start|>",
224
+ "<|vision_end|>",
225
+ "<|vision_pad|>",
226
+ "<|image_pad|>",
227
+ "<|video_pad|>",
228
+ "<d>",
229
+ "</d>",
230
+ "<|cutoff|>",
231
+ "<|lyrics_start|>",
232
+ "<|lyrics_end|>",
233
+ "<|caption_start|>",
234
+ "<|caption_end|>"
235
+ ],
236
+ "bos_token": null,
237
+ "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].content is string %}\n {{- messages[0].content }}\n {%- else %}\n {%- for content in messages[0].content %}\n {%- if 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set image_count = namespace(value=0) %}\n{%- set video_count = namespace(value=0) %}\n{%- for message in messages %}\n {%- if message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"assistant\" %}\n {{- '<|im_start|>' + message.role + '\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content_item in message.content %}\n {%- if 'text' in content_item %}\n {{- content_item.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and message.content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {%- if message.content is string %}\n {{- message.content }}\n {%- else %}\n {%- for content in message.content %}\n {%- if content.type == 'image' or 'image' in content or 'image_url' in content %}\n {%- set image_count.value = image_count.value + 1 %}\n {%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}\n <|vision_start|><|image_pad|><|vision_end|>\n {%- elif content.type == 'video' or 'video' in content %}\n {%- set video_count.value = video_count.value + 1 %}\n {%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}\n <|vision_start|><|video_pad|><|vision_end|>\n {%- elif 'text' in content %}\n {{- content.text }}\n {%- endif %}\n {%- endfor %}\n {%- endif %}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n{%- endif %}\n",
238
+ "clean_up_tokenization_spaces": false,
239
+ "eos_token": "<|im_end|>",
240
+ "errors": "replace",
241
+ "model_max_length": 262144,
242
+ "pad_token": "<|endoftext|>",
243
+ "split_special_tokens": false,
244
+ "tokenizer_class": "Qwen2Tokenizer",
245
+ "unk_token": null
246
+ }
tokenizer/vocab.json ADDED
The diff for this file is too large to render. See raw diff