Skip to content

armgit / LTX-2

Public Imported from GitHub
0

Official Python inference and LoRA trainer package for the LTX-2 audio–video generative model.

Automated PR - 2026-01-05

sync-bot9ce438b35384
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..dcae1fc
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,9 @@
+*.gif filter=lfs diff=lfs merge=lfs -text
+*.safetensors filter=lfs diff=lfs merge=lfs -text
+*.sft filter=lfs diff=lfs merge=lfs -text
+*.pt filter=lfs diff=lfs merge=lfs -text
+*.mp4 filter=lfs diff=lfs merge=lfs -text
+*.png filter=lfs diff=lfs merge=lfs -text
+*.jpeg filter=lfs diff=lfs merge=lfs -text
+*.jpg filter=lfs diff=lfs merge=lfs -text
+*.webp filter=lfs diff=lfs merge=lfs -text
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bd94eaf
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,41 @@
+# Python-generated files
+__pycache__/
+*.py[oc]
+build/
+dist/
+wheels/
+checkpoints/
+*.egg-info
+
+# Virtual environments
+.venv
+.python-version
+
+# IDE settings
+.idea/
+.vscode/
+
+# Other files
+.DS_Store
+tmp
+.wandb
+
+# Model checkpoints
+*.ckpt
+*.pt
+*.safetensors
+*.sft
+
+# Media files
+*.gif
+*.heic
+*.heif
+*.jpg
+*.jpeg
+*.json
+*.m4a
+*.mov
+*.mp4
+*.png
+*.wav
+*.webp
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..fccfbeb
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,381 @@
+ LTX-2 Community License Agreement
+ License date: January 5, 2026
+
+
+By using or distributing any portion or element of LTX-2, you agree
+to be bound by this Agreement.
+
+ 1. Definitions.
+
+ "Agreement" means the terms and conditions for the license, use,
+ reproduction, and distribution of LTX-2 and the Complementary
+ Materials, as specified in this document.
+
+ "Control" means the direct or indirect ownership of more than
+ fifty percent (50%) of the voting securities or other ownership
+ interests, or the power to direct the management and policies of
+ such Entity through voting rights, contract, or otherwise.
+
+ "Data" means a collection of information and/or content extracted
+ from the dataset used with LTX-2, including to train, pretrain,
+ or otherwise evaluate LTX-2. The Data is not licensed under this
+ Agreement.
+
+ "Derivatives of LTX-2" means all modifications to LTX-2, works
+ based on LTX-2, or any other model which is created or initialized
+ by transfer of patterns of the weights, parameters, activations or
+ output of LTX-2, to the other model, in order to cause the other
+ model to perform similarly to LTX-2, including – but not limited
+ to - distillation methods entailing the use of intermediate data
+ representations or methods based on the generation of synthetic
+ data by LTX-2 for training the other model. For clarity, Derivatives
+ of LTX-2 include: (i) any fine-tuned or adapted weights, parameters,
+ or checkpoints derived from LTX-2; (ii) derivative model architectures
+ that incorporate or are based upon LTX-2's architecture; and
+ (iii) any modified or extended versions of the Complementary
+ Materials. All intellectual property rights in Derivatives of LTX-2
+ shall be subject to the terms of this Agreement, and you may not
+ claim exclusive ownership rights in any Derivatives of LTX-2 that
+ would restrict the rights granted herein.
+
+ "Entity" means any individual, corporation, partnership, limited
+ liability company, or other legal entity. For purposes of this
+ Agreement, an Entity shall be deemed to include, on an aggregative
+ basis, all subsidiaries, affiliates, and other companies under
+ common Control with such Entity. When determining whether an Entity
+ meets any threshold under this Agreement (including revenue
+ thresholds), all subsidiaries, affiliates, and companies under
+ common Control shall be considered collectively.
+
+ "Harm" includes but is not limited to physical, mental,
+ psychological, financial and reputational damage, pain, or loss.
+
+ "Licensor" or "Lightricks" means the owner that is granting the
+ license under this Agreement. For the purposes of this Agreement,
+ the Licensor is Lightricks Ltd.
+
+ "LTX-2" means the large language models, text/image/video/audio/3D
+ generation models, and multimodal large language models and their
+ software and algorithms, including trained model weights, parameters
+ (including optimizer states), machine-learning model code,
+ inference-enabling code, training-enabling code, fine-tuning
+ enabling code, accompanying source code, scripts, documentation,
+ tutorials, examples, and all other elements of the foregoing
+ distributed and made publicly available by Lightricks (including,
+ for example, at https://github.com/Lightricks/LTX-2) for the LTX-2
+ model released on January 5, 2026. This license is applicable to
+ all LTX-2 versions released since January 5, 2026, and all future
+ releases of LTX-2 under this license.
+
+ "Output" means the results of operating LTX-2 as embodied in
+ informational content resulting therefrom.
+
+ "you" (or "your") means an individual or legal Entity licensing
+ LTX-2 in accordance with this Agreement and/or making use of LTX-2
+ for whichever purpose and in any field of use, including usage of
+ LTX-2 in an end-use application - e.g. chatbot, translator, image
+ generator.
+
+ 2. Grant of License. Subject to the terms and conditions of this
+ Agreement, you are granted a non-exclusive, worldwide,
+ non-transferable and royalty-free limited license under Licensor's
+ intellectual property or other rights owned by Licensor embodied
+ in LTX-2 to use, reproduce, prepare, distribute, publicly display,
+ publicly perform, sublicense, copy, create derivative works of,
+ and make modifications to LTX-2, for any purpose, subject to the
+ restrictions set forth in Attachment A; provided however, that
+ Entities with annual revenues of at least $10,000,000 (the
+ "Commercial Entities") are required to obtain a paid commercial
+ use license in order to use LTX-2 and Derivatives of LTX-2,
+ subject to the terms and provisions of a different license (the
+ "Commercial Use Agreement"), as will be provided by the Licensor.
+ Commercial Entities interested in such a commercial license are
+ required to contact Licensor. Any commercial use of LTX-2 or
+ Derivatives of LTX-2 by the Commercial Entities not in accordance
+ with this Agreement and/or the Commercial Use Agreement is strictly
+ prohibited and shall be deemed a material breach of this Agreement.
+ Such material breach will be subject, in addition to any license
+ fees owed to Licensor for the period such Commercial Entity used
+ LTX-2 (as will be determined by Licensor), to liquidated damages,
+ which will be paid to Licensor immediately upon demand, in an
+ amount equal to double the amount that would otherwise have been
+ paid by you for the relevant period of time. Such amount reflects
+ a reasonable estimation of the losses and administrative costs
+ incurred due to such breach. You agree and understand that this
+ remedy does not limit the Licensor's right to pursue other remedies
+ available at law or equity.
+
+ 3. Distribution and Redistribution. You may host for third parties
+ remote access purposes (e.g. software-as-a-service), reproduce
+ and distribute copies of LTX-2 or Derivatives of LTX-2 thereof in
+ any medium, with or without modifications, provided that you meet
+ the following conditions:
+
+ (a) Use-based restrictions as referenced in paragraph 4 and all
+ provisions of Attachment A MUST be included as an enforceable
+ provision by you in any type of legal agreement (e.g. a
+ license) governing the use and/or distribution of LTX-2 or
+ Derivatives of LTX-2, and you shall give notice to subsequent
+ users you distribute to, that LTX-2 or Derivatives of LTX-2
+ are subject to paragraph 4 and Attachment A in their entirety,
+ including all use restrictions and acceptable use policies;
+
+ (b) You must provide any third party recipients of LTX-2 or
+ Derivatives of LTX-2 a copy of this Agreement, including all
+ attachments and use policies. Any Derivative of LTX-2 (as
+ defined in Section 1, including but not limited to fine-tuned
+ weights, modified training code, models trained on Outputs, or
+ any other derivative) must be distributed exclusively under
+ the terms of this Agreement with a complete copy of this
+ license included;
+
+ (c) You must cause any modified files to carry prominent notices
+ stating that you changed the files;
+
+ (d) You must retain all copyright, patent, trademark, and
+ attribution notices excluding those notices that do not
+ pertain to any part of LTX-2, Derivatives of LTX-2.
+
+ You may add your own copyright statement to your modifications and
+ may provide additional or different license terms and conditions -
+ respecting paragraph 3(a) - for use, reproduction, or distribution
+ of your modifications, or for any such Derivatives of LTX-2 as a
+ whole, provided your use, reproduction, and distribution of LTX-2
+ otherwise complies with the conditions stated in this Agreement,
+ and you provide a complete copy of this Agreement with any such
+ use, reproduction and distribution of LTX-2 and any Derivatives
+ thereof.
+
+ 4. Use-based restrictions. The restrictions set forth in Attachment A
+ are considered Use-based restrictions. Therefore, you cannot use
+ LTX-2 and the Derivatives of LTX-2 in violation of the specified
+ restricted uses. You may use LTX-2 subject to this Agreement,
+ including only for lawful purposes and in accordance with the
+ Agreement. "Use" may include creating any content with, fine-tuning,
+ updating, running, training, evaluating and/or re-parametrizing
+ LTX-2. You shall require all of your users who use LTX-2 or a
+ Derivative of LTX-2 to comply with the terms of this paragraph 4.
+
+ 5. The Output You Generate. Except as set forth herein, Licensor
+ claims no rights in the Output you generate using LTX-2. You are
+ accountable for input you insert into LTX-2, the Output you
+ generate and its subsequent uses. No use of the Output can
+ contravene any provision as stated in the Agreement.
+
+ 6. Updates and Runtime Restrictions. To the maximum extent permitted
+ by law, Licensor reserves the right to restrict (remotely or
+ otherwise) usage of LTX-2 in violation of this Agreement, update
+ LTX-2 through electronic means, or modify the Output of LTX-2
+ based on updates. You shall undertake reasonable efforts to use
+ the latest version of LTX-2. Any use of the non-current version
+ of LTX-2 is done solely at your risk.
+
+ 7. Export Controls and Sanctions Compliance. You acknowledge that
+ LTX-2, Derivatives of LTX-2 may be subject to export control laws
+ and regulations, including but not limited to the U.S. Export
+ Administration Regulations and sanctions programs administered by
+ the Office of Foreign Assets Control (OFAC). You represent and
+ warrant that you and any users of LTX-2 are not (i) located in,
+ organized under the laws of, or ordinarily resident in any country
+ or territory subject to comprehensive sanctions; (ii) identified
+ on any U.S. government restricted party list, including the
+ Specially Designated Nationals and Blocked Persons List; or
+ (iii) otherwise prohibited from receiving LTX-2 under applicable
+ law. You shall not export, re-export, or transfer LTX-2, directly
+ or indirectly, in violation of any applicable export control or
+ sanctions laws or regulations. You agree to comply with all
+ applicable trade control laws and shall indemnify and hold
+ Licensor harmless from any claims arising from your failure to
+ comply with such laws.
+
+ 8. Trademarks and related. Nothing in this Agreement permits you to
+ make use of Licensor's trademarks, trade names, logos or to
+ otherwise suggest endorsement or misrepresent the relationship
+ between the parties; and any rights not expressly granted herein
+ are reserved by the Licensor.
+
+ 9. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides LTX-2 on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or
+ conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS
+ FOR A PARTICULAR PURPOSE. You are solely responsible for
+ determining the appropriateness of using or redistributing LTX-2
+ and Derivatives of LTX-2 and assume any risks associated with
+ your exercise of permissions under this Agreement.
+
+ 10. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall Licensor be liable
+ to you for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as
+ a result of this Agreement or out of the use or inability to use
+ LTX-2 (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if Licensor has been
+ advised of the possibility of such damages.
+
+ 11. Accepting Warranty or Additional Liability. While redistributing
+ LTX-2 and Derivatives of LTX-2, you may, provided you do not
+ violate the terms of this Agreement, choose to offer and charge
+ a fee for, acceptance of support, warranty, indemnity, or other
+ liability obligations. However, in accepting such obligations,
+ you may act only on your own behalf and on your sole
+ responsibility, not on behalf of Licensor, and only if you agree
+ to indemnify, defend, and hold Licensor harmless for any liability
+ incurred by, or claims asserted against Licensor, by reason of
+ your accepting any such warranty or additional liability.
+
+ 12. Governing Law. This Agreement and all relations, disputes, claims
+ and other matters arising hereunder (including non-contractual
+ disputes or claims) will be governed exclusively by, and construed
+ exclusively in accordance with, the laws of the State of New York.
+ To the extent permitted by law, choice of laws rules and the
+ United Nations Convention on Contracts for the International Sale
+ of Goods will not apply. For the purposes of adjudicating any
+ action or proceeding to enforce the terms of this Agreement, you
+ hereby irrevocably consent to the exclusive jurisdiction of, and
+ venue in, the federal and state courts located in the County of
+ New York within the State of New York. The prevailing party in
+ any claim or dispute between the parties under this Agreement
+ will be entitled to reimbursement of its reasonable attorneys'
+ fees and costs. You hereby waive the right to a trial by jury,
+ to participate in a class or representative action (including in
+ arbitration), or to combine individual proceedings in court or
+ in arbitration without the consent of all parties.
+
+ 13. Term and Termination. This Agreement is effective upon your
+ acceptance and continues until terminated. Licensor may terminate
+ this Agreement immediately upon written notice to you if you
+ breach any provision of this Agreement, including but not limited
+ to violations of the use restrictions in Attachment A or
+ unauthorized commercial use. Upon termination: (a) all rights
+ granted to you under this Agreement will immediately cease;
+ (b) you must immediately cease all use of LTX-2 and Derivatives
+ of LTX-2; (c) you must delete or destroy all copies of LTX-2
+ and Derivatives of LTX-2 in your possession or control; and
+ (d) you must notify any third parties to whom you distributed
+ LTX-2 or Derivatives of LTX-2 of the termination. Sections 8-13,
+ and Section 15 shall survive termination of this Agreement.
+ Termination does not relieve you of any obligations incurred
+ prior to termination, including payment obligations under
+ Section 2. In addition, if You commence a lawsuit or other
+ proceedings (including a cross-claim or counterclaim in a lawsuit)
+ against Licensor or any person or entity alleging that LTX-2 or
+ any Output, or any portion of any of the foregoing, infringe any
+ intellectual property or other right owned or licensable by you,
+ then all licenses granted to you under this Agreement shall
+ terminate as of the date such lawsuit or other proceeding is filed.
+
+ 14. Disputes and Arbitration. All disputes arising in connection with
+ this Agreement shall be finally settled by arbitration under the
+ Rules of Arbitration of the International Chamber of Commerce
+ ("ICC Rules"), by one (1) arbitrator appointed in accordance with
+ the ICC Rules. The seat of arbitration shall be New York, NY, USA,
+ and the proceedings shall be conducted in English. The arbitrator
+ shall be empowered to grant any relief that a court could grant.
+ Judgment on the arbitration award may be entered by any court
+ having jurisdiction thereof. Each party waives its right to a
+ trial by jury and to participate in any class or representative
+ action.
+
+ 15. If any provision of this Agreement is held to be
+ invalid, illegal
+ or unenforceable, the remaining provisions shall be unaffected
+ thereby and remain valid as if such provision had not been set
+ forth herein.
+
+ END OF TERMS AND CONDITIONS
+
+ ATTACHMENT A: Use Restrictions
+
+ When using the Outputs, LTX-2 and any Derivatives thereof, you
+ will comply with the Acceptable Use Policy. In addition, you
+ agree not to use the Outputs, LTX-2 or its Derivatives in any
+ of the following ways:
+
+ 1. In any way that violates any applicable national, federal,
+ state, local or international law or regulation;
+
+ 2. For the purpose of exploiting, Harming or attempting to
+ exploit or Harm minors in any way;
+
+ 3. To generate or disseminate false information and/or content
+ with the purpose of Harming others;
+
+ 4. To generate or disseminate personal identifiable information
+ that can be used to Harm an individual;
+
+ 5. To generate or disseminate information and/or content (e.g.
+ images, code, posts, articles), and place the information
+ and/or content in any context (e.g. bot generating tweets)
+ without expressly and intelligibly disclaiming that the
+ information and/or content is machine generated;
+
+ 6. To defame, disparage or otherwise harass others;
+
+ 7. To impersonate or attempt to impersonate (e.g. deepfakes)
+ others without their consent;
+
+ 8. For fully automated decision making that adversely impacts an
+ individual's legal rights or otherwise creates or modifies a
+ binding, enforceable obligation;
+
+ 9. For any use intended to or which has the effect of
+ discriminating against or Harming individuals or groups based
+ on online or offline social behavior or known or predicted
+ personal or personality characteristics;
+
+ 10. To exploit any of the vulnerabilities of a specific group of
+ persons based on their age, social, physical or mental
+ characteristics, in order to materially distort the behavior
+ of a person pertaining to that group in a manner that causes
+ or is likely to cause that person or another person physical
+ or psychological Harm;
+
+ 11. For any use intended to or which has the effect of
+ discriminating against individuals or groups based on legally
+ protected characteristics or categories;
+
+ 12. To provide medical advice and medical results interpretation;
+
+ 13. To generate or disseminate information for the purpose to be
+ used for administration of justice, law enforcement,
+ immigration or asylum processes, such as predicting an
+ individual will commit fraud/crime commitment (e.g. by text
+ profiling, drawing causal relationships between assertions
+ made in documents, indiscriminate and arbitrarily-targeted use);
+
+ 14. To generate and/or disseminate malware (including – but not
+ limited to – ransomware) or any other content to be used for
+ the purpose of harming electronic systems;
+
+ 15. To engage in, promote, incite, or facilitate discrimination
+ or other unlawful or harmful conduct in the provision of
+ employment, employment benefits, credit, housing, or other
+ essential goods and services;
+
+ 16. To engage in, promote, incite, or facilitate the harassment,
+ abuse, threatening, or bullying of individuals or groups of
+ individuals;
+
+ 17. For military, warfare, nuclear industries or applications,
+ weapons development, or any use in connection with activities
+ that may cause death, personal injury, or severe physical or
+ environmental damage;
+
+ 18. For commercial use only: To train, improve, or fine-tune any
+ other machine learning model, artificial intelligence system,
+ or competing model, except for Derivatives of LTX-2 as
+ expressly permitted under this Agreement;
+
+ 19. To circumvent, disable, or interfere with any technical
+ limitations, safety features, content filters, or use
+ restrictions implemented in LTX-2 by Licensor;
+
+ 20. To use LTX-2 or Derivatives of LTX-2 in any product, service,
+ or application that directly competes with Licensor's
+ commercial products or services, or is designed to replace or
+ substitute Licensor's offerings in the market, without
+ obtaining a separate commercial license from Licensor.
diff --git a/README.md b/README.md
index 8b13789..6924f32 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,116 @@
+# LTX-2
+[![Website](https://img.shields.io/badge/Website-LTX-181717?logo=google-chrome)](https://ltx.io)
+[![Model](https://img.shields.io/badge/HuggingFace-Model-orange?logo=huggingface)](https://huggingface.co/Lightricks/LTX-2)
+[![Demo](https://img.shields.io/badge/Demo-Try%20Now-brightgreen?logo=vercel)](https://app.ltx.studio/ltx-2-playground/i2v)
+[![Paper](https://img.shields.io/badge/Paper-arXiv-B31B1B?logo=arxiv)](https://arxiv.org/abs/2501.00103)
+[![Discord](https://img.shields.io/badge/Join-Discord-5865F2?logo=discord)](https://discord.gg/ltxplatform)
+
+**LTX-2** is the first DiT-based audio-video foundation model that contains all core capabilities of modern video generation in one model: synchronized audio and video, high fidelity, multiple performance modes, production-ready outputs, API access, and open access.
+
+https://github.com/user-attachments/assets/63f33254-b11b-4f73-81f4-b02cffcad2ed
+
+## 🚀 Quick Start
+
+```bash
+# Clone the repository
+git clone https://github.com/Lightricks/LTX-2.git
+cd LTX-2
+
+# Set up the environment
+uv sync --frozen
+source .venv/bin/activate
+```
+
+### Required Models
+
+Download the following models from the [LTX-2 HuggingFace repository](https://huggingface.co/Lightricks/LTX-2):
+
+**LTX-2 Model Checkpoint** (choose and download one of the following)
+ * [`ltx-2-19b-dev-fp8.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-19b-dev-fp8.safetensors) - [Download](https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-19b-dev-fp8.safetensors)
+
+ * [`ltx-2-19b-dev.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-19b-dev.safetensors) - [Download](https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-19b-dev.safetensors)
+ * [`ltx-2-19b-distilled.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-19b-distilled.safetensors) - [Download](https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-19b-distilled.safetensors)
+ * [`ltx-2-19b-distilled-fp8.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-19b-distilled-fp8.safetensors) - [Download](https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-19b-distilled-fp8.safetensors)
+
+**Spatial Upscaler** - Required for current two-stage pipeline implementations in this repository
+ * [`ltx-2-spatial-upscaler-x2-1.0.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-spatial-upscaler-x2-1.0.safetensors) - [Download](https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-spatial-upscaler-x2-1.0.safetensors)
+
+**Temporal Upscaler** - Required for current two-stage pipeline implementations in this repository
+ * [`ltx-2-temporal-upscaler-x2-1.0.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-temporal-upscaler-x2-1.0.safetensors) - [Download](https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-temporal-upscaler-x2-1.0.safetensors)
+
+**Distilled LoRA** - Required for current two-stage pipeline implementations in this repository (except DistilledPipeline and ICLoraPipeline)
+ * [`ltx-2-19b-distilled-lora-384.safetensors`](https://huggingface.co/Lightricks/LTX-2/blob/main/ltx-2-19b-distilled-lora-384.safetensors) - [Download](https://huggingface.co/Lightricks/LTX-2/resolve/main/ltx-2-19b-distilled-lora-384.safetensors)
+
+**Gemma Text Encoder** (download all assets from the repository)
+ * [`Gemma 3`](https://huggingface.co/google/gemma-3-12b-it-qat-q4_0-unquantized/tree/main)
+
+**LoRAs**
+ * [`LTX-2-19b-IC-LoRA-Canny-Control`](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Canny-Control) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Canny-Control/resolve/main/ltx-2-19b-ic-lora-canny-control.safetensors)
+ * [`LTX-2-19b-IC-LoRA-Depth-Control`](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Depth-Control) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Depth-Control/resolve/main/ltx-2-19b-ic-lora-depth-control.safetensors)
+ * [`LTX-2-19b-IC-LoRA-Detailer`](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Detailer) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Detailer/resolve/main/ltx-2-19b-ic-lora-detailer.safetensors)
+ * [`LTX-2-19b-IC-LoRA-Pose-Control`](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Pose-Control) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-IC-LoRA-Pose-Control/resolve/main/ltx-2-19b-ic-lora-pose-control.safetensors)
+ * [`LTX-2-19b-LoRA-Camera-Control-Dolly-In`](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Dolly-In) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Dolly-In/resolve/main/ltx-2-19b-lora-camera-control-dolly-in.safetensors)
+ * [`LTX-2-19b-LoRA-Camera-Control-Dolly-Left`](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Dolly-Left) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Dolly-Left/resolve/main/ltx-2-19b-lora-camera-control-dolly-left.safetensors)
+ * [`LTX-2-19b-LoRA-Camera-Control-Dolly-Out`](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Dolly-Out) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Dolly-Out/resolve/main/ltx-2-19b-lora-camera-control-dolly-out.safetensors)
+ * [`LTX-2-19b-LoRA-Camera-Control-Dolly-Right`](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Dolly-Right) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Dolly-Right/resolve/main/ltx-2-19b-lora-camera-control-dolly-right.safetensors)
+ * [`LTX-2-19b-LoRA-Camera-Control-Jib-Down`](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Jib-Down) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Jib-Down/resolve/main/ltx-2-19b-lora-camera-control-jib-down.safetensors)
+ * [`LTX-2-19b-LoRA-Camera-Control-Jib-Up`](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Jib-Up) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Jib-Up/resolve/main/ltx-2-19b-lora-camera-control-jib-up.safetensors)
+ * [`LTX-2-19b-LoRA-Camera-Control-Static`](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Static) - [Download](https://huggingface.co/Lightricks/LTX-2-19b-LoRA-Camera-Control-Static/resolve/main/ltx-2-19b-lora-camera-control-static.safetensors)
+
+### Available Pipelines
+
+* **[TI2VidTwoStagesPipeline](packages/ltx-pipelines/src/ltx_pipelines/ti2vid_two_stages.py)** - Production-quality text-to-video with 2x upsampling (recommended)
+* **[TI2VidOneStagePipeline](packages/ltx-pipelines/src/ltx_pipelines/ti2vid_one_stage.py)** - Single-stage generation for quick prototyping
+* **[DistilledPipeline](packages/ltx-pipelines/src/ltx_pipelines/distilled.py)** - Fastest inference with 8 predefined sigmas
+* **[ICLoraPipeline](packages/ltx-pipelines/src/ltx_pipelines/ic_lora.py)** - Video-to-video and image-to-video transformations
+* **[KeyframeInterpolationPipeline](packages/ltx-pipelines/src/ltx_pipelines/keyframe_interpolation.py)** - Interpolate between keyframe images
+
+### ⚡ Optimization Tips
+
+* **Use DistilledPipeline** - Fastest inference with only 8 predefined sigmas (8 steps stage 1, 4 steps stage 2)
+* **Enable FP8 transformer** - Enables lower memory footprint: `--enable-fp8` (CLI) or `fp8transformer=True` (Python)
+* **Install attention optimizations** - Use xFormers (`uv sync --extra xformers`) or [Flash Attention 3](https://github.com/Dao-AILab/flash-attention) for Hopper GPUs
+* **Use gradient estimation** - Reduce inference steps from 40 to 20-30 while maintaining quality (see [pipeline documentation](packages/ltx-pipelines/README.md#denoising-loop-optimization))
+* **Skip memory cleanup** - If you have sufficient VRAM, disable automatic memory cleanup between stages for faster processing
+* **Choose single-stage pipeline** - Use `TI2VidOneStagePipeline` for faster generation when high resolution isn't required
+
+## ✍️ Prompting for LTX-2
+
+When writing prompts, focus on detailed, chronological descriptions of actions and scenes. Include specific movements, appearances, camera angles, and environmental details - all in a single flowing paragraph. Start directly with the action, and keep descriptions literal and precise. Think like a cinematographer describing a shot list. Keep within 200 words. For best results, build your prompts using this structure:
+
+- Start with main action in a single sentence
+- Add specific details about movements and gestures
+- Describe character/object appearances precisely
+- Include background and environment details
+- Specify camera angles and movements
+- Describe lighting and colors
+- Note any changes or sudden events
+
+For additional guidance on writing a prompt please refer to <https://ltx.video/blog/how-to-prompt-for-ltx-2>
+
+### Automatic Prompt Enhancement
+
+LTX-2 pipelines support automatic prompt enhancement via an `enhance_prompt` parameter.
+
+## 🔌 ComfyUI Integration
+
+To use our model with ComfyUI, please follow the instructions at <https://github.com/Lightricks/ComfyUI-LTXVideo/>.
+
+## 📦 Packages
+
+This repository is organized as a monorepo with three main packages:
+
+* **[ltx-core](packages/ltx-core/)** - Core model implementation, inference stack, and utilities
+* **[ltx-pipelines](packages/ltx-pipelines/)** - High-level pipeline implementations for text-to-video, image-to-video, and other generation modes
+* **[ltx-trainer](packages/ltx-trainer/)** - Training and fine-tuning tools for LoRA, full fine-tuning, and IC-LoRA
+
+Each package has its own README and documentation. See the [Documentation](#-documentation) section below.
+
+## 📚 Documentation
+
+Each package includes comprehensive documentation:
+
+* **[LTX-Core README](packages/ltx-core/README.md)** - Core model implementation, inference stack, and utilities
+* **[LTX-Pipelines README](packages/ltx-pipelines/README.md)** - High-level pipeline implementations and usage guides
+* **[LTX-Trainer README](packages/ltx-trainer/README.md)** - Training and fine-tuning documentation with detailed guides
diff --git a/packages/ltx-core/README.md b/packages/ltx-core/README.md
new file mode 100644
index 0000000..28a5e84
--- /dev/null
+++ b/packages/ltx-core/README.md
@@ -0,0 +1,280 @@
+# LTX-Core
+
+The foundational library for the LTX-2 Audio-Video generation model. This package contains the raw model definitions, component implementations, and loading logic used by `ltx-pipelines` and `ltx-trainer`.
+
+## 📦 What's Inside?
+
+- **`components/`**: Modular diffusion components (Schedulers, Guiders, Noisers, Patchifiers) following standard protocols
+- **`conditioning/`**: Tools for preparing latent states and applying conditioning (image, video, keyframes)
+- **`guidance/`**: Perturbation system for fine-grained control over attention mechanisms
+- **`loader/`**: Utilities for loading weights from `.safetensors`, fusing LoRAs, and managing memory
+- **`model/`**: PyTorch implementations of the LTX-2 Transformer, Video VAE, Audio VAE, Vocoder and Upscaler
+- **`text_encoders/gemma`**: Gemma text encoder implementation with tokenizers, feature extractors, and separate encoders for audio-video and video-only generation
+
+## 🚀 Quick Start
+
+`ltx-core` provides the building blocks (models, components, and utilities) needed to construct inference flows. For ready-made inference pipelines use [`ltx-pipelines`](../ltx-pipelines/) or [`ltx-trainer`](../ltx-trainer/) for training.
+
+## 🔧 Installation
+
+```bash
+# From the repository root
+uv sync --frozen
+
+# Or install as a package
+pip install -e packages/ltx-core
+```
+
+## Building Blocks Overview
+
+`ltx-core` provides modular components that can be combined to build custom inference flows:
+
+### Core Models
+
+- **Transformer** ([`model/transformer/`](src/ltx_core/model/transformer/)): The 48-layer LTX-2 transformer with cross-modal attention for joint audio-video processing. Expects inputs in [`Modality`](src/ltx_core/model/transformer/modality.py) format
+- **Video VAE** ([`model/video_vae/`](src/ltx_core/model/video_vae/)): Encodes/decodes video pixels to/from latent space with temporal and spatial compression
+- **Audio VAE** ([`model/audio_vae/`](src/ltx_core/model/audio_vae/)): Encodes/decodes audio spectrograms to/from latent space
+- **Vocoder** ([`model/audio_vae/`](src/ltx_core/model/audio_vae/)): Neural vocoder that converts mel spectrograms to audio waveforms
+- **Text Encoder** ([`text_encoders/`](src/ltx_core/text_encoders/)): Gemma-based encoder that produces separate embeddings for video and audio conditioning
+- **Spatial Upscaler** ([`model/upsampler/`](src/ltx_core/model/upsampler/)): Upsamples latent representations for higher-resolution generation
+
+### Diffusion Components
+
+- **Schedulers** ([`components/schedulers.py`](src/ltx_core/components/schedulers.py)): Noise schedules (LTX2Scheduler, LinearQuadratic, Beta) that control the denoising process
+- **Guiders** ([`components/guiders.py`](src/ltx_core/components/guiders.py)): Guidance strategies (CFG, STG, APG) for controlling generation quality and adherence to prompts
+- **Noisers** ([`components/noisers.py`](src/ltx_core/components/noisers.py)): Add noise to latents according to the diffusion schedule
+- **Patchifiers** ([`components/patchifiers.py`](src/ltx_core/components/patchifiers.py)): Convert between spatial latents `[B, C, F, H, W]` and sequence format `[B, seq_len, dim]` for transformer processing
+
+### Conditioning & Control
+
+- **Conditioning** ([`conditioning/`](src/ltx_core/conditioning/)): Tools for preparing and applying various conditioning types (image, video, keyframes)
+- **Guidance** ([`guidance/`](src/ltx_core/guidance/)): Perturbation system for fine-grained control over attention mechanisms (e.g., skipping specific attention layers)
+
+### Utilities
+
+- **Loader** ([`loader/`](src/ltx_core/loader/)): Model loading from `.safetensors`, LoRA fusion, weight remapping, and memory management
+
+For complete, production-ready pipeline implementations that combine these building blocks, see the [`ltx-pipelines`](../ltx-pipelines/) package.
+
+---
+
+# Architecture Overview
+
+This section provides a deep dive into the internal architecture of the LTX-2 Audio-Video generation model.
+
+## Table of Contents
+
+1. [High-Level Architecture](#high-level-architecture)
+2. [The Transformer](#the-transformer)
+3. [Video VAE](#video-vae)
+4. [Audio VAE](#audio-vae)
+5. [Text Encoding (Gemma)](#text-encoding-gemma)
+6. [Spatial Upscaler](#spatial-upsampler)
+7. [Data Flow](#data-flow)
+
+---
+
+## High-Level Architecture
+
+LTX-2 is a **joint Audio-Video diffusion transformer** that processes both modalities simultaneously in a unified architecture. Unlike traditional models that handle video and audio separately, LTX-2 uses cross-modal attention to enable natural synchronization.
+
+```text
+┌─────────────────────────────────────────────────────────────┐
+│ INPUT PREPARATION │
+│ │
+│ Video Pixels → Video VAE Encoder → Video Latents │
+│ Audio Waveform → Audio VAE Encoder → Audio Latents │
+│ Text Prompt → Gemma Encoder → Text Embeddings │
+└─────────────────────────────────────────────────────────────┘
+ ↓
+┌─────────────────────────────────────────────────────────────┐
+│ LTX-2 TRANSFORMER (48 Blocks) │
+│ │
+│ ┌──────────────┐ ┌──────────────┐ │
+│ │ Video Stream │ │ Audio Stream │ │
+│ │ │ │ │ │
+│ │ Self-Attn │ │ Self-Attn │ │
+│ │ Cross-Attn │ │ Cross-Attn │ │
+│ │ │◄────────────►│ │ │
+│ │ A↔V Cross │ │ A↔V Cross │ │
+│ │ Feed-Forward │ │ Feed-Forward │ │
+│ └──────────────┘ └──────────────┘ │
+└─────────────────────────────────────────────────────────────┘
+ ↓
+┌─────────────────────────────────────────────────────────────┐
+│ OUTPUT DECODING │
+│ │
+│ Video Latents → Video VAE Decoder → Video Pixels │
+│ Audio Latents → Audio VAE Decoder → Mel Spectrogram │
+│ Mel Spectrogram → Vocoder → Audio Waveform │
+└─────────────────────────────────────────────────────────────┘
+```
+
+---
+
+## The Transformer
+
+The core of LTX-2 is a 48-layer transformer that processes both video and audio tokens simultaneously.
+
+### Model Structure
+
+**Source**: [`src/ltx_core/model/transformer/model.py`](src/ltx_core/model/transformer/model.py)
+
+The `LTXModel` class implements the transformer. It supports both video-only and audio-video generation modes. For actual usage, see the [`ltx-pipelines`](../ltx-pipelines/) package which handles model loading and initialization.
+
+### Transformer Block Architecture
+
+**Source**: [`src/ltx_core/model/transformer/transformer.py`](src/ltx_core/model/transformer/transformer.py)
+
+```text
+┌─────────────────────────────────────────────────────────────┐
+│ TRANSFORMER BLOCK │
+│ │
+│ VIDEO PATH: │
+│ Input → RMSNorm → AdaLN → Self-Attn (attn1) │
+│ → RMSNorm → Cross-Attn (attn2, text) │
+│ → RMSNorm → AdaLN → A↔V Cross-Attn │
+│ → RMSNorm → AdaLN → Feed-Forward (ff) → Output │
+│ │
+│ AUDIO PATH: │
+│ Input → RMSNorm → AdaLN → Self-Attn (audio_attn1) │
+│ → RMSNorm → Cross-Attn (audio_attn2, text) │
+│ → RMSNorm → AdaLN → A↔V Cross-Attn │
+│ → RMSNorm → AdaLN → Feed-Forward (audio_ff) │
+│ │
+│ AdaLN (Adaptive Layer Normalization): │
+│ - Uses scale_shift_table (6 params) for video/audio │
+│ - Uses scale_shift_table_a2v_ca (5 params) for A↔V CA │
+│ - Conditioned on per-token timestep embeddings │
+└─────────────────────────────────────────────────────────────┘
+```
+
+### Perturbations
+
+The transformer supports [**perturbations**](src/ltx_core/guidance/perturbations.py) that selectively skip attention operations.
+
+Perturbations allow you to disable specific attention mechanisms during inference, which is useful for guidance techniques like STG (Spatio-Temporal Guidance).
+
+**Supported Perturbation Types**:
+
+- `SKIP_VIDEO_SELF_ATTN`: Skip video self-attention
+- `SKIP_AUDIO_SELF_ATTN`: Skip audio self-attention
+- `SKIP_A2V_CROSS_ATTN`: Skip audio-to-video cross-attention
+- `SKIP_V2A_CROSS_ATTN`: Skip video-to-audio cross-attention
+
+Perturbations are used internally by guidance mechanisms like STG (Spatio-Temporal Guidance). For usage examples, see the [`ltx-pipelines`](../ltx-pipelines/) package.
+
+---
+
+## Video VAE
+
+The Video VAE ([`src/ltx_core/model/video_vae/`](src/ltx_core/model/video_vae/)) encodes video pixels into latent representations and decodes them back.
+
+### Architecture
+
+- **Encoder**: Compresses `[B, 3, F, H, W]` pixels → `[B, 128, F', H/32, W/32]` latents
+ - Where `F' = 1 + (F-1)/8` (frame count must satisfy `(F-1) % 8 == 0`)
+ - Example: `[B, 3, 33, 512, 512]` → `[B, 128, 5, 16, 16]`
+- **Decoder**: Expands `[B, 128, F, H, W]` latents → `[B, 3, F', H*32, W*32]` pixels
+ - Where `F' = 1 + (F-1)*8`
+ - Example: `[B, 128, 5, 16, 16]` → `[B, 3, 33, 512, 512]`
+
+The Video VAE is used internally by pipelines for encoding video pixels to latents and decoding latents back to pixels. For usage examples, see the [`ltx-pipelines`](../ltx-pipelines/) package.
+
+---
+
+## Audio VAE
+
+The Audio VAE ([`src/ltx_core/model/audio_vae/`](src/ltx_core/model/audio_vae/)) processes audio spectrograms.
+
+### Audio VAE Architecture
+
+- **Encoder**: Compresses mel spectrogram `[B, mel_bins, T]` → `[B, 8, T/4, 16]` latents
+ - Temporal downsampling: 4× (`LATENT_DOWNSAMPLE_FACTOR = 4`)
+ - Frequency bins: Fixed 16 mel bins in latent space
+ - Latent channels: 8
+- **Decoder**: Expands `[B, 8, T, 16]` latents → mel spectrogram `[B, mel_bins, T*4]`
+- **Vocoder**: Converts mel spectrogram → audio waveform
+
+**Downsampling**:
+
+- Temporal: 4× (time steps)
+- Frequency: Variable (input mel_bins → fixed 16 in latent space)
+
+The Audio VAE is used internally by pipelines for encoding mel spectrograms to latents and decoding latents back to mel spectrograms. The vocoder converts mel spectrograms to audio waveforms. For usage examples, see the [`ltx-pipelines`](../ltx-pipelines/) package.
+
+---
+
+## Text Encoding (Gemma)
+
+LTX-2 uses **Gemma** (Google's open LLM) as the text encoder, located in [`src/ltx_core/text_encoders/gemma/`](src/ltx_core/text_encoders/gemma/).
+
+### Text Encoder Architecture
+
+- **Tokenizer**: Converts text → token IDs
+- **Gemma Model**: Processes tokens → embeddings
+- **Text Projection**: Uses `PixArtAlphaTextProjection` to project caption embeddings
+ - Two-layer MLP with GELU (tanh approximation) or SiLU activation
+ - Projects from caption channels (3840) to model dimensions
+- **Feature Extractor**: Extracts video/audio-specific embeddings
+- **Separate Encoders**:
+ - `AVEncoder`: For audio-video generation (outputs separate video and audio contexts)
+ - `VideoOnlyEncoder`: For video-only generation
+
+### System Prompts
+
+System prompts are also used to enhance user's prompts.
+
+- **Text-to-Video**: [`gemma_t2v_system_prompt.txt`](src/ltx_core/text_encoders/gemma/encoders/prompts/gemma_t2v_system_prompt.txt)
+- **Image-to-Video**: [`gemma_i2v_system_prompt.txt`](src/ltx_core/text_encoders/gemma/encoders/prompts/gemma_i2v_system_prompt.txt)
+
+**Important**: Video and audio receive **different** context embeddings, even from the same prompt. This allows better modality-specific conditioning.
+
+**Output Format**:
+
+- Video context: `[B, seq_len, 4096]` - Video-specific text embeddings
+- Audio context: `[B, seq_len, 2048]` - Audio-specific text embeddings
+
+The text encoder is used internally by pipelines. For usage examples, see the [`ltx-pipelines`](../ltx-pipelines/) package.
+
+---
+
+## Upscaler
+
+The Upscaler ([`src/ltx_core/model/upsampler/`](src/ltx_core/model/upsampler/)) upsamples latent representations for higher-resolution output.
+
+The spatial upsampler is used internally by two-stage pipelines (e.g., [`TI2VidTwoStagesPipeline`](../ltx-pipelines/src/ltx_pipelines/ti2vid_two_stages.py), [`ICLoraPipeline`](../ltx-pipelines/src/ltx_pipelines/ic_lora.py)) to upsample low-resolution latents before final VAE decoding. For usage examples, see the [`ltx-pipelines`](../ltx-pipelines/) package.
+
+---
+
+## Data Flow
+
+### Complete Generation Pipeline
+
+Here's how all the components work together conceptually ([`src/ltx_core/components/`](src/ltx_core/components/)):
+
+**Pipeline Steps**:
+
+1. **Text Encoding**: Text prompt → Gemma encoder → separate video/audio embeddings
+2. **Latent Initialization**: Initialize noise latents in spatial format `[B, C, F, H, W]`
+3. **Patchification**: Convert spatial latents to sequence format `[B, seq_len, dim]` for transformer
+4. **Sigma Schedule**: Generate noise schedule (adapts to token count)
+5. **Denoising Loop**: Iteratively denoise using transformer predictions
+ - Create Modality inputs with per-token timesteps and RoPE positions
+ - Forward pass through transformer (conditional and unconditional for CFG)
+ - Apply guidance (CFG, STG, etc.)
+ - Update latents using diffusion step (Euler, etc.)
+6. **Unpatchification**: Convert sequence back to spatial format
+7. **VAE Decoding**: Decode latents to pixel space (with optional upsampling for two-stage)
+
+- [`TI2VidTwoStagesPipeline`](../ltx-pipelines/src/ltx_pipelines/ti2vid_two_stages.py) - Two-stage text-to-video (recommended)
+- [`ICLoraPipeline`](../ltx-pipelines/src/ltx_pipelines/ic_lora.py) - Video-to-video with IC-LoRA control
+- [`DistilledPipeline`](../ltx-pipelines/src/ltx_pipelines/distilled.py) - Fast inference with distilled model
+- [`KeyframeInterpolationPipeline`](../ltx-pipelines/src/ltx_pipelines/keyframe_interpolation.py) - Keyframe-based interpolation
+
+See the [ltx-pipelines README](../ltx-pipelines/README.md) for usage examples.
+
+## 🔗 Related Projects
+
+- **[ltx-pipelines](../ltx-pipelines/)** - High-level pipeline implementations for text-to-video, image-to-video, and video-to-video
+- **[ltx-trainer](../ltx-trainer/)** - Training and fine-tuning tools
diff --git a/packages/ltx-core/pyproject.toml b/packages/ltx-core/pyproject.toml
new file mode 100644
index 0000000..1be24dc
--- /dev/null
+++ b/packages/ltx-core/pyproject.toml
@@ -0,0 +1,37 @@
+[project]
+name = "ltx-core"
+version = "1.0.0"
+description = "Core implementation of Lightricks' LTX-2 model"
+readme = "README.md"
+requires-python = ">=3.10"
+dependencies = [
+ "torch~=2.7",
+ "torchaudio",
+ "einops",
+ "numpy",
+ "transformers",
+ "safetensors",
+ "accelerate",
+ "scipy>=1.14",
+]
+
+[project.optional-dependencies]
+xformers = ["xformers"]
+
+
+[tool.uv.sources]
+xformers = { index = "pytorch" }
+
+[[tool.uv.index]]
+name = "pytorch"
+url = "https://download.pytorch.org/whl/cu129"
+explicit = true
+
+[build-system]
+requires = ["uv_build>=0.9.8,<0.10.0"]
+build-backend = "uv_build"
+
+[dependency-groups]
+dev = [
+ "scikit-image>=0.25.2",
+]
diff --git a/packages/ltx-core/src/ltx_core/__init__.py b/packages/ltx-core/src/ltx_core/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/packages/ltx-core/src/ltx_core/components/__init__.py b/packages/ltx-core/src/ltx_core/components/__init__.py
new file mode 100644
index 0000000..c1cb638
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/components/__init__.py
@@ -0,0 +1,10 @@
+"""
+Diffusion pipeline components.
+Submodules:
+ diffusion_steps - Diffusion stepping algorithms (EulerDiffusionStep)
+ guiders - Guidance strategies (CFGGuider, STGGuider, APG variants)
+ noisers - Noise samplers (GaussianNoiser)
+ patchifiers - Latent patchification (VideoLatentPatchifier, AudioPatchifier)
+ protocols - Protocol definitions (Patchifier, etc.)
+ schedulers - Sigma schedulers (LTX2Scheduler, LinearQuadraticScheduler)
+"""
diff --git a/packages/ltx-core/src/ltx_core/components/diffusion_steps.py b/packages/ltx-core/src/ltx_core/components/diffusion_steps.py
new file mode 100644
index 0000000..99477f6
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/components/diffusion_steps.py
@@ -0,0 +1,22 @@
+import torch
+
+from ltx_core.components.protocols import DiffusionStepProtocol
+from ltx_core.utils import to_velocity
+
+
+class EulerDiffusionStep(DiffusionStepProtocol):
+ """
+ First-order Euler method for diffusion sampling.
+ Takes a single step from the current noise level (sigma) to the next by
+ computing velocity from the denoised prediction and applying: sample + velocity * dt.
+ """
+
+ def step(
+ self, sample: torch.Tensor, denoised_sample: torch.Tensor, sigmas: torch.Tensor, step_index: int
+ ) -> torch.Tensor:
+ sigma = sigmas[step_index]
+ sigma_next = sigmas[step_index + 1]
+ dt = sigma_next - sigma
+ velocity = to_velocity(sample, sigma, denoised_sample)
+
+ return (sample.to(torch.float32) + velocity.to(torch.float32) * dt).to(sample.dtype)
diff --git a/packages/ltx-core/src/ltx_core/components/guiders.py b/packages/ltx-core/src/ltx_core/components/guiders.py
new file mode 100644
index 0000000..c4d774b
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/components/guiders.py
@@ -0,0 +1,198 @@
+from dataclasses import dataclass
+
+import torch
+
+from ltx_core.components.protocols import GuiderProtocol
+
+
+@dataclass(frozen=True)
+class CFGGuider(GuiderProtocol):
+ """
+ Classifier-free guidance (CFG) guider.
+ Computes the guidance delta as (scale - 1) * (cond - uncond), steering the
+ denoising process toward the conditioned prediction.
+ Attributes:
+ scale: Guidance strength. 1.0 means no guidance, higher values increase
+ adherence to the conditioning.
+ """
+
+ scale: float
+
+ def delta(self, cond: torch.Tensor, uncond: torch.Tensor) -> torch.Tensor:
+ return (self.scale - 1) * (cond - uncond)
+
+ def enabled(self) -> bool:
+ return self.scale != 1.0
+
+
+@dataclass(frozen=True)
+class CFGStarRescalingGuider(GuiderProtocol):
+ """
+ Calculates the CFG delta between conditioned and unconditioned samples.
+ To minimize offset in the denoising direction and move mostly along the
+ conditioning axis within the distribution, the unconditioned sample is
+ rescaled in accordance with the norm of the conditioned sample.
+ Attributes:
+ scale (float):
+ Global guidance strength. A value of 1.0 corresponds to no extra
+ guidance beyond the base model prediction. Values > 1.0 increase
+ the influence of the conditioned sample relative to the
+ unconditioned one.
+ """
+
+ scale: float
+
+ def delta(self, cond: torch.Tensor, uncond: torch.Tensor) -> torch.Tensor:
+ rescaled_neg = projection_coef(cond, uncond) * uncond
+ return (self.scale - 1) * (cond - rescaled_neg)
+
+ def enabled(self) -> bool:
+ return self.scale != 1.0
+
+
+@dataclass(frozen=True)
+class STGGuider(GuiderProtocol):
+ """
+ Calculates the STG delta between conditioned and perturbed denoised samples.
+ Perturbed samples are the result of the denoising process with perturbations,
+ e.g. attentions acting as passthrough for certain layers and modalities.
+ Attributes:
+ scale (float):
+ Global strength of the STG guidance. A value of 0.0 disables the
+ guidance. Larger values increase the correction applied in the
+ direction of (pos_denoised - perturbed_denoised).
+ """
+
+ scale: float
+
+ def delta(self, pos_denoised: torch.Tensor, perturbed_denoised: torch.Tensor) -> torch.Tensor:
+ return self.scale * (pos_denoised - perturbed_denoised)
+
+ def enabled(self) -> bool:
+ return self.scale != 0.0
+
+
+@dataclass(frozen=True)
+class LtxAPGGuider(GuiderProtocol):
+ """
+ Calculates the APG (adaptive projected guidance) delta between conditioned
+ and unconditioned samples.
+ To minimize offset in the denoising direction and move mostly along the
+ conditioning axis within the distribution, the (cond - uncond) delta is
+ decomposed into components parallel and orthogonal to the conditioned
+ sample. The `eta` parameter weights the parallel component, while `scale`
+ is applied to the orthogonal component. Optionally, a norm threshold can
+ be used to suppress guidance when the magnitude of the correction is small.
+ Attributes:
+ scale (float):
+ Strength applied to the component of the guidance that is orthogonal
+ to the conditioned sample. Controls how aggressively we move in
+ directions that change semantics but stay consistent with the
+ conditioning manifold.
+ eta (float):
+ Weight of the component of the guidance that is parallel to the
+ conditioned sample. A value of 1.0 keeps the full parallel
+ component; values in [0, 1] attenuate it, and values > 1.0 amplify
+ motion along the conditioning direction.
+ norm_threshold (float):
+ Minimum L2 norm of the guidance delta below which the guidance
+ can be reduced or ignored (depending on implementation).
+ This is useful for avoiding noisy or unstable updates when the
+ guidance signal is very small.
+ """
+
+ scale: float
+ eta: float = 1.0
+ norm_threshold: float = 0.0
+
+ def delta(self, cond: torch.Tensor, uncond: torch.Tensor) -> torch.Tensor:
+ guidance = cond - uncond
+ if self.norm_threshold > 0:
+ ones = torch.ones_like(guidance)
+ guidance_norm = guidance.norm(p=2, dim=[-1, -2, -3], keepdim=True)
+ scale_factor = torch.minimum(ones, self.norm_threshold / guidance_norm)
+ guidance = guidance * scale_factor
+ proj_coeff = projection_coef(guidance, cond)
+ g_parallel = proj_coeff * cond
+ g_orth = guidance - g_parallel
+ g_apg = g_parallel * self.eta + g_orth
+
+ return g_apg * (self.scale - 1)
+
+ def enabled(self) -> bool:
+ return self.scale != 1.0
+
+
+@dataclass(frozen=False)
+class LegacyStatefulAPGGuider(GuiderProtocol):
+ """
+ Calculates the APG (adaptive projected guidance) delta between conditioned
+ and unconditioned samples.
+ To minimize offset in the denoising direction and move mostly along the
+ conditioning axis within the distribution, the (cond - uncond) delta is
+ decomposed into components parallel and orthogonal to the conditioned
+ sample. The `eta` parameter weights the parallel component, while `scale`
+ is applied to the orthogonal component. Optionally, a norm threshold can
+ be used to suppress guidance when the magnitude of the correction is small.
+ Attributes:
+ scale (float):
+ Strength applied to the component of the guidance that is orthogonal
+ to the conditioned sample. Controls how aggressively we move in
+ directions that change semantics but stay consistent with the
+ conditioning manifold.
+ eta (float):
+ Weight of the component of the guidance that is parallel to the
+ conditioned sample. A value of 1.0 keeps the full parallel
+ component; values in [0, 1] attenuate it, and values > 1.0 amplify
+ motion along the conditioning direction.
+ norm_threshold (float):
+ Minimum L2 norm of the guidance delta below which the guidance
+ can be reduced or ignored (depending on implementation).
+ This is useful for avoiding noisy or unstable updates when the
+ guidance signal is very small.
+ momentum (float):
+ Exponential moving-average coefficient for accumulating guidance
+ over time. running_avg = momentum * running_avg + guidance
+ """
+
+ scale: float
+ eta: float
+ norm_threshold: float = 5.0
+ momentum: float = 0.0
+ # it is user's responsibility not to use same APGGuider for several denoisings or different modalities
+ # in order not to share accumulated average across different denoisings or modalities
+ running_avg: torch.Tensor | None = None
+
+ def delta(self, cond: torch.Tensor, uncond: torch.Tensor) -> torch.Tensor:
+ guidance = cond - uncond
+ if self.momentum != 0:
+ if self.running_avg is None:
+ self.running_avg = guidance.clone()
+ else:
+ self.running_avg = self.momentum * self.running_avg + guidance
+ guidance = self.running_avg
+
+ if self.norm_threshold > 0:
+ ones = torch.ones_like(guidance)
+ guidance_norm = guidance.norm(p=2, dim=[-1, -2, -3], keepdim=True)
+ scale_factor = torch.minimum(ones, self.norm_threshold / guidance_norm)
+ guidance = guidance * scale_factor
+
+ proj_coeff = projection_coef(guidance, cond)
+ g_parallel = proj_coeff * cond
+ g_orth = guidance - g_parallel
+ g_apg = g_parallel * self.eta + g_orth
+
+ return g_apg * self.scale
+
+ def enabled(self) -> bool:
+ return self.scale != 0.0
+
+
+def projection_coef(to_project: torch.Tensor, project_onto: torch.Tensor) -> torch.Tensor:
+ batch_size = to_project.shape[0]
+ positive_flat = to_project.reshape(batch_size, -1)
+ negative_flat = project_onto.reshape(batch_size, -1)
+ dot_product = torch.sum(positive_flat * negative_flat, dim=1, keepdim=True)
+ squared_norm = torch.sum(negative_flat**2, dim=1, keepdim=True) + 1e-8
+ return dot_product / squared_norm
diff --git a/packages/ltx-core/src/ltx_core/components/noisers.py b/packages/ltx-core/src/ltx_core/components/noisers.py
new file mode 100644
index 0000000..2db66d8
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/components/noisers.py
@@ -0,0 +1,35 @@
+from dataclasses import replace
+from typing import Protocol
+
+import torch
+
+from ltx_core.types import LatentState
+
+
+class Noiser(Protocol):
+ """Protocol for adding noise to a latent state during diffusion."""
+
+ def __call__(self, latent_state: LatentState, noise_scale: float) -> LatentState: ...
+
+
+class GaussianNoiser(Noiser):
+ """Adds Gaussian noise to a latent state, scaled by the denoise mask."""
+
+ def __init__(self, generator: torch.Generator):
+ super().__init__()
+
+ self.generator = generator
+
+ def __call__(self, latent_state: LatentState, noise_scale: float = 1.0) -> LatentState:
+ noise = torch.randn(
+ *latent_state.latent.shape,
+ device=latent_state.latent.device,
+ dtype=latent_state.latent.dtype,
+ generator=self.generator,
+ )
+ scaled_mask = latent_state.denoise_mask * noise_scale
+ latent = noise * scaled_mask + latent_state.latent * (1 - scaled_mask)
+ return replace(
+ latent_state,
+ latent=latent.to(latent_state.latent.dtype),
+ )
diff --git a/packages/ltx-core/src/ltx_core/components/patchifiers.py b/packages/ltx-core/src/ltx_core/components/patchifiers.py
new file mode 100644
index 0000000..f9580d5
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/components/patchifiers.py
@@ -0,0 +1,348 @@
+import math
+from typing import Optional, Tuple
+
+import einops
+import torch
+
+from ltx_core.components.protocols import Patchifier
+from ltx_core.types import AudioLatentShape, SpatioTemporalScaleFactors, VideoLatentShape
+
+
+class VideoLatentPatchifier(Patchifier):
+ def __init__(self, patch_size: int):
+ # Patch sizes for video latents.
+ self._patch_size = (
+ 1, # temporal dimension
+ patch_size, # height dimension
+ patch_size, # width dimension
+ )
+
+ @property
+ def patch_size(self) -> Tuple[int, int, int]:
+ return self._patch_size
+
+ def get_token_count(self, tgt_shape: VideoLatentShape) -> int:
+ return math.prod(tgt_shape.to_torch_shape()[2:]) // math.prod(self._patch_size)
+
+ def patchify(
+ self,
+ latents: torch.Tensor,
+ ) -> torch.Tensor:
+ latents = einops.rearrange(
+ latents,
+ "b c (f p1) (h p2) (w p3) -> b (f h w) (c p1 p2 p3)",
+ p1=self._patch_size[0],
+ p2=self._patch_size[1],
+ p3=self._patch_size[2],
+ )
+
+ return latents
+
+ def unpatchify(
+ self,
+ latents: torch.Tensor,
+ output_shape: VideoLatentShape,
+ ) -> torch.Tensor:
+ assert self._patch_size[0] == 1, "Temporal patch size must be 1 for symmetric patchifier"
+
+ patch_grid_frames = output_shape.frames // self._patch_size[0]
+ patch_grid_height = output_shape.height // self._patch_size[1]
+ patch_grid_width = output_shape.width // self._patch_size[2]
+
+ latents = einops.rearrange(
+ latents,
+ "b (f h w) (c p q) -> b c f (h p) (w q)",
+ f=patch_grid_frames,
+ h=patch_grid_height,
+ w=patch_grid_width,
+ p=self._patch_size[1],
+ q=self._patch_size[2],
+ )
+
+ return latents
+
+ def get_patch_grid_bounds(
+ self,
+ output_shape: AudioLatentShape | VideoLatentShape,
+ device: Optional[torch.device] = None,
+ ) -> torch.Tensor:
+ """
+ Return the per-dimension bounds [inclusive start, exclusive end) for every
+ patch produced by `patchify`. The bounds are expressed in the original
+ video grid coordinates: frame/time, height, and width.
+ The resulting tensor is shaped `[batch_size, 3, num_patches, 2]`, where:
+ - axis 1 (size 3) enumerates (frame/time, height, width) dimensions
+ - axis 3 (size 2) stores `[start, end)` indices within each dimension
+ Args:
+ output_shape: Video grid description containing frames, height, and width.
+ device: Device of the latent tensor.
+ """
+ if not isinstance(output_shape, VideoLatentShape):
+ raise ValueError("VideoLatentPatchifier expects VideoLatentShape when computing coordinates")
+
+ frames = output_shape.frames
+ height = output_shape.height
+ width = output_shape.width
+ batch_size = output_shape.batch
+
+ # Validate inputs to ensure positive dimensions
+ assert frames > 0, f"frames must be positive, got {frames}"
+ assert height > 0, f"height must be positive, got {height}"
+ assert width > 0, f"width must be positive, got {width}"
+ assert batch_size > 0, f"batch_size must be positive, got {batch_size}"
+
+ # Generate grid coordinates for each dimension (frame, height, width)
+ # We use torch.arange to create the starting coordinates for each patch.
+ # indexing='ij' ensures the dimensions are in the order (frame, height, width).
+ grid_coords = torch.meshgrid(
+ torch.arange(start=0, end=frames, step=self._patch_size[0], device=device),
+ torch.arange(start=0, end=height, step=self._patch_size[1], device=device),
+ torch.arange(start=0, end=width, step=self._patch_size[2], device=device),
+ indexing="ij",
+ )
+
+ # Stack the grid coordinates to create the start coordinates tensor.
+ # Shape becomes (3, grid_f, grid_h, grid_w)
+ patch_starts = torch.stack(grid_coords, dim=0)
+
+ # Create a tensor containing the size of a single patch:
+ # (frame_patch_size, height_patch_size, width_patch_size).
+ # Reshape to (3, 1, 1, 1) to enable broadcasting when adding to the start coordinates.
+ patch_size_delta = torch.tensor(
+ self._patch_size,
+ device=patch_starts.device,
+ dtype=patch_starts.dtype,
+ ).view(3, 1, 1, 1)
+
+ # Calculate end coordinates: start + patch_size
+ # Shape becomes (3, grid_f, grid_h, grid_w)
+ patch_ends = patch_starts + patch_size_delta
+
+ # Stack start and end coordinates together along the last dimension
+ # Shape becomes (3, grid_f, grid_h, grid_w, 2), where the last dimension is [start, end]
+ latent_coords = torch.stack((patch_starts, patch_ends), dim=-1)
+
+ # Broadcast to batch size and flatten all spatial/temporal dimensions into one sequence.
+ # Final Shape: (batch_size, 3, num_patches, 2)
+ latent_coords = einops.repeat(
+ latent_coords,
+ "c f h w bounds -> b c (f h w) bounds",
+ b=batch_size,
+ bounds=2,
+ )
+
+ return latent_coords
+
+
+def get_pixel_coords(
+ latent_coords: torch.Tensor,
+ scale_factors: SpatioTemporalScaleFactors,
+ causal_fix: bool = False,
+) -> torch.Tensor:
+ """
+ Map latent-space `[start, end)` coordinates to their pixel-space equivalents by scaling
+ each axis (frame/time, height, width) with the corresponding VAE downsampling factors.
+ Optionally compensate for causal encoding that keeps the first frame at unit temporal scale.
+ Args:
+ latent_coords: Tensor of latent bounds shaped `(batch, 3, num_patches, 2)`.
+ scale_factors: SpatioTemporalScaleFactors tuple `(temporal, height, width)` with integer scale factors applied
+ per axis.
+ causal_fix: When True, rewrites the temporal axis of the first frame so causal VAEs
+ that treat frame zero differently still yield non-negative timestamps.
+ """
+ # Broadcast the VAE scale factors so they align with the `(batch, axis, patch, bound)` layout.
+ broadcast_shape = [1] * latent_coords.ndim
+ broadcast_shape[1] = -1 # axis dimension corresponds to (frame/time, height, width)
+ scale_tensor = torch.tensor(scale_factors, device=latent_coords.device).view(*broadcast_shape)
+
+ # Apply per-axis scaling to convert latent bounds into pixel-space coordinates.
+ pixel_coords = latent_coords * scale_tensor
+
+ if causal_fix:
+ # VAE temporal stride for the very first frame is 1 instead of `scale_factors[0]`.
+ # Shift and clamp to keep the first-frame timestamps causal and non-negative.
+ pixel_coords[:, 0, ...] = (pixel_coords[:, 0, ...] + 1 - scale_factors[0]).clamp(min=0)
+
+ return pixel_coords
+
+
+class AudioPatchifier(Patchifier):
+ def __init__(
+ self,
+ patch_size: int,
+ sample_rate: int = 16000,
+ hop_length: int = 160,
+ audio_latent_downsample_factor: int = 4,
+ is_causal: bool = True,
+ shift: int = 0,
+ ):
+ """
+ Patchifier tailored for spectrogram/audio latents.
+ Args:
+ patch_size: Number of mel bins combined into a single patch. This
+ controls the resolution along the frequency axis.
+ sample_rate: Original waveform sampling rate. Used to map latent
+ indices back to seconds so downstream consumers can align audio
+ and video cues.
+ hop_length: Window hop length used for the spectrogram. Determines
+ how many real-time samples separate two consecutive latent frames.
+ audio_latent_downsample_factor: Ratio between spectrogram frames and
+ latent frames; compensates for additional downsampling inside the
+ VAE encoder.
+ is_causal: When True, timing is shifted to account for causal
+ receptive fields so timestamps do not peek into the future.
+ shift: Integer offset applied to the latent indices. Enables
+ constructing overlapping windows from the same latent sequence.
+ """
+ self.hop_length = hop_length
+ self.sample_rate = sample_rate
+ self.audio_latent_downsample_factor = audio_latent_downsample_factor
+ self.is_causal = is_causal
+ self.shift = shift
+ self._patch_size = (1, patch_size, patch_size)
+
+ @property
+ def patch_size(self) -> Tuple[int, int, int]:
+ return self._patch_size
+
+ def get_token_count(self, tgt_shape: AudioLatentShape) -> int:
+ return tgt_shape.frames
+
+ def _get_audio_latent_time_in_sec(
+ self,
+ start_latent: int,
+ end_latent: int,
+ dtype: torch.dtype,
+ device: Optional[torch.device] = None,
+ ) -> torch.Tensor:
+ """
+ Converts latent indices into real-time seconds while honoring causal
+ offsets and the configured hop length.
+ Args:
+ start_latent: Inclusive start index inside the latent sequence. This
+ sets the first timestamp returned.
+ end_latent: Exclusive end index. Determines how many timestamps get
+ generated.
+ dtype: Floating-point dtype used for the returned tensor, allowing
+ callers to control precision.
+ device: Target device for the timestamp tensor. When omitted the
+ computation occurs on CPU to avoid surprising GPU allocations.
+ """
+ if device is None:
+ device = torch.device("cpu")
+
+ audio_latent_frame = torch.arange(start_latent, end_latent, dtype=dtype, device=device)
+
+ audio_mel_frame = audio_latent_frame * self.audio_latent_downsample_factor
+
+ if self.is_causal:
+ # Frame offset for causal alignment.
+ # The "+1" ensures the timestamp corresponds to the first sample that is fully available.
+ causal_offset = 1
+ audio_mel_frame = (audio_mel_frame + causal_offset - self.audio_latent_downsample_factor).clip(min=0)
+
+ return audio_mel_frame * self.hop_length / self.sample_rate
+
+ def _compute_audio_timings(
+ self,
+ batch_size: int,
+ num_steps: int,
+ device: Optional[torch.device] = None,
+ ) -> torch.Tensor:
+ """
+ Builds a `(B, 1, T, 2)` tensor containing timestamps for each latent frame.
+ This helper method underpins `get_patch_grid_bounds` for the audio patchifier.
+ Args:
+ batch_size: Number of sequences to broadcast the timings over.
+ num_steps: Number of latent frames (time steps) to convert into timestamps.
+ device: Device on which the resulting tensor should reside.
+ """
+ resolved_device = device
+ if resolved_device is None:
+ resolved_device = torch.device("cpu")
+
+ start_timings = self._get_audio_latent_time_in_sec(
+ self.shift,
+ num_steps + self.shift,
+ torch.float32,
+ resolved_device,
+ )
+ start_timings = start_timings.unsqueeze(0).expand(batch_size, -1).unsqueeze(1)
+
+ end_timings = self._get_audio_latent_time_in_sec(
+ self.shift + 1,
+ num_steps + self.shift + 1,
+ torch.float32,
+ resolved_device,
+ )
+ end_timings = end_timings.unsqueeze(0).expand(batch_size, -1).unsqueeze(1)
+
+ return torch.stack([start_timings, end_timings], dim=-1)
+
+ def patchify(
+ self,
+ audio_latents: torch.Tensor,
+ ) -> torch.Tensor:
+ """
+ Flattens the audio latent tensor along time. Use `get_patch_grid_bounds`
+ to derive timestamps for each latent frame based on the configured hop
+ length and downsampling.
+ Args:
+ audio_latents: Latent tensor to patchify.
+ Returns:
+ Flattened patch tokens tensor. Use `get_patch_grid_bounds` to compute the
+ corresponding timing metadata when needed.
+ """
+ audio_latents = einops.rearrange(
+ audio_latents,
+ "b c t f -> b t (c f)",
+ )
+
+ return audio_latents
+
+ def unpatchify(
+ self,
+ audio_latents: torch.Tensor,
+ output_shape: AudioLatentShape,
+ ) -> torch.Tensor:
+ """
+ Restores the `(B, C, T, F)` spectrogram tensor from flattened patches.
+ Use `get_patch_grid_bounds` to recompute the timestamps that describe each
+ frame's position in real time.
+ Args:
+ audio_latents: Latent tensor to unpatchify.
+ output_shape: Shape of the unpatched output tensor.
+ Returns:
+ Unpatched latent tensor. Use `get_patch_grid_bounds` to compute the timing
+ metadata associated with the restored latents.
+ """
+ # audio_latents shape: (batch, time, freq * channels)
+ audio_latents = einops.rearrange(
+ audio_latents,
+ "b t (c f) -> b c t f",
+ c=output_shape.channels,
+ f=output_shape.mel_bins,
+ )
+
+ return audio_latents
+
+ def get_patch_grid_bounds(
+ self,
+ output_shape: AudioLatentShape | VideoLatentShape,
+ device: Optional[torch.device] = None,
+ ) -> torch.Tensor:
+ """
+ Return the temporal bounds `[inclusive start, exclusive end)` for every
+ patch emitted by `patchify`. For audio this corresponds to timestamps in
+ seconds aligned with the original spectrogram grid.
+ The returned tensor has shape `[batch_size, 1, time_steps, 2]`, where:
+ - axis 1 (size 1) represents the temporal dimension
+ - axis 3 (size 2) stores the `[start, end)` timestamps per patch
+ Args:
+ output_shape: Audio grid specification describing the number of time steps.
+ device: Target device for the returned tensor.
+ """
+ if not isinstance(output_shape, AudioLatentShape):
+ raise ValueError("AudioPatchifier expects AudioLatentShape when computing coordinates")
+
+ return self._compute_audio_timings(output_shape.batch, output_shape.frames, device)
diff --git a/packages/ltx-core/src/ltx_core/components/protocols.py b/packages/ltx-core/src/ltx_core/components/protocols.py
new file mode 100644
index 0000000..b189e8e
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/components/protocols.py
@@ -0,0 +1,101 @@
+from typing import Protocol, Tuple
+
+import torch
+
+from ltx_core.types import AudioLatentShape, VideoLatentShape
+
+
+class Patchifier(Protocol):
+ """
+ Protocol for patchifiers that convert latent tensors into patches and assemble them back.
+ """
+
+ def patchify(
+ self,
+ latents: torch.Tensor,
+ ) -> torch.Tensor:
+ ...
+ """
+ Convert latent tensors into flattened patch tokens.
+ Args:
+ latents: Latent tensor to patchify.
+ Returns:
+ Flattened patch tokens tensor.
+ """
+
+ def unpatchify(
+ self,
+ latents: torch.Tensor,
+ output_shape: AudioLatentShape | VideoLatentShape,
+ ) -> torch.Tensor:
+ """
+ Converts latent tensors between spatio-temporal formats and flattened sequence representations.
+ Args:
+ latents: Patch tokens that must be rearranged back into the latent grid constructed by `patchify`.
+ output_shape: Shape of the output tensor. Note that output_shape is either AudioLatentShape or
+ VideoLatentShape.
+ Returns:
+ Dense latent tensor restored from the flattened representation.
+ """
+
+ @property
+ def patch_size(self) -> Tuple[int, int, int]:
+ ...
+ """
+ Returns the patch size as a tuple of (temporal, height, width) dimensions
+ """
+
+ def get_patch_grid_bounds(
+ self,
+ output_shape: AudioLatentShape | VideoLatentShape,
+ device: torch.device | None = None,
+ ) -> torch.Tensor:
+ ...
+ """
+ Compute metadata describing where each latent patch resides within the
+ grid specified by `output_shape`.
+ Args:
+ output_shape: Target grid layout for the patches.
+ device: Target device for the returned tensor.
+ Returns:
+ Tensor containing patch coordinate metadata such as spatial or temporal intervals.
+ """
+
+
+class SchedulerProtocol(Protocol):
+ """
+ Protocol for schedulers that provide a sigmas schedule tensor for a
+ given number of steps. Device is cpu.
+ """
+
+ def execute(self, steps: int, **kwargs) -> torch.FloatTensor: ...
+
+
+class GuiderProtocol(Protocol):
+ """
+ Protocol for guiders that compute a delta tensor given conditioning inputs.
+ The returned delta should be added to the conditional output (cond), enabling
+ multiple guiders to be chained together by accumulating their deltas.
+ """
+
+ scale: float
+
+ def delta(self, cond: torch.Tensor, uncond: torch.Tensor) -> torch.Tensor: ...
+
+ def enabled(self) -> bool:
+ """
+ Returns whether the corresponding perturbation is enabled. E.g. for CFG, this should return False if the scale
+ is 1.0.
+ """
+ ...
+
+
+class DiffusionStepProtocol(Protocol):
+ """
+ Protocol for diffusion steps that provide a next sample tensor for a given current sample tensor,
+ current denoised sample tensor, and sigmas tensor.
+ """
+
+ def step(
+ self, sample: torch.Tensor, denoised_sample: torch.Tensor, sigmas: torch.Tensor, step_index: int
+ ) -> torch.Tensor: ...
diff --git a/packages/ltx-core/src/ltx_core/components/schedulers.py b/packages/ltx-core/src/ltx_core/components/schedulers.py
new file mode 100644
index 0000000..5fc7619
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/components/schedulers.py
@@ -0,0 +1,129 @@
+import math
+from functools import lru_cache
+
+import numpy
+import scipy
+import torch
+
+from ltx_core.components.protocols import SchedulerProtocol
+
+BASE_SHIFT_ANCHOR = 1024
+MAX_SHIFT_ANCHOR = 4096
+
+
+class LTX2Scheduler(SchedulerProtocol):
+ """
+ Default scheduler for LTX-2 diffusion sampling.
+ Generates a sigma schedule with token-count-dependent shifting and optional
+ stretching to a terminal value.
+ """
+
+ def execute(
+ self,
+ steps: int,
+ latent: torch.Tensor | None = None,
+ max_shift: float = 2.05,
+ base_shift: float = 0.95,
+ stretch: bool = True,
+ terminal: float = 0.1,
+ **_kwargs,
+ ) -> torch.FloatTensor:
+ tokens = math.prod(latent.shape[2:]) if latent is not None else MAX_SHIFT_ANCHOR
+ sigmas = torch.linspace(1.0, 0.0, steps + 1)
+
+ x1 = BASE_SHIFT_ANCHOR
+ x2 = MAX_SHIFT_ANCHOR
+ mm = (max_shift - base_shift) / (x2 - x1)
+ b = base_shift - mm * x1
+ sigma_shift = (tokens) * mm + b
+
+ power = 1
+ sigmas = torch.where(
+ sigmas != 0,
+ math.exp(sigma_shift) / (math.exp(sigma_shift) + (1 / sigmas - 1) ** power),
+ 0,
+ )
+
+ # Stretch sigmas so that its final value matches the given terminal value.
+ if stretch:
+ non_zero_mask = sigmas != 0
+ non_zero_sigmas = sigmas[non_zero_mask]
+ one_minus_z = 1.0 - non_zero_sigmas
+ scale_factor = one_minus_z[-1] / (1.0 - terminal)
+ stretched = 1.0 - (one_minus_z / scale_factor)
+ sigmas[non_zero_mask] = stretched
+
+ return sigmas.to(torch.float32)
+
+
+class LinearQuadraticScheduler(SchedulerProtocol):
+ """
+ Scheduler with linear steps followed by quadratic steps.
+ Produces a sigma schedule that transitions linearly up to a threshold,
+ then follows a quadratic curve for the remaining steps.
+ """
+
+ def execute(
+ self, steps: int, threshold_noise: float = 0.025, linear_steps: int | None = None, **_kwargs
+ ) -> torch.FloatTensor:
+ if steps == 1:
+ return torch.FloatTensor([1.0, 0.0])
+
+ if linear_steps is None:
+ linear_steps = steps // 2
+ linear_sigma_schedule = [i * threshold_noise / linear_steps for i in range(linear_steps)]
+ threshold_noise_step_diff = linear_steps - threshold_noise * steps
+ quadratic_steps = steps - linear_steps
+ quadratic_sigma_schedule = []
+ if quadratic_steps > 0:
+ quadratic_coef = threshold_noise_step_diff / (linear_steps * quadratic_steps**2)
+ linear_coef = threshold_noise / linear_steps - 2 * threshold_noise_step_diff / (quadratic_steps**2)
+ const = quadratic_coef * (linear_steps**2)
+ quadratic_sigma_schedule = [
+ quadratic_coef * (i**2) + linear_coef * i + const for i in range(linear_steps, steps)
+ ]
+ sigma_schedule = linear_sigma_schedule + quadratic_sigma_schedule + [1.0]
+ sigma_schedule = [1.0 - x for x in sigma_schedule]
+ return torch.FloatTensor(sigma_schedule)
+
+
+class BetaScheduler(SchedulerProtocol):
+ """
+ Scheduler using a beta distribution to sample timesteps.
+ Based on: https://arxiv.org/abs/2407.12173
+ """
+
+ shift = 2.37
+ timesteps_length = 10000
+
+ def execute(self, steps: int, alpha: float = 0.6, beta: float = 0.6) -> torch.FloatTensor:
+ """
+ Execute the beta scheduler.
+ Args:
+ steps: The number of steps to execute the scheduler for.
+ alpha: The alpha parameter for the beta distribution.
+ beta: The beta parameter for the beta distribution.
+ Warnings:
+ The number of steps within `sigmas` theoretically might be less than `steps+1`,
+ because of the deduplication of the identical timesteps
+ Returns:
+ A tensor of sigmas.
+ """
+ model_sampling_sigmas = _precalculate_model_sampling_sigmas(self.shift, self.timesteps_length)
+ total_timesteps = len(model_sampling_sigmas) - 1
+ ts = 1 - numpy.linspace(0, 1, steps, endpoint=False)
+ ts = numpy.rint(scipy.stats.beta.ppf(ts, alpha, beta) * total_timesteps).tolist()
+ ts = list(dict.fromkeys(ts))
+
+ sigmas = [float(model_sampling_sigmas[int(t)]) for t in ts] + [0.0]
+ return torch.FloatTensor(sigmas)
+
+
+@lru_cache(maxsize=5)
+def _precalculate_model_sampling_sigmas(shift: float, timesteps_length: int) -> torch.Tensor:
+ timesteps = torch.arange(1, timesteps_length + 1, 1) / timesteps_length
+ return torch.Tensor([flux_time_shift(shift, 1.0, t) for t in timesteps])
+
+
+def flux_time_shift(mu: float, sigma: float, t: float) -> float:
+ return math.exp(mu) / (math.exp(mu) + (1 / t - 1) ** sigma)
diff --git a/packages/ltx-core/src/ltx_core/conditioning/__init__.py b/packages/ltx-core/src/ltx_core/conditioning/__init__.py
new file mode 100644
index 0000000..8d0871c
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/conditioning/__init__.py
@@ -0,0 +1,12 @@
+"""Conditioning utilities: latent state, tools, and conditioning types."""
+
+from ltx_core.conditioning.exceptions import ConditioningError
+from ltx_core.conditioning.item import ConditioningItem
+from ltx_core.conditioning.types import VideoConditionByKeyframeIndex, VideoConditionByLatentIndex
+
+__all__ = [
+ "ConditioningError",
+ "ConditioningItem",
+ "VideoConditionByKeyframeIndex",
+ "VideoConditionByLatentIndex",
+]
diff --git a/packages/ltx-core/src/ltx_core/conditioning/exceptions.py b/packages/ltx-core/src/ltx_core/conditioning/exceptions.py
new file mode 100644
index 0000000..458aa3b
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/conditioning/exceptions.py
@@ -0,0 +1,4 @@
+class ConditioningError(Exception):
+ """
+ Class for conditioning-related errors.
+ """
diff --git a/packages/ltx-core/src/ltx_core/conditioning/item.py b/packages/ltx-core/src/ltx_core/conditioning/item.py
new file mode 100644
index 0000000..e6eef52
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/conditioning/item.py
@@ -0,0 +1,20 @@
+from typing import Protocol
+
+from ltx_core.tools import LatentTools
+from ltx_core.types import LatentState
+
+
+class ConditioningItem(Protocol):
+ """Protocol for conditioning items that modify latent state during diffusion."""
+
+ def apply_to(self, latent_state: LatentState, latent_tools: LatentTools) -> LatentState:
+ """
+ Apply the conditioning to the latent state.
+ Args:
+ latent_state: The latent state to apply the conditioning to. This is state always patchified.
+ Returns:
+ The latent state after the conditioning has been applied.
+ IMPORTANT: If the conditioning needs to add extra tokens to the latent, it should add them to the end of the
+ latent.
+ """
+ ...
diff --git a/packages/ltx-core/src/ltx_core/conditioning/types/__init__.py b/packages/ltx-core/src/ltx_core/conditioning/types/__init__.py
new file mode 100644
index 0000000..867d73f
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/conditioning/types/__init__.py
@@ -0,0 +1,9 @@
+"""Conditioning type implementations."""
+
+from ltx_core.conditioning.types.keyframe_cond import VideoConditionByKeyframeIndex
+from ltx_core.conditioning.types.latent_cond import VideoConditionByLatentIndex
+
+__all__ = [
+ "VideoConditionByKeyframeIndex",
+ "VideoConditionByLatentIndex",
+]
diff --git a/packages/ltx-core/src/ltx_core/conditioning/types/keyframe_cond.py b/packages/ltx-core/src/ltx_core/conditioning/types/keyframe_cond.py
new file mode 100644
index 0000000..c553729
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/conditioning/types/keyframe_cond.py
@@ -0,0 +1,53 @@
+import torch
+
+from ltx_core.components.patchifiers import get_pixel_coords
+from ltx_core.conditioning.item import ConditioningItem
+from ltx_core.tools import VideoLatentTools
+from ltx_core.types import LatentState, VideoLatentShape
+
+
+class VideoConditionByKeyframeIndex(ConditioningItem):
+ """
+ Conditions video generation on keyframe latents at a specific frame index.
+ Appends keyframe tokens to the latent state with positions offset by frame_idx,
+ and sets denoise strength according to the strength parameter.
+ """
+
+ def __init__(self, keyframes: torch.Tensor, frame_idx: int, strength: float):
+ self.keyframes = keyframes
+ self.frame_idx = frame_idx
+ self.strength = strength
+
+ def apply_to(
+ self,
+ latent_state: LatentState,
+ latent_tools: VideoLatentTools,
+ ) -> LatentState:
+ tokens = latent_tools.patchifier.patchify(self.keyframes)
+ latent_coords = latent_tools.patchifier.get_patch_grid_bounds(
+ output_shape=VideoLatentShape.from_torch_shape(self.keyframes.shape),
+ device=self.keyframes.device,
+ )
+ positions = get_pixel_coords(
+ latent_coords=latent_coords,
+ scale_factors=latent_tools.scale_factors,
+ causal_fix=latent_tools.causal_fix if self.frame_idx == 0 else False,
+ )
+
+ positions[:, 0, ...] += self.frame_idx
+ positions = positions.to(dtype=torch.float32)
+ positions[:, 0, ...] /= latent_tools.fps
+
+ denoise_mask = torch.full(
+ size=(*tokens.shape[:2], 1),
+ fill_value=1.0 - self.strength,
+ device=self.keyframes.device,
+ dtype=self.keyframes.dtype,
+ )
+
+ return LatentState(
+ latent=torch.cat([latent_state.latent, tokens], dim=1),
+ denoise_mask=torch.cat([latent_state.denoise_mask, denoise_mask], dim=1),
+ positions=torch.cat([latent_state.positions, positions], dim=2),
+ clean_latent=torch.cat([latent_state.clean_latent, tokens], dim=1),
+ )
diff --git a/packages/ltx-core/src/ltx_core/conditioning/types/latent_cond.py b/packages/ltx-core/src/ltx_core/conditioning/types/latent_cond.py
new file mode 100644
index 0000000..c036273
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/conditioning/types/latent_cond.py
@@ -0,0 +1,44 @@
+import torch
+
+from ltx_core.conditioning.exceptions import ConditioningError
+from ltx_core.conditioning.item import ConditioningItem
+from ltx_core.tools import LatentTools
+from ltx_core.types import LatentState
+
+
+class VideoConditionByLatentIndex(ConditioningItem):
+ """
+ Conditions video generation by injecting latents at a specific latent frame index.
+ Replaces tokens in the latent state at positions corresponding to latent_idx,
+ and sets denoise strength according to the strength parameter.
+ """
+
+ def __init__(self, latent: torch.Tensor, strength: float, latent_idx: int):
+ self.latent = latent
+ self.strength = strength
+ self.latent_idx = latent_idx
+
+ def apply_to(self, latent_state: LatentState, latent_tools: LatentTools) -> LatentState:
+ cond_batch, cond_channels, _, cond_height, cond_width = self.latent.shape
+ tgt_batch, tgt_channels, tgt_frames, tgt_height, tgt_width = latent_tools.target_shape.to_torch_shape()
+
+ if (cond_batch, cond_channels, cond_height, cond_width) != (tgt_batch, tgt_channels, tgt_height, tgt_width):
+ raise ConditioningError(
+ f"Can't apply image conditioning item to latent with shape {latent_tools.target_shape}, expected "
+ f"shape is ({tgt_batch}, {tgt_channels}, {tgt_frames}, {tgt_height}, {tgt_width}). Make sure "
+ "the image and latent have the same spatial shape."
+ )
+
+ tokens = latent_tools.patchifier.patchify(self.latent)
+ start_token = latent_tools.patchifier.get_token_count(
+ latent_tools.target_shape._replace(frames=self.latent_idx)
+ )
+ stop_token = start_token + tokens.shape[1]
+
+ latent_state = latent_state.clone()
+
+ latent_state.latent[:, start_token:stop_token] = tokens
+ latent_state.clean_latent[:, start_token:stop_token] = tokens
+ latent_state.denoise_mask[:, start_token:stop_token] = 1.0 - self.strength
+
+ return latent_state
diff --git a/packages/ltx-core/src/ltx_core/guidance/__init__.py b/packages/ltx-core/src/ltx_core/guidance/__init__.py
new file mode 100644
index 0000000..8214c5c
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/guidance/__init__.py
@@ -0,0 +1,15 @@
+"""Guidance and perturbation utilities for attention manipulation."""
+
+from ltx_core.guidance.perturbations import (
+ BatchedPerturbationConfig,
+ Perturbation,
+ PerturbationConfig,
+ PerturbationType,
+)
+
+__all__ = [
+ "BatchedPerturbationConfig",
+ "Perturbation",
+ "PerturbationConfig",
+ "PerturbationType",
+]
diff --git a/packages/ltx-core/src/ltx_core/guidance/perturbations.py b/packages/ltx-core/src/ltx_core/guidance/perturbations.py
new file mode 100644
index 0000000..40ba4a7
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/guidance/perturbations.py
@@ -0,0 +1,79 @@
+from dataclasses import dataclass
+from enum import Enum
+
+import torch
+from torch._prims_common import DeviceLikeType
+
+
+class PerturbationType(Enum):
+ """Types of attention perturbations for STG (Spatio-Temporal Guidance)."""
+
+ SKIP_A2V_CROSS_ATTN = "skip_a2v_cross_attn"
+ SKIP_V2A_CROSS_ATTN = "skip_v2a_cross_attn"
+ SKIP_VIDEO_SELF_ATTN = "skip_video_self_attn"
+ SKIP_AUDIO_SELF_ATTN = "skip_audio_self_attn"
+
+
+@dataclass(frozen=True)
+class Perturbation:
+ """A single perturbation specifying which attention type to skip and in which blocks."""
+
+ type: PerturbationType
+ blocks: list[int] | None # None means all blocks
+
+ def is_perturbed(self, perturbation_type: PerturbationType, block: int) -> bool:
+ if self.type != perturbation_type:
+ return False
+
+ if self.blocks is None:
+ return True
+
+ return block in self.blocks
+
+
+@dataclass(frozen=True)
+class PerturbationConfig:
+ """Configuration holding a list of perturbations for a single sample."""
+
+ perturbations: list[Perturbation] | None
+
+ def is_perturbed(self, perturbation_type: PerturbationType, block: int) -> bool:
+ if self.perturbations is None:
+ return False
+
+ return any(perturbation.is_perturbed(perturbation_type, block) for perturbation in self.perturbations)
+
+ @staticmethod
+ def empty() -> "PerturbationConfig":
+ return PerturbationConfig([])
+
+
+@dataclass(frozen=True)
+class BatchedPerturbationConfig:
+ """Perturbation configurations for a batch, with utilities for generating attention masks."""
+
+ perturbations: list[PerturbationConfig]
+
+ def mask(
+ self, perturbation_type: PerturbationType, block: int, device: DeviceLikeType, dtype: torch.dtype
+ ) -> torch.Tensor:
+ mask = torch.ones((len(self.perturbations),), device=device, dtype=dtype)
+ for batch_idx, perturbation in enumerate(self.perturbations):
+ if perturbation.is_perturbed(perturbation_type, block):
+ mask[batch_idx] = 0
+
+ return mask
+
+ def mask_like(self, perturbation_type: PerturbationType, block: int, values: torch.Tensor) -> torch.Tensor:
+ mask = self.mask(perturbation_type, block, values.device, values.dtype)
+ return mask.view(mask.numel(), *([1] * len(values.shape[1:])))
+
+ def any_in_batch(self, perturbation_type: PerturbationType, block: int) -> bool:
+ return any(perturbation.is_perturbed(perturbation_type, block) for perturbation in self.perturbations)
+
+ def all_in_batch(self, perturbation_type: PerturbationType, block: int) -> bool:
+ return all(perturbation.is_perturbed(perturbation_type, block) for perturbation in self.perturbations)
+
+ @staticmethod
+ def empty(batch_size: int) -> "BatchedPerturbationConfig":
+ return BatchedPerturbationConfig([PerturbationConfig.empty() for _ in range(batch_size)])
diff --git a/packages/ltx-core/src/ltx_core/loader/__init__.py b/packages/ltx-core/src/ltx_core/loader/__init__.py
new file mode 100644
index 0000000..3aaa01e
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/loader/__init__.py
@@ -0,0 +1,48 @@
+"""Loader utilities for model weights, LoRAs, and safetensor operations."""
+
+from ltx_core.loader.fuse_loras import apply_loras
+from ltx_core.loader.module_ops import ModuleOps
+from ltx_core.loader.primitives import (
+ LoRAAdaptableProtocol,
+ LoraPathStrengthAndSDOps,
+ LoraStateDictWithStrength,
+ ModelBuilderProtocol,
+ StateDict,
+ StateDictLoader,
+)
+from ltx_core.loader.registry import DummyRegistry, Registry, StateDictRegistry
+from ltx_core.loader.sd_ops import (
+ LTXV_LORA_COMFY_RENAMING_MAP,
+ ContentMatching,
+ ContentReplacement,
+ KeyValueOperation,
+ KeyValueOperationResult,
+ SDKeyValueOperation,
+ SDOps,
+)
+from ltx_core.loader.sft_loader import SafetensorsModelStateDictLoader, SafetensorsStateDictLoader
+from ltx_core.loader.single_gpu_model_builder import SingleGPUModelBuilder
+
+__all__ = [
+ "LTXV_LORA_COMFY_RENAMING_MAP",
+ "ContentMatching",
+ "ContentReplacement",
+ "DummyRegistry",
+ "KeyValueOperation",
+ "KeyValueOperationResult",
+ "LoRAAdaptableProtocol",
+ "LoraPathStrengthAndSDOps",
+ "LoraStateDictWithStrength",
+ "ModelBuilderProtocol",
+ "ModuleOps",
+ "Registry",
+ "SDKeyValueOperation",
+ "SDOps",
+ "SafetensorsModelStateDictLoader",
+ "SafetensorsStateDictLoader",
+ "SingleGPUModelBuilder",
+ "StateDict",
+ "StateDictLoader",
+ "StateDictRegistry",
+ "apply_loras",
+]
diff --git a/packages/ltx-core/src/ltx_core/loader/fuse_loras.py b/packages/ltx-core/src/ltx_core/loader/fuse_loras.py
new file mode 100644
index 0000000..66269dd
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/loader/fuse_loras.py
@@ -0,0 +1,100 @@
+import torch
+import triton
+
+from ltx_core.loader.kernels import fused_add_round_kernel
+from ltx_core.loader.primitives import LoraStateDictWithStrength, StateDict
+
+BLOCK_SIZE = 1024
+
+
+def fused_add_round_launch(target_weight: torch.Tensor, original_weight: torch.Tensor, seed: int) -> torch.Tensor:
+ if original_weight.dtype == torch.float8_e4m3fn:
+ exponent_bits, mantissa_bits, exponent_bias = 4, 3, 7
+ elif original_weight.dtype == torch.float8_e5m2:
+ exponent_bits, mantissa_bits, exponent_bias = 5, 2, 15 # noqa: F841
+ else:
+ raise ValueError("Unsupported dtype")
+
+ if target_weight.dtype != torch.bfloat16:
+ raise ValueError("target_weight dtype must be bfloat16")
+
+ # Calculate grid and block sizes
+ n_elements = original_weight.numel()
+ grid = (triton.cdiv(n_elements, BLOCK_SIZE),)
+
+ # Launch kernel
+ fused_add_round_kernel[grid](
+ original_weight,
+ target_weight,
+ seed,
+ n_elements,
+ exponent_bias,
+ mantissa_bits,
+ BLOCK_SIZE,
+ )
+ return target_weight
+
+
+def calculate_weight_float8_(target_weights: torch.Tensor, original_weights: torch.Tensor) -> torch.Tensor:
+ result = fused_add_round_launch(target_weights, original_weights, seed=0).to(target_weights.dtype)
+ target_weights.copy_(result, non_blocking=True)
+ return target_weights
+
+
+def _prepare_deltas(
+ lora_sd_and_strengths: list[LoraStateDictWithStrength], key: str, dtype: torch.dtype, device: torch.device
+) -> torch.Tensor | None:
+ deltas = []
+ prefix = key[: -len(".weight")]
+ key_a = f"{prefix}.lora_A.weight"
+ key_b = f"{prefix}.lora_B.weight"
+ for lsd, coef in lora_sd_and_strengths:
+ if key_a not in lsd.sd or key_b not in lsd.sd:
+ continue
+ product = torch.matmul(lsd.sd[key_b] * coef, lsd.sd[key_a])
+ deltas.append(product.to(dtype=dtype, device=device))
+ if len(deltas) == 0:
+ return None
+ elif len(deltas) == 1:
+ return deltas[0]
+ return torch.sum(torch.stack(deltas, dim=0), dim=0)
+
+
+def apply_loras(
+ model_sd: StateDict,
+ lora_sd_and_strengths: list[LoraStateDictWithStrength],
+ dtype: torch.dtype,
+ destination_sd: StateDict | None = None,
+) -> StateDict:
+ sd = {}
+ if destination_sd is not None:
+ sd = destination_sd.sd
+ size = 0
+ device = torch.device("meta")
+ inner_dtypes = set()
+ for key, weight in model_sd.sd.items():
+ if weight is None:
+ continue
+ device = weight.device
+ target_dtype = dtype if dtype is not None else weight.dtype
+ deltas_dtype = target_dtype if target_dtype not in [torch.float8_e4m3fn, torch.float8_e5m2] else torch.bfloat16
+ deltas = _prepare_deltas(lora_sd_and_strengths, key, deltas_dtype, device)
+ if deltas is None:
+ if key in sd:
+ continue
+ deltas = weight.clone().to(dtype=target_dtype, device=device)
+ elif weight.dtype == torch.float8_e4m3fn:
+ if str(device).startswith("cuda"):
+ deltas = calculate_weight_float8_(deltas, weight)
+ else:
+ deltas.add_(weight.to(dtype=deltas.dtype, device=device))
+ elif weight.dtype == torch.bfloat16:
+ deltas.add_(weight)
+ else:
+ raise ValueError(f"Unsupported dtype: {weight.dtype}")
+ sd[key] = deltas.to(dtype=target_dtype)
+ inner_dtypes.add(target_dtype)
+ size += deltas.nbytes
+ if destination_sd is not None:
+ return destination_sd
+ return StateDict(sd, device, size, inner_dtypes)
diff --git a/packages/ltx-core/src/ltx_core/loader/kernels.py b/packages/ltx-core/src/ltx_core/loader/kernels.py
new file mode 100644
index 0000000..ee4cefb
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/loader/kernels.py
@@ -0,0 +1,72 @@
+# ruff: noqa: ANN001, ANN201, ERA001, N803, N806
+import triton
+import triton.language as tl
+
+
+def fused_add_round_kernel(
+ x_ptr,
+ output_ptr, # contents will be added to the output
+ seed,
+ n_elements,
+ EXPONENT_BIAS,
+ MANTISSA_BITS,
+ BLOCK_SIZE: tl.constexpr,
+):
+ """
+ A kernel to upcast 8bit quantized weights to bfloat16 with stochastic rounding
+ and add them to bfloat16 output weights. Might be used to upcast original model weights
+ and to further add them to precalculated deltas coming from LoRAs.
+ """
+ # Get program ID and compute offsets
+ pid = tl.program_id(axis=0)
+ block_start = pid * BLOCK_SIZE
+ offsets = block_start + tl.arange(0, BLOCK_SIZE)
+ mask = offsets < n_elements
+
+ # Load data
+ x = tl.load(x_ptr + offsets, mask=mask)
+ rand_vals = tl.rand(seed, offsets) - 0.5
+
+ x = tl.cast(x, tl.float16)
+ delta = tl.load(output_ptr + offsets, mask=mask)
+ delta = tl.cast(delta, tl.float16)
+ x = x + delta
+
+ x_bits = tl.cast(x, tl.int16, bitcast=True)
+
+ # Calculate the exponent. Unbiased fp16 exponent is ((x_bits & 0x7C00) >> 10) - 15 for
+ # normal numbers and -14 for subnormals.
+ fp16_exponent_bits = (x_bits & 0x7C00) >> 10
+ fp16_normals = fp16_exponent_bits > 0
+ fp16_exponent = tl.where(fp16_normals, fp16_exponent_bits - 15, -14)
+
+ # Add the target dtype's exponent bias and clamp to the target dtype's exponent range.
+ exponent = fp16_exponent + EXPONENT_BIAS
+ MAX_EXPONENT = 2 * EXPONENT_BIAS + 1
+ exponent = tl.where(exponent > MAX_EXPONENT, MAX_EXPONENT, exponent)
+ exponent = tl.where(exponent < 0, 0, exponent)
+
+ # Normal ULP exponent, expressed as an fp16 exponent field:
+ # (exponent - EXPONENT_BIAS - MANTISSA_BITS) + 15
+ # Simplifies to: fp16_exponent - MANTISSA_BITS + 15
+ # See https://en.wikipedia.org/wiki/Unit_in_the_last_place
+ eps_exp = tl.maximum(0, tl.minimum(31, exponent - EXPONENT_BIAS - MANTISSA_BITS + 15))
+
+ # Calculate epsilon in the target dtype
+ eps_normal = tl.cast(tl.cast(eps_exp << 10, tl.int16), tl.float16, bitcast=True)
+
+ # Subnormal ULP: 2^(1 - EXPONENT_BIAS - MANTISSA_BITS) ->
+ # fp16 exponent bits: (1 - EXPONENT_BIAS - MANTISSA_BITS) + 15 =
+ # 16 - EXPONENT_BIAS - MANTISSA_BITS
+ eps_subnormal = tl.cast(tl.cast((16 - EXPONENT_BIAS - MANTISSA_BITS) << 10, tl.int16), tl.float16, bitcast=True)
+ eps = tl.where(exponent > 0, eps_normal, eps_subnormal)
+
+ # Apply zero mask to epsilon
+ eps = tl.where(x == 0, 0.0, eps)
+
+ # Apply stochastic rounding
+ output = tl.cast(x + rand_vals * eps, tl.bfloat16)
+
+ # Store the result
+ tl.store(output_ptr + offsets, output, mask=mask)
diff --git a/packages/ltx-core/src/ltx_core/loader/module_ops.py b/packages/ltx-core/src/ltx_core/loader/module_ops.py
new file mode 100644
index 0000000..0c3ed2f
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/loader/module_ops.py
@@ -0,0 +1,14 @@
+from typing import Callable, NamedTuple
+
+import torch
+
+
+class ModuleOps(NamedTuple):
+ """
+ Defines a named operation for matching and mutating PyTorch modules.
+ Used to selectively transform modules in a model (e.g., replacing layers with quantized versions).
+ """
+
+ name: str
+ matcher: Callable[[torch.nn.Module], bool]
+ mutator: Callable[[torch.nn.Module], torch.nn.Module]
diff --git a/packages/ltx-core/src/ltx_core/loader/primitives.py b/packages/ltx-core/src/ltx_core/loader/primitives.py
new file mode 100644
index 0000000..2eae933
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/loader/primitives.py
@@ -0,0 +1,109 @@
+from dataclasses import dataclass
+from typing import NamedTuple, Protocol
+
+import torch
+
+from ltx_core.loader.module_ops import ModuleOps
+from ltx_core.loader.sd_ops import SDOps
+from ltx_core.model.model_protocol import ModelType
+
+
+@dataclass(frozen=True)
+class StateDict:
+ """
+ Immutable container for a PyTorch state dictionary.
+ Contains:
+ - sd: Dictionary of tensors (weights, buffers, etc.)
+ - device: Device where tensors are stored
+ - size: Total memory footprint in bytes
+ - dtype: Set of tensor dtypes present
+ """
+
+ sd: dict
+ device: torch.device
+ size: int
+ dtype: set[torch.dtype]
+
+ def footprint(self) -> tuple[int, torch.device]:
+ return self.size, self.device
+
+
+class StateDictLoader(Protocol):
+ """
+ Protocol for loading state dictionaries from various sources.
+ Implementations must provide:
+ - metadata: Extract model metadata from a single path
+ - load: Load state dict from path(s) and apply SDOps transformations
+ """
+
+ def metadata(self, path: str) -> dict:
+ """
+ Load metadata from path
+ """
+
+ def load(self, path: str | list[str], sd_ops: SDOps | None = None, device: torch.device | None = None) -> StateDict:
+ """
+ Load state dict from path or paths (for sharded model storage) and apply sd_ops
+ """
+
+
+class ModelBuilderProtocol(Protocol[ModelType]):
+ """
+ Protocol for building PyTorch models from configuration dictionaries.
+ Implementations must provide:
+ - meta_model: Create a model from configuration dictionary and apply module operations
+ - build: Create and initialize a model from state dictionary and apply dtype transformations
+ """
+
+ def meta_model(self, config: dict, module_ops: list[ModuleOps] | None = None) -> ModelType:
+ """
+ Create a model on the meta device from a configuration dictionary.
+ This decouples model creation from weight loading, allowing the model
+ architecture to be instantiated without allocating memory for parameters.
+ Args:
+ config: Model configuration dictionary.
+ module_ops: Optional list of module operations to apply (e.g., quantization).
+ Returns:
+ Model instance on meta device (no actual memory allocated for parameters).
+ """
+ ...
+
+ def build(self, dtype: torch.dtype | None = None) -> ModelType:
+ """
+ Build the model
+ Args:
+ dtype: Target dtype for the model, if None, uses the dtype of the model_path model
+ Returns:
+ Model instance
+ """
+ ...
+
+
+class LoRAAdaptableProtocol(Protocol):
+ """
+ Protocol for models that can be adapted with LoRAs.
+ Implementations must provide:
+ - lora: Add a LoRA to the model
+ """
+
+ def lora(self, lora_path: str, strength: float) -> "LoRAAdaptableProtocol":
+ pass
+
+
+class LoraPathStrengthAndSDOps(NamedTuple):
+ """
+ Tuple containing a LoRA path, strength, and SDOps for applying to the LoRA state dict.
+ """
+
+ path: str
+ strength: float
+ sd_ops: SDOps
+
+
+class LoraStateDictWithStrength(NamedTuple):
+ """
+ Tuple containing a LoRA state dict and strength for applying to the model.
+ """
+
+ state_dict: StateDict
+ strength: float
diff --git a/packages/ltx-core/src/ltx_core/loader/registry.py b/packages/ltx-core/src/ltx_core/loader/registry.py
new file mode 100644
index 0000000..9fd5f9d
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/loader/registry.py
@@ -0,0 +1,84 @@
+import hashlib
+import threading
+from dataclasses import dataclass, field
+from pathlib import Path
+from typing import Protocol
+
+from ltx_core.loader.primitives import StateDict
+from ltx_core.loader.sd_ops import SDOps
+
+
+class Registry(Protocol):
+ """
+ Protocol for managing state dictionaries in a registry.
+ It is used to store state dictionaries and reuse them later without loading them again.
+ Implementations must provide:
+ - add: Add a state dictionary to the registry
+ - pop: Remove a state dictionary from the registry
+ - get: Retrieve a state dictionary from the registry
+ - clear: Clear all state dictionaries from the registry
+ """
+
+ def add(self, paths: list[str], sd_ops: SDOps | None, state_dict: StateDict) -> None: ...
+
+ def pop(self, paths: list[str], sd_ops: SDOps | None) -> StateDict | None: ...
+
+ def get(self, paths: list[str], sd_ops: SDOps | None) -> StateDict | None: ...
+
+ def clear(self) -> None: ...
+
+
+class DummyRegistry(Registry):
+ """
+ Dummy registry that does not store state dictionaries.
+ """
+
+ def add(self, paths: list[str], sd_ops: SDOps | None, state_dict: StateDict) -> None:
+ pass
+
+ def pop(self, paths: list[str], sd_ops: SDOps | None) -> StateDict | None:
+ pass
+
+ def get(self, paths: list[str], sd_ops: SDOps | None) -> StateDict | None:
+ pass
+
+ def clear(self) -> None:
+ pass
+
+
+@dataclass
+class StateDictRegistry(Registry):
+ """
+ Registry that stores state dictionaries in a dictionary.
+ """
+
+ _state_dicts: dict[str, StateDict] = field(default_factory=dict)
+ _lock: threading.Lock = field(default_factory=threading.Lock)
+
+ def _generate_id(self, paths: list[str], sd_ops: SDOps) -> str:
+ m = hashlib.sha256()
+ parts = [str(Path(p).resolve()) for p in paths]
+ if sd_ops is not None:
+ parts.append(sd_ops.name)
+ m.update("\0".join(parts).encode("utf-8"))
+ return m.hexdigest()
+
+ def add(self, paths: list[str], sd_ops: SDOps | None, state_dict: StateDict) -> str:
+ sd_id = self._generate_id(paths, sd_ops)
+ with self._lock:
+ if sd_id in self._state_dicts:
+ raise ValueError(f"State dict retrieved from {paths} with {sd_ops} already added, check with get first")
+ self._state_dicts[sd_id] = state_dict
+ return sd_id
+
+ def pop(self, paths: list[str], sd_ops: SDOps | None) -> StateDict | None:
+ with self._lock:
+ return self._state_dicts.pop(self._generate_id(paths, sd_ops), None)
+
+ def get(self, paths: list[str], sd_ops: SDOps | None) -> StateDict | None:
+ with self._lock:
+ return self._state_dicts.get(self._generate_id(paths, sd_ops), None)
+
+ def clear(self) -> None:
+ with self._lock:
+ self._state_dicts.clear()
diff --git a/packages/ltx-core/src/ltx_core/loader/sd_ops.py b/packages/ltx-core/src/ltx_core/loader/sd_ops.py
new file mode 100644
index 0000000..d6caaf2
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/loader/sd_ops.py
@@ -0,0 +1,127 @@
+from dataclasses import dataclass, replace
+from typing import NamedTuple, Protocol
+
+import torch
+
+
+@dataclass(frozen=True, slots=True)
+class ContentReplacement:
+ """
+ Represents a content replacement operation.
+ Used to replace a specific content with a replacement in a state dict key.
+ """
+
+ content: str
+ replacement: str
+
+
+@dataclass(frozen=True, slots=True)
+class ContentMatching:
+ """
+ Represents a content matching operation.
+ Used to match a specific prefix and suffix in a state dict key.
+ """
+
+ prefix: str = ""
+ suffix: str = ""
+
+
+class KeyValueOperationResult(NamedTuple):
+ """
+ Represents the result of a key-value operation.
+ Contains the new key and value after the operation has been applied.
+ """
+
+ new_key: str
+ new_value: torch.Tensor
+
+
+class KeyValueOperation(Protocol):
+ """
+ Protocol for key-value operations.
+ Used to apply operations to a specific key and value in a state dict.
+ """
+
+ def __call__(self, tensor_key: str, tensor_value: torch.Tensor) -> list[KeyValueOperationResult]: ...
+
+
+@dataclass(frozen=True, slots=True)
+class SDKeyValueOperation:
+ """
+ Represents a key-value operation.
+ Used to apply operations to a specific key and value in a state dict.
+ """
+
+ key_matcher: ContentMatching
+ kv_operation: KeyValueOperation
+
+
+@dataclass(frozen=True, slots=True)
+class SDOps:
+ """Immutable class representing state dict key operations."""
+
+ name: str
+ mapping: tuple[
+ ContentReplacement | ContentMatching | SDKeyValueOperation, ...
+ ] = () # Immutable tuple of (key, value) pairs
+
+ def with_replacement(self, content: str, replacement: str) -> "SDOps":
+ """Create a new SDOps instance with the specified replacement added to the mapping."""
+
+ new_mapping = (*self.mapping, ContentReplacement(content, replacement))
+ return replace(self, mapping=new_mapping)
+
+ def with_matching(self, prefix: str = "", suffix: str = "") -> "SDOps":
+ """Create a new SDOps instance with the specified prefix and suffix matching added to the mapping."""
+
+ new_mapping = (*self.mapping, ContentMatching(prefix, suffix))
+ return replace(self, mapping=new_mapping)
+
+ def with_kv_operation(
+ self,
+ operation: KeyValueOperation,
+ key_prefix: str = "",
+ key_suffix: str = "",
+ ) -> "SDOps":
+ """Create a new SDOps instance with the specified value operation added to the mapping."""
+ key_matcher = ContentMatching(key_prefix, key_suffix)
+ sd_kv_operation = SDKeyValueOperation(key_matcher, operation)
+ new_mapping = (*self.mapping, sd_kv_operation)
+ return replace(self, mapping=new_mapping)
+
+ def apply_to_key(self, key: str) -> str | None:
+ """Apply the mapping to the given name."""
+ matchers = [content for content in self.mapping if isinstance(content, ContentMatching)]
+ valid = any(key.startswith(f.prefix) and key.endswith(f.suffix) for f in matchers)
+ if not valid:
+ return None
+
+ for replacement in self.mapping:
+ if not isinstance(replacement, ContentReplacement):
+ continue
+ if replacement.content in key:
+ key = key.replace(replacement.content, replacement.replacement)
+ return key
+
+ def apply_to_key_value(self, key: str, value: torch.Tensor) -> list[KeyValueOperationResult]:
+ """Apply the value operation to the given name and associated value."""
+ for operation in self.mapping:
+ if not isinstance(operation, SDKeyValueOperation):
+ continue
+ if key.startswith(operation.key_matcher.prefix) and key.endswith(operation.key_matcher.suffix):
+ return operation.kv_operation(key, value)
+ return [KeyValueOperationResult(key, value)]
+
+
+# Predefined SDOps instances
+LTXV_LORA_COMFY_RENAMING_MAP = (
+ SDOps("LTXV_LORA_COMFY_PREFIX_MAP").with_matching().with_replacement("diffusion_model.", "")
+)
+
+LTXV_LORA_COMFY_TARGET_MAP = (
+ SDOps("LTXV_LORA_COMFY_TARGET_MAP")
+ .with_matching()
+ .with_replacement("diffusion_model.", "")
+ .with_replacement(".lora_A.weight", ".weight")
+ .with_replacement(".lora_B.weight", ".weight")
+)
diff --git a/packages/ltx-core/src/ltx_core/loader/sft_loader.py b/packages/ltx-core/src/ltx_core/loader/sft_loader.py
new file mode 100644
index 0000000..f9bface
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/loader/sft_loader.py
@@ -0,0 +1,63 @@
+import json
+
+import safetensors
+import torch
+
+from ltx_core.loader.primitives import StateDict, StateDictLoader
+from ltx_core.loader.sd_ops import SDOps
+
+
+class SafetensorsStateDictLoader(StateDictLoader):
+ """
+ Loads weights from safetensors files without metadata support.
+ Use this for loading raw weight files. For model files that include
+ configuration metadata, use SafetensorsModelStateDictLoader instead.
+ """
+
+ def metadata(self, path: str) -> dict:
+ raise NotImplementedError("Not implemented")
+
+ def load(self, path: str | list[str], sd_ops: SDOps, device: torch.device | None = None) -> StateDict:
+ """
+ Load state dict from path or paths (for sharded model storage) and apply sd_ops
+ """
+ sd = {}
+ size = 0
+ dtype = set()
+ device = device or torch.device("cpu")
+ model_paths = path if isinstance(path, list) else [path]
+ for shard_path in model_paths:
+ with safetensors.safe_open(shard_path, framework="pt", device=str(device)) as f:
+ safetensor_keys = f.keys()
+ for name in safetensor_keys:
+ expected_name = name if sd_ops is None else sd_ops.apply_to_key(name)
+ if expected_name is None:
+ continue
+ value = f.get_tensor(name).to(device=device, non_blocking=True, copy=False)
+ key_value_pairs = ((expected_name, value),)
+ if sd_ops is not None:
+ key_value_pairs = sd_ops.apply_to_key_value(expected_name, value)
+ for key, value in key_value_pairs:
+ size += value.nbytes
+ dtype.add(value.dtype)
+ sd[key] = value
+
+ return StateDict(sd=sd, device=device, size=size, dtype=dtype)
+
+
+class SafetensorsModelStateDictLoader(StateDictLoader):
+ """
+ Loads weights and configuration metadata from safetensors model files.
+ Unlike SafetensorsStateDictLoader, this loader can read model configuration
+ from the safetensors file metadata via the metadata() method.
+ """
+
+ def __init__(self, weight_loader: SafetensorsStateDictLoader | None = None):
+ self.weight_loader = weight_loader if weight_loader is not None else SafetensorsStateDictLoader()
+
+ def metadata(self, path: str) -> dict:
+ with safetensors.safe_open(path, framework="pt") as f:
+ return json.loads(f.metadata()["config"])
+
+ def load(self, path: str | list[str], sd_ops: SDOps | None = None, device: torch.device | None = None) -> StateDict:
+ return self.weight_loader.load(path, sd_ops, device)
diff --git a/packages/ltx-core/src/ltx_core/loader/single_gpu_model_builder.py b/packages/ltx-core/src/ltx_core/loader/single_gpu_model_builder.py
new file mode 100644
index 0000000..9e8853a
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/loader/single_gpu_model_builder.py
@@ -0,0 +1,101 @@
+import logging
+from dataclasses import dataclass, field, replace
+from typing import Generic
+
+import torch
+
+from ltx_core.loader.fuse_loras import apply_loras
+from ltx_core.loader.module_ops import ModuleOps
+from ltx_core.loader.primitives import (
+ LoRAAdaptableProtocol,
+ LoraPathStrengthAndSDOps,
+ LoraStateDictWithStrength,
+ ModelBuilderProtocol,
+ StateDict,
+ StateDictLoader,
+)
+from ltx_core.loader.registry import DummyRegistry, Registry
+from ltx_core.loader.sd_ops import SDOps
+from ltx_core.loader.sft_loader import SafetensorsModelStateDictLoader
+from ltx_core.model.model_protocol import ModelConfigurator, ModelType
+
+logger: logging.Logger = logging.getLogger(__name__)
+
+
+@dataclass(frozen=True)
+class SingleGPUModelBuilder(Generic[ModelType], ModelBuilderProtocol[ModelType], LoRAAdaptableProtocol):
+ """
+ Builder for PyTorch models residing on a single GPU.
+ """
+
+ model_class_configurator: type[ModelConfigurator[ModelType]]
+ model_path: str | tuple[str, ...]
+ model_sd_ops: SDOps | None = None
+ module_ops: tuple[ModuleOps, ...] = field(default_factory=tuple)
+ loras: tuple[LoraPathStrengthAndSDOps, ...] = field(default_factory=tuple)
+ model_loader: StateDictLoader = field(default_factory=SafetensorsModelStateDictLoader)
+ registry: Registry = field(default_factory=DummyRegistry)
+
+ def lora(self, lora_path: str, strength: float = 1.0, sd_ops: SDOps | None = None) -> "SingleGPUModelBuilder":
+ return replace(self, loras=(*self.loras, LoraPathStrengthAndSDOps(lora_path, strength, sd_ops)))
+
+ def model_config(self) -> dict:
+ first_shard_path = self.model_path[0] if isinstance(self.model_path, tuple) else self.model_path
+ return self.model_loader.metadata(first_shard_path)
+
+ def meta_model(self, config: dict, module_ops: tuple[ModuleOps, ...]) -> ModelType:
+ with torch.device("meta"):
+ model = self.model_class_configurator.from_config(config)
+ for module_op in module_ops:
+ if module_op.matcher(model):
+ model = module_op.mutator(model)
+ return model
+
+ def load_sd(
+ self, paths: list[str], registry: Registry, device: torch.device | None, sd_ops: SDOps | None = None
+ ) -> StateDict:
+ state_dict = registry.get(paths, sd_ops)
+ if state_dict is None:
+ state_dict = self.model_loader.load(paths, sd_ops=sd_ops, device=device)
+ registry.add(paths, sd_ops=sd_ops, state_dict=state_dict)
+ return state_dict
+
+ def _return_model(self, meta_model: ModelType, device: torch.device) -> ModelType:
+ uninitialized_params = [name for name, param in meta_model.named_parameters() if str(param.device) == "meta"]
+ uninitialized_buffers = [name for name, buffer in meta_model.named_buffers() if str(buffer.device) == "meta"]
+ if uninitialized_params or uninitialized_buffers:
+ logger.warning(f"Uninitialized parameters or buffers: {uninitialized_params + uninitialized_buffers}")
+ return meta_model
+ retval = meta_model.to(device)
+ return retval
+
+ def build(self, device: torch.device | None = None, dtype: torch.dtype | None = None) -> ModelType:
+ device = torch.device("cuda") if device is None else device
+ config = self.model_config()
+ meta_model = self.meta_model(config, self.module_ops)
+ model_paths = self.model_path if isinstance(self.model_path, tuple) else [self.model_path]
+ model_state_dict = self.load_sd(model_paths, sd_ops=self.model_sd_ops, registry=self.registry, device=device)
+
+ lora_strengths = [lora.strength for lora in self.loras]
+ if not lora_strengths or (min(lora_strengths) == 0 and max(lora_strengths) == 0):
+ sd = model_state_dict.sd
+ if dtype is not None:
+ sd = {key: value.to(dtype=dtype) for key, value in model_state_dict.sd.items()}
+ meta_model.load_state_dict(sd, strict=False, assign=True)
+ return self._return_model(meta_model, device)
+
+ lora_state_dicts = [
+ self.load_sd([lora.path], sd_ops=lora.sd_ops, registry=self.registry, device=device) for lora in self.loras
+ ]
+ lora_sd_and_strengths = [
+ LoraStateDictWithStrength(sd, strength)
+ for sd, strength in zip(lora_state_dicts, lora_strengths, strict=True)
+ ]
+ final_sd = apply_loras(
+ model_sd=model_state_dict,
+ lora_sd_and_strengths=lora_sd_and_strengths,
+ dtype=dtype,
+ destination_sd=model_state_dict if isinstance(self.registry, DummyRegistry) else None,
+ )
+ meta_model.load_state_dict(final_sd.sd, strict=False, assign=True)
+ return self._return_model(meta_model, device)
diff --git a/packages/ltx-core/src/ltx_core/model/__init__.py b/packages/ltx-core/src/ltx_core/model/__init__.py
new file mode 100644
index 0000000..e8a5b27
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/__init__.py
@@ -0,0 +1,8 @@
+"""Model definitions for LTX-2."""
+
+from ltx_core.model.model_protocol import ModelConfigurator, ModelType
+
+__all__ = [
+ "ModelConfigurator",
+ "ModelType",
+]
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/__init__.py b/packages/ltx-core/src/ltx_core/model/audio_vae/__init__.py
new file mode 100644
index 0000000..d515d11
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/__init__.py
@@ -0,0 +1,27 @@
+"""Audio VAE model components."""
+
+from ltx_core.model.audio_vae.audio_vae import AudioDecoder, AudioEncoder, decode_audio
+from ltx_core.model.audio_vae.model_configurator import (
+ AUDIO_VAE_DECODER_COMFY_KEYS_FILTER,
+ AUDIO_VAE_ENCODER_COMFY_KEYS_FILTER,
+ VOCODER_COMFY_KEYS_FILTER,
+ AudioDecoderConfigurator,
+ AudioEncoderConfigurator,
+ VocoderConfigurator,
+)
+from ltx_core.model.audio_vae.ops import AudioProcessor
+from ltx_core.model.audio_vae.vocoder import Vocoder
+
+__all__ = [
+ "AUDIO_VAE_DECODER_COMFY_KEYS_FILTER",
+ "AUDIO_VAE_ENCODER_COMFY_KEYS_FILTER",
+ "VOCODER_COMFY_KEYS_FILTER",
+ "AudioDecoder",
+ "AudioDecoderConfigurator",
+ "AudioEncoder",
+ "AudioEncoderConfigurator",
+ "AudioProcessor",
+ "Vocoder",
+ "VocoderConfigurator",
+ "decode_audio",
+]
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/attention.py b/packages/ltx-core/src/ltx_core/model/audio_vae/attention.py
new file mode 100644
index 0000000..46d5ebb
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/attention.py
@@ -0,0 +1,71 @@
+from enum import Enum
+
+import torch
+
+from ltx_core.model.common.normalization import NormType, build_normalization_layer
+
+
+class AttentionType(Enum):
+ """Enum for specifying the attention mechanism type."""
+
+ VANILLA = "vanilla"
+ LINEAR = "linear"
+ NONE = "none"
+
+
+class AttnBlock(torch.nn.Module):
+ def __init__(
+ self,
+ in_channels: int,
+ norm_type: NormType = NormType.GROUP,
+ ) -> None:
+ super().__init__()
+ self.in_channels = in_channels
+
+ self.norm = build_normalization_layer(in_channels, normtype=norm_type)
+ self.q = torch.nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0)
+ self.k = torch.nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0)
+ self.v = torch.nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0)
+ self.proj_out = torch.nn.Conv2d(in_channels, in_channels, kernel_size=1, stride=1, padding=0)
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ h_ = x
+ h_ = self.norm(h_)
+ q = self.q(h_)
+ k = self.k(h_)
+ v = self.v(h_)
+
+ # compute attention
+ b, c, h, w = q.shape
+ q = q.reshape(b, c, h * w).contiguous()
+ q = q.permute(0, 2, 1).contiguous() # b,hw,c
+ k = k.reshape(b, c, h * w).contiguous() # b,c,hw
+ w_ = torch.bmm(q, k).contiguous() # b,hw,hw w[b,i,j]=sum_c q[b,i,c]k[b,c,j]
+ w_ = w_ * (int(c) ** (-0.5))
+ w_ = torch.nn.functional.softmax(w_, dim=2)
+
+ # attend to values
+ v = v.reshape(b, c, h * w).contiguous()
+ w_ = w_.permute(0, 2, 1).contiguous() # b,hw,hw (first hw of k, second of q)
+ h_ = torch.bmm(v, w_).contiguous() # b, c,hw (hw of q) h_[b,c,j] = sum_i v[b,c,i] w_[b,i,j]
+ h_ = h_.reshape(b, c, h, w).contiguous()
+
+ h_ = self.proj_out(h_)
+
+ return x + h_
+
+
+def make_attn(
+ in_channels: int,
+ attn_type: AttentionType = AttentionType.VANILLA,
+ norm_type: NormType = NormType.GROUP,
+) -> torch.nn.Module:
+ match attn_type:
+ case AttentionType.VANILLA:
+ return AttnBlock(in_channels, norm_type=norm_type)
+ case AttentionType.NONE:
+ return torch.nn.Identity()
+ case AttentionType.LINEAR:
+ raise NotImplementedError(f"Attention type {attn_type.value} is not supported yet.")
+ case _:
+ raise ValueError(f"Unknown attention type: {attn_type}")
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/audio_vae.py b/packages/ltx-core/src/ltx_core/model/audio_vae/audio_vae.py
new file mode 100644
index 0000000..b6f6d17
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/audio_vae.py
@@ -0,0 +1,480 @@
+from typing import Set, Tuple
+
+import torch
+import torch.nn.functional as F
+
+from ltx_core.components.patchifiers import AudioPatchifier
+from ltx_core.model.audio_vae.attention import AttentionType, make_attn
+from ltx_core.model.audio_vae.causal_conv_2d import make_conv2d
+from ltx_core.model.audio_vae.causality_axis import CausalityAxis
+from ltx_core.model.audio_vae.downsample import build_downsampling_path
+from ltx_core.model.audio_vae.ops import PerChannelStatistics
+from ltx_core.model.audio_vae.resnet import ResnetBlock
+from ltx_core.model.audio_vae.upsample import build_upsampling_path
+from ltx_core.model.audio_vae.vocoder import Vocoder
+from ltx_core.model.common.normalization import NormType, build_normalization_layer
+from ltx_core.types import AudioLatentShape
+
+LATENT_DOWNSAMPLE_FACTOR = 4
+
+
+def build_mid_block(
+ channels: int,
+ temb_channels: int,
+ dropout: float,
+ norm_type: NormType,
+ causality_axis: CausalityAxis,
+ attn_type: AttentionType,
+ add_attention: bool,
+) -> torch.nn.Module:
+ """Build the middle block with two ResNet blocks and optional attention."""
+ mid = torch.nn.Module()
+ mid.block_1 = ResnetBlock(
+ in_channels=channels,
+ out_channels=channels,
+ temb_channels=temb_channels,
+ dropout=dropout,
+ norm_type=norm_type,
+ causality_axis=causality_axis,
+ )
+ mid.attn_1 = make_attn(channels, attn_type=attn_type, norm_type=norm_type) if add_attention else torch.nn.Identity()
+ mid.block_2 = ResnetBlock(
+ in_channels=channels,
+ out_channels=channels,
+ temb_channels=temb_channels,
+ dropout=dropout,
+ norm_type=norm_type,
+ causality_axis=causality_axis,
+ )
+ return mid
+
+
+def run_mid_block(mid: torch.nn.Module, features: torch.Tensor) -> torch.Tensor:
+ """Run features through the middle block."""
+ features = mid.block_1(features, temb=None)
+ features = mid.attn_1(features)
+ return mid.block_2(features, temb=None)
+
+
+class AudioEncoder(torch.nn.Module):
+ """
+ Encoder that compresses audio spectrograms into latent representations.
+ The encoder uses a series of downsampling blocks with residual connections,
+ attention mechanisms, and configurable causal convolutions.
+ """
+
+ def __init__( # noqa: PLR0913
+ self,
+ *,
+ ch: int,
+ ch_mult: Tuple[int, ...] = (1, 2, 4, 8),
+ num_res_blocks: int,
+ attn_resolutions: Set[int],
+ dropout: float = 0.0,
+ resamp_with_conv: bool = True,
+ in_channels: int,
+ resolution: int,
+ z_channels: int,
+ double_z: bool = True,
+ attn_type: AttentionType = AttentionType.VANILLA,
+ mid_block_add_attention: bool = True,
+ norm_type: NormType = NormType.GROUP,
+ causality_axis: CausalityAxis = CausalityAxis.WIDTH,
+ sample_rate: int = 16000,
+ mel_hop_length: int = 160,
+ n_fft: int = 1024,
+ is_causal: bool = True,
+ mel_bins: int = 64,
+ **_ignore_kwargs,
+ ) -> None:
+ """
+ Initialize the Encoder.
+ Args:
+ Arguments are configuration parameters, loaded from the audio VAE checkpoint config
+ (audio_vae.model.params.ddconfig):
+ ch: Base number of feature channels used in the first convolution layer.
+ ch_mult: Multiplicative factors for the number of channels at each resolution level.
+ num_res_blocks: Number of residual blocks to use at each resolution level.
+ attn_resolutions: Spatial resolutions (e.g., in time/frequency) at which to apply attention.
+ resolution: Input spatial resolution of the spectrogram (height, width).
+ z_channels: Number of channels in the latent representation.
+ norm_type: Normalization layer type to use within the network (e.g., group, batch).
+ causality_axis: Axis along which convolutions should be causal (e.g., time axis).
+ sample_rate: Audio sample rate in Hz for the input signals.
+ mel_hop_length: Hop length used when computing the mel spectrogram.
+ n_fft: FFT size used to compute the spectrogram.
+ mel_bins: Number of mel-frequency bins in the input spectrogram.
+ in_channels: Number of channels in the input spectrogram tensor.
+ double_z: If True, predict both mean and log-variance (doubling latent channels).
+ is_causal: If True, use causal convolutions suitable for streaming setups.
+ dropout: Dropout probability used in residual and mid blocks.
+ attn_type: Type of attention mechanism to use in attention blocks.
+ resamp_with_conv: If True, perform resolution changes using strided convolutions.
+ mid_block_add_attention: If True, add an attention block in the mid-level of the encoder.
+ """
+ super().__init__()
+
+ self.per_channel_statistics = PerChannelStatistics(latent_channels=ch)
+ self.sample_rate = sample_rate
+ self.mel_hop_length = mel_hop_length
+ self.n_fft = n_fft
+ self.is_causal = is_causal
+ self.mel_bins = mel_bins
+
+ self.patchifier = AudioPatchifier(
+ patch_size=1,
+ audio_latent_downsample_factor=LATENT_DOWNSAMPLE_FACTOR,
+ sample_rate=sample_rate,
+ hop_length=mel_hop_length,
+ is_causal=is_causal,
+ )
+
+ self.ch = ch
+ self.temb_ch = 0
+ self.num_resolutions = len(ch_mult)
+ self.num_res_blocks = num_res_blocks
+ self.resolution = resolution
+ self.in_channels = in_channels
+ self.z_channels = z_channels
+ self.double_z = double_z
+ self.norm_type = norm_type
+ self.causality_axis = causality_axis
+ self.attn_type = attn_type
+
+ # downsampling
+ self.conv_in = make_conv2d(
+ in_channels,
+ self.ch,
+ kernel_size=3,
+ stride=1,
+ causality_axis=self.causality_axis,
+ )
+
+ self.non_linearity = torch.nn.SiLU()
+
+ self.down, block_in = build_downsampling_path(
+ ch=ch,
+ ch_mult=ch_mult,
+ num_resolutions=self.num_resolutions,
+ num_res_blocks=num_res_blocks,
+ resolution=resolution,
+ temb_channels=self.temb_ch,
+ dropout=dropout,
+ norm_type=self.norm_type,
+ causality_axis=self.causality_axis,
+ attn_type=self.attn_type,
+ attn_resolutions=attn_resolutions,
+ resamp_with_conv=resamp_with_conv,
+ )
+
+ self.mid = build_mid_block(
+ channels=block_in,
+ temb_channels=self.temb_ch,
+ dropout=dropout,
+ norm_type=self.norm_type,
+ causality_axis=self.causality_axis,
+ attn_type=self.attn_type,
+ add_attention=mid_block_add_attention,
+ )
+
+ self.norm_out = build_normalization_layer(block_in, normtype=self.norm_type)
+ self.conv_out = make_conv2d(
+ block_in,
+ 2 * z_channels if double_z else z_channels,
+ kernel_size=3,
+ stride=1,
+ causality_axis=self.causality_axis,
+ )
+
+ def forward(self, spectrogram: torch.Tensor) -> torch.Tensor:
+ """
+ Encode audio spectrogram into latent representations.
+ Args:
+ spectrogram: Input spectrogram of shape (batch, channels, time, frequency)
+ Returns:
+ Encoded latent representation of shape (batch, channels, frames, mel_bins)
+ """
+ h = self.conv_in(spectrogram)
+ h = self._run_downsampling_path(h)
+ h = run_mid_block(self.mid, h)
+ h = self._finalize_output(h)
+
+ return self._normalize_latents(h)
+
+ def _run_downsampling_path(self, h: torch.Tensor) -> torch.Tensor:
+ for level in range(self.num_resolutions):
+ stage = self.down[level]
+ for block_idx in range(self.num_res_blocks):
+ h = stage.block[block_idx](h, temb=None)
+ if stage.attn:
+ h = stage.attn[block_idx](h)
+
+ if level != self.num_resolutions - 1:
+ h = stage.downsample(h)
+
+ return h
+
+ def _finalize_output(self, h: torch.Tensor) -> torch.Tensor:
+ h = self.norm_out(h)
+ h = self.non_linearity(h)
+ return self.conv_out(h)
+
+ def _normalize_latents(self, latent_output: torch.Tensor) -> torch.Tensor:
+ """
+ Normalize encoder latents using per-channel statistics.
+ When the encoder is configured with ``double_z=True``, the final
+ convolution produces twice the number of latent channels, typically
+ interpreted as two concatenated tensors along the channel dimension
+ (e.g., mean and variance or other auxiliary parameters).
+ This method intentionally uses only the first half of the channels
+ (the "mean" component) as input to the patchifier and normalization
+ logic. The remaining channels are left unchanged by this method and
+ are expected to be consumed elsewhere in the VAE pipeline.
+ If ``double_z=False``, the encoder output already contains only the
+ mean latents and the chunking operation simply returns that tensor.
+ """
+ means = torch.chunk(latent_output, 2, dim=1)[0]
+ latent_shape = AudioLatentShape(
+ batch=means.shape[0],
+ channels=means.shape[1],
+ frames=means.shape[2],
+ mel_bins=means.shape[3],
+ )
+ latent_patched = self.patchifier.patchify(means)
+ latent_normalized = self.per_channel_statistics.normalize(latent_patched)
+ return self.patchifier.unpatchify(latent_normalized, latent_shape)
+
+
+class AudioDecoder(torch.nn.Module):
+ """
+ Symmetric decoder that reconstructs audio spectrograms from latent features.
+ The decoder mirrors the encoder structure with configurable channel multipliers,
+ attention resolutions, and causal convolutions.
+ """
+
+ def __init__( # noqa: PLR0913
+ self,
+ *,
+ ch: int,
+ out_ch: int,
+ ch_mult: Tuple[int, ...] = (1, 2, 4, 8),
+ num_res_blocks: int,
+ attn_resolutions: Set[int],
+ resolution: int,
+ z_channels: int,
+ norm_type: NormType = NormType.GROUP,
+ causality_axis: CausalityAxis = CausalityAxis.WIDTH,
+ dropout: float = 0.0,
+ mid_block_add_attention: bool = True,
+ sample_rate: int = 16000,
+ mel_hop_length: int = 160,
+ is_causal: bool = True,
+ mel_bins: int | None = None,
+ ) -> None:
+ """
+ Initialize the Decoder.
+ Args:
+ Arguments are configuration parameters, loaded from the audio VAE checkpoint config
+ (audio_vae.model.params.ddconfig):
+ - ch, out_ch, ch_mult, num_res_blocks, attn_resolutions
+ - resolution, z_channels
+ - norm_type, causality_axis
+ """
+ super().__init__()
+
+ # Internal behavioural defaults that are not driven by the checkpoint.
+ resamp_with_conv = True
+ attn_type = AttentionType.VANILLA
+
+ # Per-channel statistics for denormalizing latents
+ self.per_channel_statistics = PerChannelStatistics(latent_channels=ch)
+ self.sample_rate = sample_rate
+ self.mel_hop_length = mel_hop_length
+ self.is_causal = is_causal
+ self.mel_bins = mel_bins
+ self.patchifier = AudioPatchifier(
+ patch_size=1,
+ audio_latent_downsample_factor=LATENT_DOWNSAMPLE_FACTOR,
+ sample_rate=sample_rate,
+ hop_length=mel_hop_length,
+ is_causal=is_causal,
+ )
+
+ self.ch = ch
+ self.temb_ch = 0
+ self.num_resolutions = len(ch_mult)
+ self.num_res_blocks = num_res_blocks
+ self.resolution = resolution
+ self.out_ch = out_ch
+ self.give_pre_end = False
+ self.tanh_out = False
+ self.norm_type = norm_type
+ self.z_channels = z_channels
+ self.channel_multipliers = ch_mult
+ self.attn_resolutions = attn_resolutions
+ self.causality_axis = causality_axis
+ self.attn_type = attn_type
+
+ base_block_channels = ch * self.channel_multipliers[-1]
+ base_resolution = resolution // (2 ** (self.num_resolutions - 1))
+ self.z_shape = (1, z_channels, base_resolution, base_resolution)
+
+ self.conv_in = make_conv2d(
+ z_channels, base_block_channels, kernel_size=3, stride=1, causality_axis=self.causality_axis
+ )
+ self.non_linearity = torch.nn.SiLU()
+ self.mid = build_mid_block(
+ channels=base_block_channels,
+ temb_channels=self.temb_ch,
+ dropout=dropout,
+ norm_type=self.norm_type,
+ causality_axis=self.causality_axis,
+ attn_type=self.attn_type,
+ add_attention=mid_block_add_attention,
+ )
+ self.up, final_block_channels = build_upsampling_path(
+ ch=ch,
+ ch_mult=ch_mult,
+ num_resolutions=self.num_resolutions,
+ num_res_blocks=num_res_blocks,
+ resolution=resolution,
+ temb_channels=self.temb_ch,
+ dropout=dropout,
+ norm_type=self.norm_type,
+ causality_axis=self.causality_axis,
+ attn_type=self.attn_type,
+ attn_resolutions=attn_resolutions,
+ resamp_with_conv=resamp_with_conv,
+ initial_block_channels=base_block_channels,
+ )
+
+ self.norm_out = build_normalization_layer(final_block_channels, normtype=self.norm_type)
+ self.conv_out = make_conv2d(
+ final_block_channels, out_ch, kernel_size=3, stride=1, causality_axis=self.causality_axis
+ )
+
+ def forward(self, sample: torch.Tensor) -> torch.Tensor:
+ """
+ Decode latent features back to audio spectrograms.
+ Args:
+ sample: Encoded latent representation of shape (batch, channels, frames, mel_bins)
+ Returns:
+ Reconstructed audio spectrogram of shape (batch, channels, time, frequency)
+ """
+ sample, target_shape = self._denormalize_latents(sample)
+
+ h = self.conv_in(sample)
+ h = run_mid_block(self.mid, h)
+ h = self._run_upsampling_path(h)
+ h = self._finalize_output(h)
+
+ return self._adjust_output_shape(h, target_shape)
+
+ def _denormalize_latents(self, sample: torch.Tensor) -> tuple[torch.Tensor, AudioLatentShape]:
+ latent_shape = AudioLatentShape(
+ batch=sample.shape[0],
+ channels=sample.shape[1],
+ frames=sample.shape[2],
+ mel_bins=sample.shape[3],
+ )
+
+ sample_patched = self.patchifier.patchify(sample)
+ sample_denormalized = self.per_channel_statistics.un_normalize(sample_patched)
+ sample = self.patchifier.unpatchify(sample_denormalized, latent_shape)
+
+ target_frames = latent_shape.frames * LATENT_DOWNSAMPLE_FACTOR
+ if self.causality_axis != CausalityAxis.NONE:
+ target_frames = max(target_frames - (LATENT_DOWNSAMPLE_FACTOR - 1), 1)
+
+ target_shape = AudioLatentShape(
+ batch=latent_shape.batch,
+ channels=self.out_ch,
+ frames=target_frames,
+ mel_bins=self.mel_bins if self.mel_bins is not None else latent_shape.mel_bins,
+ )
+
+ return sample, target_shape
+
+ def _adjust_output_shape(
+ self,
+ decoded_output: torch.Tensor,
+ target_shape: AudioLatentShape,
+ ) -> torch.Tensor:
+ """
+ Adjust output shape to match target dimensions for variable-length audio.
+ This function handles the common case where decoded audio spectrograms need to be
+ resized to match a specific target shape.
+ Args:
+ decoded_output: Tensor of shape (batch, channels, time, frequency)
+ target_shape: AudioLatentShape describing (batch, channels, time, mel bins)
+ Returns:
+ Tensor adjusted to match target_shape exactly
+ """
+ # Current output shape: (batch, channels, time, frequency)
+ _, _, current_time, current_freq = decoded_output.shape
+ target_channels = target_shape.channels
+ target_time = target_shape.frames
+ target_freq = target_shape.mel_bins
+
+ # Step 1: Crop first to avoid exceeding target dimensions
+ decoded_output = decoded_output[
+ :, :target_channels, : min(current_time, target_time), : min(current_freq, target_freq)
+ ]
+
+ # Step 2: Calculate padding needed for time and frequency dimensions
+ time_padding_needed = target_time - decoded_output.shape[2]
+ freq_padding_needed = target_freq - decoded_output.shape[3]
+
+ # Step 3: Apply padding if needed
+ if time_padding_needed > 0 or freq_padding_needed > 0:
+ # PyTorch padding format: (pad_left, pad_right, pad_top, pad_bottom)
+ # For audio: pad_left/right = frequency, pad_top/bottom = time
+ padding = (
+ 0,
+ max(freq_padding_needed, 0), # frequency padding (left, right)
+ 0,
+ max(time_padding_needed, 0), # time padding (top, bottom)
+ )
+ decoded_output = F.pad(decoded_output, padding)
+
+ # Step 4: Final safety crop to ensure exact target shape
+ decoded_output = decoded_output[:, :target_channels, :target_time, :target_freq]
+
+ return decoded_output
+
+ def _run_upsampling_path(self, h: torch.Tensor) -> torch.Tensor:
+ for level in reversed(range(self.num_resolutions)):
+ stage = self.up[level]
+ for block_idx, block in enumerate(stage.block):
+ h = block(h, temb=None)
+ if stage.attn:
+ h = stage.attn[block_idx](h)
+
+ if level != 0 and hasattr(stage, "upsample"):
+ h = stage.upsample(h)
+
+ return h
+
+ def _finalize_output(self, h: torch.Tensor) -> torch.Tensor:
+ if self.give_pre_end:
+ return h
+
+ h = self.norm_out(h)
+ h = self.non_linearity(h)
+ h = self.conv_out(h)
+ return torch.tanh(h) if self.tanh_out else h
+
+
+def decode_audio(latent: torch.Tensor, audio_decoder: "AudioDecoder", vocoder: "Vocoder") -> torch.Tensor:
+ """
+ Decode an audio latent representation using the provided audio decoder and vocoder.
+ Args:
+ latent: Input audio latent tensor.
+ audio_decoder: Model to decode the latent to waveform features.
+ vocoder: Model to convert decoded features to audio waveform.
+ Returns:
+ Decoded audio as a float tensor.
+ """
+ decoded_audio = audio_decoder(latent)
+ decoded_audio = vocoder(decoded_audio).squeeze(0).float()
+ return decoded_audio
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/causal_conv_2d.py b/packages/ltx-core/src/ltx_core/model/audio_vae/causal_conv_2d.py
new file mode 100644
index 0000000..efb6386
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/causal_conv_2d.py
@@ -0,0 +1,110 @@
+import torch
+import torch.nn.functional as F
+
+from ltx_core.model.audio_vae.causality_axis import CausalityAxis
+
+
+class CausalConv2d(torch.nn.Module):
+ """
+ A causal 2D convolution.
+ This layer ensures that the output at time `t` only depends on inputs
+ at time `t` and earlier. It achieves this by applying asymmetric padding
+ to the time dimension (width) before the convolution.
+ """
+
+ def __init__(
+ self,
+ in_channels: int,
+ out_channels: int,
+ kernel_size: int | tuple[int, int],
+ stride: int = 1,
+ dilation: int | tuple[int, int] = 1,
+ groups: int = 1,
+ bias: bool = True,
+ causality_axis: CausalityAxis = CausalityAxis.HEIGHT,
+ ) -> None:
+ super().__init__()
+
+ self.causality_axis = causality_axis
+
+ # Ensure kernel_size and dilation are tuples
+ kernel_size = torch.nn.modules.utils._pair(kernel_size)
+ dilation = torch.nn.modules.utils._pair(dilation)
+
+ # Calculate padding dimensions
+ pad_h = (kernel_size[0] - 1) * dilation[0]
+ pad_w = (kernel_size[1] - 1) * dilation[1]
+
+ # The padding tuple for F.pad is (pad_left, pad_right, pad_top, pad_bottom)
+ match self.causality_axis:
+ case CausalityAxis.NONE:
+ self.padding = (pad_w // 2, pad_w - pad_w // 2, pad_h // 2, pad_h - pad_h // 2)
+ case CausalityAxis.WIDTH | CausalityAxis.WIDTH_COMPATIBILITY:
+ self.padding = (pad_w, 0, pad_h // 2, pad_h - pad_h // 2)
+ case CausalityAxis.HEIGHT:
+ self.padding = (pad_w // 2, pad_w - pad_w // 2, pad_h, 0)
+ case _:
+ raise ValueError(f"Invalid causality_axis: {causality_axis}")
+
+ # The internal convolution layer uses no padding, as we handle it manually
+ self.conv = torch.nn.Conv2d(
+ in_channels,
+ out_channels,
+ kernel_size,
+ stride=stride,
+ padding=0,
+ dilation=dilation,
+ groups=groups,
+ bias=bias,
+ )
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ # Apply causal padding before convolution
+ x = F.pad(x, self.padding)
+ return self.conv(x)
+
+
+def make_conv2d(
+ in_channels: int,
+ out_channels: int,
+ kernel_size: int | tuple[int, int],
+ stride: int = 1,
+ padding: tuple[int, int, int, int] | None = None,
+ dilation: int = 1,
+ groups: int = 1,
+ bias: bool = True,
+ causality_axis: CausalityAxis | None = None,
+) -> torch.nn.Module:
+ """
+ Create a 2D convolution layer that can be either causal or non-causal.
+ Args:
+ in_channels: Number of input channels
+ out_channels: Number of output channels
+ kernel_size: Size of the convolution kernel
+ stride: Convolution stride
+ padding: Padding (if None, will be calculated based on causal flag)
+ dilation: Dilation rate
+ groups: Number of groups for grouped convolution
+ bias: Whether to use bias
+ causality_axis: Dimension along which to apply causality.
+ Returns:
+ Either a regular Conv2d or CausalConv2d layer
+ """
+ if causality_axis is not None:
+ # For causal convolution, padding is handled internally by CausalConv2d
+ return CausalConv2d(in_channels, out_channels, kernel_size, stride, dilation, groups, bias, causality_axis)
+ else:
+ # For non-causal convolution, use symmetric padding if not specified
+ if padding is None:
+ padding = kernel_size // 2 if isinstance(kernel_size, int) else tuple(k // 2 for k in kernel_size)
+
+ return torch.nn.Conv2d(
+ in_channels,
+ out_channels,
+ kernel_size,
+ stride,
+ padding,
+ dilation,
+ groups,
+ bias,
+ )
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/causality_axis.py b/packages/ltx-core/src/ltx_core/model/audio_vae/causality_axis.py
new file mode 100644
index 0000000..b99f835
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/causality_axis.py
@@ -0,0 +1,10 @@
+from enum import Enum
+
+
+class CausalityAxis(Enum):
+ """Enum for specifying the causality axis in causal convolutions."""
+
+ NONE = None
+ WIDTH = "width"
+ HEIGHT = "height"
+ WIDTH_COMPATIBILITY = "width-compatibility"
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/downsample.py b/packages/ltx-core/src/ltx_core/model/audio_vae/downsample.py
new file mode 100644
index 0000000..336735b
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/downsample.py
@@ -0,0 +1,110 @@
+from typing import Set, Tuple
+
+import torch
+
+from ltx_core.model.audio_vae.attention import AttentionType, make_attn
+from ltx_core.model.audio_vae.causality_axis import CausalityAxis
+from ltx_core.model.audio_vae.resnet import ResnetBlock
+from ltx_core.model.common.normalization import NormType
+
+
+class Downsample(torch.nn.Module):
+ """
+ A downsampling layer that can use either a strided convolution
+ or average pooling. Supports standard and causal padding for the
+ convolutional mode.
+ """
+
+ def __init__(
+ self,
+ in_channels: int,
+ with_conv: bool,
+ causality_axis: CausalityAxis = CausalityAxis.WIDTH,
+ ) -> None:
+ super().__init__()
+ self.with_conv = with_conv
+ self.causality_axis = causality_axis
+
+ if self.causality_axis != CausalityAxis.NONE and not self.with_conv:
+ raise ValueError("causality is only supported when `with_conv=True`.")
+
+ if self.with_conv:
+ # Do time downsampling here
+ # no asymmetric padding in torch conv, must do it ourselves
+ self.conv = torch.nn.Conv2d(in_channels, in_channels, kernel_size=3, stride=2, padding=0)
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ if self.with_conv:
+ # Padding tuple is in the order: (left, right, top, bottom).
+ match self.causality_axis:
+ case CausalityAxis.NONE:
+ pad = (0, 1, 0, 1)
+ case CausalityAxis.WIDTH:
+ pad = (2, 0, 0, 1)
+ case CausalityAxis.HEIGHT:
+ pad = (0, 1, 2, 0)
+ case CausalityAxis.WIDTH_COMPATIBILITY:
+ pad = (1, 0, 0, 1)
+ case _:
+ raise ValueError(f"Invalid causality_axis: {self.causality_axis}")
+
+ x = torch.nn.functional.pad(x, pad, mode="constant", value=0)
+ x = self.conv(x)
+ else:
+ # This branch is only taken if with_conv=False, which implies causality_axis is NONE.
+ x = torch.nn.functional.avg_pool2d(x, kernel_size=2, stride=2)
+
+ return x
+
+
+def build_downsampling_path( # noqa: PLR0913
+ *,
+ ch: int,
+ ch_mult: Tuple[int, ...],
+ num_resolutions: int,
+ num_res_blocks: int,
+ resolution: int,
+ temb_channels: int,
+ dropout: float,
+ norm_type: NormType,
+ causality_axis: CausalityAxis,
+ attn_type: AttentionType,
+ attn_resolutions: Set[int],
+ resamp_with_conv: bool,
+) -> tuple[torch.nn.ModuleList, int]:
+ """Build the downsampling path with residual blocks, attention, and downsampling layers."""
+ down_modules = torch.nn.ModuleList()
+ curr_res = resolution
+ in_ch_mult = (1, *tuple(ch_mult))
+ block_in = ch
+
+ for i_level in range(num_resolutions):
+ block = torch.nn.ModuleList()
+ attn = torch.nn.ModuleList()
+ block_in = ch * in_ch_mult[i_level]
+ block_out = ch * ch_mult[i_level]
+
+ for _ in range(num_res_blocks):
+ block.append(
+ ResnetBlock(
+ in_channels=block_in,
+ out_channels=block_out,
+ temb_channels=temb_channels,
+ dropout=dropout,
+ norm_type=norm_type,
+ causality_axis=causality_axis,
+ )
+ )
+ block_in = block_out
+ if curr_res in attn_resolutions:
+ attn.append(make_attn(block_in, attn_type=attn_type, norm_type=norm_type))
+
+ down = torch.nn.Module()
+ down.block = block
+ down.attn = attn
+ if i_level != num_resolutions - 1:
+ down.downsample = Downsample(block_in, resamp_with_conv, causality_axis=causality_axis)
+ curr_res = curr_res // 2
+ down_modules.append(down)
+
+ return down_modules, block_in
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/model_configurator.py b/packages/ltx-core/src/ltx_core/model/audio_vae/model_configurator.py
new file mode 100644
index 0000000..62f85d4
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/model_configurator.py
@@ -0,0 +1,123 @@
+from ltx_core.loader.sd_ops import SDOps
+from ltx_core.model.audio_vae.attention import AttentionType
+from ltx_core.model.audio_vae.audio_vae import AudioDecoder, AudioEncoder
+from ltx_core.model.audio_vae.causality_axis import CausalityAxis
+from ltx_core.model.audio_vae.vocoder import Vocoder
+from ltx_core.model.common.normalization import NormType
+from ltx_core.model.model_protocol import ModelConfigurator
+
+
+class VocoderConfigurator(ModelConfigurator[Vocoder]):
+ @classmethod
+ def from_config(cls: type[Vocoder], config: dict) -> Vocoder:
+ config = config.get("vocoder", {})
+ return Vocoder(
+ resblock_kernel_sizes=config.get("resblock_kernel_sizes", [3, 7, 11]),
+ upsample_rates=config.get("upsample_rates", [6, 5, 2, 2, 2]),
+ upsample_kernel_sizes=config.get("upsample_kernel_sizes", [16, 15, 8, 4, 4]),
+ resblock_dilation_sizes=config.get("resblock_dilation_sizes", [[1, 3, 5], [1, 3, 5], [1, 3, 5]]),
+ upsample_initial_channel=config.get("upsample_initial_channel", 1024),
+ stereo=config.get("stereo", True),
+ resblock=config.get("resblock", "1"),
+ output_sample_rate=config.get("output_sample_rate", 24000),
+ )
+
+
+VOCODER_COMFY_KEYS_FILTER = (
+ SDOps("VOCODER_COMFY_KEYS_FILTER").with_matching(prefix="vocoder.").with_replacement("vocoder.", "")
+)
+
+
+class AudioDecoderConfigurator(ModelConfigurator[AudioDecoder]):
+ @classmethod
+ def from_config(cls: type[AudioDecoder], config: dict) -> AudioDecoder:
+ audio_vae_cfg = config.get("audio_vae", {})
+ model_cfg = audio_vae_cfg.get("model", {})
+ model_params = model_cfg.get("params", {})
+ ddconfig = model_params.get("ddconfig", {})
+ preprocessing_cfg = audio_vae_cfg.get("preprocessing", {})
+ stft_cfg = preprocessing_cfg.get("stft", {})
+ mel_cfg = preprocessing_cfg.get("mel", {})
+ variables_cfg = audio_vae_cfg.get("variables", {})
+
+ sample_rate = model_params.get("sampling_rate", 16000)
+ mel_hop_length = stft_cfg.get("hop_length", 160)
+ is_causal = stft_cfg.get("causal", True)
+ mel_bins = ddconfig.get("mel_bins") or mel_cfg.get("n_mel_channels") or variables_cfg.get("mel_bins")
+
+ return AudioDecoder(
+ ch=ddconfig.get("ch", 128),
+ out_ch=ddconfig.get("out_ch", 2),
+ ch_mult=tuple(ddconfig.get("ch_mult", (1, 2, 4))),
+ num_res_blocks=ddconfig.get("num_res_blocks", 2),
+ attn_resolutions=ddconfig.get("attn_resolutions", {8, 16, 32}),
+ resolution=ddconfig.get("resolution", 256),
+ z_channels=ddconfig.get("z_channels", 8),
+ norm_type=NormType(ddconfig.get("norm_type", "pixel")),
+ causality_axis=CausalityAxis(ddconfig.get("causality_axis", "height")),
+ dropout=ddconfig.get("dropout", 0.0),
+ mid_block_add_attention=ddconfig.get("mid_block_add_attention", True),
+ sample_rate=sample_rate,
+ mel_hop_length=mel_hop_length,
+ is_causal=is_causal,
+ mel_bins=mel_bins,
+ )
+
+
+class AudioEncoderConfigurator(ModelConfigurator[AudioEncoder]):
+ @classmethod
+ def from_config(cls: type[AudioEncoder], config: dict) -> AudioEncoder:
+ audio_vae_cfg = config.get("audio_vae", {})
+ model_cfg = audio_vae_cfg.get("model", {})
+ model_params = model_cfg.get("params", {})
+ ddconfig = model_params.get("ddconfig", {})
+ preprocessing_cfg = audio_vae_cfg.get("preprocessing", {})
+ stft_cfg = preprocessing_cfg.get("stft", {})
+ mel_cfg = preprocessing_cfg.get("mel", {})
+ variables_cfg = audio_vae_cfg.get("variables", {})
+
+ sample_rate = model_params.get("sampling_rate", 16000)
+ mel_hop_length = stft_cfg.get("hop_length", 160)
+ n_fft = stft_cfg.get("filter_length", 1024)
+ is_causal = stft_cfg.get("causal", True)
+ mel_bins = ddconfig.get("mel_bins") or mel_cfg.get("n_mel_channels") or variables_cfg.get("mel_bins")
+
+ return AudioEncoder(
+ ch=ddconfig.get("ch", 128),
+ ch_mult=tuple(ddconfig.get("ch_mult", (1, 2, 4))),
+ num_res_blocks=ddconfig.get("num_res_blocks", 2),
+ attn_resolutions=ddconfig.get("attn_resolutions", {8, 16, 32}),
+ resolution=ddconfig.get("resolution", 256),
+ z_channels=ddconfig.get("z_channels", 8),
+ double_z=ddconfig.get("double_z", True),
+ dropout=ddconfig.get("dropout", 0.0),
+ resamp_with_conv=ddconfig.get("resamp_with_conv", True),
+ in_channels=ddconfig.get("in_channels", 2),
+ attn_type=AttentionType(ddconfig.get("attn_type", "vanilla")),
+ mid_block_add_attention=ddconfig.get("mid_block_add_attention", True),
+ norm_type=NormType(ddconfig.get("norm_type", "pixel")),
+ causality_axis=CausalityAxis(ddconfig.get("causality_axis", "height")),
+ sample_rate=sample_rate,
+ mel_hop_length=mel_hop_length,
+ n_fft=n_fft,
+ is_causal=is_causal,
+ mel_bins=mel_bins,
+ )
+
+
+AUDIO_VAE_DECODER_COMFY_KEYS_FILTER = (
+ SDOps("AUDIO_VAE_DECODER_COMFY_KEYS_FILTER")
+ .with_matching(prefix="audio_vae.decoder.")
+ .with_matching(prefix="audio_vae.per_channel_statistics.")
+ .with_replacement("audio_vae.decoder.", "")
+ .with_replacement("audio_vae.per_channel_statistics.", "per_channel_statistics.")
+)
+
+
+AUDIO_VAE_ENCODER_COMFY_KEYS_FILTER = (
+ SDOps("AUDIO_VAE_ENCODER_COMFY_KEYS_FILTER")
+ .with_matching(prefix="audio_vae.encoder.")
+ .with_matching(prefix="audio_vae.per_channel_statistics.")
+ .with_replacement("audio_vae.encoder.", "")
+ .with_replacement("audio_vae.per_channel_statistics.", "per_channel_statistics.")
+)
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/ops.py b/packages/ltx-core/src/ltx_core/model/audio_vae/ops.py
new file mode 100644
index 0000000..016f429
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/ops.py
@@ -0,0 +1,76 @@
+import torch
+import torchaudio
+from torch import nn
+
+
+class AudioProcessor(nn.Module):
+ """Converts audio waveforms to log-mel spectrograms with optional resampling."""
+
+ def __init__(
+ self,
+ sample_rate: int,
+ mel_bins: int,
+ mel_hop_length: int,
+ n_fft: int,
+ ) -> None:
+ super().__init__()
+ self.sample_rate = sample_rate
+ self.mel_transform = torchaudio.transforms.MelSpectrogram(
+ sample_rate=sample_rate,
+ n_fft=n_fft,
+ win_length=n_fft,
+ hop_length=mel_hop_length,
+ f_min=0.0,
+ f_max=sample_rate / 2.0,
+ n_mels=mel_bins,
+ window_fn=torch.hann_window,
+ center=True,
+ pad_mode="reflect",
+ power=1.0,
+ mel_scale="slaney",
+ norm="slaney",
+ )
+
+ def resample_waveform(
+ self,
+ waveform: torch.Tensor,
+ source_rate: int,
+ target_rate: int,
+ ) -> torch.Tensor:
+ """Resample waveform to target sample rate if needed."""
+ if source_rate == target_rate:
+ return waveform
+ resampled = torchaudio.functional.resample(waveform, source_rate, target_rate)
+ return resampled.to(device=waveform.device, dtype=waveform.dtype)
+
+ def waveform_to_mel(
+ self,
+ waveform: torch.Tensor,
+ waveform_sample_rate: int,
+ ) -> torch.Tensor:
+ """Convert waveform to log-mel spectrogram [batch, channels, time, n_mels]."""
+ waveform = self.resample_waveform(waveform, waveform_sample_rate, self.sample_rate)
+
+ mel = self.mel_transform(waveform)
+ mel = torch.log(torch.clamp(mel, min=1e-5))
+
+ mel = mel.to(device=waveform.device, dtype=waveform.dtype)
+ return mel.permute(0, 1, 3, 2).contiguous()
+
+
+class PerChannelStatistics(nn.Module):
+ """
+ Per-channel statistics for normalizing and denormalizing the latent representation.
+ This statics is computed over the entire dataset and stored in model's checkpoint under AudioVAE state_dict.
+ """
+
+ def __init__(self, latent_channels: int = 128) -> None:
+ super().__init__()
+ self.register_buffer("std-of-means", torch.empty(latent_channels))
+ self.register_buffer("mean-of-means", torch.empty(latent_channels))
+
+ def un_normalize(self, x: torch.Tensor) -> torch.Tensor:
+ return (x * self.get_buffer("std-of-means").to(x)) + self.get_buffer("mean-of-means").to(x)
+
+ def normalize(self, x: torch.Tensor) -> torch.Tensor:
+ return (x - self.get_buffer("mean-of-means").to(x)) / self.get_buffer("std-of-means").to(x)
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/resnet.py b/packages/ltx-core/src/ltx_core/model/audio_vae/resnet.py
new file mode 100644
index 0000000..a529d6d
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/resnet.py
@@ -0,0 +1,176 @@
+from typing import Tuple
+
+import torch
+
+from ltx_core.model.audio_vae.causal_conv_2d import make_conv2d
+from ltx_core.model.audio_vae.causality_axis import CausalityAxis
+from ltx_core.model.common.normalization import NormType, build_normalization_layer
+
+LRELU_SLOPE = 0.1
+
+
+class ResBlock1(torch.nn.Module):
+ def __init__(self, channels: int, kernel_size: int = 3, dilation: Tuple[int, int, int] = (1, 3, 5)):
+ super(ResBlock1, self).__init__()
+ self.convs1 = torch.nn.ModuleList(
+ [
+ torch.nn.Conv1d(
+ channels,
+ channels,
+ kernel_size,
+ 1,
+ dilation=dilation[0],
+ padding="same",
+ ),
+ torch.nn.Conv1d(
+ channels,
+ channels,
+ kernel_size,
+ 1,
+ dilation=dilation[1],
+ padding="same",
+ ),
+ torch.nn.Conv1d(
+ channels,
+ channels,
+ kernel_size,
+ 1,
+ dilation=dilation[2],
+ padding="same",
+ ),
+ ]
+ )
+
+ self.convs2 = torch.nn.ModuleList(
+ [
+ torch.nn.Conv1d(
+ channels,
+ channels,
+ kernel_size,
+ 1,
+ dilation=1,
+ padding="same",
+ ),
+ torch.nn.Conv1d(
+ channels,
+ channels,
+ kernel_size,
+ 1,
+ dilation=1,
+ padding="same",
+ ),
+ torch.nn.Conv1d(
+ channels,
+ channels,
+ kernel_size,
+ 1,
+ dilation=1,
+ padding="same",
+ ),
+ ]
+ )
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ for conv1, conv2 in zip(self.convs1, self.convs2, strict=True):
+ xt = torch.nn.functional.leaky_relu(x, LRELU_SLOPE)
+ xt = conv1(xt)
+ xt = torch.nn.functional.leaky_relu(xt, LRELU_SLOPE)
+ xt = conv2(xt)
+ x = xt + x
+ return x
+
+
+class ResBlock2(torch.nn.Module):
+ def __init__(self, channels: int, kernel_size: int = 3, dilation: Tuple[int, int] = (1, 3)):
+ super(ResBlock2, self).__init__()
+ self.convs = torch.nn.ModuleList(
+ [
+ torch.nn.Conv1d(
+ channels,
+ channels,
+ kernel_size,
+ 1,
+ dilation=dilation[0],
+ padding="same",
+ ),
+ torch.nn.Conv1d(
+ channels,
+ channels,
+ kernel_size,
+ 1,
+ dilation=dilation[1],
+ padding="same",
+ ),
+ ]
+ )
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ for conv in self.convs:
+ xt = torch.nn.functional.leaky_relu(x, LRELU_SLOPE)
+ xt = conv(xt)
+ x = xt + x
+ return x
+
+
+class ResnetBlock(torch.nn.Module):
+ def __init__(
+ self,
+ *,
+ in_channels: int,
+ out_channels: int | None = None,
+ conv_shortcut: bool = False,
+ dropout: float = 0.0,
+ temb_channels: int = 512,
+ norm_type: NormType = NormType.GROUP,
+ causality_axis: CausalityAxis = CausalityAxis.HEIGHT,
+ ) -> None:
+ super().__init__()
+ self.causality_axis = causality_axis
+
+ if self.causality_axis != CausalityAxis.NONE and norm_type == NormType.GROUP:
+ raise ValueError("Causal ResnetBlock with GroupNorm is not supported.")
+ self.in_channels = in_channels
+ out_channels = in_channels if out_channels is None else out_channels
+ self.out_channels = out_channels
+ self.use_conv_shortcut = conv_shortcut
+
+ self.norm1 = build_normalization_layer(in_channels, normtype=norm_type)
+ self.non_linearity = torch.nn.SiLU()
+ self.conv1 = make_conv2d(in_channels, out_channels, kernel_size=3, stride=1, causality_axis=causality_axis)
+ if temb_channels > 0:
+ self.temb_proj = torch.nn.Linear(temb_channels, out_channels)
+ self.norm2 = build_normalization_layer(out_channels, normtype=norm_type)
+ self.dropout = torch.nn.Dropout(dropout)
+ self.conv2 = make_conv2d(out_channels, out_channels, kernel_size=3, stride=1, causality_axis=causality_axis)
+ if self.in_channels != self.out_channels:
+ if self.use_conv_shortcut:
+ self.conv_shortcut = make_conv2d(
+ in_channels, out_channels, kernel_size=3, stride=1, causality_axis=causality_axis
+ )
+ else:
+ self.nin_shortcut = make_conv2d(
+ in_channels, out_channels, kernel_size=1, stride=1, causality_axis=causality_axis
+ )
+
+ def forward(
+ self,
+ x: torch.Tensor,
+ temb: torch.Tensor | None = None,
+ ) -> torch.Tensor:
+ h = x
+ h = self.norm1(h)
+ h = self.non_linearity(h)
+ h = self.conv1(h)
+
+ if temb is not None:
+ h = h + self.temb_proj(self.non_linearity(temb))[:, :, None, None]
+
+ h = self.norm2(h)
+ h = self.non_linearity(h)
+ h = self.dropout(h)
+ h = self.conv2(h)
+
+ if self.in_channels != self.out_channels:
+ x = self.conv_shortcut(x) if self.use_conv_shortcut else self.nin_shortcut(x)
+
+ return x + h
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/upsample.py b/packages/ltx-core/src/ltx_core/model/audio_vae/upsample.py
new file mode 100644
index 0000000..3046e21
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/upsample.py
@@ -0,0 +1,106 @@
+from typing import Set, Tuple
+
+import torch
+
+from ltx_core.model.audio_vae.attention import AttentionType, make_attn
+from ltx_core.model.audio_vae.causal_conv_2d import make_conv2d
+from ltx_core.model.audio_vae.causality_axis import CausalityAxis
+from ltx_core.model.audio_vae.resnet import ResnetBlock
+from ltx_core.model.common.normalization import NormType
+
+
+class Upsample(torch.nn.Module):
+ def __init__(
+ self,
+ in_channels: int,
+ with_conv: bool,
+ causality_axis: CausalityAxis = CausalityAxis.HEIGHT,
+ ) -> None:
+ super().__init__()
+ self.with_conv = with_conv
+ self.causality_axis = causality_axis
+ if self.with_conv:
+ self.conv = make_conv2d(in_channels, in_channels, kernel_size=3, stride=1, causality_axis=causality_axis)
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ x = torch.nn.functional.interpolate(x, scale_factor=2.0, mode="nearest")
+ if self.with_conv:
+ x = self.conv(x)
+ # Drop FIRST element in the causal axis to undo encoder's padding, while keeping the length 1 + 2 * n.
+ # For example, if the input is [0, 1, 2], after interpolation, the output is [0, 0, 1, 1, 2, 2].
+ # The causal convolution will pad the first element as [-, -, 0, 0, 1, 1, 2, 2],
+ # So the output elements rely on the following windows:
+ # 0: [-,-,0]
+ # 1: [-,0,0]
+ # 2: [0,0,1]
+ # 3: [0,1,1]
+ # 4: [1,1,2]
+ # 5: [1,2,2]
+ # Notice that the first and second elements in the output rely only on the first element in the input,
+ # while all other elements rely on two elements in the input.
+ # So we can drop the first element to undo the padding (rather than the last element).
+ # This is a no-op for non-causal convolutions.
+ match self.causality_axis:
+ case CausalityAxis.NONE:
+ pass # x remains unchanged
+ case CausalityAxis.HEIGHT:
+ x = x[:, :, 1:, :]
+ case CausalityAxis.WIDTH:
+ x = x[:, :, :, 1:]
+ case CausalityAxis.WIDTH_COMPATIBILITY:
+ pass # x remains unchanged
+ case _:
+ raise ValueError(f"Invalid causality_axis: {self.causality_axis}")
+
+ return x
+
+
+def build_upsampling_path( # noqa: PLR0913
+ *,
+ ch: int,
+ ch_mult: Tuple[int, ...],
+ num_resolutions: int,
+ num_res_blocks: int,
+ resolution: int,
+ temb_channels: int,
+ dropout: float,
+ norm_type: NormType,
+ causality_axis: CausalityAxis,
+ attn_type: AttentionType,
+ attn_resolutions: Set[int],
+ resamp_with_conv: bool,
+ initial_block_channels: int,
+) -> tuple[torch.nn.ModuleList, int]:
+ """Build the upsampling path with residual blocks, attention, and upsampling layers."""
+ up_modules = torch.nn.ModuleList()
+ block_in = initial_block_channels
+ curr_res = resolution // (2 ** (num_resolutions - 1))
+
+ for level in reversed(range(num_resolutions)):
+ stage = torch.nn.Module()
+ stage.block = torch.nn.ModuleList()
+ stage.attn = torch.nn.ModuleList()
+ block_out = ch * ch_mult[level]
+
+ for _ in range(num_res_blocks + 1):
+ stage.block.append(
+ ResnetBlock(
+ in_channels=block_in,
+ out_channels=block_out,
+ temb_channels=temb_channels,
+ dropout=dropout,
+ norm_type=norm_type,
+ causality_axis=causality_axis,
+ )
+ )
+ block_in = block_out
+ if curr_res in attn_resolutions:
+ stage.attn.append(make_attn(block_in, attn_type=attn_type, norm_type=norm_type))
+
+ if level != 0:
+ stage.upsample = Upsample(block_in, resamp_with_conv, causality_axis=causality_axis)
+ curr_res *= 2
+
+ up_modules.insert(0, stage)
+
+ return up_modules, block_in
diff --git a/packages/ltx-core/src/ltx_core/model/audio_vae/vocoder.py b/packages/ltx-core/src/ltx_core/model/audio_vae/vocoder.py
new file mode 100644
index 0000000..c1112a7
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/audio_vae/vocoder.py
@@ -0,0 +1,123 @@
+import math
+from typing import List
+
+import einops
+import torch
+import torch.nn.functional as F
+from torch import nn
+
+from ltx_core.model.audio_vae.resnet import LRELU_SLOPE, ResBlock1, ResBlock2
+
+
+class Vocoder(torch.nn.Module):
+ """
+ Vocoder model for synthesizing audio from Mel spectrograms.
+ Args:
+ resblock_kernel_sizes: List of kernel sizes for the residual blocks.
+ This value is read from the checkpoint at `config.vocoder.resblock_kernel_sizes`.
+ upsample_rates: List of upsampling rates.
+ This value is read from the checkpoint at `config.vocoder.upsample_rates`.
+ upsample_kernel_sizes: List of kernel sizes for the upsampling layers.
+ This value is read from the checkpoint at `config.vocoder.upsample_kernel_sizes`.
+ resblock_dilation_sizes: List of dilation sizes for the residual blocks.
+ This value is read from the checkpoint at `config.vocoder.resblock_dilation_sizes`.
+ upsample_initial_channel: Initial number of channels for the upsampling layers.
+ This value is read from the checkpoint at `config.vocoder.upsample_initial_channel`.
+ stereo: Whether to use stereo output.
+ This value is read from the checkpoint at `config.vocoder.stereo`.
+ resblock: Type of residual block to use.
+ This value is read from the checkpoint at `config.vocoder.resblock`.
+ output_sample_rate: Waveform sample rate.
+ This value is read from the checkpoint at `config.vocoder.output_sample_rate`.
+ """
+
+ def __init__(
+ self,
+ resblock_kernel_sizes: List[int] | None = None,
+ upsample_rates: List[int] | None = None,
+ upsample_kernel_sizes: List[int] | None = None,
+ resblock_dilation_sizes: List[List[int]] | None = None,
+ upsample_initial_channel: int = 1024,
+ stereo: bool = True,
+ resblock: str = "1",
+ output_sample_rate: int = 24000,
+ ):
+ super().__init__()
+
+ # Initialize default values if not provided. Note that mutable default values are not supported.
+ if resblock_kernel_sizes is None:
+ resblock_kernel_sizes = [3, 7, 11]
+ if upsample_rates is None:
+ upsample_rates = [6, 5, 2, 2, 2]
+ if upsample_kernel_sizes is None:
+ upsample_kernel_sizes = [16, 15, 8, 4, 4]
+ if resblock_dilation_sizes is None:
+ resblock_dilation_sizes = [[1, 3, 5], [1, 3, 5], [1, 3, 5]]
+
+ self.output_sample_rate = output_sample_rate
+ self.num_kernels = len(resblock_kernel_sizes)
+ self.num_upsamples = len(upsample_rates)
+ in_channels = 128 if stereo else 64
+ self.conv_pre = nn.Conv1d(in_channels, upsample_initial_channel, 7, 1, padding=3)
+ resblock_class = ResBlock1 if resblock == "1" else ResBlock2
+
+ self.ups = nn.ModuleList()
+ for i, (stride, kernel_size) in enumerate(zip(upsample_rates, upsample_kernel_sizes, strict=True)):
+ self.ups.append(
+ nn.ConvTranspose1d(
+ upsample_initial_channel // (2**i),
+ upsample_initial_channel // (2 ** (i + 1)),
+ kernel_size,
+ stride,
+ padding=(kernel_size - stride) // 2,
+ )
+ )
+
+ self.resblocks = nn.ModuleList()
+ for i, _ in enumerate(self.ups):
+ ch = upsample_initial_channel // (2 ** (i + 1))
+ for kernel_size, dilations in zip(resblock_kernel_sizes, resblock_dilation_sizes, strict=True):
+ self.resblocks.append(resblock_class(ch, kernel_size, dilations))
+
+ out_channels = 2 if stereo else 1
+ final_channels = upsample_initial_channel // (2**self.num_upsamples)
+ self.conv_post = nn.Conv1d(final_channels, out_channels, 7, 1, padding=3)
+
+ self.upsample_factor = math.prod(layer.stride[0] for layer in self.ups)
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ """
+ Forward pass of the vocoder.
+ Args:
+ x: Input Mel spectrogram tensor. Can be either:
+ - 3D: (batch_size, time, mel_bins) for mono
+ - 4D: (batch_size, 2, time, mel_bins) for stereo
+ Returns:
+ Audio waveform tensor of shape (batch_size, out_channels, audio_length)
+ """
+ x = x.transpose(2, 3) # (batch, channels, time, mel_bins) -> (batch, channels, mel_bins, time)
+
+ if x.dim() == 4: # stereo
+ assert x.shape[1] == 2, "Input must have 2 channels for stereo"
+ x = einops.rearrange(x, "b s c t -> b (s c) t")
+
+ x = self.conv_pre(x)
+
+ for i in range(self.num_upsamples):
+ x = F.leaky_relu(x, LRELU_SLOPE)
+ x = self.ups[i](x)
+ start = i * self.num_kernels
+ end = start + self.num_kernels
+
+ # Evaluate all resblocks with the same input tensor so they can run
+ # independently (and thus in parallel on accelerator hardware) before
+ # aggregating their outputs via mean.
+ block_outputs = torch.stack(
+ [self.resblocks[idx](x) for idx in range(start, end)],
+ dim=0,
+ )
+
+ x = block_outputs.mean(dim=0)
+
+ x = self.conv_post(F.leaky_relu(x))
+ return torch.tanh(x)
diff --git a/packages/ltx-core/src/ltx_core/model/common/__init__.py b/packages/ltx-core/src/ltx_core/model/common/__init__.py
new file mode 100644
index 0000000..42713f7
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/common/__init__.py
@@ -0,0 +1,9 @@
+"""Common model utilities."""
+
+from ltx_core.model.common.normalization import NormType, PixelNorm, build_normalization_layer
+
+__all__ = [
+ "NormType",
+ "PixelNorm",
+ "build_normalization_layer",
+]
diff --git a/packages/ltx-core/src/ltx_core/model/common/normalization.py b/packages/ltx-core/src/ltx_core/model/common/normalization.py
new file mode 100644
index 0000000..9877db1
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/common/normalization.py
@@ -0,0 +1,59 @@
+from enum import Enum
+
+import torch
+from torch import nn
+
+
+class NormType(Enum):
+ """Normalization layer types: GROUP (GroupNorm) or PIXEL (per-location RMS norm)."""
+
+ GROUP = "group"
+ PIXEL = "pixel"
+
+
+class PixelNorm(nn.Module):
+ """
+ Per-pixel (per-location) RMS normalization layer.
+ For each element along the chosen dimension, this layer normalizes the tensor
+ by the root-mean-square of its values across that dimension:
+ y = x / sqrt(mean(x^2, dim=dim, keepdim=True) + eps)
+ """
+
+ def __init__(self, dim: int = 1, eps: float = 1e-8) -> None:
+ """
+ Args:
+ dim: Dimension along which to compute the RMS (typically channels).
+ eps: Small constant added for numerical stability.
+ """
+ super().__init__()
+ self.dim = dim
+ self.eps = eps
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ """
+ Apply RMS normalization along the configured dimension.
+ """
+ # Compute mean of squared values along `dim`, keep dimensions for broadcasting.
+ mean_sq = torch.mean(x**2, dim=self.dim, keepdim=True)
+ # Normalize by the root-mean-square (RMS).
+ rms = torch.sqrt(mean_sq + self.eps)
+ return x / rms
+
+
+def build_normalization_layer(
+ in_channels: int, *, num_groups: int = 32, normtype: NormType = NormType.GROUP
+) -> nn.Module:
+ """
+ Create a normalization layer based on the normalization type.
+ Args:
+ in_channels: Number of input channels
+ num_groups: Number of groups for group normalization
+ normtype: Type of normalization: "group" or "pixel"
+ Returns:
+ A normalization layer
+ """
+ if normtype == NormType.GROUP:
+ return torch.nn.GroupNorm(num_groups=num_groups, num_channels=in_channels, eps=1e-6, affine=True)
+ if normtype == NormType.PIXEL:
+ return PixelNorm(dim=1, eps=1e-6)
+ raise ValueError(f"Invalid normalization type: {normtype}")
diff --git a/packages/ltx-core/src/ltx_core/model/model_protocol.py b/packages/ltx-core/src/ltx_core/model/model_protocol.py
new file mode 100644
index 0000000..37a07f7
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/model_protocol.py
@@ -0,0 +1,10 @@
+from typing import Protocol, TypeVar
+
+ModelType = TypeVar("ModelType")
+
+
+class ModelConfigurator(Protocol[ModelType]):
+ """Protocol for model loader classes that instantiates models from a configuration dictionary."""
+
+ @classmethod
+ def from_config(cls, config: dict) -> ModelType: ...
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/__init__.py b/packages/ltx-core/src/ltx_core/model/transformer/__init__.py
new file mode 100644
index 0000000..6cae4f3
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/__init__.py
@@ -0,0 +1,24 @@
+"""Transformer model components."""
+
+from ltx_core.model.transformer.modality import Modality
+from ltx_core.model.transformer.model import LTXModel, X0Model
+from ltx_core.model.transformer.model_configurator import (
+ LTXV_MODEL_COMFY_RENAMING_MAP,
+ LTXV_MODEL_COMFY_RENAMING_WITH_TRANSFORMER_LINEAR_DOWNCAST_MAP,
+ UPCAST_DURING_INFERENCE,
+ LTXModelConfigurator,
+ LTXVideoOnlyModelConfigurator,
+ UpcastWithStochasticRounding,
+)
+
+__all__ = [
+ "LTXV_MODEL_COMFY_RENAMING_MAP",
+ "LTXV_MODEL_COMFY_RENAMING_WITH_TRANSFORMER_LINEAR_DOWNCAST_MAP",
+ "UPCAST_DURING_INFERENCE",
+ "LTXModel",
+ "LTXModelConfigurator",
+ "LTXVideoOnlyModelConfigurator",
+ "Modality",
+ "UpcastWithStochasticRounding",
+ "X0Model",
+]
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/adaln.py b/packages/ltx-core/src/ltx_core/model/transformer/adaln.py
new file mode 100644
index 0000000..8f4e262
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/adaln.py
@@ -0,0 +1,34 @@
+from typing import Optional, Tuple
+
+import torch
+
+from ltx_core.model.transformer.timestep_embedding import PixArtAlphaCombinedTimestepSizeEmbeddings
+
+
+class AdaLayerNormSingle(torch.nn.Module):
+ r"""
+ Norm layer adaptive layer norm single (adaLN-single).
+ As proposed in PixArt-Alpha (see: https://arxiv.org/abs/2310.00426; Section 2.3).
+ Parameters:
+ embedding_dim (`int`): The size of each embedding vector.
+ use_additional_conditions (`bool`): To use additional conditions for normalization or not.
+ """
+
+ def __init__(self, embedding_dim: int, embedding_coefficient: int = 6):
+ super().__init__()
+
+ self.emb = PixArtAlphaCombinedTimestepSizeEmbeddings(
+ embedding_dim,
+ size_emb_dim=embedding_dim // 3,
+ )
+
+ self.silu = torch.nn.SiLU()
+ self.linear = torch.nn.Linear(embedding_dim, embedding_coefficient * embedding_dim, bias=True)
+
+ def forward(
+ self,
+ timestep: torch.Tensor,
+ hidden_dtype: Optional[torch.dtype] = None,
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
+ embedded_timestep = self.emb(timestep, hidden_dtype=hidden_dtype)
+ return self.linear(self.silu(embedded_timestep)), embedded_timestep
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/attention.py b/packages/ltx-core/src/ltx_core/model/transformer/attention.py
new file mode 100644
index 0000000..9420478
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/attention.py
@@ -0,0 +1,195 @@
+from enum import Enum
+from typing import Protocol
+
+import torch
+
+from ltx_core.model.transformer.rope import LTXRopeType, apply_rotary_emb
+
+memory_efficient_attention = None
+flash_attn_interface = None
+try:
+ from xformers.ops import memory_efficient_attention
+except ImportError:
+ memory_efficient_attention = None
+try:
+ # FlashAttention3 and XFormersAttention cannot be used together
+ if memory_efficient_attention is None:
+ import flash_attn_interface
+except ImportError:
+ flash_attn_interface = None
+
+
+class AttentionCallable(Protocol):
+ def __call__(
+ self, q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, heads: int, mask: torch.Tensor | None = None
+ ) -> torch.Tensor: ...
+
+
+class PytorchAttention(AttentionCallable):
+ def __call__(
+ self, q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, heads: int, mask: torch.Tensor | None = None
+ ) -> torch.Tensor:
+ b, _, dim_head = q.shape
+ dim_head //= heads
+ q, k, v = (t.view(b, -1, heads, dim_head).transpose(1, 2) for t in (q, k, v))
+
+ if mask is not None:
+ # add a batch dimension if there isn't already one
+ if mask.ndim == 2:
+ mask = mask.unsqueeze(0)
+ # add a heads dimension if there isn't already one
+ if mask.ndim == 3:
+ mask = mask.unsqueeze(1)
+
+ out = torch.nn.functional.scaled_dot_product_attention(q, k, v, attn_mask=mask, dropout_p=0.0, is_causal=False)
+ out = out.transpose(1, 2).reshape(b, -1, heads * dim_head)
+ return out
+
+
+class XFormersAttention(AttentionCallable):
+ def __call__(
+ self,
+ q: torch.Tensor,
+ k: torch.Tensor,
+ v: torch.Tensor,
+ heads: int,
+ mask: torch.Tensor | None = None,
+ ) -> torch.Tensor:
+ if memory_efficient_attention is None:
+ raise RuntimeError("XFormersAttention was selected but `xformers` is not installed.")
+
+ b, _, dim_head = q.shape
+ dim_head //= heads
+
+ # xformers expects [B, M, H, K]
+ q, k, v = (t.view(b, -1, heads, dim_head) for t in (q, k, v))
+
+ if mask is not None:
+ # add a singleton batch dimension
+ if mask.ndim == 2:
+ mask = mask.unsqueeze(0)
+ # add a singleton heads dimension
+ if mask.ndim == 3:
+ mask = mask.unsqueeze(1)
+ # pad to a multiple of 8
+ pad = 8 - mask.shape[-1] % 8
+ # the xformers docs says that it's allowed to have a mask of shape (1, Nq, Nk)
+ # but when using separated heads, the shape has to be (B, H, Nq, Nk)
+ # in flux, this matrix ends up being over 1GB
+ # here, we create a mask with the same batch/head size as the input mask (potentially singleton or full)
+ mask_out = torch.empty(
+ [mask.shape[0], mask.shape[1], q.shape[1], mask.shape[-1] + pad], dtype=q.dtype, device=q.device
+ )
+
+ mask_out[..., : mask.shape[-1]] = mask
+ # doesn't this remove the padding again??
+ mask = mask_out[..., : mask.shape[-1]]
+ mask = mask.expand(b, heads, -1, -1)
+
+ out = memory_efficient_attention(q.to(v.dtype), k.to(v.dtype), v, attn_bias=mask, p=0.0)
+ out = out.reshape(b, -1, heads * dim_head)
+ return out
+
+
+class FlashAttention3(AttentionCallable):
+ def __call__(
+ self,
+ q: torch.Tensor,
+ k: torch.Tensor,
+ v: torch.Tensor,
+ heads: int,
+ mask: torch.Tensor | None = None,
+ ) -> torch.Tensor:
+ if flash_attn_interface is None:
+ raise RuntimeError("FlashAttention3 was selected but `FlashAttention3` is not installed.")
+
+ b, _, dim_head = q.shape
+ dim_head //= heads
+
+ q, k, v = (t.view(b, -1, heads, dim_head) for t in (q, k, v))
+
+ if mask is not None:
+ raise NotImplementedError("Mask is not supported for FlashAttention3")
+
+ out = flash_attn_interface.flash_attn_func(q.to(v.dtype), k.to(v.dtype), v)
+ out = out.reshape(b, -1, heads * dim_head)
+ return out
+
+
+class AttentionFunction(Enum):
+ PYTORCH = "pytorch"
+ XFORMERS = "xformers"
+ FLASH_ATTENTION_3 = "flash_attention_3"
+ DEFAULT = "default"
+
+ def __call__(
+ self, q: torch.Tensor, k: torch.Tensor, v: torch.Tensor, heads: int, mask: torch.Tensor | None = None
+ ) -> torch.Tensor:
+ if self is AttentionFunction.PYTORCH:
+ return PytorchAttention()(q, k, v, heads, mask)
+ elif self is AttentionFunction.XFORMERS:
+ return XFormersAttention()(q, k, v, heads, mask)
+ elif self is AttentionFunction.FLASH_ATTENTION_3:
+ return FlashAttention3()(q, k, v, heads, mask)
+ else:
+ # Default behavior: XFormers if installed else - PyTorch
+ return (
+ XFormersAttention()(q, k, v, heads, mask)
+ if memory_efficient_attention is not None
+ else PytorchAttention()(q, k, v, heads, mask)
+ )
+
+
+class Attention(torch.nn.Module):
+ def __init__(
+ self,
+ query_dim: int,
+ context_dim: int | None = None,
+ heads: int = 8,
+ dim_head: int = 64,
+ norm_eps: float = 1e-6,
+ rope_type: LTXRopeType = LTXRopeType.INTERLEAVED,
+ attention_function: AttentionCallable | AttentionFunction = AttentionFunction.DEFAULT,
+ ) -> None:
+ super().__init__()
+ self.rope_type = rope_type
+ self.attention_function = attention_function
+
+ inner_dim = dim_head * heads
+ context_dim = query_dim if context_dim is None else context_dim
+
+ self.heads = heads
+ self.dim_head = dim_head
+
+ self.q_norm = torch.nn.RMSNorm(inner_dim, eps=norm_eps)
+ self.k_norm = torch.nn.RMSNorm(inner_dim, eps=norm_eps)
+
+ self.to_q = torch.nn.Linear(query_dim, inner_dim, bias=True)
+ self.to_k = torch.nn.Linear(context_dim, inner_dim, bias=True)
+ self.to_v = torch.nn.Linear(context_dim, inner_dim, bias=True)
+
+ self.to_out = torch.nn.Sequential(torch.nn.Linear(inner_dim, query_dim, bias=True), torch.nn.Identity())
+
+ def forward(
+ self,
+ x: torch.Tensor,
+ context: torch.Tensor | None = None,
+ mask: torch.Tensor | None = None,
+ pe: torch.Tensor | None = None,
+ k_pe: torch.Tensor | None = None,
+ ) -> torch.Tensor:
+ q = self.to_q(x)
+ context = x if context is None else context
+ k = self.to_k(context)
+ v = self.to_v(context)
+
+ q = self.q_norm(q)
+ k = self.k_norm(k)
+
+ if pe is not None:
+ q = apply_rotary_emb(q, pe, self.rope_type)
+ k = apply_rotary_emb(k, pe if k_pe is None else k_pe, self.rope_type)
+
+ # attention_function can be an enum *or* a custom callable
+ out = self.attention_function(q, k, v, self.heads, mask)
+ return self.to_out(out)
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/feed_forward.py b/packages/ltx-core/src/ltx_core/model/transformer/feed_forward.py
new file mode 100644
index 0000000..a55b5a7
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/feed_forward.py
@@ -0,0 +1,15 @@
+import torch
+
+from ltx_core.model.transformer.gelu_approx import GELUApprox
+
+
+class FeedForward(torch.nn.Module):
+ def __init__(self, dim: int, dim_out: int, mult: int = 4) -> None:
+ super().__init__()
+ inner_dim = int(dim * mult)
+ project_in = GELUApprox(dim, inner_dim)
+
+ self.net = torch.nn.Sequential(project_in, torch.nn.Identity(), torch.nn.Linear(inner_dim, dim_out))
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ return self.net(x)
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/gelu_approx.py b/packages/ltx-core/src/ltx_core/model/transformer/gelu_approx.py
new file mode 100644
index 0000000..1923e6e
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/gelu_approx.py
@@ -0,0 +1,10 @@
+import torch
+
+
+class GELUApprox(torch.nn.Module):
+ def __init__(self, dim_in: int, dim_out: int) -> None:
+ super().__init__()
+ self.proj = torch.nn.Linear(dim_in, dim_out)
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ return torch.nn.functional.gelu(self.proj(x), approximate="tanh")
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/modality.py b/packages/ltx-core/src/ltx_core/model/transformer/modality.py
new file mode 100644
index 0000000..1d1ae82
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/modality.py
@@ -0,0 +1,23 @@
+from dataclasses import dataclass
+
+import torch
+
+
+@dataclass(frozen=True)
+class Modality:
+ """
+ Input data for a single modality (video or audio) in the transformer.
+ Bundles the latent tokens, timestep embeddings, positional information,
+ and text conditioning context for processing by the diffusion transformer.
+ """
+
+ latent: (
+ torch.Tensor
+ ) # Shape: (B, T, D) where B is the batch size, T is the number of tokens, and D is input dimension
+ timesteps: torch.Tensor # Shape: (B, T) where T is the number of timesteps
+ positions: (
+ torch.Tensor
+ ) # Shape: (B, 3, T) for video, where 3 is the number of dimensions and T is the number of tokens
+ context: torch.Tensor
+ enabled: bool = True
+ context_mask: torch.Tensor | None = None
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/model.py b/packages/ltx-core/src/ltx_core/model/transformer/model.py
new file mode 100644
index 0000000..411e3b4
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/model.py
@@ -0,0 +1,468 @@
+from enum import Enum
+
+import torch
+
+from ltx_core.guidance.perturbations import BatchedPerturbationConfig
+from ltx_core.model.transformer.adaln import AdaLayerNormSingle
+from ltx_core.model.transformer.attention import AttentionCallable, AttentionFunction
+from ltx_core.model.transformer.modality import Modality
+from ltx_core.model.transformer.rope import LTXRopeType
+from ltx_core.model.transformer.text_projection import PixArtAlphaTextProjection
+from ltx_core.model.transformer.transformer import BasicAVTransformerBlock, TransformerConfig
+from ltx_core.model.transformer.transformer_args import (
+ MultiModalTransformerArgsPreprocessor,
+ TransformerArgs,
+ TransformerArgsPreprocessor,
+)
+from ltx_core.utils import to_denoised
+
+
+class LTXModelType(Enum):
+ AudioVideo = "ltx av model"
+ VideoOnly = "ltx video only model"
+ AudioOnly = "ltx audio only model"
+
+ def is_video_enabled(self) -> bool:
+ return self in (LTXModelType.AudioVideo, LTXModelType.VideoOnly)
+
+ def is_audio_enabled(self) -> bool:
+ return self in (LTXModelType.AudioVideo, LTXModelType.AudioOnly)
+
+
+class LTXModel(torch.nn.Module):
+ """
+ LTX model transformer implementation.
+ This class implements the transformer blocks for the LTX model.
+ """
+
+ def __init__( # noqa: PLR0913
+ self,
+ *,
+ model_type: LTXModelType = LTXModelType.AudioVideo,
+ num_attention_heads: int = 32,
+ attention_head_dim: int = 128,
+ in_channels: int = 128,
+ out_channels: int = 128,
+ num_layers: int = 48,
+ cross_attention_dim: int = 4096,
+ norm_eps: float = 1e-06,
+ attention_type: AttentionFunction | AttentionCallable = AttentionFunction.DEFAULT,
+ caption_channels: int = 3840,
+ positional_embedding_theta: float = 10000.0,
+ positional_embedding_max_pos: list[int] | None = None,
+ timestep_scale_multiplier: int = 1000,
+ use_middle_indices_grid: bool = True,
+ audio_num_attention_heads: int = 32,
+ audio_attention_head_dim: int = 64,
+ audio_in_channels: int = 128,
+ audio_out_channels: int = 128,
+ audio_cross_attention_dim: int = 2048,
+ audio_positional_embedding_max_pos: list[int] | None = None,
+ av_ca_timestep_scale_multiplier: int = 1,
+ rope_type: LTXRopeType = LTXRopeType.INTERLEAVED,
+ double_precision_rope: bool = False,
+ ):
+ super().__init__()
+ self._enable_gradient_checkpointing = False
+ self.use_middle_indices_grid = use_middle_indices_grid
+ self.rope_type = rope_type
+ self.double_precision_rope = double_precision_rope
+ self.timestep_scale_multiplier = timestep_scale_multiplier
+ self.positional_embedding_theta = positional_embedding_theta
+ self.model_type = model_type
+ cross_pe_max_pos = None
+ if model_type.is_video_enabled():
+ if positional_embedding_max_pos is None:
+ positional_embedding_max_pos = [20, 2048, 2048]
+ self.positional_embedding_max_pos = positional_embedding_max_pos
+ self.num_attention_heads = num_attention_heads
+ self.inner_dim = num_attention_heads * attention_head_dim
+ self._init_video(
+ in_channels=in_channels,
+ out_channels=out_channels,
+ caption_channels=caption_channels,
+ norm_eps=norm_eps,
+ )
+
+ if model_type.is_audio_enabled():
+ if audio_positional_embedding_max_pos is None:
+ audio_positional_embedding_max_pos = [20]
+ self.audio_positional_embedding_max_pos = audio_positional_embedding_max_pos
+ self.audio_num_attention_heads = audio_num_attention_heads
+ self.audio_inner_dim = self.audio_num_attention_heads * audio_attention_head_dim
+ self._init_audio(
+ in_channels=audio_in_channels,
+ out_channels=audio_out_channels,
+ caption_channels=caption_channels,
+ norm_eps=norm_eps,
+ )
+
+ if model_type.is_video_enabled() and model_type.is_audio_enabled():
+ cross_pe_max_pos = max(self.positional_embedding_max_pos[0], self.audio_positional_embedding_max_pos[0])
+ self.av_ca_timestep_scale_multiplier = av_ca_timestep_scale_multiplier
+ self.audio_cross_attention_dim = audio_cross_attention_dim
+ self._init_audio_video(num_scale_shift_values=4)
+
+ self._init_preprocessors(cross_pe_max_pos)
+ # Initialize transformer blocks
+ self._init_transformer_blocks(
+ num_layers=num_layers,
+ attention_head_dim=attention_head_dim if model_type.is_video_enabled() else 0,
+ cross_attention_dim=cross_attention_dim,
+ audio_attention_head_dim=audio_attention_head_dim if model_type.is_audio_enabled() else 0,
+ audio_cross_attention_dim=audio_cross_attention_dim,
+ norm_eps=norm_eps,
+ attention_type=attention_type,
+ )
+
+ def _init_video(
+ self,
+ in_channels: int,
+ out_channels: int,
+ caption_channels: int,
+ norm_eps: float,
+ ) -> None:
+ """Initialize video-specific components."""
+ # Video input components
+ self.patchify_proj = torch.nn.Linear(in_channels, self.inner_dim, bias=True)
+
+ self.adaln_single = AdaLayerNormSingle(self.inner_dim)
+
+ # Video caption projection
+ self.caption_projection = PixArtAlphaTextProjection(
+ in_features=caption_channels,
+ hidden_size=self.inner_dim,
+ )
+
+ # Video output components
+ self.scale_shift_table = torch.nn.Parameter(torch.empty(2, self.inner_dim))
+ self.norm_out = torch.nn.LayerNorm(self.inner_dim, elementwise_affine=False, eps=norm_eps)
+ self.proj_out = torch.nn.Linear(self.inner_dim, out_channels)
+
+ def _init_audio(
+ self,
+ in_channels: int,
+ out_channels: int,
+ caption_channels: int,
+ norm_eps: float,
+ ) -> None:
+ """Initialize audio-specific components."""
+
+ # Audio input components
+ self.audio_patchify_proj = torch.nn.Linear(in_channels, self.audio_inner_dim, bias=True)
+
+ self.audio_adaln_single = AdaLayerNormSingle(
+ self.audio_inner_dim,
+ )
+
+ # Audio caption projection
+ self.audio_caption_projection = PixArtAlphaTextProjection(
+ in_features=caption_channels,
+ hidden_size=self.audio_inner_dim,
+ )
+
+ # Audio output components
+ self.audio_scale_shift_table = torch.nn.Parameter(torch.empty(2, self.audio_inner_dim))
+ self.audio_norm_out = torch.nn.LayerNorm(self.audio_inner_dim, elementwise_affine=False, eps=norm_eps)
+ self.audio_proj_out = torch.nn.Linear(self.audio_inner_dim, out_channels)
+
+ def _init_audio_video(
+ self,
+ num_scale_shift_values: int,
+ ) -> None:
+ """Initialize audio-video cross-attention components."""
+ self.av_ca_video_scale_shift_adaln_single = AdaLayerNormSingle(
+ self.inner_dim,
+ embedding_coefficient=num_scale_shift_values,
+ )
+
+ self.av_ca_audio_scale_shift_adaln_single = AdaLayerNormSingle(
+ self.audio_inner_dim,
+ embedding_coefficient=num_scale_shift_values,
+ )
+
+ self.av_ca_a2v_gate_adaln_single = AdaLayerNormSingle(
+ self.inner_dim,
+ embedding_coefficient=1,
+ )
+
+ self.av_ca_v2a_gate_adaln_single = AdaLayerNormSingle(
+ self.audio_inner_dim,
+ embedding_coefficient=1,
+ )
+
+ def _init_preprocessors(
+ self,
+ cross_pe_max_pos: int | None = None,
+ ) -> None:
+ """Initialize preprocessors for LTX."""
+
+ if self.model_type.is_video_enabled() and self.model_type.is_audio_enabled():
+ self.video_args_preprocessor = MultiModalTransformerArgsPreprocessor(
+ patchify_proj=self.patchify_proj,
+ adaln=self.adaln_single,
+ caption_projection=self.caption_projection,
+ cross_scale_shift_adaln=self.av_ca_video_scale_shift_adaln_single,
+ cross_gate_adaln=self.av_ca_a2v_gate_adaln_single,
+ inner_dim=self.inner_dim,
+ max_pos=self.positional_embedding_max_pos,
+ num_attention_heads=self.num_attention_heads,
+ cross_pe_max_pos=cross_pe_max_pos,
+ use_middle_indices_grid=self.use_middle_indices_grid,
+ audio_cross_attention_dim=self.audio_cross_attention_dim,
+ timestep_scale_multiplier=self.timestep_scale_multiplier,
+ double_precision_rope=self.double_precision_rope,
+ positional_embedding_theta=self.positional_embedding_theta,
+ rope_type=self.rope_type,
+ av_ca_timestep_scale_multiplier=self.av_ca_timestep_scale_multiplier,
+ )
+ self.audio_args_preprocessor = MultiModalTransformerArgsPreprocessor(
+ patchify_proj=self.audio_patchify_proj,
+ adaln=self.audio_adaln_single,
+ caption_projection=self.audio_caption_projection,
+ cross_scale_shift_adaln=self.av_ca_audio_scale_shift_adaln_single,
+ cross_gate_adaln=self.av_ca_v2a_gate_adaln_single,
+ inner_dim=self.audio_inner_dim,
+ max_pos=self.audio_positional_embedding_max_pos,
+ num_attention_heads=self.audio_num_attention_heads,
+ cross_pe_max_pos=cross_pe_max_pos,
+ use_middle_indices_grid=self.use_middle_indices_grid,
+ audio_cross_attention_dim=self.audio_cross_attention_dim,
+ timestep_scale_multiplier=self.timestep_scale_multiplier,
+ double_precision_rope=self.double_precision_rope,
+ positional_embedding_theta=self.positional_embedding_theta,
+ rope_type=self.rope_type,
+ av_ca_timestep_scale_multiplier=self.av_ca_timestep_scale_multiplier,
+ )
+ elif self.model_type.is_video_enabled():
+ self.video_args_preprocessor = TransformerArgsPreprocessor(
+ patchify_proj=self.patchify_proj,
+ adaln=self.adaln_single,
+ caption_projection=self.caption_projection,
+ inner_dim=self.inner_dim,
+ max_pos=self.positional_embedding_max_pos,
+ num_attention_heads=self.num_attention_heads,
+ use_middle_indices_grid=self.use_middle_indices_grid,
+ timestep_scale_multiplier=self.timestep_scale_multiplier,
+ double_precision_rope=self.double_precision_rope,
+ positional_embedding_theta=self.positional_embedding_theta,
+ rope_type=self.rope_type,
+ )
+ elif self.model_type.is_audio_enabled():
+ self.audio_args_preprocessor = TransformerArgsPreprocessor(
+ patchify_proj=self.audio_patchify_proj,
+ adaln=self.audio_adaln_single,
+ caption_projection=self.audio_caption_projection,
+ inner_dim=self.audio_inner_dim,
+ max_pos=self.audio_positional_embedding_max_pos,
+ num_attention_heads=self.audio_num_attention_heads,
+ use_middle_indices_grid=self.use_middle_indices_grid,
+ timestep_scale_multiplier=self.timestep_scale_multiplier,
+ double_precision_rope=self.double_precision_rope,
+ positional_embedding_theta=self.positional_embedding_theta,
+ rope_type=self.rope_type,
+ )
+
+ def _init_transformer_blocks(
+ self,
+ num_layers: int,
+ attention_head_dim: int,
+ cross_attention_dim: int,
+ audio_attention_head_dim: int,
+ audio_cross_attention_dim: int,
+ norm_eps: float,
+ attention_type: AttentionFunction | AttentionCallable,
+ ) -> None:
+ """Initialize transformer blocks for LTX."""
+ video_config = (
+ TransformerConfig(
+ dim=self.inner_dim,
+ heads=self.num_attention_heads,
+ d_head=attention_head_dim,
+ context_dim=cross_attention_dim,
+ )
+ if self.model_type.is_video_enabled()
+ else None
+ )
+ audio_config = (
+ TransformerConfig(
+ dim=self.audio_inner_dim,
+ heads=self.audio_num_attention_heads,
+ d_head=audio_attention_head_dim,
+ context_dim=audio_cross_attention_dim,
+ )
+ if self.model_type.is_audio_enabled()
+ else None
+ )
+ self.transformer_blocks = torch.nn.ModuleList(
+ [
+ BasicAVTransformerBlock(
+ idx=idx,
+ video=video_config,
+ audio=audio_config,
+ rope_type=self.rope_type,
+ norm_eps=norm_eps,
+ attention_function=attention_type,
+ )
+ for idx in range(num_layers)
+ ]
+ )
+
+ def set_gradient_checkpointing(self, enable: bool) -> None:
+ """Enable or disable gradient checkpointing for transformer blocks.
+ Gradient checkpointing trades compute for memory by recomputing activations
+ during the backward pass instead of storing them. This can significantly
+ reduce memory usage at the cost of ~20-30% slower training.
+ Args:
+ enable: Whether to enable gradient checkpointing
+ """
+ self._enable_gradient_checkpointing = enable
+
+ def _process_transformer_blocks(
+ self,
+ video: TransformerArgs | None,
+ audio: TransformerArgs | None,
+ perturbations: BatchedPerturbationConfig,
+ ) -> tuple[TransformerArgs, TransformerArgs]:
+ """Process transformer blocks for LTXAV."""
+
+ # Process transformer blocks
+ for block in self.transformer_blocks:
+ if self._enable_gradient_checkpointing and self.training:
+ # Use gradient checkpointing to save memory during training.
+ # With use_reentrant=False, we can pass dataclasses directly -
+ # PyTorch will track all tensor leaves in the computation graph.
+ video, audio = torch.utils.checkpoint.checkpoint(
+ block,
+ video,
+ audio,
+ perturbations,
+ use_reentrant=False,
+ )
+ else:
+ video, audio = block(
+ video=video,
+ audio=audio,
+ perturbations=perturbations,
+ )
+
+ return video, audio
+
+ def _process_output(
+ self,
+ scale_shift_table: torch.Tensor,
+ norm_out: torch.nn.LayerNorm,
+ proj_out: torch.nn.Linear,
+ x: torch.Tensor,
+ embedded_timestep: torch.Tensor,
+ ) -> torch.Tensor:
+ """Process output for LTXV."""
+ # Apply scale-shift modulation
+ scale_shift_values = (
+ scale_shift_table[None, None].to(device=x.device, dtype=x.dtype) + embedded_timestep[:, :, None]
+ )
+ shift, scale = scale_shift_values[:, :, 0], scale_shift_values[:, :, 1]
+
+ x = norm_out(x)
+ x = x * (1 + scale) + shift
+ x = proj_out(x)
+ return x
+
+ def forward(
+ self, video: Modality | None, audio: Modality | None, perturbations: BatchedPerturbationConfig
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ """
+ Forward pass for LTX models.
+ Returns:
+ Processed output tensors
+ """
+ if not self.model_type.is_video_enabled() and video is not None:
+ raise ValueError("Video is not enabled for this model")
+ if not self.model_type.is_audio_enabled() and audio is not None:
+ raise ValueError("Audio is not enabled for this model")
+
+ video_args = self.video_args_preprocessor.prepare(video) if video is not None else None
+ audio_args = self.audio_args_preprocessor.prepare(audio) if audio is not None else None
+ # Process transformer blocks
+ video_out, audio_out = self._process_transformer_blocks(
+ video=video_args,
+ audio=audio_args,
+ perturbations=perturbations,
+ )
+
+ # Process output
+ vx = (
+ self._process_output(
+ self.scale_shift_table, self.norm_out, self.proj_out, video_out.x, video_out.embedded_timestep
+ )
+ if video_out is not None
+ else None
+ )
+ ax = (
+ self._process_output(
+ self.audio_scale_shift_table,
+ self.audio_norm_out,
+ self.audio_proj_out,
+ audio_out.x,
+ audio_out.embedded_timestep,
+ )
+ if audio_out is not None
+ else None
+ )
+ return vx, ax
+
+
+class LegacyX0Model(torch.nn.Module):
+ """
+ Legacy X0 model implementation.
+ Returns fully denoised output based on the velocities produced by the base model.
+ """
+
+ def __init__(self, velocity_model: LTXModel):
+ super().__init__()
+ self.velocity_model = velocity_model
+
+ def forward(
+ self,
+ video: Modality | None,
+ audio: Modality | None,
+ perturbations: BatchedPerturbationConfig,
+ sigma: float,
+ ) -> tuple[torch.Tensor | None, torch.Tensor | None]:
+ """
+ Denoise the video and audio according to the sigma.
+ Returns:
+ Denoised video and audio
+ """
+ vx, ax = self.velocity_model(video, audio, perturbations)
+ denoised_video = to_denoised(video.latent, vx, sigma) if vx is not None else None
+ denoised_audio = to_denoised(audio.latent, ax, sigma) if ax is not None else None
+ return denoised_video, denoised_audio
+
+
+class X0Model(torch.nn.Module):
+ """
+ X0 model implementation.
+ Returns fully denoised outputs based on the velocities produced by the base model.
+ Applies scaled denoising to the video and audio according to the timesteps = sigma * denoising_mask.
+ """
+
+ def __init__(self, velocity_model: LTXModel):
+ super().__init__()
+ self.velocity_model = velocity_model
+
+ def forward(
+ self,
+ video: Modality | None,
+ audio: Modality | None,
+ perturbations: BatchedPerturbationConfig,
+ ) -> tuple[torch.Tensor | None, torch.Tensor | None]:
+ """
+ Denoise the video and audio according to the sigma.
+ Returns:
+ Denoised video and audio
+ """
+ vx, ax = self.velocity_model(video, audio, perturbations)
+ denoised_video = to_denoised(video.latent, vx, video.timesteps) if vx is not None else None
+ denoised_audio = to_denoised(audio.latent, ax, audio.timesteps) if ax is not None else None
+ return denoised_video, denoised_audio
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/model_configurator.py b/packages/ltx-core/src/ltx_core/model/transformer/model_configurator.py
new file mode 100644
index 0000000..567f436
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/model_configurator.py
@@ -0,0 +1,237 @@
+import torch
+
+from ltx_core.loader.fuse_loras import fused_add_round_launch
+from ltx_core.loader.module_ops import ModuleOps
+from ltx_core.loader.sd_ops import KeyValueOperationResult, SDOps
+from ltx_core.model.model_protocol import ModelConfigurator
+from ltx_core.model.transformer.attention import AttentionFunction
+from ltx_core.model.transformer.model import LTXModel, LTXModelType
+from ltx_core.model.transformer.rope import LTXRopeType
+from ltx_core.utils import check_config_value
+
+
+class LTXModelConfigurator(ModelConfigurator[LTXModel]):
+ """
+ Configurator for LTX model.
+ Used to create an LTX model from a configuration dictionary.
+ """
+
+ @classmethod
+ def from_config(cls: type[LTXModel], config: dict) -> LTXModel:
+ config = config.get("transformer", {})
+
+ check_config_value(config, "dropout", 0.0)
+ check_config_value(config, "attention_bias", True)
+ check_config_value(config, "num_vector_embeds", None)
+ check_config_value(config, "activation_fn", "gelu-approximate")
+ check_config_value(config, "num_embeds_ada_norm", 1000)
+ check_config_value(config, "use_linear_projection", False)
+ check_config_value(config, "only_cross_attention", False)
+ check_config_value(config, "cross_attention_norm", True)
+ check_config_value(config, "double_self_attention", False)
+ check_config_value(config, "upcast_attention", False)
+ check_config_value(config, "standardization_norm", "rms_norm")
+ check_config_value(config, "norm_elementwise_affine", False)
+ check_config_value(config, "qk_norm", "rms_norm")
+ check_config_value(config, "positional_embedding_type", "rope")
+ check_config_value(config, "use_audio_video_cross_attention", True)
+ check_config_value(config, "share_ff", False)
+ check_config_value(config, "av_cross_ada_norm", True)
+ check_config_value(config, "use_middle_indices_grid", True)
+
+ return LTXModel(
+ model_type=LTXModelType.AudioVideo,
+ num_attention_heads=config.get("num_attention_heads", 32),
+ attention_head_dim=config.get("attention_head_dim", 128),
+ in_channels=config.get("in_channels", 128),
+ out_channels=config.get("out_channels", 128),
+ num_layers=config.get("num_layers", 48),
+ cross_attention_dim=config.get("cross_attention_dim", 4096),
+ norm_eps=config.get("norm_eps", 1e-06),
+ attention_type=AttentionFunction(config.get("attention_type", "default")),
+ caption_channels=config.get("caption_channels", 3840),
+ positional_embedding_theta=config.get("positional_embedding_theta", 10000.0),
+ positional_embedding_max_pos=config.get("positional_embedding_max_pos", [20, 2048, 2048]),
+ timestep_scale_multiplier=config.get("timestep_scale_multiplier", 1000),
+ use_middle_indices_grid=config.get("use_middle_indices_grid", True),
+ audio_num_attention_heads=config.get("audio_num_attention_heads", 32),
+ audio_attention_head_dim=config.get("audio_attention_head_dim", 64),
+ audio_in_channels=config.get("audio_in_channels", 128),
+ audio_out_channels=config.get("audio_out_channels", 128),
+ audio_cross_attention_dim=config.get("audio_cross_attention_dim", 2048),
+ audio_positional_embedding_max_pos=config.get("audio_positional_embedding_max_pos", [20]),
+ av_ca_timestep_scale_multiplier=config.get("av_ca_timestep_scale_multiplier", 1),
+ rope_type=LTXRopeType(config.get("rope_type", "interleaved")),
+ double_precision_rope=config.get("frequencies_precision", False) == "float64",
+ )
+
+
+class LTXVideoOnlyModelConfigurator(ModelConfigurator[LTXModel]):
+ """
+ Configurator for LTX video only model.
+ Used to create an LTX video only model from a configuration dictionary.
+ """
+
+ @classmethod
+ def from_config(cls: type[LTXModel], config: dict) -> LTXModel:
+ config = config.get("transformer", {})
+
+ check_config_value(config, "dropout", 0.0)
+ check_config_value(config, "attention_bias", True)
+ check_config_value(config, "num_vector_embeds", None)
+ check_config_value(config, "activation_fn", "gelu-approximate")
+ check_config_value(config, "num_embeds_ada_norm", 1000)
+ check_config_value(config, "use_linear_projection", False)
+ check_config_value(config, "only_cross_attention", False)
+ check_config_value(config, "cross_attention_norm", True)
+ check_config_value(config, "double_self_attention", False)
+ check_config_value(config, "upcast_attention", False)
+ check_config_value(config, "standardization_norm", "rms_norm")
+ check_config_value(config, "norm_elementwise_affine", False)
+ check_config_value(config, "qk_norm", "rms_norm")
+ check_config_value(config, "positional_embedding_type", "rope")
+ check_config_value(config, "use_middle_indices_grid", True)
+
+ return LTXModel(
+ model_type=LTXModelType.VideoOnly,
+ num_attention_heads=config.get("num_attention_heads", 32),
+ attention_head_dim=config.get("attention_head_dim", 128),
+ in_channels=config.get("in_channels", 128),
+ out_channels=config.get("out_channels", 128),
+ num_layers=config.get("num_layers", 48),
+ cross_attention_dim=config.get("cross_attention_dim", 4096),
+ norm_eps=config.get("norm_eps", 1e-06),
+ attention_type=AttentionFunction(config.get("attention_type", "default")),
+ caption_channels=config.get("caption_channels", 3840),
+ positional_embedding_theta=config.get("positional_embedding_theta", 10000.0),
+ positional_embedding_max_pos=config.get("positional_embedding_max_pos", [20, 2048, 2048]),
+ timestep_scale_multiplier=config.get("timestep_scale_multiplier", 1000),
+ use_middle_indices_grid=config.get("use_middle_indices_grid", True),
+ rope_type=LTXRopeType(config.get("rope_type", "interleaved")),
+ double_precision_rope=config.get("frequencies_precision", False) == "float64",
+ )
+
+
+def _naive_weight_or_bias_downcast(key: str, value: torch.Tensor) -> list[KeyValueOperationResult]:
+ """
+ Downcast the weight or bias to the float8_e4m3fn dtype.
+ """
+ return [KeyValueOperationResult(key, value.to(dtype=torch.float8_e4m3fn))]
+
+
+def _upcast_and_round(
+ weight: torch.Tensor, dtype: torch.dtype, with_stochastic_rounding: bool = False, seed: int = 0
+) -> torch.Tensor:
+ """
+ Upcast the weight to the given dtype and optionally apply stochastic rounding.
+ Input weight needs to have float8_e4m3fn or float8_e5m2 dtype.
+ """
+ if not with_stochastic_rounding:
+ return weight.to(dtype)
+ return fused_add_round_launch(torch.zeros_like(weight, dtype=dtype), weight, seed)
+
+
+def replace_fwd_with_upcast(layer: torch.nn.Linear, with_stochastic_rounding: bool = False, seed: int = 0) -> None:
+ """
+ Replace linear.forward and rms_norm.forward with a version that:
+ - upcasts weight and bias to input's dtype
+ - returns F.linear or F.rms_norm calculated in that dtype
+ """
+
+ layer.original_forward = layer.forward
+
+ def new_linear_forward(*args, **_kwargs) -> torch.Tensor:
+ # assume first arg is the input tensor
+ x = args[0]
+ w_up = _upcast_and_round(layer.weight, x.dtype, with_stochastic_rounding, seed)
+ b_up = None
+
+ if layer.bias is not None:
+ b_up = _upcast_and_round(layer.bias, x.dtype, with_stochastic_rounding, seed)
+
+ return torch.nn.functional.linear(x, w_up, b_up)
+
+ layer.forward = new_linear_forward
+
+
+def amend_forward_with_upcast(
+ model: torch.nn.Module, with_stochastic_rounding: bool = False, seed: int = 0
+) -> torch.nn.Module:
+ """
+ Replace the forward method of the model's Linear and RMSNorm layers to forward
+ with upcast and optional stochastic rounding.
+ """
+ for m in model.modules():
+ if isinstance(m, (torch.nn.Linear)):
+ replace_fwd_with_upcast(m, with_stochastic_rounding, seed)
+ return model
+
+
+LTXV_MODEL_COMFY_RENAMING_MAP = (
+ SDOps("LTXV_MODEL_COMFY_PREFIX_MAP")
+ .with_matching(prefix="model.diffusion_model.")
+ .with_replacement("model.diffusion_model.", "")
+)
+
+LTXV_MODEL_COMFY_RENAMING_WITH_TRANSFORMER_LINEAR_DOWNCAST_MAP = (
+ SDOps("LTXV_MODEL_COMFY_PREFIX_MAP")
+ .with_matching(prefix="model.diffusion_model.")
+ .with_replacement("model.diffusion_model.", "")
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".to_q.weight", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".to_q.bias", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".to_k.weight", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".to_k.bias", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".to_v.weight", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".to_v.bias", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".to_out.0.weight", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".to_out.0.bias", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".ff.net.0.proj.weight", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".ff.net.0.proj.bias", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".ff.net.2.weight", operation=_naive_weight_or_bias_downcast
+ )
+ .with_kv_operation(
+ key_prefix="transformer_blocks.", key_suffix=".ff.net.2.bias", operation=_naive_weight_or_bias_downcast
+ )
+)
+
+UPCAST_DURING_INFERENCE = ModuleOps(
+ name="upcast_fp8_during_linear_forward",
+ matcher=lambda model: isinstance(model, LTXModel),
+ mutator=lambda model: amend_forward_with_upcast(model, False),
+)
+
+
+class UpcastWithStochasticRounding(ModuleOps):
+ """
+ ModuleOps for upcasting the model's float8_e4m3fn weights and biases to the bfloat16 dtype
+ and applying stochastic rounding during linear forward.
+ """
+
+ def __new__(cls, seed: int = 0):
+ return super().__new__(
+ cls,
+ name="upcast_fp8_during_linear_forward_with_stochastic_rounding",
+ matcher=lambda model: isinstance(model, LTXModel),
+ mutator=lambda model: amend_forward_with_upcast(model, True, seed),
+ )
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/rope.py b/packages/ltx-core/src/ltx_core/model/transformer/rope.py
new file mode 100644
index 0000000..2ce58d9
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/rope.py
@@ -0,0 +1,204 @@
+import functools
+import math
+from enum import Enum
+from typing import Callable, Tuple
+
+import numpy as np
+import torch
+from einops import rearrange
+
+
+class LTXRopeType(Enum):
+ INTERLEAVED = "interleaved"
+ SPLIT = "split"
+
+
+def apply_rotary_emb(
+ input_tensor: torch.Tensor,
+ freqs_cis: Tuple[torch.Tensor, torch.Tensor],
+ rope_type: LTXRopeType = LTXRopeType.INTERLEAVED,
+) -> torch.Tensor:
+ if rope_type == LTXRopeType.INTERLEAVED:
+ return apply_interleaved_rotary_emb(input_tensor, *freqs_cis)
+ elif rope_type == LTXRopeType.SPLIT:
+ return apply_split_rotary_emb(input_tensor, *freqs_cis)
+ else:
+ raise ValueError(f"Invalid rope type: {rope_type}")
+
+
+def apply_interleaved_rotary_emb(
+ input_tensor: torch.Tensor, cos_freqs: torch.Tensor, sin_freqs: torch.Tensor
+) -> torch.Tensor:
+ t_dup = rearrange(input_tensor, "... (d r) -> ... d r", r=2)
+ t1, t2 = t_dup.unbind(dim=-1)
+ t_dup = torch.stack((-t2, t1), dim=-1)
+ input_tensor_rot = rearrange(t_dup, "... d r -> ... (d r)")
+
+ out = input_tensor * cos_freqs + input_tensor_rot * sin_freqs
+
+ return out
+
+
+def apply_split_rotary_emb(
+ input_tensor: torch.Tensor, cos_freqs: torch.Tensor, sin_freqs: torch.Tensor
+) -> torch.Tensor:
+ needs_reshape = False
+ if input_tensor.ndim != 4 and cos_freqs.ndim == 4:
+ b, h, t, _ = cos_freqs.shape
+ input_tensor = input_tensor.reshape(b, t, h, -1).swapaxes(1, 2)
+ needs_reshape = True
+
+ split_input = rearrange(input_tensor, "... (d r) -> ... d r", d=2)
+ first_half_input = split_input[..., :1, :]
+ second_half_input = split_input[..., 1:, :]
+
+ output = split_input * cos_freqs.unsqueeze(-2)
+ first_half_output = output[..., :1, :]
+ second_half_output = output[..., 1:, :]
+
+ first_half_output.addcmul_(-sin_freqs.unsqueeze(-2), second_half_input)
+ second_half_output.addcmul_(sin_freqs.unsqueeze(-2), first_half_input)
+
+ output = rearrange(output, "... d r -> ... (d r)")
+ if needs_reshape:
+ output = output.swapaxes(1, 2).reshape(b, t, -1)
+
+ return output
+
+
[email protected]_cache(maxsize=5)
+def generate_freq_grid_np(
+ positional_embedding_theta: float, positional_embedding_max_pos_count: int, inner_dim: int
+) -> torch.Tensor:
+ theta = positional_embedding_theta
+ start = 1
+ end = theta
+
+ n_elem = 2 * positional_embedding_max_pos_count
+ pow_indices = np.power(
+ theta,
+ np.linspace(
+ np.log(start) / np.log(theta),
+ np.log(end) / np.log(theta),
+ inner_dim // n_elem,
+ dtype=np.float64,
+ ),
+ )
+ return torch.tensor(pow_indices * math.pi / 2, dtype=torch.float32)
+
+
[email protected]_cache(maxsize=5)
+def generate_freq_grid_pytorch(
+ positional_embedding_theta: float, positional_embedding_max_pos_count: int, inner_dim: int
+) -> torch.Tensor:
+ theta = positional_embedding_theta
+ start = 1
+ end = theta
+ n_elem = 2 * positional_embedding_max_pos_count
+
+ indices = theta ** (
+ torch.linspace(
+ math.log(start, theta),
+ math.log(end, theta),
+ inner_dim // n_elem,
+ dtype=torch.float32,
+ )
+ )
+ indices = indices.to(dtype=torch.float32)
+
+ indices = indices * math.pi / 2
+
+ return indices
+
+
+def get_fractional_positions(indices_grid: torch.Tensor, max_pos: list[int]) -> torch.Tensor:
+ n_pos_dims = indices_grid.shape[1]
+ assert n_pos_dims == len(max_pos), (
+ f"Number of position dimensions ({n_pos_dims}) must match max_pos length ({len(max_pos)})"
+ )
+ fractional_positions = torch.stack(
+ [indices_grid[:, i] / max_pos[i] for i in range(n_pos_dims)],
+ dim=-1,
+ )
+ return fractional_positions
+
+
+def generate_freqs(
+ indices: torch.Tensor, indices_grid: torch.Tensor, max_pos: list[int], use_middle_indices_grid: bool
+) -> torch.Tensor:
+ if use_middle_indices_grid:
+ assert len(indices_grid.shape) == 4
+ assert indices_grid.shape[-1] == 2
+ indices_grid_start, indices_grid_end = indices_grid[..., 0], indices_grid[..., 1]
+ indices_grid = (indices_grid_start + indices_grid_end) / 2.0
+ elif len(indices_grid.shape) == 4:
+ indices_grid = indices_grid[..., 0]
+
+ fractional_positions = get_fractional_positions(indices_grid, max_pos)
+ indices = indices.to(device=fractional_positions.device)
+
+ freqs = (indices * (fractional_positions.unsqueeze(-1) * 2 - 1)).transpose(-1, -2).flatten(2)
+ return freqs
+
+
+def split_freqs_cis(freqs: torch.Tensor, pad_size: int, num_attention_heads: int) -> tuple[torch.Tensor, torch.Tensor]:
+ cos_freq = freqs.cos()
+ sin_freq = freqs.sin()
+
+ if pad_size != 0:
+ cos_padding = torch.ones_like(cos_freq[:, :, :pad_size])
+ sin_padding = torch.zeros_like(sin_freq[:, :, :pad_size])
+
+ cos_freq = torch.concatenate([cos_padding, cos_freq], axis=-1)
+ sin_freq = torch.concatenate([sin_padding, sin_freq], axis=-1)
+
+ # Reshape freqs to be compatible with multi-head attention
+ b = cos_freq.shape[0]
+ t = cos_freq.shape[1]
+
+ cos_freq = cos_freq.reshape(b, t, num_attention_heads, -1)
+ sin_freq = sin_freq.reshape(b, t, num_attention_heads, -1)
+
+ cos_freq = torch.swapaxes(cos_freq, 1, 2) # (B,H,T,D//2)
+ sin_freq = torch.swapaxes(sin_freq, 1, 2) # (B,H,T,D//2)
+ return cos_freq, sin_freq
+
+
+def interleaved_freqs_cis(freqs: torch.Tensor, pad_size: int) -> tuple[torch.Tensor, torch.Tensor]:
+ cos_freq = freqs.cos().repeat_interleave(2, dim=-1)
+ sin_freq = freqs.sin().repeat_interleave(2, dim=-1)
+ if pad_size != 0:
+ cos_padding = torch.ones_like(cos_freq[:, :, :pad_size])
+ sin_padding = torch.zeros_like(cos_freq[:, :, :pad_size])
+ cos_freq = torch.cat([cos_padding, cos_freq], dim=-1)
+ sin_freq = torch.cat([sin_padding, sin_freq], dim=-1)
+ return cos_freq, sin_freq
+
+
+def precompute_freqs_cis(
+ indices_grid: torch.Tensor,
+ dim: int,
+ out_dtype: torch.dtype,
+ theta: float = 10000.0,
+ max_pos: list[int] | None = None,
+ use_middle_indices_grid: bool = False,
+ num_attention_heads: int = 32,
+ rope_type: LTXRopeType = LTXRopeType.INTERLEAVED,
+ freq_grid_generator: Callable[[float, int, int, torch.device], torch.Tensor] = generate_freq_grid_pytorch,
+) -> tuple[torch.Tensor, torch.Tensor]:
+ if max_pos is None:
+ max_pos = [20, 2048, 2048]
+
+ indices = freq_grid_generator(theta, indices_grid.shape[1], dim)
+ freqs = generate_freqs(indices, indices_grid, max_pos, use_middle_indices_grid)
+
+ if rope_type == LTXRopeType.SPLIT:
+ expected_freqs = dim // 2
+ current_freqs = freqs.shape[-1]
+ pad_size = expected_freqs - current_freqs
+ cos_freq, sin_freq = split_freqs_cis(freqs, pad_size, num_attention_heads)
+ else:
+ # 2 because of cos and sin by 3 for (t, x, y), 1 for temporal only
+ n_elem = 2 * indices_grid.shape[1]
+ cos_freq, sin_freq = interleaved_freqs_cis(freqs, dim % n_elem)
+ return cos_freq.to(out_dtype), sin_freq.to(out_dtype)
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/text_projection.py b/packages/ltx-core/src/ltx_core/model/transformer/text_projection.py
new file mode 100644
index 0000000..788f6c8
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/text_projection.py
@@ -0,0 +1,27 @@
+import torch
+
+
+class PixArtAlphaTextProjection(torch.nn.Module):
+ """
+ Projects caption embeddings. Also handles dropout for classifier-free guidance.
+ Adapted from https://github.com/PixArt-alpha/PixArt-alpha/blob/master/diffusion/model/nets/PixArt_blocks.py
+ """
+
+ def __init__(self, in_features: int, hidden_size: int, out_features: int | None = None, act_fn: str = "gelu_tanh"):
+ super().__init__()
+ if out_features is None:
+ out_features = hidden_size
+ self.linear_1 = torch.nn.Linear(in_features=in_features, out_features=hidden_size, bias=True)
+ if act_fn == "gelu_tanh":
+ self.act_1 = torch.nn.GELU(approximate="tanh")
+ elif act_fn == "silu":
+ self.act_1 = torch.nn.SiLU()
+ else:
+ raise ValueError(f"Unknown activation function: {act_fn}")
+ self.linear_2 = torch.nn.Linear(in_features=hidden_size, out_features=out_features, bias=True)
+
+ def forward(self, caption: torch.Tensor) -> torch.Tensor:
+ hidden_states = self.linear_1(caption)
+ hidden_states = self.act_1(hidden_states)
+ hidden_states = self.linear_2(hidden_states)
+ return hidden_states
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/timestep_embedding.py b/packages/ltx-core/src/ltx_core/model/transformer/timestep_embedding.py
new file mode 100644
index 0000000..820a955
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/timestep_embedding.py
@@ -0,0 +1,143 @@
+import math
+
+import torch
+
+
+def get_timestep_embedding(
+ timesteps: torch.Tensor,
+ embedding_dim: int,
+ flip_sin_to_cos: bool = False,
+ downscale_freq_shift: float = 1,
+ scale: float = 1,
+ max_period: int = 10000,
+) -> torch.Tensor:
+ """
+ This matches the implementation in Denoising Diffusion Probabilistic Models: Create sinusoidal timestep embeddings.
+ Args
+ timesteps (torch.Tensor):
+ a 1-D Tensor of N indices, one per batch element. These may be fractional.
+ embedding_dim (int):
+ the dimension of the output.
+ flip_sin_to_cos (bool):
+ Whether the embedding order should be `cos, sin` (if True) or `sin, cos` (if False)
+ downscale_freq_shift (float):
+ Controls the delta between frequencies between dimensions
+ scale (float):
+ Scaling factor applied to the embeddings.
+ max_period (int):
+ Controls the maximum frequency of the embeddings
+ Returns
+ torch.Tensor: an [N x dim] Tensor of positional embeddings.
+ """
+ assert len(timesteps.shape) == 1, "Timesteps should be a 1d-array"
+
+ half_dim = embedding_dim // 2
+ exponent = -math.log(max_period) * torch.arange(start=0, end=half_dim, dtype=torch.float32, device=timesteps.device)
+ exponent = exponent / (half_dim - downscale_freq_shift)
+
+ emb = torch.exp(exponent)
+ emb = timesteps[:, None].float() * emb[None, :]
+
+ # scale embeddings
+ emb = scale * emb
+
+ # concat sine and cosine embeddings
+ emb = torch.cat([torch.sin(emb), torch.cos(emb)], dim=-1)
+
+ # flip sine and cosine embeddings
+ if flip_sin_to_cos:
+ emb = torch.cat([emb[:, half_dim:], emb[:, :half_dim]], dim=-1)
+
+ # zero pad
+ if embedding_dim % 2 == 1:
+ emb = torch.nn.functional.pad(emb, (0, 1, 0, 0))
+ return emb
+
+
+class TimestepEmbedding(torch.nn.Module):
+ def __init__(
+ self,
+ in_channels: int,
+ time_embed_dim: int,
+ out_dim: int | None = None,
+ post_act_fn: str | None = None,
+ cond_proj_dim: int | None = None,
+ sample_proj_bias: bool = True,
+ ):
+ super().__init__()
+
+ self.linear_1 = torch.nn.Linear(in_channels, time_embed_dim, sample_proj_bias)
+
+ if cond_proj_dim is not None:
+ self.cond_proj = torch.nn.Linear(cond_proj_dim, in_channels, bias=False)
+ else:
+ self.cond_proj = None
+
+ self.act = torch.nn.SiLU()
+ time_embed_dim_out = out_dim if out_dim is not None else time_embed_dim
+
+ self.linear_2 = torch.nn.Linear(time_embed_dim, time_embed_dim_out, sample_proj_bias)
+
+ if post_act_fn is None:
+ self.post_act = None
+
+ def forward(self, sample: torch.Tensor, condition: torch.Tensor | None = None) -> torch.Tensor:
+ if condition is not None:
+ sample = sample + self.cond_proj(condition)
+ sample = self.linear_1(sample)
+
+ if self.act is not None:
+ sample = self.act(sample)
+
+ sample = self.linear_2(sample)
+
+ if self.post_act is not None:
+ sample = self.post_act(sample)
+ return sample
+
+
+class Timesteps(torch.nn.Module):
+ def __init__(self, num_channels: int, flip_sin_to_cos: bool, downscale_freq_shift: float, scale: int = 1):
+ super().__init__()
+ self.num_channels = num_channels
+ self.flip_sin_to_cos = flip_sin_to_cos
+ self.downscale_freq_shift = downscale_freq_shift
+ self.scale = scale
+
+ def forward(self, timesteps: torch.Tensor) -> torch.Tensor:
+ t_emb = get_timestep_embedding(
+ timesteps,
+ self.num_channels,
+ flip_sin_to_cos=self.flip_sin_to_cos,
+ downscale_freq_shift=self.downscale_freq_shift,
+ scale=self.scale,
+ )
+ return t_emb
+
+
+class PixArtAlphaCombinedTimestepSizeEmbeddings(torch.nn.Module):
+ """
+ For PixArt-Alpha.
+ Reference:
+ https://github.com/PixArt-alpha/PixArt-alpha/blob/0f55e922376d8b797edd44d25d0e7464b260dcab/diffusion/model/nets/PixArtMS.py#L164C9-L168C29
+ """
+
+ def __init__(
+ self,
+ embedding_dim: int,
+ size_emb_dim: int,
+ ):
+ super().__init__()
+
+ self.outdim = size_emb_dim
+ self.time_proj = Timesteps(num_channels=256, flip_sin_to_cos=True, downscale_freq_shift=0)
+ self.timestep_embedder = TimestepEmbedding(in_channels=256, time_embed_dim=embedding_dim)
+
+ def forward(
+ self,
+ timestep: torch.Tensor,
+ hidden_dtype: torch.dtype,
+ ) -> torch.Tensor:
+ timesteps_proj = self.time_proj(timestep)
+ timesteps_emb = self.timestep_embedder(timesteps_proj.to(dtype=hidden_dtype)) # (N, D)
+ return timesteps_emb
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/transformer.py b/packages/ltx-core/src/ltx_core/model/transformer/transformer.py
new file mode 100644
index 0000000..e2c1b0d
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/transformer.py
@@ -0,0 +1,274 @@
+from dataclasses import dataclass, replace
+
+import torch
+
+from ltx_core.guidance.perturbations import BatchedPerturbationConfig, PerturbationType
+from ltx_core.model.transformer.attention import Attention, AttentionCallable, AttentionFunction
+from ltx_core.model.transformer.feed_forward import FeedForward
+from ltx_core.model.transformer.rope import LTXRopeType
+from ltx_core.model.transformer.transformer_args import TransformerArgs
+from ltx_core.utils import rms_norm
+
+
+@dataclass
+class TransformerConfig:
+ dim: int
+ heads: int
+ d_head: int
+ context_dim: int
+
+
+class BasicAVTransformerBlock(torch.nn.Module):
+ def __init__(
+ self,
+ idx: int,
+ video: TransformerConfig | None = None,
+ audio: TransformerConfig | None = None,
+ rope_type: LTXRopeType = LTXRopeType.INTERLEAVED,
+ norm_eps: float = 1e-6,
+ attention_function: AttentionFunction | AttentionCallable = AttentionFunction.DEFAULT,
+ ):
+ super().__init__()
+
+ self.idx = idx
+ if video is not None:
+ self.attn1 = Attention(
+ query_dim=video.dim,
+ heads=video.heads,
+ dim_head=video.d_head,
+ context_dim=None,
+ rope_type=rope_type,
+ norm_eps=norm_eps,
+ attention_function=attention_function,
+ )
+ self.attn2 = Attention(
+ query_dim=video.dim,
+ context_dim=video.context_dim,
+ heads=video.heads,
+ dim_head=video.d_head,
+ rope_type=rope_type,
+ norm_eps=norm_eps,
+ attention_function=attention_function,
+ )
+ self.ff = FeedForward(video.dim, dim_out=video.dim)
+ self.scale_shift_table = torch.nn.Parameter(torch.empty(6, video.dim))
+
+ if audio is not None:
+ self.audio_attn1 = Attention(
+ query_dim=audio.dim,
+ heads=audio.heads,
+ dim_head=audio.d_head,
+ context_dim=None,
+ rope_type=rope_type,
+ norm_eps=norm_eps,
+ attention_function=attention_function,
+ )
+ self.audio_attn2 = Attention(
+ query_dim=audio.dim,
+ context_dim=audio.context_dim,
+ heads=audio.heads,
+ dim_head=audio.d_head,
+ rope_type=rope_type,
+ norm_eps=norm_eps,
+ attention_function=attention_function,
+ )
+ self.audio_ff = FeedForward(audio.dim, dim_out=audio.dim)
+ self.audio_scale_shift_table = torch.nn.Parameter(torch.empty(6, audio.dim))
+
+ if audio is not None and video is not None:
+ # Q: Video, K,V: Audio
+ self.audio_to_video_attn = Attention(
+ query_dim=video.dim,
+ context_dim=audio.dim,
+ heads=audio.heads,
+ dim_head=audio.d_head,
+ rope_type=rope_type,
+ norm_eps=norm_eps,
+ attention_function=attention_function,
+ )
+
+ # Q: Audio, K,V: Video
+ self.video_to_audio_attn = Attention(
+ query_dim=audio.dim,
+ context_dim=video.dim,
+ heads=audio.heads,
+ dim_head=audio.d_head,
+ rope_type=rope_type,
+ norm_eps=norm_eps,
+ attention_function=attention_function,
+ )
+
+ self.scale_shift_table_a2v_ca_audio = torch.nn.Parameter(torch.empty(5, audio.dim))
+ self.scale_shift_table_a2v_ca_video = torch.nn.Parameter(torch.empty(5, video.dim))
+
+ self.norm_eps = norm_eps
+
+ def get_ada_values(
+ self, scale_shift_table: torch.Tensor, batch_size: int, timestep: torch.Tensor, indices: slice
+ ) -> tuple[torch.Tensor, ...]:
+ num_ada_params = scale_shift_table.shape[0]
+
+ ada_values = (
+ scale_shift_table[indices].unsqueeze(0).unsqueeze(0).to(device=timestep.device, dtype=timestep.dtype)
+ + timestep.reshape(batch_size, timestep.shape[1], num_ada_params, -1)[:, :, indices, :]
+ ).unbind(dim=2)
+ return ada_values
+
+ def get_av_ca_ada_values(
+ self,
+ scale_shift_table: torch.Tensor,
+ batch_size: int,
+ scale_shift_timestep: torch.Tensor,
+ gate_timestep: torch.Tensor,
+ num_scale_shift_values: int = 4,
+ ) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
+ scale_shift_ada_values = self.get_ada_values(
+ scale_shift_table[:num_scale_shift_values, :], batch_size, scale_shift_timestep, slice(None, None)
+ )
+ gate_ada_values = self.get_ada_values(
+ scale_shift_table[num_scale_shift_values:, :], batch_size, gate_timestep, slice(None, None)
+ )
+
+ scale_shift_chunks = [t.squeeze(2) for t in scale_shift_ada_values]
+ gate_ada_values = [t.squeeze(2) for t in gate_ada_values]
+
+ return (*scale_shift_chunks, *gate_ada_values)
+
+ def forward( # noqa: PLR0915
+ self,
+ video: TransformerArgs | None,
+ audio: TransformerArgs | None,
+ perturbations: BatchedPerturbationConfig | None = None,
+ ) -> tuple[TransformerArgs | None, TransformerArgs | None]:
+ batch_size = video.x.shape[0]
+ if perturbations is None:
+ perturbations = BatchedPerturbationConfig.empty(batch_size)
+
+ vx = video.x if video is not None else None
+ ax = audio.x if audio is not None else None
+
+ run_vx = video is not None and video.enabled and vx.numel() > 0
+ run_ax = audio is not None and audio.enabled and ax.numel() > 0
+
+ run_a2v = run_vx and (audio is not None and audio.enabled and ax.numel() > 0)
+ run_v2a = run_ax and (video is not None and video.enabled and vx.numel() > 0)
+
+ if run_vx:
+ vshift_msa, vscale_msa, vgate_msa = self.get_ada_values(
+ self.scale_shift_table, vx.shape[0], video.timesteps, slice(0, 3)
+ )
+ if not perturbations.all_in_batch(PerturbationType.SKIP_VIDEO_SELF_ATTN, self.idx):
+ norm_vx = rms_norm(vx, eps=self.norm_eps) * (1 + vscale_msa) + vshift_msa
+ v_mask = perturbations.mask_like(PerturbationType.SKIP_VIDEO_SELF_ATTN, self.idx, vx)
+ vx = vx + self.attn1(norm_vx, pe=video.positional_embeddings) * vgate_msa * v_mask
+
+ vx = vx + self.attn2(rms_norm(vx, eps=self.norm_eps), context=video.context, mask=video.context_mask)
+
+ del vshift_msa, vscale_msa, vgate_msa
+
+ if run_ax:
+ ashift_msa, ascale_msa, agate_msa = self.get_ada_values(
+ self.audio_scale_shift_table, ax.shape[0], audio.timesteps, slice(0, 3)
+ )
+
+ if not perturbations.all_in_batch(PerturbationType.SKIP_AUDIO_SELF_ATTN, self.idx):
+ norm_ax = rms_norm(ax, eps=self.norm_eps) * (1 + ascale_msa) + ashift_msa
+ a_mask = perturbations.mask_like(PerturbationType.SKIP_AUDIO_SELF_ATTN, self.idx, ax)
+ ax = ax + self.audio_attn1(norm_ax, pe=audio.positional_embeddings) * agate_msa * a_mask
+
+ ax = ax + self.audio_attn2(rms_norm(ax, eps=self.norm_eps), context=audio.context, mask=audio.context_mask)
+
+ del ashift_msa, ascale_msa, agate_msa
+
+ # Audio - Video cross attention.
+ if run_a2v or run_v2a:
+ vx_norm3 = rms_norm(vx, eps=self.norm_eps)
+ ax_norm3 = rms_norm(ax, eps=self.norm_eps)
+
+ (
+ scale_ca_audio_hidden_states_a2v,
+ shift_ca_audio_hidden_states_a2v,
+ scale_ca_audio_hidden_states_v2a,
+ shift_ca_audio_hidden_states_v2a,
+ gate_out_v2a,
+ ) = self.get_av_ca_ada_values(
+ self.scale_shift_table_a2v_ca_audio,
+ ax.shape[0],
+ audio.cross_scale_shift_timestep,
+ audio.cross_gate_timestep,
+ )
+
+ (
+ scale_ca_video_hidden_states_a2v,
+ shift_ca_video_hidden_states_a2v,
+ scale_ca_video_hidden_states_v2a,
+ shift_ca_video_hidden_states_v2a,
+ gate_out_a2v,
+ ) = self.get_av_ca_ada_values(
+ self.scale_shift_table_a2v_ca_video,
+ vx.shape[0],
+ video.cross_scale_shift_timestep,
+ video.cross_gate_timestep,
+ )
+
+ if run_a2v:
+ vx_scaled = vx_norm3 * (1 + scale_ca_video_hidden_states_a2v) + shift_ca_video_hidden_states_a2v
+ ax_scaled = ax_norm3 * (1 + scale_ca_audio_hidden_states_a2v) + shift_ca_audio_hidden_states_a2v
+ a2v_mask = perturbations.mask_like(PerturbationType.SKIP_A2V_CROSS_ATTN, self.idx, vx)
+ vx = vx + (
+ self.audio_to_video_attn(
+ vx_scaled,
+ context=ax_scaled,
+ pe=video.cross_positional_embeddings,
+ k_pe=audio.cross_positional_embeddings,
+ )
+ * gate_out_a2v
+ * a2v_mask
+ )
+
+ if run_v2a:
+ ax_scaled = ax_norm3 * (1 + scale_ca_audio_hidden_states_v2a) + shift_ca_audio_hidden_states_v2a
+ vx_scaled = vx_norm3 * (1 + scale_ca_video_hidden_states_v2a) + shift_ca_video_hidden_states_v2a
+ v2a_mask = perturbations.mask_like(PerturbationType.SKIP_V2A_CROSS_ATTN, self.idx, ax)
+ ax = ax + (
+ self.video_to_audio_attn(
+ ax_scaled,
+ context=vx_scaled,
+ pe=audio.cross_positional_embeddings,
+ k_pe=video.cross_positional_embeddings,
+ )
+ * gate_out_v2a
+ * v2a_mask
+ )
+
+ del gate_out_a2v, gate_out_v2a
+ del (
+ scale_ca_video_hidden_states_a2v,
+ shift_ca_video_hidden_states_a2v,
+ scale_ca_audio_hidden_states_a2v,
+ shift_ca_audio_hidden_states_a2v,
+ scale_ca_video_hidden_states_v2a,
+ shift_ca_video_hidden_states_v2a,
+ scale_ca_audio_hidden_states_v2a,
+ shift_ca_audio_hidden_states_v2a,
+ )
+
+ if run_vx:
+ vshift_mlp, vscale_mlp, vgate_mlp = self.get_ada_values(
+ self.scale_shift_table, vx.shape[0], video.timesteps, slice(3, None)
+ )
+ vx_scaled = rms_norm(vx, eps=self.norm_eps) * (1 + vscale_mlp) + vshift_mlp
+ vx = vx + self.ff(vx_scaled) * vgate_mlp
+
+ del vshift_mlp, vscale_mlp, vgate_mlp
+
+ if run_ax:
+ ashift_mlp, ascale_mlp, agate_mlp = self.get_ada_values(
+ self.audio_scale_shift_table, ax.shape[0], audio.timesteps, slice(3, None)
+ )
+ ax_scaled = rms_norm(ax, eps=self.norm_eps) * (1 + ascale_mlp) + ashift_mlp
+ ax = ax + self.audio_ff(ax_scaled) * agate_mlp
+
+ del ashift_mlp, ascale_mlp, agate_mlp
+
+ return replace(video, x=vx) if video is not None else None, replace(audio, x=ax) if audio is not None else None
diff --git a/packages/ltx-core/src/ltx_core/model/transformer/transformer_args.py b/packages/ltx-core/src/ltx_core/model/transformer/transformer_args.py
new file mode 100644
index 0000000..ade5aa7
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/transformer/transformer_args.py
@@ -0,0 +1,239 @@
+from dataclasses import dataclass, replace
+
+import torch
+
+from ltx_core.model.transformer.adaln import AdaLayerNormSingle
+from ltx_core.model.transformer.modality import Modality
+from ltx_core.model.transformer.rope import (
+ LTXRopeType,
+ generate_freq_grid_np,
+ generate_freq_grid_pytorch,
+ precompute_freqs_cis,
+)
+from ltx_core.model.transformer.text_projection import PixArtAlphaTextProjection
+
+
+@dataclass(frozen=True)
+class TransformerArgs:
+ x: torch.Tensor
+ context: torch.Tensor
+ context_mask: torch.Tensor
+ timesteps: torch.Tensor
+ embedded_timestep: torch.Tensor
+ positional_embeddings: torch.Tensor
+ cross_positional_embeddings: torch.Tensor | None
+ cross_scale_shift_timestep: torch.Tensor | None
+ cross_gate_timestep: torch.Tensor | None
+ enabled: bool
+
+
+class TransformerArgsPreprocessor:
+ def __init__( # noqa: PLR0913
+ self,
+ patchify_proj: torch.nn.Linear,
+ adaln: AdaLayerNormSingle,
+ caption_projection: PixArtAlphaTextProjection,
+ inner_dim: int,
+ max_pos: list[int],
+ num_attention_heads: int,
+ use_middle_indices_grid: bool,
+ timestep_scale_multiplier: int,
+ double_precision_rope: bool,
+ positional_embedding_theta: float,
+ rope_type: LTXRopeType,
+ ) -> None:
+ self.patchify_proj = patchify_proj
+ self.adaln = adaln
+ self.caption_projection = caption_projection
+ self.inner_dim = inner_dim
+ self.max_pos = max_pos
+ self.num_attention_heads = num_attention_heads
+ self.use_middle_indices_grid = use_middle_indices_grid
+ self.timestep_scale_multiplier = timestep_scale_multiplier
+ self.double_precision_rope = double_precision_rope
+ self.positional_embedding_theta = positional_embedding_theta
+ self.rope_type = rope_type
+
+ def _prepare_timestep(
+ self, timestep: torch.Tensor, batch_size: int, hidden_dtype: torch.dtype
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ """Prepare timestep embeddings."""
+
+ timestep = timestep * self.timestep_scale_multiplier
+ timestep, embedded_timestep = self.adaln(
+ timestep.flatten(),
+ hidden_dtype=hidden_dtype,
+ )
+
+ # Second dimension is 1 or number of tokens (if timestep_per_token)
+ timestep = timestep.view(batch_size, -1, timestep.shape[-1])
+ embedded_timestep = embedded_timestep.view(batch_size, -1, embedded_timestep.shape[-1])
+ return timestep, embedded_timestep
+
+ def _prepare_context(
+ self,
+ context: torch.Tensor,
+ x: torch.Tensor,
+ attention_mask: torch.Tensor | None = None,
+ ) -> tuple[torch.Tensor, torch.Tensor | None]:
+ """Prepare context for transformer blocks."""
+ batch_size = x.shape[0]
+ context = self.caption_projection(context)
+ context = context.view(batch_size, -1, x.shape[-1])
+
+ return context, attention_mask
+
+ def _prepare_attention_mask(self, attention_mask: torch.Tensor | None, x_dtype: torch.dtype) -> torch.Tensor | None:
+ """Prepare attention mask."""
+ if attention_mask is None or torch.is_floating_point(attention_mask):
+ return attention_mask
+
+ return (attention_mask - 1).to(x_dtype).reshape(
+ (attention_mask.shape[0], 1, -1, attention_mask.shape[-1])
+ ) * torch.finfo(x_dtype).max
+
+ def _prepare_positional_embeddings(
+ self,
+ positions: torch.Tensor,
+ inner_dim: int,
+ max_pos: list[int],
+ use_middle_indices_grid: bool,
+ num_attention_heads: int,
+ x_dtype: torch.dtype,
+ ) -> torch.Tensor:
+ """Prepare positional embeddings."""
+ freq_grid_generator = generate_freq_grid_np if self.double_precision_rope else generate_freq_grid_pytorch
+ pe = precompute_freqs_cis(
+ positions,
+ dim=inner_dim,
+ out_dtype=x_dtype,
+ theta=self.positional_embedding_theta,
+ max_pos=max_pos,
+ use_middle_indices_grid=use_middle_indices_grid,
+ num_attention_heads=num_attention_heads,
+ rope_type=self.rope_type,
+ freq_grid_generator=freq_grid_generator,
+ )
+ return pe
+
+ def prepare(
+ self,
+ modality: Modality,
+ ) -> TransformerArgs:
+ x = self.patchify_proj(modality.latent)
+ timestep, embedded_timestep = self._prepare_timestep(modality.timesteps, x.shape[0], modality.latent.dtype)
+ context, attention_mask = self._prepare_context(modality.context, x, modality.context_mask)
+ attention_mask = self._prepare_attention_mask(attention_mask, modality.latent.dtype)
+ pe = self._prepare_positional_embeddings(
+ positions=modality.positions,
+ inner_dim=self.inner_dim,
+ max_pos=self.max_pos,
+ use_middle_indices_grid=self.use_middle_indices_grid,
+ num_attention_heads=self.num_attention_heads,
+ x_dtype=modality.latent.dtype,
+ )
+ return TransformerArgs(
+ x=x,
+ context=context,
+ context_mask=attention_mask,
+ timesteps=timestep,
+ embedded_timestep=embedded_timestep,
+ positional_embeddings=pe,
+ cross_positional_embeddings=None,
+ cross_scale_shift_timestep=None,
+ cross_gate_timestep=None,
+ enabled=modality.enabled,
+ )
+
+
+class MultiModalTransformerArgsPreprocessor:
+ def __init__( # noqa: PLR0913
+ self,
+ patchify_proj: torch.nn.Linear,
+ adaln: AdaLayerNormSingle,
+ caption_projection: PixArtAlphaTextProjection,
+ cross_scale_shift_adaln: AdaLayerNormSingle,
+ cross_gate_adaln: AdaLayerNormSingle,
+ inner_dim: int,
+ max_pos: list[int],
+ num_attention_heads: int,
+ cross_pe_max_pos: int,
+ use_middle_indices_grid: bool,
+ audio_cross_attention_dim: int,
+ timestep_scale_multiplier: int,
+ double_precision_rope: bool,
+ positional_embedding_theta: float,
+ rope_type: LTXRopeType,
+ av_ca_timestep_scale_multiplier: int,
+ ) -> None:
+ self.simple_preprocessor = TransformerArgsPreprocessor(
+ patchify_proj=patchify_proj,
+ adaln=adaln,
+ caption_projection=caption_projection,
+ inner_dim=inner_dim,
+ max_pos=max_pos,
+ num_attention_heads=num_attention_heads,
+ use_middle_indices_grid=use_middle_indices_grid,
+ timestep_scale_multiplier=timestep_scale_multiplier,
+ double_precision_rope=double_precision_rope,
+ positional_embedding_theta=positional_embedding_theta,
+ rope_type=rope_type,
+ )
+ self.cross_scale_shift_adaln = cross_scale_shift_adaln
+ self.cross_gate_adaln = cross_gate_adaln
+ self.cross_pe_max_pos = cross_pe_max_pos
+ self.audio_cross_attention_dim = audio_cross_attention_dim
+ self.av_ca_timestep_scale_multiplier = av_ca_timestep_scale_multiplier
+
+ def prepare(
+ self,
+ modality: Modality,
+ ) -> TransformerArgs:
+ transformer_args = self.simple_preprocessor.prepare(modality)
+ cross_pe = self.simple_preprocessor._prepare_positional_embeddings(
+ positions=modality.positions[:, 0:1, :],
+ inner_dim=self.audio_cross_attention_dim,
+ max_pos=[self.cross_pe_max_pos],
+ use_middle_indices_grid=True,
+ num_attention_heads=self.simple_preprocessor.num_attention_heads,
+ x_dtype=modality.latent.dtype,
+ )
+
+ cross_scale_shift_timestep, cross_gate_timestep = self._prepare_cross_attention_timestep(
+ timestep=modality.timesteps,
+ timestep_scale_multiplier=self.simple_preprocessor.timestep_scale_multiplier,
+ batch_size=transformer_args.x.shape[0],
+ hidden_dtype=modality.latent.dtype,
+ )
+
+ return replace(
+ transformer_args,
+ cross_positional_embeddings=cross_pe,
+ cross_scale_shift_timestep=cross_scale_shift_timestep,
+ cross_gate_timestep=cross_gate_timestep,
+ )
+
+ def _prepare_cross_attention_timestep(
+ self,
+ timestep: torch.Tensor,
+ timestep_scale_multiplier: int,
+ batch_size: int,
+ hidden_dtype: torch.dtype,
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ """Prepare cross attention timestep embeddings."""
+ timestep = timestep * timestep_scale_multiplier
+
+ av_ca_factor = self.av_ca_timestep_scale_multiplier / timestep_scale_multiplier
+
+ scale_shift_timestep, _ = self.cross_scale_shift_adaln(
+ timestep.flatten(),
+ hidden_dtype=hidden_dtype,
+ )
+ scale_shift_timestep = scale_shift_timestep.view(batch_size, -1, scale_shift_timestep.shape[-1])
+ gate_noise_timestep, _ = self.cross_gate_adaln(
+ timestep.flatten() * av_ca_factor,
+ hidden_dtype=hidden_dtype,
+ )
+ gate_noise_timestep = gate_noise_timestep.view(batch_size, -1, gate_noise_timestep.shape[-1])
+
+ return scale_shift_timestep, gate_noise_timestep
diff --git a/packages/ltx-core/src/ltx_core/model/upsampler/__init__.py b/packages/ltx-core/src/ltx_core/model/upsampler/__init__.py
new file mode 100644
index 0000000..4836bfc
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/upsampler/__init__.py
@@ -0,0 +1,10 @@
+"""Latent upsampler model components."""
+
+from ltx_core.model.upsampler.model import LatentUpsampler, upsample_video
+from ltx_core.model.upsampler.model_configurator import LatentUpsamplerConfigurator
+
+__all__ = [
+ "LatentUpsampler",
+ "LatentUpsamplerConfigurator",
+ "upsample_video",
+]
diff --git a/packages/ltx-core/src/ltx_core/model/upsampler/blur_downsample.py b/packages/ltx-core/src/ltx_core/model/upsampler/blur_downsample.py
new file mode 100644
index 0000000..ccc0149
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/upsampler/blur_downsample.py
@@ -0,0 +1,53 @@
+import math
+
+import torch
+import torch.nn.functional as F
+from einops import rearrange
+
+
+class BlurDownsample(torch.nn.Module):
+ """
+ Anti-aliased spatial downsampling by integer stride using a fixed separable binomial kernel.
+ Applies only on H,W. Works for dims=2 or dims=3 (per-frame).
+ """
+
+ def __init__(self, dims: int, stride: int, kernel_size: int = 5) -> None:
+ super().__init__()
+ assert dims in (2, 3)
+ assert isinstance(stride, int)
+ assert stride >= 1
+ assert kernel_size >= 3
+ assert kernel_size % 2 == 1
+ self.dims = dims
+ self.stride = stride
+ self.kernel_size = kernel_size
+
+ # 5x5 separable binomial kernel using binomial coefficients [1, 4, 6, 4, 1] from
+ # the 4th row of Pascal's triangle. This kernel is used for anti-aliasing and
+ # provides a smooth approximation of a Gaussian filter (often called a "binomial filter").
+ # The 2D kernel is constructed as the outer product and normalized.
+ k = torch.tensor([math.comb(kernel_size - 1, k) for k in range(kernel_size)])
+ k2d = k[:, None] @ k[None, :]
+ k2d = (k2d / k2d.sum()).float() # shape (kernel_size, kernel_size)
+ self.register_buffer("kernel", k2d[None, None, :, :]) # (1, 1, kernel_size, kernel_size)
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ if self.stride == 1:
+ return x
+
+ if self.dims == 2:
+ return self._apply_2d(x)
+ else:
+ # dims == 3: apply per-frame on H,W
+ b, _, f, _, _ = x.shape
+ x = rearrange(x, "b c f h w -> (b f) c h w")
+ x = self._apply_2d(x)
+ h2, w2 = x.shape[-2:]
+ x = rearrange(x, "(b f) c h w -> b c f h w", b=b, f=f, h=h2, w=w2)
+ return x
+
+ def _apply_2d(self, x2d: torch.Tensor) -> torch.Tensor:
+ c = x2d.shape[1]
+ weight = self.kernel.expand(c, 1, self.kernel_size, self.kernel_size) # depthwise
+ x2d = F.conv2d(x2d, weight=weight, bias=None, stride=self.stride, padding=self.kernel_size // 2, groups=c)
+ return x2d
diff --git a/packages/ltx-core/src/ltx_core/model/upsampler/model.py b/packages/ltx-core/src/ltx_core/model/upsampler/model.py
new file mode 100644
index 0000000..10d65ed
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/upsampler/model.py
@@ -0,0 +1,142 @@
+import torch
+from einops import rearrange
+
+from ltx_core.model.upsampler.pixel_shuffle import PixelShuffleND
+from ltx_core.model.upsampler.res_block import ResBlock
+from ltx_core.model.upsampler.spatial_rational_resampler import SpatialRationalResampler
+from ltx_core.model.video_vae import VideoEncoder
+
+
+class LatentUpsampler(torch.nn.Module):
+ """
+ Model to upsample VAE latents spatially and/or temporally.
+ Args:
+ in_channels (`int`): Number of channels in the input latent
+ mid_channels (`int`): Number of channels in the middle layers
+ num_blocks_per_stage (`int`): Number of ResBlocks to use in each stage (pre/post upsampling)
+ dims (`int`): Number of dimensions for convolutions (2 or 3)
+ spatial_upsample (`bool`): Whether to spatially upsample the latent
+ temporal_upsample (`bool`): Whether to temporally upsample the latent
+ spatial_scale (`float`): Scale factor for spatial upsampling
+ rational_resampler (`bool`): Whether to use a rational resampler for spatial upsampling
+ """
+
+ def __init__(
+ self,
+ in_channels: int = 128,
+ mid_channels: int = 512,
+ num_blocks_per_stage: int = 4,
+ dims: int = 3,
+ spatial_upsample: bool = True,
+ temporal_upsample: bool = False,
+ spatial_scale: float = 2.0,
+ rational_resampler: bool = False,
+ ):
+ super().__init__()
+
+ self.in_channels = in_channels
+ self.mid_channels = mid_channels
+ self.num_blocks_per_stage = num_blocks_per_stage
+ self.dims = dims
+ self.spatial_upsample = spatial_upsample
+ self.temporal_upsample = temporal_upsample
+ self.spatial_scale = float(spatial_scale)
+ self.rational_resampler = rational_resampler
+
+ conv = torch.nn.Conv2d if dims == 2 else torch.nn.Conv3d
+
+ self.initial_conv = conv(in_channels, mid_channels, kernel_size=3, padding=1)
+ self.initial_norm = torch.nn.GroupNorm(32, mid_channels)
+ self.initial_activation = torch.nn.SiLU()
+
+ self.res_blocks = torch.nn.ModuleList([ResBlock(mid_channels, dims=dims) for _ in range(num_blocks_per_stage)])
+
+ if spatial_upsample and temporal_upsample:
+ self.upsampler = torch.nn.Sequential(
+ torch.nn.Conv3d(mid_channels, 8 * mid_channels, kernel_size=3, padding=1),
+ PixelShuffleND(3),
+ )
+ elif spatial_upsample:
+ if rational_resampler:
+ self.upsampler = SpatialRationalResampler(mid_channels=mid_channels, scale=self.spatial_scale)
+ else:
+ self.upsampler = torch.nn.Sequential(
+ torch.nn.Conv2d(mid_channels, 4 * mid_channels, kernel_size=3, padding=1),
+ PixelShuffleND(2),
+ )
+ elif temporal_upsample:
+ self.upsampler = torch.nn.Sequential(
+ torch.nn.Conv3d(mid_channels, 2 * mid_channels, kernel_size=3, padding=1),
+ PixelShuffleND(1),
+ )
+ else:
+ raise ValueError("Either spatial_upsample or temporal_upsample must be True")
+
+ self.post_upsample_res_blocks = torch.nn.ModuleList(
+ [ResBlock(mid_channels, dims=dims) for _ in range(num_blocks_per_stage)]
+ )
+
+ self.final_conv = conv(mid_channels, in_channels, kernel_size=3, padding=1)
+
+ def forward(self, latent: torch.Tensor) -> torch.Tensor:
+ b, _, f, _, _ = latent.shape
+
+ if self.dims == 2:
+ x = rearrange(latent, "b c f h w -> (b f) c h w")
+ x = self.initial_conv(x)
+ x = self.initial_norm(x)
+ x = self.initial_activation(x)
+
+ for block in self.res_blocks:
+ x = block(x)
+
+ x = self.upsampler(x)
+
+ for block in self.post_upsample_res_blocks:
+ x = block(x)
+
+ x = self.final_conv(x)
+ x = rearrange(x, "(b f) c h w -> b c f h w", b=b, f=f)
+ else:
+ x = self.initial_conv(latent)
+ x = self.initial_norm(x)
+ x = self.initial_activation(x)
+
+ for block in self.res_blocks:
+ x = block(x)
+
+ if self.temporal_upsample:
+ x = self.upsampler(x)
+ # remove the first frame after upsampling.
+ # This is done because the first frame encodes one pixel frame.
+ x = x[:, :, 1:, :, :]
+ elif isinstance(self.upsampler, SpatialRationalResampler):
+ x = self.upsampler(x)
+ else:
+ x = rearrange(x, "b c f h w -> (b f) c h w")
+ x = self.upsampler(x)
+ x = rearrange(x, "(b f) c h w -> b c f h w", b=b, f=f)
+
+ for block in self.post_upsample_res_blocks:
+ x = block(x)
+
+ x = self.final_conv(x)
+
+ return x
+
+
+def upsample_video(latent: torch.Tensor, video_encoder: VideoEncoder, upsampler: "LatentUpsampler") -> torch.Tensor:
+ """
+ Apply upsampling to the latent representation using the provided upsampler,
+ with normalization and un-normalization based on the video encoder's per-channel statistics.
+ Args:
+ latent: Input latent tensor of shape [B, C, F, H, W].
+ video_encoder: VideoEncoder with per_channel_statistics for normalization.
+ upsampler: LatentUpsampler module to perform upsampling.
+ Returns:
+ torch.Tensor: Upsampled and re-normalized latent tensor.
+ """
+ latent = video_encoder.per_channel_statistics.un_normalize(latent)
+ latent = upsampler(latent)
+ latent = video_encoder.per_channel_statistics.normalize(latent)
+ return latent
diff --git a/packages/ltx-core/src/ltx_core/model/upsampler/model_configurator.py b/packages/ltx-core/src/ltx_core/model/upsampler/model_configurator.py
new file mode 100644
index 0000000..2a714a4
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/upsampler/model_configurator.py
@@ -0,0 +1,30 @@
+from ltx_core.model.model_protocol import ModelConfigurator
+from ltx_core.model.upsampler.model import LatentUpsampler
+
+
+class LatentUpsamplerConfigurator(ModelConfigurator[LatentUpsampler]):
+ """
+ Configurator for LatentUpsampler model.
+ Used to create a LatentUpsampler model from a configuration dictionary.
+ """
+
+ @classmethod
+ def from_config(cls: type[LatentUpsampler], config: dict) -> LatentUpsampler:
+ in_channels = config.get("in_channels", 128)
+ mid_channels = config.get("mid_channels", 512)
+ num_blocks_per_stage = config.get("num_blocks_per_stage", 4)
+ dims = config.get("dims", 3)
+ spatial_upsample = config.get("spatial_upsample", True)
+ temporal_upsample = config.get("temporal_upsample", False)
+ spatial_scale = config.get("spatial_scale", 2.0)
+ rational_resampler = config.get("rational_resampler", False)
+ return LatentUpsampler(
+ in_channels=in_channels,
+ mid_channels=mid_channels,
+ num_blocks_per_stage=num_blocks_per_stage,
+ dims=dims,
+ spatial_upsample=spatial_upsample,
+ temporal_upsample=temporal_upsample,
+ spatial_scale=spatial_scale,
+ rational_resampler=rational_resampler,
+ )
diff --git a/packages/ltx-core/src/ltx_core/model/upsampler/pixel_shuffle.py b/packages/ltx-core/src/ltx_core/model/upsampler/pixel_shuffle.py
new file mode 100644
index 0000000..3c78f3b
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/upsampler/pixel_shuffle.py
@@ -0,0 +1,54 @@
+import torch
+from einops import rearrange
+
+
+class PixelShuffleND(torch.nn.Module):
+ """
+ N-dimensional pixel shuffle operation for upsampling tensors.
+ Args:
+ dims (int): Number of dimensions to apply pixel shuffle to.
+ - 1: Temporal (e.g., frames)
+ - 2: Spatial (e.g., height and width)
+ - 3: Spatiotemporal (e.g., depth, height, width)
+ upscale_factors (tuple[int, int, int], optional): Upscaling factors for each dimension.
+ For dims=1, only the first value is used.
+ For dims=2, the first two values are used.
+ For dims=3, all three values are used.
+ The input tensor is rearranged so that the channel dimension is split into
+ smaller channels and upscaling factors, and the upscaling factors are moved
+ into the corresponding spatial/temporal dimensions.
+ Note:
+ This operation is equivalent to the patchifier operation in for the models. Consider
+ using this class instead.
+ """
+
+ def __init__(self, dims: int, upscale_factors: tuple[int, int, int] = (2, 2, 2)):
+ super().__init__()
+ assert dims in [1, 2, 3], "dims must be 1, 2, or 3"
+ self.dims = dims
+ self.upscale_factors = upscale_factors
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ if self.dims == 3:
+ return rearrange(
+ x,
+ "b (c p1 p2 p3) d h w -> b c (d p1) (h p2) (w p3)",
+ p1=self.upscale_factors[0],
+ p2=self.upscale_factors[1],
+ p3=self.upscale_factors[2],
+ )
+ elif self.dims == 2:
+ return rearrange(
+ x,
+ "b (c p1 p2) h w -> b c (h p1) (w p2)",
+ p1=self.upscale_factors[0],
+ p2=self.upscale_factors[1],
+ )
+ elif self.dims == 1:
+ return rearrange(
+ x,
+ "b (c p1) f h w -> b c (f p1) h w",
+ p1=self.upscale_factors[0],
+ )
+ else:
+ raise ValueError(f"Unsupported dims: {self.dims}")
diff --git a/packages/ltx-core/src/ltx_core/model/upsampler/res_block.py b/packages/ltx-core/src/ltx_core/model/upsampler/res_block.py
new file mode 100644
index 0000000..8b76035
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/upsampler/res_block.py
@@ -0,0 +1,37 @@
+from typing import Optional
+
+import torch
+
+
+class ResBlock(torch.nn.Module):
+ """
+ Residual block with two convolutional layers, group normalization, and SiLU activation.
+ Args:
+ channels (int): Number of input and output channels.
+ mid_channels (Optional[int]): Number of channels in the intermediate convolution layer. Defaults to `channels`
+ if not specified.
+ dims (int): Dimensionality of the convolution (2 for Conv2d, 3 for Conv3d). Defaults to 3.
+ """
+
+ def __init__(self, channels: int, mid_channels: Optional[int] = None, dims: int = 3):
+ super().__init__()
+ if mid_channels is None:
+ mid_channels = channels
+
+ conv = torch.nn.Conv2d if dims == 2 else torch.nn.Conv3d
+
+ self.conv1 = conv(channels, mid_channels, kernel_size=3, padding=1)
+ self.norm1 = torch.nn.GroupNorm(32, mid_channels)
+ self.conv2 = conv(mid_channels, channels, kernel_size=3, padding=1)
+ self.norm2 = torch.nn.GroupNorm(32, channels)
+ self.activation = torch.nn.SiLU()
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ residual = x
+ x = self.conv1(x)
+ x = self.norm1(x)
+ x = self.activation(x)
+ x = self.conv2(x)
+ x = self.norm2(x)
+ x = self.activation(x + residual)
+ return x
diff --git a/packages/ltx-core/src/ltx_core/model/upsampler/spatial_rational_resampler.py b/packages/ltx-core/src/ltx_core/model/upsampler/spatial_rational_resampler.py
new file mode 100644
index 0000000..a4e0556
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/upsampler/spatial_rational_resampler.py
@@ -0,0 +1,47 @@
+from typing import Tuple
+
+import torch
+from einops import rearrange
+
+from ltx_core.model.upsampler.blur_downsample import BlurDownsample
+from ltx_core.model.upsampler.pixel_shuffle import PixelShuffleND
+
+
+def _rational_for_scale(scale: float) -> Tuple[int, int]:
+ mapping = {0.75: (3, 4), 1.5: (3, 2), 2.0: (2, 1), 4.0: (4, 1)}
+ if float(scale) not in mapping:
+ raise ValueError(f"Unsupported scale {scale}. Choose from {list(mapping.keys())}")
+ return mapping[float(scale)]
+
+
+class SpatialRationalResampler(torch.nn.Module):
+ """
+ Fully-learned rational spatial scaling: up by 'num' via PixelShuffle, then anti-aliased
+ downsample by 'den' using fixed blur + stride. Operates on H,W only.
+ For dims==3, work per-frame for spatial scaling (temporal axis untouched).
+ Args:
+ mid_channels (`int`): Number of intermediate channels for the convolution layer
+ scale (`float`): Spatial scaling factor. Supported values are:
+ - 0.75: Downsample by 3/4 (reduce spatial size)
+ - 1.5: Upsample by 3/2 (increase spatial size)
+ - 2.0: Upsample by 2x (double spatial size)
+ - 4.0: Upsample by 4x (quadruple spatial size)
+ Any other value will raise a ValueError.
+ """
+
+ def __init__(self, mid_channels: int, scale: float):
+ super().__init__()
+ self.scale = float(scale)
+ self.num, self.den = _rational_for_scale(self.scale)
+ self.conv = torch.nn.Conv2d(mid_channels, (self.num**2) * mid_channels, kernel_size=3, padding=1)
+ self.pixel_shuffle = PixelShuffleND(2, upscale_factors=(self.num, self.num))
+ self.blur_down = BlurDownsample(dims=2, stride=self.den)
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ b, _, f, _, _ = x.shape
+ x = rearrange(x, "b c f h w -> (b f) c h w")
+ x = self.conv(x)
+ x = self.pixel_shuffle(x)
+ x = self.blur_down(x)
+ x = rearrange(x, "(b f) c h w -> b c f h w", b=b, f=f)
+ return x
diff --git a/packages/ltx-core/src/ltx_core/model/video_vae/__init__.py b/packages/ltx-core/src/ltx_core/model/video_vae/__init__.py
new file mode 100644
index 0000000..62b1e6a
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/video_vae/__init__.py
@@ -0,0 +1,24 @@
+"""Video VAE package."""
+
+from ltx_core.model.video_vae.model_configurator import (
+ VAE_DECODER_COMFY_KEYS_FILTER,
+ VAE_ENCODER_COMFY_KEYS_FILTER,
+ VideoDecoderConfigurator,
+ VideoEncoderConfigurator,
+)
+from ltx_core.model.video_vae.tiling import SpatialTilingConfig, TemporalTilingConfig, TilingConfig
+from ltx_core.model.video_vae.video_vae import VideoDecoder, VideoEncoder, decode_video, get_video_chunks_number
+
+__all__ = [
+ "VAE_DECODER_COMFY_KEYS_FILTER",
+ "VAE_ENCODER_COMFY_KEYS_FILTER",
+ "SpatialTilingConfig",
+ "TemporalTilingConfig",
+ "TilingConfig",
+ "VideoDecoder",
+ "VideoDecoderConfigurator",
+ "VideoEncoder",
+ "VideoEncoderConfigurator",
+ "decode_video",
+ "get_video_chunks_number",
+]
diff --git a/packages/ltx-core/src/ltx_core/model/video_vae/convolution.py b/packages/ltx-core/src/ltx_core/model/video_vae/convolution.py
new file mode 100644
index 0000000..7c3957a
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/video_vae/convolution.py
@@ -0,0 +1,317 @@
+from typing import Tuple, Union
+
+import torch
+from einops import rearrange
+from torch import nn
+from torch.nn import functional as F
+
+from ltx_core.model.video_vae.enums import PaddingModeType
+
+
+def make_conv_nd( # noqa: PLR0913
+ dims: Union[int, Tuple[int, int]],
+ in_channels: int,
+ out_channels: int,
+ kernel_size: int,
+ stride: int = 1,
+ padding: int = 0,
+ dilation: int = 1,
+ groups: int = 1,
+ bias: bool = True,
+ causal: bool = False,
+ spatial_padding_mode: PaddingModeType = PaddingModeType.ZEROS,
+ temporal_padding_mode: PaddingModeType = PaddingModeType.ZEROS,
+) -> nn.Module:
+ if not (spatial_padding_mode == temporal_padding_mode or causal):
+ raise NotImplementedError("spatial and temporal padding modes must be equal")
+ if dims == 2:
+ return nn.Conv2d(
+ in_channels=in_channels,
+ out_channels=out_channels,
+ kernel_size=kernel_size,
+ stride=stride,
+ padding=padding,
+ dilation=dilation,
+ groups=groups,
+ bias=bias,
+ padding_mode=spatial_padding_mode.value,
+ )
+ elif dims == 3:
+ if causal:
+ return CausalConv3d(
+ in_channels=in_channels,
+ out_channels=out_channels,
+ kernel_size=kernel_size,
+ stride=stride,
+ dilation=dilation,
+ groups=groups,
+ bias=bias,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ return nn.Conv3d(
+ in_channels=in_channels,
+ out_channels=out_channels,
+ kernel_size=kernel_size,
+ stride=stride,
+ padding=padding,
+ dilation=dilation,
+ groups=groups,
+ bias=bias,
+ padding_mode=spatial_padding_mode.value,
+ )
+ elif dims == (2, 1):
+ return DualConv3d(
+ in_channels=in_channels,
+ out_channels=out_channels,
+ kernel_size=kernel_size,
+ stride=stride,
+ padding=padding,
+ bias=bias,
+ padding_mode=spatial_padding_mode.value,
+ )
+ else:
+ raise ValueError(f"unsupported dimensions: {dims}")
+
+
+def make_linear_nd(
+ dims: int,
+ in_channels: int,
+ out_channels: int,
+ bias: bool = True,
+) -> nn.Module:
+ if dims == 2:
+ return nn.Conv2d(in_channels=in_channels, out_channels=out_channels, kernel_size=1, bias=bias)
+ elif dims in (3, (2, 1)):
+ return nn.Conv3d(in_channels=in_channels, out_channels=out_channels, kernel_size=1, bias=bias)
+ else:
+ raise ValueError(f"unsupported dimensions: {dims}")
+
+
+class DualConv3d(nn.Module):
+ def __init__(
+ self,
+ in_channels: int,
+ out_channels: int,
+ kernel_size: int,
+ stride: Union[int, Tuple[int, int, int]] = 1,
+ padding: Union[int, Tuple[int, int, int]] = 0,
+ dilation: Union[int, Tuple[int, int, int]] = 1,
+ groups: int = 1,
+ bias: bool = True,
+ padding_mode: str = "zeros",
+ ) -> None:
+ super(DualConv3d, self).__init__()
+
+ self.in_channels = in_channels
+ self.out_channels = out_channels
+ self.padding_mode = padding_mode
+ # Ensure kernel_size, stride, padding, and dilation are tuples of length 3
+ if isinstance(kernel_size, int):
+ kernel_size = (kernel_size, kernel_size, kernel_size)
+ if kernel_size == (1, 1, 1):
+ raise ValueError("kernel_size must be greater than 1. Use make_linear_nd instead.")
+ if isinstance(stride, int):
+ stride = (stride, stride, stride)
+ if isinstance(padding, int):
+ padding = (padding, padding, padding)
+ if isinstance(dilation, int):
+ dilation = (dilation, dilation, dilation)
+
+ # Set parameters for convolutions
+ self.groups = groups
+ self.bias = bias
+
+ # Define the size of the channels after the first convolution
+ intermediate_channels = out_channels if in_channels < out_channels else in_channels
+
+ # Define parameters for the first convolution
+ self.weight1 = nn.Parameter(
+ torch.Tensor(
+ intermediate_channels,
+ in_channels // groups,
+ 1,
+ kernel_size[1],
+ kernel_size[2],
+ )
+ )
+ self.stride1 = (1, stride[1], stride[2])
+ self.padding1 = (0, padding[1], padding[2])
+ self.dilation1 = (1, dilation[1], dilation[2])
+ if bias:
+ self.bias1 = nn.Parameter(torch.Tensor(intermediate_channels))
+ else:
+ self.register_parameter("bias1", None)
+
+ # Define parameters for the second convolution
+ self.weight2 = nn.Parameter(torch.Tensor(out_channels, intermediate_channels // groups, kernel_size[0], 1, 1))
+ self.stride2 = (stride[0], 1, 1)
+ self.padding2 = (padding[0], 0, 0)
+ self.dilation2 = (dilation[0], 1, 1)
+ if bias:
+ self.bias2 = nn.Parameter(torch.Tensor(out_channels))
+ else:
+ self.register_parameter("bias2", None)
+
+ # Initialize weights and biases
+ self.reset_parameters()
+
+ def reset_parameters(self) -> None:
+ nn.init.kaiming_uniform_(self.weight1, a=torch.sqrt(5))
+ nn.init.kaiming_uniform_(self.weight2, a=torch.sqrt(5))
+ if self.bias:
+ fan_in1, _ = nn.init._calculate_fan_in_and_fan_out(self.weight1)
+ bound1 = 1 / torch.sqrt(fan_in1)
+ nn.init.uniform_(self.bias1, -bound1, bound1)
+ fan_in2, _ = nn.init._calculate_fan_in_and_fan_out(self.weight2)
+ bound2 = 1 / torch.sqrt(fan_in2)
+ nn.init.uniform_(self.bias2, -bound2, bound2)
+
+ def forward(
+ self,
+ x: torch.Tensor,
+ use_conv3d: bool = False,
+ skip_time_conv: bool = False,
+ ) -> torch.Tensor:
+ if use_conv3d:
+ return self.forward_with_3d(x=x, skip_time_conv=skip_time_conv)
+ else:
+ return self.forward_with_2d(x=x, skip_time_conv=skip_time_conv)
+
+ def forward_with_3d(self, x: torch.Tensor, skip_time_conv: bool = False) -> torch.Tensor:
+ # First convolution
+ x = F.conv3d(
+ x,
+ self.weight1,
+ self.bias1,
+ self.stride1,
+ self.padding1,
+ self.dilation1,
+ self.groups,
+ padding_mode=self.padding_mode,
+ )
+
+ if skip_time_conv:
+ return x
+
+ # Second convolution
+ x = F.conv3d(
+ x,
+ self.weight2,
+ self.bias2,
+ self.stride2,
+ self.padding2,
+ self.dilation2,
+ self.groups,
+ padding_mode=self.padding_mode,
+ )
+
+ return x
+
+ def forward_with_2d(self, x: torch.Tensor, skip_time_conv: bool = False) -> torch.Tensor:
+ b, _, _, h, w = x.shape
+
+ # First 2D convolution
+ x = rearrange(x, "b c d h w -> (b d) c h w")
+ # Squeeze the depth dimension out of weight1 since it's 1
+ weight1 = self.weight1.squeeze(2)
+ # Select stride, padding, and dilation for the 2D convolution
+ stride1 = (self.stride1[1], self.stride1[2])
+ padding1 = (self.padding1[1], self.padding1[2])
+ dilation1 = (self.dilation1[1], self.dilation1[2])
+ x = F.conv2d(
+ x,
+ weight1,
+ self.bias1,
+ stride1,
+ padding1,
+ dilation1,
+ self.groups,
+ padding_mode=self.padding_mode,
+ )
+
+ _, _, h, w = x.shape
+
+ if skip_time_conv:
+ x = rearrange(x, "(b d) c h w -> b c d h w", b=b)
+ return x
+
+ # Second convolution which is essentially treated as a 1D convolution across the 'd' dimension
+ x = rearrange(x, "(b d) c h w -> (b h w) c d", b=b)
+
+ # Reshape weight2 to match the expected dimensions for conv1d
+ weight2 = self.weight2.squeeze(-1).squeeze(-1)
+ # Use only the relevant dimension for stride, padding, and dilation for the 1D convolution
+ stride2 = self.stride2[0]
+ padding2 = self.padding2[0]
+ dilation2 = self.dilation2[0]
+ x = F.conv1d(
+ x,
+ weight2,
+ self.bias2,
+ stride2,
+ padding2,
+ dilation2,
+ self.groups,
+ padding_mode=self.padding_mode,
+ )
+ x = rearrange(x, "(b h w) c d -> b c d h w", b=b, h=h, w=w)
+
+ return x
+
+ @property
+ def weight(self) -> torch.Tensor:
+ return self.weight2
+
+
+class CausalConv3d(nn.Module):
+ def __init__(
+ self,
+ in_channels: int,
+ out_channels: int,
+ kernel_size: int = 3,
+ stride: Union[int, Tuple[int]] = 1,
+ dilation: int = 1,
+ groups: int = 1,
+ bias: bool = True,
+ spatial_padding_mode: PaddingModeType = PaddingModeType.ZEROS,
+ ) -> None:
+ super().__init__()
+
+ self.in_channels = in_channels
+ self.out_channels = out_channels
+
+ kernel_size = (kernel_size, kernel_size, kernel_size)
+ self.time_kernel_size = kernel_size[0]
+
+ dilation = (dilation, 1, 1)
+
+ height_pad = kernel_size[1] // 2
+ width_pad = kernel_size[2] // 2
+ padding = (0, height_pad, width_pad)
+
+ self.conv = nn.Conv3d(
+ in_channels,
+ out_channels,
+ kernel_size,
+ stride=stride,
+ dilation=dilation,
+ padding=padding,
+ padding_mode=spatial_padding_mode.value,
+ groups=groups,
+ bias=bias,
+ )
+
+ def forward(self, x: torch.Tensor, causal: bool = True) -> torch.Tensor:
+ if causal:
+ first_frame_pad = x[:, :, :1, :, :].repeat((1, 1, self.time_kernel_size - 1, 1, 1))
+ x = torch.concatenate((first_frame_pad, x), dim=2)
+ else:
+ first_frame_pad = x[:, :, :1, :, :].repeat((1, 1, (self.time_kernel_size - 1) // 2, 1, 1))
+ last_frame_pad = x[:, :, -1:, :, :].repeat((1, 1, (self.time_kernel_size - 1) // 2, 1, 1))
+ x = torch.concatenate((first_frame_pad, x, last_frame_pad), dim=2)
+ x = self.conv(x)
+ return x
+
+ @property
+ def weight(self) -> torch.Tensor:
+ return self.conv.weight
diff --git a/packages/ltx-core/src/ltx_core/model/video_vae/enums.py b/packages/ltx-core/src/ltx_core/model/video_vae/enums.py
new file mode 100644
index 0000000..edb2eac
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/video_vae/enums.py
@@ -0,0 +1,20 @@
+from enum import Enum
+
+
+class NormLayerType(Enum):
+ GROUP_NORM = "group_norm"
+ PIXEL_NORM = "pixel_norm"
+
+
+class LogVarianceType(Enum):
+ PER_CHANNEL = "per_channel"
+ UNIFORM = "uniform"
+ CONSTANT = "constant"
+ NONE = "none"
+
+
+class PaddingModeType(Enum):
+ ZEROS = "zeros"
+ REFLECT = "reflect"
+ REPLICATE = "replicate"
+ CIRCULAR = "circular"
diff --git a/packages/ltx-core/src/ltx_core/model/video_vae/model_configurator.py b/packages/ltx-core/src/ltx_core/model/video_vae/model_configurator.py
new file mode 100644
index 0000000..7998006
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/video_vae/model_configurator.py
@@ -0,0 +1,77 @@
+from ltx_core.loader.sd_ops import SDOps
+from ltx_core.model.model_protocol import ModelConfigurator
+from ltx_core.model.video_vae.enums import LogVarianceType, NormLayerType, PaddingModeType
+from ltx_core.model.video_vae.video_vae import VideoDecoder, VideoEncoder
+
+
+class VideoEncoderConfigurator(ModelConfigurator[VideoEncoder]):
+ """Configurator for creating a video VAE Encoder from a configuration dictionary."""
+
+ @classmethod
+ def from_config(cls: type[VideoEncoder], config: dict) -> VideoEncoder:
+ config = config.get("vae", {})
+ convolution_dimensions = config.get("dims", 3)
+ in_channels = config.get("in_channels", 3)
+ latent_channels = config.get("latent_channels", 128)
+ encoder_spatial_padding_mode = PaddingModeType(config.get("encoder_spatial_padding_mode", "zeros"))
+ encoder_blocks = config.get("encoder_blocks", [])
+ patch_size = config.get("patch_size", 4)
+ norm_layer_str = config.get("norm_layer", "pixel_norm")
+ latent_log_var_str = config.get("latent_log_var", "uniform")
+
+ return VideoEncoder(
+ convolution_dimensions=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=latent_channels,
+ encoder_blocks=encoder_blocks,
+ patch_size=patch_size,
+ norm_layer=NormLayerType(norm_layer_str),
+ latent_log_var=LogVarianceType(latent_log_var_str),
+ encoder_spatial_padding_mode=encoder_spatial_padding_mode,
+ )
+
+
+class VideoDecoderConfigurator(ModelConfigurator[VideoDecoder]):
+ """Configurator for creating a video VAE Decoder from a configuration dictionary."""
+
+ @classmethod
+ def from_config(cls: type[VideoDecoder], config: dict) -> VideoDecoder:
+ config = config.get("vae", {})
+ convolution_dimensions = config.get("dims", 3)
+ latent_channels = config.get("latent_channels", 128)
+ decoder_spatial_padding_mode = PaddingModeType(config.get("decoder_spatial_padding_mode", "reflect"))
+ out_channels = config.get("out_channels", 3)
+ decoder_blocks = config.get("decoder_blocks", [])
+ patch_size = config.get("patch_size", 4)
+ norm_layer_str = config.get("norm_layer", "pixel_norm")
+ causal = config.get("causal_decoder", False)
+ timestep_conditioning = config.get("timestep_conditioning", True)
+
+ return VideoDecoder(
+ convolution_dimensions=convolution_dimensions,
+ in_channels=latent_channels,
+ out_channels=out_channels,
+ decoder_blocks=decoder_blocks,
+ patch_size=patch_size,
+ norm_layer=NormLayerType(norm_layer_str),
+ causal=causal,
+ timestep_conditioning=timestep_conditioning,
+ decoder_spatial_padding_mode=decoder_spatial_padding_mode,
+ )
+
+
+VAE_DECODER_COMFY_KEYS_FILTER = (
+ SDOps("VAE_DECODER_COMFY_KEYS_FILTER")
+ .with_matching(prefix="vae.decoder.")
+ .with_matching(prefix="vae.per_channel_statistics.")
+ .with_replacement("vae.decoder.", "")
+ .with_replacement("vae.per_channel_statistics.", "per_channel_statistics.")
+)
+
+VAE_ENCODER_COMFY_KEYS_FILTER = (
+ SDOps("VAE_ENCODER_COMFY_KEYS_FILTER")
+ .with_matching(prefix="vae.encoder.")
+ .with_matching(prefix="vae.per_channel_statistics.")
+ .with_replacement("vae.encoder.", "")
+ .with_replacement("vae.per_channel_statistics.", "per_channel_statistics.")
+)
diff --git a/packages/ltx-core/src/ltx_core/model/video_vae/normalization.py b/packages/ltx-core/src/ltx_core/model/video_vae/normalization.py
new file mode 100644
index 0000000..45c0035
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/video_vae/normalization.py
@@ -0,0 +1,3 @@
+from ltx_core.model.common.normalization import PixelNorm, build_normalization_layer
+
+__all__ = ["PixelNorm", "build_normalization_layer"]
diff --git a/packages/ltx-core/src/ltx_core/model/video_vae/ops.py b/packages/ltx-core/src/ltx_core/model/video_vae/ops.py
new file mode 100644
index 0000000..cb0ed2d
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/video_vae/ops.py
@@ -0,0 +1,85 @@
+import torch
+from einops import rearrange
+from torch import nn
+
+
+def patchify(x: torch.Tensor, patch_size_hw: int, patch_size_t: int = 1) -> torch.Tensor:
+ """
+ Rearrange spatial dimensions into channels. Divides image into patch_size x patch_size blocks
+ and moves pixels from each block into separate channels (space-to-depth).
+ Args:
+ x: Input tensor (4D or 5D)
+ patch_size_hw: Spatial patch size for height and width. With patch_size_hw=4, divides HxW into 4x4 blocks.
+ patch_size_t: Temporal patch size for frames. Default=1 (no temporal patching).
+ For 5D: (B, C, F, H, W) -> (B, Cx(patch_size_hw^2)x(patch_size_t), F/patch_size_t, H/patch_size_hw, W/patch_size_hw)
+ Example: (B, 3, 33, 512, 512) with patch_size_hw=4, patch_size_t=1 -> (B, 48, 33, 128, 128)
+ """
+ if patch_size_hw == 1 and patch_size_t == 1:
+ return x
+ if x.dim() == 4:
+ x = rearrange(x, "b c (h q) (w r) -> b (c r q) h w", q=patch_size_hw, r=patch_size_hw)
+ elif x.dim() == 5:
+ x = rearrange(
+ x,
+ "b c (f p) (h q) (w r) -> b (c p r q) f h w",
+ p=patch_size_t,
+ q=patch_size_hw,
+ r=patch_size_hw,
+ )
+ else:
+ raise ValueError(f"Invalid input shape: {x.shape}")
+
+ return x
+
+
+def unpatchify(x: torch.Tensor, patch_size_hw: int, patch_size_t: int = 1) -> torch.Tensor:
+ """
+ Rearrange channels back into spatial dimensions. Inverse of patchify - moves pixels from
+ channels back into patch_size x patch_size blocks (depth-to-space).
+ Args:
+ x: Input tensor (4D or 5D)
+ patch_size_hw: Spatial patch size for height and width. With patch_size_hw=4, expands HxW by 4x.
+ patch_size_t: Temporal patch size for frames. Default=1 (no temporal expansion).
+ For 5D: (B, Cx(patch_size_hw^2)x(patch_size_t), F, H, W) -> (B, C, Fxpatch_size_t, Hxpatch_size_hw, Wxpatch_size_hw)
+ Example: (B, 48, 33, 128, 128) with patch_size_hw=4, patch_size_t=1 -> (B, 3, 33, 512, 512)
+ """
+ if patch_size_hw == 1 and patch_size_t == 1:
+ return x
+
+ if x.dim() == 4:
+ x = rearrange(x, "b (c r q) h w -> b c (h q) (w r)", q=patch_size_hw, r=patch_size_hw)
+ elif x.dim() == 5:
+ x = rearrange(
+ x,
+ "b (c p r q) f h w -> b c (f p) (h q) (w r)",
+ p=patch_size_t,
+ q=patch_size_hw,
+ r=patch_size_hw,
+ )
+
+ return x
+
+
+class PerChannelStatistics(nn.Module):
+ """
+ Per-channel statistics for normalizing and denormalizing the latent representation.
+ This statics is computed over the entire dataset and stored in model's checkpoint under VAE state_dict.
+ """
+
+ def __init__(self, latent_channels: int = 128):
+ super().__init__()
+ self.register_buffer("std-of-means", torch.empty(latent_channels))
+ self.register_buffer("mean-of-means", torch.empty(latent_channels))
+ self.register_buffer("mean-of-stds", torch.empty(latent_channels))
+ self.register_buffer("mean-of-stds_over_std-of-means", torch.empty(latent_channels))
+ self.register_buffer("channel", torch.empty(latent_channels))
+
+ def un_normalize(self, x: torch.Tensor) -> torch.Tensor:
+ return (x * self.get_buffer("std-of-means").view(1, -1, 1, 1, 1).to(x)) + self.get_buffer("mean-of-means").view(
+ 1, -1, 1, 1, 1
+ ).to(x)
+
+ def normalize(self, x: torch.Tensor) -> torch.Tensor:
+ return (x - self.get_buffer("mean-of-means").view(1, -1, 1, 1, 1).to(x)) / self.get_buffer("std-of-means").view(
+ 1, -1, 1, 1, 1
+ ).to(x)
diff --git a/packages/ltx-core/src/ltx_core/model/video_vae/resnet.py b/packages/ltx-core/src/ltx_core/model/video_vae/resnet.py
new file mode 100644
index 0000000..300e66b
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/video_vae/resnet.py
@@ -0,0 +1,277 @@
+from typing import Optional, Tuple, Union
+
+import torch
+from torch import nn
+
+from ltx_core.model.common.normalization import PixelNorm
+from ltx_core.model.transformer.timestep_embedding import PixArtAlphaCombinedTimestepSizeEmbeddings
+from ltx_core.model.video_vae.convolution import make_conv_nd, make_linear_nd
+from ltx_core.model.video_vae.enums import NormLayerType, PaddingModeType
+
+
+class ResnetBlock3D(nn.Module):
+ r"""
+ A Resnet block.
+ Parameters:
+ in_channels (`int`): The number of channels in the input.
+ out_channels (`int`, *optional*, default to be `None`):
+ The number of output channels for the first conv layer. If None, same as `in_channels`.
+ dropout (`float`, *optional*, defaults to `0.0`): The dropout probability to use.
+ groups (`int`, *optional*, default to `32`): The number of groups to use for the first normalization layer.
+ eps (`float`, *optional*, defaults to `1e-6`): The epsilon to use for the normalization.
+ """
+
+ def __init__(
+ self,
+ dims: Union[int, Tuple[int, int]],
+ in_channels: int,
+ out_channels: Optional[int] = None,
+ dropout: float = 0.0,
+ groups: int = 32,
+ eps: float = 1e-6,
+ norm_layer: NormLayerType = NormLayerType.PIXEL_NORM,
+ inject_noise: bool = False,
+ timestep_conditioning: bool = False,
+ spatial_padding_mode: PaddingModeType = PaddingModeType.ZEROS,
+ ):
+ super().__init__()
+ self.in_channels = in_channels
+ out_channels = in_channels if out_channels is None else out_channels
+ self.out_channels = out_channels
+ self.inject_noise = inject_noise
+
+ if norm_layer == NormLayerType.GROUP_NORM:
+ self.norm1 = nn.GroupNorm(num_groups=groups, num_channels=in_channels, eps=eps, affine=True)
+ elif norm_layer == NormLayerType.PIXEL_NORM:
+ self.norm1 = PixelNorm()
+
+ self.non_linearity = nn.SiLU()
+
+ self.conv1 = make_conv_nd(
+ dims,
+ in_channels,
+ out_channels,
+ kernel_size=3,
+ stride=1,
+ padding=1,
+ causal=True,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+
+ if inject_noise:
+ self.per_channel_scale1 = nn.Parameter(torch.zeros((in_channels, 1, 1)))
+
+ if norm_layer == NormLayerType.GROUP_NORM:
+ self.norm2 = nn.GroupNorm(num_groups=groups, num_channels=out_channels, eps=eps, affine=True)
+ elif norm_layer == NormLayerType.PIXEL_NORM:
+ self.norm2 = PixelNorm()
+
+ self.dropout = torch.nn.Dropout(dropout)
+
+ self.conv2 = make_conv_nd(
+ dims,
+ out_channels,
+ out_channels,
+ kernel_size=3,
+ stride=1,
+ padding=1,
+ causal=True,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+
+ if inject_noise:
+ self.per_channel_scale2 = nn.Parameter(torch.zeros((in_channels, 1, 1)))
+
+ self.conv_shortcut = (
+ make_linear_nd(dims=dims, in_channels=in_channels, out_channels=out_channels)
+ if in_channels != out_channels
+ else nn.Identity()
+ )
+
+ # Using GroupNorm with 1 group is equivalent to LayerNorm but works with (B, C, ...) layout
+ # avoiding the need for dimension rearrangement used in standard nn.LayerNorm
+ self.norm3 = (
+ nn.GroupNorm(num_groups=1, num_channels=in_channels, eps=eps, affine=True)
+ if in_channels != out_channels
+ else nn.Identity()
+ )
+
+ self.timestep_conditioning = timestep_conditioning
+
+ if timestep_conditioning:
+ self.scale_shift_table = nn.Parameter(torch.randn(4, in_channels) / in_channels**0.5)
+
+ def _feed_spatial_noise(
+ self,
+ hidden_states: torch.Tensor,
+ per_channel_scale: torch.Tensor,
+ generator: Optional[torch.Generator] = None,
+ ) -> torch.Tensor:
+ spatial_shape = hidden_states.shape[-2:]
+ device = hidden_states.device
+ dtype = hidden_states.dtype
+
+ # similar to the "explicit noise inputs" method in style-gan
+ spatial_noise = torch.randn(spatial_shape, device=device, dtype=dtype, generator=generator)[None]
+ scaled_noise = (spatial_noise * per_channel_scale)[None, :, None, ...]
+ hidden_states = hidden_states + scaled_noise
+
+ return hidden_states
+
+ def forward(
+ self,
+ input_tensor: torch.Tensor,
+ causal: bool = True,
+ timestep: Optional[torch.Tensor] = None,
+ generator: Optional[torch.Generator] = None,
+ ) -> torch.Tensor:
+ hidden_states = input_tensor
+ batch_size = hidden_states.shape[0]
+
+ hidden_states = self.norm1(hidden_states)
+ if self.timestep_conditioning:
+ if timestep is None:
+ raise ValueError("'timestep' parameter must be provided when 'timestep_conditioning' is True")
+ ada_values = self.scale_shift_table[None, ..., None, None, None].to(
+ device=hidden_states.device, dtype=hidden_states.dtype
+ ) + timestep.reshape(
+ batch_size,
+ 4,
+ -1,
+ timestep.shape[-3],
+ timestep.shape[-2],
+ timestep.shape[-1],
+ )
+ shift1, scale1, shift2, scale2 = ada_values.unbind(dim=1)
+
+ hidden_states = hidden_states * (1 + scale1) + shift1
+
+ hidden_states = self.non_linearity(hidden_states)
+
+ hidden_states = self.conv1(hidden_states, causal=causal)
+
+ if self.inject_noise:
+ hidden_states = self._feed_spatial_noise(
+ hidden_states,
+ self.per_channel_scale1.to(device=hidden_states.device, dtype=hidden_states.dtype),
+ generator=generator,
+ )
+
+ hidden_states = self.norm2(hidden_states)
+
+ if self.timestep_conditioning:
+ hidden_states = hidden_states * (1 + scale2) + shift2
+
+ hidden_states = self.non_linearity(hidden_states)
+
+ hidden_states = self.dropout(hidden_states)
+
+ hidden_states = self.conv2(hidden_states, causal=causal)
+
+ if self.inject_noise:
+ hidden_states = self._feed_spatial_noise(
+ hidden_states,
+ self.per_channel_scale2.to(device=hidden_states.device, dtype=hidden_states.dtype),
+ generator=generator,
+ )
+
+ input_tensor = self.norm3(input_tensor)
+
+ batch_size = input_tensor.shape[0]
+
+ input_tensor = self.conv_shortcut(input_tensor)
+
+ output_tensor = input_tensor + hidden_states
+
+ return output_tensor
+
+
+class UNetMidBlock3D(nn.Module):
+ """
+ A 3D UNet mid-block [`UNetMidBlock3D`] with multiple residual blocks.
+ Args:
+ in_channels (`int`): The number of input channels.
+ dropout (`float`, *optional*, defaults to 0.0): The dropout rate.
+ num_layers (`int`, *optional*, defaults to 1): The number of residual blocks.
+ resnet_eps (`float`, *optional*, 1e-6 ): The epsilon value for the resnet blocks.
+ resnet_groups (`int`, *optional*, defaults to 32):
+ The number of groups to use in the group normalization layers of the resnet blocks.
+ norm_layer (`str`, *optional*, defaults to `group_norm`):
+ The normalization layer to use. Can be either `group_norm` or `pixel_norm`.
+ inject_noise (`bool`, *optional*, defaults to `False`):
+ Whether to inject noise into the hidden states.
+ timestep_conditioning (`bool`, *optional*, defaults to `False`):
+ Whether to condition the hidden states on the timestep.
+ Returns:
+ `torch.Tensor`: The output of the last residual block, which is a tensor of shape `(batch_size,
+ in_channels, height, width)`.
+ """
+
+ def __init__(
+ self,
+ dims: Union[int, Tuple[int, int]],
+ in_channels: int,
+ dropout: float = 0.0,
+ num_layers: int = 1,
+ resnet_eps: float = 1e-6,
+ resnet_groups: int = 32,
+ norm_layer: NormLayerType = NormLayerType.GROUP_NORM,
+ inject_noise: bool = False,
+ timestep_conditioning: bool = False,
+ spatial_padding_mode: PaddingModeType = PaddingModeType.ZEROS,
+ ):
+ super().__init__()
+ resnet_groups = resnet_groups if resnet_groups is not None else min(in_channels // 4, 32)
+
+ self.timestep_conditioning = timestep_conditioning
+
+ if timestep_conditioning:
+ self.time_embedder = PixArtAlphaCombinedTimestepSizeEmbeddings(
+ embedding_dim=in_channels * 4, size_emb_dim=0
+ )
+
+ self.res_blocks = nn.ModuleList(
+ [
+ ResnetBlock3D(
+ dims=dims,
+ in_channels=in_channels,
+ out_channels=in_channels,
+ eps=resnet_eps,
+ groups=resnet_groups,
+ dropout=dropout,
+ norm_layer=norm_layer,
+ inject_noise=inject_noise,
+ timestep_conditioning=timestep_conditioning,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ for _ in range(num_layers)
+ ]
+ )
+
+ def forward(
+ self,
+ hidden_states: torch.Tensor,
+ causal: bool = True,
+ timestep: Optional[torch.Tensor] = None,
+ generator: Optional[torch.Generator] = None,
+ ) -> torch.Tensor:
+ timestep_embed = None
+ if self.timestep_conditioning:
+ if timestep is None:
+ raise ValueError("'timestep' parameter must be provided when 'timestep_conditioning' is True")
+ batch_size = hidden_states.shape[0]
+ timestep_embed = self.time_embedder(
+ timestep=timestep.flatten(),
+ hidden_dtype=hidden_states.dtype,
+ )
+ timestep_embed = timestep_embed.view(batch_size, timestep_embed.shape[-1], 1, 1, 1)
+
+ for resnet in self.res_blocks:
+ hidden_states = resnet(
+ hidden_states,
+ causal=causal,
+ timestep=timestep_embed,
+ generator=generator,
+ )
+
+ return hidden_states
diff --git a/packages/ltx-core/src/ltx_core/model/video_vae/sampling.py b/packages/ltx-core/src/ltx_core/model/video_vae/sampling.py
new file mode 100644
index 0000000..5d8f742
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/video_vae/sampling.py
@@ -0,0 +1,123 @@
+import math
+from typing import Tuple, Union
+
+import torch
+from einops import rearrange
+from torch import nn
+
+from .convolution import make_conv_nd
+from .enums import PaddingModeType
+
+
+class SpaceToDepthDownsample(nn.Module):
+ def __init__(
+ self,
+ dims: Union[int, Tuple[int, int]],
+ in_channels: int,
+ out_channels: int,
+ stride: Tuple[int, int, int],
+ spatial_padding_mode: PaddingModeType = PaddingModeType.ZEROS,
+ ):
+ super().__init__()
+ self.stride = stride
+ self.group_size = in_channels * math.prod(stride) // out_channels
+ self.conv = make_conv_nd(
+ dims=dims,
+ in_channels=in_channels,
+ out_channels=out_channels // math.prod(stride),
+ kernel_size=3,
+ stride=1,
+ causal=True,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+
+ def forward(
+ self,
+ x: torch.Tensor,
+ causal: bool = True,
+ ) -> torch.Tensor:
+ if self.stride[0] == 2:
+ x = torch.cat([x[:, :, :1, :, :], x], dim=2) # duplicate first frames for padding
+
+ # skip connection
+ x_in = rearrange(
+ x,
+ "b c (d p1) (h p2) (w p3) -> b (c p1 p2 p3) d h w",
+ p1=self.stride[0],
+ p2=self.stride[1],
+ p3=self.stride[2],
+ )
+ x_in = rearrange(x_in, "b (c g) d h w -> b c g d h w", g=self.group_size)
+ x_in = x_in.mean(dim=2)
+
+ # conv
+ x = self.conv(x, causal=causal)
+ x = rearrange(
+ x,
+ "b c (d p1) (h p2) (w p3) -> b (c p1 p2 p3) d h w",
+ p1=self.stride[0],
+ p2=self.stride[1],
+ p3=self.stride[2],
+ )
+
+ x = x + x_in
+
+ return x
+
+
+class DepthToSpaceUpsample(nn.Module):
+ def __init__(
+ self,
+ dims: int | Tuple[int, int],
+ in_channels: int,
+ stride: Tuple[int, int, int],
+ residual: bool = False,
+ out_channels_reduction_factor: int = 1,
+ spatial_padding_mode: PaddingModeType = PaddingModeType.ZEROS,
+ ):
+ super().__init__()
+ self.stride = stride
+ self.out_channels = math.prod(stride) * in_channels // out_channels_reduction_factor
+ self.conv = make_conv_nd(
+ dims=dims,
+ in_channels=in_channels,
+ out_channels=self.out_channels,
+ kernel_size=3,
+ stride=1,
+ causal=True,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ self.residual = residual
+ self.out_channels_reduction_factor = out_channels_reduction_factor
+
+ def forward(
+ self,
+ x: torch.Tensor,
+ causal: bool = True,
+ ) -> torch.Tensor:
+ if self.residual:
+ # Reshape and duplicate the input to match the output shape
+ x_in = rearrange(
+ x,
+ "b (c p1 p2 p3) d h w -> b c (d p1) (h p2) (w p3)",
+ p1=self.stride[0],
+ p2=self.stride[1],
+ p3=self.stride[2],
+ )
+ num_repeat = math.prod(self.stride) // self.out_channels_reduction_factor
+ x_in = x_in.repeat(1, num_repeat, 1, 1, 1)
+ if self.stride[0] == 2:
+ x_in = x_in[:, :, 1:, :, :]
+ x = self.conv(x, causal=causal)
+ x = rearrange(
+ x,
+ "b (c p1 p2 p3) d h w -> b c (d p1) (h p2) (w p3)",
+ p1=self.stride[0],
+ p2=self.stride[1],
+ p3=self.stride[2],
+ )
+ if self.stride[0] == 2:
+ x = x[:, :, 1:, :, :]
+ if self.residual:
+ x = x + x_in
+ return x
diff --git a/packages/ltx-core/src/ltx_core/model/video_vae/tiling.py b/packages/ltx-core/src/ltx_core/model/video_vae/tiling.py
new file mode 100644
index 0000000..bb79695
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/video_vae/tiling.py
@@ -0,0 +1,260 @@
+import itertools
+from dataclasses import dataclass
+from typing import Callable, List, NamedTuple, Tuple
+
+import torch
+
+
+def compute_trapezoidal_mask_1d(
+ length: int,
+ ramp_left: int,
+ ramp_right: int,
+ left_starts_from_0: bool = False,
+) -> torch.Tensor:
+ """
+ Generate a 1D trapezoidal blending mask with linear ramps.
+ Args:
+ length: Output length of the mask.
+ ramp_left: Fade-in length on the left.
+ ramp_right: Fade-out length on the right.
+ left_starts_from_0: Whether the ramp starts from 0 or first non-zero value.
+ Useful for temporal tiles where the first tile is causal.
+ Returns:
+ A 1D tensor of shape `(length,)` with values in [0, 1].
+ """
+ if length <= 0:
+ raise ValueError("Mask length must be positive.")
+
+ ramp_left = max(0, min(ramp_left, length))
+ ramp_right = max(0, min(ramp_right, length))
+
+ mask = torch.ones(length)
+
+ if ramp_left > 0:
+ interval_length = ramp_left + 1 if left_starts_from_0 else ramp_left + 2
+ fade_in = torch.linspace(0.0, 1.0, interval_length)[:-1]
+ if not left_starts_from_0:
+ fade_in = fade_in[1:]
+ mask[:ramp_left] *= fade_in
+
+ if ramp_right > 0:
+ fade_out = torch.linspace(1.0, 0.0, steps=ramp_right + 2)[1:-1]
+ mask[-ramp_right:] *= fade_out
+
+ return mask.clamp_(0, 1)
+
+
+@dataclass(frozen=True)
+class SpatialTilingConfig:
+ """Configuration for dividing each frame into spatial tiles with optional overlap.
+ Args:
+ tile_size_in_pixels (int): Size of each tile in pixels. Must be at least 64 and divisible by 32.
+ tile_overlap_in_pixels (int, optional): Overlap between tiles in pixels. Must be divisible by 32. Defaults to 0.
+ """
+
+ tile_size_in_pixels: int
+ tile_overlap_in_pixels: int = 0
+
+ def __post_init__(self) -> None:
+ if self.tile_size_in_pixels < 64:
+ raise ValueError(f"tile_size_in_pixels must be at least 64, got {self.tile_size_in_pixels}")
+ if self.tile_size_in_pixels % 32 != 0:
+ raise ValueError(f"tile_size_in_pixels must be divisible by 32, got {self.tile_size_in_pixels}")
+ if self.tile_overlap_in_pixels % 32 != 0:
+ raise ValueError(f"tile_overlap_in_pixels must be divisible by 32, got {self.tile_overlap_in_pixels}")
+ if self.tile_overlap_in_pixels >= self.tile_size_in_pixels:
+ raise ValueError(
+ f"Overlap must be less than tile size, got {self.tile_overlap_in_pixels} and {self.tile_size_in_pixels}"
+ )
+
+
+@dataclass(frozen=True)
+class TemporalTilingConfig:
+ """Configuration for dividing a video into temporal tiles (chunks of frames) with optional overlap.
+ Args:
+ tile_size_in_frames (int): Number of frames in each tile. Must be at least 16 and divisible by 8.
+ tile_overlap_in_frames (int, optional): Number of overlapping frames between consecutive tiles.
+ Must be divisible by 8. Defaults to 0.
+ """
+
+ tile_size_in_frames: int
+ tile_overlap_in_frames: int = 0
+
+ def __post_init__(self) -> None:
+ if self.tile_size_in_frames < 16:
+ raise ValueError(f"tile_size_in_frames must be at least 16, got {self.tile_size_in_frames}")
+ if self.tile_size_in_frames % 8 != 0:
+ raise ValueError(f"tile_size_in_frames must be divisible by 8, got {self.tile_size_in_frames}")
+ if self.tile_overlap_in_frames % 8 != 0:
+ raise ValueError(f"tile_overlap_in_frames must be divisible by 8, got {self.tile_overlap_in_frames}")
+ if self.tile_overlap_in_frames >= self.tile_size_in_frames:
+ raise ValueError(
+ f"Overlap must be less than tile size, got {self.tile_overlap_in_frames} and {self.tile_size_in_frames}"
+ )
+
+
+@dataclass(frozen=True)
+class TilingConfig:
+ """Configuration for splitting video into tiles with optional overlap.
+ Attributes:
+ spatial_config: Configuration for splitting spatial dimensions into tiles.
+ temporal_config: Configuration for splitting temporal dimension into tiles.
+ """
+
+ spatial_config: SpatialTilingConfig | None = None
+ temporal_config: TemporalTilingConfig | None = None
+
+ @classmethod
+ def default(cls) -> "TilingConfig":
+ return cls(
+ spatial_config=SpatialTilingConfig(tile_size_in_pixels=512, tile_overlap_in_pixels=64),
+ temporal_config=TemporalTilingConfig(tile_size_in_frames=64, tile_overlap_in_frames=24),
+ )
+
+
+@dataclass(frozen=True)
+class DimensionIntervals:
+ """Intervals which a single dimension of the latent space is split into.
+ Each interval is defined by its start, end, left ramp, and right ramp.
+ The start and end are the indices of the first and last element (exclusive) in the interval.
+ Ramps are regions of the interval where the value of the mask tensor is
+ interpolated between 0 and 1 for blending with neighboring intervals.
+ The left ramp and right ramp values are the lengths of the left and right ramps.
+ """
+
+ starts: List[int]
+ ends: List[int]
+ left_ramps: List[int]
+ right_ramps: List[int]
+
+
+@dataclass(frozen=True)
+class LatentIntervals:
+ """Intervals which the latent tensor of given shape is split into.
+ Each dimension of the latent space is split into intervals based on the length along said dimension.
+ """
+
+ original_shape: torch.Size
+ dimension_intervals: Tuple[DimensionIntervals, ...]
+
+
+# Operation to split a single dimension of the tensor into intervals based on the length along the dimension.
+SplitOperation = Callable[[int], DimensionIntervals]
+# Operation to map the intervals in input dimension to slices and masks along a corresponding output dimension.
+MappingOperation = Callable[[DimensionIntervals], tuple[list[slice], list[torch.Tensor | None]]]
+
+
+def default_split_operation(length: int) -> DimensionIntervals:
+ return DimensionIntervals(starts=[0], ends=[length], left_ramps=[0], right_ramps=[0])
+
+
+DEFAULT_SPLIT_OPERATION: SplitOperation = default_split_operation
+
+
+def default_mapping_operation(
+ _intervals: DimensionIntervals,
+) -> tuple[list[slice], list[torch.Tensor | None]]:
+ return [slice(0, None)], [None]
+
+
+DEFAULT_MAPPING_OPERATION: MappingOperation = default_mapping_operation
+
+
+class Tile(NamedTuple):
+ """
+ Represents a single tile.
+ Attributes:
+ in_coords:
+ Tuple of slices specifying where to cut the tile from the INPUT tensor.
+ out_coords:
+ Tuple of slices specifying where this tile's OUTPUT should be placed in the reconstructed OUTPUT tensor.
+ masks_1d:
+ Per-dimension masks in OUTPUT units.
+ These are used to create all-dimensional blending mask.
+ Methods:
+ blend_mask:
+ Create a single N-D mask from the per-dimension masks.
+ """
+
+ in_coords: Tuple[slice, ...]
+ out_coords: Tuple[slice, ...]
+ masks_1d: Tuple[Tuple[torch.Tensor, ...]]
+
+ @property
+ def blend_mask(self) -> torch.Tensor:
+ num_dims = len(self.out_coords)
+ per_dimension_masks: List[torch.Tensor] = []
+
+ for dim_idx in range(num_dims):
+ mask_1d = self.masks_1d[dim_idx]
+ view_shape = [1] * num_dims
+ if mask_1d is None:
+ # Broadcast mask along this dimension (length 1).
+ one = torch.ones(1)
+
+ view_shape[dim_idx] = 1
+ per_dimension_masks.append(one.view(*view_shape))
+ continue
+
+ # Reshape (L,) -> (1, ..., L, ..., 1) so masks across dimensions broadcast-multiply.
+ view_shape[dim_idx] = mask_1d.shape[0]
+ per_dimension_masks.append(mask_1d.view(*view_shape))
+
+ # Multiply per-dimension masks to form the full N-D mask (separable blending window).
+ combined_mask = per_dimension_masks[0]
+ for mask in per_dimension_masks[1:]:
+ combined_mask = combined_mask * mask
+
+ return combined_mask
+
+
+def create_tiles_from_intervals_and_mappers(
+ intervals: LatentIntervals,
+ mappers: List[MappingOperation],
+) -> List[Tile]:
+ full_dim_input_slices = []
+ full_dim_output_slices = []
+ full_dim_masks_1d = []
+ for axis_index in range(len(intervals.original_shape)):
+ dimension_intervals = intervals.dimension_intervals[axis_index]
+ starts = dimension_intervals.starts
+ ends = dimension_intervals.ends
+ input_slices = [slice(s, e) for s, e in zip(starts, ends, strict=True)]
+ output_slices, masks_1d = mappers[axis_index](dimension_intervals)
+ full_dim_input_slices.append(input_slices)
+ full_dim_output_slices.append(output_slices)
+ full_dim_masks_1d.append(masks_1d)
+
+ tiles = []
+ tile_in_coords = list(itertools.product(*full_dim_input_slices))
+ tile_out_coords = list(itertools.product(*full_dim_output_slices))
+ tile_mask_1ds = list(itertools.product(*full_dim_masks_1d))
+ for in_coord, out_coord, mask_1d in zip(tile_in_coords, tile_out_coords, tile_mask_1ds, strict=True):
+ tiles.append(
+ Tile(
+ in_coords=in_coord,
+ out_coords=out_coord,
+ masks_1d=mask_1d,
+ )
+ )
+ return tiles
+
+
+def create_tiles(
+ latent_shape: torch.Size,
+ splitters: List[SplitOperation],
+ mappers: List[MappingOperation],
+) -> List[Tile]:
+ if len(splitters) != len(latent_shape):
+ raise ValueError(
+ f"Number of splitters must be equal to number of dimensions in latent shape, "
+ f"got {len(splitters)} and {len(latent_shape)}"
+ )
+ if len(mappers) != len(latent_shape):
+ raise ValueError(
+ f"Number of mappers must be equal to number of dimensions in latent shape, "
+ f"got {len(mappers)} and {len(latent_shape)}"
+ )
+ intervals = [splitter(length) for splitter, length in zip(splitters, latent_shape, strict=True)]
+ latent_intervals = LatentIntervals(original_shape=latent_shape, dimension_intervals=tuple(intervals))
+ return create_tiles_from_intervals_and_mappers(latent_intervals, mappers)
diff --git a/packages/ltx-core/src/ltx_core/model/video_vae/video_vae.py b/packages/ltx-core/src/ltx_core/model/video_vae/video_vae.py
new file mode 100644
index 0000000..c65a3e0
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/model/video_vae/video_vae.py
@@ -0,0 +1,925 @@
+from dataclasses import replace
+from typing import Any, Callable, Iterator, List, Optional, Tuple
+
+import torch
+from einops import rearrange
+from torch import nn
+
+from ltx_core.model.common.normalization import PixelNorm
+from ltx_core.model.transformer.timestep_embedding import PixArtAlphaCombinedTimestepSizeEmbeddings
+from ltx_core.model.video_vae.convolution import make_conv_nd
+from ltx_core.model.video_vae.enums import LogVarianceType, NormLayerType, PaddingModeType
+from ltx_core.model.video_vae.ops import PerChannelStatistics, patchify, unpatchify
+from ltx_core.model.video_vae.resnet import ResnetBlock3D, UNetMidBlock3D
+from ltx_core.model.video_vae.sampling import DepthToSpaceUpsample, SpaceToDepthDownsample
+from ltx_core.model.video_vae.tiling import (
+ DEFAULT_MAPPING_OPERATION,
+ DEFAULT_SPLIT_OPERATION,
+ DimensionIntervals,
+ MappingOperation,
+ SplitOperation,
+ Tile,
+ TilingConfig,
+ compute_trapezoidal_mask_1d,
+ create_tiles,
+)
+from ltx_core.types import SpatioTemporalScaleFactors, VideoLatentShape
+
+
+def _make_encoder_block(
+ block_name: str,
+ block_config: dict[str, Any],
+ in_channels: int,
+ convolution_dimensions: int,
+ norm_layer: NormLayerType,
+ norm_num_groups: int,
+ spatial_padding_mode: PaddingModeType,
+) -> Tuple[nn.Module, int]:
+ out_channels = in_channels
+
+ if block_name == "res_x":
+ block = UNetMidBlock3D(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ num_layers=block_config["num_layers"],
+ resnet_eps=1e-6,
+ resnet_groups=norm_num_groups,
+ norm_layer=norm_layer,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "res_x_y":
+ out_channels = in_channels * block_config.get("multiplier", 2)
+ block = ResnetBlock3D(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=out_channels,
+ eps=1e-6,
+ groups=norm_num_groups,
+ norm_layer=norm_layer,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "compress_time":
+ block = make_conv_nd(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=out_channels,
+ kernel_size=3,
+ stride=(2, 1, 1),
+ causal=True,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "compress_space":
+ block = make_conv_nd(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=out_channels,
+ kernel_size=3,
+ stride=(1, 2, 2),
+ causal=True,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "compress_all":
+ block = make_conv_nd(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=out_channels,
+ kernel_size=3,
+ stride=(2, 2, 2),
+ causal=True,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "compress_all_x_y":
+ out_channels = in_channels * block_config.get("multiplier", 2)
+ block = make_conv_nd(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=out_channels,
+ kernel_size=3,
+ stride=(2, 2, 2),
+ causal=True,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "compress_all_res":
+ out_channels = in_channels * block_config.get("multiplier", 2)
+ block = SpaceToDepthDownsample(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=out_channels,
+ stride=(2, 2, 2),
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "compress_space_res":
+ out_channels = in_channels * block_config.get("multiplier", 2)
+ block = SpaceToDepthDownsample(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=out_channels,
+ stride=(1, 2, 2),
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "compress_time_res":
+ out_channels = in_channels * block_config.get("multiplier", 2)
+ block = SpaceToDepthDownsample(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=out_channels,
+ stride=(2, 1, 1),
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ else:
+ raise ValueError(f"unknown block: {block_name}")
+
+ return block, out_channels
+
+
+class VideoEncoder(nn.Module):
+ _DEFAULT_NORM_NUM_GROUPS = 32
+ """
+ Variational Autoencoder Encoder. Encodes video frames into a latent representation.
+ The encoder compresses the input video through a series of downsampling operations controlled by
+ patch_size and encoder_blocks. The output is a normalized latent tensor with shape (B, 128, F', H', W').
+ Compression Behavior:
+ The total compression is determined by:
+ 1. Initial spatial compression via patchify: H -> H/4, W -> W/4 (patch_size=4)
+ 2. Sequential compression through encoder_blocks based on their stride patterns
+ Compression blocks apply 2x compression in specified dimensions:
+ - "compress_time" / "compress_time_res": temporal only
+ - "compress_space" / "compress_space_res": spatial only (H and W)
+ - "compress_all" / "compress_all_res": all dimensions (F, H, W)
+ - "res_x" / "res_x_y": no compression
+ Standard LTX Video configuration:
+ - patch_size=4
+ - encoder_blocks: 1x compress_space_res, 1x compress_time_res, 2x compress_all_res
+ - Final dimensions: F' = 1 + (F-1)/8, H' = H/32, W' = W/32
+ - Example: (B, 3, 33, 512, 512) -> (B, 128, 5, 16, 16)
+ - Note: Input must have 1 + 8*k frames (e.g., 1, 9, 17, 25, 33...)
+ Args:
+ convolution_dimensions: The number of dimensions to use in convolutions (2D or 3D).
+ in_channels: The number of input channels. For RGB images, this is 3.
+ out_channels: The number of output channels (latent channels). For latent channels, this is 128.
+ encoder_blocks: The list of blocks to construct the encoder. Each block is a tuple of (block_name, params)
+ where params is either an int (num_layers) or a dict with configuration.
+ patch_size: The patch size for initial spatial compression. Should be a power of 2.
+ norm_layer: The normalization layer to use. Can be either `group_norm` or `pixel_norm`.
+ latent_log_var: The log variance mode. Can be either `per_channel`, `uniform`, `constant` or `none`.
+ """
+
+ def __init__(
+ self,
+ convolution_dimensions: int = 3,
+ in_channels: int = 3,
+ out_channels: int = 128,
+ encoder_blocks: List[Tuple[str, int]] | List[Tuple[str, dict[str, Any]]] = [], # noqa: B006
+ patch_size: int = 4,
+ norm_layer: NormLayerType = NormLayerType.PIXEL_NORM,
+ latent_log_var: LogVarianceType = LogVarianceType.UNIFORM,
+ encoder_spatial_padding_mode: PaddingModeType = PaddingModeType.ZEROS,
+ ):
+ super().__init__()
+
+ self.patch_size = patch_size
+ self.norm_layer = norm_layer
+ self.latent_channels = out_channels
+ self.latent_log_var = latent_log_var
+ self._norm_num_groups = self._DEFAULT_NORM_NUM_GROUPS
+
+ # Per-channel statistics for normalizing latents
+ self.per_channel_statistics = PerChannelStatistics(latent_channels=out_channels)
+
+ in_channels = in_channels * patch_size**2
+ feature_channels = out_channels
+
+ self.conv_in = make_conv_nd(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=feature_channels,
+ kernel_size=3,
+ stride=1,
+ padding=1,
+ causal=True,
+ spatial_padding_mode=encoder_spatial_padding_mode,
+ )
+
+ self.down_blocks = nn.ModuleList([])
+
+ for block_name, block_params in encoder_blocks:
+ # Convert int to dict format for uniform handling
+ block_config = {"num_layers": block_params} if isinstance(block_params, int) else block_params
+
+ block, feature_channels = _make_encoder_block(
+ block_name=block_name,
+ block_config=block_config,
+ in_channels=feature_channels,
+ convolution_dimensions=convolution_dimensions,
+ norm_layer=norm_layer,
+ norm_num_groups=self._norm_num_groups,
+ spatial_padding_mode=encoder_spatial_padding_mode,
+ )
+
+ self.down_blocks.append(block)
+
+ # out
+ if norm_layer == NormLayerType.GROUP_NORM:
+ self.conv_norm_out = nn.GroupNorm(num_channels=feature_channels, num_groups=self._norm_num_groups, eps=1e-6)
+ elif norm_layer == NormLayerType.PIXEL_NORM:
+ self.conv_norm_out = PixelNorm()
+
+ self.conv_act = nn.SiLU()
+
+ conv_out_channels = out_channels
+ if latent_log_var == LogVarianceType.PER_CHANNEL:
+ conv_out_channels *= 2
+ elif latent_log_var in {LogVarianceType.UNIFORM, LogVarianceType.CONSTANT}:
+ conv_out_channels += 1
+ elif latent_log_var != LogVarianceType.NONE:
+ raise ValueError(f"Invalid latent_log_var: {latent_log_var}")
+
+ self.conv_out = make_conv_nd(
+ dims=convolution_dimensions,
+ in_channels=feature_channels,
+ out_channels=conv_out_channels,
+ kernel_size=3,
+ padding=1,
+ causal=True,
+ spatial_padding_mode=encoder_spatial_padding_mode,
+ )
+
+ def forward(self, sample: torch.Tensor) -> torch.Tensor:
+ r"""
+ Encode video frames into normalized latent representation.
+ Args:
+ sample: Input video (B, C, F, H, W). F must be 1 + 8*k (e.g., 1, 9, 17, 25, 33...).
+ Returns:
+ Normalized latent means (B, 128, F', H', W') where F' = 1+(F-1)/8, H' = H/32, W' = W/32.
+ Example: (B, 3, 33, 512, 512) -> (B, 128, 5, 16, 16).
+ """
+ # Validate frame count
+ frames_count = sample.shape[2]
+ if ((frames_count - 1) % 8) != 0:
+ raise ValueError(
+ "Invalid number of frames: Encode input must have 1 + 8 * x frames "
+ "(e.g., 1, 9, 17, ...). Please check your input."
+ )
+
+ # Initial spatial compression: trade spatial resolution for channel depth
+ # This reduces H,W by patch_size and increases channels, making convolutions more efficient
+ # Example: (B, 3, F, 512, 512) -> (B, 48, F, 128, 128) with patch_size=4
+ sample = patchify(sample, patch_size_hw=self.patch_size, patch_size_t=1)
+ sample = self.conv_in(sample)
+
+ for down_block in self.down_blocks:
+ sample = down_block(sample)
+
+ sample = self.conv_norm_out(sample)
+ sample = self.conv_act(sample)
+ sample = self.conv_out(sample)
+
+ if self.latent_log_var == LogVarianceType.UNIFORM:
+ # Uniform Variance: model outputs N means and 1 shared log-variance channel.
+ # We need to expand the single logvar to match the number of means channels
+ # to create a format compatible with PER_CHANNEL (means + logvar, each with N channels).
+ # Sample shape: (B, N+1, ...) where N = latent_channels (e.g., 128 means + 1 logvar = 129)
+ # Target shape: (B, 2*N, ...) where first N are means, last N are logvar
+
+ if sample.shape[1] < 2:
+ raise ValueError(
+ f"Invalid channel count for UNIFORM mode: expected at least 2 channels "
+ f"(N means + 1 logvar), got {sample.shape[1]}"
+ )
+
+ # Extract means (first N channels) and logvar (last 1 channel)
+ means = sample[:, :-1, ...] # (B, N, ...)
+ logvar = sample[:, -1:, ...] # (B, 1, ...)
+
+ # Repeat logvar N times to match means channels
+ # Use expand/repeat pattern that works for both 4D and 5D tensors
+ num_channels = means.shape[1]
+ repeat_shape = [1, num_channels] + [1] * (sample.ndim - 2)
+ repeated_logvar = logvar.repeat(*repeat_shape) # (B, N, ...)
+
+ # Concatenate to create (B, 2*N, ...) format: [means, repeated_logvar]
+ sample = torch.cat([means, repeated_logvar], dim=1)
+ elif self.latent_log_var == LogVarianceType.CONSTANT:
+ sample = sample[:, :-1, ...]
+ approx_ln_0 = -30 # this is the minimal clamp value in DiagonalGaussianDistribution objects
+ sample = torch.cat(
+ [sample, torch.ones_like(sample, device=sample.device) * approx_ln_0],
+ dim=1,
+ )
+
+ # Split into means and logvar, then normalize means
+ means, _ = torch.chunk(sample, 2, dim=1)
+ return self.per_channel_statistics.normalize(means)
+
+
+def _make_decoder_block(
+ block_name: str,
+ block_config: dict[str, Any],
+ in_channels: int,
+ convolution_dimensions: int,
+ norm_layer: NormLayerType,
+ timestep_conditioning: bool,
+ norm_num_groups: int,
+ spatial_padding_mode: PaddingModeType,
+) -> Tuple[nn.Module, int]:
+ out_channels = in_channels
+ if block_name == "res_x":
+ block = UNetMidBlock3D(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ num_layers=block_config["num_layers"],
+ resnet_eps=1e-6,
+ resnet_groups=norm_num_groups,
+ norm_layer=norm_layer,
+ inject_noise=block_config.get("inject_noise", False),
+ timestep_conditioning=timestep_conditioning,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "attn_res_x":
+ block = UNetMidBlock3D(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ num_layers=block_config["num_layers"],
+ resnet_groups=norm_num_groups,
+ norm_layer=norm_layer,
+ inject_noise=block_config.get("inject_noise", False),
+ timestep_conditioning=timestep_conditioning,
+ attention_head_dim=block_config["attention_head_dim"],
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "res_x_y":
+ out_channels = in_channels // block_config.get("multiplier", 2)
+ block = ResnetBlock3D(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=out_channels,
+ eps=1e-6,
+ groups=norm_num_groups,
+ norm_layer=norm_layer,
+ inject_noise=block_config.get("inject_noise", False),
+ timestep_conditioning=False,
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "compress_time":
+ block = DepthToSpaceUpsample(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ stride=(2, 1, 1),
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "compress_space":
+ block = DepthToSpaceUpsample(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ stride=(1, 2, 2),
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ elif block_name == "compress_all":
+ out_channels = in_channels // block_config.get("multiplier", 1)
+ block = DepthToSpaceUpsample(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ stride=(2, 2, 2),
+ residual=block_config.get("residual", False),
+ out_channels_reduction_factor=block_config.get("multiplier", 1),
+ spatial_padding_mode=spatial_padding_mode,
+ )
+ else:
+ raise ValueError(f"unknown layer: {block_name}")
+
+ return block, out_channels
+
+
+class VideoDecoder(nn.Module):
+ _DEFAULT_NORM_NUM_GROUPS = 32
+ """
+ Variational Autoencoder Decoder. Decodes latent representation into video frames.
+ The decoder upsamples latents through a series of upsampling operations (inverse of encoder).
+ Output dimensions: F = 8x(F'-1) + 1, H = 32xH', W = 32xW' for standard LTX Video configuration.
+ Upsampling blocks expand dimensions by 2x in specified dimensions:
+ - "compress_time": temporal only
+ - "compress_space": spatial only (H and W)
+ - "compress_all": all dimensions (F, H, W)
+ - "res_x" / "res_x_y" / "attn_res_x": no upsampling
+ Causal Mode:
+ causal=False (standard): Symmetric padding, allows future frame dependencies.
+ causal=True: Causal padding, each frame depends only on past/current frames.
+ First frame removed after temporal upsampling in both modes. Output shape unchanged.
+ Example: (B, 128, 5, 16, 16) -> (B, 3, 33, 512, 512) for both modes.
+ Args:
+ convolution_dimensions: The number of dimensions to use in convolutions (2D or 3D).
+ in_channels: The number of input channels (latent channels). Default is 128.
+ out_channels: The number of output channels. For RGB images, this is 3.
+ decoder_blocks: The list of blocks to construct the decoder. Each block is a tuple of (block_name, params)
+ where params is either an int (num_layers) or a dict with configuration.
+ patch_size: Final spatial expansion factor. For standard LTX Video, use 4 for 4x spatial expansion:
+ H -> Hx4, W -> Wx4. Should be a power of 2.
+ norm_layer: The normalization layer to use. Can be either `group_norm` or `pixel_norm`.
+ causal: Whether to use causal convolutions. For standard LTX Video, use False for symmetric padding.
+ When True, uses causal padding (past/current frames only).
+ timestep_conditioning: Whether to condition the decoder on timestep for denoising.
+ """
+
+ def __init__(
+ self,
+ convolution_dimensions: int = 3,
+ in_channels: int = 128,
+ out_channels: int = 3,
+ decoder_blocks: List[Tuple[str, int | dict]] = [], # noqa: B006
+ patch_size: int = 4,
+ norm_layer: NormLayerType = NormLayerType.PIXEL_NORM,
+ causal: bool = False,
+ timestep_conditioning: bool = False,
+ decoder_spatial_padding_mode: PaddingModeType = PaddingModeType.REFLECT,
+ ):
+ super().__init__()
+
+ # Spatiotemporal downscaling between decoded video space and VAE latents.
+ # According to the LTXV paper, the standard configuration downsamples
+ # video inputs by a factor of 8 in the temporal dimension and 32 in
+ # each spatial dimension (height and width). This parameter determines how
+ # many video frames and pixels correspond to a single latent cell.
+ self.video_downscale_factors = SpatioTemporalScaleFactors(
+ time=8,
+ width=32,
+ height=32,
+ )
+
+ self.patch_size = patch_size
+ out_channels = out_channels * patch_size**2
+ self.causal = causal
+ self.timestep_conditioning = timestep_conditioning
+ self._norm_num_groups = self._DEFAULT_NORM_NUM_GROUPS
+
+ # Per-channel statistics for denormalizing latents
+ self.per_channel_statistics = PerChannelStatistics(latent_channels=in_channels)
+
+ # Noise and timestep parameters for decoder conditioning
+ self.decode_noise_scale = 0.025
+ self.decode_timestep = 0.05
+
+ # Compute initial feature_channels by going through blocks in reverse
+ # This determines the channel width at the start of the decoder
+ feature_channels = in_channels
+ for block_name, block_params in list(reversed(decoder_blocks)):
+ block_config = block_params if isinstance(block_params, dict) else {}
+ if block_name == "res_x_y":
+ feature_channels = feature_channels * block_config.get("multiplier", 2)
+ if block_name == "compress_all":
+ feature_channels = feature_channels * block_config.get("multiplier", 1)
+
+ self.conv_in = make_conv_nd(
+ dims=convolution_dimensions,
+ in_channels=in_channels,
+ out_channels=feature_channels,
+ kernel_size=3,
+ stride=1,
+ padding=1,
+ causal=True,
+ spatial_padding_mode=decoder_spatial_padding_mode,
+ )
+
+ self.up_blocks = nn.ModuleList([])
+
+ for block_name, block_params in list(reversed(decoder_blocks)):
+ # Convert int to dict format for uniform handling
+ block_config = {"num_layers": block_params} if isinstance(block_params, int) else block_params
+
+ block, feature_channels = _make_decoder_block(
+ block_name=block_name,
+ block_config=block_config,
+ in_channels=feature_channels,
+ convolution_dimensions=convolution_dimensions,
+ norm_layer=norm_layer,
+ timestep_conditioning=timestep_conditioning,
+ norm_num_groups=self._norm_num_groups,
+ spatial_padding_mode=decoder_spatial_padding_mode,
+ )
+
+ self.up_blocks.append(block)
+
+ if norm_layer == NormLayerType.GROUP_NORM:
+ self.conv_norm_out = nn.GroupNorm(num_channels=feature_channels, num_groups=self._norm_num_groups, eps=1e-6)
+ elif norm_layer == NormLayerType.PIXEL_NORM:
+ self.conv_norm_out = PixelNorm()
+
+ self.conv_act = nn.SiLU()
+ self.conv_out = make_conv_nd(
+ dims=convolution_dimensions,
+ in_channels=feature_channels,
+ out_channels=out_channels,
+ kernel_size=3,
+ padding=1,
+ causal=True,
+ spatial_padding_mode=decoder_spatial_padding_mode,
+ )
+
+ if timestep_conditioning:
+ self.timestep_scale_multiplier = nn.Parameter(torch.tensor(1000.0))
+ self.last_time_embedder = PixArtAlphaCombinedTimestepSizeEmbeddings(
+ embedding_dim=feature_channels * 2, size_emb_dim=0
+ )
+ self.last_scale_shift_table = nn.Parameter(torch.empty(2, feature_channels))
+
+ # def forward(self, sample: torch.Tensor, target_shape) -> torch.Tensor:
+ def forward(
+ self,
+ sample: torch.Tensor,
+ timestep: Optional[torch.Tensor] = None,
+ generator: Optional[torch.Generator] = None,
+ ) -> torch.Tensor:
+ r"""
+ Decode latent representation into video frames.
+ Args:
+ sample: Latent tensor (B, 128, F', H', W').
+ timestep: Timestep for conditioning (if timestep_conditioning=True). Uses default 0.05 if None.
+ generator: Random generator for deterministic noise injection (if inject_noise=True in blocks).
+ Returns:
+ Decoded video (B, 3, F, H, W) where F = 8x(F'-1) + 1, H = 32xH', W = 32xW'.
+ Example: (B, 128, 5, 16, 16) -> (B, 3, 33, 512, 512).
+ Note: First frame is removed after temporal upsampling regardless of causal mode.
+ When causal=False, allows future frame dependencies in convolutions but maintains same output shape.
+ """
+ batch_size = sample.shape[0]
+
+ # Add noise if timestep conditioning is enabled
+ if self.timestep_conditioning:
+ noise = (
+ torch.randn(
+ sample.size(),
+ generator=generator,
+ dtype=sample.dtype,
+ device=sample.device,
+ )
+ * self.decode_noise_scale
+ )
+
+ sample = noise + (1.0 - self.decode_noise_scale) * sample
+
+ # Denormalize latents
+ sample = self.per_channel_statistics.un_normalize(sample)
+
+ # Use default decode_timestep if timestep not provided
+ if timestep is None and self.timestep_conditioning:
+ timestep = torch.full((batch_size,), self.decode_timestep, device=sample.device, dtype=sample.dtype)
+
+ sample = self.conv_in(sample, causal=self.causal)
+
+ scaled_timestep = None
+ if self.timestep_conditioning:
+ if timestep is None:
+ raise ValueError("'timestep' parameter must be provided when 'timestep_conditioning' is True")
+ scaled_timestep = timestep * self.timestep_scale_multiplier.to(sample)
+
+ for up_block in self.up_blocks:
+ if isinstance(up_block, UNetMidBlock3D):
+ block_kwargs = {
+ "causal": self.causal,
+ "timestep": scaled_timestep if self.timestep_conditioning else None,
+ "generator": generator,
+ }
+ sample = up_block(sample, **block_kwargs)
+ elif isinstance(up_block, ResnetBlock3D):
+ sample = up_block(sample, causal=self.causal, generator=generator)
+ else:
+ sample = up_block(sample, causal=self.causal)
+
+ sample = self.conv_norm_out(sample)
+
+ if self.timestep_conditioning:
+ embedded_timestep = self.last_time_embedder(
+ timestep=scaled_timestep.flatten(),
+ hidden_dtype=sample.dtype,
+ )
+ embedded_timestep = embedded_timestep.view(batch_size, embedded_timestep.shape[-1], 1, 1, 1)
+ ada_values = self.last_scale_shift_table[None, ..., None, None, None].to(
+ device=sample.device, dtype=sample.dtype
+ ) + embedded_timestep.reshape(
+ batch_size,
+ 2,
+ -1,
+ embedded_timestep.shape[-3],
+ embedded_timestep.shape[-2],
+ embedded_timestep.shape[-1],
+ )
+ shift, scale = ada_values.unbind(dim=1)
+ sample = sample * (1 + scale) + shift
+
+ sample = self.conv_act(sample)
+ sample = self.conv_out(sample, causal=self.causal)
+
+ # Final spatial expansion: reverse the initial patchify from encoder
+ # Moves pixels from channels back to spatial dimensions
+ # Example: (B, 48, F, 128, 128) -> (B, 3, F, 512, 512) with patch_size=4
+ sample = unpatchify(sample, patch_size_hw=self.patch_size, patch_size_t=1)
+
+ return sample
+
+ def _prepare_tiles(
+ self,
+ latent: torch.Tensor,
+ tiling_config: TilingConfig | None = None,
+ ) -> List[Tile]:
+ splitters = [DEFAULT_SPLIT_OPERATION] * len(latent.shape)
+ mappers = [DEFAULT_MAPPING_OPERATION] * len(latent.shape)
+ if tiling_config is not None and tiling_config.spatial_config is not None:
+ cfg = tiling_config.spatial_config
+ long_side = max(latent.shape[3], latent.shape[4])
+
+ def enable_on_axis(axis_idx: int, factor: int) -> None:
+ size = cfg.tile_size_in_pixels // factor
+ overlap = cfg.tile_overlap_in_pixels // factor
+ axis_length = latent.shape[axis_idx]
+ lower_threshold = max(2, overlap + 1)
+ tile_size = max(lower_threshold, round(size * axis_length / long_side))
+ splitters[axis_idx] = split_in_spatial(tile_size, overlap)
+ mappers[axis_idx] = to_mapping_operation(map_spatial_slice, factor)
+
+ enable_on_axis(3, self.video_downscale_factors.height)
+ enable_on_axis(4, self.video_downscale_factors.width)
+
+ if tiling_config is not None and tiling_config.temporal_config is not None:
+ cfg = tiling_config.temporal_config
+ tile_size = cfg.tile_size_in_frames // self.video_downscale_factors.time
+ overlap = cfg.tile_overlap_in_frames // self.video_downscale_factors.time
+ splitters[2] = split_in_temporal(tile_size, overlap)
+ mappers[2] = to_mapping_operation(map_temporal_slice, self.video_downscale_factors.time)
+
+ return create_tiles(latent.shape, splitters, mappers)
+
+ def tiled_decode(
+ self,
+ latent: torch.Tensor,
+ tiling_config: TilingConfig | None = None,
+ timestep: Optional[torch.Tensor] = None,
+ generator: Optional[torch.Generator] = None,
+ ) -> Iterator[torch.Tensor]:
+ """
+ Decode a latent tensor into video frames using tiled processing.
+ Splits the latent tensor into tiles, decodes each tile individually,
+ and yields video chunks as they become available.
+ Args:
+ latent: Input latent tensor (B, C, F', H', W').
+ tiling_config: Tiling configuration for the latent tensor.
+ timestep: Optional timestep for decoder conditioning.
+ generator: Optional random generator for deterministic decoding.
+ Yields:
+ Video chunks (B, C, T, H, W) by temporal slices;
+ """
+
+ # Calculate full video shape from latent shape to get spatial dimensions
+ full_video_shape = VideoLatentShape.from_torch_shape(latent.shape).upscale(self.video_downscale_factors)
+ tiles = self._prepare_tiles(latent, tiling_config)
+
+ temporal_groups = self._group_tiles_by_temporal_slice(tiles)
+
+ # State for temporal overlap handling
+ previous_chunk = None
+ previous_weights = None
+ previous_temporal_slice = None
+
+ for temporal_group_tiles in temporal_groups:
+ curr_temporal_slice = temporal_group_tiles[0].out_coords[2]
+
+ # Calculate the shape of the temporal buffer for this group of tiles.
+ # The temporal length depends on whether this is the first tile (starts at 0) or not.
+ # - First tile: (frames - 1) * scale + 1
+ # - Subsequent tiles: frames * scale
+ # This logic is handled by TemporalAxisMapping and reflected in out_coords.
+ temporal_tile_buffer_shape = full_video_shape._replace(
+ frames=curr_temporal_slice.stop - curr_temporal_slice.start,
+ )
+
+ buffer = torch.zeros(
+ temporal_tile_buffer_shape.to_torch_shape(),
+ device=latent.device,
+ dtype=latent.dtype,
+ )
+
+ curr_weights = self._accumulate_temporal_group_into_buffer(
+ group_tiles=temporal_group_tiles,
+ buffer=buffer,
+ latent=latent,
+ timestep=timestep,
+ generator=generator,
+ )
+
+ # Blend with previous temporal chunk if it exists
+ if previous_chunk is not None:
+ # Check if current temporal slice overlaps with previous temporal slice
+ if previous_temporal_slice.stop > curr_temporal_slice.start:
+ overlap_len = previous_temporal_slice.stop - curr_temporal_slice.start
+ temporal_overlap_slice = slice(curr_temporal_slice.start - previous_temporal_slice.start, None)
+
+ # The overlap is already masked before it reaches this step. Each tile is accumulated into buffer
+ # with its trapezoidal mask, and curr_weights accumulates the same mask. In the overlap blend we add
+ # the masked values (buffer[...]) and the corresponding weights (curr_weights[...]) into the
+ # previous buffers, then later normalize by weights.
+ previous_chunk[:, :, temporal_overlap_slice, :, :] += buffer[:, :, slice(0, overlap_len), :, :]
+ previous_weights[:, :, temporal_overlap_slice, :, :] += curr_weights[
+ :, :, slice(0, overlap_len), :, :
+ ]
+
+ buffer[:, :, slice(0, overlap_len), :, :] = previous_chunk[:, :, temporal_overlap_slice, :, :]
+ curr_weights[:, :, slice(0, overlap_len), :, :] = previous_weights[
+ :, :, temporal_overlap_slice, :, :
+ ]
+
+ # Yield the non-overlapping part of the previous chunk
+ previous_weights = previous_weights.clamp(min=1e-8)
+ yield_len = curr_temporal_slice.start - previous_temporal_slice.start
+ yield (previous_chunk / previous_weights)[:, :, :yield_len, :, :]
+
+ # Update state for next iteration
+ previous_chunk = buffer
+ previous_weights = curr_weights
+ previous_temporal_slice = curr_temporal_slice
+
+ # Yield any remaining chunk
+ if previous_chunk is not None:
+ previous_weights = previous_weights.clamp(min=1e-8)
+ yield previous_chunk / previous_weights
+
+ def _group_tiles_by_temporal_slice(self, tiles: List[Tile]) -> List[List[Tile]]:
+ """Group tiles by their temporal output slice."""
+ if not tiles:
+ return []
+
+ groups = []
+ current_slice = tiles[0].out_coords[2]
+ current_group = []
+
+ for tile in tiles:
+ tile_slice = tile.out_coords[2]
+ if tile_slice == current_slice:
+ current_group.append(tile)
+ else:
+ groups.append(current_group)
+ current_slice = tile_slice
+ current_group = [tile]
+
+ # Add the final group
+ if current_group:
+ groups.append(current_group)
+
+ return groups
+
+ def _accumulate_temporal_group_into_buffer(
+ self,
+ group_tiles: List[Tile],
+ buffer: torch.Tensor,
+ latent: torch.Tensor,
+ timestep: Optional[torch.Tensor],
+ generator: Optional[torch.Generator],
+ ) -> torch.Tensor:
+ """
+ Decode and accumulate all tiles of a temporal group into a local buffer.
+ The buffer is local to the group and always starts at time 0; temporal coordinates
+ are rebased by subtracting temporal_slice.start.
+ """
+ temporal_slice = group_tiles[0].out_coords[2]
+
+ weights = torch.zeros_like(buffer)
+
+ for tile in group_tiles:
+ decoded_tile = self.forward(latent[tile.in_coords], timestep, generator)
+ mask = tile.blend_mask.to(device=buffer.device, dtype=buffer.dtype)
+ temporal_offset = tile.out_coords[2].start - temporal_slice.start
+ # Use the tile's output coordinate length, not the decoded tile's length,
+ # as the decoder may produce a different number of frames than expected
+ expected_temporal_len = tile.out_coords[2].stop - tile.out_coords[2].start
+ decoded_temporal_len = decoded_tile.shape[2]
+
+ # Ensure we don't exceed the buffer or decoded tile bounds
+ actual_temporal_len = min(expected_temporal_len, decoded_temporal_len, buffer.shape[2] - temporal_offset)
+
+ chunk_coords = (
+ slice(None), # batch
+ slice(None), # channels
+ slice(temporal_offset, temporal_offset + actual_temporal_len),
+ tile.out_coords[3], # height
+ tile.out_coords[4], # width
+ )
+
+ # Slice decoded_tile and mask to match the actual length we're writing
+ decoded_slice = decoded_tile[:, :, :actual_temporal_len, :, :]
+ mask_slice = mask[:, :, :actual_temporal_len, :, :] if mask.shape[2] > 1 else mask
+
+ buffer[chunk_coords] += decoded_slice * mask_slice
+ weights[chunk_coords] += mask_slice
+
+ return weights
+
+
+def decode_video(
+ latent: torch.Tensor,
+ video_decoder: VideoDecoder,
+ tiling_config: TilingConfig | None = None,
+) -> Iterator[torch.Tensor]:
+ """
+ Decode a video latent tensor with the given decoder.
+ Args:
+ latent: Tensor [c, f, h, w]
+ video_decoder: Decoder module.
+ tiling_config: Optional tiling settings.
+ Yields:
+ Decoded chunk [f, h, w, c], uint8 in [0, 255].
+ """
+
+ def convert_to_uint8(frames: torch.Tensor) -> torch.Tensor:
+ frames = (((frames + 1.0) / 2.0).clamp(0.0, 1.0) * 255.0).to(torch.uint8)
+ frames = rearrange(frames[0], "c f h w -> f h w c")
+ return frames
+
+ if tiling_config is not None:
+ for frames in video_decoder.tiled_decode(latent, tiling_config):
+ yield convert_to_uint8(frames)
+ else:
+ decoded_video = video_decoder(latent)
+ yield convert_to_uint8(decoded_video)
+
+
+def get_video_chunks_number(num_frames: int, tiling_config: TilingConfig | None = None) -> int:
+ """
+ Get the number of video chunks for a given number of frames and tiling configuration.
+ Args:
+ num_frames: Number of frames in the video.
+ tiling_config: Tiling configuration.
+ Returns:
+ Number of video chunks.
+ """
+ if not tiling_config or not tiling_config.temporal_config:
+ return 1
+ cfg = tiling_config.temporal_config
+ frame_stride = cfg.tile_size_in_frames - cfg.tile_overlap_in_frames
+ return (num_frames - 1 + frame_stride - 1) // frame_stride
+
+
+def split_in_spatial(size: int, overlap: int) -> SplitOperation:
+ def split(dimension_size: int) -> DimensionIntervals:
+ if dimension_size <= size:
+ return DEFAULT_SPLIT_OPERATION(dimension_size)
+ amount = (dimension_size + size - 2 * overlap - 1) // (size - overlap)
+ starts = [i * (size - overlap) for i in range(amount)]
+ ends = [start + size for start in starts]
+ ends[-1] = dimension_size
+ left_ramps = [0] + [overlap] * (amount - 1)
+ right_ramps = [overlap] * (amount - 1) + [0]
+ return DimensionIntervals(starts=starts, ends=ends, left_ramps=left_ramps, right_ramps=right_ramps)
+
+ return split
+
+
+def split_in_temporal(size: int, overlap: int) -> SplitOperation:
+ non_causal_split = split_in_spatial(size, overlap)
+
+ def split(dimension_size: int) -> DimensionIntervals:
+ if dimension_size <= size:
+ return DEFAULT_SPLIT_OPERATION(dimension_size)
+ intervals = non_causal_split(dimension_size)
+ starts = intervals.starts
+ starts[1:] = [s - 1 for s in starts[1:]]
+ left_ramps = intervals.left_ramps
+ left_ramps[1:] = [r + 1 for r in left_ramps[1:]]
+ return replace(intervals, starts=starts, left_ramps=left_ramps)
+
+ return split
+
+
+def to_mapping_operation(
+ map_func: Callable[[int, int, int, int, int], Tuple[slice, torch.Tensor]],
+ scale: int,
+) -> MappingOperation:
+ def map_op(intervals: DimensionIntervals) -> tuple[list[slice], list[torch.Tensor | None]]:
+ output_slices: list[slice] = []
+ masks_1d: list[torch.Tensor | None] = []
+ number_of_slices = len(intervals.starts)
+ for i in range(number_of_slices):
+ start = intervals.starts[i]
+ end = intervals.ends[i]
+ left_ramp = intervals.left_ramps[i]
+ right_ramp = intervals.right_ramps[i]
+ output_slice, mask_1d = map_func(start, end, left_ramp, right_ramp, scale)
+ output_slices.append(output_slice)
+ masks_1d.append(mask_1d)
+ return output_slices, masks_1d
+
+ return map_op
+
+
+def map_temporal_slice(begin: int, end: int, left_ramp: int, right_ramp: int, scale: int) -> Tuple[slice, torch.Tensor]:
+ start = begin * scale
+ stop = 1 + (end - 1) * scale
+ left_ramp = 1 + (left_ramp - 1) * scale
+ right_ramp = right_ramp * scale
+
+ return slice(start, stop), compute_trapezoidal_mask_1d(stop - start, left_ramp, right_ramp, True)
+
+
+def map_spatial_slice(begin: int, end: int, left_ramp: int, right_ramp: int, scale: int) -> Tuple[slice, torch.Tensor]:
+ start = begin * scale
+ stop = end * scale
+ left_ramp = left_ramp * scale
+ right_ramp = right_ramp * scale
+
+ return slice(start, stop), compute_trapezoidal_mask_1d(stop - start, left_ramp, right_ramp, False)
diff --git a/packages/ltx-core/src/ltx_core/text_encoders/__init__.py b/packages/ltx-core/src/ltx_core/text_encoders/__init__.py
new file mode 100644
index 0000000..b65ae14
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/text_encoders/__init__.py
@@ -0,0 +1 @@
+"""CLIP/text encoder model components."""
diff --git a/packages/ltx-core/src/ltx_core/text_encoders/gemma/__init__.py b/packages/ltx-core/src/ltx_core/text_encoders/gemma/__init__.py
new file mode 100644
index 0000000..751b094
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/text_encoders/gemma/__init__.py
@@ -0,0 +1,31 @@
+"""Gemma text encoder components."""
+
+from ltx_core.text_encoders.gemma.encoders.av_encoder import (
+ AV_GEMMA_TEXT_ENCODER_KEY_OPS,
+ AVGemmaEncoderOutput,
+ AVGemmaTextEncoderModel,
+ AVGemmaTextEncoderModelConfigurator,
+)
+from ltx_core.text_encoders.gemma.encoders.base_encoder import (
+ GemmaTextEncoderModelBase,
+ encode_text,
+ module_ops_from_gemma_root,
+)
+from ltx_core.text_encoders.gemma.encoders.video_only_encoder import (
+ VideoGemmaEncoderOutput,
+ VideoGemmaTextEncoderModel,
+ VideoGemmaTextEncoderModelConfigurator,
+)
+
+__all__ = [
+ "AV_GEMMA_TEXT_ENCODER_KEY_OPS",
+ "AVGemmaEncoderOutput",
+ "AVGemmaTextEncoderModel",
+ "AVGemmaTextEncoderModelConfigurator",
+ "GemmaTextEncoderModelBase",
+ "VideoGemmaEncoderOutput",
+ "VideoGemmaTextEncoderModel",
+ "VideoGemmaTextEncoderModelConfigurator",
+ "encode_text",
+ "module_ops_from_gemma_root",
+]
diff --git a/packages/ltx-core/src/ltx_core/text_encoders/gemma/embeddings_connector.py b/packages/ltx-core/src/ltx_core/text_encoders/gemma/embeddings_connector.py
new file mode 100644
index 0000000..a5cdd0a
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/text_encoders/gemma/embeddings_connector.py
@@ -0,0 +1,210 @@
+import torch
+
+from ltx_core.model.model_protocol import ModelConfigurator
+from ltx_core.model.transformer.attention import Attention
+from ltx_core.model.transformer.feed_forward import FeedForward
+from ltx_core.model.transformer.rope import (
+ LTXRopeType,
+ generate_freq_grid_np,
+ generate_freq_grid_pytorch,
+ precompute_freqs_cis,
+)
+from ltx_core.utils import rms_norm
+
+
+class _BasicTransformerBlock1D(torch.nn.Module):
+ def __init__(
+ self,
+ dim: int,
+ heads: int,
+ dim_head: int,
+ rope_type: LTXRopeType = LTXRopeType.INTERLEAVED,
+ ):
+ super().__init__()
+
+ self.attn1 = Attention(
+ query_dim=dim,
+ heads=heads,
+ dim_head=dim_head,
+ rope_type=rope_type,
+ )
+
+ self.ff = FeedForward(
+ dim,
+ dim_out=dim,
+ )
+
+ def forward(
+ self,
+ hidden_states: torch.Tensor,
+ attention_mask: torch.Tensor | None = None,
+ pe: torch.Tensor | None = None,
+ ) -> torch.Tensor:
+ # Notice that normalization is always applied before the real computation in the following blocks.
+
+ # 1. Normalization Before Self-Attention
+ norm_hidden_states = rms_norm(hidden_states)
+
+ norm_hidden_states = norm_hidden_states.squeeze(1)
+
+ # 2. Self-Attention
+ attn_output = self.attn1(norm_hidden_states, mask=attention_mask, pe=pe)
+
+ hidden_states = attn_output + hidden_states
+ if hidden_states.ndim == 4:
+ hidden_states = hidden_states.squeeze(1)
+
+ # 3. Normalization before Feed-Forward
+ norm_hidden_states = rms_norm(hidden_states)
+
+ # 4. Feed-forward
+ ff_output = self.ff(norm_hidden_states)
+
+ hidden_states = ff_output + hidden_states
+ if hidden_states.ndim == 4:
+ hidden_states = hidden_states.squeeze(1)
+
+ return hidden_states
+
+
+class Embeddings1DConnector(torch.nn.Module):
+ """
+ Embeddings1DConnector applies a 1D transformer-based processing to sequential embeddings (e.g., for video, audio, or
+ other modalities). It supports rotary positional encoding (rope), optional causal temporal positioning, and can
+ substitute padded positions with learnable registers. The module is highly configurable for head size, number of
+ layers, and register usage.
+ Args:
+ attention_head_dim (int): Dimension of each attention head (default=128).
+ num_attention_heads (int): Number of attention heads (default=30).
+ num_layers (int): Number of transformer layers (default=2).
+ positional_embedding_theta (float): Scaling factor for position embedding (default=10000.0).
+ positional_embedding_max_pos (list[int] | None): Max positions for positional embeddings (default=[1]).
+ causal_temporal_positioning (bool): If True, uses causal attention (default=False).
+ num_learnable_registers (int | None): Number of learnable registers to replace padded tokens. If None, disables
+ register replacement. (default=128)
+ rope_type (LTXRopeType): The RoPE variant to use (default=DEFAULT_ROPE_TYPE).
+ double_precision_rope (bool): Use double precision rope calculation (default=False).
+ """
+
+ _supports_gradient_checkpointing = True
+
+ def __init__(
+ self,
+ attention_head_dim: int = 128,
+ num_attention_heads: int = 30,
+ num_layers: int = 2,
+ positional_embedding_theta: float = 10000.0,
+ positional_embedding_max_pos: list[int] | None = None,
+ causal_temporal_positioning: bool = False,
+ num_learnable_registers: int | None = 128,
+ rope_type: LTXRopeType = LTXRopeType.INTERLEAVED,
+ double_precision_rope: bool = False,
+ ):
+ super().__init__()
+ self.num_attention_heads = num_attention_heads
+ self.inner_dim = num_attention_heads * attention_head_dim
+ self.causal_temporal_positioning = causal_temporal_positioning
+ self.positional_embedding_theta = positional_embedding_theta
+ self.positional_embedding_max_pos = (
+ positional_embedding_max_pos if positional_embedding_max_pos is not None else [1]
+ )
+ self.rope_type = rope_type
+ self.double_precision_rope = double_precision_rope
+ self.transformer_1d_blocks = torch.nn.ModuleList(
+ [
+ _BasicTransformerBlock1D(
+ dim=self.inner_dim,
+ heads=num_attention_heads,
+ dim_head=attention_head_dim,
+ rope_type=rope_type,
+ )
+ for _ in range(num_layers)
+ ]
+ )
+
+ self.num_learnable_registers = num_learnable_registers
+ if self.num_learnable_registers:
+ self.learnable_registers = torch.nn.Parameter(
+ torch.rand(self.num_learnable_registers, self.inner_dim, dtype=torch.bfloat16) * 2.0 - 1.0
+ )
+
+ def _replace_padded_with_learnable_registers(
+ self, hidden_states: torch.Tensor, attention_mask: torch.Tensor
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ assert hidden_states.shape[1] % self.num_learnable_registers == 0, (
+ f"Hidden states sequence length {hidden_states.shape[1]} must be divisible by num_learnable_registers "
+ f"{self.num_learnable_registers}."
+ )
+
+ num_registers_duplications = hidden_states.shape[1] // self.num_learnable_registers
+ learnable_registers = torch.tile(self.learnable_registers, (num_registers_duplications, 1))
+ attention_mask_binary = (attention_mask.squeeze(1).squeeze(1).unsqueeze(-1) >= -9000.0).int()
+
+ non_zero_hidden_states = hidden_states[:, attention_mask_binary.squeeze().bool(), :]
+ non_zero_nums = non_zero_hidden_states.shape[1]
+ pad_length = hidden_states.shape[1] - non_zero_nums
+ adjusted_hidden_states = torch.nn.functional.pad(non_zero_hidden_states, pad=(0, 0, 0, pad_length), value=0)
+ flipped_mask = torch.flip(attention_mask_binary, dims=[1])
+ hidden_states = flipped_mask * adjusted_hidden_states + (1 - flipped_mask) * learnable_registers
+
+ attention_mask = torch.full_like(
+ attention_mask,
+ 0.0,
+ dtype=attention_mask.dtype,
+ device=attention_mask.device,
+ )
+
+ return hidden_states, attention_mask
+
+ def forward(
+ self,
+ hidden_states: torch.Tensor,
+ attention_mask: torch.Tensor | None = None,
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ """
+ Forward pass of Embeddings1DConnector.
+ Args:
+ hidden_states (torch.Tensor): Input tensor of embeddings (shape [batch, seq_len, feature_dim]).
+ attention_mask (torch.Tensor|None): Optional mask for valid tokens (shape compatible with hidden_states).
+ Returns:
+ tuple[torch.Tensor, torch.Tensor]: Processed features and the corresponding (possibly modified) mask.
+ """
+ if self.num_learnable_registers:
+ hidden_states, attention_mask = self._replace_padded_with_learnable_registers(hidden_states, attention_mask)
+
+ indices_grid = torch.arange(hidden_states.shape[1], dtype=torch.float32, device=hidden_states.device)
+ indices_grid = indices_grid[None, None, :]
+ freq_grid_generator = generate_freq_grid_np if self.double_precision_rope else generate_freq_grid_pytorch
+ freqs_cis = precompute_freqs_cis(
+ indices_grid=indices_grid,
+ dim=self.inner_dim,
+ out_dtype=hidden_states.dtype,
+ theta=self.positional_embedding_theta,
+ max_pos=self.positional_embedding_max_pos,
+ num_attention_heads=self.num_attention_heads,
+ rope_type=self.rope_type,
+ freq_grid_generator=freq_grid_generator,
+ )
+
+ for block in self.transformer_1d_blocks:
+ hidden_states = block(hidden_states, attention_mask=attention_mask, pe=freqs_cis)
+
+ hidden_states = rms_norm(hidden_states)
+
+ return hidden_states, attention_mask
+
+
+class Embeddings1DConnectorConfigurator(ModelConfigurator[Embeddings1DConnector]):
+ @classmethod
+ def from_config(cls: type[Embeddings1DConnector], config: dict) -> Embeddings1DConnector:
+ config = config.get("transformer", {})
+ rope_type = LTXRopeType(config.get("rope_type", "interleaved"))
+ double_precision_rope = config.get("frequencies_precision", False) == "float64"
+ pe_max_pos = config.get("connector_positional_embedding_max_pos", [1])
+
+ connector = Embeddings1DConnector(
+ positional_embedding_max_pos=pe_max_pos,
+ rope_type=rope_type,
+ double_precision_rope=double_precision_rope,
+ )
+ return connector
diff --git a/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/av_encoder.py b/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/av_encoder.py
new file mode 100644
index 0000000..11697bc
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/av_encoder.py
@@ -0,0 +1,94 @@
+from typing import NamedTuple
+
+import torch
+from transformers.models.gemma3 import Gemma3ForConditionalGeneration
+
+from ltx_core.loader.sd_ops import SDOps
+from ltx_core.model.model_protocol import ModelConfigurator
+from ltx_core.text_encoders.gemma.embeddings_connector import (
+ Embeddings1DConnector,
+ Embeddings1DConnectorConfigurator,
+)
+from ltx_core.text_encoders.gemma.encoders.base_encoder import GemmaTextEncoderModelBase
+from ltx_core.text_encoders.gemma.feature_extractor import GemmaFeaturesExtractorProjLinear
+from ltx_core.text_encoders.gemma.tokenizer import LTXVGemmaTokenizer
+
+
+class AVGemmaEncoderOutput(NamedTuple):
+ video_encoding: torch.Tensor
+ audio_encoding: torch.Tensor
+ attention_mask: torch.Tensor
+
+
+class AVGemmaTextEncoderModel(GemmaTextEncoderModelBase):
+ """
+ AVGemma Text Encoder Model.
+ This class combines the tokenizer, Gemma model, feature extractor from base class and a
+ video and audio embeddings connectors to provide a preprocessing for audio-visual pipeline.
+ """
+
+ def __init__(
+ self,
+ feature_extractor_linear: GemmaFeaturesExtractorProjLinear,
+ embeddings_connector: Embeddings1DConnector,
+ audio_embeddings_connector: Embeddings1DConnector,
+ tokenizer: LTXVGemmaTokenizer | None = None,
+ model: Gemma3ForConditionalGeneration | None = None,
+ dtype: torch.dtype = torch.bfloat16,
+ ) -> None:
+ super().__init__(
+ feature_extractor_linear=feature_extractor_linear,
+ tokenizer=tokenizer,
+ model=model,
+ dtype=dtype,
+ )
+ self.embeddings_connector = embeddings_connector.to(dtype=dtype)
+ self.audio_embeddings_connector = audio_embeddings_connector.to(dtype=dtype)
+
+ def _run_connectors(
+ self, encoded_input: torch.Tensor, attention_mask: torch.Tensor
+ ) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]:
+ connector_attention_mask = self._convert_to_additive_mask(attention_mask, encoded_input.dtype)
+
+ encoded, encoded_connector_attention_mask = self.embeddings_connector(
+ encoded_input,
+ connector_attention_mask,
+ )
+
+ # restore the mask values to int64
+ attention_mask = (encoded_connector_attention_mask < 0.000001).to(torch.int64)
+ attention_mask = attention_mask.reshape([encoded.shape[0], encoded.shape[1], 1])
+ encoded = encoded * attention_mask
+
+ encoded_for_audio, _ = self.audio_embeddings_connector(encoded_input, connector_attention_mask)
+
+ return encoded, encoded_for_audio, attention_mask.squeeze(-1)
+
+ def forward(self, text: str, padding_side: str = "left") -> AVGemmaEncoderOutput:
+ encoded_inputs, attention_mask = self._preprocess_text(text, padding_side)
+ video_encoding, audio_encoding, attention_mask = self._run_connectors(encoded_inputs, attention_mask)
+ return AVGemmaEncoderOutput(video_encoding, audio_encoding, attention_mask)
+
+
+class AVGemmaTextEncoderModelConfigurator(ModelConfigurator[AVGemmaTextEncoderModel]):
+ @classmethod
+ def from_config(cls: type["AVGemmaTextEncoderModel"], config: dict) -> "AVGemmaTextEncoderModel":
+ feature_extractor_linear = GemmaFeaturesExtractorProjLinear.from_config(config)
+ embeddings_connector = Embeddings1DConnectorConfigurator.from_config(config)
+ audio_embeddings_connector = Embeddings1DConnectorConfigurator.from_config(config)
+ return AVGemmaTextEncoderModel(
+ feature_extractor_linear=feature_extractor_linear,
+ embeddings_connector=embeddings_connector,
+ audio_embeddings_connector=audio_embeddings_connector,
+ )
+
+
+AV_GEMMA_TEXT_ENCODER_KEY_OPS = (
+ SDOps("AV_GEMMA_TEXT_ENCODER_KEY_OPS")
+ .with_matching(prefix="text_embedding_projection.")
+ .with_matching(prefix="model.diffusion_model.audio_embeddings_connector.")
+ .with_matching(prefix="model.diffusion_model.video_embeddings_connector.")
+ .with_replacement("text_embedding_projection.", "feature_extractor_linear.")
+ .with_replacement("model.diffusion_model.video_embeddings_connector.", "embeddings_connector.")
+ .with_replacement("model.diffusion_model.audio_embeddings_connector.", "audio_embeddings_connector.")
+)
diff --git a/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/base_encoder.py b/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/base_encoder.py
new file mode 100644
index 0000000..e689c1a
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/base_encoder.py
@@ -0,0 +1,329 @@
+import functools
+from pathlib import Path
+
+import torch
+from einops import rearrange
+from transformers import AutoImageProcessor, Gemma3ForConditionalGeneration, Gemma3Processor
+
+from ltx_core.loader.module_ops import ModuleOps
+from ltx_core.text_encoders.gemma.feature_extractor import GemmaFeaturesExtractorProjLinear
+from ltx_core.text_encoders.gemma.tokenizer import LTXVGemmaTokenizer
+
+
+class GemmaTextEncoderModelBase(torch.nn.Module):
+ """
+ Gemma Text Encoder Model.
+ This base class combines the tokenizer, Gemma model and feature extractor to provide a preprocessing
+ for implementation classes for multimodal pipelines. It processes input text through tokenization,
+ obtains hidden states from the base language model, applies a linear feature extractor.
+ Args:
+ tokenizer (LTXVGemmaTokenizer): The tokenizer used for text preprocessing.
+ model (Gemma3ForConditionalGeneration): The base Gemma LLM.
+ feature_extractor_linear (GemmaFeaturesExtractorProjLinear): Linear projection for hidden state aggregation.
+ dtype (torch.dtype, optional): The data type for model parameters (default: torch.bfloat16).
+ """
+
+ def __init__(
+ self,
+ feature_extractor_linear: GemmaFeaturesExtractorProjLinear,
+ tokenizer: LTXVGemmaTokenizer | None = None,
+ model: Gemma3ForConditionalGeneration | None = None,
+ img_processor: Gemma3Processor | None = None,
+ dtype: torch.dtype = torch.bfloat16,
+ ) -> None:
+ super().__init__()
+ self._gemma_root = None
+ self.tokenizer = tokenizer
+ self.model = model
+ self.processor = img_processor
+ self.feature_extractor_linear = feature_extractor_linear.to(dtype=dtype)
+
+ def _run_feature_extractor(
+ self, hidden_states: torch.Tensor, attention_mask: torch.Tensor, padding_side: str = "right"
+ ) -> torch.Tensor:
+ encoded_text_features = torch.stack(hidden_states, dim=-1)
+ encoded_text_features_dtype = encoded_text_features.dtype
+
+ sequence_lengths = attention_mask.sum(dim=-1)
+ normed_concated_encoded_text_features = _norm_and_concat_padded_batch(
+ encoded_text_features, sequence_lengths, padding_side=padding_side
+ )
+
+ return self.feature_extractor_linear(normed_concated_encoded_text_features.to(encoded_text_features_dtype))
+
+ def _convert_to_additive_mask(self, attention_mask: torch.Tensor, dtype: torch.dtype) -> torch.Tensor:
+ return (attention_mask - 1).to(dtype).reshape(
+ (attention_mask.shape[0], 1, -1, attention_mask.shape[-1])
+ ) * torch.finfo(dtype).max
+
+ def _preprocess_text(self, text: str, padding_side: str = "left") -> tuple[torch.Tensor, dict[str, torch.Tensor]]:
+ """
+ Encode a given string into feature tensors suitable for downstream tasks.
+ Args:
+ text (str): Input string to encode.
+ Returns:
+ tuple[torch.Tensor, dict[str, torch.Tensor]]: Encoded features and a dictionary with attention mask.
+ """
+ token_pairs = self.tokenizer.tokenize_with_weights(text)["gemma"]
+ input_ids = torch.tensor([[t[0] for t in token_pairs]], device=self.model.device)
+ attention_mask = torch.tensor([[w[1] for w in token_pairs]], device=self.model.device)
+ outputs = self.model(input_ids=input_ids, attention_mask=attention_mask, output_hidden_states=True)
+ projected = self._run_feature_extractor(
+ hidden_states=outputs.hidden_states, attention_mask=attention_mask, padding_side=padding_side
+ )
+ return projected, attention_mask
+
+ def _init_image_processor(self) -> None:
+ img_processor = AutoImageProcessor.from_pretrained(self._gemma_root, local_files_only=True)
+ if not self.tokenizer:
+ raise ValueError("Tokenizer is not loaded, cannot load image processor")
+ self.processor = Gemma3Processor(image_processor=img_processor, tokenizer=self.tokenizer.tokenizer)
+
+ def _enhance(
+ self,
+ messages: list[dict[str, str]],
+ image: torch.Tensor | None = None,
+ max_new_tokens: int = 512,
+ seed: int = 42,
+ ) -> str:
+ if self.processor is None:
+ self._init_image_processor()
+ text = self.processor.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
+
+ model_inputs = self.processor(
+ text=text,
+ images=image,
+ return_tensors="pt",
+ ).to(self.model.device)
+ pad_token_id = self.processor.tokenizer.pad_token_id if self.processor.tokenizer.pad_token_id is not None else 0
+ model_inputs = _pad_inputs_for_attention_alignment(model_inputs, pad_token_id=pad_token_id)
+
+ with torch.inference_mode(), torch.random.fork_rng(devices=[self.model.device]):
+ torch.manual_seed(seed)
+ outputs = self.model.generate(
+ **model_inputs,
+ max_new_tokens=max_new_tokens,
+ do_sample=True,
+ temperature=0.7,
+ )
+ generated_ids = outputs[0][len(model_inputs.input_ids[0]) :]
+ enhanced_prompt = self.processor.tokenizer.decode(generated_ids, skip_special_tokens=True)
+
+ return enhanced_prompt
+
+ def enhance_t2v(
+ self,
+ prompt: str,
+ max_new_tokens: int = 512,
+ system_prompt: str | None = None,
+ seed: int = 42,
+ ) -> str:
+ """Enhance a text prompt for T2V generation."""
+
+ system_prompt = system_prompt or self.default_gemma_t2v_system_prompt
+
+ messages = [
+ {"role": "system", "content": system_prompt},
+ {"role": "user", "content": f"user prompt: {prompt}"},
+ ]
+
+ return self._enhance(messages, max_new_tokens=max_new_tokens, seed=seed)
+
+ def enhance_i2v(
+ self,
+ prompt: str,
+ image: torch.Tensor,
+ max_new_tokens: int = 512,
+ system_prompt: str | None = None,
+ seed: int = 42,
+ ) -> str:
+ """Enhance a text prompt for I2V generation using a reference image."""
+ system_prompt = system_prompt or self.default_gemma_i2v_system_prompt
+ messages = [
+ {"role": "system", "content": system_prompt},
+ {
+ "role": "user",
+ "content": [
+ {"type": "image"},
+ {"type": "text", "text": f"User Raw Input Prompt: {prompt}."},
+ ],
+ },
+ ]
+ return self._enhance(messages, image=image, max_new_tokens=max_new_tokens, seed=seed)
+
+ @functools.cached_property
+ def default_gemma_i2v_system_prompt(self) -> str:
+ return _load_system_prompt("gemma_i2v_system_prompt.txt")
+
+ @functools.cached_property
+ def default_gemma_t2v_system_prompt(self) -> str:
+ return _load_system_prompt("gemma_t2v_system_prompt.txt")
+
+ def forward(self, text: str, padding_side: str = "left") -> tuple[torch.Tensor, torch.Tensor]:
+ raise NotImplementedError("This method is not implemented for the base class")
+
+
+def _norm_and_concat_padded_batch(
+ encoded_text: torch.Tensor,
+ sequence_lengths: torch.Tensor,
+ padding_side: str = "right",
+) -> torch.Tensor:
+ """Normalize and flatten multi-layer hidden states, respecting padding.
+ Performs per-batch, per-layer normalization using masked mean and range,
+ then concatenates across the layer dimension.
+ Args:
+ encoded_text: Hidden states of shape [batch, seq_len, hidden_dim, num_layers].
+ sequence_lengths: Number of valid (non-padded) tokens per batch item.
+ padding_side: Whether padding is on "left" or "right".
+ Returns:
+ Normalized tensor of shape [batch, seq_len, hidden_dim * num_layers],
+ with padded positions zeroed out.
+ """
+ b, t, d, l = encoded_text.shape # noqa: E741
+ device = encoded_text.device
+
+ # Build mask: [B, T, 1, 1]
+ token_indices = torch.arange(t, device=device)[None, :] # [1, T]
+
+ if padding_side == "right":
+ # For right padding, valid tokens are from 0 to sequence_length-1
+ mask = token_indices < sequence_lengths[:, None] # [B, T]
+ elif padding_side == "left":
+ # For left padding, valid tokens are from (T - sequence_length) to T-1
+ start_indices = t - sequence_lengths[:, None] # [B, 1]
+ mask = token_indices >= start_indices # [B, T]
+ else:
+ raise ValueError(f"padding_side must be 'left' or 'right', got {padding_side}")
+
+ mask = rearrange(mask, "b t -> b t 1 1")
+
+ eps = 1e-6
+
+ # Compute masked mean: [B, 1, 1, L]
+ masked = encoded_text.masked_fill(~mask, 0.0)
+ denom = (sequence_lengths * d).view(b, 1, 1, 1)
+ mean = masked.sum(dim=(1, 2), keepdim=True) / (denom + eps)
+
+ # Compute masked min/max: [B, 1, 1, L]
+ x_min = encoded_text.masked_fill(~mask, float("inf")).amin(dim=(1, 2), keepdim=True)
+ x_max = encoded_text.masked_fill(~mask, float("-inf")).amax(dim=(1, 2), keepdim=True)
+ range_ = x_max - x_min
+
+ # Normalize only the valid tokens
+ normed = 8 * (encoded_text - mean) / (range_ + eps)
+
+ # concat to be [Batch, T, D * L] - this preserves the original structure
+ normed = normed.reshape(b, t, -1) # [B, T, D * L]
+
+ # Apply mask to preserve original padding (set padded positions to 0)
+ mask_flattened = rearrange(mask, "b t 1 1 -> b t 1").expand(-1, -1, d * l)
+ normed = normed.masked_fill(~mask_flattened, 0.0)
+
+ return normed
+
+
[email protected]_cache(maxsize=2)
+def _load_system_prompt(prompt_name: str) -> str:
+ with open(Path(__file__).parent / "prompts" / f"{prompt_name}", "r") as f:
+ return f.read()
+
+
+def _find_matching_dir(root_path: str, pattern: str) -> str:
+ """
+ Recursively search for files matching a glob pattern and return the parent directory of the first match.
+ """
+
+ matches = list(Path(root_path).rglob(pattern))
+ if not matches:
+ raise FileNotFoundError(f"No files matching pattern '{pattern}' found under {root_path}")
+ return str(matches[0].parent)
+
+
+def module_ops_from_gemma_root(gemma_root: str) -> tuple[ModuleOps, ...]:
+ gemma_path = _find_matching_dir(gemma_root, "model*.safetensors")
+ tokenizer_path = _find_matching_dir(gemma_root, "tokenizer.model")
+
+ def load_gemma(module: GemmaTextEncoderModelBase) -> GemmaTextEncoderModelBase:
+ module.model = Gemma3ForConditionalGeneration.from_pretrained(
+ gemma_path, local_files_only=True, torch_dtype=torch.bfloat16
+ )
+ module._gemma_root = module._gemma_root or gemma_root
+ return module
+
+ def load_tokenizer(module: GemmaTextEncoderModelBase) -> GemmaTextEncoderModelBase:
+ module.tokenizer = LTXVGemmaTokenizer(tokenizer_path, 1024)
+ module._gemma_root = module._gemma_root or gemma_root
+ return module
+
+ gemma_load_ops = ModuleOps(
+ "GemmaLoad",
+ matcher=lambda module: isinstance(module, GemmaTextEncoderModelBase) and module.model is None,
+ mutator=load_gemma,
+ )
+ tokenizer_load_ops = ModuleOps(
+ "TokenizerLoad",
+ matcher=lambda module: isinstance(module, GemmaTextEncoderModelBase) and module.tokenizer is None,
+ mutator=load_tokenizer,
+ )
+ return (gemma_load_ops, tokenizer_load_ops)
+
+
+def encode_text(text_encoder: GemmaTextEncoderModelBase, prompts: list[str]) -> list[tuple[torch.Tensor, torch.Tensor]]:
+ """
+ Encode a list of prompts using the provided Gemma text encoder.
+ Args:
+ text_encoder: The Gemma text encoder instance.
+ prompts: List of prompt strings to encode.
+ Returns:
+ List of tuples, each containing (v_context, a_context) tensors for each prompt.
+ """
+ result = []
+ for prompt in prompts:
+ v_context, a_context, _ = text_encoder(prompt)
+ result.append((v_context, a_context))
+ return result
+
+
+def _cat_with_padding(
+ tensor: torch.Tensor,
+ padding_length: int,
+ value: int | float,
+) -> torch.Tensor:
+ """Concatenate a tensor with a padding tensor of the given value."""
+ return torch.cat(
+ [
+ tensor,
+ torch.full(
+ (1, padding_length),
+ value,
+ dtype=tensor.dtype,
+ device=tensor.device,
+ ),
+ ],
+ dim=1,
+ )
+
+
+def _pad_inputs_for_attention_alignment(
+ model_inputs: dict[str, torch.Tensor],
+ pad_token_id: int = 0,
+ alignment: int = 8,
+) -> dict[str, torch.Tensor]:
+ """Pad sequence length to multiple of alignment for Flash Attention compatibility.
+ Flash Attention within SDPA requires sequence lengths aligned to 8 bytes.
+ This pads input_ids, attention_mask, and token_type_ids (if present) to prevent
+ 'p.attn_bias_ptr is not correctly aligned' errors.
+ """
+ seq_len = model_inputs.input_ids.shape[1]
+ padded_len = ((seq_len + alignment - 1) // alignment) * alignment
+ padding_length = padded_len - seq_len
+
+ if padding_length > 0:
+ model_inputs["input_ids"] = _cat_with_padding(model_inputs.input_ids, padding_length, pad_token_id)
+
+ model_inputs["attention_mask"] = _cat_with_padding(model_inputs.attention_mask, padding_length, 0)
+
+ if "token_type_ids" in model_inputs and model_inputs["token_type_ids"] is not None:
+ model_inputs["token_type_ids"] = _cat_with_padding(model_inputs["token_type_ids"], padding_length, 0)
+
+ return model_inputs
diff --git a/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/prompts/gemma_i2v_system_prompt.txt b/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/prompts/gemma_i2v_system_prompt.txt
new file mode 100644
index 0000000..0d67724
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/prompts/gemma_i2v_system_prompt.txt
@@ -0,0 +1,30 @@
+You are a Creative Assistant writing concise, action-focused image-to-video prompts. Given an image (first frame) and user Raw Input Prompt, generate a prompt to guide video generation from that image.
+
+#### Guidelines:
+- Analyze the Image: Identify Subject, Setting, Elements, Style and Mood.
+- Follow user Raw Input Prompt: Include all requested motion, actions, camera movements, audio, and details. If in conflict with the image, prioritize user request while maintaining visual consistency (describe transition from image to user's scene).
+- Describe only changes from the image: Don't reiterate established visual details. Inaccurate descriptions may cause scene cuts.
+- Active language: Use present-progressive verbs ("is walking," "speaking"). If no action specified, describe natural movements.
+- Chronological flow: Use temporal connectors ("as," "then," "while").
+- Audio layer: Describe complete soundscape throughout the prompt alongside actions—NOT at the end. Align audio intensity with action tempo. Include natural background audio, ambient sounds, effects, speech or music (when requested). Be specific (e.g., "soft footsteps on tile") not vague (e.g., "ambient sound").
+- Speech (only when requested): Provide exact words in quotes with character's visual/voice characteristics (e.g., "The tall man speaks in a low, gravelly voice"), language if not English and accent if relevant. If general conversation mentioned without text, generate contextual quoted dialogue. (i.e., "The man is talking" input -> the output should include exact spoken words, like: "The man is talking in an excited voice saying: 'You won't believe what I just saw!' His hands gesture expressively as he speaks, eyebrows raised with enthusiasm. The ambient sound of a quiet room underscores his animated speech.")
+- Style: Include visual style at beginning: "Style: <style>, <rest of prompt>." If unclear, omit to avoid conflicts.
+- Visual and audio only: Describe only what is seen and heard. NO smell, taste, or tactile sensations.
+- Restrained language: Avoid dramatic terms. Use mild, natural, understated phrasing.
+
+#### Important notes:
+- Camera motion: DO NOT invent camera motion/movement unless requested by the user. Make sure to include camera motion only if specified in the input.
+- Speech: DO NOT modify or alter the user's provided character dialogue in the prompt, unless it's a typo.
+- No timestamps or cuts: DO NOT use timestamps or describe scene cuts unless explicitly requested.
+- Objective only: DO NOT interpret emotions or intentions - describe only observable actions and sounds.
+- Format: DO NOT use phrases like "The scene opens with..." / "The video starts...". Start directly with Style (optional) and chronological scene description.
+- Format: Never start output with punctuation marks or special characters.
+- DO NOT invent dialogue unless the user mentions speech/talking/singing/conversation.
+- Your performance is CRITICAL. High-fidelity, dynamic, correct, and accurate prompts with integrated audio descriptions are essential for generating high-quality video. Your goal is flawless execution of these rules.
+
+#### Output Format (Strict):
+- Single concise paragraph in natural English. NO titles, headings, prefaces, sections, code fences, or Markdown.
+- If unsafe/invalid, return original user prompt. Never ask questions or clarifications.
+
+#### Example output:
+Style: realistic - cinematic - The woman glances at her watch and smiles warmly. She speaks in a cheerful, friendly voice, "I think we're right on time!" In the background, a café barista prepares drinks at the counter. The barista calls out in a clear, upbeat tone, "Two cappuccinos ready!" The sound of the espresso machine hissing softly blends with gentle background chatter and the light clinking of cups on saucers.
diff --git a/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/prompts/gemma_t2v_system_prompt.txt b/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/prompts/gemma_t2v_system_prompt.txt
new file mode 100644
index 0000000..e864201
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/prompts/gemma_t2v_system_prompt.txt
@@ -0,0 +1,40 @@
+You are a Creative Assistant. Given a user's raw input prompt describing a scene or concept, expand it into a detailed video generation prompt with specific visuals and integrated audio to guide a text-to-video model.
+
+#### Guidelines
+- Strictly follow all aspects of the user's raw input: include every element requested (style, visuals, motions, actions, camera movement, audio).
+ - If the input is vague, invent concrete details: lighting, textures, materials, scene settings, etc.
+ - For characters: describe gender, clothing, hair, expressions. DO NOT invent unrequested characters.
+- Use active language: present-progressive verbs ("is walking," "speaking"). If no action specified, describe natural movements.
+- Maintain chronological flow: use temporal connectors ("as," "then," "while").
+- Audio layer: Describe complete soundscape (background audio, ambient sounds, SFX, speech/music when requested). Integrate sounds chronologically alongside actions. Be specific (e.g., "soft footsteps on tile"), not vague (e.g., "ambient sound is present").
+- Speech (only when requested):
+ - For ANY speech-related input (talking, conversation, singing, etc.), ALWAYS include exact words in quotes with voice characteristics (e.g., "The man says in an excited voice: 'You won't believe what I just saw!'").
+ - Specify language if not English and accent if relevant.
+- Style: Include visual style at the beginning: "Style: <style>, <rest of prompt>." Default to cinematic-realistic if unspecified. Omit if unclear.
+- Visual and audio only: NO non-visual/auditory senses (smell, taste, touch).
+- Restrained language: Avoid dramatic/exaggerated terms. Use mild, natural phrasing.
+ - Colors: Use plain terms ("red dress"), not intensified ("vibrant blue," "bright red").
+ - Lighting: Use neutral descriptions ("soft overhead light"), not harsh ("blinding light").
+ - Facial features: Use delicate modifiers for subtle features (i.e., "subtle freckles").
+
+#### Important notes:
+- Analyze the user's raw input carefully. In cases of FPV or POV, exclude the description of the subject whose POV is requested.
+- Camera motion: DO NOT invent camera motion unless requested by the user.
+- Speech: DO NOT modify user-provided character dialogue unless it's a typo.
+- No timestamps or cuts: DO NOT use timestamps or describe scene cuts unless explicitly requested.
+- Format: DO NOT use phrases like "The scene opens with...". Start directly with Style (optional) and chronological scene description.
+- Format: DO NOT start your response with special characters.
+- DO NOT invent dialogue unless the user mentions speech/talking/singing/conversation.
+- If the user's raw input prompt is highly detailed, chronological and in the requested format: DO NOT make major edits or introduce new elements. Add/enhance audio descriptions if missing.
+
+#### Output Format (Strict):
+- Single continuous paragraph in natural language (English).
+- NO titles, headings, prefaces, code fences, or Markdown.
+- If unsafe/invalid, return original user prompt. Never ask questions or clarifications.
+
+Your output quality is CRITICAL. Generate visually rich, dynamic prompts with integrated audio for high-quality video generation.
+
+#### Example
+Input: "A woman at a coffee shop talking on the phone"
+Output:
+Style: realistic with cinematic lighting. In a medium close-up, a woman in her early 30s with shoulder-length brown hair sits at a small wooden table by the window. She wears a cream-colored turtleneck sweater, holding a white ceramic coffee cup in one hand and a smartphone to her ear with the other. Ambient cafe sounds fill the space—espresso machine hiss, quiet conversations, gentle clinking of cups. The woman listens intently, nodding slightly, then takes a sip of her coffee and sets it down with a soft clink. Her face brightens into a warm smile as she speaks in a clear, friendly voice, 'That sounds perfect! I'd love to meet up this weekend. How about Saturday afternoon?' She laughs softly—a genuine chuckle—and shifts in her chair. Behind her, other patrons move subtly in and out of focus. 'Great, I'll see you then,' she concludes cheerfully, lowering the phone.
diff --git a/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/video_only_encoder.py b/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/video_only_encoder.py
new file mode 100644
index 0000000..e4841a5
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/text_encoders/gemma/encoders/video_only_encoder.py
@@ -0,0 +1,85 @@
+from typing import NamedTuple
+
+import torch
+from transformers import Gemma3ForConditionalGeneration
+
+from ltx_core.loader.sd_ops import SDOps
+from ltx_core.model.model_protocol import ModelConfigurator
+from ltx_core.text_encoders.gemma.embeddings_connector import (
+ Embeddings1DConnector,
+ Embeddings1DConnectorConfigurator,
+)
+from ltx_core.text_encoders.gemma.encoders.base_encoder import GemmaTextEncoderModelBase
+from ltx_core.text_encoders.gemma.feature_extractor import GemmaFeaturesExtractorProjLinear
+from ltx_core.text_encoders.gemma.tokenizer import LTXVGemmaTokenizer
+
+
+class VideoGemmaEncoderOutput(NamedTuple):
+ video_encoding: torch.Tensor
+ attention_mask: torch.Tensor
+
+
+class VideoGemmaTextEncoderModel(GemmaTextEncoderModelBase):
+ """
+ Video Gemma Text Encoder Model.
+ This class combines the tokenizer, Gemma model, feature extractor from base class and a
+ video embeddings connector to provide a preprocessing for video only pipeline.
+ """
+
+ def __init__(
+ self,
+ feature_extractor_linear: GemmaFeaturesExtractorProjLinear,
+ embeddings_connector: Embeddings1DConnector,
+ tokenizer: LTXVGemmaTokenizer | None = None,
+ model: Gemma3ForConditionalGeneration | None = None,
+ dtype: torch.dtype = torch.bfloat16,
+ ) -> None:
+ super().__init__(
+ feature_extractor_linear=feature_extractor_linear,
+ tokenizer=tokenizer,
+ model=model,
+ dtype=dtype,
+ )
+ self.embeddings_connector = embeddings_connector.to(dtype=dtype)
+
+ def _run_connector(
+ self, encoded_input: torch.Tensor, attention_mask: torch.Tensor
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ connector_attention_mask = self._convert_to_additive_mask(attention_mask, encoded_input.dtype)
+
+ encoded, encoded_connector_attention_mask = self.embeddings_connector(
+ encoded_input,
+ connector_attention_mask,
+ )
+
+ # restore the mask values to int64
+ attention_mask = (encoded_connector_attention_mask < 0.000001).to(torch.int64)
+ attention_mask = attention_mask.reshape([encoded.shape[0], encoded.shape[1], 1])
+ encoded = encoded * attention_mask
+
+ return encoded, attention_mask.squeeze(-1)
+
+ def forward(self, text: str, padding_side: str = "left") -> VideoGemmaEncoderOutput:
+ encoded_inputs, attention_mask = self._preprocess_text(text, padding_side)
+ video_encoding, attention_mask = self._run_connector(encoded_inputs, attention_mask)
+ return VideoGemmaEncoderOutput(video_encoding, attention_mask)
+
+
+class VideoGemmaTextEncoderModelConfigurator(ModelConfigurator[VideoGemmaTextEncoderModel]):
+ @classmethod
+ def from_config(cls: type["VideoGemmaTextEncoderModel"], config: dict) -> "VideoGemmaTextEncoderModel":
+ feature_extractor_linear = GemmaFeaturesExtractorProjLinear.from_config(config)
+ embeddings_connector = Embeddings1DConnectorConfigurator.from_config(config)
+ return VideoGemmaTextEncoderModel(
+ feature_extractor_linear=feature_extractor_linear,
+ embeddings_connector=embeddings_connector,
+ )
+
+
+VIDEO_ONLY_GEMMA_TEXT_ENCODER_KEY_OPS = (
+ SDOps("VIDEO_ONLY_GEMMA_TEXT_ENCODER_KEY_OPS")
+ .with_matching(prefix="text_embedding_projection.")
+ .with_matching(prefix="model.diffusion_model.embeddings_connector.")
+ .with_replacement("text_embedding_projection.", "feature_extractor_linear.")
+ .with_replacement("model.diffusion_model.embeddings_connector.", "embeddings_connector.")
+)
diff --git a/packages/ltx-core/src/ltx_core/text_encoders/gemma/feature_extractor.py b/packages/ltx-core/src/ltx_core/text_encoders/gemma/feature_extractor.py
new file mode 100644
index 0000000..ab41dd6
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/text_encoders/gemma/feature_extractor.py
@@ -0,0 +1,36 @@
+import torch
+
+from ltx_core.model.model_protocol import ModelConfigurator
+
+
+class GemmaFeaturesExtractorProjLinear(torch.nn.Module, ModelConfigurator["GemmaFeaturesExtractorProjLinear"]):
+ """
+ Feature extractor module for Gemma models.
+ This module applies a single linear projection to the input tensor.
+ It expects a flattened feature tensor of shape (batch_size, 3840*49).
+ The linear layer maps this to a (batch_size, 3840) embedding.
+ Attributes:
+ aggregate_embed (torch.nn.Linear): Linear projection layer.
+ """
+
+ def __init__(self) -> None:
+ """
+ Initialize the GemmaFeaturesExtractorProjLinear module.
+ The input dimension is expected to be 3840 * 49, and the output is 3840.
+ """
+ super().__init__()
+ self.aggregate_embed = torch.nn.Linear(3840 * 49, 3840, bias=False)
+
+ def forward(self, x: torch.Tensor) -> torch.Tensor:
+ """
+ Forward pass for the feature extractor.
+ Args:
+ x (torch.Tensor): Input tensor of shape (batch_size, 3840 * 49).
+ Returns:
+ torch.Tensor: Output tensor of shape (batch_size, 3840).
+ """
+ return self.aggregate_embed(x)
+
+ @classmethod
+ def from_config(cls: type["GemmaFeaturesExtractorProjLinear"], _config: dict) -> "GemmaFeaturesExtractorProjLinear":
+ return cls()
diff --git a/packages/ltx-core/src/ltx_core/text_encoders/gemma/tokenizer.py b/packages/ltx-core/src/ltx_core/text_encoders/gemma/tokenizer.py
new file mode 100644
index 0000000..f4f384c
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/text_encoders/gemma/tokenizer.py
@@ -0,0 +1,64 @@
+from transformers import AutoTokenizer
+
+
+class LTXVGemmaTokenizer:
+ """
+ Tokenizer wrapper for Gemma models compatible with LTXV processes.
+ This class wraps HuggingFace's `AutoTokenizer` for use with Gemma text encoders,
+ ensuring correct settings and output formatting for downstream consumption.
+ """
+
+ def __init__(self, tokenizer_path: str, max_length: int = 256):
+ """
+ Initialize the tokenizer.
+ Args:
+ tokenizer_path (str): Path to the pretrained tokenizer files or model directory.
+ max_length (int, optional): Max sequence length for encoding. Defaults to 256.
+ """
+ self.tokenizer = AutoTokenizer.from_pretrained(
+ tokenizer_path, local_files_only=True, model_max_length=max_length
+ )
+ # Gemma expects left padding for chat-style prompts; for plain text it doesn't matter much.
+ self.tokenizer.padding_side = "left"
+ if self.tokenizer.pad_token is None:
+ self.tokenizer.pad_token = self.tokenizer.eos_token
+
+ self.max_length = max_length
+
+ def tokenize_with_weights(self, text: str, return_word_ids: bool = False) -> dict[str, list[tuple[int, int]]]:
+ """
+ Tokenize the given text and return token IDs and attention weights.
+ Args:
+ text (str): The input string to tokenize.
+ return_word_ids (bool, optional): If True, includes the token's position (index) in the output tuples.
+ If False (default), omits the indices.
+ Returns:
+ dict[str, list[tuple[int, int]]] OR dict[str, list[tuple[int, int, int]]]:
+ A dictionary with a "gemma" key mapping to:
+ - a list of (token_id, attention_mask) tuples if return_word_ids is False;
+ - a list of (token_id, attention_mask, index) tuples if return_word_ids is True.
+ Example:
+ >>> tokenizer = LTXVGemmaTokenizer("path/to/tokenizer", max_length=8)
+ >>> tokenizer.tokenize_with_weights("hello world")
+ {'gemma': [(1234, 1), (5678, 1), (2, 0), ...]}
+ """
+ text = text.strip()
+ encoded = self.tokenizer(
+ text,
+ padding="max_length",
+ max_length=self.max_length,
+ truncation=True,
+ return_tensors="pt",
+ )
+ input_ids = encoded.input_ids
+ attention_mask = encoded.attention_mask
+ tuples = [
+ (token_id, attn, i) for i, (token_id, attn) in enumerate(zip(input_ids[0], attention_mask[0], strict=True))
+ ]
+ out = {"gemma": tuples}
+
+ if not return_word_ids:
+ # Return only (token_id, attention_mask) pairs, omitting token position
+ out = {k: [(t, w) for t, w, _ in v] for k, v in out.items()}
+
+ return out
diff --git a/packages/ltx-core/src/ltx_core/tools.py b/packages/ltx-core/src/ltx_core/tools.py
new file mode 100644
index 0000000..9e12d2f
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/tools.py
@@ -0,0 +1,184 @@
+from dataclasses import dataclass, replace
+from typing import Protocol
+
+import torch
+from torch._prims_common import DeviceLikeType
+
+from ltx_core.components.patchifiers import (
+ AudioLatentShape,
+ AudioPatchifier,
+ VideoLatentPatchifier,
+ VideoLatentShape,
+ get_pixel_coords,
+)
+from ltx_core.components.protocols import Patchifier
+from ltx_core.types import LatentState, SpatioTemporalScaleFactors
+
+DEFAULT_SCALE_FACTORS = SpatioTemporalScaleFactors.default()
+
+
+class LatentTools(Protocol):
+ """
+ Tools for building latent states.
+ """
+
+ patchifier: Patchifier
+ target_shape: VideoLatentShape | AudioLatentShape
+
+ def create_initial_state(
+ self,
+ device: DeviceLikeType,
+ dtype: torch.dtype,
+ initial_latent: torch.Tensor | None = None,
+ ) -> LatentState:
+ """
+ Create an initial latent state. If initial_latent is provided, it will be used to create the latent state.
+ """
+ ...
+
+ def patchify(self, latent_state: LatentState) -> LatentState:
+ """
+ Patchify the latent state.
+ """
+ if latent_state.latent.shape != self.target_shape.to_torch_shape():
+ raise ValueError(
+ f"Latent state has shape {latent_state.latent.shape}, expected shape is "
+ f"{self.target_shape.to_torch_shape()}"
+ )
+ latent_state = latent_state.clone()
+ latent = self.patchifier.patchify(latent_state.latent)
+ clean_latent = self.patchifier.patchify(latent_state.clean_latent)
+ denoise_mask = self.patchifier.patchify(latent_state.denoise_mask)
+ return replace(latent_state, latent=latent, denoise_mask=denoise_mask, clean_latent=clean_latent)
+
+ def unpatchify(self, latent_state: LatentState) -> LatentState:
+ """
+ Unpatchify the latent state.
+ """
+ latent_state = latent_state.clone()
+ latent = self.patchifier.unpatchify(latent_state.latent, output_shape=self.target_shape)
+ clean_latent = self.patchifier.unpatchify(latent_state.clean_latent, output_shape=self.target_shape)
+ denoise_mask = self.patchifier.unpatchify(
+ latent_state.denoise_mask, output_shape=self.target_shape.mask_shape()
+ )
+ return replace(latent_state, latent=latent, denoise_mask=denoise_mask, clean_latent=clean_latent)
+
+ def clear_conditioning(self, latent_state: LatentState) -> LatentState:
+ """
+ Clear the conditioning from the latent state. This method removes extra tokens from the end of the latent.
+ Therefore, conditioning items should add extra tokens ONLY to the end of the latent.
+ """
+ latent_state = latent_state.clone()
+
+ num_tokens = self.patchifier.get_token_count(self.target_shape)
+ latent = latent_state.latent[:, :num_tokens]
+ clean_latent = latent_state.clean_latent[:, :num_tokens]
+ denoise_mask = torch.ones_like(latent_state.denoise_mask)[:, :num_tokens]
+ positions = latent_state.positions[:, :, :num_tokens]
+
+ return LatentState(latent=latent, denoise_mask=denoise_mask, positions=positions, clean_latent=clean_latent)
+
+
+@dataclass(frozen=True)
+class VideoLatentTools(LatentTools):
+ """
+ Tools for building video latent states.
+ """
+
+ patchifier: VideoLatentPatchifier
+ target_shape: VideoLatentShape
+ fps: float
+ scale_factors: SpatioTemporalScaleFactors = DEFAULT_SCALE_FACTORS
+ causal_fix: bool = True
+
+ def create_initial_state(
+ self,
+ device: DeviceLikeType,
+ dtype: torch.dtype,
+ initial_latent: torch.Tensor | None = None,
+ ) -> LatentState:
+ if initial_latent is not None:
+ assert initial_latent.shape == self.target_shape.to_torch_shape(), (
+ f"Latent shape {initial_latent.shape} does not match target shape {self.target_shape.to_torch_shape()}"
+ )
+ else:
+ initial_latent = torch.zeros(
+ *self.target_shape.to_torch_shape(),
+ device=device,
+ dtype=dtype,
+ )
+
+ clean_latent = initial_latent.clone()
+
+ denoise_mask = torch.ones(
+ *self.target_shape.mask_shape().to_torch_shape(),
+ device=device,
+ dtype=torch.float32,
+ )
+
+ latent_coords = self.patchifier.get_patch_grid_bounds(
+ output_shape=self.target_shape,
+ device=device,
+ )
+
+ positions = get_pixel_coords(
+ latent_coords=latent_coords,
+ scale_factors=self.scale_factors,
+ causal_fix=self.causal_fix,
+ ).float()
+ positions[:, 0, ...] = positions[:, 0, ...] / self.fps
+
+ return self.patchify(
+ LatentState(
+ latent=initial_latent,
+ denoise_mask=denoise_mask,
+ positions=positions.to(dtype),
+ clean_latent=clean_latent,
+ )
+ )
+
+
+@dataclass(frozen=True)
+class AudioLatentTools(LatentTools):
+ """
+ Tools for building audio latent states.
+ """
+
+ patchifier: AudioPatchifier
+ target_shape: AudioLatentShape
+
+ def create_initial_state(
+ self,
+ device: DeviceLikeType,
+ dtype: torch.dtype,
+ initial_latent: torch.Tensor | None = None,
+ ) -> LatentState:
+ if initial_latent is not None:
+ assert initial_latent.shape == self.target_shape.to_torch_shape(), (
+ f"Latent shape {initial_latent.shape} does not match target shape {self.target_shape.to_torch_shape()}"
+ )
+ else:
+ initial_latent = torch.zeros(
+ *self.target_shape.to_torch_shape(),
+ device=device,
+ dtype=dtype,
+ )
+
+ clean_latent = initial_latent.clone()
+
+ denoise_mask = torch.ones(
+ *self.target_shape.mask_shape().to_torch_shape(),
+ device=device,
+ dtype=torch.float32,
+ )
+
+ latent_coords = self.patchifier.get_patch_grid_bounds(
+ output_shape=self.target_shape,
+ device=device,
+ )
+
+ return self.patchify(
+ LatentState(
+ latent=initial_latent, denoise_mask=denoise_mask, positions=latent_coords, clean_latent=clean_latent
+ )
+ )
diff --git a/packages/ltx-core/src/ltx_core/types.py b/packages/ltx-core/src/ltx_core/types.py
new file mode 100644
index 0000000..0f91289
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/types.py
@@ -0,0 +1,181 @@
+from dataclasses import dataclass
+from typing import NamedTuple
+
+import torch
+
+
+class VideoPixelShape(NamedTuple):
+ """
+ Shape of the tensor representing the video pixel array. Assumes BGR channel format.
+ """
+
+ batch: int
+ frames: int
+ height: int
+ width: int
+ fps: float
+
+
+class SpatioTemporalScaleFactors(NamedTuple):
+ """
+ Describes the spatiotemporal downscaling between decoded video space and
+ the corresponding VAE latent grid.
+ """
+
+ time: int
+ width: int
+ height: int
+
+ @classmethod
+ def default(cls) -> "SpatioTemporalScaleFactors":
+ return cls(time=8, width=32, height=32)
+
+
+VIDEO_SCALE_FACTORS = SpatioTemporalScaleFactors.default()
+
+
+class VideoLatentShape(NamedTuple):
+ """
+ Shape of the tensor representing video in VAE latent space.
+ The latent representation is a 5D tensor with dimensions ordered as
+ (batch, channels, frames, height, width). Spatial and temporal dimensions
+ are downscaled relative to pixel space according to the VAE's scale factors.
+ """
+
+ batch: int
+ channels: int
+ frames: int
+ height: int
+ width: int
+
+ def to_torch_shape(self) -> torch.Size:
+ return torch.Size([self.batch, self.channels, self.frames, self.height, self.width])
+
+ @staticmethod
+ def from_torch_shape(shape: torch.Size) -> "VideoLatentShape":
+ return VideoLatentShape(
+ batch=shape[0],
+ channels=shape[1],
+ frames=shape[2],
+ height=shape[3],
+ width=shape[4],
+ )
+
+ def mask_shape(self) -> "VideoLatentShape":
+ return self._replace(channels=1)
+
+ @staticmethod
+ def from_pixel_shape(
+ shape: VideoPixelShape,
+ latent_channels: int = 128,
+ scale_factors: SpatioTemporalScaleFactors = VIDEO_SCALE_FACTORS,
+ ) -> "VideoLatentShape":
+ frames = (shape.frames - 1) // scale_factors[0] + 1
+ height = shape.height // scale_factors[1]
+ width = shape.width // scale_factors[2]
+
+ return VideoLatentShape(
+ batch=shape.batch,
+ channels=latent_channels,
+ frames=frames,
+ height=height,
+ width=width,
+ )
+
+ def upscale(self, scale_factors: SpatioTemporalScaleFactors = VIDEO_SCALE_FACTORS) -> "VideoLatentShape":
+ return self._replace(
+ channels=3,
+ frames=(self.frames - 1) * scale_factors.time + 1,
+ height=self.height * scale_factors.height,
+ width=self.width * scale_factors.width,
+ )
+
+
+class AudioLatentShape(NamedTuple):
+ """
+ Shape of audio in VAE latent space: (batch, channels, frames, mel_bins).
+ mel_bins is the number of frequency bins from the mel-spectrogram encoding.
+ """
+
+ batch: int
+ channels: int
+ frames: int
+ mel_bins: int
+
+ def to_torch_shape(self) -> torch.Size:
+ return torch.Size([self.batch, self.channels, self.frames, self.mel_bins])
+
+ def mask_shape(self) -> "AudioLatentShape":
+ return self._replace(channels=1, mel_bins=1)
+
+ @staticmethod
+ def from_torch_shape(shape: torch.Size) -> "AudioLatentShape":
+ return AudioLatentShape(
+ batch=shape[0],
+ channels=shape[1],
+ frames=shape[2],
+ mel_bins=shape[3],
+ )
+
+ @staticmethod
+ def from_duration(
+ batch: int,
+ duration: float,
+ channels: int = 8,
+ mel_bins: int = 16,
+ sample_rate: int = 16000,
+ hop_length: int = 160,
+ audio_latent_downsample_factor: int = 4,
+ ) -> "AudioLatentShape":
+ latents_per_second = float(sample_rate) / float(hop_length) / float(audio_latent_downsample_factor)
+
+ return AudioLatentShape(
+ batch=batch,
+ channels=channels,
+ frames=round(duration * latents_per_second),
+ mel_bins=mel_bins,
+ )
+
+ @staticmethod
+ def from_video_pixel_shape(
+ shape: VideoPixelShape,
+ channels: int = 8,
+ mel_bins: int = 16,
+ sample_rate: int = 16000,
+ hop_length: int = 160,
+ audio_latent_downsample_factor: int = 4,
+ ) -> "AudioLatentShape":
+ return AudioLatentShape.from_duration(
+ batch=shape.batch,
+ duration=float(shape.frames) / float(shape.fps),
+ channels=channels,
+ mel_bins=mel_bins,
+ sample_rate=sample_rate,
+ hop_length=hop_length,
+ audio_latent_downsample_factor=audio_latent_downsample_factor,
+ )
+
+
+@dataclass(frozen=True)
+class LatentState:
+ """
+ State of latents during the diffusion denoising process.
+ Attributes:
+ latent: The current noisy latent tensor being denoised.
+ denoise_mask: Mask encoding the denoising strength for each token (1 = full denoising, 0 = no denoising).
+ positions: Positional indices for each latent element, used for positional embeddings.
+ clean_latent: Initial state of the latent before denoising, may include conditioning latents.
+ """
+
+ latent: torch.Tensor
+ denoise_mask: torch.Tensor
+ positions: torch.Tensor
+ clean_latent: torch.Tensor
+
+ def clone(self) -> "LatentState":
+ return LatentState(
+ latent=self.latent.clone(),
+ denoise_mask=self.denoise_mask.clone(),
+ positions=self.positions.clone(),
+ clean_latent=self.clean_latent.clone(),
+ )
diff --git a/packages/ltx-core/src/ltx_core/utils.py b/packages/ltx-core/src/ltx_core/utils.py
new file mode 100644
index 0000000..a7a3acb
--- /dev/null
+++ b/packages/ltx-core/src/ltx_core/utils.py
@@ -0,0 +1,51 @@
+from typing import Any
+
+import torch
+
+
+def rms_norm(x: torch.Tensor, weight: torch.Tensor | None = None, eps: float = 1e-6) -> torch.Tensor:
+ """Root-mean-square (RMS) normalize `x` over its last dimension.
+ Thin wrapper around `torch.nn.functional.rms_norm` that infers the normalized
+ shape and forwards `weight` and `eps`.
+ """
+ return torch.nn.functional.rms_norm(x, (x.shape[-1],), weight=weight, eps=eps)
+
+
+def check_config_value(config: dict, key: str, expected: Any) -> None: # noqa: ANN401
+ actual = config.get(key)
+ if actual != expected:
+ raise ValueError(f"Config value {key} is {actual}, expected {expected}")
+
+
+def to_velocity(
+ sample: torch.Tensor,
+ sigma: float | torch.Tensor,
+ denoised_sample: torch.Tensor,
+ calc_dtype: torch.dtype = torch.float32,
+) -> torch.Tensor:
+ """
+ Convert the sample and its denoised version to velocity.
+ Returns:
+ Velocity
+ """
+ if isinstance(sigma, torch.Tensor):
+ sigma = sigma.to(calc_dtype).item()
+ if sigma == 0:
+ raise ValueError("Sigma can't be 0.0")
+ return ((sample.to(calc_dtype) - denoised_sample.to(calc_dtype)) / sigma).to(sample.dtype)
+
+
+def to_denoised(
+ sample: torch.Tensor,
+ velocity: torch.Tensor,
+ sigma: float | torch.Tensor,
+ calc_dtype: torch.dtype = torch.float32,
+) -> torch.Tensor:
+ """
+ Convert the sample and its denoising velocity to denoised sample.
+ Returns:
+ Denoised sample
+ """
+ if isinstance(sigma, torch.Tensor):
+ sigma = sigma.to(calc_dtype)
+ return (sample.to(calc_dtype) - velocity.to(calc_dtype) * sigma).to(sample.dtype)
diff --git a/packages/ltx-pipelines/README.md b/packages/ltx-pipelines/README.md
new file mode 100644
index 0000000..f30a96e
--- /dev/null
+++ b/packages/ltx-pipelines/README.md
@@ -0,0 +1,308 @@
+# LTX-2 Pipelines
+
+High-level pipeline implementations for generating audio-video content with Lightricks' **LTX-2** model. This package provides ready-to-use pipelines for text-to-video, image-to-video, video-to-video, and keyframe interpolation tasks.
+
+Pipelines are built using building blocks from [`ltx-core`](../ltx-core/) (schedulers, guiders, noisers, patchifiers) and handle the complete inference flow including model loading, encoding, decoding, and file I/O.
+
+---
+
+## 📋 Overview
+
+LTX-2 Pipelines provides production-ready implementations that abstract away the complexity of the diffusion process, model loading, and memory management. Each pipeline is optimized for specific use cases and offers different trade-offs between speed, quality, and memory usage.
+
+**Key Features:**
+
+- 🎬 **Multiple Pipeline Types**: Text-to-video, image-to-video, video-to-video, and keyframe interpolation
+- ⚡ **Optimized Performance**: Support for FP8 transformers, gradient estimation, and memory optimization
+- 🎯 **Production Ready**: Two-stage pipelines for best quality output
+- 🔧 **LoRA Support**: Easy integration with trained LoRA adapters
+- 📦 **Self-Contained**: Handles model loading, encoding, decoding, and file I/O
+- 🚀 **CLI Support**: All pipelines can be run as command-line scripts
+
+---
+
+## 🚀 Quick Start
+
+`ltx-pipelines` provides ready-made inference pipelines for text-to-video, image-to-video, video-to-video, and keyframe interpolation. Built using building blocks from [`ltx-core`](../ltx-core/), these pipelines handle the complete inference flow including model loading, encoding, decoding, and file I/O.
+
+## 🔧 Installation
+
+```bash
+# From the repository root
+uv sync --frozen
+
+# Or install as a package
+pip install -e packages/ltx-pipelines
+```
+
+### Running Pipelines
+
+All pipelines can be run directly from the command line. Each pipeline module is executable:
+
+```bash
+# Run a pipeline (example: two-stage text-to-video)
+python -m ltx_pipelines.ti2vid_two_stages \
+ --checkpoint-path path/to/checkpoint.safetensors \
+ --distilled-lora-path path/to/distilled_lora.safetensors \
+ --spatial-upsampler-path path/to/upsampler.safetensors \
+ --gemma-root path/to/gemma \
+ --prompt "A beautiful sunset over the ocean" \
+ --output-path output.mp4
+
+# View all available options for any pipeline
+python -m ltx_pipelines.ti2vid_two_stages --help
+```
+
+Available pipeline modules:
+
+- `ltx_pipelines.ti2vid_two_stages` - Two-stage text-to-video (recommended)
+- `ltx_pipelines.ti2vid_one_stage` - Single-stage text-to-video
+- `ltx_pipelines.distilled` - Fast distilled pipeline
+- `ltx_pipelines.ic_lora` - Video-to-video with IC-LoRA
+- `ltx_pipelines.keyframe_interpolation` - Keyframe interpolation
+
+Use `--help` with any pipeline module to see all available options and parameters.
+
+---
+
+## 🎯 Pipeline Selection Guide
+
+### Quick Decision Tree
+
+```text
+Do you need to condition on existing images/videos?
+├─ YES → Do you have reference videos for video-to-video?
+│ ├─ YES → Use ICLoraPipeline
+│ └─ NO → Do you have keyframe images to interpolate?
+│ ├─ YES → Use KeyframeInterpolationPipeline
+│ └─ NO → Use ICLoraPipeline (image conditioning only)
+│
+└─ NO → Text-to-video only
+ ├─ Do you need best quality?
+ │ └─ YES → Use TI2VidTwoStagesPipeline (recommended for production)
+ │
+ └─ Do you need fastest inference?
+ └─ YES → Use DistilledPipeline (with 8 predefined sigmas)
+```
+
+> **Note:** [`TI2VidOneStagePipeline`](src/ltx_pipelines/ti2vid_one_stage.py) is primarily for educational purposes. For best quality, use two-stage pipelines ([`TI2VidTwoStagesPipeline`](src/ltx_pipelines/ti2vid_two_stages.py), [`ICLoraPipeline`](src/ltx_pipelines/ic_lora.py), [`KeyframeInterpolationPipeline`](src/ltx_pipelines/keyframe_interpolation.py), or [`DistilledPipeline`](src/ltx_pipelines/distilled.py)).
+
+### Features Comparison
+
+| Pipeline | Stages | CFG | Upsampling | Conditioning | Best For |
+| -------- | ------ | --- | ---------- | ------------- | -------- |
+| **TI2VidTwoStagesPipeline** | 2 | ✅ | ✅ | Image | **Production quality** (recommended) |
+| **TI2VidOneStagePipeline** | 1 | ✅ | ❌ | Image | Educational, prototyping |
+| **DistilledPipeline** | 2 | ❌ | ✅ | Image | Fastest inference (8 sigmas) |
+| **ICLoraPipeline** | 2 | ✅ | ✅ | Image + Video | Video-to-video transformations |
+| **KeyframeInterpolationPipeline** | 2 | ✅ | ✅ | Keyframes | Animation, interpolation |
+
+---
+
+## 📦 Available Pipelines
+
+### 1. TI2VidTwoStagesPipeline
+
+**Best for:** High-quality text-to-video generation with upsampling. **Recommended for production use.**
+
+**Source**: [`src/ltx_pipelines/ti2vid_two_stages.py`](src/ltx_pipelines/ti2vid_two_stages.py)
+
+Two-stage generation: Stage 1 generates low-resolution video with CFG guidance, Stage 2 upsamples to 2x resolution with distilled LoRA refinement. Supports image conditioning. Highest quality output, slower than one-stage but significantly better quality.
+
+**Use when:** Production-quality video generation, higher resolution needed, quality over speed, text-to-video with image conditioning.
+
+---
+
+### 2. TI2VidOneStagePipeline
+
+**Best for:** Educational purposes and quick prototyping.
+
+**Source**: [`src/ltx_pipelines/ti2vid_one_stage.py`](src/ltx_pipelines/ti2vid_one_stage.py)
+
+> **⚠️ Important:** This pipeline is primarily for educational purposes. For production-quality results, use `TI2VidTwoStagesPipeline` or other two-stage pipelines.
+
+Single-stage generation (no upsampling) with CFG guidance and image conditioning support. Faster inference but lower resolution output (typically 512x768).
+
+**Use when:** Learning how the pipeline works, quick prototyping, testing, or when high resolution is not needed.
+
+---
+
+### 3. DistilledPipeline
+
+**Best for:** Fastest inference with good quality using a distilled model with predefined sigma schedule.
+
+**Source**: [`src/ltx_pipelines/distilled.py`](src/ltx_pipelines/distilled.py)
+
+Two-stage generation with 8 predefined sigmas (8 steps in stage 1, 4 steps in stage 2). No CFG guidance required. Fastest inference among all pipelines. Supports image conditioning. Requires spatial upsampler.
+
+**Use when:** Fastest inference is critical, batch processing many videos, or when you have a distilled model checkpoint.
+
+---
+
+### 4. ICLoraPipeline
+
+**Best for:** Video-to-video and image-to-video transformations using IC-LoRA.
+
+**Source**: [`src/ltx_pipelines/ic_lora.py`](src/ltx_pipelines/ic_lora.py)
+
+Two-stage generation with IC-LoRA support. Can condition on reference videos (video-to-video) or images at specific frames. CFG guidance in stage 1, upsampling in stage 2. Requires IC-LoRA trained model.
+
+**Use when:** Video-to-video transformations, image-to-video with strong control, or when you have reference videos to guide generation.
+
+---
+
+### 5. KeyframeInterpolationPipeline
+
+**Best for:** Generating videos by interpolating between keyframe images.
+
+**Source**: [`src/ltx_pipelines/keyframe_interpolation.py`](src/ltx_pipelines/keyframe_interpolation.py)
+
+Two-stage generation with keyframe interpolation. Uses guiding latents (additive conditioning) instead of replacing latents for smoother transitions. CFG guidance in stage 1, upsampling in stage 2.
+
+**Use when:** You have keyframe images and want to interpolate between them, creating smooth transitions, or animation/motion interpolation tasks.
+
+---
+
+## 🎨 Conditioning Types
+
+Pipelines use different conditioning methods from [`ltx-core`](../ltx-core/) for controlling generation. See the [ltx-core conditioning documentation](../ltx-core/README.md#conditioning--control) for details.
+
+### Image Conditioning
+
+All pipelines support image conditioning, but with different methods:
+
+- **Replacing Latents** ([`image_conditionings_by_replacing_latent`](src/ltx_pipelines/utils/helpers.py)):
+ - Used by: `TI2VidOneStagePipeline`, `TI2VidTwoStagesPipeline`, `DistilledPipeline`, `ICLoraPipeline`
+ - Replaces the latent at a specific frame with the encoded image
+ - Strong control over specific frames
+
+- **Guiding Latents** ([`image_conditionings_by_adding_guiding_latent`](src/ltx_pipelines/utils/helpers.py)):
+ - Used by: `KeyframeInterpolationPipeline`
+ - Adds the image as a guiding signal rather than replacing
+ - Better for smooth interpolation between keyframes
+
+### Video Conditioning
+
+- **Video Conditioning** (ICLoraPipeline only):
+ - Conditions on entire reference videos
+ - Useful for video-to-video transformations
+ - Uses `VideoConditionByKeyframeIndex` from [`ltx-core`](../ltx-core/)
+
+---
+
+## ⚡ Optimization Tips
+
+
+### Memory Optimization
+
+**FP8 Transformer (Lower Memory Footprint):**
+
+For smaller GPU memory footprint, use the `enable-fp8` flag and use the `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True` environment variable.
+
+**CLI:**
+
+```bash
+PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True python -m ltx_pipelines.ti2vid_one_stage --enable-fp8 --checkpoint-path=...
+```
+
+**Programmatically:**
+
+When authoring custom scripts, pass the `fp8transformer` flag to pipeline classes or construct your own by analogy:
+
+```python
+pipeline = TI2VidTwoStagesPipeline(
+ checkpoint_path=ltx_model_path,
+ distilled_lora_path=distilled_lora_path,
+ distilled_lora_strength=0.6,
+ spatial_upsampler_path=upsampler_path,
+ gemma_root=gemma_root_path,
+ loras=[],
+ fp8transformer=True,
+)
+pipeline(...)
+```
+
+You still need to use `PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True` when launching:
+
+```bash
+PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True python my_denoising_pipeline.py
+```
+
+**Memory Cleanup Between Stages:**
+
+By default, pipelines clean GPU memory (especially transformer weights) between stages. If you have enough memory, you can skip this cleanup to reduce running time:
+
+```python
+# In pipeline implementations, memory cleanup happens automatically
+# between stages. For custom pipelines, you can skip:
+# utils.cleanup_memory() # Comment out if you have enough VRAM
+```
+
+### Denoising Loop Optimization
+
+**Gradient Estimation Denoising Loop:**
+
+Instead of the standard Euler denoising loop, you can use gradient estimation for fewer steps (~20-30 instead of 40):
+
+```python
+from ltx_pipelines.utils.helpers import gradient_estimating_euler_denoising_loop
+
+# Use gradient estimation denoising loop
+def denoising_loop(sigmas, video_state, audio_state, stepper):
+ return gradient_estimating_euler_denoising_loop(
+ sigmas=sigmas,
+ video_state=video_state,
+ audio_state=audio_state,
+ stepper=stepper,
+ denoise_fn=your_denoise_function,
+ ge_gamma=2.0, # Gradient estimation coefficient
+ )
+```
+
+This allows you to use **20-30 steps instead of 40** while maintaining quality. The gradient estimation function is available in [`pipeline_utils.py`](src/ltx_pipelines/utils/helpers.py).
+
+---
+
+## 🔧 Requirements
+
+- **LTX-2 Model Checkpoint** - Local `.safetensors` file
+- **Gemma Text Encoder** - Local Gemma model directory
+- **Spatial Upscaler** - Required for two-stage pipelines (except one-stage)
+- **Distilled LoRA** - Required for two-stage pipelines (except one-stage and distilled)
+
+---
+
+## 📖 Example: Image-to-Video
+
+```python
+from ltx_pipelines.ti2vid_two_stages import TI2VidTwoStagesPipeline
+
+pipeline = TI2VidTwoStagesPipeline(
+ checkpoint_path="/path/to/checkpoint.safetensors",
+ distilled_lora_path="/path/to/distilled_lora.safetensors",
+ spatial_upsampler_path="/path/to/upsampler.safetensors",
+ gemma_root="/path/to/gemma",
+ loras=[],
+)
+
+# Generate video from image
+pipeline(
+ prompt="A serene landscape with mountains in the background",
+ output_path="output.mp4",
+ seed=42,
+ height=512,
+ width=768,
+ num_frames=121,
+ frame_rate=25.0,
+ num_inference_steps=40,
+ cfg_guidance_scale=3.0,
+ images=[("input_image.jpg", 0, 1.0)], # Image at frame 0, strength 1.0
+)
+```
+
+---
+
+## 🔗 Related Projects
+
+- **[LTX-Core](../ltx-core/)** - Core model implementation and inference components (schedulers, guiders, noisers, patchifiers)
+- **[LTX-Trainer](../ltx-trainer/)** - Training and fine-tuning tools
diff --git a/packages/ltx-pipelines/pyproject.toml b/packages/ltx-pipelines/pyproject.toml
new file mode 100644
index 0000000..9dcca5a
--- /dev/null
+++ b/packages/ltx-pipelines/pyproject.toml
@@ -0,0 +1,11 @@
+[project]
+name = "ltx-pipelines"
+version = "1.0.0"
+description = "Pipelines implementation for Lightricks' LTX-2 model"
+readme = "README.md"
+requires-python = ">=3.10"
+dependencies = ["ltx-core", "av", "tqdm", "pillow"]
+
+[build-system]
+requires = ["uv_build>=0.9.8,<0.10.0"]
+build-backend = "uv_build"
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/__init__.py b/packages/ltx-pipelines/src/ltx_pipelines/__init__.py
new file mode 100644
index 0000000..a4fd05e
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/__init__.py
@@ -0,0 +1,26 @@
+"""
+LTX-2 Pipelines: High-level video generation pipelines and utilities.
+This package provides ready-to-use pipelines for video generation:
+- TI2VidOneStagePipeline: Text/image-to-video in a single stage
+- TI2VidTwoStagesPipeline: Two-stage generation with upsampling
+- DistilledPipeline: Fast distilled two-stage generation
+- ICLoraPipeline: Image/video conditioning with distilled LoRA
+- KeyframeInterpolationPipeline: Keyframe-based video interpolation
+- ModelLedger: Central coordinator for loading and building models
+For more detailed components and utilities, import from specific submodules
+like `ltx_pipelines.utils.media_io` or `ltx_pipelines.utils.constants`.
+"""
+
+from ltx_pipelines.distilled import DistilledPipeline
+from ltx_pipelines.ic_lora import ICLoraPipeline
+from ltx_pipelines.keyframe_interpolation import KeyframeInterpolationPipeline
+from ltx_pipelines.ti2vid_one_stage import TI2VidOneStagePipeline
+from ltx_pipelines.ti2vid_two_stages import TI2VidTwoStagesPipeline
+
+__all__ = [
+ "DistilledPipeline",
+ "ICLoraPipeline",
+ "KeyframeInterpolationPipeline",
+ "TI2VidOneStagePipeline",
+ "TI2VidTwoStagesPipeline",
+]
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/distilled.py b/packages/ltx-pipelines/src/ltx_pipelines/distilled.py
new file mode 100644
index 0000000..e3b51ba
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/distilled.py
@@ -0,0 +1,232 @@
+import logging
+from collections.abc import Iterator
+
+import torch
+
+from ltx_core.components.diffusion_steps import EulerDiffusionStep
+from ltx_core.components.noisers import GaussianNoiser
+from ltx_core.components.protocols import DiffusionStepProtocol
+from ltx_core.loader import LoraPathStrengthAndSDOps
+from ltx_core.model.audio_vae import decode_audio as vae_decode_audio
+from ltx_core.model.upsampler import upsample_video
+from ltx_core.model.video_vae import TilingConfig, get_video_chunks_number
+from ltx_core.model.video_vae import decode_video as vae_decode_video
+from ltx_core.text_encoders.gemma import encode_text
+from ltx_core.types import LatentState, VideoPixelShape
+from ltx_pipelines.utils import ModelLedger
+from ltx_pipelines.utils.args import default_2_stage_distilled_arg_parser
+from ltx_pipelines.utils.constants import (
+ AUDIO_SAMPLE_RATE,
+ DISTILLED_SIGMA_VALUES,
+ STAGE_2_DISTILLED_SIGMA_VALUES,
+)
+from ltx_pipelines.utils.helpers import (
+ assert_resolution,
+ cleanup_memory,
+ denoise_audio_video,
+ euler_denoising_loop,
+ generate_enhanced_prompt,
+ get_device,
+ image_conditionings_by_replacing_latent,
+ simple_denoising_func,
+)
+from ltx_pipelines.utils.media_io import encode_video
+from ltx_pipelines.utils.types import PipelineComponents
+
+device = get_device()
+
+
+class DistilledPipeline:
+ """
+ Two-stage distilled video generation pipeline.
+ Stage 1 generates video at the target resolution, then Stage 2 upsamples
+ by 2x and refines with additional denoising steps for higher quality output.
+ """
+
+ def __init__(
+ self,
+ checkpoint_path: str,
+ gemma_root: str,
+ spatial_upsampler_path: str,
+ loras: list[LoraPathStrengthAndSDOps],
+ device: torch.device = device,
+ fp8transformer: bool = False,
+ ):
+ self.device = device
+ self.dtype = torch.bfloat16
+
+ self.model_ledger = ModelLedger(
+ dtype=self.dtype,
+ device=device,
+ checkpoint_path=checkpoint_path,
+ spatial_upsampler_path=spatial_upsampler_path,
+ gemma_root_path=gemma_root,
+ loras=loras,
+ fp8transformer=fp8transformer,
+ )
+
+ self.pipeline_components = PipelineComponents(
+ dtype=self.dtype,
+ device=device,
+ )
+
+ def __call__(
+ self,
+ prompt: str,
+ seed: int,
+ height: int,
+ width: int,
+ num_frames: int,
+ frame_rate: float,
+ images: list[tuple[str, int, float]],
+ tiling_config: TilingConfig | None = None,
+ enhance_prompt: bool = False,
+ ) -> tuple[Iterator[torch.Tensor], torch.Tensor]:
+ assert_resolution(height=height, width=width, is_two_stage=True)
+
+ generator = torch.Generator(device=self.device).manual_seed(seed)
+ noiser = GaussianNoiser(generator=generator)
+ stepper = EulerDiffusionStep()
+ dtype = torch.bfloat16
+
+ text_encoder = self.model_ledger.text_encoder()
+ if enhance_prompt:
+ prompt = generate_enhanced_prompt(text_encoder, prompt, images[0][0] if len(images) > 0 else None)
+ context_p = encode_text(text_encoder, prompts=[prompt])[0]
+ video_context, audio_context = context_p
+
+ torch.cuda.synchronize()
+ del text_encoder
+ cleanup_memory()
+
+ # Stage 1: Initial low resolution video generation.
+ video_encoder = self.model_ledger.video_encoder()
+ transformer = self.model_ledger.transformer()
+ stage_1_sigmas = torch.Tensor(DISTILLED_SIGMA_VALUES).to(self.device)
+
+ def denoising_loop(
+ sigmas: torch.Tensor, video_state: LatentState, audio_state: LatentState, stepper: DiffusionStepProtocol
+ ) -> tuple[LatentState, LatentState]:
+ return euler_denoising_loop(
+ sigmas=sigmas,
+ video_state=video_state,
+ audio_state=audio_state,
+ stepper=stepper,
+ denoise_fn=simple_denoising_func(
+ video_context=video_context,
+ audio_context=audio_context,
+ transformer=transformer, # noqa: F821
+ ),
+ )
+
+ stage_1_output_shape = VideoPixelShape(
+ batch=1,
+ frames=num_frames,
+ width=width // 2,
+ height=height // 2,
+ fps=frame_rate,
+ )
+ stage_1_conditionings = image_conditionings_by_replacing_latent(
+ images=images,
+ height=stage_1_output_shape.height,
+ width=stage_1_output_shape.width,
+ video_encoder=video_encoder,
+ dtype=dtype,
+ device=self.device,
+ )
+
+ video_state, audio_state = denoise_audio_video(
+ output_shape=stage_1_output_shape,
+ conditionings=stage_1_conditionings,
+ noiser=noiser,
+ sigmas=stage_1_sigmas,
+ stepper=stepper,
+ denoising_loop_fn=denoising_loop,
+ components=self.pipeline_components,
+ dtype=dtype,
+ device=self.device,
+ )
+
+ # Stage 2: Upsample and refine the video at higher resolution with distilled LORA.
+ upscaled_video_latent = upsample_video(
+ latent=video_state.latent[:1], video_encoder=video_encoder, upsampler=self.model_ledger.spatial_upsampler()
+ )
+
+ torch.cuda.synchronize()
+ cleanup_memory()
+
+ stage_2_sigmas = torch.Tensor(STAGE_2_DISTILLED_SIGMA_VALUES).to(self.device)
+ stage_2_output_shape = VideoPixelShape(batch=1, frames=num_frames, width=width, height=height, fps=frame_rate)
+ stage_2_conditionings = image_conditionings_by_replacing_latent(
+ images=images,
+ height=stage_2_output_shape.height,
+ width=stage_2_output_shape.width,
+ video_encoder=video_encoder,
+ dtype=dtype,
+ device=self.device,
+ )
+ video_state, audio_state = denoise_audio_video(
+ output_shape=stage_2_output_shape,
+ conditionings=stage_2_conditionings,
+ noiser=noiser,
+ sigmas=stage_2_sigmas,
+ stepper=stepper,
+ denoising_loop_fn=denoising_loop,
+ components=self.pipeline_components,
+ dtype=dtype,
+ device=self.device,
+ noise_scale=stage_2_sigmas[0],
+ initial_video_latent=upscaled_video_latent,
+ initial_audio_latent=audio_state.latent,
+ )
+
+ torch.cuda.synchronize()
+ del transformer
+ del video_encoder
+ cleanup_memory()
+
+ decoded_video = vae_decode_video(video_state.latent, self.model_ledger.video_decoder(), tiling_config)
+ decoded_audio = vae_decode_audio(
+ audio_state.latent, self.model_ledger.audio_decoder(), self.model_ledger.vocoder()
+ )
+ return decoded_video, decoded_audio
+
+
+def main() -> None:
+ logging.getLogger().setLevel(logging.INFO)
+ parser = default_2_stage_distilled_arg_parser()
+ args = parser.parse_args()
+ pipeline = DistilledPipeline(
+ checkpoint_path=args.checkpoint_path,
+ spatial_upsampler_path=args.spatial_upsampler_path,
+ gemma_root=args.gemma_root,
+ loras=args.lora,
+ fp8transformer=args.enable_fp8,
+ )
+ tiling_config = TilingConfig.default()
+ video_chunks_number = get_video_chunks_number(args.num_frames, tiling_config)
+ video, audio = pipeline(
+ prompt=args.prompt,
+ seed=args.seed,
+ height=args.height,
+ width=args.width,
+ num_frames=args.num_frames,
+ frame_rate=args.frame_rate,
+ images=args.images,
+ tiling_config=tiling_config,
+ enhance_prompt=args.enhance_prompt,
+ )
+
+ encode_video(
+ video=video,
+ fps=args.frame_rate,
+ audio=audio,
+ audio_sample_rate=AUDIO_SAMPLE_RATE,
+ output_path=args.output_path,
+ video_chunks_number=video_chunks_number,
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/ic_lora.py b/packages/ltx-pipelines/src/ltx_pipelines/ic_lora.py
new file mode 100644
index 0000000..f9826a0
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/ic_lora.py
@@ -0,0 +1,309 @@
+import logging
+from collections.abc import Iterator
+
+import torch
+
+from ltx_core.components.diffusion_steps import EulerDiffusionStep
+from ltx_core.components.noisers import GaussianNoiser
+from ltx_core.components.protocols import DiffusionStepProtocol
+from ltx_core.conditioning import ConditioningItem, VideoConditionByKeyframeIndex
+from ltx_core.loader import LoraPathStrengthAndSDOps
+from ltx_core.model.audio_vae import decode_audio as vae_decode_audio
+from ltx_core.model.upsampler import upsample_video
+from ltx_core.model.video_vae import TilingConfig, VideoEncoder, get_video_chunks_number
+from ltx_core.model.video_vae import decode_video as vae_decode_video
+from ltx_core.text_encoders.gemma import encode_text
+from ltx_core.types import LatentState, VideoPixelShape
+from ltx_pipelines.utils import ModelLedger
+from ltx_pipelines.utils.args import VideoConditioningAction, default_2_stage_distilled_arg_parser
+from ltx_pipelines.utils.constants import (
+ AUDIO_SAMPLE_RATE,
+ DISTILLED_SIGMA_VALUES,
+ STAGE_2_DISTILLED_SIGMA_VALUES,
+)
+from ltx_pipelines.utils.helpers import (
+ assert_resolution,
+ cleanup_memory,
+ denoise_audio_video,
+ euler_denoising_loop,
+ generate_enhanced_prompt,
+ get_device,
+ image_conditionings_by_replacing_latent,
+ simple_denoising_func,
+)
+from ltx_pipelines.utils.media_io import encode_video, load_video_conditioning
+from ltx_pipelines.utils.types import PipelineComponents
+
+device = get_device()
+
+
+class ICLoraPipeline:
+ """
+ Two-stage video generation pipeline with In-Context (IC) LoRA support.
+ Allows conditioning the generated video on control signals such as depth maps,
+ human pose, or image edges via the video_conditioning parameter.
+ The specific IC-LoRA model should be provided via the loras parameter.
+ Stage 1 generates video at the target resolution, then Stage 2 upsamples
+ by 2x and refines with additional denoising steps for higher quality output.
+ """
+
+ def __init__(
+ self,
+ checkpoint_path: str,
+ spatial_upsampler_path: str,
+ gemma_root: str,
+ loras: list[LoraPathStrengthAndSDOps],
+ device: torch.device = device,
+ fp8transformer: bool = False,
+ ):
+ self.dtype = torch.bfloat16
+ self.stage_1_model_ledger = ModelLedger(
+ dtype=self.dtype,
+ device=device,
+ checkpoint_path=checkpoint_path,
+ spatial_upsampler_path=spatial_upsampler_path,
+ gemma_root_path=gemma_root,
+ loras=loras,
+ fp8transformer=fp8transformer,
+ )
+ self.stage_2_model_ledger = ModelLedger(
+ dtype=self.dtype,
+ device=device,
+ checkpoint_path=checkpoint_path,
+ spatial_upsampler_path=spatial_upsampler_path,
+ gemma_root_path=gemma_root,
+ loras=[],
+ fp8transformer=fp8transformer,
+ )
+ self.pipeline_components = PipelineComponents(
+ dtype=self.dtype,
+ device=device,
+ )
+ self.device = device
+
+ @torch.inference_mode()
+ def __call__(
+ self,
+ prompt: str,
+ seed: int,
+ height: int,
+ width: int,
+ num_frames: int,
+ frame_rate: float,
+ images: list[tuple[str, int, float]],
+ video_conditioning: list[tuple[str, float]],
+ enhance_prompt: bool = False,
+ tiling_config: TilingConfig | None = None,
+ ) -> tuple[Iterator[torch.Tensor], torch.Tensor]:
+ assert_resolution(height=height, width=width, is_two_stage=True)
+
+ generator = torch.Generator(device=self.device).manual_seed(seed)
+ noiser = GaussianNoiser(generator=generator)
+ stepper = EulerDiffusionStep()
+ dtype = torch.bfloat16
+
+ text_encoder = self.stage_1_model_ledger.text_encoder()
+
+ if enhance_prompt:
+ prompt = generate_enhanced_prompt(
+ text_encoder, prompt, images[0][0] if len(images) > 0 else None, seed=seed
+ )
+ video_context, audio_context = encode_text(text_encoder, prompts=[prompt])[0]
+
+ torch.cuda.synchronize()
+ del text_encoder
+ cleanup_memory()
+
+ # Stage 1: Initial low resolution video generation.
+ video_encoder = self.stage_1_model_ledger.video_encoder()
+ transformer = self.stage_1_model_ledger.transformer()
+ stage_1_sigmas = torch.Tensor(DISTILLED_SIGMA_VALUES).to(self.device)
+
+ def first_stage_denoising_loop(
+ sigmas: torch.Tensor, video_state: LatentState, audio_state: LatentState, stepper: DiffusionStepProtocol
+ ) -> tuple[LatentState, LatentState]:
+ return euler_denoising_loop(
+ sigmas=sigmas,
+ video_state=video_state,
+ audio_state=audio_state,
+ stepper=stepper,
+ denoise_fn=simple_denoising_func(
+ video_context=video_context,
+ audio_context=audio_context,
+ transformer=transformer, # noqa: F821
+ ),
+ )
+
+ stage_1_output_shape = VideoPixelShape(
+ batch=1,
+ frames=num_frames,
+ width=width // 2,
+ height=height // 2,
+ fps=frame_rate,
+ )
+ stage_1_conditionings = self._create_conditionings(
+ images=images,
+ video_conditioning=video_conditioning,
+ height=stage_1_output_shape.height,
+ width=stage_1_output_shape.width,
+ video_encoder=video_encoder,
+ num_frames=num_frames,
+ )
+ video_state, audio_state = denoise_audio_video(
+ output_shape=stage_1_output_shape,
+ conditionings=stage_1_conditionings,
+ noiser=noiser,
+ sigmas=stage_1_sigmas,
+ stepper=stepper,
+ denoising_loop_fn=first_stage_denoising_loop,
+ components=self.pipeline_components,
+ dtype=dtype,
+ device=self.device,
+ )
+
+ torch.cuda.synchronize()
+ del transformer
+ cleanup_memory()
+
+ # Stage 2: Upsample and refine the video at higher resolution with distilled LORA.
+ upscaled_video_latent = upsample_video(
+ latent=video_state.latent[:1],
+ video_encoder=video_encoder,
+ upsampler=self.stage_2_model_ledger.spatial_upsampler(),
+ )
+
+ torch.cuda.synchronize()
+ cleanup_memory()
+
+ transformer = self.stage_2_model_ledger.transformer()
+ distilled_sigmas = torch.Tensor(STAGE_2_DISTILLED_SIGMA_VALUES).to(self.device)
+
+ def second_stage_denoising_loop(
+ sigmas: torch.Tensor, video_state: LatentState, audio_state: LatentState, stepper: DiffusionStepProtocol
+ ) -> tuple[LatentState, LatentState]:
+ return euler_denoising_loop(
+ sigmas=sigmas,
+ video_state=video_state,
+ audio_state=audio_state,
+ stepper=stepper,
+ denoise_fn=simple_denoising_func(
+ video_context=video_context,
+ audio_context=audio_context,
+ transformer=transformer, # noqa: F821
+ ),
+ )
+
+ stage_2_output_shape = VideoPixelShape(batch=1, frames=num_frames, width=width, height=height, fps=frame_rate)
+ stage_2_conditionings = image_conditionings_by_replacing_latent(
+ images=images,
+ height=stage_2_output_shape.height,
+ width=stage_2_output_shape.width,
+ video_encoder=video_encoder,
+ dtype=self.dtype,
+ device=self.device,
+ )
+
+ video_state, audio_state = denoise_audio_video(
+ output_shape=stage_2_output_shape,
+ conditionings=stage_2_conditionings,
+ noiser=noiser,
+ sigmas=distilled_sigmas,
+ stepper=stepper,
+ denoising_loop_fn=second_stage_denoising_loop,
+ components=self.pipeline_components,
+ dtype=dtype,
+ device=self.device,
+ noise_scale=distilled_sigmas[0],
+ initial_video_latent=upscaled_video_latent,
+ initial_audio_latent=audio_state.latent,
+ )
+
+ torch.cuda.synchronize()
+ del transformer
+ del video_encoder
+ cleanup_memory()
+
+ decoded_video = vae_decode_video(video_state.latent, self.stage_2_model_ledger.video_decoder(), tiling_config)
+ decoded_audio = vae_decode_audio(
+ audio_state.latent, self.stage_2_model_ledger.audio_decoder(), self.stage_2_model_ledger.vocoder()
+ )
+ return decoded_video, decoded_audio
+
+ def _create_conditionings(
+ self,
+ images: list[tuple[str, int, float]],
+ video_conditioning: list[tuple[str, float]],
+ height: int,
+ width: int,
+ num_frames: int,
+ video_encoder: VideoEncoder,
+ ) -> list[ConditioningItem]:
+ conditionings = image_conditionings_by_replacing_latent(
+ images=images,
+ height=height,
+ width=width,
+ video_encoder=video_encoder,
+ dtype=self.dtype,
+ device=self.device,
+ )
+
+ for video_path, strength in video_conditioning:
+ video = load_video_conditioning(
+ video_path=video_path,
+ height=height,
+ width=width,
+ frame_cap=num_frames,
+ dtype=self.dtype,
+ device=self.device,
+ )
+ encoded_video = video_encoder(video)
+ conditionings.append(VideoConditionByKeyframeIndex(keyframes=encoded_video, frame_idx=0, strength=strength))
+
+ return conditionings
+
+
+def main() -> None:
+ logging.getLogger().setLevel(logging.INFO)
+ parser = default_2_stage_distilled_arg_parser()
+ parser.add_argument(
+ "--video-conditioning",
+ action=VideoConditioningAction,
+ nargs=2,
+ metavar=("PATH", "STRENGTH"),
+ required=True,
+ )
+ args = parser.parse_args()
+ pipeline = ICLoraPipeline(
+ checkpoint_path=args.checkpoint_path,
+ spatial_upsampler_path=args.spatial_upsampler_path,
+ gemma_root=args.gemma_root,
+ loras=args.lora,
+ fp8transformer=args.enable_fp8,
+ )
+ tiling_config = TilingConfig.default()
+ video_chunks_number = get_video_chunks_number(args.num_frames, tiling_config)
+ video, audio = pipeline(
+ prompt=args.prompt,
+ seed=args.seed,
+ height=args.height,
+ width=args.width,
+ num_frames=args.num_frames,
+ frame_rate=args.frame_rate,
+ images=args.images,
+ video_conditioning=args.video_conditioning,
+ tiling_config=tiling_config,
+ )
+
+ encode_video(
+ video=video,
+ fps=args.frame_rate,
+ audio=audio,
+ audio_sample_rate=AUDIO_SAMPLE_RATE,
+ output_path=args.output_path,
+ video_chunks_number=video_chunks_number,
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/keyframe_interpolation.py b/packages/ltx-pipelines/src/ltx_pipelines/keyframe_interpolation.py
new file mode 100644
index 0000000..553a850
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/keyframe_interpolation.py
@@ -0,0 +1,273 @@
+import logging
+from collections.abc import Iterator
+
+import torch
+
+from ltx_core.components.diffusion_steps import EulerDiffusionStep
+from ltx_core.components.guiders import CFGGuider
+from ltx_core.components.noisers import GaussianNoiser
+from ltx_core.components.protocols import DiffusionStepProtocol
+from ltx_core.components.schedulers import LTX2Scheduler
+from ltx_core.loader import LoraPathStrengthAndSDOps
+from ltx_core.model.audio_vae import decode_audio as vae_decode_audio
+from ltx_core.model.upsampler import upsample_video
+from ltx_core.model.video_vae import TilingConfig, get_video_chunks_number
+from ltx_core.model.video_vae import decode_video as vae_decode_video
+from ltx_core.text_encoders.gemma import encode_text
+from ltx_core.types import LatentState, VideoPixelShape
+from ltx_pipelines.utils import ModelLedger
+from ltx_pipelines.utils.args import default_2_stage_arg_parser
+from ltx_pipelines.utils.constants import (
+ AUDIO_SAMPLE_RATE,
+ STAGE_2_DISTILLED_SIGMA_VALUES,
+)
+from ltx_pipelines.utils.helpers import (
+ assert_resolution,
+ cleanup_memory,
+ denoise_audio_video,
+ euler_denoising_loop,
+ generate_enhanced_prompt,
+ get_device,
+ guider_denoising_func,
+ image_conditionings_by_adding_guiding_latent,
+ simple_denoising_func,
+)
+from ltx_pipelines.utils.media_io import encode_video
+from ltx_pipelines.utils.types import PipelineComponents
+
+device = get_device()
+
+
+class KeyframeInterpolationPipeline:
+ """
+ Keyframe-based Two-stage video interpolation pipeline.
+ Interpolates between keyframes to generate a video with smoother transitions.
+ Stage 1 generates video at the target resolution, then Stage 2 upsamples
+ by 2x and refines with additional denoising steps for higher quality output.
+ """
+
+ def __init__(
+ self,
+ checkpoint_path: str,
+ distilled_lora: list[LoraPathStrengthAndSDOps],
+ spatial_upsampler_path: str,
+ gemma_root: str,
+ loras: list[LoraPathStrengthAndSDOps],
+ device: torch.device = device,
+ fp8transformer: bool = False,
+ ):
+ self.device = device
+ self.dtype = torch.bfloat16
+ self.stage_1_model_ledger = ModelLedger(
+ dtype=self.dtype,
+ device=device,
+ checkpoint_path=checkpoint_path,
+ spatial_upsampler_path=spatial_upsampler_path,
+ gemma_root_path=gemma_root,
+ loras=loras,
+ fp8transformer=fp8transformer,
+ )
+ self.stage_2_model_ledger = self.stage_1_model_ledger.with_loras(
+ loras=distilled_lora,
+ )
+ self.pipeline_components = PipelineComponents(
+ dtype=self.dtype,
+ device=device,
+ )
+
+ @torch.inference_mode()
+ def __call__( # noqa: PLR0913
+ self,
+ prompt: str,
+ negative_prompt: str,
+ seed: int,
+ height: int,
+ width: int,
+ num_frames: int,
+ frame_rate: float,
+ num_inference_steps: int,
+ cfg_guidance_scale: float,
+ images: list[tuple[str, int, float]],
+ tiling_config: TilingConfig | None = None,
+ enhance_prompt: bool = False,
+ ) -> tuple[Iterator[torch.Tensor], torch.Tensor]:
+ assert_resolution(height=height, width=width, is_two_stage=True)
+
+ generator = torch.Generator(device=self.device).manual_seed(seed)
+ noiser = GaussianNoiser(generator=generator)
+ stepper = EulerDiffusionStep()
+ cfg_guider = CFGGuider(cfg_guidance_scale)
+ dtype = torch.bfloat16
+
+ text_encoder = self.stage_1_model_ledger.text_encoder()
+ if enhance_prompt:
+ prompt = generate_enhanced_prompt(
+ text_encoder, prompt, images[0][0] if len(images) > 0 else None, seed=seed
+ )
+ context_p, context_n = encode_text(text_encoder, prompts=[prompt, negative_prompt])
+ v_context_p, a_context_p = context_p
+ v_context_n, a_context_n = context_n
+
+ torch.cuda.synchronize()
+ del text_encoder
+ cleanup_memory()
+
+ # Stage 1: Initial low resolution video generation.
+ video_encoder = self.stage_1_model_ledger.video_encoder()
+ transformer = self.stage_1_model_ledger.transformer()
+ sigmas = LTX2Scheduler().execute(steps=num_inference_steps).to(dtype=torch.float32, device=self.device)
+
+ def first_stage_denoising_loop(
+ sigmas: torch.Tensor, video_state: LatentState, audio_state: LatentState, stepper: DiffusionStepProtocol
+ ) -> tuple[LatentState, LatentState]:
+ return euler_denoising_loop(
+ sigmas=sigmas,
+ video_state=video_state,
+ audio_state=audio_state,
+ stepper=stepper,
+ denoise_fn=guider_denoising_func(
+ cfg_guider,
+ v_context_p,
+ v_context_n,
+ a_context_p,
+ a_context_n,
+ transformer=transformer, # noqa: F821
+ ),
+ )
+
+ stage_1_output_shape = VideoPixelShape(
+ batch=1,
+ frames=num_frames,
+ width=width // 2,
+ height=height // 2,
+ fps=frame_rate,
+ )
+ stage_1_conditionings = image_conditionings_by_adding_guiding_latent(
+ images=images,
+ height=stage_1_output_shape.height,
+ width=stage_1_output_shape.width,
+ video_encoder=video_encoder,
+ dtype=dtype,
+ device=self.device,
+ )
+ video_state, audio_state = denoise_audio_video(
+ output_shape=stage_1_output_shape,
+ conditionings=stage_1_conditionings,
+ noiser=noiser,
+ sigmas=sigmas,
+ stepper=stepper,
+ denoising_loop_fn=first_stage_denoising_loop,
+ components=self.pipeline_components,
+ dtype=dtype,
+ device=self.device,
+ )
+
+ torch.cuda.synchronize()
+ del transformer
+ cleanup_memory()
+
+ # Stage 2: Upsample and refine the video at higher resolution with distilled LORA.
+ upscaled_video_latent = upsample_video(
+ latent=video_state.latent[:1],
+ video_encoder=video_encoder,
+ upsampler=self.stage_2_model_ledger.spatial_upsampler(),
+ )
+
+ torch.cuda.synchronize()
+ cleanup_memory()
+
+ transformer = self.stage_2_model_ledger.transformer()
+ distilled_sigmas = torch.Tensor(STAGE_2_DISTILLED_SIGMA_VALUES).to(self.device)
+
+ def second_stage_denoising_loop(
+ sigmas: torch.Tensor, video_state: LatentState, audio_state: LatentState, stepper: DiffusionStepProtocol
+ ) -> tuple[LatentState, LatentState]:
+ return euler_denoising_loop(
+ sigmas=sigmas,
+ video_state=video_state,
+ audio_state=audio_state,
+ stepper=stepper,
+ denoise_fn=simple_denoising_func(
+ video_context=v_context_p,
+ audio_context=a_context_p,
+ transformer=transformer, # noqa: F821
+ ),
+ )
+
+ stage_2_output_shape = VideoPixelShape(batch=1, frames=num_frames, width=width, height=height, fps=frame_rate)
+ stage_2_conditionings = image_conditionings_by_adding_guiding_latent(
+ images=images,
+ height=stage_2_output_shape.height,
+ width=stage_2_output_shape.width,
+ video_encoder=video_encoder,
+ dtype=dtype,
+ device=self.device,
+ )
+ video_state, audio_state = denoise_audio_video(
+ output_shape=stage_2_output_shape,
+ conditionings=stage_2_conditionings,
+ noiser=noiser,
+ sigmas=distilled_sigmas,
+ stepper=stepper,
+ denoising_loop_fn=second_stage_denoising_loop,
+ components=self.pipeline_components,
+ dtype=dtype,
+ device=self.device,
+ noise_scale=distilled_sigmas[0],
+ initial_video_latent=upscaled_video_latent,
+ initial_audio_latent=audio_state.latent,
+ )
+
+ torch.cuda.synchronize()
+ del transformer
+ del video_encoder
+ cleanup_memory()
+
+ decoded_video = vae_decode_video(video_state.latent, self.stage_2_model_ledger.video_decoder(), tiling_config)
+ decoded_audio = vae_decode_audio(
+ audio_state.latent, self.stage_2_model_ledger.audio_decoder(), self.stage_2_model_ledger.vocoder()
+ )
+ return decoded_video, decoded_audio
+
+
+def main() -> None:
+ logging.getLogger().setLevel(logging.INFO)
+ parser = default_2_stage_arg_parser()
+ args = parser.parse_args()
+ pipeline = KeyframeInterpolationPipeline(
+ checkpoint_path=args.checkpoint_path,
+ distilled_lora=args.distilled_lora,
+ spatial_upsampler_path=args.spatial_upsampler_path,
+ gemma_root=args.gemma_root,
+ loras=args.lora,
+ fp8transformer=args.enable_fp8,
+ )
+ tiling_config = TilingConfig.default()
+ video_chunks_number = get_video_chunks_number(args.num_frames, tiling_config)
+ video, audio = pipeline(
+ prompt=args.prompt,
+ negative_prompt=args.negative_prompt,
+ seed=args.seed,
+ height=args.height,
+ width=args.width,
+ num_frames=args.num_frames,
+ frame_rate=args.frame_rate,
+ num_inference_steps=args.num_inference_steps,
+ cfg_guidance_scale=args.cfg_guidance_scale,
+ images=args.images,
+ tiling_config=tiling_config,
+ )
+
+ encode_video(
+ video=video,
+ fps=args.frame_rate,
+ audio=audio,
+ audio_sample_rate=AUDIO_SAMPLE_RATE,
+ output_path=args.output_path,
+ video_chunks_number=video_chunks_number,
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/ti2vid_one_stage.py b/packages/ltx-pipelines/src/ltx_pipelines/ti2vid_one_stage.py
new file mode 100644
index 0000000..bfb801c
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/ti2vid_one_stage.py
@@ -0,0 +1,193 @@
+import logging
+from collections.abc import Iterator
+
+import torch
+
+from ltx_core.components.diffusion_steps import EulerDiffusionStep
+from ltx_core.components.guiders import CFGGuider
+from ltx_core.components.noisers import GaussianNoiser
+from ltx_core.components.protocols import DiffusionStepProtocol
+from ltx_core.components.schedulers import LTX2Scheduler
+from ltx_core.loader import LoraPathStrengthAndSDOps
+from ltx_core.model.audio_vae import decode_audio as vae_decode_audio
+from ltx_core.model.video_vae import decode_video as vae_decode_video
+from ltx_core.text_encoders.gemma import encode_text
+from ltx_core.types import LatentState, VideoPixelShape
+from ltx_pipelines.utils import ModelLedger
+from ltx_pipelines.utils.args import default_1_stage_arg_parser
+from ltx_pipelines.utils.constants import AUDIO_SAMPLE_RATE
+from ltx_pipelines.utils.helpers import (
+ assert_resolution,
+ cleanup_memory,
+ denoise_audio_video,
+ euler_denoising_loop,
+ generate_enhanced_prompt,
+ get_device,
+ guider_denoising_func,
+ image_conditionings_by_replacing_latent,
+)
+from ltx_pipelines.utils.media_io import encode_video
+from ltx_pipelines.utils.types import PipelineComponents
+
+device = get_device()
+
+
+class TI2VidOneStagePipeline:
+ """
+ Single-stage text/image-to-video generation pipeline.
+ Generates video at the target resolution in a single diffusion pass with
+ classifier-free guidance (CFG). Supports optional image conditioning via
+ the images parameter.
+ """
+
+ def __init__(
+ self,
+ checkpoint_path: str,
+ gemma_root: str,
+ loras: list[LoraPathStrengthAndSDOps],
+ device: torch.device = device,
+ fp8transformer: bool = False,
+ ):
+ self.dtype = torch.bfloat16
+ self.device = device
+ self.model_ledger = ModelLedger(
+ dtype=self.dtype,
+ device=device,
+ checkpoint_path=checkpoint_path,
+ gemma_root_path=gemma_root,
+ loras=loras,
+ fp8transformer=fp8transformer,
+ )
+ self.pipeline_components = PipelineComponents(
+ dtype=self.dtype,
+ device=device,
+ )
+
+ def __call__( # noqa: PLR0913
+ self,
+ prompt: str,
+ negative_prompt: str,
+ seed: int,
+ height: int,
+ width: int,
+ num_frames: int,
+ frame_rate: float,
+ num_inference_steps: int,
+ cfg_guidance_scale: float,
+ images: list[tuple[str, int, float]],
+ enhance_prompt: bool = False,
+ ) -> tuple[Iterator[torch.Tensor], torch.Tensor]:
+ assert_resolution(height=height, width=width, is_two_stage=False)
+
+ generator = torch.Generator(device=self.device).manual_seed(seed)
+ noiser = GaussianNoiser(generator=generator)
+ stepper = EulerDiffusionStep()
+ cfg_guider = CFGGuider(cfg_guidance_scale)
+ dtype = torch.bfloat16
+
+ text_encoder = self.model_ledger.text_encoder()
+ if enhance_prompt:
+ prompt = generate_enhanced_prompt(
+ text_encoder, prompt, images[0][0] if len(images) > 0 else None, seed=seed
+ )
+ context_p, context_n = encode_text(text_encoder, prompts=[prompt, negative_prompt])
+ v_context_p, a_context_p = context_p
+ v_context_n, a_context_n = context_n
+
+ torch.cuda.synchronize()
+ del text_encoder
+ cleanup_memory()
+
+ # Stage 1: Initial low resolution video generation.
+ video_encoder = self.model_ledger.video_encoder()
+ transformer = self.model_ledger.transformer()
+ sigmas = LTX2Scheduler().execute(steps=num_inference_steps).to(dtype=torch.float32, device=self.device)
+
+ def first_stage_denoising_loop(
+ sigmas: torch.Tensor, video_state: LatentState, audio_state: LatentState, stepper: DiffusionStepProtocol
+ ) -> tuple[LatentState, LatentState]:
+ return euler_denoising_loop(
+ sigmas=sigmas,
+ video_state=video_state,
+ audio_state=audio_state,
+ stepper=stepper,
+ denoise_fn=guider_denoising_func(
+ cfg_guider,
+ v_context_p,
+ v_context_n,
+ a_context_p,
+ a_context_n,
+ transformer=transformer, # noqa: F821
+ ),
+ )
+
+ stage_1_output_shape = VideoPixelShape(batch=1, frames=num_frames, width=width, height=height, fps=frame_rate)
+ stage_1_conditionings = image_conditionings_by_replacing_latent(
+ images=images,
+ height=stage_1_output_shape.height,
+ width=stage_1_output_shape.width,
+ video_encoder=video_encoder,
+ dtype=dtype,
+ device=self.device,
+ )
+
+ video_state, audio_state = denoise_audio_video(
+ output_shape=stage_1_output_shape,
+ conditionings=stage_1_conditionings,
+ noiser=noiser,
+ sigmas=sigmas,
+ stepper=stepper,
+ denoising_loop_fn=first_stage_denoising_loop,
+ components=self.pipeline_components,
+ dtype=dtype,
+ device=self.device,
+ )
+
+ torch.cuda.synchronize()
+ del transformer
+ cleanup_memory()
+
+ decoded_video = vae_decode_video(video_state.latent, self.model_ledger.video_decoder())
+ decoded_audio = vae_decode_audio(
+ audio_state.latent, self.model_ledger.audio_decoder(), self.model_ledger.vocoder()
+ )
+
+ return decoded_video, decoded_audio
+
+
+def main() -> None:
+ logging.getLogger().setLevel(logging.INFO)
+ parser = default_1_stage_arg_parser()
+ args = parser.parse_args()
+ pipeline = TI2VidOneStagePipeline(
+ checkpoint_path=args.checkpoint_path,
+ gemma_root=args.gemma_root,
+ loras=args.lora,
+ fp8transformer=args.enable_fp8,
+ )
+ video, audio = pipeline(
+ prompt=args.prompt,
+ negative_prompt=args.negative_prompt,
+ seed=args.seed,
+ height=args.height,
+ width=args.width,
+ num_frames=args.num_frames,
+ frame_rate=args.frame_rate,
+ num_inference_steps=args.num_inference_steps,
+ cfg_guidance_scale=args.cfg_guidance_scale,
+ images=args.images,
+ )
+
+ encode_video(
+ video=video,
+ fps=args.frame_rate,
+ audio=audio,
+ audio_sample_rate=AUDIO_SAMPLE_RATE,
+ output_path=args.output_path,
+ video_chunks_number=1,
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/ti2vid_two_stages.py b/packages/ltx-pipelines/src/ltx_pipelines/ti2vid_two_stages.py
new file mode 100644
index 0000000..b835bfe
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/ti2vid_two_stages.py
@@ -0,0 +1,276 @@
+import logging
+from collections.abc import Iterator
+
+import torch
+
+from ltx_core.components.diffusion_steps import EulerDiffusionStep
+from ltx_core.components.guiders import CFGGuider
+from ltx_core.components.noisers import GaussianNoiser
+from ltx_core.components.protocols import DiffusionStepProtocol
+from ltx_core.components.schedulers import LTX2Scheduler
+from ltx_core.loader import LoraPathStrengthAndSDOps
+from ltx_core.model.audio_vae import decode_audio as vae_decode_audio
+from ltx_core.model.upsampler import upsample_video
+from ltx_core.model.video_vae import TilingConfig, get_video_chunks_number
+from ltx_core.model.video_vae import decode_video as vae_decode_video
+from ltx_core.text_encoders.gemma import encode_text
+from ltx_core.types import LatentState, VideoPixelShape
+from ltx_pipelines.utils import ModelLedger
+from ltx_pipelines.utils.args import default_2_stage_arg_parser
+from ltx_pipelines.utils.constants import (
+ AUDIO_SAMPLE_RATE,
+ STAGE_2_DISTILLED_SIGMA_VALUES,
+)
+from ltx_pipelines.utils.helpers import (
+ assert_resolution,
+ cleanup_memory,
+ denoise_audio_video,
+ euler_denoising_loop,
+ generate_enhanced_prompt,
+ get_device,
+ guider_denoising_func,
+ image_conditionings_by_replacing_latent,
+ simple_denoising_func,
+)
+from ltx_pipelines.utils.media_io import encode_video
+from ltx_pipelines.utils.types import PipelineComponents
+
+device = get_device()
+
+
+class TI2VidTwoStagesPipeline:
+ """
+ Two-stage text/image-to-video generation pipeline.
+ Stage 1 generates video at the target resolution with CFG guidance, then
+ Stage 2 upsamples by 2x and refines using a distilled LoRA for higher
+ quality output. Supports optional image conditioning via the images parameter.
+ """
+
+ def __init__(
+ self,
+ checkpoint_path: str,
+ distilled_lora: list[LoraPathStrengthAndSDOps],
+ spatial_upsampler_path: str,
+ gemma_root: str,
+ loras: list[LoraPathStrengthAndSDOps],
+ device: str = device,
+ fp8transformer: bool = False,
+ ):
+ self.device = device
+ self.dtype = torch.bfloat16
+ self.stage_1_model_ledger = ModelLedger(
+ dtype=self.dtype,
+ device=device,
+ checkpoint_path=checkpoint_path,
+ gemma_root_path=gemma_root,
+ spatial_upsampler_path=spatial_upsampler_path,
+ loras=loras,
+ fp8transformer=fp8transformer,
+ )
+
+ self.stage_2_model_ledger = self.stage_1_model_ledger.with_loras(
+ loras=distilled_lora,
+ )
+
+ self.pipeline_components = PipelineComponents(
+ dtype=self.dtype,
+ device=device,
+ )
+
+ @torch.inference_mode()
+ def __call__( # noqa: PLR0913
+ self,
+ prompt: str,
+ negative_prompt: str,
+ seed: int,
+ height: int,
+ width: int,
+ num_frames: int,
+ frame_rate: float,
+ num_inference_steps: int,
+ cfg_guidance_scale: float,
+ images: list[tuple[str, int, float]],
+ tiling_config: TilingConfig | None = None,
+ enhance_prompt: bool = False,
+ ) -> tuple[Iterator[torch.Tensor], torch.Tensor]:
+ assert_resolution(height=height, width=width, is_two_stage=True)
+
+ generator = torch.Generator(device=self.device).manual_seed(seed)
+ noiser = GaussianNoiser(generator=generator)
+ stepper = EulerDiffusionStep()
+ cfg_guider = CFGGuider(cfg_guidance_scale)
+ dtype = torch.bfloat16
+
+ text_encoder = self.stage_1_model_ledger.text_encoder()
+ if enhance_prompt:
+ prompt = generate_enhanced_prompt(
+ text_encoder, prompt, images[0][0] if len(images) > 0 else None, seed=seed
+ )
+ context_p, context_n = encode_text(text_encoder, prompts=[prompt, negative_prompt])
+ v_context_p, a_context_p = context_p
+ v_context_n, a_context_n = context_n
+
+ torch.cuda.synchronize()
+ del text_encoder
+ cleanup_memory()
+
+ # Stage 1: Initial low resolution video generation.
+ video_encoder = self.stage_1_model_ledger.video_encoder()
+ transformer = self.stage_1_model_ledger.transformer()
+ sigmas = LTX2Scheduler().execute(steps=num_inference_steps).to(dtype=torch.float32, device=self.device)
+
+ def first_stage_denoising_loop(
+ sigmas: torch.Tensor, video_state: LatentState, audio_state: LatentState, stepper: DiffusionStepProtocol
+ ) -> tuple[LatentState, LatentState]:
+ return euler_denoising_loop(
+ sigmas=sigmas,
+ video_state=video_state,
+ audio_state=audio_state,
+ stepper=stepper,
+ denoise_fn=guider_denoising_func(
+ cfg_guider,
+ v_context_p,
+ v_context_n,
+ a_context_p,
+ a_context_n,
+ transformer=transformer, # noqa: F821
+ ),
+ )
+
+ stage_1_output_shape = VideoPixelShape(
+ batch=1,
+ frames=num_frames,
+ width=width // 2,
+ height=height // 2,
+ fps=frame_rate,
+ )
+ stage_1_conditionings = image_conditionings_by_replacing_latent(
+ images=images,
+ height=stage_1_output_shape.height,
+ width=stage_1_output_shape.width,
+ video_encoder=video_encoder,
+ dtype=dtype,
+ device=self.device,
+ )
+ video_state, audio_state = denoise_audio_video(
+ output_shape=stage_1_output_shape,
+ conditionings=stage_1_conditionings,
+ noiser=noiser,
+ sigmas=sigmas,
+ stepper=stepper,
+ denoising_loop_fn=first_stage_denoising_loop,
+ components=self.pipeline_components,
+ dtype=dtype,
+ device=self.device,
+ )
+
+ torch.cuda.synchronize()
+ del transformer
+ cleanup_memory()
+
+ # Stage 2: Upsample and refine the video at higher resolution with distilled LORA.
+ upscaled_video_latent = upsample_video(
+ latent=video_state.latent[:1],
+ video_encoder=video_encoder,
+ upsampler=self.stage_2_model_ledger.spatial_upsampler(),
+ )
+
+ torch.cuda.synchronize()
+ cleanup_memory()
+
+ transformer = self.stage_2_model_ledger.transformer()
+ distilled_sigmas = torch.Tensor(STAGE_2_DISTILLED_SIGMA_VALUES).to(self.device)
+
+ def second_stage_denoising_loop(
+ sigmas: torch.Tensor, video_state: LatentState, audio_state: LatentState, stepper: DiffusionStepProtocol
+ ) -> tuple[LatentState, LatentState]:
+ return euler_denoising_loop(
+ sigmas=sigmas,
+ video_state=video_state,
+ audio_state=audio_state,
+ stepper=stepper,
+ denoise_fn=simple_denoising_func(
+ video_context=v_context_p,
+ audio_context=a_context_p,
+ transformer=transformer, # noqa: F821
+ ),
+ )
+
+ stage_2_output_shape = VideoPixelShape(batch=1, frames=num_frames, width=width, height=height, fps=frame_rate)
+ stage_2_conditionings = image_conditionings_by_replacing_latent(
+ images=images,
+ height=stage_2_output_shape.height,
+ width=stage_2_output_shape.width,
+ video_encoder=video_encoder,
+ dtype=dtype,
+ device=self.device,
+ )
+ video_state, audio_state = denoise_audio_video(
+ output_shape=stage_2_output_shape,
+ conditionings=stage_2_conditionings,
+ noiser=noiser,
+ sigmas=distilled_sigmas,
+ stepper=stepper,
+ denoising_loop_fn=second_stage_denoising_loop,
+ components=self.pipeline_components,
+ dtype=dtype,
+ device=self.device,
+ noise_scale=distilled_sigmas[0],
+ initial_video_latent=upscaled_video_latent,
+ initial_audio_latent=audio_state.latent,
+ )
+
+ torch.cuda.synchronize()
+ del transformer
+ del video_encoder
+ cleanup_memory()
+
+ decoded_video = vae_decode_video(video_state.latent, self.stage_2_model_ledger.video_decoder(), tiling_config)
+ decoded_audio = vae_decode_audio(
+ audio_state.latent, self.stage_2_model_ledger.audio_decoder(), self.stage_2_model_ledger.vocoder()
+ )
+
+ return decoded_video, decoded_audio
+
+
+def main() -> None:
+ logging.getLogger().setLevel(logging.INFO)
+ parser = default_2_stage_arg_parser()
+ args = parser.parse_args()
+ pipeline = TI2VidTwoStagesPipeline(
+ checkpoint_path=args.checkpoint_path,
+ distilled_lora=args.distilled_lora,
+ spatial_upsampler_path=args.spatial_upsampler_path,
+ gemma_root=args.gemma_root,
+ loras=args.lora,
+ fp8transformer=args.enable_fp8,
+ )
+ tiling_config = TilingConfig.default()
+ video_chunks_number = get_video_chunks_number(args.num_frames, tiling_config)
+ video, audio = pipeline(
+ prompt=args.prompt,
+ negative_prompt=args.negative_prompt,
+ seed=args.seed,
+ height=args.height,
+ width=args.width,
+ num_frames=args.num_frames,
+ frame_rate=args.frame_rate,
+ num_inference_steps=args.num_inference_steps,
+ cfg_guidance_scale=args.cfg_guidance_scale,
+ images=args.images,
+ tiling_config=tiling_config,
+ )
+
+ encode_video(
+ video=video,
+ fps=args.frame_rate,
+ audio=audio,
+ audio_sample_rate=AUDIO_SAMPLE_RATE,
+ output_path=args.output_path,
+ video_chunks_number=video_chunks_number,
+ )
+
+
+if __name__ == "__main__":
+ main()
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/utils/__init__.py b/packages/ltx-pipelines/src/ltx_pipelines/utils/__init__.py
new file mode 100644
index 0000000..3592a9b
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/utils/__init__.py
@@ -0,0 +1,5 @@
+from ltx_pipelines.utils.model_ledger import ModelLedger
+
+__all__ = [
+ "ModelLedger",
+]
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/utils/args.py b/packages/ltx-pipelines/src/ltx_pipelines/utils/args.py
new file mode 100644
index 0000000..c5bb8f5
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/utils/args.py
@@ -0,0 +1,277 @@
+import argparse
+from pathlib import Path
+
+from ltx_core.loader import LTXV_LORA_COMFY_RENAMING_MAP, LoraPathStrengthAndSDOps
+from ltx_pipelines.utils.constants import (
+ DEFAULT_1_STAGE_HEIGHT,
+ DEFAULT_1_STAGE_WIDTH,
+ DEFAULT_2_STAGE_HEIGHT,
+ DEFAULT_2_STAGE_WIDTH,
+ DEFAULT_CFG_GUIDANCE_SCALE,
+ DEFAULT_FRAME_RATE,
+ DEFAULT_LORA_STRENGTH,
+ DEFAULT_NEGATIVE_PROMPT,
+ DEFAULT_NUM_FRAMES,
+ DEFAULT_NUM_INFERENCE_STEPS,
+ DEFAULT_SEED,
+)
+
+
+class VideoConditioningAction(argparse.Action):
+ def __call__(
+ self,
+ parser: argparse.ArgumentParser, # noqa: ARG002
+ namespace: argparse.Namespace,
+ values: list[str],
+ option_string: str | None = None, # noqa: ARG002
+ ) -> None:
+ path, strength_str = values
+ resolved_path = resolve_path(path)
+ strength = float(strength_str)
+ current = getattr(namespace, self.dest) or []
+ current.append((resolved_path, strength))
+ setattr(namespace, self.dest, current)
+
+
+class ImageAction(argparse.Action):
+ def __call__(
+ self,
+ parser: argparse.ArgumentParser, # noqa: ARG002
+ namespace: argparse.Namespace,
+ values: list[str],
+ option_string: str | None = None, # noqa: ARG002
+ ) -> None:
+ path, frame_idx, strength_str = values
+ resolved_path = resolve_path(path)
+ frame_idx = int(frame_idx)
+ strength = float(strength_str)
+ current = getattr(namespace, self.dest) or []
+ current.append((resolved_path, frame_idx, strength))
+ setattr(namespace, self.dest, current)
+
+
+class LoraAction(argparse.Action):
+ def __call__(
+ self,
+ parser: argparse.ArgumentParser, # noqa: ARG002
+ namespace: argparse.Namespace,
+ values: list[str],
+ option_string: str | None = None,
+ ) -> None:
+ if len(values) > 2:
+ msg = f"{option_string} accepts at most 2 arguments (PATH and optional STRENGTH), got {len(values)} values"
+ raise argparse.ArgumentError(self, msg)
+
+ path = values[0]
+ strength_str = values[1] if len(values) > 1 else str(DEFAULT_LORA_STRENGTH)
+
+ resolved_path = resolve_path(path)
+ strength = float(strength_str)
+
+ current = getattr(namespace, self.dest) or []
+ current.append(LoraPathStrengthAndSDOps(resolved_path, strength, LTXV_LORA_COMFY_RENAMING_MAP))
+ setattr(namespace, self.dest, current)
+
+
+def resolve_path(path: str) -> str:
+ return str(Path(path).expanduser().resolve().as_posix())
+
+
+def basic_arg_parser() -> argparse.ArgumentParser:
+ parser = argparse.ArgumentParser()
+ parser.add_argument(
+ "--checkpoint-path",
+ type=resolve_path,
+ required=True,
+ help="Path to LTX-2 model checkpoint (.safetensors file).",
+ )
+ parser.add_argument(
+ "--gemma-root",
+ type=resolve_path,
+ required=True,
+ help="Path to the root directory containing the Gemma text encoder model files.",
+ )
+ parser.add_argument(
+ "--prompt",
+ type=str,
+ required=True,
+ help="Text prompt describing the desired video content to be generated by the model.",
+ )
+ parser.add_argument(
+ "--output-path",
+ type=resolve_path,
+ required=True,
+ help="Path to the output video file (MP4 format).",
+ )
+ parser.add_argument(
+ "--seed",
+ type=int,
+ default=DEFAULT_SEED,
+ help=(
+ f"Random seed value used to initialize the noise tensor for "
+ f"reproducible generation (default: {DEFAULT_SEED})."
+ ),
+ )
+ parser.add_argument(
+ "--height",
+ type=int,
+ default=DEFAULT_1_STAGE_HEIGHT,
+ help=f"Height of the generated video in pixels, should be divisible by 32 (default: {DEFAULT_1_STAGE_HEIGHT}).",
+ )
+ parser.add_argument(
+ "--width",
+ type=int,
+ default=DEFAULT_1_STAGE_WIDTH,
+ help=f"Width of the generated video in pixels, should be divisible by 32 (default: {DEFAULT_1_STAGE_WIDTH}).",
+ )
+ parser.add_argument(
+ "--num-frames",
+ type=int,
+ default=DEFAULT_NUM_FRAMES,
+ help=f"Number of frames to generate in the output video sequence, num-frames = (8 x K) + 1, "
+ f"where k is a non-negative integer (default: {DEFAULT_NUM_FRAMES}).",
+ )
+ parser.add_argument(
+ "--frame-rate",
+ type=float,
+ default=DEFAULT_FRAME_RATE,
+ help=f"Frame rate of the generated video (fps) (default: {DEFAULT_FRAME_RATE}).",
+ )
+ parser.add_argument(
+ "--num-inference-steps",
+ type=int,
+ default=DEFAULT_NUM_INFERENCE_STEPS,
+ help=(
+ f"Number of denoising steps in the diffusion sampling process. "
+ f"Higher values improve quality but increase generation time (default: {DEFAULT_NUM_INFERENCE_STEPS})."
+ ),
+ )
+ parser.add_argument(
+ "--image",
+ dest="images",
+ action=ImageAction,
+ nargs=3,
+ metavar=("PATH", "FRAME_IDX", "STRENGTH"),
+ default=[],
+ help=(
+ "Image conditioning input: path to image file, target frame index, "
+ "and conditioning strength (all three required). Default: empty list [] (no image conditioning). "
+ "Can be specified multiple times. Example: --image path/to/image1.jpg 0 0.8 "
+ "--image path/to/image2.jpg 160 0.9"
+ ),
+ )
+ parser.add_argument(
+ "--lora",
+ dest="lora",
+ action=LoraAction,
+ nargs="+", # Accept 1-2 arguments per use (path and optional strength); validation is handled in LoraAction
+ metavar=("PATH", "STRENGTH"),
+ default=[],
+ help=(
+ "LoRA (Low-Rank Adaptation) model: path to model file and optional strength "
+ f"(default strength: {DEFAULT_LORA_STRENGTH}). Can be specified multiple times. "
+ "Example: --lora path/to/lora1.safetensors 0.8 --lora path/to/lora2.safetensors"
+ ),
+ )
+ parser.add_argument(
+ "--enable-fp8",
+ action="store_true",
+ help="Enable FP8 mode to reduce memory footprint by keeping model in lower precision. "
+ "Note that calculations are still performed in bfloat16 precision.",
+ )
+ parser.add_argument("--enhance-prompt", action="store_true")
+ return parser
+
+
+def default_1_stage_arg_parser() -> argparse.ArgumentParser:
+ parser = basic_arg_parser()
+ parser.add_argument(
+ "--cfg-guidance-scale",
+ type=float,
+ default=DEFAULT_CFG_GUIDANCE_SCALE,
+ help=(
+ f"Classifier-free guidance (CFG) scale controlling how strongly "
+ f"the model adheres to the prompt. Higher values increase prompt "
+ f"adherence but may reduce diversity (default: {DEFAULT_CFG_GUIDANCE_SCALE})."
+ ),
+ )
+ parser.add_argument(
+ "--negative-prompt",
+ type=str,
+ default=DEFAULT_NEGATIVE_PROMPT,
+ help=(
+ "Negative prompt describing what should not appear in the generated video, "
+ "used to guide the diffusion process away from unwanted content. "
+ "Default: a comprehensive negative prompt covering common artifacts and quality issues."
+ ),
+ )
+
+ return parser
+
+
+def default_2_stage_arg_parser() -> argparse.ArgumentParser:
+ parser = default_1_stage_arg_parser()
+ parser.set_defaults(height=DEFAULT_2_STAGE_HEIGHT, width=DEFAULT_2_STAGE_WIDTH)
+ # Update help text to reflect 2-stage defaults
+ for action in parser._actions:
+ if "--height" in action.option_strings:
+ action.help = (
+ f"Height of the generated video in pixels, should be divisible by 64 "
+ f"(default: {DEFAULT_2_STAGE_HEIGHT})."
+ )
+ if "--width" in action.option_strings:
+ action.help = (
+ f"Width of the generated video in pixels, should be divisible by 64 (default: {DEFAULT_2_STAGE_WIDTH})."
+ )
+ parser.add_argument(
+ "--distilled-lora",
+ dest="distilled_lora",
+ action=LoraAction,
+ nargs="+", # Accept 1-2 arguments per use (path and optional strength); validation is handled in LoraAction
+ metavar=("PATH", "STRENGTH"),
+ required=True,
+ help=(
+ "Distilled LoRA (Low-Rank Adaptation) model used in the second stage (upscaling and refinement): "
+ f"path to model file and optional strength (default strength: {DEFAULT_LORA_STRENGTH}). "
+ "The second stage upsamples the video by 2x resolution and refines it using a distilled "
+ "denoising schedule (fewer steps, no CFG). The distilled LoRA is specifically trained "
+ "for this refinement process to improve quality at higher resolutions. "
+ "Example: --distilled-lora path/to/distilled_lora.safetensors 0.8"
+ ),
+ )
+ parser.add_argument(
+ "--spatial-upsampler-path",
+ type=resolve_path,
+ required=True,
+ help=(
+ "Path to the spatial upsampler model used to increase the resolution "
+ "of the generated video in the latent space."
+ ),
+ )
+ return parser
+
+
+def default_2_stage_distilled_arg_parser() -> argparse.ArgumentParser:
+ parser = basic_arg_parser()
+ parser.set_defaults(height=DEFAULT_2_STAGE_HEIGHT, width=DEFAULT_2_STAGE_WIDTH)
+ # Update help text to reflect 2-stage defaults
+ for action in parser._actions:
+ if "--height" in action.option_strings:
+ action.help = (
+ f"Height of the generated video in pixels, should be divisible by 64 "
+ f"(default: {DEFAULT_2_STAGE_HEIGHT})."
+ )
+ if "--width" in action.option_strings:
+ action.help = (
+ f"Width of the generated video in pixels, should be divisible by 64 (default: {DEFAULT_2_STAGE_WIDTH})."
+ )
+ parser.add_argument(
+ "--spatial-upsampler-path",
+ type=resolve_path,
+ required=True,
+ help=(
+ "Path to the spatial upsampler model used to increase the resolution "
+ "of the generated video in the latent space."
+ ),
+ )
+ return parser
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py b/packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py
new file mode 100644
index 0000000..737135b
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/utils/constants.py
@@ -0,0 +1,77 @@
+# =============================================================================
+# Diffusion Schedule
+# =============================================================================
+
+# Noise schedule for the distilled pipeline. These sigma values control noise
+# levels at each denoising step and were tuned to match the distillation process.
+from ltx_core.types import SpatioTemporalScaleFactors
+
+DISTILLED_SIGMA_VALUES = [1.0, 0.99375, 0.9875, 0.98125, 0.975, 0.909375, 0.725, 0.421875, 0.0]
+
+# Reduced schedule for super-resolution stage 2 (subset of distilled values)
+STAGE_2_DISTILLED_SIGMA_VALUES = [0.909375, 0.725, 0.421875, 0.0]
+
+
+# =============================================================================
+# Video Generation Defaults
+# =============================================================================
+
+DEFAULT_SEED = 10
+DEFAULT_1_STAGE_HEIGHT = 512
+DEFAULT_1_STAGE_WIDTH = 768
+DEFAULT_2_STAGE_HEIGHT = DEFAULT_1_STAGE_HEIGHT * 2
+DEFAULT_2_STAGE_WIDTH = DEFAULT_1_STAGE_WIDTH * 2
+DEFAULT_NUM_FRAMES = 121
+DEFAULT_FRAME_RATE = 24.0
+DEFAULT_NUM_INFERENCE_STEPS = 40
+DEFAULT_CFG_GUIDANCE_SCALE = 4.0
+
+
+# =============================================================================
+# Audio
+# =============================================================================
+
+AUDIO_SAMPLE_RATE = 24000
+
+
+# =============================================================================
+# LoRA
+# =============================================================================
+
+DEFAULT_LORA_STRENGTH = 1.0
+
+
+# =============================================================================
+# Video VAE Architecture
+# =============================================================================
+
+VIDEO_SCALE_FACTORS = SpatioTemporalScaleFactors.default()
+VIDEO_LATENT_CHANNELS = 128
+
+
+# =============================================================================
+# Image Preprocessing
+# =============================================================================
+
+# CRF (Constant Rate Factor) for H.264 encoding used in image conditioning.
+# Lower = higher quality, 0 = lossless. This mimics compression artifacts.
+DEFAULT_IMAGE_CRF = 33
+
+
+# =============================================================================
+# Prompts
+# =============================================================================
+
+DEFAULT_NEGATIVE_PROMPT = (
+ "blurry, out of focus, overexposed, underexposed, low contrast, washed out colors, excessive noise, "
+ "grainy texture, poor lighting, flickering, motion blur, distorted proportions, unnatural skin tones, "
+ "deformed facial features, asymmetrical face, missing facial features, extra limbs, disfigured hands, "
+ "wrong hand count, artifacts around text, inconsistent perspective, camera shake, incorrect depth of "
+ "field, background too sharp, background clutter, distracting reflections, harsh shadows, inconsistent "
+ "lighting direction, color banding, cartoonish rendering, 3D CGI look, unrealistic materials, uncanny "
+ "valley effect, incorrect ethnicity, wrong gender, exaggerated expressions, wrong gaze direction, "
+ "mismatched lip sync, silent or muted audio, distorted voice, robotic voice, echo, background noise, "
+ "off-sync audio, incorrect dialogue, added dialogue, repetitive speech, jittery movement, awkward "
+ "pauses, incorrect timing, unnatural transitions, inconsistent framing, tilted camera, flat lighting, "
+ "inconsistent tone, cinematic oversaturation, stylized filters, or AI artifacts."
+)
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/utils/helpers.py b/packages/ltx-pipelines/src/ltx_pipelines/utils/helpers.py
new file mode 100644
index 0000000..867db18
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/utils/helpers.py
@@ -0,0 +1,474 @@
+import gc
+import logging
+from dataclasses import replace
+
+import torch
+from tqdm import tqdm
+
+from ltx_core.components.noisers import Noiser
+from ltx_core.components.protocols import DiffusionStepProtocol, GuiderProtocol
+from ltx_core.conditioning import (
+ ConditioningItem,
+ VideoConditionByKeyframeIndex,
+ VideoConditionByLatentIndex,
+)
+from ltx_core.model.transformer import Modality, X0Model
+from ltx_core.model.video_vae import VideoEncoder
+from ltx_core.text_encoders.gemma import GemmaTextEncoderModelBase
+from ltx_core.tools import AudioLatentTools, LatentTools, VideoLatentTools
+from ltx_core.types import AudioLatentShape, LatentState, VideoLatentShape, VideoPixelShape
+from ltx_core.utils import to_denoised, to_velocity
+from ltx_pipelines.utils.media_io import decode_image, load_image_conditioning, resize_aspect_ratio_preserving
+from ltx_pipelines.utils.types import (
+ DenoisingFunc,
+ DenoisingLoopFunc,
+ PipelineComponents,
+)
+
+
+def get_device() -> torch.device:
+ if torch.cuda.is_available():
+ return torch.device("cuda")
+ return torch.device("cpu")
+
+
+def cleanup_memory() -> None:
+ gc.collect()
+ torch.cuda.empty_cache()
+ torch.cuda.synchronize()
+
+
+def image_conditionings_by_replacing_latent(
+ images: list[tuple[str, int, float]],
+ height: int,
+ width: int,
+ video_encoder: VideoEncoder,
+ dtype: torch.dtype,
+ device: torch.device,
+) -> list[ConditioningItem]:
+ conditionings = []
+ for image_path, frame_idx, strength in images:
+ image = load_image_conditioning(
+ image_path=image_path,
+ height=height,
+ width=width,
+ dtype=dtype,
+ device=device,
+ )
+ encoded_image = video_encoder(image)
+ conditionings.append(
+ VideoConditionByLatentIndex(
+ latent=encoded_image,
+ strength=strength,
+ latent_idx=frame_idx,
+ )
+ )
+
+ return conditionings
+
+
+def image_conditionings_by_adding_guiding_latent(
+ images: list[tuple[str, int, float]],
+ height: int,
+ width: int,
+ video_encoder: VideoEncoder,
+ dtype: torch.dtype,
+ device: torch.device,
+) -> list[ConditioningItem]:
+ conditionings = []
+ for image_path, frame_idx, strength in images:
+ image = load_image_conditioning(
+ image_path=image_path,
+ height=height,
+ width=width,
+ dtype=dtype,
+ device=device,
+ )
+ encoded_image = video_encoder(image)
+ conditionings.append(
+ VideoConditionByKeyframeIndex(keyframes=encoded_image, frame_idx=frame_idx, strength=strength)
+ )
+ return conditionings
+
+
+def euler_denoising_loop(
+ sigmas: torch.Tensor,
+ video_state: LatentState,
+ audio_state: LatentState,
+ stepper: DiffusionStepProtocol,
+ denoise_fn: DenoisingFunc,
+) -> tuple[LatentState, LatentState]:
+ """
+ Perform the joint audio-video denoising loop over a diffusion schedule.
+ This function iterates over all but the final value in ``sigmas`` and, at
+ each diffusion step, calls ``denoise_fn`` to obtain denoised video and
+ audio latents. The denoised latents are post-processed with their
+ respective denoise masks and clean latents, then passed to ``stepper`` to
+ advance the noisy latents one step along the diffusion schedule.
+ ### Parameters
+ sigmas:
+ A 1D tensor of noise levels (diffusion sigmas) defining the sampling
+ schedule. All steps except the last element are iterated over.
+ video_state:
+ The current video :class:`LatentState`, containing the noisy latent,
+ its clean reference latent, and the denoising mask.
+ audio_state:
+ The current audio :class:`LatentState`, analogous to ``video_state``
+ but for the audio modality.
+ stepper:
+ An implementation of :class:`DiffusionStepProtocol` that updates a
+ latent given the current latent, its denoised estimate, the full
+ ``sigmas`` schedule, and the current step index.
+ denoise_fn:
+ A callable implementing :class:`DenoisingFunc`. It is invoked as
+ ``denoise_fn(video_state, audio_state, sigmas, step_index)`` and must
+ return a tuple ``(denoised_video, denoised_audio)``, where each element
+ is a tensor with the same shape as the corresponding latent.
+ ### Returns
+ tuple[LatentState, LatentState]
+ A pair ``(video_state, audio_state)`` containing the final video and
+ audio latent states after completing the denoising loop.
+ """
+ for step_idx, _ in enumerate(tqdm(sigmas[:-1])):
+ denoised_video, denoised_audio = denoise_fn(video_state, audio_state, sigmas, step_idx)
+
+ denoised_video = post_process_latent(denoised_video, video_state.denoise_mask, video_state.clean_latent)
+ denoised_audio = post_process_latent(denoised_audio, audio_state.denoise_mask, audio_state.clean_latent)
+
+ video_state = replace(video_state, latent=stepper.step(video_state.latent, denoised_video, sigmas, step_idx))
+ audio_state = replace(audio_state, latent=stepper.step(audio_state.latent, denoised_audio, sigmas, step_idx))
+
+ return (video_state, audio_state)
+
+
+def gradient_estimating_euler_denoising_loop(
+ sigmas: torch.Tensor,
+ video_state: LatentState,
+ audio_state: LatentState,
+ stepper: DiffusionStepProtocol,
+ denoise_fn: DenoisingFunc,
+ ge_gamma: float = 2.0,
+) -> tuple[LatentState, LatentState]:
+ """
+ Perform the joint audio-video denoising loop using gradient-estimation sampling.
+ This function is similar to :func:`euler_denoising_loop`, but applies
+ gradient estimation to improve the denoised estimates by tracking velocity
+ changes across steps. See the referenced function for detailed parameter
+ documentation.
+ ### Parameters
+ ge_gamma:
+ Gradient estimation coefficient controlling the velocity correction term.
+ Default is 2.0. Paper: https://openreview.net/pdf?id=o2ND9v0CeK
+ sigmas, video_state, audio_state, stepper, denoise_fn:
+ See :func:`euler_denoising_loop` for parameter descriptions.
+ ### Returns
+ tuple[LatentState, LatentState]
+ See :func:`euler_denoising_loop` for return value description.
+ """
+
+ previous_audio_velocity = None
+ previous_video_velocity = None
+
+ def update_velocity_and_sample(
+ noisy_sample: torch.Tensor, denoised_sample: torch.Tensor, sigma: float, previous_velocity: torch.Tensor | None
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ current_velocity = to_velocity(noisy_sample, sigma, denoised_sample)
+ if previous_velocity is not None:
+ delta_v = current_velocity - previous_velocity
+ total_velocity = ge_gamma * delta_v + previous_velocity
+ denoised_sample = to_denoised(noisy_sample, total_velocity, sigma)
+ return current_velocity, denoised_sample
+
+ for step_idx, _ in enumerate(tqdm(sigmas[:-1])):
+ denoised_video, denoised_audio = denoise_fn(video_state, audio_state, sigmas, step_idx)
+
+ denoised_video = post_process_latent(denoised_video, video_state.denoise_mask, video_state.clean_latent)
+ denoised_audio = post_process_latent(denoised_audio, audio_state.denoise_mask, audio_state.clean_latent)
+
+ if sigmas[step_idx + 1] == 0:
+ return replace(video_state, latent=denoised_video), replace(audio_state, latent=denoised_audio)
+
+ previous_video_velocity, denoised_video = update_velocity_and_sample(
+ video_state.latent, denoised_video, sigmas[step_idx], previous_video_velocity
+ )
+ previous_audio_velocity, denoised_audio = update_velocity_and_sample(
+ audio_state.latent, denoised_audio, sigmas[step_idx], previous_audio_velocity
+ )
+
+ video_state = replace(video_state, latent=stepper.step(video_state.latent, denoised_video, sigmas, step_idx))
+ audio_state = replace(audio_state, latent=stepper.step(audio_state.latent, denoised_audio, sigmas, step_idx))
+
+ return (video_state, audio_state)
+
+
+def noise_video_state(
+ output_shape: VideoPixelShape,
+ noiser: Noiser,
+ conditionings: list[ConditioningItem],
+ components: PipelineComponents,
+ dtype: torch.dtype,
+ device: torch.device,
+ noise_scale: float = 1.0,
+ initial_latent: torch.Tensor | None = None,
+) -> tuple[LatentState, VideoLatentTools]:
+ """Initialize and noise a video latent state for the diffusion pipeline.
+ Creates a video latent state from the output shape, applies conditionings,
+ and adds noise using the provided noiser. Returns the noised state and
+ video latent tools for further processing. If initial_latent is provided, it will be used to create the initial
+ state, otherwise an empty initial state will be created.
+ """
+ video_latent_shape = VideoLatentShape.from_pixel_shape(
+ shape=output_shape,
+ latent_channels=components.video_latent_channels,
+ scale_factors=components.video_scale_factors,
+ )
+ video_tools = VideoLatentTools(components.video_patchifier, video_latent_shape, output_shape.fps)
+ video_state = create_noised_state(
+ tools=video_tools,
+ conditionings=conditionings,
+ noiser=noiser,
+ dtype=dtype,
+ device=device,
+ noise_scale=noise_scale,
+ initial_latent=initial_latent,
+ )
+
+ return video_state, video_tools
+
+
+def noise_audio_state(
+ output_shape: VideoPixelShape,
+ noiser: Noiser,
+ conditionings: list[ConditioningItem],
+ components: PipelineComponents,
+ dtype: torch.dtype,
+ device: torch.device,
+ noise_scale: float = 1.0,
+ initial_latent: torch.Tensor | None = None,
+) -> tuple[LatentState, AudioLatentTools]:
+ """Initialize and noise an audio latent state for the diffusion pipeline.
+ Creates an audio latent state from the output shape, applies conditionings,
+ and adds noise using the provided noiser. Returns the noised state and
+ audio latent tools for further processing. If initial_latent is provided, it will be used to create the initial
+ state, otherwise an empty initial state will be created.
+ """
+ audio_latent_shape = AudioLatentShape.from_video_pixel_shape(output_shape)
+ audio_tools = AudioLatentTools(components.audio_patchifier, audio_latent_shape)
+ audio_state = create_noised_state(
+ tools=audio_tools,
+ conditionings=conditionings,
+ noiser=noiser,
+ dtype=dtype,
+ device=device,
+ noise_scale=noise_scale,
+ initial_latent=initial_latent,
+ )
+
+ return audio_state, audio_tools
+
+
+def create_noised_state(
+ tools: LatentTools,
+ conditionings: list[ConditioningItem],
+ noiser: Noiser,
+ dtype: torch.dtype,
+ device: torch.device,
+ noise_scale: float = 1.0,
+ initial_latent: torch.Tensor | None = None,
+) -> LatentState:
+ """Create a noised latent state from empty state, conditionings, and noiser.
+ Creates an empty latent state, applies conditionings, and then adds noise
+ using the provided noiser. Returns the final noised state ready for diffusion.
+ """
+ state = tools.create_initial_state(device, dtype, initial_latent)
+ state = state_with_conditionings(state, conditionings, tools)
+ state = noiser(state, noise_scale)
+
+ return state
+
+
+def state_with_conditionings(
+ latent_state: LatentState, conditioning_items: list[ConditioningItem], latent_tools: LatentTools
+) -> LatentState:
+ """Apply a list of conditionings to a latent state.
+ Iterates through the conditioning items and applies each one to the latent
+ state in sequence. Returns the modified state with all conditionings applied.
+ """
+ for conditioning in conditioning_items:
+ latent_state = conditioning.apply_to(latent_state=latent_state, latent_tools=latent_tools)
+
+ return latent_state
+
+
+def post_process_latent(denoised: torch.Tensor, denoise_mask: torch.Tensor, clean: torch.Tensor) -> torch.Tensor:
+ """Blend denoised output with clean state based on mask."""
+ return (denoised * denoise_mask + clean.float() * (1 - denoise_mask)).to(denoised.dtype)
+
+
+def modality_from_latent_state(
+ state: LatentState, context: torch.Tensor, sigma: float | torch.Tensor, enabled: bool = True
+) -> Modality:
+ """Create a Modality from a latent state.
+ Constructs a Modality object with the latent state's data, timesteps derived
+ from the denoise mask and sigma, positions, and the provided context.
+ """
+ return Modality(
+ enabled=enabled,
+ latent=state.latent,
+ timesteps=timesteps_from_mask(state.denoise_mask, sigma),
+ positions=state.positions,
+ context=context,
+ context_mask=None,
+ )
+
+
+def timesteps_from_mask(denoise_mask: torch.Tensor, sigma: float | torch.Tensor) -> torch.Tensor:
+ """Compute timesteps from a denoise mask and sigma value.
+ Multiplies the denoise mask by sigma to produce timesteps for each position
+ in the latent state. Areas where the mask is 0 will have zero timesteps.
+ """
+ return denoise_mask * sigma
+
+
+def simple_denoising_func(
+ video_context: torch.Tensor, audio_context: torch.Tensor, transformer: X0Model
+) -> DenoisingFunc:
+ def simple_denoising_step(
+ video_state: LatentState, audio_state: LatentState, sigmas: torch.Tensor, step_index: int
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ sigma = sigmas[step_index]
+ pos_video = modality_from_latent_state(video_state, video_context, sigma)
+ pos_audio = modality_from_latent_state(audio_state, audio_context, sigma)
+
+ denoised_video, denoised_audio = transformer(video=pos_video, audio=pos_audio, perturbations=None)
+ return denoised_video, denoised_audio
+
+ return simple_denoising_step
+
+
+def guider_denoising_func(
+ guider: GuiderProtocol,
+ v_context_p: torch.Tensor,
+ v_context_n: torch.Tensor,
+ a_context_p: torch.Tensor,
+ a_context_n: torch.Tensor,
+ transformer: X0Model,
+) -> DenoisingFunc:
+ def guider_denoising_step(
+ video_state: LatentState, audio_state: LatentState, sigmas: torch.Tensor, step_index: int
+ ) -> tuple[torch.Tensor, torch.Tensor]:
+ sigma = sigmas[step_index]
+ pos_video = modality_from_latent_state(video_state, v_context_p, sigma)
+ pos_audio = modality_from_latent_state(audio_state, a_context_p, sigma)
+
+ denoised_video, denoised_audio = transformer(video=pos_video, audio=pos_audio, perturbations=None)
+ if guider.enabled():
+ neg_video = modality_from_latent_state(video_state, v_context_n, sigma)
+ neg_audio = modality_from_latent_state(audio_state, a_context_n, sigma)
+
+ neg_denoised_video, neg_denoised_audio = transformer(video=neg_video, audio=neg_audio, perturbations=None)
+
+ denoised_video = denoised_video + guider.delta(denoised_video, neg_denoised_video)
+ denoised_audio = denoised_audio + guider.delta(denoised_audio, neg_denoised_audio)
+
+ return denoised_video, denoised_audio
+
+ return guider_denoising_step
+
+
+def denoise_audio_video( # noqa: PLR0913
+ output_shape: VideoPixelShape,
+ conditionings: list[ConditioningItem],
+ noiser: Noiser,
+ sigmas: torch.Tensor,
+ stepper: DiffusionStepProtocol,
+ denoising_loop_fn: DenoisingLoopFunc,
+ components: PipelineComponents,
+ dtype: torch.dtype,
+ device: torch.device,
+ noise_scale: float = 1.0,
+ initial_video_latent: torch.Tensor | None = None,
+ initial_audio_latent: torch.Tensor | None = None,
+) -> tuple[LatentState, LatentState]:
+ video_state, video_tools = noise_video_state(
+ output_shape=output_shape,
+ noiser=noiser,
+ conditionings=conditionings,
+ components=components,
+ dtype=dtype,
+ device=device,
+ noise_scale=noise_scale,
+ initial_latent=initial_video_latent,
+ )
+ audio_state, audio_tools = noise_audio_state(
+ output_shape=output_shape,
+ noiser=noiser,
+ conditionings=[],
+ components=components,
+ dtype=dtype,
+ device=device,
+ noise_scale=noise_scale,
+ initial_latent=initial_audio_latent,
+ )
+
+ video_state, audio_state = denoising_loop_fn(
+ sigmas,
+ video_state,
+ audio_state,
+ stepper,
+ )
+
+ video_state = video_tools.clear_conditioning(video_state)
+ video_state = video_tools.unpatchify(video_state)
+ audio_state = audio_tools.clear_conditioning(audio_state)
+ audio_state = audio_tools.unpatchify(audio_state)
+
+ return video_state, audio_state
+
+
+_UNICODE_REPLACEMENTS = str.maketrans("\u2018\u2019\u201c\u201d\u2014\u2013\u00a0\u2032\u2212", "''\"\"-- '-")
+
+
+def clean_response(text: str) -> str:
+ """Clean a response from curly quotes and leading non-letter characters which Gemma tends to insert."""
+ text = text.translate(_UNICODE_REPLACEMENTS)
+
+ # Remove leading non-letter characters
+ for i, char in enumerate(text):
+ if char.isalpha():
+ return text[i:]
+ return text
+
+
+def generate_enhanced_prompt(
+ text_encoder: GemmaTextEncoderModelBase,
+ prompt: str,
+ image_path: str | None = None,
+ image_long_side: int = 896,
+ seed: int = 42,
+) -> str:
+ """Generate an enhanced prompt from a text encoder and a prompt."""
+ image = None
+ if image_path:
+ image = decode_image(image_path=image_path)
+ image = torch.tensor(image)
+ image = resize_aspect_ratio_preserving(image, image_long_side).to(torch.uint8)
+ prompt = text_encoder.enhance_i2v(prompt, image, seed=seed)
+ else:
+ prompt = text_encoder.enhance_t2v(prompt, seed=seed)
+ logging.info(f"Enhanced prompt: {prompt}")
+ return clean_response(prompt)
+
+
+def assert_resolution(height: int, width: int, is_two_stage: bool) -> None:
+ """Assert that the resolution is divisible by the required divisor.
+ For two-stage pipelines, the resolution must be divisible by 64.
+ For one-stage pipelines, the resolution must be divisible by 32.
+ """
+ divisor = 64 if is_two_stage else 32
+ if height % divisor != 0 or width % divisor != 0:
+ raise ValueError(
+ f"Resolution ({height}x{width}) is not divisible by {divisor}. "
+ f"For {'two-stage' if is_two_stage else 'one-stage'} pipelines, "
+ f"height and width must be multiples of {divisor}."
+ )
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/utils/media_io.py b/packages/ltx-pipelines/src/ltx_pipelines/utils/media_io.py
new file mode 100644
index 0000000..e1081b7
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/utils/media_io.py
@@ -0,0 +1,299 @@
+import math
+from collections.abc import Generator, Iterator
+from fractions import Fraction
+from io import BytesIO
+
+import av
+import numpy as np
+import torch
+from einops import rearrange
+from PIL import Image
+from torch._prims_common import DeviceLikeType
+from tqdm import tqdm
+
+from ltx_pipelines.utils.constants import DEFAULT_IMAGE_CRF
+
+
+def resize_aspect_ratio_preserving(image: torch.Tensor, long_side: int) -> torch.Tensor:
+ """
+ Resize image preserving aspect ratio (filling target long side).
+ Preserves the input dimensions order.
+ Args:
+ image: Input image tensor with shape (F (optional), H, W, C)
+ long_side: Target long side size.
+ Returns:
+ Tensor with shape (F (optional), H, W, C) F = 1 if input is 3D, otherwise input shape[0]
+ """
+ height, width = image.shape[-3:2]
+ max_side = max(height, width)
+ scale = long_side / float(max_side)
+ target_height = int(height * scale)
+ target_width = int(width * scale)
+ resized = resize_and_center_crop(image, target_height, target_width)
+ # rearrange and remove batch dimension
+ result = rearrange(resized, "b c f h w -> b f h w c")[0]
+ # preserve input dimensions
+ return result[0] if result.shape[0] == 1 else result
+
+
+def resize_and_center_crop(tensor: torch.Tensor, height: int, width: int) -> torch.Tensor:
+ """
+ Resize tensor preserving aspect ratio (filling target), then center crop to exact dimensions.
+ Args:
+ latent: Input tensor with shape (H, W, C) or (F, H, W, C)
+ height: Target height
+ width: Target width
+ Returns:
+ Tensor with shape (1, C, 1, height, width) for 3D input or (1, C, F, height, width) for 4D input
+ """
+ if tensor.ndim == 3:
+ tensor = rearrange(tensor, "h w c -> 1 c h w")
+ elif tensor.ndim == 4:
+ tensor = rearrange(tensor, "f h w c -> f c h w")
+ else:
+ raise ValueError(f"Expected input with 3 or 4 dimensions; got shape {tensor.shape}.")
+
+ _, _, src_h, src_w = tensor.shape
+
+ scale = max(height / src_h, width / src_w)
+ # Use ceil to avoid floating-point rounding causing new_h/new_w to be
+ # slightly smaller than target, which would result in negative crop offsets.
+ new_h = math.ceil(src_h * scale)
+ new_w = math.ceil(src_w * scale)
+
+ tensor = torch.nn.functional.interpolate(tensor, size=(new_h, new_w), mode="bilinear", align_corners=False)
+
+ crop_top = (new_h - height) // 2
+ crop_left = (new_w - width) // 2
+ tensor = tensor[:, :, crop_top : crop_top + height, crop_left : crop_left + width]
+
+ tensor = rearrange(tensor, "f c h w -> 1 c f h w")
+ return tensor
+
+
+def normalize_latent(latent: torch.Tensor, device: torch.device, dtype: torch.dtype) -> torch.Tensor:
+ return (latent / 127.5 - 1.0).to(device=device, dtype=dtype)
+
+
+def load_image_conditioning(
+ image_path: str, height: int, width: int, dtype: torch.dtype, device: torch.device
+) -> torch.Tensor:
+ """
+ Loads an image from a path and preprocesses it for conditioning.
+ Note: The image is resized to the nearest multiple of 2 for compatibility with video codecs.
+ """
+ image = decode_image(image_path=image_path)
+ image = preprocess(image=image)
+ image = torch.tensor(image, dtype=torch.float32, device=device)
+ image = resize_and_center_crop(image, height, width)
+ image = normalize_latent(image, device, dtype)
+ return image
+
+
+def load_video_conditioning(
+ video_path: str, height: int, width: int, frame_cap: int, dtype: torch.dtype, device: torch.device
+) -> torch.Tensor:
+ """
+ Loads a video from a path and preprocesses it for conditioning.
+ Note: The video is resized to the nearest multiple of 2 for compatibility with video codecs.
+ """
+ frames = decode_video_from_file(path=video_path, frame_cap=frame_cap, device=device)
+ result = None
+ for f in frames:
+ frame = resize_and_center_crop(f.to(torch.float32), height, width)
+ frame = normalize_latent(frame, device, dtype)
+ result = frame if result is None else torch.cat([result, frame], dim=2)
+ return result
+
+
+def decode_image(image_path: str) -> np.ndarray:
+ image = Image.open(image_path)
+ np_array = np.array(image)[..., :3]
+ return np_array
+
+
+def _write_audio(
+ container: av.container.Container, audio_stream: av.audio.AudioStream, samples: torch.Tensor, audio_sample_rate: int
+) -> None:
+ if samples.ndim == 1:
+ samples = samples[:, None]
+
+ if samples.shape[1] != 2 and samples.shape[0] == 2:
+ samples = samples.T
+
+ if samples.shape[1] != 2:
+ raise ValueError(f"Expected samples with 2 channels; got shape {samples.shape}.")
+
+ # Convert to int16 packed for ingestion; resampler converts to encoder fmt.
+ if samples.dtype != torch.int16:
+ samples = torch.clip(samples, -1.0, 1.0)
+ samples = (samples * 32767.0).to(torch.int16)
+
+ frame_in = av.AudioFrame.from_ndarray(
+ samples.contiguous().reshape(1, -1).cpu().numpy(),
+ format="s16",
+ layout="stereo",
+ )
+ frame_in.sample_rate = audio_sample_rate
+
+ _resample_audio(container, audio_stream, frame_in)
+
+
+def _prepare_audio_stream(container: av.container.Container, audio_sample_rate: int) -> av.audio.AudioStream:
+ """
+ Prepare the audio stream for writing.
+ """
+ audio_stream = container.add_stream("aac", rate=audio_sample_rate)
+ audio_stream.codec_context.sample_rate = audio_sample_rate
+ audio_stream.codec_context.layout = "stereo"
+ audio_stream.codec_context.time_base = Fraction(1, audio_sample_rate)
+ return audio_stream
+
+
+def _resample_audio(
+ container: av.container.Container, audio_stream: av.audio.AudioStream, frame_in: av.AudioFrame
+) -> None:
+ cc = audio_stream.codec_context
+
+ # Use the encoder's format/layout/rate as the *target*
+ target_format = cc.format or "fltp" # AAC → usually fltp
+ target_layout = cc.layout or "stereo"
+ target_rate = cc.sample_rate or frame_in.sample_rate
+
+ audio_resampler = av.audio.resampler.AudioResampler(
+ format=target_format,
+ layout=target_layout,
+ rate=target_rate,
+ )
+
+ audio_next_pts = 0
+ for rframe in audio_resampler.resample(frame_in):
+ if rframe.pts is None:
+ rframe.pts = audio_next_pts
+ audio_next_pts += rframe.samples
+ rframe.sample_rate = frame_in.sample_rate
+ container.mux(audio_stream.encode(rframe))
+
+ # flush audio encoder
+ for packet in audio_stream.encode():
+ container.mux(packet)
+
+
+def encode_video(
+ video: torch.Tensor | Iterator[torch.Tensor],
+ fps: int,
+ audio: torch.Tensor | None,
+ audio_sample_rate: int | None,
+ output_path: str,
+ video_chunks_number: int,
+) -> None:
+ if isinstance(video, torch.Tensor):
+ video = iter([video])
+
+ first_chunk = next(video)
+
+ _, height, width, _ = first_chunk.shape
+
+ container = av.open(output_path, mode="w")
+ stream = container.add_stream("libx264", rate=int(fps))
+ stream.width = width
+ stream.height = height
+ stream.pix_fmt = "yuv420p"
+
+ if audio is not None:
+ if audio_sample_rate is None:
+ raise ValueError("audio_sample_rate is required when audio is provided")
+
+ audio_stream = _prepare_audio_stream(container, audio_sample_rate)
+
+ def all_tiles(
+ first_chunk: torch.Tensor, tiles_generator: Generator[tuple[torch.Tensor, int], None, None]
+ ) -> Generator[tuple[torch.Tensor, int], None, None]:
+ yield first_chunk
+ yield from tiles_generator
+
+ for video_chunk in tqdm(all_tiles(first_chunk, video), total=video_chunks_number):
+ video_chunk_cpu = video_chunk.to("cpu").numpy()
+ for frame_array in video_chunk_cpu:
+ frame = av.VideoFrame.from_ndarray(frame_array, format="rgb24")
+ for packet in stream.encode(frame):
+ container.mux(packet)
+
+ # Flush encoder
+ for packet in stream.encode():
+ container.mux(packet)
+
+ if audio is not None:
+ _write_audio(container, audio_stream, audio, audio_sample_rate)
+
+ container.close()
+
+
+def decode_audio_from_file(path: str, device: torch.device) -> torch.Tensor | None:
+ container = av.open(path)
+ try:
+ audio = []
+ audio_stream = next(s for s in container.streams if s.type == "audio")
+ for frame in container.decode(audio_stream):
+ audio.append(torch.tensor(frame.to_ndarray(), dtype=torch.float32, device=device).unsqueeze(0))
+ container.close()
+ audio = torch.cat(audio)
+ except StopIteration:
+ audio = None
+ finally:
+ container.close()
+
+ return audio
+
+
+def decode_video_from_file(path: str, frame_cap: int, device: DeviceLikeType) -> Generator[torch.Tensor]:
+ container = av.open(path)
+ try:
+ video_stream = next(s for s in container.streams if s.type == "video")
+ for frame in container.decode(video_stream):
+ tensor = torch.tensor(frame.to_rgb().to_ndarray(), dtype=torch.uint8, device=device).unsqueeze(0)
+ yield tensor
+ frame_cap = frame_cap - 1
+ if frame_cap == 0:
+ break
+ finally:
+ container.close()
+
+
+def encode_single_frame(output_file: str, image_array: np.ndarray, crf: float) -> None:
+ container = av.open(output_file, "w", format="mp4")
+ try:
+ stream = container.add_stream("libx264", rate=1, options={"crf": str(crf), "preset": "veryfast"})
+ # Round to nearest multiple of 2 for compatibility with video codecs
+ height = image_array.shape[0] // 2 * 2
+ width = image_array.shape[1] // 2 * 2
+ image_array = image_array[:height, :width]
+ stream.height = height
+ stream.width = width
+ av_frame = av.VideoFrame.from_ndarray(image_array, format="rgb24").reformat(format="yuv420p")
+ container.mux(stream.encode(av_frame))
+ container.mux(stream.encode())
+ finally:
+ container.close()
+
+
+def decode_single_frame(video_file: str) -> np.array:
+ container = av.open(video_file)
+ try:
+ stream = next(s for s in container.streams if s.type == "video")
+ frame = next(container.decode(stream))
+ finally:
+ container.close()
+ return frame.to_ndarray(format="rgb24")
+
+
+def preprocess(image: np.array, crf: float = DEFAULT_IMAGE_CRF) -> np.array:
+ if crf == 0:
+ return image
+
+ with BytesIO() as output_file:
+ encode_single_frame(output_file, image, crf)
+ video_bytes = output_file.getvalue()
+ with BytesIO(video_bytes) as video_file:
+ image_array = decode_single_frame(video_file)
+ return image_array
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/utils/model_ledger.py b/packages/ltx-pipelines/src/ltx_pipelines/utils/model_ledger.py
new file mode 100644
index 0000000..c507ff4
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/utils/model_ledger.py
@@ -0,0 +1,243 @@
+from dataclasses import replace
+
+import torch
+
+from ltx_core.loader.primitives import LoraPathStrengthAndSDOps
+from ltx_core.loader.registry import DummyRegistry, Registry
+from ltx_core.loader.single_gpu_model_builder import SingleGPUModelBuilder as Builder
+from ltx_core.model.audio_vae import (
+ AUDIO_VAE_DECODER_COMFY_KEYS_FILTER,
+ VOCODER_COMFY_KEYS_FILTER,
+ AudioDecoder,
+ AudioDecoderConfigurator,
+ Vocoder,
+ VocoderConfigurator,
+)
+from ltx_core.model.transformer import (
+ LTXV_MODEL_COMFY_RENAMING_MAP,
+ LTXV_MODEL_COMFY_RENAMING_WITH_TRANSFORMER_LINEAR_DOWNCAST_MAP,
+ UPCAST_DURING_INFERENCE,
+ LTXModelConfigurator,
+ X0Model,
+)
+from ltx_core.model.upsampler import LatentUpsampler, LatentUpsamplerConfigurator
+from ltx_core.model.video_vae import (
+ VAE_DECODER_COMFY_KEYS_FILTER,
+ VAE_ENCODER_COMFY_KEYS_FILTER,
+ VideoDecoder,
+ VideoDecoderConfigurator,
+ VideoEncoder,
+ VideoEncoderConfigurator,
+)
+from ltx_core.text_encoders.gemma import (
+ AV_GEMMA_TEXT_ENCODER_KEY_OPS,
+ AVGemmaTextEncoderModel,
+ AVGemmaTextEncoderModelConfigurator,
+ module_ops_from_gemma_root,
+)
+
+
+class ModelLedger:
+ """
+ Central coordinator for loading and building models used in an LTX pipeline.
+ The ledger wires together multiple model builders (transformer, video VAE encoder/decoder,
+ audio VAE decoder, vocoder, text encoder, and optional latent upsampler) and exposes
+ factory methods for constructing model instances.
+ ### Model Building
+ Each model method (e.g. :meth:`transformer`, :meth:`video_decoder`, :meth:`text_encoder`)
+ constructs a new model instance on each call. The builder uses the
+ :class:`~ltx_core.loader.registry.Registry` to load weights from the checkpoint,
+ instantiates the model with the configured ``dtype``, and moves it to ``self.device``.
+ .. note::
+ Models are **not cached**. Each call to a model method creates a new instance.
+ Callers are responsible for storing references to models they wish to reuse
+ and for freeing GPU memory (e.g. by deleting references and calling
+ ``torch.cuda.empty_cache()``).
+ ### Constructor parameters
+ dtype:
+ Torch dtype used when constructing all models (e.g. ``torch.bfloat16``).
+ device:
+ Target device to which models are moved after construction (e.g. ``torch.device("cuda")``).
+ checkpoint_path:
+ Path to a checkpoint directory or file containing the core model weights
+ (transformer, video VAE, audio VAE, text encoder, vocoder). If ``None``, the
+ corresponding builders are not created and calling those methods will raise
+ a :class:`ValueError`.
+ gemma_root_path:
+ Base path to Gemma-compatible CLIP/text encoder weights. Required to
+ initialize the text encoder builder; if omitted, :meth:`text_encoder` cannot be used.
+ spatial_upsampler_path:
+ Optional path to a latent upsampler checkpoint. If provided, the
+ :meth:`spatial_upsampler` method becomes available; otherwise calling it raises
+ a :class:`ValueError`.
+ loras:
+ Optional collection of LoRA configurations (paths, strengths, and key operations)
+ that are applied on top of the base transformer weights when building the model.
+ registry:
+ Optional :class:`Registry` instance for weight caching across builders.
+ Defaults to :class:`DummyRegistry` which performs no cross-builder caching.
+ fp8transformer:
+ If ``True``, builds the transformer with FP8 quantization and upcasting during inference.
+ ### Creating Variants
+ Use :meth:`with_loras` to create a new ``ModelLedger`` instance that includes
+ additional LoRA configurations while sharing the same registry for weight caching.
+ """
+
+ def __init__(
+ self,
+ dtype: torch.dtype,
+ device: torch.device,
+ checkpoint_path: str | None = None,
+ gemma_root_path: str | None = None,
+ spatial_upsampler_path: str | None = None,
+ loras: LoraPathStrengthAndSDOps | None = None,
+ registry: Registry | None = None,
+ fp8transformer: bool = False,
+ ):
+ self.dtype = dtype
+ self.device = device
+ self.checkpoint_path = checkpoint_path
+ self.gemma_root_path = gemma_root_path
+ self.spatial_upsampler_path = spatial_upsampler_path
+ self.loras = loras or ()
+ self.registry = registry or DummyRegistry()
+ self.fp8transformer = fp8transformer
+ self.build_model_builders()
+
+ def build_model_builders(self) -> None:
+ if self.checkpoint_path is not None:
+ self.transformer_builder = Builder(
+ model_path=self.checkpoint_path,
+ model_class_configurator=LTXModelConfigurator,
+ model_sd_ops=LTXV_MODEL_COMFY_RENAMING_MAP,
+ loras=tuple(self.loras),
+ registry=self.registry,
+ )
+
+ self.vae_decoder_builder = Builder(
+ model_path=self.checkpoint_path,
+ model_class_configurator=VideoDecoderConfigurator,
+ model_sd_ops=VAE_DECODER_COMFY_KEYS_FILTER,
+ registry=self.registry,
+ )
+
+ self.vae_encoder_builder = Builder(
+ model_path=self.checkpoint_path,
+ model_class_configurator=VideoEncoderConfigurator,
+ model_sd_ops=VAE_ENCODER_COMFY_KEYS_FILTER,
+ registry=self.registry,
+ )
+
+ self.audio_decoder_builder = Builder(
+ model_path=self.checkpoint_path,
+ model_class_configurator=AudioDecoderConfigurator,
+ model_sd_ops=AUDIO_VAE_DECODER_COMFY_KEYS_FILTER,
+ registry=self.registry,
+ )
+
+ self.vocoder_builder = Builder(
+ model_path=self.checkpoint_path,
+ model_class_configurator=VocoderConfigurator,
+ model_sd_ops=VOCODER_COMFY_KEYS_FILTER,
+ registry=self.registry,
+ )
+
+ if self.gemma_root_path is not None:
+ self.text_encoder_builder = Builder(
+ model_path=self.checkpoint_path,
+ model_class_configurator=AVGemmaTextEncoderModelConfigurator,
+ model_sd_ops=AV_GEMMA_TEXT_ENCODER_KEY_OPS,
+ registry=self.registry,
+ module_ops=module_ops_from_gemma_root(self.gemma_root_path),
+ )
+
+ if self.spatial_upsampler_path is not None:
+ self.upsampler_builder = Builder(
+ model_path=self.spatial_upsampler_path,
+ model_class_configurator=LatentUpsamplerConfigurator,
+ registry=self.registry,
+ )
+
+ def _target_device(self) -> torch.device:
+ if isinstance(self.registry, DummyRegistry) or self.registry is None:
+ return self.device
+ else:
+ return torch.device("cpu")
+
+ def with_loras(self, loras: LoraPathStrengthAndSDOps) -> "ModelLedger":
+ return ModelLedger(
+ dtype=self.dtype,
+ device=self.device,
+ checkpoint_path=self.checkpoint_path,
+ gemma_root_path=self.gemma_root_path,
+ spatial_upsampler_path=self.spatial_upsampler_path,
+ loras=(*self.loras, *loras),
+ registry=self.registry,
+ fp8transformer=self.fp8transformer,
+ )
+
+ def transformer(self) -> X0Model:
+ if not hasattr(self, "transformer_builder"):
+ raise ValueError(
+ "Transformer not initialized. Please provide a checkpoint path to the ModelLedger constructor."
+ )
+ if self.fp8transformer:
+ fp8_builder = replace(
+ self.transformer_builder,
+ module_ops=(UPCAST_DURING_INFERENCE,),
+ model_sd_ops=LTXV_MODEL_COMFY_RENAMING_WITH_TRANSFORMER_LINEAR_DOWNCAST_MAP,
+ )
+ return X0Model(fp8_builder.build(device=self._target_device())).to(self.device).eval()
+ else:
+ return (
+ X0Model(self.transformer_builder.build(device=self._target_device(), dtype=self.dtype))
+ .to(self.device)
+ .eval()
+ )
+
+ def video_decoder(self) -> VideoDecoder:
+ if not hasattr(self, "vae_decoder_builder"):
+ raise ValueError(
+ "Video decoder not initialized. Please provide a checkpoint path to the ModelLedger constructor."
+ )
+
+ return self.vae_decoder_builder.build(device=self._target_device(), dtype=self.dtype).to(self.device).eval()
+
+ def video_encoder(self) -> VideoEncoder:
+ if not hasattr(self, "vae_encoder_builder"):
+ raise ValueError(
+ "Video encoder not initialized. Please provide a checkpoint path to the ModelLedger constructor."
+ )
+
+ return self.vae_encoder_builder.build(device=self._target_device(), dtype=self.dtype).to(self.device).eval()
+
+ def text_encoder(self) -> AVGemmaTextEncoderModel:
+ if not hasattr(self, "text_encoder_builder"):
+ raise ValueError(
+ "Text encoder not initialized. Please provide a checkpoint path and gemma root path to the "
+ "ModelLedger constructor."
+ )
+
+ return self.text_encoder_builder.build(device=self._target_device(), dtype=self.dtype).to(self.device).eval()
+
+ def audio_decoder(self) -> AudioDecoder:
+ if not hasattr(self, "audio_decoder_builder"):
+ raise ValueError(
+ "Audio decoder not initialized. Please provide a checkpoint path to the ModelLedger constructor."
+ )
+
+ return self.audio_decoder_builder.build(device=self._target_device(), dtype=self.dtype).to(self.device).eval()
+
+ def vocoder(self) -> Vocoder:
+ if not hasattr(self, "vocoder_builder"):
+ raise ValueError(
+ "Vocoder not initialized. Please provide a checkpoint path to the ModelLedger constructor."
+ )
+
+ return self.vocoder_builder.build(device=self._target_device(), dtype=self.dtype).to(self.device).eval()
+
+ def spatial_upsampler(self) -> LatentUpsampler:
+ if not hasattr(self, "upsampler_builder"):
+ raise ValueError("Upsampler not initialized. Please provide upsampler path to the ModelLedger constructor.")
+
+ return self.upsampler_builder.build(device=self._target_device(), dtype=self.dtype).to(self.device).eval()
diff --git a/packages/ltx-pipelines/src/ltx_pipelines/utils/types.py b/packages/ltx-pipelines/src/ltx_pipelines/utils/types.py
new file mode 100644
index 0000000..cd63a1f
--- /dev/null
+++ b/packages/ltx-pipelines/src/ltx_pipelines/utils/types.py
@@ -0,0 +1,73 @@
+from typing import Protocol
+
+import torch
+
+from ltx_core.components.patchifiers import AudioPatchifier, VideoLatentPatchifier
+from ltx_core.components.protocols import DiffusionStepProtocol
+from ltx_core.types import LatentState
+from ltx_pipelines.utils.constants import VIDEO_LATENT_CHANNELS, VIDEO_SCALE_FACTORS
+
+
+class PipelineComponents:
+ """
+ Container class for pipeline components used throughout the LTX pipelines.
+ Attributes:
+ dtype (torch.dtype): Default torch dtype for tensors in the pipeline.
+ device (torch.device): Target device to place tensors and modules on.
+ video_scale_factors (SpatioTemporalScaleFactors): Scale factors (T, H, W) for VAE latent space.
+ video_latent_channels (int): Number of channels in the video latent representation.
+ video_patchifier (VideoLatentPatchifier): Patchifier instance for video latents.
+ audio_patchifier (AudioPatchifier): Patchifier instance for audio latents.
+ """
+
+ def __init__(
+ self,
+ dtype: torch.dtype,
+ device: torch.device,
+ ):
+ self.dtype = dtype
+ self.device = device
+
+ self.video_scale_factors = VIDEO_SCALE_FACTORS
+ self.video_latent_channels = VIDEO_LATENT_CHANNELS
+
+ self.video_patchifier = VideoLatentPatchifier(patch_size=1)
+ self.audio_patchifier = AudioPatchifier(patch_size=1)
+
+
+class DenoisingFunc(Protocol):
+ """
+ Protocol for a denoising function used in the LTX pipeline.
+ Args:
+ video_state (LatentState): The current latent state for video.
+ audio_state (LatentState): The current latent state for audio.
+ sigmas (torch.Tensor): A 1D tensor of sigma values for each diffusion step.
+ step_index (int): Index of the current denoising step.
+ Returns:
+ tuple[torch.Tensor, torch.Tensor]: The denoised video and audio tensors.
+ """
+
+ def __call__(
+ self, video_state: LatentState, audio_state: LatentState, sigmas: torch.Tensor, step_index: int
+ ) -> tuple[torch.Tensor, torch.Tensor]: ...
+
+
+class DenoisingLoopFunc(Protocol):
+ """
+ Protocol for a denoising loop function used in the LTX pipeline.
+ Args:
+ sigmas (torch.Tensor): A 1D tensor of sigma values for each diffusion step.
+ video_state (LatentState): The current latent state for video.
+ audio_state (LatentState): The current latent state for audio.
+ stepper (DiffusionStepProtocol): The diffusion step protocol to use.
+ Returns:
+ tuple[LatentState, LatentState]: The denoised video and audio latent states.
+ """
+
+ def __call__(
+ self,
+ sigmas: torch.Tensor,
+ video_state: LatentState,
+ audio_state: LatentState,
+ stepper: DiffusionStepProtocol,
+ ) -> tuple[torch.Tensor, torch.Tensor]: ...
diff --git a/packages/ltx-trainer/.gitignore b/packages/ltx-trainer/.gitignore
new file mode 100644
index 0000000..aa42d10
--- /dev/null
+++ b/packages/ltx-trainer/.gitignore
@@ -0,0 +1,6 @@
+configs/*.yaml
+!configs/ltx2_av_lora.yaml
+!configs/ltx2_v2v_ic_lora.yaml
+datasets
+outputs
+wandb
diff --git a/packages/ltx-trainer/AGENTS.md b/packages/ltx-trainer/AGENTS.md
new file mode 100644
index 0000000..79320bc
--- /dev/null
+++ b/packages/ltx-trainer/AGENTS.md
@@ -0,0 +1,352 @@
+# AGENTS.md
+
+This file provides guidance to AI coding assistants (Claude, Cursor, etc.) when working with code in this repository.
+
+## Project Overview
+
+**LTX-2 Trainer** is a training toolkit for fine-tuning the Lightricks LTX-2 audio-video generation model. It supports:
+
+- **LoRA training** - Efficient fine-tuning with adapters
+- **Full fine-tuning** - Complete model training
+- **Audio-video training** - Joint audio and video generation
+- **IC-LoRA training** - In-context control adapters for video-to-video transformations
+
+**Key Dependencies:**
+
+- **[`ltx-core`](../ltx-core/)** - Core model implementations (transformer, VAE, text encoder)
+- **[`ltx-pipelines`](../ltx-pipelines/)** - Inference pipeline components
+
+> **Important:** This trainer only supports **LTX-2** (the audio-video model). The older LTXV models are not supported.
+
+## Architecture Overview
+
+### Package Structure
+
+```
+packages/ltx-trainer/
+├── src/ltx_trainer/ # Main training module
+│ ├── config.py # Pydantic configuration models
+│ ├── trainer.py # Main training orchestration with Accelerate
+│ ├── model_loader.py # Model loading using ltx-core
+│ ├── validation_sampler.py # Inference for validation samples
+│ ├── datasets.py # PrecomputedDataset for latent-based training
+│ ├── training_strategies/ # Strategy pattern for different training modes
+│ │ ├── __init__.py # Factory function: get_training_strategy()
+│ │ ├── base_strategy.py # TrainingStrategy ABC, ModelInputs, TrainingStrategyConfigBase
+│ │ ├── text_to_video.py # TextToVideoStrategy, TextToVideoConfig
+│ │ └── video_to_video.py # VideoToVideoStrategy, VideoToVideoConfig
+│ ├── timestep_samplers.py # Flow matching timestep sampling
+│ ├── captioning.py # Video captioning utilities
+│ ├── video_utils.py # Video processing utilities
+│ └── hf_hub_utils.py # HuggingFace Hub integration
+├── scripts/ # User-facing CLI tools
+│ ├── train.py # Main training script
+│ ├── process_dataset.py # Dataset preprocessing
+│ ├── process_videos.py # Video latent encoding
+│ ├── process_captions.py # Text embedding computation
+│ ├── caption_videos.py # Automatic video captioning
+│ ├── decode_latents.py # Latent decoding for debugging
+│ ├── inference.py # Inference with trained models
+│ ├── compute_reference.py # Generate IC-LoRA reference videos
+│ └── split_scenes.py # Scene detection and splitting
+├── configs/ # Example training configurations
+│ ├── ltx2_av_lora.yaml # Audio-video LoRA training
+│ ├── ltx2_v2v_ic_lora.yaml # IC-LoRA video-to-video
+│ └── accelerate/ # Accelerate configs for distributed training
+└── docs/ # Documentation
+```
+
+### Key Architectural Patterns
+
+**Model Loading:**
+
+- `ltx_trainer.model_loader` provides component loaders using `ltx-core`
+- Individual loaders: `load_transformer()`, `load_video_vae_encoder()`, `load_video_vae_decoder()`, `load_text_encoder()`, etc.
+- Combined loader: `load_model()` returns `LtxModelComponents` dataclass
+- Uses `SingleGPUModelBuilder` from ltx-core internally
+
+**Training Flow:**
+
+1. Configuration loaded via Pydantic models in `config.py`
+2. `Trainer` class orchestrates the training loop
+3. Training strategies (`TextToVideoStrategy`, `VideoToVideoStrategy`) prepare inputs and compute loss
+4. Accelerate handles distributed training and device placement
+5. Data flows as precomputed latents through `PrecomputedDataset`
+
+**Model Interface (Modality-based):**
+
+```python
+from ltx_core.model.transformer.modality import Modality
+
+# Create modality objects for video and audio
+video = Modality(
+ enabled=True,
+ latent=video_latents, # [B, seq_len, 128]
+ timesteps=video_timesteps, # [B, seq_len] per-token
+ positions=video_positions, # [B, 3, seq_len, 2]
+ context=video_embeds,
+ context_mask=None,
+)
+audio = Modality(
+ enabled=True,
+ latent=audio_latents,
+ timesteps=audio_timesteps,
+ positions=audio_positions, # [B, 1, seq_len, 2]
+ context=audio_embeds,
+ context_mask=None,
+)
+
+# Forward pass returns predictions for both modalities
+video_pred, audio_pred = model(video=video, audio=audio, perturbations=None)
+```
+
+> **Note:** `Modality` is immutable (frozen dataclass). Use `dataclasses.replace()` to modify.
+
+**Configuration System:**
+
+- All config in `src/ltx_trainer/config.py`
+- Main class: `LtxTrainerConfig`
+- Training strategy configs: `TextToVideoConfig`, `VideoToVideoConfig`
+- Uses Pydantic field validators and model validators
+- Config files in `configs/` directory
+
+## Development Commands
+
+### Setup and Installation
+
+```bash
+# From the repository root
+uv sync
+cd packages/ltx-trainer
+```
+
+### Code Quality
+
+```bash
+# Run ruff linting and formatting
+uv run ruff check .
+uv run ruff format .
+
+# Run pre-commit checks
+uv run pre-commit run --all-files
+```
+
+### Running Tests
+
+```bash
+cd packages/ltx-trainer
+uv run pytest
+```
+
+### Running Training
+
+```bash
+# Single GPU
+uv run python scripts/train.py configs/ltx2_av_lora.yaml
+
+# Multi-GPU with Accelerate
+uv run accelerate launch scripts/train.py configs/ltx2_av_lora.yaml
+```
+
+## Code Standards
+
+### Type Hints
+
+- **Always use type hints** for all function arguments and return values
+- Use Python 3.10+ syntax: `list[str]` not `List[str]`, `str | Path` not `Union[str, Path]`
+- Use `pathlib.Path` for file operations
+
+### Class Methods
+
+- Mark methods as `@staticmethod` if they don't access instance or class state
+- Use `@classmethod` for alternative constructors
+
+### AI/ML Specific
+
+- Use `@torch.inference_mode()` for inference (prefer over `@torch.no_grad()`)
+- Use `accelerator.device` for distributed compatibility
+- Support mixed precision (`bfloat16` via dtype parameters)
+- Use gradient checkpointing for memory-intensive training
+
+### Logging
+
+- Use `from ltx_trainer import logger` for all messages
+- Avoid print statements in production code
+
+## Important Files & Modules
+
+### Configuration (CRITICAL)
+
+**`src/ltx_trainer/config.py`** - Master config definitions
+
+Key classes:
+- `LtxTrainerConfig` - Main configuration container
+- `ModelConfig` - Model paths and training mode
+- `TrainingStrategyConfig` - Union of `TextToVideoConfig` | `VideoToVideoConfig`
+- `LoraConfig` - LoRA hyperparameters
+- `OptimizationConfig` - Learning rate, batch size, etc.
+- `ValidationConfig` - Validation settings
+- `WandbConfig` - W&B logging settings
+
+**⚠️ When modifying config.py:**
+1. Update ALL config files in `configs/`
+2. Update `docs/configuration-reference.md`
+3. Test that all configs remain valid
+
+### Training Core
+
+**`src/ltx_trainer/trainer.py`** - Main training loop
+
+- Implements distributed training with Accelerate
+- Handles mixed precision, gradient accumulation, checkpointing
+- Uses training strategies for mode-specific logic
+
+**`src/ltx_trainer/training_strategies/`** - Strategy pattern
+
+- `base_strategy.py`: `TrainingStrategy` ABC, `ModelInputs` dataclass
+- `text_to_video.py`: Standard text-to-video (with optional audio)
+- `video_to_video.py`: IC-LoRA video-to-video transformations
+
+Key methods each strategy implements:
+- `get_data_sources()` - Required data directories
+- `prepare_training_inputs()` - Convert batch to `ModelInputs`
+- `compute_loss()` - Calculate training loss
+- `requires_audio` property - Whether audio components needed
+
+**`src/ltx_trainer/model_loader.py`** - Model loading
+
+Component loaders:
+- `load_transformer()` → `LTXModel`
+- `load_video_vae_encoder()` → `VideoVAEEncoder`
+- `load_video_vae_decoder()` → `VideoVAEDecoder`
+- `load_audio_vae_decoder()` → `AudioVAEDecoder`
+- `load_vocoder()` → `Vocoder`
+- `load_text_encoder()` → `AVGemmaTextEncoderModel`
+- `load_model()` → `LtxModelComponents` (convenience wrapper)
+
+**`src/ltx_trainer/validation_sampler.py`** - Inference for validation
+
+Uses ltx-core components for denoising:
+- `LTX2Scheduler` for sigma scheduling
+- `EulerDiffusionStep` for diffusion steps
+- `CFGGuider` for classifier-free guidance
+
+### Data
+
+**`src/ltx_trainer/datasets.py`** - Dataset handling
+
+- `PrecomputedDataset` loads pre-computed VAE latents
+- Supports video latents, audio latents, text embeddings, reference latents
+
+## Common Development Tasks
+
+### Adding a New Configuration Parameter
+
+1. Add field to appropriate config class in `src/ltx_trainer/config.py`
+2. Add validator if needed
+3. Update ALL config files in `configs/`
+4. Update `docs/configuration-reference.md`
+
+### Implementing a New Training Strategy
+
+1. Create new file in `src/ltx_trainer/training_strategies/`
+2. Create config class inheriting `TrainingStrategyConfigBase`
+3. Create strategy class inheriting `TrainingStrategy`
+4. Implement: `get_data_sources()`, `prepare_training_inputs()`, `compute_loss()`
+5. Add to `__init__.py`: import, add to `TrainingStrategyConfig` union, update factory
+6. Add discriminator tag to config.py's `TrainingStrategyConfig`
+7. Create example config file in `configs/`
+
+### Working with Modalities
+
+```python
+from dataclasses import replace
+from ltx_core.model.transformer.modality import Modality
+
+# Create modality
+video = Modality(
+ enabled=True,
+ latent=latents,
+ timesteps=timesteps,
+ positions=positions,
+ context=context,
+ context_mask=None,
+)
+
+# Update (immutable - must use replace)
+video = replace(video, latent=new_latent, timesteps=new_timesteps)
+
+# Disable a modality
+audio = replace(audio, enabled=False)
+```
+
+## Debugging Tips
+
+**Training Issues:**
+
+- Check logs first (rich logger provides context)
+- GPU memory: Look for OOM errors, enable `enable_gradient_checkpointing: true`
+- Distributed training: Check `accelerator.state` and device placement
+
+**Model Loading:**
+
+- Ensure `model_path` points to a local `.safetensors` file
+- Ensure `text_encoder_path` points to a Gemma model directory
+- URLs are NOT supported for model paths
+
+**Configuration:**
+
+- Validation errors: Check validators in `config.py`
+- Unknown fields: Config uses `extra="forbid"` - all fields must be defined
+- Strategy validation: IC-LoRA requires `reference_videos` in validation config
+
+## Key Constraints
+
+### LTX-2 Frame Requirements
+
+Frames must satisfy `frames % 8 == 1`:
+- ✅ Valid: 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 121
+- ❌ Invalid: 24, 32, 48, 64, 100
+
+### Resolution Requirements
+
+Width and height must be divisible by 32.
+
+### Model Paths
+
+- Must be local paths (URLs not supported)
+- `model_path`: Path to `.safetensors` checkpoint
+- `text_encoder_path`: Path to Gemma model directory
+
+### Platform Requirements
+
+- Linux required (uses `triton` which is Linux-only)
+- CUDA GPU with 24GB+ VRAM recommended
+
+## Reference: ltx-core Key Components
+
+```
+packages/ltx-core/src/ltx_core/
+├── model/
+│ ├── transformer/
+│ │ ├── model.py # LTXModel
+│ │ ├── modality.py # Modality dataclass
+│ │ └── transformer.py # BasicAVTransformerBlock
+│ ├── video_vae/
+│ │ └── video_vae.py # Encoder, Decoder
+│ ├── audio_vae/
+│ │ ├── audio_vae.py # Decoder
+│ │ └── vocoder.py # Vocoder
+│ └── clip/gemma/
+│ └── encoders/av_encoder.py # AVGemmaTextEncoderModel
+├── pipeline/
+│ ├── components/
+│ │ ├── schedulers.py # LTX2Scheduler
+│ │ ├── diffusion_steps.py # EulerDiffusionStep
+│ │ ├── guiders.py # CFGGuider
+│ │ └── patchifiers.py # VideoLatentPatchifier, AudioPatchifier
+│ └── conditioning/ # VideoLatentTools, AudioLatentTools
+└── loader/
+ ├── single_gpu_model_builder.py # SingleGPUModelBuilder
+ └── sd_ops.py # Key remapping (SDOps)
+```
diff --git a/packages/ltx-trainer/CLAUDE.md b/packages/ltx-trainer/CLAUDE.md
new file mode 120000
index 0000000..47dc3e3
--- /dev/null
+++ b/packages/ltx-trainer/CLAUDE.md
@@ -0,0 +1 @@
+AGENTS.md
\ No newline at end of file
diff --git a/packages/ltx-trainer/README.md b/packages/ltx-trainer/README.md
new file mode 100644
index 0000000..ba672c2
--- /dev/null
+++ b/packages/ltx-trainer/README.md
@@ -0,0 +1,63 @@
+# LTX-2 Trainer
+
+This package provides tools and scripts for training and fine-tuning
+Lightricks' **LTX-2** audio-video generation model. It enables LoRA training, full
+fine-tuning, and training of video-to-video transformations (IC-LoRA) on custom datasets.
+
+---
+
+## 📖 Documentation
+
+All detailed guides and technical documentation are in the [docs](./docs/) directory:
+
+- [⚡ Quick Start Guide](docs/quick-start.md)
+- [🎬 Dataset Preparation](docs/dataset-preparation.md)
+- [🛠️ Training Modes](docs/training-modes.md)
+- [⚙️ Configuration Reference](docs/configuration-reference.md)
+- [🚀 Training Guide](docs/training-guide.md)
+- [🧪 Inference Guide](../ltx-pipelines/README.md)
+- [🔧 Utility Scripts](docs/utility-scripts.md)
+- [📚 LTX-Core Documentation](../ltx-core/README.md)
+- [🛡️ Troubleshooting Guide](docs/troubleshooting.md)
+
+---
+
+## 🔧 Requirements
+
+- **LTX-2 Model Checkpoint** - Local `.safetensors` file
+- **Gemma Text Encoder** - Local Gemma model directory (required for LTX-2)
+- **Linux with CUDA** - CUDA 13+ recommended for optimal performance
+- **Nvidia GPU with 80GB+ VRAM** - Is highly recommended; lower VRAM may work with gradient checkpointing and lower
+ resolutions
+
+---
+
+## 🤝 Contributing
+
+We welcome contributions from the community! Here's how you can help:
+
+- **Share Your Work**: If you've trained interesting LoRAs or achieved cool results, please share them with the
+ community.
+- **Report Issues**: Found a bug or have a suggestion? Open an issue on GitHub.
+- **Submit PRs**: Help improve the codebase with bug fixes or general improvements.
+- **Feature Requests**: Have ideas for new features? Let us know through GitHub issues.
+
+---
+
+## 💬 Join the Community
+
+Have questions, want to share your results, or need real-time help?
+
+Join our [community Discord server](https://discord.gg/ltxplatform) to connect with other users and the development
+team!
+
+- Get troubleshooting help
+- Share your training results and workflows
+- Collaborate on new ideas and features
+- Stay up to date with announcements and updates
+
+We look forward to seeing you there!
+
+---
+
+Happy training! 🎉
diff --git a/packages/ltx-trainer/configs/accelerate/ddp.yaml b/packages/ltx-trainer/configs/accelerate/ddp.yaml
new file mode 100644
index 0000000..2edb132
--- /dev/null
+++ b/packages/ltx-trainer/configs/accelerate/ddp.yaml
@@ -0,0 +1,16 @@
+compute_environment: LOCAL_MACHINE
+debug: false
+distributed_type: MULTI_GPU
+downcast_bf16: 'no'
+enable_cpu_affinity: false
+machine_rank: 0
+main_training_function: main
+mixed_precision: bf16
+num_machines: 1
+num_processes: 4
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
diff --git a/packages/ltx-trainer/configs/accelerate/ddp_compile.yaml b/packages/ltx-trainer/configs/accelerate/ddp_compile.yaml
new file mode 100644
index 0000000..9398f94
--- /dev/null
+++ b/packages/ltx-trainer/configs/accelerate/ddp_compile.yaml
@@ -0,0 +1,21 @@
+compute_environment: LOCAL_MACHINE
+dynamo_config:
+ dynamo_backend: INDUCTOR
+ dynamo_mode: default
+ dynamo_use_fullgraph: false
+ dynamo_use_dynamic: true
+debug: false
+distributed_type: MULTI_GPU
+downcast_bf16: 'no'
+enable_cpu_affinity: false
+machine_rank: 0
+main_training_function: main
+mixed_precision: bf16
+num_machines: 1
+num_processes: 4
+rdzv_backend: static
+same_network: true
+tpu_env: [ ]
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
diff --git a/packages/ltx-trainer/configs/accelerate/fsdp.yaml b/packages/ltx-trainer/configs/accelerate/fsdp.yaml
new file mode 100644
index 0000000..6a8b002
--- /dev/null
+++ b/packages/ltx-trainer/configs/accelerate/fsdp.yaml
@@ -0,0 +1,29 @@
+compute_environment: LOCAL_MACHINE
+debug: false
+distributed_type: FSDP
+downcast_bf16: 'no'
+enable_cpu_affinity: false
+fsdp_config:
+ fsdp_activation_checkpointing: false
+ fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
+ fsdp_backward_prefetch: BACKWARD_PRE
+ fsdp_cpu_ram_efficient_loading: true
+ fsdp_forward_prefetch: false
+ fsdp_offload_params: false
+ fsdp_reshard_after_forward: FULL_SHARD
+ fsdp_state_dict_type: SHARDED_STATE_DICT
+ fsdp_sync_module_states: true
+ fsdp_transformer_layer_cls_to_wrap: BasicAVTransformerBlock
+ fsdp_use_orig_params: true
+ fsdp_version: 1
+machine_rank: 0
+main_training_function: main
+mixed_precision: bf16
+num_machines: 1
+num_processes: 4
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
diff --git a/packages/ltx-trainer/configs/accelerate/fsdp_compile.yaml b/packages/ltx-trainer/configs/accelerate/fsdp_compile.yaml
new file mode 100644
index 0000000..a6b7089
--- /dev/null
+++ b/packages/ltx-trainer/configs/accelerate/fsdp_compile.yaml
@@ -0,0 +1,34 @@
+compute_environment: LOCAL_MACHINE
+debug: false
+distributed_type: FSDP
+downcast_bf16: 'no'
+dynamo_config:
+ dynamo_backend: INDUCTOR
+ dynamo_mode: default
+ dynamo_use_fullgraph: false
+ dynamo_use_dynamic: true
+enable_cpu_affinity: false
+fsdp_config:
+ fsdp_activation_checkpointing: false
+ fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP
+ fsdp_backward_prefetch: BACKWARD_PRE
+ fsdp_cpu_ram_efficient_loading: true
+ fsdp_forward_prefetch: false
+ fsdp_offload_params: false
+ fsdp_reshard_after_forward: FULL_SHARD
+ fsdp_state_dict_type: SHARDED_STATE_DICT
+ fsdp_sync_module_states: true
+ fsdp_transformer_layer_cls_to_wrap: BasicAVTransformerBlock
+ fsdp_use_orig_params: true
+ fsdp_version: 1
+machine_rank: 0
+main_training_function: main
+mixed_precision: bf16
+num_machines: 1
+num_processes: 4
+rdzv_backend: static
+same_network: true
+tpu_env: []
+tpu_use_cluster: false
+tpu_use_sudo: false
+use_cpu: false
diff --git a/packages/ltx-trainer/configs/ltx2_av_lora.yaml b/packages/ltx-trainer/configs/ltx2_av_lora.yaml
new file mode 100644
index 0000000..8cf917d
--- /dev/null
+++ b/packages/ltx-trainer/configs/ltx2_av_lora.yaml
@@ -0,0 +1,309 @@
+# =============================================================================
+# LTX-2 Audio-Video LoRA Training Configuration
+# =============================================================================
+#
+# This configuration is for training LoRA adapters on the LTX-2 model for
+# text-to-video generation. It supports both video-only and joint audio-video
+# training modes.
+#
+# Use this configuration when you want to:
+# - Fine-tune LTX-2 on your own video dataset
+# - Train with or without audio generation
+# - Create custom video generation styles or audiovisual concepts
+#
+# Dataset structure for text-to-video training:
+# preprocessed_data_root/
+# ├── latents/ # Video latents (VAE-encoded videos)
+# ├── conditions/ # Text embeddings for each video
+# └── audio_latents/ # Audio latents (only if with_audio: true)
+#
+# =============================================================================
+
+# -----------------------------------------------------------------------------
+# Model Configuration
+# -----------------------------------------------------------------------------
+# Specifies the base model to fine-tune and the training mode.
+model:
+ # Path to the LTX-2 model checkpoint (.safetensors file)
+ # This should be a local path to your downloaded model
+ model_path: "path/to/ltx-2-model.safetensors"
+
+ # Path to the text encoder model directory
+ # For LTX-2, this is typically the Gemma-based text encoder
+ text_encoder_path: "path/to/gemma-text-encoder"
+
+ # Training mode: "lora" for efficient adapter training, "full" for full fine-tuning
+ # LoRA is recommended for most use cases (faster, less memory, prevents overfitting)
+ training_mode: "lora"
+
+ # Optional: Path to resume training from a checkpoint
+ # Can be a checkpoint file (.safetensors) or directory (uses latest checkpoint)
+ load_checkpoint: null
+
+# -----------------------------------------------------------------------------
+# LoRA Configuration
+# -----------------------------------------------------------------------------
+# Controls the Low-Rank Adaptation parameters for efficient fine-tuning.
+lora:
+ # Rank of the LoRA matrices (higher = more capacity but more parameters)
+ # Typical values: 8, 16, 32, 64. Start with 32 for general fine-tuning.
+ rank: 32
+
+ # Alpha scaling factor (usually set equal to rank)
+ # The effective scaling is alpha/rank, so alpha=rank means scaling of 1.0
+ alpha: 32
+
+ # Dropout probability for LoRA layers (0.0 = no dropout)
+ # Can help with regularization if overfitting occurs
+ dropout: 0.0
+
+ # Which transformer modules to apply LoRA to
+ # The LTX-2 transformer has separate attention and FFN blocks for video and audio:
+ #
+ # VIDEO MODULES:
+ # - attn1.to_k, attn1.to_q, attn1.to_v, attn1.to_out.0 (video self-attention)
+ # - attn2.to_k, attn2.to_q, attn2.to_v, attn2.to_out.0 (video cross-attention to text)
+ # - ff.net.0.proj, ff.net.2 (video feed-forward)
+ #
+ # AUDIO MODULES:
+ # - audio_attn1.to_k, audio_attn1.to_q, audio_attn1.to_v, audio_attn1.to_out.0 (audio self-attention)
+ # - audio_attn2.to_k, audio_attn2.to_q, audio_attn2.to_v, audio_attn2.to_out.0 (audio cross-attention to text)
+ # - audio_ff.net.0.proj, audio_ff.net.2 (audio feed-forward)
+ #
+ # AUDIO-VIDEO CROSS-ATTENTION MODULES (for cross-modal interaction):
+ # - audio_to_video_attn.to_k, audio_to_video_attn.to_q, audio_to_video_attn.to_v, audio_to_video_attn.to_out.0
+ # (Q from video, K/V from audio - allows video to attend to audio features)
+ # - video_to_audio_attn.to_k, video_to_audio_attn.to_q, video_to_audio_attn.to_v, video_to_audio_attn.to_out.0
+ # (Q from audio, K/V from video - allows audio to attend to video features)
+ #
+ # Using short patterns like "to_k" matches ALL attention modules (video, audio, and cross-modal).
+ # For audio-video training, this is the recommended approach.
+ target_modules:
+ # Attention layers (matches both video and audio branches)
+ - "to_k"
+ - "to_q"
+ - "to_v"
+ - "to_out.0"
+ # Uncomment below to also train feed-forward layers (can increase the LoRA's capacity):
+ # - "ff.net.0.proj"
+ # - "ff.net.2"
+ # - "audio_ff.net.0.proj"
+ # - "audio_ff.net.2"
+
+# -----------------------------------------------------------------------------
+# Training Strategy Configuration
+# -----------------------------------------------------------------------------
+# Defines the text-to-video training approach.
+training_strategy:
+ # Strategy name: "text_to_video" for standard text-to-video training
+ name: "text_to_video"
+
+ # Probability of conditioning on the first frame during training
+ # Higher values train the model to perform better in image-to-video (I2V) mode,
+ # where a clean first frame is provided and the model generates the rest of the video
+ # Increase this value to train the model to perform better in image-to-video (I2V) mode
+ first_frame_conditioning_p: 0.5
+
+ # Enable joint audio-video training
+ # Set to true if your dataset includes audio and you want to train the audio branch
+ with_audio: true
+
+ # Directory name (within preprocessed_data_root) containing audio latents
+ # Only used when with_audio is true
+ audio_latents_dir: "audio_latents"
+
+# -----------------------------------------------------------------------------
+# Optimization Configuration
+# -----------------------------------------------------------------------------
+# Controls the training optimization parameters.
+optimization:
+ # Learning rate for the optimizer
+ # Typical range for LoRA: 1e-5 to 1e-4
+ learning_rate: 1e-4
+
+ # Total number of training steps
+ steps: 2000
+
+ # Batch size per GPU
+ # Reduce if running out of memory
+ batch_size: 1
+
+ # Number of gradient accumulation steps
+ # Effective batch size = batch_size * gradient_accumulation_steps * num_gpus
+ gradient_accumulation_steps: 1
+
+ # Maximum gradient norm for clipping (helps training stability)
+ max_grad_norm: 1.0
+
+ # Optimizer type: "adamw" (standard) or "adamw8bit" (memory-efficient)
+ optimizer_type: "adamw"
+
+ # Learning rate scheduler type
+ # Options: "constant", "linear", "cosine", "cosine_with_restarts", "polynomial"
+ scheduler_type: "linear"
+
+ # Additional scheduler parameters (depends on scheduler_type)
+ scheduler_params: { }
+
+ # Enable gradient checkpointing to reduce memory usage
+ # Recommended for training with limited GPU memory
+ enable_gradient_checkpointing: true
+
+# -----------------------------------------------------------------------------
+# Acceleration Configuration
+# -----------------------------------------------------------------------------
+# Hardware acceleration and memory optimization settings.
+acceleration:
+ # Mixed precision training mode
+ # Options: "no" (fp32), "fp16" (half precision), "bf16" (bfloat16, recommended)
+ mixed_precision_mode: "bf16"
+
+ # Model quantization for reduced memory usage
+ # Options: null (none), "int8-quanto", "int4-quanto", "int2-quanto", "fp8-quanto", "fp8uz-quanto"
+ quantization: null
+
+ # Load text encoder in 8-bit precision to save memory
+ # Useful when GPU memory is limited
+ load_text_encoder_in_8bit: false
+
+# -----------------------------------------------------------------------------
+# Data Configuration
+# -----------------------------------------------------------------------------
+# Specifies the training data location and loading parameters.
+data:
+ # Root directory containing preprocessed training data
+ # Should contain: latents/, conditions/, and optionally audio_latents/
+ preprocessed_data_root: "/path/to/preprocessed/data"
+
+ # Number of worker processes for data loading
+ # Used for parallel data loading to speed up data loading
+ num_dataloader_workers: 2
+
+# -----------------------------------------------------------------------------
+# Validation Configuration
+# -----------------------------------------------------------------------------
+# Controls validation video generation during training.
+# NOTE: Validation sampling use simplified inference pipelines and prioritizes speed over
+# maximum quality. For production-quality inference, use `packages/ltx-pipelines`.
+validation:
+ # Text prompts for validation video generation
+ # Provide prompts representative of your training data
+ # LTX-2 prefers longer, detailed prompts that describe both visual content and audio
+ prompts:
+ - "A woman with long brown hair sits at a wooden desk in a cozy home office, typing on a laptop while occasionally glancing at notes beside her. Soft natural light streams through a large window, casting warm shadows across the room. She pauses to take a sip from a ceramic mug, then continues working with focused concentration. The audio captures the gentle clicking of keyboard keys, the soft rustle of papers, and ambient room tone with occasional distant bird chirps from outside."
+ - "A chef in a white uniform stands in a professional kitchen, carefully plating a gourmet dish with precise movements. Steam rises from freshly cooked vegetables as he arranges them with tweezers. The stainless steel surfaces gleam under bright overhead lights, and various pots simmer on the stove behind him. The audio features the sizzling of pans, the clinking of utensils against plates, and the ambient hum of kitchen ventilation."
+
+ # Negative prompt to avoid unwanted artifacts
+ negative_prompt: "worst quality, inconsistent motion, blurry, jittery, distorted"
+
+ # Optional: First frame images for image-to-video validation
+ # If provided, must have one image per prompt
+ images: null
+
+ # Output video dimensions [width, height, frames]
+ # Width and height must be divisible by 32
+ # Frames must satisfy: frames % 8 == 1 (e.g., 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, ...)
+ video_dims: [ 576, 576, 89 ]
+
+ # Frame rate for generated videos
+ frame_rate: 25.0
+
+ # Random seed for reproducible validation outputs
+ seed: 42
+
+ # Number of denoising steps for validation inference
+ # Higher values = better quality but slower generation
+ inference_steps: 30
+
+ # Generate validation videos every N training steps
+ # Set to null to disable validation during training
+ interval: 100
+
+ # Number of videos to generate per prompt
+ videos_per_prompt: 1
+
+ # Classifier-free guidance scale
+ # Higher values = stronger adherence to prompt but may introduce artifacts
+ guidance_scale: 4.0
+
+ # STG (Spatio-Temporal Guidance) parameters for improved video quality
+ # STG is combined with CFG for better temporal coherence
+ stg_scale: 1.0 # Recommended: 1.0 (0.0 disables STG)
+ stg_blocks: [29] # Recommended: single block 29
+ stg_mode: "stg_av" # "stg_av" perturbs both audio and video, "stg_v" video only
+
+ # Whether to generate audio in validation samples
+ # Independent of training_strategy.with_audio - you can generate audio
+ # in validation even when not training the audio branch
+ generate_audio: true
+
+ # Skip validation at the beginning of training (step 0)
+ skip_initial_validation: false
+
+# -----------------------------------------------------------------------------
+# Checkpoint Configuration
+# -----------------------------------------------------------------------------
+# Controls model checkpoint saving during training.
+checkpoints:
+ # Save a checkpoint every N steps
+ # Set to null to disable intermediate checkpoints
+ interval: 250
+
+ # Number of most recent checkpoints to keep
+ # Set to -1 to keep all checkpoints
+ keep_last_n: -1
+
+# -----------------------------------------------------------------------------
+# Flow Matching Configuration
+# -----------------------------------------------------------------------------
+# Parameters for the flow matching training objective.
+flow_matching:
+ # Timestep sampling mode
+ # "shifted_logit_normal" is recommended for LTX-2 models
+ timestep_sampling_mode: "shifted_logit_normal"
+
+ # Additional parameters for timestep sampling
+ timestep_sampling_params: { }
+
+# -----------------------------------------------------------------------------
+# Hugging Face Hub Configuration
+# -----------------------------------------------------------------------------
+# Settings for uploading trained models to the Hugging Face Hub.
+hub:
+ # Whether to push the trained model to the Hub
+ push_to_hub: false
+
+ # Repository ID on Hugging Face Hub (e.g., "username/my-lora-model")
+ # Required if push_to_hub is true
+ hub_model_id: null
+
+# -----------------------------------------------------------------------------
+# Weights & Biases Configuration
+# -----------------------------------------------------------------------------
+# Settings for experiment tracking with W&B.
+wandb:
+ # Enable W&B logging
+ enabled: false
+
+ # W&B project name
+ project: "ltx-2-trainer"
+
+ # W&B username or team (null uses default account)
+ entity: null
+
+ # Tags to help organize runs
+ tags: [ "ltx2", "lora" ]
+
+ # Log validation videos to W&B
+ log_validation_videos: true
+
+# -----------------------------------------------------------------------------
+# General Configuration
+# -----------------------------------------------------------------------------
+# Global settings for the training run.
+
+# Random seed for reproducibility
+seed: 42
+
+# Directory to save outputs (checkpoints, validation videos, logs)
+output_dir: "outputs/ltx2_av_lora"
diff --git a/packages/ltx-trainer/configs/ltx2_v2v_ic_lora.yaml b/packages/ltx-trainer/configs/ltx2_v2v_ic_lora.yaml
new file mode 100644
index 0000000..166b1ec
--- /dev/null
+++ b/packages/ltx-trainer/configs/ltx2_v2v_ic_lora.yaml
@@ -0,0 +1,319 @@
+# =============================================================================
+# LTX-2 Video-to-Video (IC-LoRA) Training Configuration
+# =============================================================================
+#
+# This configuration is for training In-Context LoRA (IC-LoRA) adapters that
+# enable video-to-video transformations. IC-LoRA learns to apply visual
+# transformations (e.g., depth-to-video, pose control, style transfer, etc.)
+# by conditioning on reference videos.
+#
+# Key differences from text-to-video LoRA:
+# - Uses reference videos as conditioning input alongside text prompts
+# - Requires preprocessed reference latents in addition to target latents
+# - Validation requires reference videos to demonstrate the transformation
+#
+# Dataset structure for IC-LoRA training:
+# preprocessed_data_root/
+# ├── latents/ # Target video latents (what the model learns to generate)
+# ├── conditions/ # Text embeddings for each video
+# └── reference_latents/ # Reference video latents (conditioning input)
+#
+# =============================================================================
+
+# -----------------------------------------------------------------------------
+# Model Configuration
+# -----------------------------------------------------------------------------
+# Specifies the base model to fine-tune and the training mode.
+model:
+ # Path to the LTX-2 model checkpoint (.safetensors file)
+ # This should be a local path to your downloaded model
+ model_path: "path/to/ltx-2-model.safetensors"
+
+ # Path to the text encoder model directory
+ # For LTX-2, this is typically the Gemma-based text encoder
+ text_encoder_path: "path/to/gemma-text-encoder"
+
+ # Training mode: "lora" for efficient adapter training, "full" for full fine-tuning
+ # Note: video_to_video strategy requires "lora" mode
+ training_mode: "lora"
+
+ # Optional: Path to resume training from a checkpoint
+ # Can be a checkpoint file (.safetensors) or directory (uses latest checkpoint)
+ load_checkpoint: null
+
+# -----------------------------------------------------------------------------
+# LoRA Configuration
+# -----------------------------------------------------------------------------
+# Controls the Low-Rank Adaptation parameters for efficient fine-tuning.
+lora:
+ # Rank of the LoRA matrices (higher = more capacity but more parameters)
+ # Typical values: 8, 16, 32, 64. Start with 16-32 for IC-LoRA.
+ rank: 32
+
+ # Alpha scaling factor (usually set equal to rank)
+ # The effective scaling is alpha/rank, so alpha=rank means scaling of 1.0
+ alpha: 32
+
+ # Dropout probability for LoRA layers (0.0 = no dropout)
+ # Can help with regularization if overfitting occurs
+ dropout: 0.0
+
+ # Which transformer modules to apply LoRA to
+ # The LTX-2 transformer has separate attention and FFN blocks for video and audio:
+ #
+ # VIDEO MODULES:
+ # - attn1.to_k, attn1.to_q, attn1.to_v, attn1.to_out.0 (video self-attention)
+ # - attn2.to_k, attn2.to_q, attn2.to_v, attn2.to_out.0 (video cross-attention to text)
+ # - ff.net.0.proj, ff.net.2 (video feed-forward)
+ #
+ # AUDIO MODULES (not used for video-only IC-LoRA):
+ # - audio_attn1.to_k, audio_attn1.to_q, audio_attn1.to_v, audio_attn1.to_out.0 (audio self-attention)
+ # - audio_attn2.to_k, audio_attn2.to_q, audio_attn2.to_v, audio_attn2.to_out.0 (audio cross-attention to text)
+ # - audio_ff.net.0.proj, audio_ff.net.2 (audio feed-forward)
+ #
+ # AUDIO-VIDEO CROSS-ATTENTION MODULES (for cross-modal interaction, not used for video-only IC-LoRA):
+ # - audio_to_video_attn.to_k, audio_to_video_attn.to_q, audio_to_video_attn.to_v, audio_to_video_attn.to_out.0
+ # (Q from video, K/V from audio - allows video to attend to audio features)
+ # - video_to_audio_attn.to_k, video_to_audio_attn.to_q, video_to_audio_attn.to_v, video_to_audio_attn.to_out.0
+ # (Q from audio, K/V from video - allows audio to attend to video features)
+ #
+ # For IC-LoRA (video-only), we explicitly target video modules.
+ # Including FFN layers often improves transformation quality.
+ target_modules:
+ # Video self-attention
+ - "attn1.to_k"
+ - "attn1.to_q"
+ - "attn1.to_v"
+ - "attn1.to_out.0"
+ # Video cross-attention
+ - "attn2.to_k"
+ - "attn2.to_q"
+ - "attn2.to_v"
+ - "attn2.to_out.0"
+ # Video feed-forward (often improves transformation quality)
+ - "ff.net.0.proj"
+ - "ff.net.2"
+
+# -----------------------------------------------------------------------------
+# Training Strategy Configuration
+# -----------------------------------------------------------------------------
+# Defines the video-to-video (IC-LoRA) training approach.
+training_strategy:
+ # Strategy name: "video_to_video" for IC-LoRA training
+ name: "video_to_video"
+
+ # Probability of conditioning on the first frame during training
+ # Higher values train the model to perform better in image-to-video (I2V) mode,
+ # where a clean first frame is provided and the model generates the rest of the video
+ # Increase this value to train the model to perform better in image-to-video (I2V) mode
+ first_frame_conditioning_p: 0.2
+
+ # Directory name (within preprocessed_data_root) containing reference video latents
+ # These are the conditioning inputs that guide the transformation
+ reference_latents_dir: "reference_latents"
+
+# -----------------------------------------------------------------------------
+# Optimization Configuration
+# -----------------------------------------------------------------------------
+# Controls the training optimization parameters.
+optimization:
+ # Learning rate for the optimizer
+ # Typical range for LoRA: 1e-5 to 1e-4
+ learning_rate: 2e-4
+
+ # Total number of training steps
+ steps: 3000
+
+ # Batch size per GPU
+ # Reduce if running out of memory
+ batch_size: 1
+
+ # Number of gradient accumulation steps
+ # Effective batch size = batch_size * gradient_accumulation_steps * num_gpus
+ gradient_accumulation_steps: 1
+
+ # Maximum gradient norm for clipping (helps training stability)
+ max_grad_norm: 1.0
+
+ # Optimizer type: "adamw" (standard) or "adamw8bit" (memory-efficient)
+ optimizer_type: "adamw"
+
+ # Learning rate scheduler type
+ # Options: "constant", "linear", "cosine", "cosine_with_restarts", "polynomial"
+ scheduler_type: "linear"
+
+ # Additional scheduler parameters (depends on scheduler_type)
+ scheduler_params: { }
+
+ # Enable gradient checkpointing to reduce memory usage
+ # Recommended for training with limited GPU memory
+ enable_gradient_checkpointing: true
+
+# -----------------------------------------------------------------------------
+# Acceleration Configuration
+# -----------------------------------------------------------------------------
+# Hardware acceleration and memory optimization settings.
+acceleration:
+ # Mixed precision training mode
+ # Options: "no" (fp32), "fp16" (half precision), "bf16" (bfloat16, recommended)
+ mixed_precision_mode: "bf16"
+
+ # Model quantization for reduced memory usage
+ # Options: null (none), "int8-quanto", "int4-quanto", "int2-quanto", "fp8-quanto", "fp8uz-quanto"
+ quantization: null
+
+ # Load text encoder in 8-bit precision to save memory
+ # Useful when GPU memory is limited
+ load_text_encoder_in_8bit: false
+
+# -----------------------------------------------------------------------------
+# Data Configuration
+# -----------------------------------------------------------------------------
+# Specifies the training data location and loading parameters.
+data:
+ # Root directory containing preprocessed training data
+ # Should contain: latents/, conditions/, and reference_latents/ subdirectories
+ preprocessed_data_root: "/path/to/preprocessed/data"
+
+ # Number of worker processes for data loading
+ # Used for parallel data loading to speed up data loading
+ num_dataloader_workers: 2
+
+# -----------------------------------------------------------------------------
+# Validation Configuration
+# -----------------------------------------------------------------------------
+# Controls validation video generation during training.
+# NOTE: Validation sampling use simplified inference pipelines and prioritizes speed over
+# maximum quality. For production-quality inference, use `packages/ltx-pipelines`.
+validation:
+ # Text prompts for validation video generation
+ # Provide prompts representative of your training data
+ # LTX-2 prefers longer, detailed prompts that describe both visual content and audio
+ prompts:
+ - "A man in a casual blue jacket walks along a winding path through a lush green park on a bright sunny afternoon. Tall oak trees line the pathway, their leaves rustling gently in the breeze. Dappled sunlight creates shifting patterns on the ground as he strolls at a relaxed pace, occasionally looking up at the scenery around him. The audio captures footsteps on gravel, birds singing in the trees, distant children playing, and the soft whisper of wind through the foliage."
+ - "A fluffy orange tabby cat sits perfectly still on a wooden windowsill, its green eyes intently tracking small birds hopping on a branch just outside the glass. The cat's ears twitch and rotate, following every movement. Warm afternoon light illuminates its fur, creating a soft golden glow. Behind the cat, a cozy living room with a bookshelf and houseplants is visible. The audio features gentle purring, occasional soft meows, muffled bird chirps through the window, and quiet ambient room sounds."
+
+ # Reference videos for validation (REQUIRED for video_to_video strategy)
+ # Must provide one reference video per prompt
+ # These are the conditioning inputs for generating validation outputs
+ reference_videos:
+ - "/path/to/reference_video_1.mp4"
+ - "/path/to/reference_video_2.mp4"
+
+ # Negative prompt to avoid unwanted artifacts
+ negative_prompt: "worst quality, inconsistent motion, blurry, jittery, distorted"
+
+ # Optional: First frame images for additional conditioning
+ # If provided, must have one image per prompt
+ images: null
+
+ # Output video dimensions [width, height, frames]
+ # Width and height must be divisible by 32
+ # Frames must satisfy: frames % 8 == 1 (e.g., 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, ...)
+ video_dims: [ 512, 512, 81 ]
+
+ # Frame rate for generated videos
+ frame_rate: 25.0
+
+ # Random seed for reproducible validation outputs
+ seed: 42
+
+ # Number of denoising steps for validation inference
+ # Higher values = better quality but slower generation
+ inference_steps: 30
+
+ # Generate validation videos every N training steps
+ # Set to null to disable validation during training
+ interval: 100
+
+ # Number of videos to generate per prompt
+ videos_per_prompt: 1
+
+ # Classifier-free guidance scale
+ # Higher values = stronger adherence to prompt but may introduce artifacts
+ guidance_scale: 4.0
+
+ # STG (Spatio-Temporal Guidance) parameters for improved video quality
+ # STG is combined with CFG for better temporal coherence
+ stg_scale: 1.0 # Recommended: 1.0 (0.0 disables STG)
+ stg_blocks: [29] # Recommended: single block 29
+ stg_mode: "stg_v" # "stg_v" for video-only (no audio training)
+
+ # Whether to generate audio in validation samples
+ # Can be enabled even when not training the audio branch
+ generate_audio: false
+
+ # Skip validation at the beginning of training (step 0)
+ skip_initial_validation: false
+
+ # Concatenate reference video side-by-side with generated output
+ # Useful for visually comparing the transformation quality
+ include_reference_in_output: true
+
+# -----------------------------------------------------------------------------
+# Checkpoint Configuration
+# -----------------------------------------------------------------------------
+# Controls model checkpoint saving during training.
+checkpoints:
+ # Save a checkpoint every N steps
+ # Set to null to disable intermediate checkpoints
+ interval: 250
+
+ # Number of most recent checkpoints to keep
+ # Set to -1 to keep all checkpoints
+ keep_last_n: 3
+
+# -----------------------------------------------------------------------------
+# Flow Matching Configuration
+# -----------------------------------------------------------------------------
+# Parameters for the flow matching training objective.
+flow_matching:
+ # Timestep sampling mode
+ # "shifted_logit_normal" is recommended for LTX-2 models
+ timestep_sampling_mode: "shifted_logit_normal"
+
+ # Additional parameters for timestep sampling
+ timestep_sampling_params: { }
+
+# -----------------------------------------------------------------------------
+# Hugging Face Hub Configuration
+# -----------------------------------------------------------------------------
+# Settings for uploading trained models to the Hugging Face Hub.
+hub:
+ # Whether to push the trained model to the Hub
+ push_to_hub: false
+
+ # Repository ID on Hugging Face Hub (e.g., "username/my-ic-lora-model")
+ # Required if push_to_hub is true
+ hub_model_id: null
+
+# -----------------------------------------------------------------------------
+# Weights & Biases Configuration
+# -----------------------------------------------------------------------------
+# Settings for experiment tracking with W&B.
+wandb:
+ # Enable W&B logging
+ enabled: false
+
+ # W&B project name
+ project: "ltx-2-trainer"
+
+ # W&B username or team (null uses default account)
+ entity: null
+
+ # Tags to help organize runs
+ tags: [ "ltx2", "ic-lora", "video-to-video" ]
+
+ # Log validation videos to W&B
+ log_validation_videos: true
+
+# -----------------------------------------------------------------------------
+# General Configuration
+# -----------------------------------------------------------------------------
+# Global settings for the training run.
+
+# Random seed for reproducibility
+seed: 42
+
+# Directory to save outputs (checkpoints, validation videos, logs)
+output_dir: "outputs/ltx2_v2v_ic_lora"
diff --git a/packages/ltx-trainer/docs/configuration-reference.md b/packages/ltx-trainer/docs/configuration-reference.md
new file mode 100644
index 0000000..363d0ec
--- /dev/null
+++ b/packages/ltx-trainer/docs/configuration-reference.md
@@ -0,0 +1,368 @@
+# Configuration Reference
+
+The trainer uses structured Pydantic models for configuration, making it easy to customize training parameters.
+This guide covers all available configuration options and their usage.
+
+## 📋 Overview
+
+The main configuration class is [`LtxTrainerConfig`](../src/ltx_trainer/config.py), which includes the following
+sub-configurations:
+
+- **ModelConfig**: Base model and training mode settings
+- **LoraConfig**: LoRA training parameters
+- **TrainingStrategyConfig**: Training strategy settings (text-to-video or video-to-video)
+- **OptimizationConfig**: Learning rate, batch sizes, and scheduler settings
+- **AccelerationConfig**: Mixed precision and quantization settings
+- **DataConfig**: Data loading parameters
+- **ValidationConfig**: Validation and inference settings
+- **CheckpointsConfig**: Checkpoint saving frequency and retention settings
+- **HubConfig**: Hugging Face Hub integration settings
+- **WandbConfig**: Weights & Biases logging settings
+- **FlowMatchingConfig**: Timestep sampling parameters
+
+## 📄 Example Configuration Files
+
+Check out our example configurations in the `configs` directory:
+
+- 📄 [Audio-Video LoRA Training](../configs/ltx2_av_lora.yaml) - Joint audio-video to generation training
+- 📄 [IC-LoRA Training](../configs/ltx2_v2v_ic_lora.yaml) - Video-to-video transformation training
+
+## ⚙️ Configuration Sections
+
+### ModelConfig
+
+Controls the base model and training mode settings.
+
+```yaml
+model:
+ model_path: "/path/to/ltx-2-model.safetensors" # Local path to model checkpoint
+ text_encoder_path: "/path/to/gemma-model" # Path to Gemma text encoder directory
+ training_mode: "lora" # "lora" or "full"
+ load_checkpoint: null # Path to checkpoint to resume from
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|---------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `model_path` | **Required.** Local path to the LTX-2 model checkpoint (`.safetensors` file). URLs are not supported. |
+| `text_encoder_path` | **Required.** Path to the Gemma text encoder model directory. Download from [HuggingFace](https://huggingface.co/google/gemma-3-12b-it-qat-q4_0-unquantized/). |
+| `training_mode` | Training approach - `"lora"` for LoRA training or `"full"` for full-rank fine-tuning. |
+| `load_checkpoint` | Optional path to resume training from a checkpoint file or directory. |
+
+> [!NOTE]
+> LTX-2 requires both a model checkpoint and a Gemma text encoder. Both must be local paths.
+
+### LoraConfig
+
+LoRA-specific fine-tuning parameters (only used when `training_mode: "lora"`).
+
+```yaml
+lora:
+ rank: 32 # LoRA rank (higher = more parameters)
+ alpha: 32 # LoRA alpha scaling factor
+ dropout: 0.0 # Dropout probability (0.0-1.0)
+ target_modules: # Modules to apply LoRA to
+ - "to_k"
+ - "to_q"
+ - "to_v"
+ - "to_out.0"
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|------------------|---------------------------------------------------------------------------------|
+| `rank` | LoRA rank - higher values mean more trainable parameters (typical range: 8-128) |
+| `alpha` | Alpha scaling factor - typically set equal to rank |
+| `dropout` | Dropout probability for regularization |
+| `target_modules` | List of transformer modules to apply LoRA adapters to (see below) |
+
+#### Understanding Target Modules
+
+The LTX-2 transformer has separate attention and feed-forward blocks for video and audio, as well as cross-attention
+modules that enable the two modalities to exchange information. Choosing the right `target_modules` is critical for
+achieving good results, especially when training with audio.
+
+**Video-only modules:**
+
+| Module Pattern | Description |
+|------------------------------------------------------------|---------------------------------|
+| `attn1.to_k`, `attn1.to_q`, `attn1.to_v`, `attn1.to_out.0` | Video self-attention |
+| `attn2.to_k`, `attn2.to_q`, `attn2.to_v`, `attn2.to_out.0` | Video cross-attention (to text) |
+| `ff.net.0.proj`, `ff.net.2` | Video feed-forward network |
+
+**Audio-only modules:**
+
+| Module Pattern | Description |
+|------------------------------------------------------------------------------------|---------------------------------|
+| `audio_attn1.to_k`, `audio_attn1.to_q`, `audio_attn1.to_v`, `audio_attn1.to_out.0` | Audio self-attention |
+| `audio_attn2.to_k`, `audio_attn2.to_q`, `audio_attn2.to_v`, `audio_attn2.to_out.0` | Audio cross-attention (to text) |
+| `audio_ff.net.0.proj`, `audio_ff.net.2` | Audio feed-forward network |
+
+**Audio-video cross-attention modules:**
+
+These modules enable bidirectional information flow between the audio and video modalities:
+
+| Module Pattern | Description |
+|--------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------|
+| `audio_to_video_attn.to_k`, `audio_to_video_attn.to_q`, `audio_to_video_attn.to_v`, `audio_to_video_attn.to_out.0` | Video attends to audio (Q from video, K/V from audio) |
+| `video_to_audio_attn.to_k`, `video_to_audio_attn.to_q`, `video_to_audio_attn.to_v`, `video_to_audio_attn.to_out.0` | Audio attends to video (Q from audio, K/V from video) |
+
+**Recommended configurations:**
+
+For **video-only training**, target the video attention layers:
+
+```yaml
+target_modules:
+ - "attn1.to_k"
+ - "attn1.to_q"
+ - "attn1.to_v"
+ - "attn1.to_out.0"
+ - "attn2.to_k"
+ - "attn2.to_q"
+ - "attn2.to_v"
+ - "attn2.to_out.0"
+```
+
+For **audio-video training**, use patterns that match both branches:
+
+```yaml
+target_modules:
+ - "to_k"
+ - "to_q"
+ - "to_v"
+ - "to_out.0"
+```
+
+> [!NOTE]
+> Using shorter patterns like `"to_k"` will match all attention modules including `attn1.to_k`, `audio_attn1.to_k`,
+> `audio_to_video_attn.to_k`, and `video_to_audio_attn.to_k`, effectively training video, audio, and cross-modal
+> attention branches together.
+
+> [!TIP]
+> You can also target the feed-forward (FFN) modules (`ff.net.0.proj`, `ff.net.2` for video,
+> `audio_ff.net.0.proj`, `audio_ff.net.2` for audio) to increase the LoRA's capacity and potentially
+> help it capture the target distribution better.
+
+### TrainingStrategyConfig
+
+Configures the training strategy. The trainer includes two built-in strategies described below.
+For custom use cases, see [Implementing Custom Training Strategies](custom-training-strategies.md).
+
+#### Text-to-Video Strategy
+
+```yaml
+training_strategy:
+ name: "text_to_video"
+ first_frame_conditioning_p: 0.1 # Probability of first-frame conditioning
+ with_audio: false # Enable joint audio-video training
+ audio_latents_dir: "audio_latents" # Directory for audio latents (when with_audio: true)
+```
+
+#### Video-to-Video Strategy (IC-LoRA)
+
+```yaml
+training_strategy:
+ name: "video_to_video"
+ first_frame_conditioning_p: 0.1
+ reference_latents_dir: "reference_latents" # Directory for reference video latents
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|------------------------------|------------------------------------------------------------------|
+| `name` | Strategy type: `"text_to_video"` or `"video_to_video"` |
+| `first_frame_conditioning_p` | Probability of using first frame as conditioning (0.0-1.0) |
+| `with_audio` | (text_to_video only) Enable joint audio-video training |
+| `audio_latents_dir` | (text_to_video only) Directory name for audio latents |
+| `reference_latents_dir` | (video_to_video only) Directory name for reference video latents |
+
+### OptimizationConfig
+
+Training optimization parameters including learning rates, batch sizes, and schedulers.
+
+```yaml
+optimization:
+ learning_rate: 1e-4 # Learning rate
+ steps: 2000 # Total training steps
+ batch_size: 1 # Batch size per GPU
+ gradient_accumulation_steps: 1 # Steps to accumulate gradients
+ max_grad_norm: 1.0 # Gradient clipping threshold
+ optimizer_type: "adamw" # "adamw" or "adamw8bit"
+ scheduler_type: "linear" # Scheduler type
+ scheduler_params: { } # Additional scheduler parameters
+ enable_gradient_checkpointing: true # Memory optimization
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|---------------------------------|----------------------------------------------------------------------------------------------|
+| `learning_rate` | Learning rate for optimization (typical range: 1e-5 to 1e-3) |
+| `steps` | Total number of training steps |
+| `batch_size` | Batch size per GPU (reduce if running out of memory) |
+| `gradient_accumulation_steps` | Accumulate gradients over multiple steps |
+| `scheduler_type` | LR scheduler: `"constant"`, `"linear"`, `"cosine"`, `"cosine_with_restarts"`, `"polynomial"` |
+| `enable_gradient_checkpointing` | Trade training speed for GPU memory savings (recommended for large models) |
+
+### AccelerationConfig
+
+Hardware acceleration and compute optimization settings.
+
+```yaml
+acceleration:
+ mixed_precision_mode: "bf16" # "no", "fp16", or "bf16"
+ quantization: null # Quantization options
+ load_text_encoder_in_8bit: false # Load text encoder in 8-bit
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|-----------------------------|------------------------------------------------------------------------------------|
+| `mixed_precision_mode` | Precision mode - `"bf16"` recommended for modern GPUs |
+| `quantization` | Model quantization: `null`, `"int8-quanto"`, `"int4-quanto"`, `"fp8-quanto"`, etc. |
+| `load_text_encoder_in_8bit` | Load the Gemma text encoder in 8-bit to save GPU memory |
+
+### DataConfig
+
+Data loading and processing configuration.
+
+```yaml
+data:
+ preprocessed_data_root: "/path/to/preprocessed/data" # Path to precomputed dataset
+ num_dataloader_workers: 2 # Background data loading workers
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|--------------------------|--------------------------------------------------------------------------------------------|
+| `preprocessed_data_root` | Path to your preprocessed dataset (contains `latents/`, `conditions/`, etc.) |
+| `num_dataloader_workers` | Number of parallel data loading processes (0 = synchronous loading, useful when debugging) |
+
+### ValidationConfig
+
+Validation and inference settings for monitoring training progress.
+
+```yaml
+validation:
+ prompts: # Validation prompts
+ - "A cat playing with a ball"
+ - "A dog running in a field"
+ negative_prompt: "worst quality, inconsistent motion, blurry, jittery, distorted"
+ images: null # Optional image paths for image-to-video
+ reference_videos: null # Reference video paths (IC-LoRA only)
+ video_dims: [ 576, 576, 89 ] # Video dimensions [width, height, frames]
+ frame_rate: 25.0 # Frame rate for generated videos
+ seed: 42 # Random seed for reproducibility
+ inference_steps: 30 # Number of inference steps
+ interval: 100 # Steps between validation runs
+ videos_per_prompt: 1 # Videos generated per prompt
+ guidance_scale: 4.0 # CFG guidance strength
+ stg_scale: 1.0 # STG guidance strength (0.0 to disable)
+ stg_blocks: [ 29 ] # Transformer blocks to perturb for STG
+ stg_mode: "stg_av" # "stg_av" or "stg_v" (video only)
+ generate_audio: true # Whether to generate audio
+ skip_initial_validation: false # Skip validation at step 0
+ include_reference_in_output: false # Include reference video side-by-side (IC-LoRA)
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|-------------------------------|--------------------------------------------------------------------------------------------------------------------------|
+| `prompts` | List of text prompts for validation video generation |
+| `images` | List of image paths for image-to-video validation (must match number of prompts) |
+| `reference_videos` | List of reference video paths for IC-LoRA validation (must match number of prompts) |
+| `video_dims` | Output dimensions `[width, height, frames]`. Width/height must be divisible by 32, frames must satisfy `frames % 8 == 1` |
+| `interval` | Steps between validation runs (set to `null` to disable) |
+| `guidance_scale` | CFG (Classifier-Free Guidance) scale. Recommended: 4.0 |
+| `stg_scale` | STG (Spatio-Temporal Guidance) scale. 0.0 disables STG. Recommended: 1.0 |
+| `stg_blocks` | Transformer blocks to perturb for STG. Recommended: `[29]` (single block) |
+| `stg_mode` | STG mode: `"stg_av"` perturbs both audio and video, `"stg_v"` perturbs video only |
+| `generate_audio` | Whether to generate audio in validation samples |
+| `include_reference_in_output` | For IC-LoRA: concatenate reference video side-by-side with output |
+
+### CheckpointsConfig
+
+Model checkpointing configuration.
+
+```yaml
+checkpoints:
+ interval: 250 # Steps between checkpoint saves (null = disabled)
+ keep_last_n: 3 # Number of recent checkpoints to retain
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|---------------|------------------------------------------------------------------------|
+| `interval` | Steps between intermediate checkpoint saves (set to `null` to disable) |
+| `keep_last_n` | Number of most recent checkpoints to keep (-1 = keep all) |
+
+### HubConfig
+
+Hugging Face Hub integration for automatic model uploads.
+
+```yaml
+hub:
+ push_to_hub: false # Enable Hub uploading
+ hub_model_id: "username/model-name" # Hub repository ID
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|----------------|------------------------------------------------------------------|
+| `push_to_hub` | Whether to automatically push trained models to Hugging Face Hub |
+| `hub_model_id` | Repository ID in format `"username/repository-name"` |
+
+### WandbConfig
+
+Weights & Biases logging configuration.
+
+```yaml
+wandb:
+ enabled: false # Enable W&B logging
+ project: "ltx-2-trainer" # W&B project name
+ entity: null # W&B username or team
+ tags: [ ] # Tags for the run
+ log_validation_videos: true # Log validation videos to W&B
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|-------------------------|--------------------------------------------------|
+| `enabled` | Whether to enable W&B logging |
+| `project` | W&B project name |
+| `entity` | W&B username or team (null uses default account) |
+| `log_validation_videos` | Whether to log validation videos to W&B |
+
+### FlowMatchingConfig
+
+Flow matching training configuration for timestep sampling.
+
+```yaml
+flow_matching:
+ timestep_sampling_mode: "shifted_logit_normal" # Timestep sampling strategy
+ timestep_sampling_params: { } # Additional sampling parameters
+```
+
+**Key parameters:**
+
+| Parameter | Description |
+|----------------------------|------------------------------------------------------------|
+| `timestep_sampling_mode` | Sampling strategy: `"uniform"` or `"shifted_logit_normal"` |
+| `timestep_sampling_params` | Additional parameters for the sampling strategy |
+
+## 🚀 Next Steps
+
+Once you've configured your training parameters:
+
+- Set up your dataset using [Dataset Preparation](dataset-preparation.md)
+- Choose your training approach in [Training Modes](training-modes.md)
+- Start training with the [Training Guide](training-guide.md)
diff --git a/packages/ltx-trainer/docs/custom-training-strategies.md b/packages/ltx-trainer/docs/custom-training-strategies.md
new file mode 100644
index 0000000..383932e
--- /dev/null
+++ b/packages/ltx-trainer/docs/custom-training-strategies.md
@@ -0,0 +1,509 @@
+# Implementing Custom Training Strategies
+
+This guide explains how to implement your own training strategy for specialized use cases like audio-only training,
+video inpainting, or other custom training recipes.
+
+## 📋 Overview
+
+The trainer uses the **Strategy Pattern** to separate training logic from the core training loop. Each strategy defines:
+
+1. **What data is needed** - Which preprocessed data directories to load
+2. **How to prepare inputs** - Transform batch data into model inputs
+3. **How to compute loss** - Calculate the training objective
+
+This architecture lets you implement new training modes without modifying the core trainer code.
+
+### When You Need a Custom Strategy
+
+Consider implementing a custom strategy when you need:
+
+- **Different input modalities** (e.g., audio-only, audio-to-video conditioning)
+- **Additional conditioning signals** (e.g., masks for inpainting, depth maps)
+- **Custom loss computation** (e.g., weighted losses, auxiliary losses)
+- **Different noise application patterns** (e.g., partial masking)
+
+## 🏗️ Architecture Overview
+
+### How Strategies Fit Into the Trainer
+
+The trainer delegates all training-mode-specific logic to the strategy:
+
+1. **Initialization** — The trainer calls `get_data_sources()` to determine which preprocessed data directories to load
+2. **Each training step:**
+ - Calls `prepare_training_inputs()` to transform the raw batch into model-ready inputs
+ - Runs the transformer forward pass
+ - Calls `compute_loss()` to compute the training objective
+
+The trainer handles everything else: optimization, checkpointing, validation, and distributed training.
+
+### Key Components
+
+| Component | Purpose |
+|-----------------------------------------------------------------------------------------|--------------------------------------------------------------|
+| [`TrainingStrategyConfigBase`](../src/ltx_trainer/training_strategies/base_strategy.py) | Base class for strategy configuration (Pydantic model) |
+| [`TrainingStrategy`](../src/ltx_trainer/training_strategies/base_strategy.py) | Abstract base class defining the strategy interface |
+| [`ModelInputs`](../src/ltx_trainer/training_strategies/base_strategy.py) | Dataclass containing prepared inputs for the transformer |
+| [`Modality`](../../ltx-core/src/ltx_core/model/transformer/modality.py) | ltx-core dataclass representing video or audio modality data |
+
+## 📝 Step-by-Step Implementation
+
+### Step 1: Plan Your Strategy
+
+Before writing code, answer these questions:
+
+1. **What additional data does your strategy need?**
+ - Example: Inpainting needs mask latents alongside video latents
+ - Example: Audio-to-video needs reference audio embeddings
+
+2. **What does conditioning look like?**
+ - Which tokens should be noised vs. kept clean?
+ - How should conditioning tokens be structured (e.g., first frame, reference video, mask)?
+
+3. **How should loss be computed?**
+ - Which tokens contribute to the loss?
+ - Are there multiple loss terms to combine?
+
+### Step 2: Extend Data Preprocessing (If Needed)
+
+If your strategy requires additional preprocessed data beyond video latents, audio latents, and text embeddings, you'll
+need to extend the preprocessing pipeline.
+
+#### Option A: Modify `process_dataset.py`
+
+For integrated preprocessing, add new arguments and processing steps to the main script. For example, to add mask
+preprocessing:
+
+```python
+# In process_dataset.py, add a new argument
+def main(
+ # ... existing arguments ...
+ mask_column: str | None = typer.Option(
+ default=None,
+ help="Column name containing mask video paths (for inpainting)",
+ ),
+) -> None:
+ # ... existing processing ...
+
+ # Process masks if provided
+ if mask_column:
+ logger.info("Processing mask videos for inpainting training...")
+ mask_latents_dir = output_base / "mask_latents"
+
+ compute_latents(
+ dataset_file=dataset_path,
+ video_column=mask_column,
+ resolution_buckets=parsed_resolution_buckets,
+ output_dir=str(mask_latents_dir),
+ model_path=model_path,
+ # ... other args ...
+ )
+```
+
+#### Option B: Create a Standalone Script
+
+For complex preprocessing that doesn't fit naturally into the existing pipeline, create a dedicated script
+(e.g., `scripts/process_masks.py`). Use [`scripts/compute_reference.py`](../scripts/compute_reference.py) as a
+template - it shows how to process paired data and update the dataset JSON.
+
+#### Expected Output Structure
+
+Your preprocessing should create a directory structure that the strategy can reference:
+
+```
+preprocessed_data_root/
+├── latents/ # Video latents (standard)
+├── conditions/ # Text embeddings (standard)
+├── audio_latents/ # Audio latents (if with_audio)
+├── mask_latents/ # Your custom data directory
+└── reference_latents/ # Reference videos (for IC-LoRA)
+```
+
+### Step 3: Create the Strategy Configuration
+
+Create a new file for your strategy (e.g., `src/ltx_trainer/training_strategies/inpainting.py`):
+
+```python
+"""Inpainting training strategy.
+
+This strategy implements video inpainting training where:
+- Mask latents indicate which regions to inpaint
+- Loss is computed only on masked (inpainted) regions
+"""
+
+from typing import Any, Literal
+
+import torch
+from pydantic import Field
+from torch import Tensor
+
+from ltx_core.model.transformer.modality import Modality
+from ltx_trainer.timestep_samplers import TimestepSampler
+from ltx_trainer.training_strategies.base_strategy import (
+ ModelInputs,
+ TrainingStrategy,
+ TrainingStrategyConfigBase,
+)
+
+
+class InpaintingConfig(TrainingStrategyConfigBase):
+ """Configuration for inpainting training strategy."""
+
+ # The 'name' field acts as a discriminator for the config union
+ name: Literal["inpainting"] = "inpainting"
+
+ mask_latents_dir: str = Field(
+ default="mask_latents",
+ description="Directory name for mask latents",
+ )
+
+ # Add any strategy-specific parameters
+ mask_threshold: float = Field(
+ default=0.5,
+ description="Threshold for binary mask conversion",
+ ge=0.0,
+ le=1.0,
+ )
+```
+
+**Key points:**
+
+- Inherit from `TrainingStrategyConfigBase`
+- Use `Literal["your_strategy_name"]` for the `name` field - this enables automatic strategy selection
+- Use Pydantic `Field` for validation and documentation
+
+### Step 4: Implement the Strategy Class
+
+```python
+class InpaintingStrategy(TrainingStrategy):
+ """Inpainting training strategy.
+
+ Trains the model to fill in masked regions of videos while
+ keeping unmasked regions as conditioning.
+ """
+
+ config: InpaintingConfig
+
+ def __init__(self, config: InpaintingConfig):
+ super().__init__(config)
+
+ @property
+ def requires_audio(self) -> bool:
+ """Whether this strategy requires audio components."""
+ return False # Set to True if your strategy needs audio
+
+ def get_data_sources(self) -> dict[str, str]:
+ """Define which data directories to load.
+
+ Returns a mapping of directory names to batch keys.
+ The trainer will load .pt files from each directory and
+ make them available in the batch under the specified key.
+ """
+ return {
+ "latents": "latents", # -> batch["latents"]
+ "conditions": "conditions", # -> batch["conditions"]
+ self.config.mask_latents_dir: "masks", # -> batch["masks"]
+ }
+
+ def prepare_training_inputs(
+ self,
+ batch: dict[str, Any],
+ timestep_sampler: TimestepSampler,
+ ) -> ModelInputs:
+ """Transform batch data into model inputs.
+
+ This is where the core training logic lives:
+ 1. Extract and patchify latents
+ 2. Sample noise and apply it appropriately
+ 3. Create conditioning masks
+ 4. Build Modality objects for the transformer
+ """
+ # Get video latents [B, C, F, H, W]
+ latents_data = batch["latents"]
+ video_latents = latents_data["latents"]
+
+ # Get dimensions
+ num_frames = latents_data["num_frames"][0].item()
+ height = latents_data["height"][0].item()
+ width = latents_data["width"][0].item()
+
+ # Patchify: [B, C, F, H, W] -> [B, seq_len, C]
+ video_latents = self._video_patchifier.patchify(video_latents)
+
+ batch_size, seq_len, _ = video_latents.shape
+ device = video_latents.device
+ dtype = video_latents.dtype
+
+ # Get mask latents and process them
+ mask_data = batch["masks"]
+ mask_latents = mask_data["latents"]
+ mask_latents = self._video_patchifier.patchify(mask_latents)
+
+ # Create binary mask: True = inpaint this region, False = keep original
+ inpaint_mask = mask_latents.mean(dim=-1) > self.config.mask_threshold
+
+ # Sample noise and sigmas
+ sigmas = timestep_sampler.sample_for(video_latents)
+ noise = torch.randn_like(video_latents)
+
+ # Apply noise only to inpaint regions
+ sigmas_expanded = sigmas.view(-1, 1, 1)
+ noisy_latents = (1 - sigmas_expanded) * video_latents + sigmas_expanded * noise
+
+ # Keep original latents for non-inpaint regions (conditioning)
+ inpaint_mask_expanded = inpaint_mask.unsqueeze(-1)
+ noisy_latents = torch.where(inpaint_mask_expanded, noisy_latents, video_latents)
+
+ # Create per-token timesteps
+ # Conditioning tokens (non-inpaint) get timestep=0
+ # Inpaint tokens get the sampled sigma
+ timesteps = self._create_per_token_timesteps(~inpaint_mask, sigmas.squeeze())
+
+ # Compute targets (velocity prediction: noise - clean)
+ targets = noise - video_latents
+
+ # Get text embeddings
+ conditions = batch["conditions"]
+ video_prompt_embeds = conditions["video_prompt_embeds"]
+ prompt_attention_mask = conditions["prompt_attention_mask"]
+
+ # Generate position embeddings
+ positions = self._get_video_positions(
+ num_frames=num_frames,
+ height=height,
+ width=width,
+ batch_size=batch_size,
+ fps=24.0, # Or get from latents_data
+ device=device,
+ dtype=dtype,
+ )
+
+ # Create video Modality
+ video_modality = Modality(
+ enabled=True,
+ latent=noisy_latents,
+ timesteps=timesteps,
+ positions=positions,
+ context=video_prompt_embeds,
+ context_mask=prompt_attention_mask,
+ )
+
+ # Loss mask: only compute loss on inpaint regions
+ loss_mask = inpaint_mask
+
+ return ModelInputs(
+ video=video_modality,
+ audio=None,
+ video_targets=targets,
+ audio_targets=None,
+ video_loss_mask=loss_mask,
+ audio_loss_mask=None,
+ )
+
+ def compute_loss(
+ self,
+ video_pred: Tensor,
+ audio_pred: Tensor | None,
+ inputs: ModelInputs,
+ ) -> Tensor:
+ """Compute training loss on inpaint regions only."""
+ # MSE loss
+ loss = (video_pred - inputs.video_targets).pow(2)
+
+ # Apply loss mask
+ loss_mask = inputs.video_loss_mask.unsqueeze(-1).float()
+ loss = loss.mul(loss_mask).div(loss_mask.mean() + 1e-8)
+
+ return loss.mean()
+```
+
+### Step 5: Register the Strategy
+
+You need to register your strategy in two places:
+
+**1. Update [`src/ltx_trainer/training_strategies/__init__.py`](../src/ltx_trainer/training_strategies/__init__.py):**
+
+```python
+# Add import for your strategy
+from ltx_trainer.training_strategies.inpainting import InpaintingConfig, InpaintingStrategy
+
+# Add to the TrainingStrategyConfig type alias
+TrainingStrategyConfig = TextToVideoConfig | VideoToVideoConfig | InpaintingConfig
+
+# Add to __all__
+__all__ = [
+ # ... existing exports ...
+ "InpaintingConfig",
+ "InpaintingStrategy",
+]
+
+
+# Add case in get_training_strategy()
+def get_training_strategy(config: TrainingStrategyConfig) -> TrainingStrategy:
+ match config:
+ # ... existing cases ...
+ case InpaintingConfig():
+ strategy = InpaintingStrategy(config)
+```
+
+**2. Update [`src/ltx_trainer/config.py`](../src/ltx_trainer/config.py):**
+
+```python
+# Add import
+from ltx_trainer.training_strategies.inpainting import InpaintingConfig
+
+# Add to the TrainingStrategyConfig union with a Tag matching your strategy name
+TrainingStrategyConfig = Annotated[
+ Annotated[TextToVideoConfig, Tag("text_to_video")]
+ | Annotated[VideoToVideoConfig, Tag("video_to_video")]
+ | Annotated[InpaintingConfig, Tag("inpainting")], # Add your config
+ Discriminator(_get_strategy_discriminator),
+]
+```
+
+### Step 6: Create a Configuration File
+
+Create an example config in `configs/`:
+
+```yaml
+# configs/ltx2_inpainting_lora.yaml
+
+model:
+ model_path: "/path/to/ltx2.safetensors"
+ text_encoder_path: "/path/to/gemma"
+ training_mode: "lora"
+
+training_strategy:
+ name: "inpainting" # Must match your Literal type
+ mask_latents_dir: "mask_latents"
+ mask_threshold: 0.5
+
+lora:
+ rank: 32
+ alpha: 32
+ target_modules:
+ - "to_k"
+ - "to_q"
+ - "to_v"
+ - "to_out.0"
+
+data:
+ preprocessed_data_root: "/path/to/preprocessed/dataset"
+
+optimization:
+ learning_rate: 1e-4
+ steps: 2000
+ batch_size: 1
+
+# ... other config sections ...
+```
+
+## 🔧 Helper Methods Reference
+
+The base `TrainingStrategy` class provides these helper methods:
+
+| Method | Purpose |
+|----------------------------------------------|-------------------------------------------------|
+| `_video_patchifier.patchify(latents)` | Convert `[B, C, F, H, W]` → `[B, seq_len, C]` |
+| `_audio_patchifier.patchify(latents)` | Convert `[B, C, T, F]` → `[B, T, C*F]` |
+| `_get_video_positions(...)` | Generate position embeddings for video |
+| `_get_audio_positions(...)` | Generate position embeddings for audio |
+| `_create_per_token_timesteps(mask, sigma)` | Create timesteps with 0 for conditioning tokens |
+| `_create_first_frame_conditioning_mask(...)` | Create mask for first-frame conditioning |
+
+## 📊 Understanding ModelInputs
+
+The `ModelInputs` dataclass contains everything needed for the forward pass and loss computation:
+
+```python
+@dataclass
+class ModelInputs:
+ video: Modality # Video modality data
+ audio: Modality | None # Audio modality (None if video-only)
+
+ video_targets: Tensor # Target values for loss (velocity)
+ audio_targets: Tensor | None
+
+ video_loss_mask: Tensor # Boolean: True = compute loss for this token
+ audio_loss_mask: Tensor | None
+
+ ref_seq_len: int | None = None # For IC-LoRA: reference sequence length
+```
+
+## 📊 Understanding Modality
+
+The `Modality` dataclass (from ltx-core) represents a single modality's data:
+
+```python
+@dataclass(frozen=True)
+class Modality:
+ enabled: bool # Whether this modality is active
+ latent: Tensor # [B, seq_len, C] - the latent tokens
+ timesteps: Tensor # [B, seq_len] - per-token timesteps (sigmas)
+ positions: Tensor # [B, dims, seq_len, 2] - position bounds
+ context: Tensor # [B, ctx_len, C] - text embeddings
+ context_mask: Tensor # [B, ctx_len] - attention mask for context
+```
+
+> [!NOTE]
+> **Per-token timesteps:** Each token in the sequence has its own timestep. Conditioning tokens—those that should remain
+> un-noised—must have `timestep=0`. This is how the model distinguishes clean reference tokens from tokens to denoise. Use
+`_create_per_token_timesteps(conditioning_mask, sigma)` to set this up correctly.
+
+> [!NOTE]
+> `Modality` is immutable (frozen dataclass). Use `dataclasses.replace()` to create modified copies.
+
+## ✅ Testing Your Strategy
+
+1. **Verify your training configuration is valid:**
+ ```bash
+ uv run python -c "
+ from ltx_trainer.config import LtxTrainerConfig
+ import yaml
+
+ with open('configs/ltx2_inpainting_lora.yaml') as f:
+ config = LtxTrainerConfig(**yaml.safe_load(f))
+ print(f'Strategy: {config.training_strategy.name}')
+ "
+ ```
+
+2. **Test strategy instantiation:**
+ ```bash
+ uv run python -c "
+ from ltx_trainer.training_strategies import get_training_strategy
+ from ltx_trainer.training_strategies.inpainting import InpaintingConfig
+
+ config = InpaintingConfig()
+ strategy = get_training_strategy(config)
+ print(f'Data sources: {strategy.get_data_sources()}')
+ "
+ ```
+
+3. **Run a short training test:**
+ ```bash
+ uv run python scripts/train.py configs/ltx2_inpainting_lora.yaml
+ ```
+
+## 💡 Tips and Best Practices
+
+### Debugging
+
+- Set `data.num_dataloader_workers: 0` to get clearer error messages
+- Use a small dataset and few steps for initial testing
+- Check tensor shapes at each step with print statements
+
+## 🔗 Related Documentation
+
+- [Training Modes](training-modes.md) - Overview of built-in training modes
+- [Configuration Reference](configuration-reference.md) - All configuration options
+- [Dataset Preparation](dataset-preparation.md) - Preprocessing workflow
+- [ltx-core Documentation](../../ltx-core/README.md) - Core model components
+
+## 📚 Reference: Existing Strategies
+
+Study these implementations for guidance:
+
+| Strategy | Complexity | Key Features |
+|------------------------------------------------------------------------------------|------------|------------------------------------------------|
+| [`TextToVideoStrategy`](../src/ltx_trainer/training_strategies/text_to_video.py) | Simple | First-frame conditioning, optional audio |
+| [`VideoToVideoStrategy`](../src/ltx_trainer/training_strategies/video_to_video.py) | Medium | Reference video concatenation, split loss mask |
diff --git a/packages/ltx-trainer/docs/dataset-preparation.md b/packages/ltx-trainer/docs/dataset-preparation.md
new file mode 100644
index 0000000..53528ce
--- /dev/null
+++ b/packages/ltx-trainer/docs/dataset-preparation.md
@@ -0,0 +1,342 @@
+# Dataset Preparation Guide
+
+This guide covers the complete workflow for preparing and preprocessing your dataset for training.
+
+## 📋 Overview
+
+The general dataset preparation workflow is:
+
+1. **(Optional)** Split long videos into scenes using `split_scenes.py`
+2. **(Optional)** Generate captions for your videos using `caption_videos.py`
+3. **Preprocess your dataset** using `process_dataset.py` to compute and cache video/audio latents and text embeddings
+4. **Run the trainer** with your preprocessed dataset
+
+## 🎬 Step 1: Split Scenes
+
+If you're starting with raw, long-form videos (e.g., downloaded from YouTube), you should first split them into shorter, coherent scenes.
+
+```bash
+uv run python scripts/split_scenes.py input.mp4 scenes_output_dir/ \
+ --filter-shorter-than 5s
+```
+
+This will create multiple video clips in `scenes_output_dir`.
+These clips will be the input for the captioning step, if you choose to use it.
+
+The script supports many configuration options for scene detection (detector algorithms, thresholds, minimum scene lengths, etc.):
+
+```bash
+uv run python scripts/split_scenes.py --help
+```
+
+## 📝 Step 2: Caption Videos
+
+If your dataset doesn't include captions, you can automatically generate them using multimodal models that understand both video and audio.
+
+```bash
+uv run python scripts/caption_videos.py scenes_output_dir/ \
+ --output scenes_output_dir/dataset.json
+```
+
+If you're running into VRAM issues, try enabling 8-bit quantization to reduce memory usage:
+
+```bash
+uv run python scripts/caption_videos.py scenes_output_dir/ \
+ --output scenes_output_dir/dataset.json \
+ --use-8bit
+```
+
+This will create a `dataset.json` file containing video paths and their captions.
+
+**Captioning options:**
+
+| Option | Description |
+|--------|-------------|
+| `--captioner-type` | `qwen_omni` (default, local) or `gemini_flash` (API) |
+| `--use-8bit` | Enable 8-bit quantization for lower VRAM usage |
+| `--no-audio` | Disable audio processing (video-only captions) |
+| `--override` | Re-caption files that already have captions |
+| `--api-key` | API key for Gemini Flash (or set `GOOGLE_API_KEY` env var) |
+
+**Caption format:**
+
+The captioner produces structured captions with sections for:
+- **Visual content**: People, objects, actions, settings, colors, movements
+- **Speech transcription**: Word-for-word transcription of spoken content
+- **Sounds**: Music, ambient sounds, sound effects
+- **On-screen text**: Any visible text overlays
+
+> [!NOTE]
+> The automatically generated captions may contain inaccuracies or hallucinated content.
+> We recommend reviewing and correcting the generated captions in your `dataset.json` file before proceeding to preprocessing.
+
+## ⚡ Step 3: Dataset Preprocessing
+
+This step preprocesses your video dataset by:
+
+1. Resizing and cropping videos to fit specified resolution buckets
+2. Computing and caching video latent representations
+3. Computing and caching text embeddings for captions
+4. (Optional) Computing and caching audio latents
+
+> [!WARNING]
+> Very large videos (especially high spatial resolution and/or many frames) can cause GPU out-of-memory (OOM)
+> during preprocessing/encoding.
+> The simplest fix is to reduce the target resolution (spatially: width/height) and/or the number of frames
+> (temporally) by using `--resolution-buckets` with smaller dimensions (lower width/height and/or fewer frames).
+
+### Basic Usage
+
+```bash
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model
+```
+
+### With Audio Processing
+
+For audio-video training, add the `--with-audio` flag:
+
+```bash
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model \
+ --with-audio
+```
+
+### 📊 Dataset Format
+
+The trainer supports either videos or single images.
+Note that your dataset must be homogeneous - either all videos or all images, mixing is not supported.
+
+> [!TIP]
+> **Image Datasets:** When using images, follow the same preprocessing steps and format requirements as with videos,
+> but use `1` for the frame count in the resolution bucket (e.g., `960x544x1`).
+
+The dataset must be a CSV, JSON, or JSONL metadata file with columns for captions and video paths:
+
+**JSON format example:**
+
+```json
+[
+ {
+ "caption": "A cat playing with a ball of yarn",
+ "media_path": "videos/cat_playing.mp4"
+ },
+ {
+ "caption": "A dog running in the park",
+ "media_path": "videos/dog_running.mp4"
+ }
+]
+```
+
+**JSONL format example:**
+
+```jsonl
+{"caption": "A cat playing with a ball of yarn", "media_path": "videos/cat_playing.mp4"}
+{"caption": "A dog running in the park", "media_path": "videos/dog_running.mp4"}
+```
+
+**CSV format example:**
+
+```csv
+caption,media_path
+"A cat playing with a ball of yarn","videos/cat_playing.mp4"
+"A dog running in the park","videos/dog_running.mp4"
+```
+
+### 📐 Resolution Buckets
+
+Videos are organized into "buckets" of specific dimensions (width × height × frames).
+Each video is assigned to the nearest matching bucket.
+You can preprocess with one or multiple resolution buckets.
+When training with multiple resolution buckets, you must use a batch size of 1.
+
+The dimensions of each bucket must follow these constraints due to LTX-2's VAE architecture:
+
+- **Spatial dimensions** (width and height) must be multiples of 32
+- **Number of frames** must satisfy `frames % 8 == 1` (e.g., 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 121, etc.)
+
+**Guidelines for choosing training resolution:**
+
+- For high-quality, detailed videos: use larger spatial dimensions (e.g. 768x448) with fewer frames (e.g. 89)
+- For longer, motion-focused videos: use smaller spatial dimensions (512×512) with more frames (121)
+- Memory usage increases with both spatial and temporal dimensions
+
+**Example usage:**
+
+```bash
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model
+```
+
+Multiple buckets are supported by separating entries with `;`:
+
+```bash
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49;512x512x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model
+```
+
+**Video processing workflow:**
+
+1. Videos are **resized** maintaining aspect ratio until either width or height matches the target
+2. The larger dimension is **center cropped** to match the bucket's dimensions
+3. Only the **first X frames are taken** to match the bucket's frame count, remaining frames are ignored
+
+> [!NOTE]
+> The sequence length processed by the transformer model can be calculated as:
+>
+> ```
+> sequence_length = (H/32) * (W/32) * ((F-1)/8 + 1)
+> ```
+>
+> Where:
+> - H = Height of video
+> - W = Width of video
+> - F = Number of frames
+> - 32 = VAE's spatial downsampling factor
+> - 8 = VAE's temporal downsampling factor
+>
+> For example, a 768×448×89 video would have sequence length:
+> ```
+> (768/32) * (448/32) * ((89-1)/8 + 1) = 24 * 14 * 12 = 4,032
+> ```
+>
+> Keep this in mind when choosing video dimensions, as longer sequences require more GPU memory.
+
+> [!WARNING]
+> When training with multiple resolution buckets, you must use a batch size of 1
+> (i.e., set `optimization.batch_size: 1` in your training config).
+
+### 📁 Output Structure
+
+The preprocessed data is saved in a `.precomputed` directory:
+
+```
+dataset/
+└── .precomputed/
+ ├── latents/ # Cached video latents
+ ├── conditions/ # Cached text embeddings
+ ├── audio_latents/ # (only if --with-audio) Cached audio latents
+ └── reference_latents/ # (only for IC-LoRA) Cached reference video latents
+```
+
+## 🪄 IC-LoRA Reference Video Preprocessing
+
+For IC-LoRA training, you need to preprocess datasets that include reference videos.
+Reference videos provide the conditioning input while target videos represent the desired transformed output.
+
+### Dataset Format with Reference Videos
+
+**JSON format:**
+
+```json
+[
+ {
+ "caption": "A cat playing with a ball of yarn",
+ "media_path": "videos/cat_playing.mp4",
+ "reference_path": "references/cat_playing_depth.mp4"
+ }
+]
+```
+
+**JSONL format:**
+
+```jsonl
+{"caption": "A cat playing with a ball of yarn", "media_path": "videos/cat_playing.mp4", "reference_path": "references/cat_playing_depth.mp4"}
+{"caption": "A dog running in the park", "media_path": "videos/dog_running.mp4", "reference_path": "references/dog_running_depth.mp4"}
+```
+
+### Preprocessing with Reference Videos
+
+To preprocess a dataset with reference videos, add the `--reference-column` argument specifying the name of the field
+in your dataset JSON/JSONL/CSV that contains the reference video paths:
+
+```bash
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model \
+ --reference-column "reference_path"
+```
+
+This will create an additional `reference_latents/` directory containing the preprocessed reference video latents.
+
+
+### Generating Reference Videos
+
+**Dataset Requirements for IC-LoRA:**
+
+- Your dataset must contain paired videos where each target video has a corresponding reference video
+- Reference and target videos must have *identical* resolution and length
+- Both reference and target videos should be preprocessed together using the same resolution buckets
+
+We provide an example script, [`scripts/compute_reference.py`](../scripts/compute_reference.py), to generate reference
+videos for a given dataset. The default implementation generates Canny edge reference videos.
+
+```bash
+uv run python scripts/compute_reference.py scenes_output_dir/ \
+ --output scenes_output_dir/dataset.json
+```
+
+The script accepts a JSON file as the dataset configuration and updates it in-place by adding the filenames of the generated reference videos.
+
+If you want to generate a different type of condition (depth maps, pose skeletons, etc.), modify or replace the `compute_reference()` function within this script.
+
+### Example Dataset
+
+For reference, see our **[Canny Control Dataset](https://huggingface.co/datasets/Lightricks/Canny-Control-Dataset)** which demonstrates proper IC-LoRA dataset structure with paired videos and Canny edge maps.
+
+
+## 🎯 LoRA Trigger Words
+
+When training a LoRA, you can specify a trigger token that will be prepended to all captions:
+
+```bash
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model \
+ --lora-trigger "MYTRIGGER"
+```
+
+This acts as a trigger word that activates the LoRA during inference when you include the same token in your prompts.
+
+> [!NOTE]
+> There is no need to manually insert the trigger word into your dataset JSON/JSONL/CSV file.
+> The trigger word specified with `--lora-trigger` is automatically prepended to each caption during preprocessing.
+
+## 🔍 Decoding Videos for Verification
+
+If you add the `--decode` flag, the script will VAE-decode the precomputed latents and save the resulting videos
+in `.precomputed/decoded_videos`. When audio preprocessing is enabled (`--with-audio`), audio latents will also be
+decoded and saved to `.precomputed/decoded_audio`. This allows you to visually and audibly inspect the processed data.
+
+```bash
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model \
+ --decode
+```
+
+For single-frame images, the decoded latents will be saved as PNG files rather than MP4 videos.
+
+## 🚀 Next Steps
+
+Once your dataset is preprocessed, you can proceed to:
+
+- Configure your training parameters in [Configuration Reference](configuration-reference.md)
+- Choose your training approach in [Training Modes](training-modes.md)
+- Start training with the [Training Guide](training-guide.md)
+
+> [!TIP]
+> If your training recipe requires additional preprocessed data (e.g., masks, conditioning signals), see
+> [Implementing Custom Training Strategies](custom-training-strategies.md) for guidance on extending the
+> preprocessing pipeline.
diff --git a/packages/ltx-trainer/docs/quick-start.md b/packages/ltx-trainer/docs/quick-start.md
new file mode 100644
index 0000000..8174f1f
--- /dev/null
+++ b/packages/ltx-trainer/docs/quick-start.md
@@ -0,0 +1,128 @@
+# Quick Start Guide
+
+Get up and running with LTX-2 training in just a few steps!
+
+## 📋 Prerequisites
+
+Before you begin, ensure you have:
+
+1. **LTX-2 Model Checkpoint** - A local `.safetensors` file containing the LTX-2 model weights.
+ Download `ltx-2-19b-dev.safetensors` from: [HuggingFace Hub](https://huggingface.co/Lightricks/LTX-2)
+2. **Gemma Text Encoder** - A local directory containing the Gemma model (required for LTX-2).
+ Download from: [HuggingFace Hub](https://huggingface.co/google/gemma-3-12b-it-qat-q4_0-unquantized/)
+3. **Linux with CUDA** - The trainer requires `triton` which is Linux-only
+4. **GPU with sufficient VRAM** - 80GB recommended. Lower VRAM may work with gradient checkpointing and lower
+ resolutions
+
+## ⚡ Installation
+
+First, install [uv](https://docs.astral.sh/uv/getting-started/installation/) if you haven't already.
+Then clone the repository and install the dependencies:
+
+```bash
+git clone https://github.com/Lightricks/LTX-2
+```
+
+The `ltx-trainer` package is part of the `LTX-2` monorepo. Install the dependencies from the repository root,
+then navigate to the trainer package:
+
+```bash
+# From the repository root
+uv sync
+cd packages/ltx-trainer
+```
+
+> [!NOTE]
+> The trainer depends on [`ltx-core`](../../ltx-core/) and [`ltx-pipelines`](../../ltx-pipelines/)
+> packages which are automatically installed from the monorepo.
+
+## 🏋 Training Workflow
+
+### 1. Prepare Your Dataset
+
+Organize your videos and captions, then preprocess them:
+
+```bash
+# Split long videos into scenes (optional)
+uv run python scripts/split_scenes.py input.mp4 scenes_output_dir/ --filter-shorter-than 5s
+
+# Generate captions for videos (optional)
+uv run python scripts/caption_videos.py scenes_output_dir/ --output dataset.json
+
+# Preprocess the dataset (compute latents and embeddings)
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model
+```
+
+See [Dataset Preparation](dataset-preparation.md) for detailed instructions.
+
+### 2. Configure Training
+
+Create or modify a configuration YAML file. Start with one of the example configs:
+
+- [`configs/ltx2_av_lora.yaml`](../configs/ltx2_av_lora.yaml) - Audio-video LoRA training
+- [`configs/ltx2_v2v_ic_lora.yaml`](../configs/ltx2_v2v_ic_lora.yaml) - IC-LoRA video-to-video
+
+Key settings to update:
+
+```yaml
+model:
+ model_path: "/path/to/ltx-2-model.safetensors"
+ text_encoder_path: "/path/to/gemma-model"
+
+data:
+ preprocessed_data_root: "/path/to/preprocessed/data"
+
+output_dir: "outputs/my_training_run"
+```
+
+See [Configuration Reference](configuration-reference.md) for all available options.
+
+### 3. Start Training
+
+```bash
+uv run python scripts/train.py configs/ltx2_av_lora.yaml
+```
+
+For multi-GPU training:
+
+```bash
+uv run accelerate launch scripts/train.py configs/ltx2_av_lora.yaml
+```
+
+See [Training Guide](training-guide.md) for distributed training and advanced options.
+
+## 🎯 Training Modes
+
+The trainer supports several training modes:
+
+| Mode | Description | Config Example |
+|----------------------|--------------------------------|--------------------------------------------|
+| **LoRA** | Efficient adapter training | `training_strategy.name: "text_to_video"` |
+| **Audio-Video LoRA** | Joint audio-video training | `training_strategy.with_audio: true` |
+| **IC-LoRA** | Video-to-video transformations | `training_strategy.name: "video_to_video"` |
+| **Full Fine-tuning** | Full model training | `model.training_mode: "full"` |
+
+See [Training Modes](training-modes.md) for detailed explanations,
+or [Custom Training Strategies](custom-training-strategies.md) if you need to implement your own training recipe.
+
+## Next Steps
+
+Once you've completed your first training run, you can:
+
+- **Use your trained LoRA for inference** - The [`ltx-pipelines`](../../ltx-pipelines/) package provides
+ production-ready inference
+ pipelines for various use cases (T2V, I2V, IC-LoRA, etc.). See the package documentation for details.
+- Learn more about [Dataset Preparation](dataset-preparation.md) for advanced preprocessing
+- Explore different [Training Modes](training-modes.md) (LoRA, Audio-Video, IC-LoRA)
+- Dive deeper into [Training Configuration](configuration-reference.md)
+- Understand the model architecture in [LTX-Core Documentation](../../ltx-core/README.md)
+
+## Need Help?
+
+If you run into issues at any step, see the [Troubleshooting Guide](troubleshooting.md) for solutions to common
+problems.
+
+Join our [Discord community](https://discord.gg/ltxplatform) for real-time help and discussion!
diff --git a/packages/ltx-trainer/docs/training-guide.md b/packages/ltx-trainer/docs/training-guide.md
new file mode 100644
index 0000000..f737083
--- /dev/null
+++ b/packages/ltx-trainer/docs/training-guide.md
@@ -0,0 +1,203 @@
+# Training Guide
+
+This guide covers how to run training jobs, from basic single-GPU training to advanced distributed setups and automatic
+model uploads.
+
+## ⚡ Basic Training (Single GPU)
+
+After preprocessing your dataset and preparing a configuration file, you can start training using the trainer script:
+
+```bash
+uv run python scripts/train.py configs/ltx2_av_lora.yaml
+```
+
+The trainer will:
+
+1. **Load your configuration** and validate all parameters
+2. **Initialize models** and apply optimizations
+3. **Run the training loop** with progress tracking
+4. **Generate validation videos** (if configured)
+5. **Save the trained weights** in your output directory
+
+### Output Files
+
+**For LoRA training:**
+
+- `lora_weights.safetensors` - Main LoRA weights file
+- `training_config.yaml` - Copy of training configuration
+- `validation_samples/` - Generated validation videos (if enabled)
+
+**For full model fine-tuning:**
+
+- `model_weights.safetensors` - Full model weights
+- `training_config.yaml` - Copy of training configuration
+- `validation_samples/` - Generated validation videos (if enabled)
+
+## 🖥️ Distributed / Multi-GPU Training
+
+We use Hugging Face 🤗 [Accelerate](https://huggingface.co/docs/accelerate/index) for multi-GPU DDP and FSDP.
+
+### Configure Accelerate
+
+Run the interactive wizard once to set up your environment (DDP / FSDP, GPU count, etc.):
+
+```bash
+uv run accelerate config
+```
+
+This stores your preferences in `~/.cache/huggingface/accelerate/default_config.yaml`.
+
+### Use the Provided Accelerate Configs (Recommended)
+
+We include ready-to-use Accelerate config files in `configs/accelerate/`:
+
+- [ddp.yaml](../configs/accelerate/ddp.yaml) — Standard DDP
+- [ddp_compile.yaml](../configs/accelerate/ddp_compile.yaml) — DDP with `torch.compile` (Inductor)
+- [fsdp.yaml](../configs/accelerate/fsdp.yaml) — Standard FSDP (auto-wraps `BasicAVTransformerBlock`)
+- [fsdp_compile.yaml](../configs/accelerate/fsdp_compile.yaml) — FSDP with `torch.compile` (Inductor)
+
+Launch with a specific config using `--config_file`:
+
+```bash
+# DDP (2 GPUs shown as example)
+CUDA_VISIBLE_DEVICES=0,1 \
+uv run accelerate launch --config_file configs/accelerate/ddp.yaml \
+ scripts/train.py configs/ltx2_av_lora.yaml
+
+# DDP + torch.compile
+CUDA_VISIBLE_DEVICES=0,1 \
+uv run accelerate launch --config_file configs/accelerate/ddp_compile.yaml \
+ scripts/train.py configs/ltx2_av_lora.yaml
+
+# FSDP (4 GPUs shown as example)
+CUDA_VISIBLE_DEVICES=0,1,2,3 \
+uv run accelerate launch --config_file configs/accelerate/fsdp.yaml \
+ scripts/train.py configs/ltx2_av_lora.yaml
+
+# FSDP + torch.compile
+CUDA_VISIBLE_DEVICES=0,1,2,3 \
+uv run accelerate launch --config_file configs/accelerate/fsdp_compile.yaml \
+ scripts/train.py configs/ltx2_av_lora.yaml
+```
+
+**Notes:**
+
+- The number of processes is taken from the Accelerate config (`num_processes`). Override with `--num_processes X` or
+ restrict GPUs with `CUDA_VISIBLE_DEVICES`.
+- The compile variants enable `torch.compile` with the Inductor backend via Accelerate's `dynamo_config`.
+- FSDP configs auto-wrap the transformer blocks (`fsdp_transformer_layer_cls_to_wrap: BasicAVTransformerBlock`).
+
+### Launch with Your Default Accelerate Config
+
+If you prefer to use your default Accelerate profile:
+
+```bash
+# Use settings from your default accelerate config
+uv run accelerate launch scripts/train.py configs/ltx2_av_lora.yaml
+
+# Override number of processes on the fly (e.g., 2 GPUs)
+uv run accelerate launch --num_processes 2 scripts/train.py configs/ltx2_av_lora.yaml
+
+# Select specific GPUs
+CUDA_VISIBLE_DEVICES=0,1 uv run accelerate launch scripts/train.py configs/ltx2_av_lora.yaml
+```
+
+> [!TIP]
+> You can disable the in-terminal progress bars with `--disable-progress-bars` flag in the trainer CLI if desired.
+
+### Benefits of Distributed Training
+
+- **Faster training**: Distribute workload across multiple GPUs
+- **Larger effective batch sizes**: Combine gradients from multiple GPUs
+- **Memory efficiency**: Each GPU handles a portion of the batch
+
+> [!NOTE]
+> Distributed training requires that all GPUs have sufficient memory for the model and batch size. The effective batch
+> size becomes `batch_size × num_processes`.
+
+## 🤗 Pushing Models to Hugging Face Hub
+
+You can automatically push your trained models to the Hugging Face Hub by adding the following to your configuration:
+
+```yaml
+hub:
+ push_to_hub: true
+ hub_model_id: "your-username/your-model-name"
+```
+
+### Prerequisites
+
+Before pushing, make sure you:
+
+1. **Have a Hugging Face account** - Sign up at [huggingface.co](https://huggingface.co)
+2. **Are logged in** via `huggingface-cli login` or have set the `HUGGING_FACE_HUB_TOKEN` environment variable
+3. **Have write access** to the specified repository (it will be created if it doesn't exist)
+
+### Login Options
+
+**Option 1: Interactive login**
+
+```bash
+uv run huggingface-cli login
+```
+
+**Option 2: Environment variable**
+
+```bash
+export HUGGING_FACE_HUB_TOKEN="your_token_here"
+```
+
+### What Gets Uploaded
+
+The trainer will automatically:
+
+- **Create a model card** with training details and sample outputs
+- **Upload model weights**
+- **Push sample videos as GIFs** in the model card
+- **Include training configuration and prompts**
+
+## 📊 Weights & Biases Logging
+
+Enable experiment tracking with W&B by adding to your configuration:
+
+```yaml
+wandb:
+ enabled: true
+ project: "ltx-2-trainer"
+ entity: null # Your W&B username or team
+ tags: [ "ltx2", "lora" ]
+ log_validation_videos: true
+```
+
+This will log:
+
+- Training loss and learning rate
+- Validation videos
+- Model configuration
+- Training progress
+
+## 🚀 Next Steps
+
+After training completes:
+
+- **Run inference with your trained LoRA** - The [`ltx-pipelines`](../../ltx-pipelines/) package provides
+ production-ready inference
+ pipelines that support loading custom LoRAs. Available pipelines include text-to-video, image-to-video,
+ IC-LoRA video-to-video, and more. See the [`ltx-pipelines`](../../ltx-pipelines/) package for usage details.
+- **Test your model** with validation prompts
+- **Iterate and improve** based on validation results
+- **Share your results** by pushing to Hugging Face Hub
+
+## 💡 Tips for Successful Training
+
+- **Start small**: Begin with a small dataset and a few hundred steps to verify everything works
+- **Monitor validation**: Keep an eye on validation samples to catch overfitting
+- **Adjust learning rate**: Lower learning rates often produce better results
+- **Use gradient checkpointing**: Essential for training with limited GPU memory
+- **Save checkpoints**: Regular checkpoints help recover from interruptions
+
+## Need Help?
+
+If you encounter issues during training, see the [Troubleshooting Guide](troubleshooting.md).
+
+Join our [Discord community](https://discord.gg/ltxplatform) for real-time help!
diff --git a/packages/ltx-trainer/docs/training-modes.md b/packages/ltx-trainer/docs/training-modes.md
new file mode 100644
index 0000000..39df11d
--- /dev/null
+++ b/packages/ltx-trainer/docs/training-modes.md
@@ -0,0 +1,221 @@
+# Training Modes Guide
+
+The trainer supports several training modes, each suited for different use cases and requirements.
+
+## 🎯 Standard LoRA Training (Video-Only)
+
+Standard LoRA (Low-Rank Adaptation) training fine-tunes the model by adding small, trainable adapter layers while
+keeping the base model frozen. This approach:
+
+- **Requires significantly less memory and compute** than full fine-tuning
+- **Produces small, portable weight files** (typically a few hundred MB)
+- **Is ideal for learning specific styles, effects, or concepts**
+- **Can be easily combined with other LoRAs** during inference
+
+Configure standard LoRA training with:
+
+```yaml
+model:
+ training_mode: "lora"
+
+training_strategy:
+ name: "text_to_video"
+ first_frame_conditioning_p: 0.1
+ with_audio: false # Video-only training
+```
+
+## 🔊 Audio-Video LoRA Training
+
+LTX-2 supports joint audio-video generation. You can train LoRA adapters that affect both video and audio output:
+
+- **Synchronized audio-video generation** - Audio matches the visual content
+- **Same efficient LoRA approach** - Just enable audio training
+- **Requires audio latents** - Dataset must include preprocessed audio
+
+Configure audio-video training with:
+
+```yaml
+model:
+ training_mode: "lora"
+
+training_strategy:
+ name: "text_to_video"
+ first_frame_conditioning_p: 0.1
+ with_audio: true # Enable audio training
+ audio_latents_dir: "audio_latents" # Directory containing audio latents
+```
+
+**Example configuration file:**
+
+- 📄 [Audio-Video LoRA Training](../configs/ltx2_av_lora.yaml)
+
+**Dataset structure for audio-video training:**
+
+```
+preprocessed_data_root/
+├── latents/ # Video latents
+├── conditions/ # Text embeddings
+└── audio_latents/ # Audio latents (required when with_audio: true)
+```
+
+> [!IMPORTANT]
+> When training audio-video LoRAs, ensure your `target_modules` configuration captures video, audio, and
+> cross-modal attention branches. Use patterns like `"to_k"` instead of `"attn1.to_k"` to match:
+> - Video modules: `attn1.to_k`, `attn2.to_k`
+> - Audio modules: `audio_attn1.to_k`, `audio_attn2.to_k`
+> - Cross-modal modules: `audio_to_video_attn.to_k`, `video_to_audio_attn.to_k`
+>
+> The cross-modal attention modules (`audio_to_video_attn` and `video_to_audio_attn`) enable bidirectional
+> information flow between audio and video, which is critical for synchronized audiovisual generation.
+> See [Understanding Target Modules](configuration-reference.md#understanding-target-modules) for detailed guidance.
+
+> [!NOTE]
+> You can generate audio during validation even if you're not training the audio branch.
+> Set `validation.generate_audio: true` independently of `training_strategy.with_audio`.
+
+## 🔥 Full Model Fine-tuning
+
+Full model fine-tuning updates all parameters of the base model, providing maximum flexibility but
+requiring substantial computational resources and larger training datasets:
+
+- **Offers the highest potential quality and capability improvements**
+- **Requires multiple GPUs** and distributed training techniques (e.g., FSDP)
+- **Produces large checkpoint files** (several GB)
+- **Best for major model adaptations** or when LoRA limitations are reached
+
+Configure full fine-tuning with:
+
+```yaml
+model:
+ training_mode: "full"
+
+training_strategy:
+ name: "text_to_video"
+ first_frame_conditioning_p: 0.1
+```
+
+> [!IMPORTANT]
+> Full fine-tuning of LTX-2 requires multiple high-end GPUs (e.g., 4-8× H100 80GB) and distributed
+> training with FSDP. See [Training Guide](training-guide.md) for multi-GPU setup instructions.
+
+## 🔄 In-Context LoRA (IC-LoRA) Training
+
+IC-LoRA is a specialized training mode for video-to-video transformations.
+Unlike standard training modes that learn from individual videos, IC-LoRA learns transformations from pairs of videos.
+IC-LoRA enables a wide range of advanced video-to-video applications, such as:
+
+- **Control adapters** (e.g., Depth, Pose): Learn to map from a control signal (like a depth map or pose skeleton) to a
+ target video
+- **Video deblurring**: Transform blurry input videos into sharp, high-quality outputs
+- **Style transfer**: Apply the style of a reference video to a target video sequence
+- **Colorization**: Convert grayscale reference videos into colorized outputs
+- **Restoration and enhancement**: Denoise, upscale, or restore old or degraded videos
+
+By providing paired reference and target videos, IC-LoRA can learn complex transformations that go beyond caption-based conditioning.
+
+IC-LoRA training fundamentally differs from standard LoRA and full fine-tuning:
+
+- **Reference videos** provide clean, unnoised conditioning input showing the "before" state
+- **Target videos** are noised during training and represent the desired "after" state
+- **The model learns transformations** from reference videos to target videos
+- **Loss is applied only to the target portion**, not the reference
+- **Training and inference time increase significantly** due to the doubled sequence length
+
+To enable IC-LoRA training, configure your YAML file with:
+
+```yaml
+model:
+ training_mode: "lora" # Required: IC-LoRA uses LoRA mode
+
+training_strategy:
+ name: "video_to_video"
+ first_frame_conditioning_p: 0.1
+ reference_latents_dir: "reference_latents" # Directory for reference video latents
+```
+
+**Example configuration file:**
+
+- 📄 [IC-LoRA Training](../configs/ltx2_v2v_ic_lora.yaml) - Video-to-video transformation training
+
+### Dataset Requirements for IC-LoRA
+
+- Your dataset must contain **paired videos** where each target video has a corresponding reference video
+- Reference and target videos must have **identical resolution and length**
+- Both reference and target videos should be **preprocessed together** using the same resolution buckets
+
+**Dataset structure for IC-LoRA training:**
+
+```
+preprocessed_data_root/
+├── latents/ # Target video latents (what the model learns to generate)
+├── conditions/ # Text embeddings for each video
+└── reference_latents/ # Reference video latents (conditioning input)
+```
+
+### Generating Reference Videos
+
+We provide an example script to generate reference videos (e.g., Canny edge maps) for a given dataset.
+The script takes a JSON file as input (e.g., output of `caption_videos.py`) and updates it with the generated reference
+video paths.
+
+```bash
+uv run python scripts/compute_reference.py scenes_output_dir/ \
+ --output scenes_output_dir/dataset.json
+```
+
+To compute a different condition (depth maps, pose skeletons, etc.), modify the `compute_reference()` function in the
+script.
+
+### Configuration Requirements for IC-LoRA
+
+- You **must** provide `reference_videos` in your validation configuration when using IC-LoRA training
+- The number of reference videos must match the number of validation prompts
+
+Example validation configuration for IC-LoRA:
+
+```yaml
+validation:
+ prompts:
+ - "First prompt describing the desired output"
+ - "Second prompt describing the desired output"
+ reference_videos:
+ - "/path/to/reference1.mp4"
+ - "/path/to/reference2.mp4"
+ include_reference_in_output: true # Show reference side-by-side with output
+```
+
+## 📊 Training Mode Comparison
+
+| Aspect | LoRA | Audio-Video LoRA | Full Fine-tuning | IC-LoRA |
+|----------------------|------------|------------------|------------------|----------------|
+| **Memory Usage** | Low | Low-Medium | High | Medium |
+| **Training Speed** | Fast | Fast | Slow | Medium |
+| **Output Size** | 100MB-few GB (depends on rank) | 100MB-few GB (depends on rank) | Tens of GB | 100MB-few GB (depends on rank) |
+| **Flexibility** | Medium | Medium | High | Specialized |
+| **Audio Support** | Optional | Yes | Optional | No |
+| **Reference Videos** | No | No | No | Yes (required) |
+
+## 🎬 Using Trained Models for Inference
+
+After training, use the [`ltx-pipelines`](../../ltx-pipelines/) package for production inference with your trained LoRAs:
+
+| Training Mode | Recommended Pipeline |
+|---------------|---------------------|
+| LoRA / Audio-Video LoRA | `TI2VidOneStagePipeline` or `TI2VidTwoStagesPipeline` |
+| IC-LoRA | `ICLoraPipeline` |
+
+All pipelines support loading custom LoRAs via the `loras` parameter. See the [`ltx-pipelines`](../../ltx-pipelines/) package
+documentation for detailed usage instructions.
+
+## 🚀 Next Steps
+
+Once you've chosen your training mode:
+
+- Set up your dataset using [Dataset Preparation](dataset-preparation.md)
+- Configure your training parameters in [Configuration Reference](configuration-reference.md)
+- Start training with the [Training Guide](training-guide.md)
+
+> [!TIP]
+> Need a training mode that's not covered here? See [Implementing Custom Training Strategies](custom-training-strategies.md)
+> to learn how to create your own strategy for specialized use cases like video inpainting, audio-only training, or
+> custom conditioning.
diff --git a/packages/ltx-trainer/docs/troubleshooting.md b/packages/ltx-trainer/docs/troubleshooting.md
new file mode 100644
index 0000000..3c61fcb
--- /dev/null
+++ b/packages/ltx-trainer/docs/troubleshooting.md
@@ -0,0 +1,295 @@
+# Troubleshooting Guide
+
+This guide covers common issues and solutions when training with the LTX-2 trainer.
+
+## 🔧 VRAM and Memory Issues
+
+Memory management is crucial for successful training with LTX-2.
+
+### Memory Optimization Techniques
+
+#### 1. Enable Gradient Checkpointing
+
+Gradient checkpointing trades training speed for memory savings. **Highly recommended** for most training runs:
+
+```yaml
+optimization:
+ enable_gradient_checkpointing: true
+```
+
+#### 2. Enable 8-bit Text Encoder
+
+Load the Gemma text encoder in 8-bit precision to save GPU memory:
+
+```yaml
+acceleration:
+ load_text_encoder_in_8bit: true
+```
+
+#### 3. Reduce Batch Size
+
+Lower the batch size if you encounter out-of-memory errors:
+
+```yaml
+optimization:
+ batch_size: 1 # Start with 1 and increase gradually
+```
+
+Use gradient accumulation to maintain a larger effective batch size:
+
+```yaml
+optimization:
+ batch_size: 1
+ gradient_accumulation_steps: 4 # Effective batch size = 4
+```
+
+#### 4. Use Lower Resolution
+
+Reduce spatial or temporal dimensions to save memory:
+
+```bash
+# Smaller spatial resolution
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "512x512x49" \
+ --model-path /path/to/model.safetensors \
+ --text-encoder-path /path/to/gemma
+
+# Fewer frames
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x25" \
+ --model-path /path/to/model.safetensors \
+ --text-encoder-path /path/to/gemma
+```
+
+#### 5. Enable Model Quantization
+
+Use quantization to reduce memory usage:
+
+```yaml
+acceleration:
+ quantization: "int8-quanto" # Options: int8-quanto, int4-quanto, fp8-quanto
+```
+
+#### 6. Use 8-bit Optimizer
+
+The 8-bit AdamW optimizer uses less memory:
+
+```yaml
+optimization:
+ optimizer_type: "adamw8bit"
+```
+
+---
+
+## ⚠️ Common Usage Issues
+
+### Issue: "No module named 'ltx_trainer'" Error
+
+**Solution:**
+Ensure you've installed the dependencies and are using `uv run` to execute scripts:
+
+```bash
+# From the repository root
+uv sync
+cd packages/ltx-trainer
+uv run python scripts/train.py configs/ltx2_av_lora.yaml
+```
+
+> [!TIP]
+> Always use `uv run` to execute Python scripts. This automatically uses the correct virtual environment
+> without requiring manual activation.
+
+### Issue: "Gemma model path is not a directory" Error
+
+**Solution:**
+The `text_encoder_path` must point to a directory containing the Gemma model, not a file:
+
+```yaml
+model:
+ model_path: "/path/to/ltx-2-model.safetensors" # File path
+ text_encoder_path: "/path/to/gemma-model/" # Directory path
+```
+
+### Issue: "Model path does not exist" Error
+
+**Solution:**
+LTX-2 requires local model paths. URLs are not supported:
+
+```yaml
+# ✅ Correct - local path
+model:
+ model_path: "/path/to/ltx-2-model.safetensors"
+
+# ❌ Wrong - URL not supported
+model:
+ model_path: "https://huggingface.co/..."
+```
+
+### Issue: "Frames must satisfy frames % 8 == 1" Error
+
+**Solution:**
+LTX-2 requires the number of frames to satisfy `frames % 8 == 1`:
+
+- ✅ Valid: 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 121
+- ❌ Invalid: 24, 32, 48, 64, 100
+
+### Issue: Slow Training Speed
+
+**Optimizations:**
+
+1. **Disable gradient checkpointing** (if you have enough VRAM):
+
+ ```yaml
+ optimization:
+ enable_gradient_checkpointing: false
+ ```
+
+
+2. **Use torch.compile** via Accelerate:
+
+ ```bash
+ uv run accelerate launch --config_file configs/accelerate/ddp_compile.yaml \
+ scripts/train.py configs/ltx2_av_lora.yaml
+ ```
+
+### Issue: Poor Quality Validation Outputs
+
+**Solutions:**
+
+1. **Use Image-to-Video Validation:**
+ For more reliable validation, use image-to-video (first-frame conditioning) rather than pure text-to-video:
+
+ ```yaml
+ validation:
+ prompts:
+ - "a professional portrait video of a person"
+ images:
+ - "/path/to/first_frame.png" # One image per prompt
+ ```
+
+2. **Increase inference steps:**
+
+ ```yaml
+ validation:
+ inference_steps: 50 # Default is 30
+ ```
+
+3. **Adjust guidance settings:**
+
+ ```yaml
+ validation:
+ guidance_scale: 4.0 # CFG scale (recommended: 4.0)
+ stg_scale: 1.0 # STG scale for temporal coherence (recommended: 1.0)
+ stg_blocks: [29] # Transformer block to perturb
+ ```
+
+4. **Check caption quality:**
+ Review and manually edit captions for accuracy if using auto-generated captions.
+ LTX-2 prefers long, detailed captions that describe both visual content and audio (e.g., ambient sounds, speech,
+ music).
+
+5. **Check target modules:**
+ Ensure your `target_modules` configuration matches your training goals. For audio-video training,
+ use patterns that match both branches (e.g., `"to_k"` instead of `"attn1.to_k"`).
+ See [Understanding Target Modules](configuration-reference.md#understanding-target-modules) for details.
+
+6. **Adjust LoRA rank:**
+ Try higher values for more capacity:
+
+ ```yaml
+ lora:
+ rank: 64 # Or 128 for more capacity
+ ```
+
+7. **Increase training steps:**
+
+ ```yaml
+ optimization:
+ steps: 3000
+ ```
+
+---
+
+## 🔍 Debugging Tools
+
+### Monitor GPU Memory Usage
+
+Track memory usage during training:
+
+```bash
+# Watch GPU memory in real-time
+watch -n 1 nvidia-smi
+
+# Log memory usage to file
+nvidia-smi --query-gpu=memory.used,memory.total --format=csv --loop=5 > memory_log.csv
+```
+
+### Verify Preprocessed Data
+
+Decode latents to visualize the preprocessed videos:
+
+```bash
+uv run python scripts/decode_latents.py dataset/.precomputed/latents debug_output \
+ --model-path /path/to/model.safetensors
+```
+
+To also decode audio latents, add the `--with-audio` flag:
+
+```bash
+uv run python scripts/decode_latents.py dataset/.precomputed/latents debug_output \
+ --model-path /path/to/model.safetensors \
+ --with-audio
+```
+
+Compare decoded videos and audio with originals to ensure quality.
+
+---
+
+## 💡 Best Practices
+
+### Before Training
+
+- [ ] Test preprocessing with a small subset first
+- [ ] Verify all video files are accessible
+- [ ] Check available GPU memory
+- [ ] Review configuration against hardware capabilities
+- [ ] Ensure model and text encoder paths are correct
+
+### During Training
+
+- [ ] Monitor GPU memory usage
+- [ ] Check loss convergence regularly
+- [ ] Review validation samples periodically
+- [ ] Save checkpoints frequently
+
+### After Training
+
+- [ ] Test trained model with diverse prompts
+- [ ] Document training parameters and results
+- [ ] Archive training data and configs
+
+## 🆘 Getting Help
+
+If you're still experiencing issues:
+
+1. **Check logs:** Review console output for error details
+2. **Search issues:** Look through GitHub issues for similar problems
+3. **Provide details:** When reporting issues, include:
+ - Hardware specifications (GPU model, VRAM)
+ - Configuration file used
+ - Complete error message
+ - Steps to reproduce the issue
+
+---
+
+## 🤝 Join the Community
+
+Have questions, want to share your results, or need real-time help?
+Join our [community Discord server](https://discord.gg/ltxplatform)
+to connect with other users and the development team!
+
+- Get troubleshooting help
+- Share your training results and workflows
+- Stay up to date with announcements and updates
+
+We look forward to seeing you there!
diff --git a/packages/ltx-trainer/docs/utility-scripts.md b/packages/ltx-trainer/docs/utility-scripts.md
new file mode 100644
index 0000000..48617ff
--- /dev/null
+++ b/packages/ltx-trainer/docs/utility-scripts.md
@@ -0,0 +1,274 @@
+# Utility Scripts Reference
+
+This guide covers the various utility scripts available for preprocessing, conversion, and debugging tasks.
+
+## 🎬 Dataset Processing Scripts
+
+### Video Scene Splitting
+
+The `scripts/split_scenes.py` script automatically splits long videos into shorter, coherent scenes.
+
+```bash
+# Basic scene splitting
+uv run python scripts/split_scenes.py input.mp4 output_dir/ --filter-shorter-than 5s
+```
+
+**Key features:**
+
+- **Automatic scene detection**: Uses PySceneDetect for intelligent splitting
+- **Multiple algorithms**: Content-based, adaptive, threshold, and histogram detection
+- **Filtering options**: Remove scenes shorter than specified duration
+- **Customizable parameters**: Thresholds, window sizes, and detection modes
+
+**Common options:**
+
+```bash
+# See all available options
+uv run python scripts/split_scenes.py --help
+
+# Use adaptive detection with custom threshold
+uv run python scripts/split_scenes.py video.mp4 scenes/ --detector adaptive --threshold 30.0
+
+# Limit to maximum number of scenes
+uv run python scripts/split_scenes.py video.mp4 scenes/ --max-scenes 50
+```
+
+### Automatic Video Captioning
+
+The `scripts/caption_videos.py` script generates captions for videos (with audio) using multimodal models.
+
+```bash
+# Generate captions for all videos in a directory (uses Qwen2.5-Omni by default)
+uv run python scripts/caption_videos.py videos_dir/ --output dataset.json
+
+# Use 8-bit quantization to reduce VRAM usage
+uv run python scripts/caption_videos.py videos_dir/ --output dataset.json --use-8bit
+
+# Use Gemini Flash API instead (requires API key)
+uv run python scripts/caption_videos.py videos_dir/ --output dataset.json \
+ --captioner-type gemini_flash --api-key YOUR_API_KEY
+
+# Caption without audio processing (video-only)
+uv run python scripts/caption_videos.py videos_dir/ --output dataset.json --no-audio
+
+# Force re-caption all files
+uv run python scripts/caption_videos.py videos_dir/ --output dataset.json --override
+```
+
+**Key features:**
+
+- **Audio-visual captioning**: Processes both video and audio content, including speech transcription
+- **Multiple backends**:
+ - `qwen_omni` (default): Local Qwen2.5-Omni model - processes video + audio locally
+ - `gemini_flash`: Google Gemini Flash API - cloud-based, requires API key
+- **Structured output**: Captions include visual description, speech transcription, sounds, and on-screen text
+- **Memory optimization**: 8-bit quantization option for limited VRAM
+- **Incremental processing**: Skips already-captioned files by default
+- **Multiple output formats**: JSON, JSONL, CSV, or TXT
+
+**Caption format:**
+
+The captioner produces structured captions with four sections:
+- `[VISUAL]`: Detailed description of visual content
+- `[SPEECH]`: Word-for-word transcription of spoken content
+- `[SOUNDS]`: Description of music, ambient sounds, sound effects
+- `[TEXT]`: Any on-screen text visible in the video
+
+**Environment variables (for Gemini Flash):**
+
+Set one of these to use Gemini Flash without passing `--api-key`:
+- `GOOGLE_API_KEY`
+- `GEMINI_API_KEY`
+
+### Dataset Preprocessing
+
+The `scripts/process_dataset.py` script processes videos and caches latents for training.
+
+```bash
+# Basic preprocessing
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model
+
+# With audio processing
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model \
+ --with-audio
+
+# With video decoding for verification
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model \
+ --decode
+```
+
+Multiple resolution buckets can be specified, separated by `;`:
+
+```bash
+uv run python scripts/process_dataset.py dataset.json \
+ --resolution-buckets "960x544x49;512x512x81" \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --text-encoder-path /path/to/gemma-model
+```
+
+> [!NOTE]
+> When training with multiple resolution buckets, set `optimization.batch_size: 1`.
+
+For detailed usage, see the [Dataset Preparation Guide](dataset-preparation.md).
+
+### Reference Video Generation
+
+The `scripts/compute_reference.py` script provides a template for creating reference videos needed for IC-LoRA training.
+The default implementation generates Canny edge reference videos.
+
+```bash
+# Generate Canny edge reference videos
+uv run python scripts/compute_reference.py videos_dir/ --output dataset.json
+```
+
+**Key features:**
+
+- **Canny edge detection**: Creates edge-based reference videos
+- **In-place editing**: Updates existing dataset JSON files
+- **Customizable**: Modify the `compute_reference()` function for different conditions (depth, pose, etc.)
+
+> [!TIP]
+> You can edit this script to generate other types of reference videos for IC-LoRA training,
+> such as depth maps, segmentation masks, or any custom video transformation.
+
+## 🔍 Debugging and Verification Scripts
+
+### Latents Decoding
+
+The `scripts/decode_latents.py` script decodes precomputed video latents back into video files for visual inspection.
+
+```bash
+# Basic usage
+uv run python scripts/decode_latents.py /path/to/latents/dir \
+ --output-dir /path/to/output \
+ --model-path /path/to/ltx-2-model.safetensors
+
+# With VAE tiling for large videos
+uv run python scripts/decode_latents.py /path/to/latents/dir \
+ --output-dir /path/to/output \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --vae-tiling
+
+# Decode both video and audio latents
+uv run python scripts/decode_latents.py /path/to/latents/dir \
+ --output-dir /path/to/output \
+ --model-path /path/to/ltx-2-model.safetensors \
+ --with-audio
+```
+
+**The script will:**
+
+1. **Load the VAE model** from the specified path
+2. **Process all `.pt` latent files** in the input directory
+3. **Decode each latent** back into a video using the VAE
+4. **Save resulting videos** as MP4 files in the output directory
+
+**When to use:**
+
+- **Verify preprocessing quality**: Check that your videos were encoded correctly
+- **Debug training data**: Visualize what the model actually sees during training
+- **Quality assessment**: Ensure latent encoding preserves important visual details
+
+
+### Inference Script
+
+The `scripts/inference.py` script runs inference with a trained model.
+
+> [!TIP]
+> For production inference, consider using the [`ltx-pipelines`](../../ltx-pipelines/) package which provides optimized,
+> feature-rich pipelines for various use cases:
+> - **Text/Image-to-Video**: `TI2VidOneStagePipeline`, `TI2VidTwoStagesPipeline`
+> - **Distilled (fast) inference**: `DistilledPipeline`
+> - **IC-LoRA video-to-video**: `ICLoraPipeline`
+> - **Keyframe interpolation**: `KeyframeInterpolationPipeline`
+>
+> All pipelines support loading custom LoRAs trained with this trainer.
+
+```bash
+# Text-to-video inference (with audio by default)
+# By default, uses CFG scale 4.0 and STG scale 1.0 with block 29
+uv run python scripts/inference.py \
+ --checkpoint /path/to/model.safetensors \
+ --text-encoder-path /path/to/gemma \
+ --prompt "A cat playing with a ball" \
+ --output output.mp4
+
+# Video-only (skip audio generation)
+uv run python scripts/inference.py \
+ --checkpoint /path/to/model.safetensors \
+ --text-encoder-path /path/to/gemma \
+ --prompt "A cat playing with a ball" \
+ --skip-audio \
+ --output output.mp4
+
+# Image-to-video with conditioning image
+uv run python scripts/inference.py \
+ --checkpoint /path/to/model.safetensors \
+ --text-encoder-path /path/to/gemma \
+ --prompt "A cat walking" \
+ --condition-image first_frame.png \
+ --output output.mp4
+
+# Custom guidance settings
+uv run python scripts/inference.py \
+ --checkpoint /path/to/model.safetensors \
+ --text-encoder-path /path/to/gemma \
+ --prompt "A cat playing with a ball" \
+ --guidance-scale 4.0 \
+ --stg-scale 1.0 \
+ --stg-blocks 29 \
+ --output output.mp4
+
+# Disable STG (CFG only)
+uv run python scripts/inference.py \
+ --checkpoint /path/to/model.safetensors \
+ --text-encoder-path /path/to/gemma \
+ --prompt "A cat playing with a ball" \
+ --stg-scale 0.0 \
+ --output output.mp4
+```
+
+**Guidance parameters:**
+
+| Parameter | Default | Description |
+|-----------|---------|-------------|
+| `--guidance-scale` | 4.0 | CFG (Classifier-Free Guidance) scale |
+| `--stg-scale` | 1.0 | STG (Spatio-Temporal Guidance) scale. 0.0 disables STG |
+| `--stg-blocks` | 29 | Transformer block(s) to perturb for STG |
+| `--stg-mode` | stg_av | `stg_av` perturbs both audio and video, `stg_v` video only |
+
+## 🚀 Training Scripts
+
+### Basic and Distributed Training
+
+Use `scripts/train.py` for both single GPU and multi-GPU runs:
+
+```bash
+# Single-GPU training
+uv run python scripts/train.py configs/ltx2_av_lora.yaml
+
+# Multi-GPU (uses your accelerate config)
+uv run accelerate launch scripts/train.py configs/ltx2_av_lora.yaml
+
+# Override number of processes
+uv run accelerate launch --num_processes 4 scripts/train.py configs/ltx2_av_lora.yaml
+```
+
+For detailed usage, see the [Training Guide](training-guide.md).
+
+## 💡 Tips for Using Utility Scripts
+
+- **Start with `--help`**: Always check available options for each script
+- **Test on small datasets**: Verify workflows with a few files before processing large datasets
+- **Use decode verification**: Always decode a few samples to verify preprocessing quality
+- **Monitor VRAM usage**: Use `--use-8bit` or quantization flags when running into memory issues
+- **Keep backups**: Make copies of important dataset files before running conversion scripts
diff --git a/packages/ltx-trainer/pyproject.toml b/packages/ltx-trainer/pyproject.toml
new file mode 100644
index 0000000..19735d3
--- /dev/null
+++ b/packages/ltx-trainer/pyproject.toml
@@ -0,0 +1,89 @@
+[project]
+name = "ltx-trainer"
+version = "1.0.0"
+description = "LTX-2 training, democratized."
+readme = "README.md"
+authors = [
+ { name = "Matan Ben-Yosef", email = "[email protected]" }
+]
+requires-python = ">=3.10"
+dependencies = [
+ "ltx-core",
+ "accelerate>=1.2.1",
+ "av>=14.2.1",
+ "bitsandbytes >=0.45.2; sys_platform == 'linux'",
+ "huggingface-hub[hf-xet]>=0.31.4",
+ "imageio>=2.37.0",
+ "imageio-ffmpeg>=0.6.0",
+ "opencv-python>=4.11.0.86",
+ "optimum-quanto>=0.2.6",
+ "pandas>=2.2.3",
+ "peft>=0.14.0",
+ "pillow-heif>=0.21.0",
+ "pydantic>=2.10.4",
+ "rich>=13.9.4",
+ "safetensors>=0.5.0",
+ "scenedetect>=0.6.5.2",
+ "sentencepiece>=0.2.0",
+ "torch>=2.6.0",
+ "torchaudio>=2.9.0",
+ "torchcodec>=0.8.1",
+ "torchvision>=0.21.0",
+ "typer>=0.15.1",
+ "wandb>=0.19.11",
+ "setuptools>=80.9.0",
+]
+
+[dependency-groups]
+dev = [
+ "pre-commit>=4.0.1",
+ "ruff>=0.8.6",
+]
+
+
+[build-system]
+requires = ["hatchling"]
+build-backend = "hatchling.build"
+
+
+
+[tool.ruff]
+target-version = "1.0.0"
+line-length = 120
+
+[tool.ruff.lint]
+select = [
+ "E", # pycodestyle
+ "F", # pyflakes
+ "W", # pycodestyle (warnings)
+ "I", # isort
+ "N", # pep8-naming
+ "ANN", # flake8-annotations
+ "B", # flake8-bugbear
+ "A", # flake8-builtins
+ "COM", # flake8-commas
+ "C4", # flake8-comprehensions
+ "DTZ", # flake8-datetimez
+ "EXE", # flake8-executable
+ "PIE", # flake8-pie
+ "T20", # flake8-print
+ "PT", # flake8-pytest
+ "SIM", # flake8-simplify
+ "ARG", # flake8-unused-arguments
+ "PTH", # flake8--use-pathlib
+ "ERA", # flake8-eradicate
+ "RUF", # ruff specific rules
+ "PL", # pylint
+]
+ignore = [
+ "ANN002", # Missing type annotation for *args
+ "ANN003", # Missing type annotation for **kwargs
+ "ANN204", # Missing type annotation for special method
+ "COM812", # Missing trailing comma
+ "PTH123", # `open()` should be replaced by `Path.open()`
+ "PLR2004", # Magic value used in comparison, consider replacing with a constant variable
+]
+[tool.ruff.lint.pylint]
+max-args = 10
+[tool.ruff.lint.isort]
+known-first-party = ["ltx_trainer", "ltx_core", "ltx_pipelines"]
diff --git a/packages/ltx-trainer/scripts/caption_videos.py b/packages/ltx-trainer/scripts/caption_videos.py
new file mode 100755
index 0000000..b8898ef
--- /dev/null
+++ b/packages/ltx-trainer/scripts/caption_videos.py
@@ -0,0 +1,486 @@
+#!/usr/bin/env python3
+
+"""
+Auto-caption videos with audio using multimodal models.
+This script provides a command-line interface for generating captions for videos
+(including audio) using multimodal models. It supports:
+- Qwen2.5-Omni: Local model for audio-visual captioning (default)
+- Gemini Flash: Cloud-based API for audio-visual captioning
+The paths to videos in the generated dataset/captions file will be RELATIVE to the
+directory where the output file is stored. This makes the dataset more portable and
+easier to use in different environments.
+Basic usage:
+ # Caption a single video (includes audio by default)
+ caption_videos.py video.mp4 --output captions.json
+ # Caption all videos in a directory
+ caption_videos.py videos_dir/ --output captions.csv
+ # Caption with custom instruction
+ caption_videos.py video.mp4 --instruction "Describe what happens in this video in detail."
+Advanced usage:
+ # Use Gemini Flash API (requires GEMINI_API_KEY or GOOGLE_API_KEY env var)
+ caption_videos.py videos_dir/ --captioner-type gemini_flash
+ # Disable audio processing (video-only captions)
+ caption_videos.py videos_dir/ --no-audio
+ # Process videos with specific extensions and save as JSON
+ caption_videos.py videos_dir/ --extensions mp4,mov,avi --output captions.json
+"""
+
+import csv
+import json
+from enum import Enum
+from pathlib import Path
+
+import torch
+import typer
+from rich.console import Console
+from rich.progress import (
+ BarColumn,
+ MofNCompleteColumn,
+ Progress,
+ SpinnerColumn,
+ TextColumn,
+ TimeElapsedColumn,
+ TimeRemainingColumn,
+)
+from transformers.utils.logging import disable_progress_bar
+
+from ltx_trainer.captioning import CaptionerType, MediaCaptioningModel, create_captioner
+
+VIDEO_EXTENSIONS = ["mp4", "avi", "mov", "mkv", "webm"]
+IMAGE_EXTENSIONS = ["jpg", "jpeg", "png"]
+MEDIA_EXTENSIONS = VIDEO_EXTENSIONS + IMAGE_EXTENSIONS
+SAVE_INTERVAL = 5
+
+console = Console()
+app = typer.Typer(
+ pretty_exceptions_enable=False,
+ no_args_is_help=True,
+ help="Auto-caption videos with audio using multimodal models.",
+)
+
+disable_progress_bar()
+
+
+class OutputFormat(str, Enum):
+ """Available output formats for captions."""
+
+ TXT = "txt" # Separate files for captions and video paths, one caption / video path per line
+ CSV = "csv" # CSV file with video path and caption columns
+ JSON = "json" # JSON file with video paths as keys and captions as values
+ JSONL = "jsonl" # JSON Lines file with one JSON object per line
+
+
+def caption_media(
+ input_path: Path,
+ output_path: Path,
+ captioner: MediaCaptioningModel,
+ extensions: list[str],
+ recursive: bool,
+ fps: int,
+ include_audio: bool,
+ clean_caption: bool,
+ output_format: OutputFormat,
+ override: bool,
+) -> None:
+ """Caption videos and images using the provided captioning model.
+ Args:
+ input_path: Path to input video file or directory
+ output_path: Path to output caption file
+ captioner: Media captioning model
+ extensions: List of media file extensions to include
+ recursive: Whether to search subdirectories recursively
+ fps: Frames per second to sample from videos (ignored for images)
+ include_audio: Whether to include audio in captioning
+ clean_caption: Whether to clean up captions
+ output_format: Format to save the captions in
+ override: Whether to override existing captions
+ """
+
+ # Get list of media files to process
+ media_files = _get_media_files(input_path, extensions, recursive)
+
+ if not media_files:
+ console.print("[bold yellow]No media files found to process.[/]")
+ return
+
+ console.print(f"Found [bold]{len(media_files)}[/] media files to process.")
+
+ # Load existing captions and determine which files need processing
+ base_dir = output_path.parent.resolve()
+ existing_captions = _load_existing_captions(output_path, output_format)
+ existing_abs_paths = {str((base_dir / p).resolve()) for p in existing_captions}
+
+ if override:
+ media_to_process = media_files
+ else:
+ media_to_process = [f for f in media_files if str(f.resolve()) not in existing_abs_paths]
+ if skipped := len(media_files) - len(media_to_process):
+ console.print(f"[bold yellow]Skipping {skipped} media that already have captions.[/]")
+
+ if not media_to_process:
+ console.print("[bold yellow]All media already have captions. Use --override to recaption.[/]")
+ return
+
+ # Process media files
+ captions = existing_captions.copy()
+ successfully_captioned = 0
+ progress = Progress(
+ SpinnerColumn(),
+ TextColumn("{task.description}"),
+ BarColumn(bar_width=40),
+ MofNCompleteColumn(),
+ TimeElapsedColumn(),
+ TextColumn("•"),
+ TimeRemainingColumn(),
+ console=console,
+ )
+
+ with progress:
+ task = progress.add_task("Captioning", total=len(media_to_process))
+
+ for i, media_file in enumerate(media_to_process):
+ progress.update(task, description=f"Captioning [bold blue]{media_file.name}[/]")
+
+ try:
+ # Generate caption for the media
+ caption = captioner.caption(
+ path=media_file,
+ fps=fps,
+ include_audio=include_audio,
+ clean_caption=clean_caption,
+ )
+
+ # Convert absolute path to relative path (relative to the output file's directory)
+ rel_path = str(media_file.resolve().relative_to(base_dir))
+ # Store the caption with the relative path as key
+ captions[rel_path] = caption
+ successfully_captioned += 1
+ except Exception as e:
+ console.print(f"[bold red]Error captioning {media_file}: {e}[/]")
+
+ if i % SAVE_INTERVAL == 0:
+ _save_captions(captions, output_path, output_format)
+
+ # Advance progress bar
+ progress.advance(task)
+
+ # Save captions to file
+ _save_captions(captions, output_path, output_format)
+
+ # Print summary
+ console.print(
+ f"[bold green]✓[/] Captioned [bold]{successfully_captioned}/{len(media_to_process)}[/] media successfully.",
+ )
+
+
+def _get_media_files(
+ input_path: Path,
+ extensions: list[str] = MEDIA_EXTENSIONS,
+ recursive: bool = False,
+) -> list[Path]:
+ """Get all media files from the input path."""
+ input_path = Path(input_path)
+ # Normalize extensions to lowercase without dots
+ extensions_set = {ext.lower().lstrip(".") for ext in extensions}
+
+ if input_path.is_file():
+ # If input is a file, check if it has a valid extension
+ if input_path.suffix.lstrip(".").lower() in extensions_set:
+ return [input_path]
+ else:
+ typer.echo(f"Warning: {input_path} is not a recognized media file. Skipping.")
+ return []
+ elif input_path.is_dir():
+ # Find all files and filter by extension case-insensitively
+ glob_pattern = "**/*" if recursive else "*"
+ media_files = [
+ f for f in input_path.glob(glob_pattern) if f.is_file() and f.suffix.lstrip(".").lower() in extensions_set
+ ]
+ return sorted(media_files)
+ else:
+ typer.echo(f"Error: {input_path} does not exist.")
+ raise typer.Exit(code=1)
+
+
+def _save_captions(
+ captions: dict[str, str],
+ output_path: Path,
+ format_type: OutputFormat,
+) -> None:
+ """Save captions to a file in the specified format.
+ Args:
+ captions: Dictionary mapping media paths to captions
+ output_path: Path to save the output file
+ format_type: Format to save the captions in
+ """
+ # Create parent directories if they don't exist
+ output_path.parent.mkdir(parents=True, exist_ok=True)
+
+ console.print("[bold blue]Saving captions...[/]")
+
+ match format_type:
+ case OutputFormat.TXT:
+ # Create two separate files for captions and media paths
+ captions_file = output_path.with_stem(f"{output_path.stem}_captions")
+ paths_file = output_path.with_stem(f"{output_path.stem}_paths")
+
+ with captions_file.open("w", encoding="utf-8") as f:
+ for caption in captions.values():
+ f.write(f"{caption}\n")
+
+ with paths_file.open("w", encoding="utf-8") as f:
+ for media_path in captions:
+ f.write(f"{media_path}\n")
+
+ console.print(f"[bold green]✓[/] Captions saved to [cyan]{captions_file}[/]")
+ console.print(f"[bold green]✓[/] Media paths saved to [cyan]{paths_file}[/]")
+
+ case OutputFormat.CSV:
+ with output_path.open("w", encoding="utf-8", newline="") as f:
+ writer = csv.writer(f)
+ writer.writerow(["caption", "media_path"])
+ for media_path, caption in captions.items():
+ writer.writerow([caption, media_path])
+
+ console.print(f"[bold green]✓[/] Captions saved to [cyan]{output_path}[/]")
+
+ case OutputFormat.JSON:
+ # Format as list of dictionaries with caption and media_path keys
+ json_data = [{"caption": caption, "media_path": media_path} for media_path, caption in captions.items()]
+
+ with output_path.open("w", encoding="utf-8") as f:
+ json.dump(json_data, f, indent=2, ensure_ascii=False)
+
+ console.print(f"[bold green]✓[/] Captions saved to [cyan]{output_path}[/]")
+
+ case OutputFormat.JSONL:
+ with output_path.open("w", encoding="utf-8") as f:
+ for media_path, caption in captions.items():
+ f.write(json.dumps({"caption": caption, "media_path": media_path}, ensure_ascii=False) + "\n")
+
+ console.print(f"[bold green]✓[/] Captions saved to [cyan]{output_path}[/]")
+
+ case _:
+ raise ValueError(f"Unsupported output format: {format_type}")
+
+
+def _load_existing_captions( # noqa: PLR0912
+ output_path: Path,
+ format_type: OutputFormat,
+) -> dict[str, str]:
+ """Load existing captions from a file.
+ Args:
+ output_path: Path to the captions file
+ format_type: Format of the captions file
+ Returns:
+ Dictionary mapping media paths to captions, or empty dict if file doesn't exist
+ """
+ if not output_path.exists():
+ return {}
+
+ console.print(f"[bold blue]Loading existing captions from [cyan]{output_path}[/]...[/]")
+
+ existing_captions = {}
+
+ try:
+ match format_type:
+ case OutputFormat.TXT:
+ # For TXT format, we have two separate files
+ captions_file = output_path.with_stem(f"{output_path.stem}_captions")
+ paths_file = output_path.with_stem(f"{output_path.stem}_paths")
+
+ if captions_file.exists() and paths_file.exists():
+ captions = captions_file.read_text(encoding="utf-8").splitlines()
+ paths = paths_file.read_text(encoding="utf-8").splitlines()
+
+ if len(captions) == len(paths):
+ existing_captions = dict(zip(paths, captions, strict=False))
+
+ case OutputFormat.CSV:
+ with output_path.open("r", encoding="utf-8", newline="") as f:
+ reader = csv.reader(f)
+ # Skip header
+ next(reader, None)
+ for row in reader:
+ if len(row) >= 2:
+ caption, media_path = row[0], row[1]
+ existing_captions[media_path] = caption
+
+ case OutputFormat.JSON:
+ with output_path.open("r", encoding="utf-8") as f:
+ json_data = json.load(f)
+ for item in json_data:
+ if "caption" in item and "media_path" in item:
+ existing_captions[item["media_path"]] = item["caption"]
+
+ case OutputFormat.JSONL:
+ with output_path.open("r", encoding="utf-8") as f:
+ for line in f:
+ item = json.loads(line)
+ if "caption" in item and "media_path" in item:
+ existing_captions[item["media_path"]] = item["caption"]
+
+ case _:
+ raise ValueError(f"Unsupported output format: {format_type}")
+
+ console.print(f"[bold green]✓[/] Loaded [bold]{len(existing_captions)}[/] existing captions")
+ return existing_captions
+
+ except Exception as e:
+ console.print(f"[bold yellow]Warning: Could not load existing captions: {e}[/]")
+ return {}
+
+
+def main( # noqa: PLR0913
+ input_path: Path = typer.Argument( # noqa: B008
+ ...,
+ help="Path to input video/image file or directory containing media files",
+ exists=True,
+ ),
+ output: Path | None = typer.Option( # noqa: B008
+ None,
+ "--output",
+ "-o",
+ help="Path to output file for captions. Format determined by file extension.",
+ ),
+ captioner_type: CaptionerType = typer.Option( # noqa: B008
+ CaptionerType.QWEN_OMNI,
+ "--captioner-type",
+ "-c",
+ help="Type of captioner to use. Valid values: 'qwen_omni' (local), 'gemini_flash' (API)",
+ case_sensitive=False,
+ ),
+ device: str | None = typer.Option(
+ None,
+ "--device",
+ "-d",
+ help="Device to use for inference (e.g., 'cuda', 'cuda:0', 'cpu'). Only for local models.",
+ ),
+ use_8bit: bool = typer.Option(
+ False,
+ "--use-8bit",
+ help="Whether to use 8-bit precision for the captioning model (reduces memory usage)",
+ ),
+ instruction: str | None = typer.Option(
+ None,
+ "--instruction",
+ "-i",
+ help="Custom instruction for the captioning model. If not provided, uses an appropriate default.",
+ ),
+ extensions: str = typer.Option(
+ ",".join(MEDIA_EXTENSIONS),
+ "--extensions",
+ "-e",
+ help="Comma-separated list of media file extensions to process",
+ ),
+ recursive: bool = typer.Option(
+ False,
+ "--recursive",
+ "-r",
+ help="Search for media files in subdirectories recursively",
+ ),
+ fps: int = typer.Option(
+ 3,
+ "--fps",
+ "-f",
+ help="Frames per second to sample from videos (ignored for images)",
+ ),
+ include_audio: bool = typer.Option(
+ True,
+ "--audio/--no-audio",
+ help="Whether to include audio in captioning (for videos with audio tracks)",
+ ),
+ clean_caption: bool = typer.Option(
+ True,
+ "--clean-caption/--raw-caption",
+ help="Whether to clean up captions by removing common VLM patterns",
+ ),
+ override: bool = typer.Option(
+ False,
+ "--override",
+ help="Whether to override existing captions for media",
+ ),
+ api_key: str | None = typer.Option(
+ None,
+ "--api-key",
+ envvar=["GOOGLE_API_KEY", "GEMINI_API_KEY"],
+ help="API key for Gemini Flash (can also use GOOGLE_API_KEY or GEMINI_API_KEY env var)",
+ ),
+) -> None:
+ """Auto-caption videos with audio using multimodal models.
+ This script supports audio-visual captioning using:
+ - Qwen2.5-Omni: Local model (default) - processes both video and audio
+ - Gemini Flash: Cloud API - requires GOOGLE_API_KEY environment variable
+ The paths in the output file will be relative to the output file's directory.
+ Examples:
+ # Caption videos with audio using Qwen2.5-Omni (default)
+ caption_videos.py videos_dir/ -o captions.json
+ # Caption using Gemini Flash API
+ caption_videos.py videos_dir/ -o captions.json -c gemini_flash
+ # Caption without audio (video-only)
+ caption_videos.py videos_dir/ -o captions.json --no-audio
+ # Caption with custom instruction
+ caption_videos.py video.mp4 -o captions.json -i "Describe this video in detail"
+ """
+
+ # Determine device for local models
+ device_str = device or ("cuda" if torch.cuda.is_available() else "cpu")
+
+ # Parse extensions
+ ext_list = [ext.strip() for ext in extensions.split(",")]
+
+ # Determine output path and format
+ if output is None:
+ output_format = OutputFormat.JSON
+ if input_path.is_file(): # noqa: SIM108
+ # Default to a JSON file with the same name as the input media
+ output = input_path.with_suffix(".dataset.json")
+ else:
+ # Default to a JSON file in the input directory
+ output = input_path / "dataset.json"
+ else:
+ # Determine format from file extension
+ output_format = OutputFormat(Path(output).suffix.lstrip(".").lower())
+
+ # Ensure output path is absolute
+ output = Path(output).resolve()
+ console.print(f"Output will be saved to [bold blue]{output}[/]")
+
+ # Initialize captioning model
+ with console.status("Loading captioning model...", spinner="dots"):
+ if captioner_type == CaptionerType.QWEN_OMNI:
+ captioner = create_captioner(
+ captioner_type=captioner_type,
+ device=device_str,
+ use_8bit=use_8bit,
+ instruction=instruction,
+ )
+ elif captioner_type == CaptionerType.GEMINI_FLASH:
+ captioner = create_captioner(
+ captioner_type=captioner_type,
+ api_key=api_key,
+ instruction=instruction,
+ )
+ else:
+ raise ValueError(f"Unsupported captioner type: {captioner_type}")
+
+ console.print(f"[bold green]✓[/] {captioner_type.value} captioning model loaded successfully")
+
+ # Caption media files
+ caption_media(
+ input_path=input_path,
+ output_path=output,
+ captioner=captioner,
+ extensions=ext_list,
+ recursive=recursive,
+ fps=fps,
+ include_audio=include_audio,
+ clean_caption=clean_caption,
+ output_format=output_format,
+ override=override,
+ )
+
+
+if __name__ == "__main__":
+ app()
diff --git a/packages/ltx-trainer/scripts/compute_reference.py b/packages/ltx-trainer/scripts/compute_reference.py
new file mode 100644
index 0000000..a3ad007
--- /dev/null
+++ b/packages/ltx-trainer/scripts/compute_reference.py
@@ -0,0 +1,288 @@
+"""
+Compute reference videos for IC-LoRA training.
+This script provides a command-line interface for generating reference videos to be used for IC-LoRA training.
+Note that it reads and writes to the same file (the output of caption_videos.py),
+where it adds the "reference_path" field to the JSON.
+Basic usage:
+ # Compute reference videos for all videos in a directory
+ compute_reference.py videos_dir/ --output videos_dir/captions.json
+"""
+
+# Standard library imports
+import json
+from pathlib import Path
+from typing import Dict
+
+# Third-party imports
+import cv2
+import torch
+import torchvision.transforms.functional as TF # noqa: N812
+import typer
+from rich.console import Console
+from rich.progress import (
+ BarColumn,
+ MofNCompleteColumn,
+ Progress,
+ SpinnerColumn,
+ TextColumn,
+ TimeElapsedColumn,
+ TimeRemainingColumn,
+)
+from transformers.utils.logging import disable_progress_bar
+
+# Local imports
+from ltx_trainer.video_utils import read_video, save_video
+
+# Initialize console and disable progress bars
+console = Console()
+disable_progress_bar()
+
+
+def compute_reference(
+ images: torch.Tensor,
+) -> torch.Tensor:
+ """Compute Canny edge detection on a batch of images.
+ Args:
+ images: Batch of images tensor of shape [B, C, H, W]
+ Returns:
+ Binary edge masks tensor of shape [B, H, W]
+ """
+ # Convert to grayscale if needed
+ if images.shape[1] == 3:
+ images = TF.rgb_to_grayscale(images)
+
+ # Ensure images are in [0, 1] range
+ if images.max() > 1.0:
+ images = images / 255.0
+
+ # Compute Canny edges
+ edge_masks = []
+ for image in images:
+ # Convert to numpy for OpenCV
+ image_np = (image.squeeze().cpu().numpy() * 255).astype("uint8")
+
+ # Apply Canny edge detection
+ edges = cv2.Canny(
+ image_np,
+ threshold1=100,
+ threshold2=200,
+ )
+
+ # Convert back to tensor
+ edge_mask = torch.from_numpy(edges).float()
+ edge_masks.append(edge_mask)
+
+ edges = torch.stack(edge_masks)
+ edges = torch.stack([edges] * 3, dim=1) # Convert to 3-channel
+ return edges
+
+
+def _get_meta_data(
+ output_path: Path,
+) -> Dict[str, str]:
+ """Get set of existing reference video paths without loading the actual files.
+ Args:
+ output_path: Path to the reference video paths file
+ Returns:
+ Dictionary mapping media paths to reference video paths
+ """
+ if not output_path.exists():
+ return {}
+
+ console.print(f"[bold blue]Reading meta data from [cyan]{output_path}[/]...[/]")
+
+ try:
+ with output_path.open("r", encoding="utf-8") as f:
+ json_data = json.load(f)
+ return json_data
+
+ except Exception as e:
+ console.print(f"[bold yellow]Warning: Could not check meta data: {e}[/]")
+ return {}
+
+
+def _save_dataset_json(
+ reference_paths: Dict[str, str],
+ output_path: Path,
+) -> None:
+ """Save dataset json with reference video paths.
+ Args:
+ reference_paths: Dictionary mapping media paths to reference video paths
+ output_path: Path to save the output file
+ """
+
+ with output_path.open("r", encoding="utf-8") as f:
+ json_data = json.load(f)
+ new_json_data = json_data.copy()
+ for i, item in enumerate(json_data):
+ media_path = item["media_path"]
+ reference_path = reference_paths[media_path]
+ new_json_data[i]["reference_path"] = reference_path
+
+ with output_path.open("w", encoding="utf-8") as f:
+ json.dump(new_json_data, f, indent=2, ensure_ascii=False)
+
+ console.print(f"[bold green]✓[/] Reference video paths saved to [cyan]{output_path}[/]")
+ console.print("[bold yellow]Note:[/] Use these files with ImageOrVideoDataset by setting:")
+ console.print(" reference_column='[cyan]reference_path[/]'")
+ console.print(" video_column='[cyan]media_path[/]'")
+
+
+def process_media(
+ input_path: Path,
+ output_path: Path,
+ override: bool,
+ batch_size: int = 100,
+) -> None:
+ """Process videos and images to compute condition on videos.
+ Args:
+ input_path: Path to input video/image file or directory
+ output_path: Path to output reference video file
+ override: Whether to override existing reference video files
+ """
+ if not output_path.exists():
+ raise FileNotFoundError(
+ f"Output file does not exist: {output_path}. This is also the input file for the dataset."
+ )
+
+ # Check for existing reference video files
+ meta_data = _get_meta_data(output_path)
+
+ base_dir = input_path.resolve()
+ console.print(f"Using [bold blue]{base_dir}[/] as base directory for relative paths")
+
+ # Filter media files
+ media_to_process = []
+ skipped_media = []
+
+ def media_path_to_reference_path(media_file: Path) -> Path:
+ return media_file.parent / (media_file.stem + "_reference" + media_file.suffix)
+
+ media_files = [base_dir / Path(sample["media_path"]) for sample in meta_data]
+ for media_file in media_files:
+ reference_path = media_path_to_reference_path(media_file)
+ media_to_process.append(media_file)
+
+ console.print(f"Processing [bold]{len(media_to_process)}[/] media.")
+
+ # Initialize progress tracking
+ progress = Progress(
+ SpinnerColumn(),
+ TextColumn("{task.description}"),
+ BarColumn(bar_width=40),
+ MofNCompleteColumn(),
+ TimeElapsedColumn(),
+ TextColumn("•"),
+ TimeRemainingColumn(),
+ console=console,
+ )
+
+ # Process media files
+ media_paths = [item["media_path"] for item in meta_data]
+ reference_paths = {rel_path: str(media_path_to_reference_path(Path(rel_path))) for rel_path in media_paths}
+
+ with progress:
+ task = progress.add_task("Computing condition on videos", total=len(media_to_process))
+
+ for media_file in media_to_process:
+ progress.update(task, description=f"Processing [bold blue]{media_file.name}[/]")
+
+ rel_path = str(media_file.resolve().relative_to(base_dir))
+ reference_path = media_path_to_reference_path(media_file)
+ reference_paths[rel_path] = str(reference_path.relative_to(base_dir))
+
+ if not reference_path.resolve().exists() or override:
+ try:
+ video, fps = read_video(media_file)
+
+ # Process frames in batches
+ condition_frames = []
+
+ for i in range(0, len(video), batch_size):
+ batch = video[i : i + batch_size]
+ condition_batch = compute_reference(batch)
+ condition_frames.append(condition_batch)
+
+ # Concatenate all edge frames
+ all_condition = torch.cat(condition_frames, dim=0)
+
+ # Save the edge video
+ save_video(all_condition, reference_path.resolve(), fps=fps)
+
+ except Exception as e:
+ console.print(f"[bold red]Error processing [bold blue]{media_file}[/]: {e}[/]")
+ reference_paths.pop(rel_path)
+ else:
+ skipped_media.append(media_file)
+
+ progress.advance(task)
+
+ # Save results
+ _save_dataset_json(reference_paths, output_path)
+
+ # Print summary
+ total_to_process = len(media_files) - len(skipped_media)
+ console.print(
+ f"[bold green]✓[/] Processed [bold]{total_to_process}/{len(media_files)}[/] media successfully.",
+ )
+
+
+app = typer.Typer(
+ pretty_exceptions_enable=False,
+ no_args_is_help=True,
+ help="Compute reference videos for IC-LoRA training.",
+)
+
+
+def main(
+ input_path: Path = typer.Argument( # noqa: B008
+ ...,
+ help="Path to input video/image file or directory containing media files",
+ exists=True,
+ ),
+ output: Path | None = typer.Option( # noqa: B008
+ None,
+ "--output",
+ "-o",
+ help="Path to json output file for reference video paths. "
+ "This is also the input file for the dataset, the output of compute_captions.py.",
+ ),
+ override: bool = typer.Option(
+ False,
+ "--override",
+ help="Whether to override existing reference video files",
+ ),
+ batch_size: int = typer.Option(
+ 100,
+ "--batch-size",
+ help="Batch size for processing videos",
+ ),
+) -> None:
+ """Compute reference videos for IC-LoRA training.
+ This script generates reference videos (e.g., Canny edge maps) for given videos.
+ The paths in the output file will be relative to the output file's directory.
+ Examples:
+ # Process all videos in a directory
+ compute_reference.py videos_dir/ -o videos_dir/captions.json
+ """
+
+ # Ensure output path is absolute
+ output = Path(output).resolve()
+ console.print(f"Output will be saved to [bold blue]{output}[/]")
+
+ # Verify output path exists
+ if not output.exists():
+ raise FileNotFoundError(f"Output file does not exist: {output}. This is also the input file for the dataset.")
+
+ # Process media files
+ process_media(
+ input_path=input_path,
+ output_path=output,
+ override=override,
+ batch_size=batch_size,
+ )
+
+
+if __name__ == "__main__":
+ app()
diff --git a/packages/ltx-trainer/scripts/decode_latents.py b/packages/ltx-trainer/scripts/decode_latents.py
new file mode 100755
index 0000000..1542ae5
--- /dev/null
+++ b/packages/ltx-trainer/scripts/decode_latents.py
@@ -0,0 +1,338 @@
+#!/usr/bin/env python3
+
+"""
+Decode precomputed video latents back into videos using the VAE.
+This script loads latent files saved during preprocessing and decodes them
+back into video clips using the same VAE model.
+Basic usage:
+ python scripts/decode_latents.py /path/to/latents/dir /path/to/output \
+ --model-source /path/to/ltx2.safetensors
+"""
+
+from pathlib import Path
+
+import torch
+import torchaudio
+import torchvision.utils
+import typer
+from rich.console import Console
+from rich.progress import (
+ BarColumn,
+ MofNCompleteColumn,
+ Progress,
+ SpinnerColumn,
+ TextColumn,
+ TimeElapsedColumn,
+ TimeRemainingColumn,
+)
+from transformers.utils.logging import disable_progress_bar
+
+from ltx_trainer import logger
+from ltx_trainer.model_loader import load_audio_vae_decoder, load_video_vae_decoder, load_vocoder
+from ltx_trainer.video_utils import save_video
+
+disable_progress_bar()
+console = Console()
+app = typer.Typer(
+ pretty_exceptions_enable=False,
+ no_args_is_help=True,
+ help="Decode precomputed video latents back into videos using the VAE.",
+)
+
+
+class LatentsDecoder:
+ def __init__(
+ self,
+ model_path: str,
+ device: str = "cuda",
+ vae_tiling: bool = False,
+ with_audio: bool = False,
+ ):
+ """Initialize the decoder with model configuration.
+ Args:
+ model_path: Path to LTX-2 checkpoint (.safetensors)
+ device: Device to use for computation
+ vae_tiling: Whether to enable VAE tiling for larger video resolutions
+ with_audio: Whether to load audio VAE for audio decoding
+ """
+ self.device = torch.device(device)
+ self.model_path = model_path
+ self.vae = None
+ self.audio_vae = None
+ self.vocoder = None
+ self._load_model(model_path, vae_tiling, with_audio)
+
+ def _load_model(self, model_path: str, vae_tiling: bool, with_audio: bool = False) -> None:
+ """Initialize and load the VAE model(s)."""
+ with console.status(f"[bold]Loading video VAE decoder from {model_path}...", spinner="dots"):
+ self.vae = load_video_vae_decoder(model_path, device=self.device, dtype=torch.bfloat16)
+
+ if vae_tiling:
+ self.vae.enable_tiling()
+
+ if with_audio:
+ with console.status(f"[bold]Loading audio VAE decoder from {model_path}...", spinner="dots"):
+ self.audio_vae = load_audio_vae_decoder(model_path, device=self.device, dtype=torch.bfloat16)
+
+ with console.status(f"[bold]Loading vocoder from {model_path}...", spinner="dots"):
+ self.vocoder = load_vocoder(model_path, device=self.device)
+
+ @torch.inference_mode()
+ def decode(self, latents_dir: Path, output_dir: Path, seed: int | None = None) -> None:
+ """Decode all latent files in the directory recursively.
+ Args:
+ latents_dir: Directory containing latent files (.pt)
+ output_dir: Directory to save decoded videos
+ seed: Optional random seed for noise generation
+ """
+ # Find all .pt files recursively
+ latent_files = list(latents_dir.rglob("*.pt"))
+
+ if not latent_files:
+ logger.warning(f"No .pt files found in {latents_dir}")
+ return
+
+ logger.info(f"Found {len(latent_files):,} latent files to decode")
+
+ # Process files with progress bar
+ with Progress(
+ SpinnerColumn(),
+ TextColumn("[progress.description]{task.description}"),
+ BarColumn(),
+ MofNCompleteColumn(),
+ TimeElapsedColumn(),
+ TimeRemainingColumn(),
+ console=console,
+ ) as progress:
+ task = progress.add_task("Decoding latents", total=len(latent_files))
+
+ for latent_file in latent_files:
+ # Calculate relative path to maintain directory structure
+ rel_path = latent_file.relative_to(latents_dir)
+ output_subdir = output_dir / rel_path.parent
+ output_subdir.mkdir(parents=True, exist_ok=True)
+
+ try:
+ self._process_file(latent_file, output_subdir, seed)
+ except Exception as e:
+ logger.error(f"Error processing {latent_file}: {e}")
+ continue
+
+ progress.advance(task)
+
+ logger.info(f"Decoding complete! Videos saved to {output_dir}")
+
+ def _process_file(self, latent_file: Path, output_dir: Path, seed: int | None) -> None:
+ """Process a single latent file."""
+ # Load the latent data
+ data = torch.load(latent_file, map_location=self.device, weights_only=False)
+
+ # Get latents - handle both old patchified [seq_len, C] and new [C, F, H, W] formats
+ latents = data["latents"]
+ num_frames = data["num_frames"]
+ height = data["height"]
+ width = data["width"]
+
+ # Check if latents need reshaping (old patchified format)
+ if latents.dim() == 2:
+ # Old format: [seq_len, C] -> reshape to [C, F, H, W]
+ _seq_len, channels = latents.shape
+ latents = latents.reshape(num_frames, height, width, channels)
+ latents = latents.permute(3, 0, 1, 2) # [F, H, W, C] -> [C, F, H, W]
+
+ # Add batch dimension: [C, F, H, W] -> [1, C, F, H, W]
+ latents = latents.unsqueeze(0).to(device=self.device, dtype=torch.bfloat16)
+
+ # Create generator only if seed is provided
+ generator = None
+ if seed is not None:
+ generator = torch.Generator(device=self.device)
+ generator.manual_seed(seed)
+
+ # Decode the video (VAE decoder uses forward/call, not decode method)
+ video = self.vae(latents) # [B, C, F, H, W]
+
+ # Convert to [F, C, H, W] format and normalize to [0, 1]
+ video = video[0] # Remove batch dimension -> [C, F, H, W]
+ video = video.permute(1, 0, 2, 3) # [C, F, H, W] -> [F, C, H, W]
+ video = (video + 1) / 2 # Denormalize from [-1, 1] to [0, 1]
+ video = video.clamp(0, 1)
+
+ # Determine output format and save
+ is_image = video.shape[0] == 1
+ if is_image:
+ # Save as PNG for single frame
+ output_path = output_dir / f"{latent_file.stem}.png"
+ torchvision.utils.save_image(
+ video[0], # [C, H, W] in [0, 1]
+ str(output_path),
+ )
+ else:
+ # Save as MP4 for video using PyAV-based save_video
+ output_path = output_dir / f"{latent_file.stem}.mp4"
+ fps = data.get("fps", 24) # Use stored FPS or default to 24
+ save_video(
+ video_tensor=video, # [F, C, H, W] in [0, 1]
+ output_path=output_path,
+ fps=fps,
+ )
+
+ @torch.inference_mode()
+ def decode_audio(self, latents_dir: Path, output_dir: Path) -> None:
+ """Decode all audio latent files in the directory recursively.
+ Args:
+ latents_dir: Directory containing audio latent files (.pt)
+ output_dir: Directory to save decoded audio files
+ """
+ # Check if audio VAE is loaded
+ if self.audio_vae is None or self.vocoder is None:
+ logger.warning("Audio VAE or vocoder not loaded. Skipping audio decoding.")
+ return
+
+ # Find all .pt files recursively
+ latent_files = list(latents_dir.rglob("*.pt"))
+
+ if not latent_files:
+ logger.warning(f"No .pt files found in {latents_dir}")
+ return
+
+ logger.info(f"Found {len(latent_files):,} audio latent files to decode")
+
+ # Process files with progress bar
+ with Progress(
+ SpinnerColumn(),
+ TextColumn("[progress.description]{task.description}"),
+ BarColumn(),
+ MofNCompleteColumn(),
+ TimeElapsedColumn(),
+ TimeRemainingColumn(),
+ console=console,
+ ) as progress:
+ task = progress.add_task("Decoding audio latents", total=len(latent_files))
+
+ for latent_file in latent_files:
+ # Calculate relative path to maintain directory structure
+ rel_path = latent_file.relative_to(latents_dir)
+ output_subdir = output_dir / rel_path.parent
+ output_subdir.mkdir(parents=True, exist_ok=True)
+
+ try:
+ self._process_audio_file(latent_file, output_subdir)
+ except Exception as e:
+ logger.error(f"Error processing audio {latent_file}: {e}")
+ continue
+
+ progress.advance(task)
+
+ logger.info(f"Audio decoding complete! Audio files saved to {output_dir}")
+
+ def _process_audio_file(self, latent_file: Path, output_dir: Path) -> None:
+ """Process a single audio latent file."""
+ # Load the latent data
+ data = torch.load(latent_file, map_location=self.device, weights_only=False)
+
+ latents = data["latents"].to(device=self.device, dtype=torch.float32)
+ num_time_steps = data["num_time_steps"]
+ freq_bins = data["frequency_bins"]
+
+ # Handle both old patchified [seq_len, C] and new [C, T, F] formats
+ if latents.dim() == 2:
+ # Old format: [seq_len, channels] where seq_len = time * freq
+ # Reshape to [C, T, F]
+ latents = latents.reshape(num_time_steps, freq_bins, -1) # [T, F, C]
+ latents = latents.permute(2, 0, 1) # [T, F, C] -> [C, T, F]
+
+ # Add batch dimension: [C, T, F] -> [1, C, T, F]
+ latents = latents.unsqueeze(0)
+
+ # Set correct dtype for audio VAE
+ latents = latents.to(dtype=torch.bfloat16)
+
+ # Decode audio using audio VAE decoder (produces mel spectrogram)
+ mel_spectrogram = self.audio_vae(latents)
+
+ # Convert mel spectrogram to waveform using vocoder
+ waveform = self.vocoder(mel_spectrogram)
+
+ # Save as WAV
+ output_path = output_dir / f"{latent_file.stem}.wav"
+ sample_rate = self.vocoder.output_sample_rate
+ torchaudio.save(str(output_path), waveform[0].cpu(), sample_rate)
+
+
+def main(
+ latents_dir: str = typer.Argument(
+ ...,
+ help="Directory containing the precomputed latent files (searched recursively)",
+ ),
+ output_dir: str = typer.Argument(
+ ...,
+ help="Directory to save the decoded videos (maintains same folder hierarchy as input)",
+ ),
+ model_path: str = typer.Option(
+ ...,
+ help="Path to LTX-2 checkpoint (.safetensors file)",
+ ),
+ device: str = typer.Option(
+ default="cuda",
+ help="Device to use for computation",
+ ),
+ vae_tiling: bool = typer.Option(
+ default=False,
+ help="Enable VAE tiling for larger video resolutions",
+ ),
+ seed: int | None = typer.Option(
+ default=None,
+ help="Random seed for noise generation during decoding",
+ ),
+ with_audio: bool = typer.Option(
+ default=False,
+ help="Also decode audio latents (requires audio_latents directory)",
+ ),
+ audio_latents_dir: str | None = typer.Option(
+ default=None,
+ help="Directory containing audio latent files (defaults to 'audio_latents' sibling of latents_dir)",
+ ),
+) -> None:
+ """Decode precomputed video latents back into videos using the VAE.
+ This script recursively searches for .pt latent files in the input directory
+ and decodes them to videos, maintaining the same folder hierarchy in the output.
+ Examples:
+ # Basic usage
+ python scripts/decode_latents.py /path/to/latents /path/to/videos \\
+ --model-path /path/to/ltx2.safetensors
+ # With VAE tiling for large videos
+ python scripts/decode_latents.py /path/to/latents /path/to/videos \\
+ --model-path /path/to/ltx2.safetensors --vae-tiling
+ # With audio decoding
+ python scripts/decode_latents.py /path/to/latents /path/to/videos \\
+ --model-path /path/to/ltx2.safetensors --with-audio
+ """
+ latents_path = Path(latents_dir)
+ output_path = Path(output_dir)
+
+ if not latents_path.exists() or not latents_path.is_dir():
+ raise typer.BadParameter(f"Latents directory does not exist: {latents_path}")
+
+ decoder = LatentsDecoder(
+ model_path=model_path,
+ device=device,
+ vae_tiling=vae_tiling,
+ with_audio=with_audio,
+ )
+ decoder.decode(latents_path, output_path, seed=seed)
+
+ # Decode audio if requested
+ if with_audio:
+ audio_path = Path(audio_latents_dir) if audio_latents_dir else latents_path.parent / "audio_latents"
+
+ if audio_path.exists():
+ audio_output_path = output_path.parent / "decoded_audio"
+ decoder.decode_audio(audio_path, audio_output_path)
+ else:
+ logger.warning(f"Audio latents directory not found: {audio_path}")
+
+
+if __name__ == "__main__":
+ app()
diff --git a/packages/ltx-trainer/scripts/inference.py b/packages/ltx-trainer/scripts/inference.py
new file mode 100755
index 0000000..042fb4e
--- /dev/null
+++ b/packages/ltx-trainer/scripts/inference.py
@@ -0,0 +1,443 @@
+#!/usr/bin/env python3
+# ruff: noqa: T201
+"""
+CLI script for running LTX video/audio generation inference.
+Usage:
+ # Text-to-Video + Audio (default behavior)
+ python scripts/inference.py --checkpoint path/to/model.safetensors \
+ --text-encoder-path path/to/gemma \
+ --prompt "A cat playing with a ball" --output output.mp4
+ # Video only (skip audio)
+ python scripts/inference.py --checkpoint path/to/model.safetensors \
+ --text-encoder-path path/to/gemma \
+ --prompt "A cat playing with a ball" --skip-audio --output output.mp4
+ # Image-to-Video
+ python scripts/inference.py --checkpoint path/to/model.safetensors \
+ --text-encoder-path path/to/gemma \
+ --prompt "A cat walking" --condition-image first_frame.png --output output.mp4
+ # Video-to-Video (IC-LoRA style)
+ python scripts/inference.py --checkpoint path/to/model.safetensors \
+ --text-encoder-path path/to/gemma \
+ --prompt "A cat turning into a dog" --reference-video input.mp4 --output output.mp4
+ # With LoRA weights
+ python scripts/inference.py --checkpoint path/to/model.safetensors \
+ --text-encoder-path path/to/gemma \
+ --lora-path path/to/lora.safetensors \
+ --prompt "A cat in my custom style" --output output.mp4
+"""
+
+import argparse
+import re
+from pathlib import Path
+
+import torch
+import torchaudio
+from peft import LoraConfig, get_peft_model, set_peft_model_state_dict
+from safetensors.torch import load_file
+from torchvision import transforms
+
+from ltx_trainer.model_loader import load_model
+from ltx_trainer.progress import StandaloneSamplingProgress
+from ltx_trainer.utils import open_image_as_srgb
+from ltx_trainer.validation_sampler import GenerationConfig, ValidationSampler
+from ltx_trainer.video_utils import read_video, save_video
+
+
+def load_image(image_path: str) -> torch.Tensor:
+ """Load an image and convert to tensor [C, H, W] in [0, 1]."""
+ image = open_image_as_srgb(image_path)
+ transform = transforms.ToTensor()
+ return transform(image)
+
+
+def extract_lora_target_modules(state_dict: dict[str, torch.Tensor]) -> list[str]:
+ """Extract target module names from LoRA checkpoint keys.
+ LoRA keys follow the pattern (after removing "diffusion_model." prefix):
+ - transformer_blocks.0.attn1.to_k.lora_A.weight
+ - transformer_blocks.0.ff.net.0.proj.lora_B.weight
+ This extracts the full module path like "transformer_blocks.0.attn1.to_k".
+ Using full paths is more robust than partial patterns.
+ """
+ target_modules = set()
+ # Pattern to extract everything before .lora_A or .lora_B
+ pattern = re.compile(r"(.+)\.lora_[AB]\.")
+
+ for key in state_dict:
+ match = pattern.match(key)
+ if match:
+ module_path = match.group(1)
+ target_modules.add(module_path)
+
+ return sorted(target_modules)
+
+
+def load_lora_weights(transformer: torch.nn.Module, lora_path: str | Path) -> torch.nn.Module:
+ """Load LoRA weights into the transformer model.
+ The LoRA rank and target modules are automatically detected from the checkpoint.
+ Alpha is set equal to rank (standard practice for inference).
+ Args:
+ transformer: The base transformer model
+ lora_path: Path to the LoRA weights (.safetensors)
+ Returns:
+ The transformer model with LoRA weights applied
+ """
+ print(f"Loading LoRA weights from {lora_path}...")
+
+ # Load the LoRA state dict
+ state_dict = load_file(str(lora_path))
+
+ # Remove "diffusion_model." prefix (ComfyUI-compatible format)
+ state_dict = {k.replace("diffusion_model.", "", 1): v for k, v in state_dict.items()}
+
+ # Extract target modules from the checkpoint
+ target_modules = extract_lora_target_modules(state_dict)
+ if not target_modules:
+ raise ValueError(f"Could not extract target modules from LoRA checkpoint: {lora_path}")
+ print(f" Detected {len(target_modules)} target modules")
+
+ # Auto-detect rank from the first lora_A weight shape
+ lora_rank = None
+ for key, value in state_dict.items():
+ if "lora_A" in key and value.ndim == 2:
+ lora_rank = value.shape[0]
+ break
+ if lora_rank is None:
+ raise ValueError("Could not auto-detect LoRA rank from weights")
+ print(f" LoRA rank: {lora_rank}")
+
+ # Create LoRA config and wrap the model
+ # Alpha = rank is standard for inference (maintains the trained scale)
+ lora_config = LoraConfig(
+ r=lora_rank,
+ lora_alpha=lora_rank,
+ target_modules=target_modules,
+ lora_dropout=0.0,
+ init_lora_weights=True,
+ )
+
+ # Wrap the transformer with PEFT to add LoRA layers
+ transformer = get_peft_model(transformer, lora_config)
+
+ # Load the LoRA weights
+ base_model = transformer.get_base_model()
+ set_peft_model_state_dict(base_model, state_dict)
+
+ print("✓ LoRA weights loaded successfully")
+ return transformer
+
+
+def main() -> None: # noqa: PLR0912, PLR0915
+ parser = argparse.ArgumentParser(
+ description="LTX Video/Audio Generation",
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ )
+
+ # Model arguments
+ parser.add_argument(
+ "--checkpoint",
+ type=str,
+ required=True,
+ help="Path to model checkpoint (.safetensors)",
+ )
+ parser.add_argument(
+ "--text-encoder-path",
+ type=str,
+ required=True,
+ help="Path to Gemma text encoder directory",
+ )
+
+ # LoRA arguments
+ parser.add_argument(
+ "--lora-path",
+ type=str,
+ default=None,
+ help="Path to LoRA weights (.safetensors)",
+ )
+
+ # Generation arguments
+ parser.add_argument(
+ "--prompt",
+ type=str,
+ required=True,
+ help="Text prompt for generation",
+ )
+ parser.add_argument(
+ "--negative-prompt",
+ type=str,
+ default="",
+ help="Negative prompt",
+ )
+ parser.add_argument(
+ "--height",
+ type=int,
+ default=544,
+ help="Video height (must be divisible by 32)",
+ )
+ parser.add_argument(
+ "--width",
+ type=int,
+ default=960,
+ help="Video width (must be divisible by 32)",
+ )
+ parser.add_argument(
+ "--num-frames",
+ type=int,
+ default=97,
+ help="Number of video frames (must be k*8 + 1)",
+ )
+ parser.add_argument(
+ "--frame-rate",
+ type=float,
+ default=25.0,
+ help="Video frame rate",
+ )
+ parser.add_argument(
+ "--num-inference-steps",
+ type=int,
+ default=30,
+ help="Number of denoising steps",
+ )
+ parser.add_argument(
+ "--guidance-scale",
+ type=float,
+ default=4.0,
+ help="Classifier-free guidance scale (CFG)",
+ )
+ parser.add_argument(
+ "--stg-scale",
+ type=float,
+ default=1.0,
+ help="STG (Spatio-Temporal Guidance) scale. 0.0 disables STG. Default: 1.0",
+ )
+ parser.add_argument(
+ "--stg-blocks",
+ type=int,
+ nargs="*",
+ default=[29],
+ help="Which transformer blocks to perturb for STG. Default: 29 (single block).",
+ )
+ parser.add_argument(
+ "--stg-mode",
+ type=str,
+ default="stg_av",
+ choices=["stg_av", "stg_v"],
+ help="STG mode: 'stg_av' perturbs both audio and video, 'stg_v' perturbs video only",
+ )
+ parser.add_argument(
+ "--seed",
+ type=int,
+ default=42,
+ help="Random seed for reproducibility",
+ )
+
+ # Conditioning arguments
+ parser.add_argument(
+ "--condition-image",
+ type=str,
+ default=None,
+ help="Path to conditioning image for image-to-video generation",
+ )
+ parser.add_argument(
+ "--reference-video",
+ type=str,
+ default=None,
+ help="Path to reference video for video-to-video generation (IC-LoRA style)",
+ )
+ parser.add_argument(
+ "--include-reference-in-output",
+ action="store_true",
+ help="Include reference video side-by-side with generated output (only for V2V)",
+ )
+
+ # Audio arguments
+ parser.add_argument(
+ "--skip-audio",
+ action="store_true",
+ help="Skip audio generation (by default, audio is generated alongside video)",
+ )
+
+ # Output arguments
+ parser.add_argument(
+ "--output",
+ type=str,
+ required=True,
+ help="Output video path (.mp4)",
+ )
+ parser.add_argument(
+ "--audio-output",
+ type=str,
+ default=None,
+ help="Output audio path (.wav, optional - if not provided, audio will be embedded in video)",
+ )
+
+ # Device arguments
+ parser.add_argument(
+ "--device",
+ type=str,
+ default="cuda",
+ help="Device to run on (cuda/cpu)",
+ )
+
+ args = parser.parse_args()
+
+ # Validate conditioning arguments
+ if args.include_reference_in_output and args.reference_video is None:
+ parser.error("--include-reference-in-output requires --reference-video")
+
+ # Validate arguments
+ generate_audio = not args.skip_audio
+
+ print("=" * 80)
+ print("LTX Video/Audio Generation")
+ print("=" * 80)
+
+ # Determine if we need VAE encoder (for image or video conditioning)
+ need_vae_encoder = args.condition_image is not None or args.reference_video is not None
+
+ components = load_model(
+ checkpoint_path=args.checkpoint,
+ device="cpu", # Load to CPU first, sampler will move to device as needed
+ dtype=torch.bfloat16,
+ with_video_vae_encoder=need_vae_encoder,
+ with_video_vae_decoder=True,
+ with_audio_vae_decoder=generate_audio,
+ with_vocoder=generate_audio,
+ with_text_encoder=True,
+ text_encoder_path=args.text_encoder_path,
+ )
+
+ # Apply LoRA weights if provided
+ transformer = components.transformer
+ if args.lora_path is not None:
+ transformer = load_lora_weights(transformer, args.lora_path)
+
+ # Load conditioning image if provided
+ condition_image = None
+ if args.condition_image:
+ print(f"Loading conditioning image from {args.condition_image}...")
+ condition_image = load_image(args.condition_image)
+
+ # Load reference video if provided
+ reference_video = None
+ if args.reference_video:
+ print(f"Loading reference video from {args.reference_video}...")
+ reference_video, ref_fps = read_video(args.reference_video, max_frames=args.num_frames)
+ print(f" Loaded {reference_video.shape[0]} frames @ {ref_fps:.1f} fps")
+
+ # Determine generation mode
+ if args.reference_video is not None and args.condition_image is not None:
+ mode = "Video-to-Video + Image Conditioning (V2V+I2V)"
+ elif args.reference_video is not None:
+ mode = "Video-to-Video (V2V)"
+ elif args.condition_image is not None:
+ mode = "Image-to-Video (I2V)"
+ else:
+ mode = "Text-to-Video (T2V)"
+
+ print("\n" + "=" * 80)
+ print("Generation Parameters")
+ print("=" * 80)
+ print(f"Mode: {mode}")
+ print(f"Prompt: {args.prompt}")
+ if args.negative_prompt:
+ print(f"Negative prompt: {args.negative_prompt}")
+ print(f"Resolution: {args.width}x{args.height}")
+ print(f"Frames: {args.num_frames} @ {args.frame_rate} fps")
+ print(f"Inference steps: {args.num_inference_steps}")
+ print(f"CFG scale: {args.guidance_scale}")
+ if args.stg_scale > 0:
+ blocks_str = args.stg_blocks if args.stg_blocks else "all"
+ print(f"STG scale: {args.stg_scale} (mode: {args.stg_mode}, blocks: {blocks_str})")
+ else:
+ print("STG: disabled")
+ print(f"Seed: {args.seed}")
+ if args.lora_path:
+ print(f"LoRA: {args.lora_path}")
+ if condition_image is not None:
+ print(f"Conditioning: Image ({args.condition_image})")
+ if reference_video is not None:
+ print(f"Reference: Video ({args.reference_video})")
+ if args.include_reference_in_output:
+ print(" → Will include reference side-by-side in output")
+ if generate_audio:
+ video_duration = args.num_frames / args.frame_rate
+ print(f"Audio: Enabled (duration will match video: {video_duration:.2f}s)")
+ print("=" * 80)
+
+ print(f"\nGenerating {'video + audio' if generate_audio else 'video'}...")
+
+ # Create generation config
+ gen_config = GenerationConfig(
+ prompt=args.prompt,
+ negative_prompt=args.negative_prompt,
+ height=args.height,
+ width=args.width,
+ num_frames=args.num_frames,
+ frame_rate=args.frame_rate,
+ num_inference_steps=args.num_inference_steps,
+ guidance_scale=args.guidance_scale,
+ seed=args.seed,
+ condition_image=condition_image,
+ reference_video=reference_video,
+ generate_audio=generate_audio,
+ include_reference_in_output=args.include_reference_in_output,
+ stg_scale=args.stg_scale,
+ stg_blocks=args.stg_blocks,
+ stg_mode=args.stg_mode,
+ )
+
+ # Generate with progress bar
+ with StandaloneSamplingProgress(num_steps=args.num_inference_steps) as progress:
+ # Create sampler with progress context
+ sampler = ValidationSampler(
+ transformer=transformer,
+ vae_decoder=components.video_vae_decoder,
+ vae_encoder=components.video_vae_encoder,
+ text_encoder=components.text_encoder,
+ audio_decoder=components.audio_vae_decoder if generate_audio else None,
+ vocoder=components.vocoder if generate_audio else None,
+ sampling_context=progress,
+ )
+ video, audio = sampler.generate(
+ config=gen_config,
+ device=args.device,
+ )
+
+ # Save video
+ output_path = Path(args.output)
+ output_path.parent.mkdir(parents=True, exist_ok=True)
+
+ # Get audio sample rate from vocoder if audio was generated
+ audio_sample_rate = None
+ if audio is not None and components.vocoder is not None:
+ audio_sample_rate = components.vocoder.output_sample_rate
+
+ save_video(
+ video_tensor=video,
+ output_path=output_path,
+ fps=args.frame_rate,
+ audio=audio,
+ audio_sample_rate=audio_sample_rate,
+ )
+ print(f"✓ Video saved to {args.output}")
+
+ # Save separate audio file if requested
+ if audio is not None and args.audio_output is not None:
+ audio_output_path = Path(args.audio_output)
+ audio_output_path.parent.mkdir(parents=True, exist_ok=True)
+
+ torchaudio.save(
+ str(audio_output_path),
+ audio.cpu(),
+ sample_rate=audio_sample_rate,
+ )
+ duration = audio.shape[1] / audio_sample_rate
+ print(f"✓ Audio saved: {duration:.2f}s at {audio_sample_rate}Hz")
+
+ print("\n" + "=" * 80)
+ print("Generation complete!")
+ print("=" * 80)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/packages/ltx-trainer/scripts/process_captions.py b/packages/ltx-trainer/scripts/process_captions.py
new file mode 100755
index 0000000..f511690
--- /dev/null
+++ b/packages/ltx-trainer/scripts/process_captions.py
@@ -0,0 +1,415 @@
+#!/usr/bin/env python
+
+"""
+Compute text embeddings for video generation training.
+This module provides functionality for processing text captions, including:
+- Loading captions from various file formats (CSV, JSON, JSONL)
+- Cleaning and preprocessing text (removing LLM prefixes, adding ID tokens)
+- CaptionsDataset for caption-only preprocessing workflows
+Can be used as a standalone script:
+ python scripts/process_captions.py dataset.json --output-dir /path/to/output \
+ --model-source /path/to/ltx2.safetensors --text-encoder-path /path/to/gemma
+"""
+
+import json
+import os
+from pathlib import Path
+from typing import Any
+
+import pandas as pd
+import torch
+import typer
+from rich.console import Console
+from rich.progress import (
+ BarColumn,
+ MofNCompleteColumn,
+ Progress,
+ SpinnerColumn,
+ TaskProgressColumn,
+ TextColumn,
+ TimeElapsedColumn,
+ TimeRemainingColumn,
+)
+from torch.utils.data import DataLoader, Dataset
+from transformers.utils.logging import disable_progress_bar
+
+from ltx_trainer import logger
+from ltx_trainer.model_loader import load_text_encoder
+
+# Disable tokenizers parallelism to avoid warnings
+os.environ["TOKENIZERS_PARALLELISM"] = "false"
+
+disable_progress_bar()
+
+# Common phrases that LLMs often add to captions that we might want to remove
+COMMON_BEGINNING_PHRASES: tuple[str, ...] = (
+ "This video",
+ "The video",
+ "This clip",
+ "The clip",
+ "The animation",
+ "This image",
+ "The image",
+ "This picture",
+ "The picture",
+)
+
+COMMON_CONTINUATION_WORDS: tuple[str, ...] = (
+ "shows",
+ "depicts",
+ "features",
+ "captures",
+ "highlights",
+ "introduces",
+ "presents",
+)
+
+COMMON_LLM_START_PHRASES: tuple[str, ...] = (
+ "In the video,",
+ "In this video,",
+ "In this video clip,",
+ "In the clip,",
+ "Caption:",
+ *(
+ f"{beginning} {continuation}"
+ for beginning in COMMON_BEGINNING_PHRASES
+ for continuation in COMMON_CONTINUATION_WORDS
+ ),
+)
+
+app = typer.Typer(
+ pretty_exceptions_enable=False,
+ no_args_is_help=True,
+ help="Process text captions and save embeddings for video generation training.",
+)
+
+
+class CaptionsDataset(Dataset):
+ """
+ Dataset for processing text captions only.
+ This dataset is designed for caption preprocessing workflows where you only need
+ to process text without loading videos. Useful for:
+ - Precomputing text embeddings
+ - Caption cleaning and preprocessing
+ - Text-only preprocessing pipelines
+ """
+
+ def __init__(
+ self,
+ dataset_file: str | Path,
+ caption_column: str,
+ media_column: str = "media_path",
+ lora_trigger: str | None = None,
+ remove_llm_prefixes: bool = False,
+ ) -> None:
+ """
+ Initialize the captions dataset.
+ Args:
+ dataset_file: Path to CSV/JSON/JSONL metadata file
+ caption_column: Column name for captions in the metadata file
+ media_column: Column name for media paths (used for output naming)
+ lora_trigger: Optional trigger word to prepend to each caption
+ remove_llm_prefixes: Whether to remove common LLM-generated prefixes
+ """
+ super().__init__()
+
+ self.dataset_file = Path(dataset_file)
+ self.caption_column = caption_column
+ self.media_column = media_column
+ self.lora_trigger = f"{lora_trigger.strip()} " if lora_trigger else ""
+
+ # Load captions with their corresponding output embedding paths
+ self.caption_data = self._load_caption_data()
+
+ # Convert to lists for indexing
+ self.output_paths = list(self.caption_data.keys())
+ self.prompts = list(self.caption_data.values())
+
+ # Clean LLM start phrases if requested
+ if remove_llm_prefixes:
+ self._clean_llm_prefixes()
+
+ def __len__(self) -> int:
+ return len(self.prompts)
+
+ def __getitem__(self, index: int) -> dict[str, Any]:
+ """Get a single caption with optional trigger word prepended and output path."""
+ prompt = self.lora_trigger + self.prompts[index]
+ return {
+ "prompt": prompt,
+ "output_path": self.output_paths[index],
+ "index": index,
+ }
+
+ def _load_caption_data(self) -> dict[str, str]:
+ """Load captions and compute their output embedding paths."""
+ if self.dataset_file.suffix == ".csv":
+ return self._load_caption_data_from_csv()
+ elif self.dataset_file.suffix == ".json":
+ return self._load_caption_data_from_json()
+ elif self.dataset_file.suffix == ".jsonl":
+ return self._load_caption_data_from_jsonl()
+ else:
+ raise ValueError("Expected `dataset_file` to be a path to a CSV, JSON, or JSONL file.")
+
+ def _load_caption_data_from_csv(self) -> dict[str, str]:
+ """Load captions from a CSV file and compute output embedding paths."""
+ df = pd.read_csv(self.dataset_file)
+
+ if self.caption_column not in df.columns:
+ raise ValueError(f"Column '{self.caption_column}' not found in CSV file")
+ if self.media_column not in df.columns:
+ raise ValueError(f"Column '{self.media_column}' not found in CSV file")
+
+ caption_data = {}
+ for _, row in df.iterrows():
+ media_path = Path(row[self.media_column].strip())
+ # Convert media path to embedding output path (same structure, .pt extension)
+ output_path = str(media_path.with_suffix(".pt"))
+ caption_data[output_path] = row[self.caption_column]
+
+ return caption_data
+
+ def _load_caption_data_from_json(self) -> dict[str, str]:
+ """Load captions from a JSON file and compute output embedding paths."""
+ with open(self.dataset_file, "r", encoding="utf-8") as file:
+ data = json.load(file)
+
+ if not isinstance(data, list):
+ raise ValueError("JSON file must contain a list of objects")
+
+ caption_data = {}
+ for entry in data:
+ if self.caption_column not in entry:
+ raise ValueError(f"Key '{self.caption_column}' not found in JSON entry: {entry}")
+ if self.media_column not in entry:
+ raise ValueError(f"Key '{self.media_column}' not found in JSON entry: {entry}")
+
+ media_path = Path(entry[self.media_column].strip())
+ # Convert media path to embedding output path (same structure, .pt extension)
+ output_path = str(media_path.with_suffix(".pt"))
+ caption_data[output_path] = entry[self.caption_column]
+
+ return caption_data
+
+ def _load_caption_data_from_jsonl(self) -> dict[str, str]:
+ """Load captions from a JSONL file and compute output embedding paths."""
+ caption_data = {}
+ with open(self.dataset_file, "r", encoding="utf-8") as file:
+ for line in file:
+ entry = json.loads(line)
+ if self.caption_column not in entry:
+ raise ValueError(f"Key '{self.caption_column}' not found in JSONL entry: {entry}")
+ if self.media_column not in entry:
+ raise ValueError(f"Key '{self.media_column}' not found in JSONL entry: {entry}")
+
+ media_path = Path(entry[self.media_column].strip())
+ # Convert media path to embedding output path (same structure, .pt extension)
+ output_path = str(media_path.with_suffix(".pt"))
+ caption_data[output_path] = entry[self.caption_column]
+
+ return caption_data
+
+ def _clean_llm_prefixes(self) -> None:
+ """Remove common LLM-generated prefixes from captions."""
+ for i in range(len(self.prompts)):
+ self.prompts[i] = self.prompts[i].strip()
+ for phrase in COMMON_LLM_START_PHRASES:
+ if self.prompts[i].startswith(phrase):
+ self.prompts[i] = self.prompts[i].removeprefix(phrase).strip()
+ break
+
+
+def compute_captions_embeddings(
+ dataset_file: str | Path,
+ output_dir: str,
+ model_path: str,
+ text_encoder_path: str,
+ caption_column: str = "caption",
+ media_column: str = "media_path",
+ lora_trigger: str | None = None,
+ remove_llm_prefixes: bool = False,
+ batch_size: int = 8,
+ device: str = "cuda",
+) -> None:
+ """
+ Process captions and save text embeddings.
+ Args:
+ dataset_file: Path to metadata file (CSV/JSON/JSONL) containing captions and media paths
+ output_dir: Directory to save embeddings
+ model_path: Path to LTX-2 checkpoint (.safetensors)
+ text_encoder_path: Path to Gemma text encoder directory
+ caption_column: Column name containing captions in the metadata file
+ media_column: Column name containing media paths (used for output naming)
+ lora_trigger: Optional trigger word to prepend to each caption
+ remove_llm_prefixes: Whether to remove common LLM-generated prefixes
+ batch_size: Batch size for processing
+ device: Device to use for computation
+ """
+
+ console = Console()
+
+ # Create dataset
+ dataset = CaptionsDataset(
+ dataset_file=dataset_file,
+ caption_column=caption_column,
+ media_column=media_column,
+ lora_trigger=lora_trigger,
+ remove_llm_prefixes=remove_llm_prefixes,
+ )
+ logger.info(f"Loaded {len(dataset):,} captions")
+
+ output_path = Path(output_dir)
+ output_path.mkdir(parents=True, exist_ok=True)
+
+ # Load text encoder
+ with console.status("[bold]Loading Gemma text encoder...", spinner="dots"):
+ text_encoder = load_text_encoder(model_path, text_encoder_path, device=device, dtype=torch.bfloat16)
+
+ logger.info("Text encoder loaded successfully")
+
+ # TODO(batch-tokenization): The current Gemma tokenizer doesn't support batched tokenization.
+ if batch_size > 1:
+ logger.warning(
+ "Batch size greater than 1 is not currently supported with the Gemma tokenizer. "
+ "Overriding batch_size to 1. This will be fixed in a future update."
+ )
+ batch_size = 1
+
+ # Create dataloader
+ dataloader = DataLoader(dataset, batch_size=batch_size, shuffle=False, num_workers=2)
+
+ # Process batches
+ total_batches = len(dataloader)
+ logger.info(f"Processing captions in {total_batches:,} batches...")
+
+ with Progress(
+ SpinnerColumn(),
+ TextColumn("[progress.description]{task.description}"),
+ BarColumn(),
+ TaskProgressColumn(),
+ MofNCompleteColumn(),
+ TimeElapsedColumn(),
+ TimeRemainingColumn(),
+ console=console,
+ ) as progress:
+ task = progress.add_task("Processing captions", total=len(dataloader))
+ for batch in dataloader:
+ # Encode prompts using _preprocess_text (returns embeddings before connector)
+ # This is what we want to save - the connector is applied during training
+ with torch.inference_mode():
+ # TODO(batch-tokenization): When tokenizer supports batching, encode all prompts at once:
+ # prompt_embeds, prompt_attention_mask = text_encoder._preprocess_text(batch["prompt"]) # noqa: ERA001
+ # For now, process one at a time:
+ for i in range(len(batch["prompt"])):
+ prompt_embeds, prompt_attention_mask = text_encoder._preprocess_text(
+ batch["prompt"][i], padding_side="left"
+ )
+
+ output_rel_path = Path(batch["output_path"][i])
+
+ # Create output directory maintaining structure
+ output_dir_path = output_path / output_rel_path.parent
+ output_dir_path.mkdir(parents=True, exist_ok=True)
+
+ embedding_data = {
+ "prompt_embeds": prompt_embeds[0].cpu().contiguous(),
+ "prompt_attention_mask": prompt_attention_mask[0].cpu().contiguous(),
+ }
+
+ output_file = output_path / output_rel_path
+ torch.save(embedding_data, output_file)
+
+ progress.advance(task)
+
+ logger.info(f"Processed {len(dataset):,} captions. Embeddings saved to {output_path}")
+
+
+def main(
+ dataset_file: str = typer.Argument(
+ ...,
+ help="Path to metadata file (CSV/JSON/JSONL) containing captions and media paths",
+ ),
+ output_dir: str = typer.Option(
+ ...,
+ help="Output directory to save text embeddings",
+ ),
+ model_path: str = typer.Option(
+ ...,
+ help="Path to LTX-2 checkpoint (.safetensors file)",
+ ),
+ text_encoder_path: str = typer.Option(
+ ...,
+ help="Path to Gemma text encoder directory",
+ ),
+ caption_column: str = typer.Option(
+ default="caption",
+ help="Column name containing captions in the dataset JSON/JSONL/CSV file",
+ ),
+ media_column: str = typer.Option(
+ default="media_path",
+ help="Column name in the dataset JSON/JSONL/CSV file containing media paths "
+ "(used for output file naming and folder structure)",
+ ),
+ batch_size: int = typer.Option(
+ default=8,
+ help="Batch size for processing",
+ ),
+ device: str = typer.Option(
+ default="cuda",
+ help="Device to use for computation",
+ ),
+ lora_trigger: str | None = typer.Option(
+ default=None,
+ help="Optional trigger word to prepend to each caption (activates the LoRA during inference)",
+ ),
+ remove_llm_prefixes: bool = typer.Option(
+ default=False,
+ help="Remove common LLM-generated prefixes from captions",
+ ),
+) -> None:
+ """Process text captions and save embeddings for video generation training.
+ This script processes captions from metadata files and saves text embeddings
+ that can be used for training video generation models. The output embeddings
+ will maintain the same folder structure and naming as the corresponding media files.
+ Note: This script is designed for LTX-2 models which use the Gemma text encoder.
+ Examples:
+ # Process captions with LTX-2 model
+ python scripts/process_captions.py dataset.json --output-dir ./embeddings \\
+ --model-path /path/to/ltx2_checkpoint.safetensors \\
+ --text-encoder-path /path/to/gemma
+ # Add a trigger word for LoRA training
+ python scripts/process_captions.py dataset.json --output-dir ./embeddings \\
+ --model-path /path/to/ltx2.safetensors --text-encoder-path /path/to/gemma \\
+ --lora-trigger "mytoken"
+ # Remove LLM-generated prefixes from captions
+ python scripts/process_captions.py dataset.json --output-dir ./embeddings \\
+ --model-path /path/to/ltx2.safetensors --text-encoder-path /path/to/gemma \\
+ --remove-llm-prefixes
+ """
+
+ # Validate dataset file
+ if not Path(dataset_file).is_file():
+ raise typer.BadParameter(f"Dataset file not found: {dataset_file}")
+
+ if lora_trigger:
+ logger.info(f'LoRA trigger word "{lora_trigger}" will be prepended to all captions')
+
+ # Process embeddings
+ compute_captions_embeddings(
+ dataset_file=dataset_file,
+ output_dir=output_dir,
+ model_path=model_path,
+ text_encoder_path=text_encoder_path,
+ caption_column=caption_column,
+ media_column=media_column,
+ lora_trigger=lora_trigger,
+ remove_llm_prefixes=remove_llm_prefixes,
+ batch_size=batch_size,
+ device=device,
+ )
+
+
+if __name__ == "__main__":
+ app()
diff --git a/packages/ltx-trainer/scripts/process_dataset.py b/packages/ltx-trainer/scripts/process_dataset.py
new file mode 100755
index 0000000..9ca2e98
--- /dev/null
+++ b/packages/ltx-trainer/scripts/process_dataset.py
@@ -0,0 +1,269 @@
+#!/usr/bin/env python3
+
+"""
+Preprocess a video dataset by computing video clips latents and text captions embeddings.
+This script provides a command-line interface for preprocessing video datasets by computing
+latent representations of video clips and text embeddings of their captions. The preprocessed
+data can be used to accelerate training of video generation models and to save GPU memory.
+Basic usage:
+ python scripts/process_dataset.py /path/to/dataset.json --resolution-buckets 768x768x49 \
+ --model-path /path/to/ltx2.safetensors --text-encoder-path /path/to/gemma
+The dataset must be a CSV, JSON, or JSONL file with columns for captions and video paths.
+"""
+
+from pathlib import Path
+
+import typer
+from decode_latents import LatentsDecoder
+from process_captions import compute_captions_embeddings
+from process_videos import compute_latents, parse_resolution_buckets
+from rich.console import Console
+
+from ltx_trainer import logger
+
+console = Console()
+app = typer.Typer(
+ pretty_exceptions_enable=False,
+ no_args_is_help=True,
+ help="Preprocess a video dataset by computing video clips latents and text captions embeddings. "
+ "The dataset must be a CSV, JSON, or JSONL file with columns for captions and video paths.",
+)
+
+
+def preprocess_dataset( # noqa: PLR0913
+ dataset_file: str,
+ caption_column: str,
+ video_column: str,
+ resolution_buckets: list[tuple[int, int, int]],
+ batch_size: int,
+ output_dir: str | None,
+ lora_trigger: str | None,
+ vae_tiling: bool,
+ decode: bool,
+ model_path: str,
+ text_encoder_path: str,
+ device: str,
+ remove_llm_prefixes: bool = False,
+ reference_column: str | None = None,
+ with_audio: bool = False,
+) -> None:
+ """Run the preprocessing pipeline with the given arguments."""
+ # Validate dataset file
+ _validate_dataset_file(dataset_file)
+
+ # Set up output directories
+ output_base = Path(output_dir) if output_dir else Path(dataset_file).parent / ".precomputed"
+ conditions_dir = output_base / "conditions"
+ latents_dir = output_base / "latents"
+
+ if lora_trigger:
+ logger.info(f'LoRA trigger word "{lora_trigger}" will be prepended to all captions')
+
+ # Process captions using the dedicated function
+ compute_captions_embeddings(
+ dataset_file=dataset_file,
+ output_dir=str(conditions_dir),
+ model_path=model_path,
+ text_encoder_path=text_encoder_path,
+ caption_column=caption_column,
+ media_column=video_column,
+ lora_trigger=lora_trigger,
+ remove_llm_prefixes=remove_llm_prefixes,
+ batch_size=batch_size,
+ device=device,
+ )
+
+ # Process videos using the dedicated function
+ audio_latents_dir = None
+ if with_audio:
+ logger.info("Audio preprocessing enabled - will extract and encode audio from videos")
+ audio_latents_dir = output_base / "audio_latents"
+
+ compute_latents(
+ dataset_file=dataset_file,
+ video_column=video_column,
+ resolution_buckets=resolution_buckets,
+ output_dir=str(latents_dir),
+ model_path=model_path,
+ batch_size=batch_size,
+ device=device,
+ vae_tiling=vae_tiling,
+ with_audio=with_audio,
+ audio_output_dir=str(audio_latents_dir) if audio_latents_dir else None,
+ )
+
+ # Process reference videos if reference_column is provided
+ if reference_column:
+ logger.info("Processing reference videos for IC-LoRA training...")
+ reference_latents_dir = output_base / "reference_latents"
+
+ compute_latents(
+ dataset_file=dataset_file,
+ main_media_column=video_column,
+ video_column=reference_column,
+ resolution_buckets=resolution_buckets,
+ output_dir=str(reference_latents_dir),
+ model_path=model_path,
+ batch_size=batch_size,
+ device=device,
+ vae_tiling=vae_tiling,
+ )
+
+ # Handle decoding if requested (for verification)
+ if decode:
+ logger.info("Decoding latents for verification...")
+
+ decoder = LatentsDecoder(
+ model_path=model_path,
+ device=device,
+ vae_tiling=vae_tiling,
+ with_audio=with_audio,
+ )
+ decoder.decode(latents_dir, output_base / "decoded_videos")
+
+ # Also decode reference videos if they exist
+ if reference_column:
+ reference_latents_dir = output_base / "reference_latents"
+ if reference_latents_dir.exists():
+ logger.info("Decoding reference videos...")
+ decoder.decode(reference_latents_dir, output_base / "decoded_reference_videos")
+
+ # Decode audio latents if they exist
+ if with_audio and audio_latents_dir and audio_latents_dir.exists():
+ logger.info("Decoding audio latents...")
+ decoder.decode_audio(audio_latents_dir, output_base / "decoded_audio")
+
+ # Print summary
+ logger.info(f"Dataset preprocessing complete! Results saved to {output_base}")
+ if reference_column:
+ logger.info("Reference videos processed and saved to reference_latents/ directory for IC-LoRA training")
+ if with_audio:
+ logger.info("Audio latents saved to audio_latents/ directory for audio-video training")
+
+
+def _validate_dataset_file(dataset_path: str) -> None:
+ """Validate that the dataset file exists and has the correct format."""
+ dataset_file = Path(dataset_path)
+
+ if not dataset_file.exists():
+ raise FileNotFoundError(f"Dataset file does not exist: {dataset_file}")
+
+ if not dataset_file.is_file():
+ raise ValueError(f"Dataset path must be a file, not a directory: {dataset_file}")
+
+ if dataset_file.suffix.lower() not in [".csv", ".json", ".jsonl"]:
+ raise ValueError(f"Dataset file must be CSV, JSON, or JSONL format: {dataset_file}")
+
+
+def main( # noqa: PLR0913
+ dataset_path: str = typer.Argument(
+ ...,
+ help="Path to metadata file (CSV/JSON/JSONL) containing captions and video paths",
+ ),
+ resolution_buckets: str = typer.Option(
+ ...,
+ help='Resolution buckets in format "WxHxF;WxHxF;..." (e.g. "768x768x25;512x512x49")',
+ ),
+ model_path: str = typer.Option(
+ ...,
+ help="Path to LTX-2 checkpoint (.safetensors file)",
+ ),
+ text_encoder_path: str = typer.Option(
+ ...,
+ help="Path to Gemma text encoder directory",
+ ),
+ caption_column: str = typer.Option(
+ default="caption",
+ help="Column name containing captions in the dataset JSON/JSONL/CSV file",
+ ),
+ video_column: str = typer.Option(
+ default="media_path",
+ help="Column name containing video paths in the dataset JSON/JSONL/CSV file",
+ ),
+ batch_size: int = typer.Option(
+ default=1,
+ help="Batch size for preprocessing",
+ ),
+ device: str = typer.Option(
+ default="cuda",
+ help="Device to use for computation",
+ ),
+ vae_tiling: bool = typer.Option(
+ default=False,
+ help="Enable VAE tiling for larger video resolutions",
+ ),
+ output_dir: str | None = typer.Option(
+ default=None,
+ help="Output directory (defaults to .precomputed in dataset directory)",
+ ),
+ lora_trigger: str | None = typer.Option(
+ default=None,
+ help="Optional trigger word to prepend to each caption (activates the LoRA during inference)",
+ ),
+ decode: bool = typer.Option(
+ default=False,
+ help="Decode and save latents after encoding (videos and audio) for verification",
+ ),
+ remove_llm_prefixes: bool = typer.Option(
+ default=False,
+ help="Remove LLM prefixes from captions",
+ ),
+ reference_column: str | None = typer.Option(
+ default=None,
+ help="Column name containing reference video paths (for video-to-video training)",
+ ),
+ with_audio: bool = typer.Option(
+ default=False,
+ help="Extract and encode audio from video files",
+ ),
+) -> None:
+ """Preprocess a video dataset by computing and saving latents and text embeddings.
+ The dataset must be a CSV, JSON, or JSONL file with columns for captions and video paths.
+ This script is designed for LTX-2 models which use the Gemma text encoder.
+ Examples:
+ # Process a dataset with LTX-2 model
+ python scripts/process_dataset.py dataset.json --resolution-buckets 768x768x25 \\
+ --model-path /path/to/ltx2.safetensors --text-encoder-path /path/to/gemma
+ # Process dataset with custom column names
+ python scripts/process_dataset.py dataset.json --resolution-buckets 768x768x25 \\
+ --model-path /path/to/ltx2.safetensors --text-encoder-path /path/to/gemma \\
+ --caption-column "text" --video-column "video_path"
+ # Process dataset with reference videos for IC-LoRA training
+ python scripts/process_dataset.py dataset.json --resolution-buckets 768x768x25 \\
+ --model-path /path/to/ltx2.safetensors --text-encoder-path /path/to/gemma \\
+ --reference-column "reference_path"
+ # Process dataset with audio for audio-video training
+ python scripts/process_dataset.py dataset.json --resolution-buckets 768x512x97 \\
+ --model-path /path/to/ltx2.safetensors --text-encoder-path /path/to/gemma \\
+ --with-audio
+ """
+ parsed_resolution_buckets = parse_resolution_buckets(resolution_buckets)
+
+ if len(parsed_resolution_buckets) > 1:
+ logger.warning(
+ "Using multiple resolution buckets. "
+ "When training with multiple resolution buckets, you must use a batch size of 1."
+ )
+
+ preprocess_dataset(
+ dataset_file=dataset_path,
+ caption_column=caption_column,
+ video_column=video_column,
+ resolution_buckets=parsed_resolution_buckets,
+ batch_size=batch_size,
+ output_dir=output_dir,
+ lora_trigger=lora_trigger,
+ vae_tiling=vae_tiling,
+ decode=decode,
+ model_path=model_path,
+ text_encoder_path=text_encoder_path,
+ device=device,
+ remove_llm_prefixes=remove_llm_prefixes,
+ reference_column=reference_column,
+ with_audio=with_audio,
+ )
+
+
+if __name__ == "__main__":
+ app()
diff --git a/packages/ltx-trainer/scripts/process_videos.py b/packages/ltx-trainer/scripts/process_videos.py
new file mode 100755
index 0000000..7cdeed0
--- /dev/null
+++ b/packages/ltx-trainer/scripts/process_videos.py
@@ -0,0 +1,825 @@
+#!/usr/bin/env python3
+
+"""
+Compute latent representations for video generation training.
+This module provides functionality for processing video and image files, including:
+- Loading videos/images from various file formats (CSV, JSON, JSONL)
+- Resizing, cropping, and transforming media
+- MediaDataset for video-only preprocessing workflows
+- BucketSampler for grouping videos by resolution
+Can be used as a standalone script:
+ python scripts/process_videos.py dataset.csv --resolution-buckets 768x768x25 \
+ --output-dir /path/to/output --model-source /path/to/ltx2.safetensors
+"""
+
+import json
+import math
+from pathlib import Path
+from typing import Any
+
+import numpy as np
+import pandas as pd
+import torch
+import torchaudio
+import typer
+from pillow_heif import register_heif_opener
+from rich.console import Console
+from rich.progress import (
+ BarColumn,
+ MofNCompleteColumn,
+ Progress,
+ SpinnerColumn,
+ TaskProgressColumn,
+ TextColumn,
+ TimeElapsedColumn,
+ TimeRemainingColumn,
+)
+from torch.utils.data import DataLoader, Dataset
+from torchvision import transforms
+from torchvision.transforms import InterpolationMode
+from torchvision.transforms.functional import crop, resize, to_tensor
+from transformers.utils.logging import disable_progress_bar
+
+from ltx_core.model.audio_vae import AudioProcessor
+from ltx_trainer import logger
+from ltx_trainer.model_loader import load_audio_vae_encoder, load_video_vae_encoder
+from ltx_trainer.utils import open_image_as_srgb
+from ltx_trainer.video_utils import get_video_frame_count, read_video
+
+disable_progress_bar()
+
+# Register HEIF/HEIC support
+register_heif_opener()
+
+# Constants for validation
+VAE_SPATIAL_FACTOR = 32
+VAE_TEMPORAL_FACTOR = 8
+
+# Audio constants
+AUDIO_LATENT_CHANNELS = 8
+AUDIO_FREQUENCY_BINS = 16
+
+app = typer.Typer(
+ pretty_exceptions_enable=False,
+ no_args_is_help=True,
+ help="Process videos/images and save latent representations for video generation training.",
+)
+
+
+class MediaDataset(Dataset):
+ """
+ Dataset for processing video and image files.
+ This dataset is designed for media preprocessing workflows where you need to:
+ - Load and preprocess videos/images
+ - Apply resizing and cropping transformations
+ - Handle different resolution buckets
+ - Filter out invalid media files
+ - Optionally extract audio from video files
+ """
+
+ def __init__(
+ self,
+ dataset_file: str | Path,
+ main_media_column: str,
+ video_column: str,
+ resolution_buckets: list[tuple[int, int, int]],
+ reshape_mode: str = "center",
+ with_audio: bool = False,
+ ) -> None:
+ """
+ Initialize the media dataset.
+ Args:
+ dataset_file: Path to CSV/JSON/JSONL metadata file
+ video_column: Column name for video paths in the metadata file
+ resolution_buckets: List of (frames, height, width) tuples
+ reshape_mode: How to crop videos ("center", "random")
+ with_audio: Whether to extract audio from video files
+ """
+ super().__init__()
+
+ self.dataset_file = Path(dataset_file)
+ self.main_media_column = main_media_column
+ self.resolution_buckets = resolution_buckets
+ self.reshape_mode = reshape_mode
+ self.with_audio = with_audio
+
+ # First load main media paths
+ self.main_media_paths = self._load_video_paths(main_media_column)
+
+ # Then load reference video paths
+ self.video_paths = self._load_video_paths(video_column)
+
+ # Filter out videos with insufficient frames
+ self._filter_valid_videos()
+
+ self.max_target_frames = max(self.resolution_buckets, key=lambda x: x[0])[0]
+
+ # Set up video transforms
+ self.transforms = transforms.Compose(
+ [
+ transforms.Lambda(lambda x: x.clamp_(0, 1)),
+ transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5], inplace=True),
+ ]
+ )
+
+ def __len__(self) -> int:
+ return len(self.video_paths)
+
+ def __getitem__(self, index: int) -> dict[str, Any]:
+ """Get a single video/image with metadata, and optionally audio."""
+ if isinstance(index, list):
+ # Special case for BucketSampler - return cached data
+ return index
+
+ video_path: Path = self.video_paths[index]
+
+ # Compute relative path of the video
+ data_root = self.dataset_file.parent
+ relative_path = str(video_path.relative_to(data_root))
+ media_relative_path = str(self.main_media_paths[index].relative_to(data_root))
+
+ if video_path.suffix.lower() in [".png", ".jpg", ".jpeg"]:
+ media_tensor = self._preprocess_image(video_path)
+ fps = 1.0
+ audio_data = None # Images don't have audio
+ else:
+ media_tensor, fps = self._preprocess_video(video_path)
+
+ # Extract audio if enabled
+ if self.with_audio:
+ # Calculate target duration from the processed video frames
+ # This ensures audio is trimmed to match the exact video duration
+ # media_tensor is [C, F, H, W] so shape[1] is num_frames
+ target_duration = media_tensor.shape[1] / fps
+ audio_data = self._extract_audio(video_path, target_duration)
+ else:
+ audio_data = None
+
+ # media_tensor is [C, F, H, W] format for VAE compatibility
+ _, num_frames, height, width = media_tensor.shape
+
+ result = {
+ "video": media_tensor,
+ "relative_path": relative_path,
+ "main_media_relative_path": media_relative_path,
+ "video_metadata": {
+ "num_frames": num_frames,
+ "height": height,
+ "width": width,
+ "fps": fps,
+ },
+ }
+
+ # Add audio data if available
+ if audio_data is not None:
+ result["audio"] = audio_data
+
+ return result
+
+ @staticmethod
+ def _extract_audio(video_path: Path, target_duration: float) -> dict[str, torch.Tensor | int] | None:
+ """Extract audio track from a video file, trimmed to match video duration."""
+ try:
+ # torchaudio can extract audio from video files directly
+ # waveform shape: [channels, samples]
+ waveform, sample_rate = torchaudio.load(str(video_path))
+
+ # Trim or pad to target duration
+ target_samples = int(target_duration * sample_rate)
+ current_samples = waveform.shape[-1]
+
+ if current_samples > target_samples:
+ # Trim to target duration
+ waveform = waveform[..., :target_samples]
+ elif current_samples < target_samples:
+ # Pad with zeros to target duration
+ padding = target_samples - current_samples
+ waveform = torch.nn.functional.pad(waveform, (0, padding))
+ logger.warning(f"Padded audio to {target_duration:.2f} seconds for {video_path}")
+
+ return {"waveform": waveform, "sample_rate": sample_rate}
+
+ except Exception as e:
+ logger.debug(f"Could not extract audio from {video_path}: {e}")
+ return None
+
+ def _load_video_paths(self, column: str) -> list[Path]:
+ """Load video paths from the specified data source."""
+ if self.dataset_file.suffix == ".csv":
+ return self._load_video_paths_from_csv(column)
+ elif self.dataset_file.suffix == ".json":
+ return self._load_video_paths_from_json(column)
+ elif self.dataset_file.suffix == ".jsonl":
+ return self._load_video_paths_from_jsonl(column)
+ else:
+ raise ValueError("Expected `dataset_file` to be a path to a CSV, JSON, or JSONL file.")
+
+ def _load_video_paths_from_csv(self, column: str) -> list[Path]:
+ """Load video paths from a CSV file."""
+ df = pd.read_csv(self.dataset_file)
+ if column not in df.columns:
+ raise ValueError(f"Column '{column}' not found in CSV file")
+
+ data_root = self.dataset_file.parent
+ video_paths = [data_root / Path(line.strip()) for line in df[column].tolist()]
+
+ # Validate that all paths exist
+ invalid_paths = [path for path in video_paths if not path.is_file()]
+ if invalid_paths:
+ raise ValueError(f"Found {len(invalid_paths)} invalid video paths. First few: {invalid_paths[:5]}")
+
+ return video_paths
+
+ def _load_video_paths_from_json(self, column: str) -> list[Path]:
+ """Load video paths from a JSON file."""
+ with open(self.dataset_file, "r", encoding="utf-8") as file:
+ data = json.load(file)
+
+ if not isinstance(data, list):
+ raise ValueError("JSON file must contain a list of objects")
+
+ data_root = self.dataset_file.parent
+ video_paths = []
+ for entry in data:
+ if column not in entry:
+ raise ValueError(f"Key '{column}' not found in JSON entry")
+ video_paths.append(data_root / Path(entry[column].strip()))
+
+ # Validate that all paths exist
+ invalid_paths = [path for path in video_paths if not path.is_file()]
+ if invalid_paths:
+ raise ValueError(f"Found {len(invalid_paths)} invalid video paths. First few: {invalid_paths[:5]}")
+
+ return video_paths
+
+ def _load_video_paths_from_jsonl(self, column: str) -> list[Path]:
+ """Load video paths from a JSONL file."""
+ data_root = self.dataset_file.parent
+ video_paths = []
+ with open(self.dataset_file, "r", encoding="utf-8") as file:
+ for line in file:
+ entry = json.loads(line)
+ if column not in entry:
+ raise ValueError(f"Key '{column}' not found in JSONL entry")
+ video_paths.append(data_root / Path(entry[column].strip()))
+
+ # Validate that all paths exist
+ invalid_paths = [path for path in video_paths if not path.is_file()]
+ if invalid_paths:
+ raise ValueError(f"Found {len(invalid_paths)} invalid video paths. First few: {invalid_paths[:5]}")
+
+ return video_paths
+
+ def _filter_valid_videos(self) -> None:
+ """Filter out videos with insufficient frames."""
+ original_length = len(self.video_paths)
+ valid_video_paths = []
+ valid_main_media_paths = []
+ min_frames_required = min(self.resolution_buckets, key=lambda x: x[0])[0]
+
+ for i, video_path in enumerate(self.video_paths):
+ if video_path.suffix.lower() in [".png", ".jpg", ".jpeg"]:
+ valid_video_paths.append(video_path)
+ valid_main_media_paths.append(self.main_media_paths[i])
+ continue
+
+ try:
+ frame_count = get_video_frame_count(video_path)
+
+ if frame_count >= min_frames_required:
+ valid_video_paths.append(video_path)
+ valid_main_media_paths.append(self.main_media_paths[i])
+ else:
+ logger.warning(
+ f"Skipping video at {video_path} - has {frame_count} frames, "
+ f"which is less than the minimum required frames ({min_frames_required})"
+ )
+ except Exception as e:
+ logger.warning(f"Failed to read video at {video_path}: {e!s}")
+
+ # Update both path lists to maintain synchronization
+ self.video_paths = valid_video_paths
+ self.main_media_paths = valid_main_media_paths
+
+ if len(self.video_paths) < original_length:
+ logger.warning(
+ f"Filtered out {original_length - len(self.video_paths)} videos with insufficient frames. "
+ f"Proceeding with {len(self.video_paths)} valid videos."
+ )
+
+ def _preprocess_image(self, path: Path) -> torch.Tensor:
+ """Preprocess a single image by resizing and applying transforms."""
+ image = open_image_as_srgb(path)
+ image = to_tensor(image)
+ image = image.unsqueeze(0) # Add frame dimension [1, C, H, W] for bucket selection
+
+ # Find nearest resolution bucket and resize
+ nearest_bucket = self._get_resolution_bucket_for_item(image)
+ _, target_height, target_width = nearest_bucket
+ image_resized = self._resize_and_crop(image, target_height, target_width)
+ # _resize_and_crop returns [C, H, W] for single-frame input (squeeze removes dim 0)
+
+ # Apply transforms
+ image = self.transforms(image_resized) # [C, H, W] -> [C, H, W]
+
+ # Add frame dimension in VAE format: [C, H, W] -> [C, 1, H, W]
+ image = image.unsqueeze(1)
+ return image
+
+ def _preprocess_video(self, path: Path) -> tuple[torch.Tensor, float]:
+ """Preprocess a video by loading, resizing, and applying transforms.
+ Returns:
+ Tuple of (video tensor in [C, F, H, W] format, fps)
+ """
+ # Load video frames up to max_target_frames
+ video, fps = read_video(path, max_frames=self.max_target_frames)
+
+ nearest_bucket = self._get_resolution_bucket_for_item(video)
+ target_num_frames, target_height, target_width = nearest_bucket
+ frames_resized = self._resize_and_crop(video, target_height, target_width)
+
+ # Trim video to target number of frames
+ frames_resized = frames_resized[:target_num_frames]
+
+ # Apply transforms to each frame and stack
+ video = torch.stack([self.transforms(frame) for frame in frames_resized], dim=0)
+
+ # Permute [F,C,H,W] -> [C,F,H,W] for VAE compatibility
+ # After DataLoader batching, this becomes [B,C,F,H,W] which VAE expects
+ video = video.permute(1, 0, 2, 3).contiguous()
+
+ return video, fps
+
+ def _get_resolution_bucket_for_item(self, media_tensor: torch.Tensor) -> tuple[int, int, int]:
+ """Get the nearest resolution bucket for the given media tensor."""
+ num_frames, _, height, width = media_tensor.shape
+
+ def distance(bucket: tuple[int, int, int]) -> tuple:
+ bucket_num_frames, bucket_height, bucket_width = bucket
+ # Lexicographic key:
+ # 1) minimize aspect-ratio diff (in log-scale, for invariance to shorter/longer ARs)
+ # 2) prefer buckets with more frames (by using negative)
+ # 3) prefer buckets with larger spatial area (by using negative)
+ return (
+ abs(math.log(width / height) - math.log(bucket_width / bucket_height)),
+ -bucket_num_frames,
+ -(bucket_height * bucket_width),
+ )
+
+ # Keep only buckets with <= available frames
+ relevant_buckets = [b for b in self.resolution_buckets if b[0] <= num_frames]
+ if not relevant_buckets:
+ raise ValueError(f"No resolution buckets have <= {num_frames} frames. Available: {self.resolution_buckets}")
+
+ # Find the bucket with the minimal distance (according to the function above) to the media item's shape.
+ nearest_bucket = min(relevant_buckets, key=distance)
+
+ return nearest_bucket
+
+ def _resize_and_crop(self, media_tensor: torch.Tensor, target_height: int, target_width: int) -> torch.Tensor:
+ """Resize and crop tensor to target size."""
+ # Get current dimensions
+ current_height, current_width = media_tensor.shape[2], media_tensor.shape[3]
+
+ # Calculate aspect ratios to determine which dimension to resize first
+ current_aspect = current_width / current_height
+ target_aspect = target_width / target_height
+
+ # Resize while maintaining aspect ratio - scale to make the smaller dimension fit
+ if current_aspect > target_aspect:
+ # Current is wider than target, so scale by height
+ new_width = int(current_width * target_height / current_height)
+ media_tensor = resize(
+ media_tensor,
+ size=[target_height, new_width], # type: ignore
+ interpolation=InterpolationMode.BICUBIC,
+ )
+ else:
+ # Current is taller than target, so scale by width
+ new_height = int(current_height * target_width / current_width)
+ media_tensor = resize(
+ media_tensor,
+ size=[new_height, target_width],
+ interpolation=InterpolationMode.BICUBIC,
+ )
+
+ # Update dimensions after resize
+ current_height, current_width = media_tensor.shape[2], media_tensor.shape[3]
+ media_tensor = media_tensor.squeeze(0)
+
+ # Calculate how much we need to crop from each dimension
+ delta_h = current_height - target_height
+ delta_w = current_width - target_width
+
+ # Determine crop position based on reshape mode
+ if self.reshape_mode == "random":
+ # Random crop position
+ top = np.random.randint(0, delta_h + 1)
+ left = np.random.randint(0, delta_w + 1)
+ elif self.reshape_mode == "center":
+ # Center crop
+ top, left = delta_h // 2, delta_w // 2
+ else:
+ raise ValueError(f"Unsupported reshape mode: {self.reshape_mode}")
+
+ # Perform the final crop to exact target dimensions
+ media_tensor = crop(media_tensor, top=top, left=left, height=target_height, width=target_width)
+ return media_tensor
+
+
+def compute_latents( # noqa: PLR0913, PLR0915
+ dataset_file: str | Path,
+ video_column: str,
+ resolution_buckets: list[tuple[int, int, int]],
+ output_dir: str,
+ model_path: str,
+ main_media_column: str | None = None,
+ reshape_mode: str = "center",
+ batch_size: int = 1,
+ device: str = "cuda",
+ vae_tiling: bool = False,
+ with_audio: bool = False,
+ audio_output_dir: str | None = None,
+) -> None:
+ """
+ Process videos and save latent representations.
+ Args:
+ dataset_file: Path to metadata file (CSV/JSON/JSONL) containing video paths
+ video_column: Column name for video paths in the metadata file
+ resolution_buckets: List of (frames, height, width) tuples
+ output_dir: Directory to save video latents
+ model_path: Path to LTX-2 checkpoint (.safetensors)
+ reshape_mode: How to crop videos ("center", "random")
+ main_media_column: Column name for main media paths (if different from video_column)
+ batch_size: Batch size for processing
+ device: Device to use for computation
+ vae_tiling: Whether to enable VAE tiling
+ with_audio: Whether to extract and encode audio from videos
+ audio_output_dir: Directory to save audio latents (required if with_audio=True)
+ """
+ # Validate audio parameters
+ if with_audio and audio_output_dir is None:
+ raise ValueError("audio_output_dir must be provided when with_audio=True")
+
+ console = Console()
+ torch_device = torch.device(device)
+
+ # Create dataset
+ dataset = MediaDataset(
+ dataset_file=dataset_file,
+ main_media_column=main_media_column or video_column,
+ video_column=video_column,
+ resolution_buckets=resolution_buckets,
+ reshape_mode=reshape_mode,
+ with_audio=with_audio,
+ )
+ logger.info(f"Loaded {len(dataset)} valid media files")
+
+ output_path = Path(output_dir)
+ output_path.mkdir(parents=True, exist_ok=True)
+
+ # Set up audio output directory if needed
+ audio_output_path = None
+ if with_audio:
+ audio_output_path = Path(audio_output_dir)
+ audio_output_path.mkdir(parents=True, exist_ok=True)
+
+ # Load video VAE encoder
+ with console.status(f"[bold]Loading video VAE encoder from [cyan]{model_path}[/]...", spinner="dots"):
+ vae = load_video_vae_encoder(model_path, device=torch_device, dtype=torch.bfloat16)
+
+ if vae_tiling:
+ vae.enable_tiling()
+
+ # Load audio VAE encoder and audio processor if needed
+ audio_vae_encoder = None
+ audio_processor = None
+ if with_audio:
+ with console.status(f"[bold]Loading audio VAE encoder from [cyan]{model_path}[/]...", spinner="dots"):
+ audio_vae_encoder = load_audio_vae_encoder(
+ checkpoint_path=model_path,
+ device=torch_device,
+ dtype=torch.float32, # Audio VAE needs float32 for quality. TODO: re-test with bfloat16.
+ )
+ # Create audio processor for waveform-to-spectrogram conversion
+ audio_processor = AudioProcessor(
+ sample_rate=audio_vae_encoder.sample_rate,
+ mel_bins=audio_vae_encoder.mel_bins,
+ mel_hop_length=audio_vae_encoder.mel_hop_length,
+ n_fft=audio_vae_encoder.n_fft,
+ ).to(torch_device)
+
+ # Create dataloader
+ # Note: batch_size=1 required when with_audio because audio extraction can fail for some videos,
+ # and the default collate function can't handle mixed None/dict values across a batch.
+ if with_audio and batch_size > 1:
+ logger.warning("Audio processing requires batch_size=1. Overriding batch_size to 1.")
+ batch_size = 1
+ dataloader = DataLoader(dataset, batch_size=batch_size, shuffle=False, num_workers=4)
+
+ # Track audio statistics
+ audio_success_count = 0
+ audio_skip_count = 0
+
+ # Process batches
+ with Progress(
+ SpinnerColumn(),
+ TextColumn("[progress.description]{task.description}"),
+ BarColumn(),
+ TaskProgressColumn(),
+ MofNCompleteColumn(),
+ TimeElapsedColumn(),
+ TimeRemainingColumn(),
+ console=console,
+ ) as progress:
+ task = progress.add_task("Processing videos", total=len(dataloader))
+
+ for batch in dataloader:
+ # Get video tensor - shape is [B, F, C, H, W] from DataLoader
+ video = batch["video"]
+
+ # Encode video
+ with torch.inference_mode():
+ video_latent_data = encode_video(vae=vae, video=video)
+
+ # Save latents for each item in batch
+ for i in range(len(batch["relative_path"])):
+ output_rel_path = Path(batch["main_media_relative_path"][i]).with_suffix(".pt")
+ output_file = output_path / output_rel_path
+
+ # Create output directory maintaining structure
+ output_file.parent.mkdir(parents=True, exist_ok=True)
+
+ # Index into batch to get this item's latents
+ latent_data = {
+ "latents": video_latent_data["latents"][i].cpu().contiguous(), # [C, F', H', W']
+ "num_frames": video_latent_data["num_frames"],
+ "height": video_latent_data["height"],
+ "width": video_latent_data["width"],
+ "fps": batch["video_metadata"]["fps"][i].item(),
+ }
+
+ torch.save(latent_data, output_file)
+
+ # Process audio if enabled (audio is already extracted by the dataset)
+ if with_audio:
+ audio_batch = batch.get("audio")
+ if audio_batch is not None:
+ # Extract the i-th item from batched audio data
+ # DataLoader collates [channels, samples] -> [batch, channels, samples]
+ audio_data = {
+ "waveform": audio_batch["waveform"][i],
+ "sample_rate": audio_batch["sample_rate"][i].item(),
+ }
+
+ # Encode audio
+ with torch.inference_mode():
+ audio_latents = encode_audio(audio_vae_encoder, audio_processor, audio_data)
+
+ # Save audio latents
+ audio_output_file = audio_output_path / output_rel_path
+ audio_output_file.parent.mkdir(parents=True, exist_ok=True)
+
+ audio_save_data = {
+ "latents": audio_latents["latents"].cpu().contiguous(),
+ "num_time_steps": audio_latents["num_time_steps"],
+ "frequency_bins": audio_latents["frequency_bins"],
+ "duration": audio_latents["duration"],
+ }
+
+ torch.save(audio_save_data, audio_output_file)
+ audio_success_count += 1
+ else:
+ # Video has no audio track
+ audio_skip_count += 1
+
+ progress.advance(task)
+
+ # Log summary
+ logger.info(f"Processed {len(dataset)} videos. Latents saved to {output_path}")
+ if with_audio:
+ logger.info(
+ f"Audio processing: {audio_success_count} videos with audio, "
+ f"{audio_skip_count} videos without audio (skipped)"
+ )
+
+
+def encode_video(
+ vae: torch.nn.Module,
+ video: torch.Tensor,
+ dtype: torch.dtype | None = None,
+) -> dict[str, torch.Tensor | int]:
+ """Encode video into non-patchified latent representation.
+ Args:
+ vae: Video VAE encoder model
+ video: Input tensor of shape [B, C, F, H, W] (batch, channels, frames, height, width)
+ This is the format expected by the VAE encoder.
+ dtype: Target dtype for output latents
+ Returns:
+ Dict containing non-patchified latents and shape information:
+ {
+ "latents": Tensor[B, C, F', H', W'], # Non-patchified format with batch dim
+ "num_frames": int, # Latent frame count
+ "height": int, # Latent height
+ "width": int, # Latent width
+ }
+ """
+ device = next(vae.parameters()).device
+ vae_dtype = next(vae.parameters()).dtype
+
+ # Add batch dimension if needed
+ if video.ndim == 4:
+ video = video.unsqueeze(0) # [C, F, H, W] -> [B, C, F, H, W]
+
+ video = video.to(device=device, dtype=vae_dtype)
+
+ # Encode video - VAE expects [B, C, F, H, W], returns [B, C, F', H', W']
+ latents = vae(video)
+
+ if dtype is not None:
+ latents = latents.to(dtype=dtype)
+
+ _, _, num_frames, height, width = latents.shape
+
+ return {
+ "latents": latents, # [B, C, F', H', W']
+ "num_frames": num_frames,
+ "height": height,
+ "width": width,
+ }
+
+
+def encode_audio(
+ audio_vae_encoder: torch.nn.Module,
+ audio_processor: torch.nn.Module,
+ audio_data: dict[str, torch.Tensor | int],
+) -> dict[str, torch.Tensor | int | float]:
+ """Encode audio waveform into latent representation.
+ Args:
+ audio_vae_encoder: Audio VAE encoder model from ltx-core
+ audio_processor: AudioProcessor for waveform-to-spectrogram conversion
+ audio_data: Dict with {"waveform": Tensor[channels, samples], "sample_rate": int}
+ Returns:
+ Dict containing audio latents and shape information:
+ {
+ "latents": Tensor[C, T, F], # Non-patchified format
+ "num_time_steps": int,
+ "frequency_bins": int,
+ "duration": float,
+ }
+ """
+ device = next(audio_vae_encoder.parameters()).device
+ dtype = next(audio_vae_encoder.parameters()).dtype
+
+ waveform = audio_data["waveform"].to(device=device, dtype=dtype)
+ sample_rate = audio_data["sample_rate"]
+
+ # Add batch dimension if needed: [channels, samples] -> [batch, channels, samples]
+ if waveform.dim() == 2:
+ waveform = waveform.unsqueeze(0)
+
+ # Calculate duration
+ duration = waveform.shape[-1] / sample_rate
+
+ # Convert waveform to mel spectrogram using AudioProcessor
+ mel_spectrogram = audio_processor.waveform_to_mel(waveform, waveform_sample_rate=sample_rate)
+ mel_spectrogram = mel_spectrogram.to(dtype=dtype)
+
+ # Encode mel spectrogram to latents
+ latents = audio_vae_encoder(mel_spectrogram)
+
+ # latents shape: [batch, channels, time, freq] = [1, 8, T, 16]
+ _, _channels, time_steps, freq_bins = latents.shape
+
+ return {
+ "latents": latents.squeeze(0), # [C, T, F] - remove batch dim
+ "num_time_steps": time_steps,
+ "frequency_bins": freq_bins,
+ "duration": duration,
+ }
+
+
+def parse_resolution_buckets(resolution_buckets_str: str) -> list[tuple[int, int, int]]:
+ """Parse resolution buckets from string format to list of tuples (frames, height, width)"""
+ resolution_buckets = []
+ for bucket_str in resolution_buckets_str.split(";"):
+ w, h, f = map(int, bucket_str.split("x"))
+
+ if w % VAE_SPATIAL_FACTOR != 0 or h % VAE_SPATIAL_FACTOR != 0:
+ raise typer.BadParameter(
+ f"Width and height must be multiples of {VAE_SPATIAL_FACTOR}, got {w}x{h}",
+ param_hint="resolution-buckets",
+ )
+
+ if f % VAE_TEMPORAL_FACTOR != 1:
+ raise typer.BadParameter(
+ f"Number of frames must be a multiple of {VAE_TEMPORAL_FACTOR} plus 1, got {f}",
+ param_hint="resolution-buckets",
+ )
+
+ resolution_buckets.append((f, h, w))
+ return resolution_buckets
+
+
+def main( # noqa: PLR0913
+ dataset_file: str = typer.Argument(
+ ...,
+ help="Path to metadata file (CSV/JSON/JSONL) containing video paths",
+ ),
+ resolution_buckets: str = typer.Option(
+ ...,
+ help='Resolution buckets in format "WxHxF;WxHxF;..." (e.g. "768x768x25;512x512x49")',
+ ),
+ output_dir: str = typer.Option(
+ ...,
+ help="Output directory to save video latents",
+ ),
+ model_path: str = typer.Option(
+ ...,
+ help="Path to LTX-2 checkpoint (.safetensors file)",
+ ),
+ video_column: str = typer.Option(
+ default="media_path",
+ help="Column name in the dataset JSON/JSONL/CSV file containing video paths",
+ ),
+ batch_size: int = typer.Option(
+ default=1,
+ help="Batch size for processing",
+ ),
+ device: str = typer.Option(
+ default="cuda",
+ help="Device to use for computation",
+ ),
+ vae_tiling: bool = typer.Option(
+ default=False,
+ help="Enable VAE tiling for larger video resolutions",
+ ),
+ reshape_mode: str = typer.Option(
+ default="center",
+ help="How to crop videos: 'center' or 'random'",
+ ),
+ with_audio: bool = typer.Option(
+ default=False,
+ help="Extract and encode audio from video files",
+ ),
+ audio_output_dir: str | None = typer.Option(
+ default=None,
+ help="Output directory for audio latents (required if --with-audio is set)",
+ ),
+) -> None:
+ """Process videos/images and save latent representations for video generation training.
+ This script processes videos and images from metadata files and saves latent representations
+ that can be used for training video generation models. The output latents will maintain
+ the same folder structure and naming as the corresponding media files.
+ Examples:
+ # Process videos from a CSV file
+ python scripts/process_videos.py dataset.csv --resolution-buckets 768x768x25 \\
+ --output-dir ./latents --model-path /path/to/ltx2.safetensors
+ # Process videos from a JSON file with custom video column
+ python scripts/process_videos.py dataset.json --resolution-buckets 768x768x25 \\
+ --output-dir ./latents --model-path /path/to/ltx2.safetensors --video-column "video_path"
+ # Enable VAE tiling to save GPU VRAM
+ python scripts/process_videos.py dataset.csv --resolution-buckets 1024x1024x25 \\
+ --output-dir ./latents --model-path /path/to/ltx2.safetensors --vae-tiling
+ # Process videos with audio
+ python scripts/process_videos.py dataset.csv --resolution-buckets 768x768x25 \\
+ --output-dir ./latents --model-path /path/to/ltx2.safetensors \\
+ --with-audio --audio-output-dir ./audio_latents
+ """
+
+ # Validate dataset file exists
+ if not Path(dataset_file).is_file():
+ raise typer.BadParameter(f"Dataset file not found: {dataset_file}")
+
+ # Validate audio parameters
+ if with_audio and audio_output_dir is None:
+ raise typer.BadParameter("--audio-output-dir is required when --with-audio is set")
+
+ # Parse resolution buckets
+ parsed_resolution_buckets = parse_resolution_buckets(resolution_buckets)
+
+ if len(parsed_resolution_buckets) > 1:
+ logger.warning(
+ "Using multiple resolution buckets. "
+ "When training with multiple resolution buckets, you must use a batch size of 1."
+ )
+
+ # Process latents
+ compute_latents(
+ dataset_file=dataset_file,
+ video_column=video_column,
+ resolution_buckets=parsed_resolution_buckets,
+ output_dir=output_dir,
+ model_path=model_path,
+ reshape_mode=reshape_mode,
+ batch_size=batch_size,
+ device=device,
+ vae_tiling=vae_tiling,
+ with_audio=with_audio,
+ audio_output_dir=audio_output_dir,
+ )
+
+
+if __name__ == "__main__":
+ app()
diff --git a/packages/ltx-trainer/scripts/split_scenes.py b/packages/ltx-trainer/scripts/split_scenes.py
new file mode 100755
index 0000000..0cfce5c
--- /dev/null
+++ b/packages/ltx-trainer/scripts/split_scenes.py
@@ -0,0 +1,417 @@
+#!/usr/bin/env python3
+
+"""
+Split video into scenes using PySceneDetect.
+This script provides a command-line interface for splitting videos into scenes using various detection algorithms.
+It supports multiple detection methods, preview image generation, and customizable parameters for fine-tuning
+the scene detection process.
+Basic usage:
+ # Split video using default content-based detection
+ scenes_split.py input.mp4 output_dir/
+ # Save 3 preview images per scene
+ scenes_split.py input.mp4 output_dir/ --save-images 3
+ # Process specific duration and filter short scenes
+ scenes_split.py input.mp4 output_dir/ --duration 60s --filter-shorter-than 2s
+Advanced usage:
+ # Content detection with minimum scene length and frame skip
+ scenes_split.py input.mp4 output_dir/ --detector content --min-scene-length 30 --frame-skip 2
+ # Use adaptive detection with custom detector and detector parameters
+ scenes_split.py input.mp4 output_dir/ --detector adaptive --threshold 3.0 --adaptive-window 10
+"""
+
+from enum import Enum
+from pathlib import Path
+from typing import List, Optional, Tuple
+
+import typer
+from scenedetect import (
+ AdaptiveDetector,
+ ContentDetector,
+ HistogramDetector,
+ SceneManager,
+ ThresholdDetector,
+ open_video,
+)
+from scenedetect.frame_timecode import FrameTimecode
+from scenedetect.scene_manager import SceneDetector, write_scene_list_html
+from scenedetect.scene_manager import save_images as save_scene_images
+from scenedetect.stats_manager import StatsManager
+from scenedetect.video_splitter import split_video_ffmpeg
+
+app = typer.Typer(no_args_is_help=True, help="Split video into scenes using PySceneDetect.")
+
+
+class DetectorType(str, Enum):
+ """Available scene detection algorithms."""
+
+ CONTENT = "content" # Detects fast cuts using HSV color space
+ ADAPTIVE = "adaptive" # Detects fast two-phase cuts
+ THRESHOLD = "threshold" # Detects fast cuts/slow fades in from and out to a given threshold level
+ HISTOGRAM = "histogram" # Detects based on YUV histogram differences in adjacent frames
+
+
+def create_detector(
+ detector_type: DetectorType,
+ threshold: Optional[float] = None,
+ min_scene_len: Optional[int] = None,
+ luma_only: Optional[bool] = None,
+ adaptive_window: Optional[int] = None,
+ fade_bias: Optional[float] = None,
+) -> SceneDetector:
+ """Create a scene detector based on the specified type and parameters.
+ Args:
+ detector_type: Type of detector to create
+ threshold: Detection threshold (meaning varies by detector)
+ min_scene_len: Minimum scene length in frames
+ luma_only: If True, only use brightness for content detection
+ adaptive_window: Window size for adaptive detection
+ fade_bias: Bias for fade in/out detection (-1.0 to 1.0)
+ Note: Parameters set to None will use the detector's built-in default values.
+ Returns:
+ Configured scene detector instance
+ """
+ # Set common arguments
+ kwargs = {}
+ if threshold is not None:
+ kwargs["threshold"] = threshold
+
+ if min_scene_len is not None:
+ kwargs["min_scene_len"] = min_scene_len
+
+ match detector_type:
+ case DetectorType.CONTENT:
+ if luma_only is not None:
+ kwargs["luma_only"] = luma_only
+ return ContentDetector(**kwargs)
+ case DetectorType.ADAPTIVE:
+ if adaptive_window is not None:
+ kwargs["window_width"] = adaptive_window
+ if luma_only is not None:
+ kwargs["luma_only"] = luma_only
+ if "threshold" in kwargs:
+ # Special case for adaptive detector which uses different param name
+ kwargs["adaptive_threshold"] = kwargs.pop("threshold")
+ return AdaptiveDetector(**kwargs)
+ case DetectorType.THRESHOLD:
+ if fade_bias is not None:
+ kwargs["fade_bias"] = fade_bias
+ return ThresholdDetector(**kwargs)
+ case DetectorType.HISTOGRAM:
+ return HistogramDetector(**kwargs)
+ case _:
+ raise ValueError(f"Unknown detector type: {detector_type}")
+
+
+def validate_output_dir(output_dir: str) -> Path:
+ """Validate and create output directory if it doesn't exist.
+ Args:
+ output_dir: Path to the output directory
+ Returns:
+ Path object of the validated output directory
+ """
+ path = Path(output_dir)
+
+ if path.exists() and not path.is_dir():
+ raise typer.BadParameter(f"{output_dir} exists but is not a directory")
+
+ return path
+
+
+def parse_timecode(video: any, time_str: Optional[str]) -> Optional[FrameTimecode]:
+ """Parse a timecode string into a FrameTimecode object.
+ Supports formats:
+ - Frames: '123'
+ - Seconds: '123s' or '123.45s'
+ - Timecode: '00:02:03' or '00:02:03.456'
+ Args:
+ video: Video object to get framerate from
+ time_str: String to parse, or None
+ Returns:
+ FrameTimecode object or None if input is None
+ """
+ if time_str is None:
+ return None
+
+ try:
+ if time_str.endswith("s"):
+ # Seconds format
+ seconds = float(time_str[:-1])
+ return FrameTimecode(timecode=seconds, fps=video.frame_rate)
+ elif ":" in time_str:
+ # Timecode format
+ return FrameTimecode(timecode=time_str, fps=video.frame_rate)
+ else:
+ # Frame number format
+ return FrameTimecode(timecode=int(time_str), fps=video.frame_rate)
+ except ValueError as e:
+ raise typer.BadParameter(
+ f"Invalid timecode format: {time_str}. Use frames (123), "
+ f"seconds (123s/123.45s), or timecode (HH:MM:SS[.nnn])",
+ ) from e
+
+
+def detect_and_split_scenes( # noqa: PLR0913
+ video_path: str,
+ output_dir: Path,
+ detector_type: DetectorType,
+ threshold: Optional[float] = None,
+ min_scene_len: Optional[int] = None,
+ max_scenes: Optional[int] = None,
+ filter_shorter_than: Optional[str] = None,
+ skip_start: Optional[int] = None, # noqa: ARG001
+ skip_end: Optional[int] = None, # noqa: ARG001
+ save_images_per_scene: int = 0,
+ stats_file: Optional[str] = None,
+ luma_only: bool = False,
+ adaptive_window: Optional[int] = None,
+ fade_bias: Optional[float] = None,
+ downscale_factor: Optional[int] = None,
+ frame_skip: int = 0,
+ duration: Optional[str] = None,
+) -> List[Tuple[FrameTimecode, FrameTimecode]]:
+ """Detect and split scenes in a video using the specified parameters.
+ Args:
+ video_path: Path to input video.
+ output_dir: Directory to save output split scenes.
+ detector_type: Type of scene detector to use.
+ threshold: Detection threshold.
+ min_scene_len: Minimum scene length in frames.
+ max_scenes: Maximum number of scenes to detect.
+ filter_shorter_than: Filter out scenes shorter than this duration (frames/seconds/timecode)
+ skip_start: Number of frames to skip at start.
+ skip_end: Number of frames to skip at end.
+ save_images_per_scene: Number of images to save per scene (0 to disable).
+ stats_file: Path to save detection statistics (optional).
+ luma_only: Only use brightness for content detection.
+ adaptive_window: Window size for adaptive detection.
+ fade_bias: Bias for fade detection (-1.0 to 1.0).
+ downscale_factor: Factor to downscale frames by during detection.
+ frame_skip: Number of frames to skip (i.e. process every 1 in N+1 frames,
+ where N is frame_skip, processing only 1/N+1 percent of the video,
+ speeding up the detection time at the expense of accuracy).
+ frame_skip must be 0 (the default) when using a StatsManager.
+ duration: How much of the video to process from start position.
+ Can be specified as frames (123), seconds (123s/123.45s),
+ or timecode (HH:MM:SS[.nnn]).
+ Returns:
+ List of detected scenes as (start, end) FrameTimecode pairs.
+ """
+ # Create video stream
+ video = open_video(video_path, backend="opencv")
+
+ # Parse duration if specified
+ duration_tc = parse_timecode(video, duration)
+
+ # Parse filter_shorter_than if specified
+ filter_shorter_than_tc = parse_timecode(video, filter_shorter_than)
+
+ # Initialize scene manager with optional stats manager
+ stats_manager = StatsManager() if stats_file else None
+ scene_manager = SceneManager(stats_manager)
+
+ # Configure scene manager
+ if downscale_factor:
+ scene_manager.auto_downscale = False
+ scene_manager.downscale = downscale_factor
+
+ # Create and add detector
+ detector = create_detector(
+ detector_type=detector_type,
+ threshold=threshold,
+ min_scene_len=min_scene_len,
+ luma_only=luma_only,
+ adaptive_window=adaptive_window,
+ fade_bias=fade_bias,
+ )
+ scene_manager.add_detector(detector)
+
+ # Detect scenes
+ typer.echo("Detecting scenes...")
+ scene_manager.detect_scenes(
+ video=video,
+ show_progress=True,
+ frame_skip=frame_skip,
+ duration=duration_tc,
+ )
+
+ # Get scene list
+ scenes = scene_manager.get_scene_list()
+
+ # Filter out scenes that are too short if filter_shorter_than is specified
+ if filter_shorter_than_tc:
+ original_count = len(scenes)
+ scenes = [
+ (start, end)
+ for start, end in scenes
+ if (end.get_frames() - start.get_frames()) >= filter_shorter_than_tc.get_frames()
+ ]
+ if len(scenes) < original_count:
+ typer.echo(
+ f"Filtered out {original_count - len(scenes)} scenes shorter "
+ f"than {filter_shorter_than_tc.get_seconds():.1f} seconds "
+ f"({filter_shorter_than_tc.get_frames()} frames)",
+ )
+
+ # Apply max scenes limit if specified
+ if max_scenes and len(scenes) > max_scenes:
+ typer.echo(f"Dropping last {len(scenes) - max_scenes} scenes to meet max_scenes ({max_scenes}) limit")
+ scenes = scenes[:max_scenes]
+
+ # Print scene information
+ typer.echo(f"Found {len(scenes)} scenes:")
+ for i, (start, end) in enumerate(scenes, 1):
+ typer.echo(
+ f"Scene {i}: {start.get_timecode()} to {end.get_timecode()} "
+ f"({end.get_frames() - start.get_frames()} frames)",
+ )
+
+ # Save stats if requested
+ if stats_file:
+ typer.echo(f"Saving detection stats to {stats_file}")
+ stats_manager.save_to_csv(stats_file)
+
+ # Split video into scenes
+ typer.echo("Splitting video into scenes...")
+ try:
+ split_video_ffmpeg(
+ input_video_path=video_path,
+ scene_list=scenes,
+ output_dir=output_dir,
+ show_progress=True,
+ )
+ typer.echo(f"Scenes have been saved to: {output_dir}")
+ except Exception as e:
+ raise typer.BadParameter(f"Error splitting video: {e}") from e
+
+ # Save preview images if requested
+ if save_images_per_scene > 0:
+ typer.echo(f"Saving {save_images_per_scene} preview images per scene...")
+ image_filenames = save_scene_images(
+ scene_list=scenes,
+ video=video,
+ num_images=save_images_per_scene,
+ output_dir=str(output_dir),
+ show_progress=True,
+ )
+
+ # Generate HTML report with scene information and previews
+ html_path = output_dir / "scene_report.html"
+ write_scene_list_html(
+ output_html_filename=str(html_path),
+ scene_list=scenes,
+ image_filenames=image_filenames,
+ )
+ typer.echo(f"Scene report saved to: {html_path}")
+
+ return scenes
+
+
+def main( # noqa: PLR0913
+ video_path: Path = typer.Argument( # noqa: B008
+ ...,
+ help="Path to the input video file",
+ exists=True,
+ dir_okay=False,
+ ),
+ output_dir: str = typer.Argument(
+ ...,
+ help="Directory where split scenes will be saved",
+ ),
+ detector: DetectorType = typer.Option( # noqa: B008
+ DetectorType.CONTENT,
+ help="Scene detection algorithm to use",
+ ),
+ threshold: Optional[float] = typer.Option(
+ None,
+ help="Detection threshold (meaning varies by detector)",
+ ),
+ max_scenes: Optional[int] = typer.Option(
+ None,
+ help="Maximum number of scenes to produce",
+ ),
+ min_scene_length: Optional[int] = typer.Option(
+ None,
+ help="Minimum scene length during detection. Forces the detector to make scenes at least this many frames. "
+ "This affects scene detection behavior but does not filter out short scenes.",
+ ),
+ filter_shorter_than: Optional[str] = typer.Option(
+ None,
+ help="Filter out scenes shorter than this duration. Can be specified as frames (123), "
+ "seconds (123s/123.45s), or timecode (HH:MM:SS[.nnn]). These scenes will be detected but not saved.",
+ ),
+ skip_start: Optional[int] = typer.Option(
+ None,
+ help="Number of frames to skip at the start of the video",
+ ),
+ skip_end: Optional[int] = typer.Option(
+ None,
+ help="Number of frames to skip at the end of the video",
+ ),
+ duration: Optional[str] = typer.Option(
+ None,
+ "-d",
+ help="How much of the video to process. Can be specified as frames (123), "
+ "seconds (123s/123.45s), or timecode (HH:MM:SS[.nnn])",
+ ),
+ save_images: int = typer.Option(
+ 0,
+ help="Number of preview images to save per scene (0 to disable)",
+ ),
+ stats_file: Optional[str] = typer.Option(
+ None,
+ help="Path to save detection statistics CSV",
+ ),
+ luma_only: bool = typer.Option(
+ False,
+ help="Only use brightness for content detection",
+ ),
+ adaptive_window: Optional[int] = typer.Option(
+ None,
+ help="Window size for adaptive detection",
+ ),
+ fade_bias: Optional[float] = typer.Option(
+ None,
+ help="Bias for fade detection (-1.0 to 1.0)",
+ ),
+ downscale: Optional[int] = typer.Option(
+ None,
+ help="Factor to downscale frames by during detection",
+ ),
+ frame_skip: int = typer.Option(
+ 0,
+ help="Number of frames to skip during processing",
+ ),
+) -> None:
+ """Split video into scenes using PySceneDetect."""
+ if skip_start or skip_end:
+ typer.echo("Skipping start and end frames is not supported yet.")
+ return
+
+ # Validate output directory
+ output_path = validate_output_dir(output_dir)
+
+ # Detect and split scenes
+ detect_and_split_scenes(
+ video_path=str(video_path),
+ output_dir=output_path,
+ detector_type=detector,
+ threshold=threshold,
+ min_scene_len=min_scene_length,
+ max_scenes=max_scenes,
+ filter_shorter_than=filter_shorter_than,
+ skip_start=skip_start,
+ skip_end=skip_end,
+ duration=duration,
+ save_images_per_scene=save_images,
+ stats_file=stats_file,
+ luma_only=luma_only,
+ adaptive_window=adaptive_window,
+ fade_bias=fade_bias,
+ downscale_factor=downscale,
+ frame_skip=frame_skip,
+ )
+
+
+if __name__ == "__main__":
+ app()
diff --git a/packages/ltx-trainer/scripts/train.py b/packages/ltx-trainer/scripts/train.py
new file mode 100755
index 0000000..3d86787
--- /dev/null
+++ b/packages/ltx-trainer/scripts/train.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+"""
+Train LTXV models using configuration from YAML files.
+This script provides a command-line interface for training LTXV models using
+either LoRA fine-tuning or full model fine-tuning. It loads configuration from
+a YAML file and passes it to the trainer.
+Basic usage:
+ python scripts/train.py CONFIG_PATH [--disable-progress-bars]
+For multi-GPU/FSDP training, configure and launch via Accelerate:
+ accelerate config
+ accelerate launch scripts/train.py CONFIG_PATH
+"""
+
+from pathlib import Path
+
+import typer
+import yaml
+from rich.console import Console
+
+from ltx_trainer.config import LtxTrainerConfig
+from ltx_trainer.trainer import LtxvTrainer
+
+console = Console()
+app = typer.Typer(
+ pretty_exceptions_enable=False,
+ no_args_is_help=True,
+ help="Train LTXV models using configuration from YAML files.",
+)
+
+
+def main(
+ config_path: str = typer.Argument(..., help="Path to YAML configuration file"),
+ disable_progress_bars: bool = typer.Option(
+ False,
+ "--disable-progress-bars",
+ help="Disable progress bars (useful for multi-process runs)",
+ ),
+) -> None:
+ """Train the model using the provided configuration file."""
+ # Load the configuration from the YAML file
+ config_path = Path(config_path)
+ if not config_path.exists():
+ typer.echo(f"Error: Configuration file {config_path} does not exist.")
+ raise typer.Exit(code=1)
+
+ with open(config_path, "r") as file:
+ config_data = yaml.safe_load(file)
+
+ # Convert the loaded data to the LtxTrainerConfig object
+ try:
+ trainer_config = LtxTrainerConfig(**config_data)
+ except Exception as e:
+ typer.echo(f"Error: Invalid configuration data: {e}")
+ raise typer.Exit(code=1) from e
+
+ # Initialize the training process
+ trainer = LtxvTrainer(trainer_config)
+ trainer.train(disable_progress_bars=disable_progress_bars)
+
+
+if __name__ == "__main__":
+ app()
diff --git a/packages/ltx-trainer/src/ltx_trainer/__init__.py b/packages/ltx-trainer/src/ltx_trainer/__init__.py
new file mode 100644
index 0000000..56efa40
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/__init__.py
@@ -0,0 +1,44 @@
+import logging
+import os
+import sys
+from logging import getLogger
+from pathlib import Path
+
+from rich.logging import RichHandler
+
+# Get the process rank
+IS_MULTI_GPU = os.environ.get("LOCAL_RANK") is not None
+RANK = int(os.environ.get("LOCAL_RANK", "0"))
+
+# Configure with Rich
+logging.basicConfig(
+ level="INFO",
+ format=f"\\[rank {RANK}] %(message)s" if IS_MULTI_GPU else "%(message)s",
+ handlers=[
+ RichHandler(
+ rich_tracebacks=True,
+ show_time=False,
+ markup=True,
+ )
+ ],
+)
+
+# Get the logger and configure it
+logger = getLogger("ltxv_trainer")
+logger.setLevel(logging.DEBUG)
+logger.propagate = True
+
+# Set level based on process
+if RANK != 0:
+ logger.setLevel(logging.WARNING)
+
+# Expose common logging functions directly
+debug = logger.debug
+info = logger.info
+warning = logger.warning
+error = logger.error
+critical = logger.critical
+
+
+# Add the root directory to the Python path so we can import from scripts.
+sys.path.insert(0, str(Path(__file__).parent.parent.parent))
diff --git a/packages/ltx-trainer/src/ltx_trainer/captioning.py b/packages/ltx-trainer/src/ltx_trainer/captioning.py
new file mode 100644
index 0000000..303d5bb
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/captioning.py
@@ -0,0 +1,401 @@
+"""
+Audio-visual media captioning using multimodal models.
+This module provides captioning capabilities for videos with audio using:
+- Qwen2.5-Omni: Local model supporting text, audio, image, and video inputs (default)
+- Gemini Flash: Cloud-based API for audio-visual captioning
+Requirements:
+- Qwen2.5-Omni: transformers>=4.50, torch
+- Gemini Flash: google-generativeai (pip install google-generativeai)
+ Set GEMINI_API_KEY or GOOGLE_API_KEY environment variable
+"""
+
+import itertools
+import re
+from abc import ABC, abstractmethod
+from enum import Enum
+from pathlib import Path
+
+import torch
+
+# Instruction for audio-visual captioning (default) - includes speech transcription and sounds
+DEFAULT_CAPTION_INSTRUCTION = """\
+Analyze this media and provide a detailed caption in the following EXACT format. Fill in ALL sections:
+
+[VISUAL]: <Detailed description of people, objects, actions, settings, colors, and movements>
+[SPEECH]: <Word-for-word transcription of everything spoken.
+ Listen carefully and transcribe the exact words. If no speech, write "None">
+[SOUNDS]: <Description of music, ambient sounds, sound effects. If none, write "None">
+[TEXT]: <Any on-screen text visible. If none, write "None">
+
+You MUST fill in all four sections. For [SPEECH], transcribe the actual words spoken, not a summary."""
+
+# Instruction for video-only captioning (no audio processing)
+VIDEO_ONLY_CAPTION_INSTRUCTION = """\
+Analyze this media and provide a detailed caption in the following EXACT format. Fill in ALL sections:
+
+[VISUAL]: <Detailed description of people, objects, actions, settings, colors, and movements>
+[TEXT]: <Any on-screen text visible. If none, write "None">
+
+You MUST fill in both sections."""
+
+
+class CaptionerType(str, Enum):
+ """Enum for different types of media captioners."""
+
+ QWEN_OMNI = "qwen_omni" # Local Qwen2.5-Omni model (audio + video)
+ GEMINI_FLASH = "gemini_flash" # Gemini Flash API (audio + video)
+
+
+def create_captioner(captioner_type: CaptionerType, **kwargs) -> "MediaCaptioningModel":
+ """Factory function to create a media captioner.
+ Args:
+ captioner_type: The type of captioner to create
+ **kwargs: Additional arguments to pass to the captioner constructor
+ Returns:
+ An instance of a MediaCaptioningModel
+ """
+ match captioner_type:
+ case CaptionerType.QWEN_OMNI:
+ return QwenOmniCaptioner(**kwargs)
+ case CaptionerType.GEMINI_FLASH:
+ return GeminiFlashCaptioner(**kwargs)
+ case _:
+ raise ValueError(f"Unsupported captioner type: {captioner_type}")
+
+
+class MediaCaptioningModel(ABC):
+ """Abstract base class for audio-visual media captioning models."""
+
+ @abstractmethod
+ def caption(self, path: str | Path, **kwargs) -> str:
+ """Generate a caption for the given video or image.
+ Args:
+ path: Path to the video/image file to caption
+ Returns:
+ A string containing the generated caption
+ """
+
+ @property
+ @abstractmethod
+ def supports_audio(self) -> bool:
+ """Whether this captioner supports audio input."""
+
+ @staticmethod
+ def _is_image_file(path: str | Path) -> bool:
+ """Check if the file is an image based on extension."""
+ return str(path).lower().endswith((".png", ".jpg", ".jpeg", ".heic", ".heif", ".webp"))
+
+ @staticmethod
+ def _is_video_file(path: str | Path) -> bool:
+ """Check if the file is a video based on extension."""
+ return str(path).lower().endswith((".mp4", ".avi", ".mov", ".mkv", ".webm"))
+
+ @staticmethod
+ def _clean_raw_caption(caption: str) -> str:
+ """Clean up the raw caption by removing common VLM patterns."""
+ start = ["The", "This"]
+ kind = ["video", "image", "scene", "animated sequence", "clip", "footage"]
+ act = ["displays", "shows", "features", "depicts", "presents", "showcases", "captures", "contains"]
+
+ for x, y, z in itertools.product(start, kind, act):
+ caption = caption.replace(f"{x} {y} {z} ", "", 1)
+
+ return caption
+
+
+class QwenOmniCaptioner(MediaCaptioningModel):
+ """Audio-visual captioning using Alibaba's Qwen2.5-Omni model.
+ Qwen2.5-Omni is an end-to-end multimodal model that can perceive text, images, audio, and video.
+ It uses a Thinker-Talker architecture where the Thinker generates text and the Talker can
+ generate speech. For captioning, we use only the Thinker component for text generation.
+ Key features:
+ - Block-wise processing for streaming multimodal inputs
+ - TMRoPE (Time-aligned Multimodal RoPE) for synchronizing video and audio timestamps
+ - Can extract and process audio directly from video files
+ See: https://huggingface.co/docs/transformers/en/model_doc/qwen2_5_omni
+ Model: Qwen/Qwen2.5-Omni-7B (7B parameters)
+ """
+
+ MODEL_ID = "Qwen/Qwen2.5-Omni-7B"
+
+ # Default system prompt required by Qwen2.5-Omni for proper audio processing
+ DEFAULT_SYSTEM_PROMPT = (
+ "You are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, "
+ "capable of perceiving auditory and visual inputs, as well as generating text and speech."
+ )
+
+ def __init__(
+ self,
+ device: str | torch.device | None = None,
+ use_8bit: bool = False,
+ instruction: str | None = None,
+ ):
+ """
+ Initialize the Qwen2.5-Omni captioner.
+ Args:
+ device: Device to use for inference (e.g., 'cuda', 'cuda:0', 'cpu')
+ use_8bit: Whether to use 8-bit quantization for reduced memory usage
+ instruction: Custom instruction prompt. If None, uses the default instruction
+ """
+ self.device = torch.device(device or ("cuda" if torch.cuda.is_available() else "cpu"))
+ self.instruction = instruction
+ self._load_model(use_8bit=use_8bit)
+
+ @property
+ def supports_audio(self) -> bool:
+ return True
+
+ def caption(
+ self,
+ path: str | Path,
+ fps: int = 1,
+ include_audio: bool = True,
+ clean_caption: bool = True,
+ ) -> str:
+ """Generate a caption for the given video or image.
+ Args:
+ path: Path to the video/image file to caption
+ fps: Frames per second to sample from videos
+ include_audio: Whether to include audio in the captioning (for videos)
+ clean_caption: Whether to clean up the raw caption by removing common VLM patterns
+ Returns:
+ A string containing the generated caption
+ """
+ path = Path(path)
+ is_image = self._is_image_file(path)
+ is_video = self._is_video_file(path)
+
+ # Determine if we should process audio
+ use_audio = include_audio and is_video
+
+ # Use custom instruction if provided, otherwise pick appropriate default
+ if self.instruction is not None:
+ instruction = self.instruction
+ else:
+ instruction = DEFAULT_CAPTION_INSTRUCTION if use_audio else VIDEO_ONLY_CAPTION_INSTRUCTION
+
+ # Build the user content based on media type
+ # Based on HuggingFace docs: https://huggingface.co/docs/transformers/en/model_doc/qwen2_5_omni
+ user_content = []
+
+ if is_image:
+ user_content.append({"type": "image", "image": str(path)})
+ elif is_video:
+ user_content.append({"type": "video", "video": str(path)})
+
+ # Add the instruction text
+ user_content.append({"type": "text", "text": instruction})
+
+ # Build conversation - use the default system prompt required by Qwen2.5-Omni
+ # Using a custom system prompt causes warnings and may affect audio processing
+ messages = [
+ {
+ "role": "system",
+ "content": [{"type": "text", "text": self.DEFAULT_SYSTEM_PROMPT}],
+ },
+ {"role": "user", "content": user_content},
+ ]
+
+ # Process inputs using the processor's apply_chat_template
+ # For videos with audio, use load_audio_from_video=True and use_audio_in_video=True
+ inputs = self.processor.apply_chat_template(
+ messages,
+ load_audio_from_video=use_audio,
+ add_generation_prompt=True,
+ tokenize=True,
+ return_dict=True,
+ return_tensors="pt",
+ fps=fps,
+ padding=True,
+ use_audio_in_video=use_audio,
+ ).to(self.model.device)
+
+ # Generate caption (text only, using Thinker-only model)
+ # Note: For Qwen2_5OmniThinkerForConditionalGeneration, use standard generate params
+ # (not thinker_ prefixed ones, those are for the full Qwen2_5OmniForConditionalGeneration)
+ input_len = inputs["input_ids"].shape[1]
+
+ output_tokens = self.model.generate(
+ **inputs,
+ use_audio_in_video=use_audio,
+ do_sample=False,
+ max_new_tokens=1024,
+ )
+
+ # Extract only the generated tokens (exclude the input/prompt tokens)
+ generated_tokens = output_tokens[:, input_len:]
+
+ # Decode only the generated response
+ caption_raw = self.processor.batch_decode(
+ generated_tokens,
+ skip_special_tokens=True,
+ clean_up_tokenization_spaces=False,
+ )[0]
+
+ # Remove hallucinated conversation turns (e.g., "Human\nHuman\n..." or "Human: ...")
+ # This is a known issue with chat models continuing to generate fake turns
+ # We look for patterns that are clearly hallucinated chat turns, not legitimate uses of "human"
+
+ # Match "\nHuman" followed by ":", "\n", or end of string (chat turn patterns)
+ # This won't match "A human walks..." or "...the human body..."
+ caption_raw = re.split(r"\nHuman(?::|(?:\s*\n)|$)", caption_raw, maxsplit=1)[0]
+ caption_raw = caption_raw.strip()
+
+ # Clean up caption if requested
+ return self._clean_raw_caption(caption_raw) if clean_caption else caption_raw
+
+ def _load_model(self, use_8bit: bool) -> None:
+ """Load the Qwen2.5-Omni model and processor.
+ Uses the Thinker-only model (Qwen2_5OmniThinkerForConditionalGeneration) for text generation
+ to save compute by not loading the audio generation components.
+ """
+ from transformers import ( # noqa: PLC0415
+ BitsAndBytesConfig,
+ Qwen2_5OmniProcessor,
+ Qwen2_5OmniThinkerForConditionalGeneration,
+ )
+
+ quantization_config = BitsAndBytesConfig(load_in_8bit=True) if use_8bit else None
+
+ # Use Thinker-only model for text generation (saves memory by not loading Talker)
+ self.model = Qwen2_5OmniThinkerForConditionalGeneration.from_pretrained(
+ self.MODEL_ID,
+ dtype=torch.bfloat16,
+ low_cpu_mem_usage=True,
+ quantization_config=quantization_config,
+ device_map="auto",
+ )
+
+ self.processor = Qwen2_5OmniProcessor.from_pretrained(self.MODEL_ID)
+
+
+class GeminiFlashCaptioner(MediaCaptioningModel):
+ """Audio-visual captioning using Google's Gemini Flash API.
+ Gemini Flash is a cloud-based multimodal model that natively supports
+ audio and video understanding. Requires a Google API key.
+ Note: This captioner requires the `google-generativeai` package and a valid API key.
+ Set the GEMINI_API_KEY or GOOGLE_API_KEY environment variable, or pass the key directly.
+ """
+
+ MODEL_ID = "gemini-flash-lite-latest"
+
+ def __init__(
+ self,
+ api_key: str | None = None,
+ instruction: str | None = None,
+ ):
+ """Initialize the Gemini Flash captioner.
+ Args:
+ api_key: Google API key. If not provided, will look for
+ GEMINI_API_KEY or GOOGLE_API_KEY environment variable.
+ instruction: Custom instruction prompt. If None, uses the default instruction
+ """
+ self.instruction = instruction
+ self._init_client(api_key)
+
+ @property
+ def supports_audio(self) -> bool:
+ return True
+
+ def caption(
+ self,
+ path: str | Path,
+ fps: int = 3, # noqa: ARG002 - kept for API compatibility
+ include_audio: bool = True,
+ clean_caption: bool = True,
+ ) -> str:
+ """Generate a caption for the given video or image.
+ Args:
+ path: Path to the video/image file to caption
+ fps: Frames per second (not used for Gemini, kept for API compatibility)
+ include_audio: Whether to include audio content in the caption
+ clean_caption: Whether to clean up the raw caption
+ Returns:
+ A string containing the generated caption
+ """
+ import time # noqa: PLC0415
+
+ path = Path(path)
+ is_video = self._is_video_file(path)
+ use_audio = include_audio and is_video
+
+ # Use custom instruction if provided, otherwise pick appropriate default
+ if self.instruction is not None:
+ instruction = self.instruction
+ else:
+ instruction = DEFAULT_CAPTION_INSTRUCTION if use_audio else VIDEO_ONLY_CAPTION_INSTRUCTION
+
+ # Upload the file to Gemini
+ uploaded_file = self._genai.upload_file(path)
+
+ # Wait for processing to complete (videos need time to process)
+ while uploaded_file.state.name == "PROCESSING":
+ time.sleep(1)
+ uploaded_file = self._genai.get_file(uploaded_file.name)
+
+ if uploaded_file.state.name == "FAILED":
+ raise RuntimeError(f"File processing failed: {uploaded_file.state.name}")
+
+ # Generate caption
+ response = self._model.generate_content([uploaded_file, instruction])
+
+ caption_raw = response.text
+
+ # Clean up the uploaded file
+ self._genai.delete_file(uploaded_file.name)
+
+ # Clean up caption if requested
+ return self._clean_raw_caption(caption_raw) if clean_caption else caption_raw
+
+ def _init_client(self, api_key: str | None) -> None:
+ """Initialize the Gemini API client."""
+ import os # noqa: PLC0415
+
+ try:
+ import google.generativeai as genai # noqa: PLC0415
+ except ImportError as e:
+ raise ImportError(
+ "The `google-generativeai` package is required for Gemini Flash captioning. "
+ "Install it with: `uv pip install google-generativeai`"
+ ) from e
+
+ # Get API key from argument or environment
+ # GEMINI_API_KEY is the recommended variable, GOOGLE_API_KEY also works
+ resolved_api_key = api_key or os.environ.get("GEMINI_API_KEY") or os.environ.get("GOOGLE_API_KEY")
+
+ if not resolved_api_key:
+ raise ValueError(
+ "Gemini API key is required. Provide it via the `api_key` argument "
+ "or set the GEMINI_API_KEY or GOOGLE_API_KEY environment variable."
+ )
+
+ # Configure the genai library with the API key
+ genai.configure(api_key=resolved_api_key)
+
+ # Store reference to genai module for file operations
+ self._genai = genai
+
+ # Initialize the model
+ self._model = genai.GenerativeModel(self.MODEL_ID)
+
+
+def example() -> None:
+ """Example usage of the captioning module."""
+ import sys # noqa: PLC0415
+
+ if len(sys.argv) < 2:
+ print(f"Usage: python {sys.argv[0]} <video_path> [captioner_type]") # noqa: T201
+ print(" captioner_type: qwen_omni (default) or gemini_flash") # noqa: T201
+ sys.exit(1)
+
+ video_path = sys.argv[1]
+ captioner_type = CaptionerType(sys.argv[2]) if len(sys.argv) > 2 else CaptionerType.QWEN_OMNI
+
+ print(f"Using {captioner_type.value} captioner:") # noqa: T201
+ captioner = create_captioner(captioner_type)
+ caption = captioner.caption(video_path)
+ print(f"CAPTION: {caption}") # noqa: T201
+
+
+if __name__ == "__main__":
+ example()
diff --git a/packages/ltx-trainer/src/ltx_trainer/config.py b/packages/ltx-trainer/src/ltx_trainer/config.py
new file mode 100644
index 0000000..690f59a
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/config.py
@@ -0,0 +1,472 @@
+from pathlib import Path
+from typing import Annotated, Literal
+
+from pydantic import BaseModel, ConfigDict, Discriminator, Field, Tag, ValidationInfo, field_validator, model_validator
+
+from ltx_trainer.quantization import QuantizationOptions
+from ltx_trainer.training_strategies.base_strategy import TrainingStrategyConfigBase
+from ltx_trainer.training_strategies.text_to_video import TextToVideoConfig
+from ltx_trainer.training_strategies.video_to_video import VideoToVideoConfig
+
+
+class ConfigBaseModel(BaseModel):
+ model_config = ConfigDict(extra="forbid")
+
+
+class ModelConfig(ConfigBaseModel):
+ """Configuration for the base model and training mode"""
+
+ model_path: str | Path = Field(
+ ...,
+ description="Model path - local path to safetensors checkpoint file",
+ )
+
+ text_encoder_path: str | Path | None = Field(
+ default=None,
+ description="Path to text encoder (required for LTX-2/Gemma models, optional for LTXV/T5 models)",
+ )
+
+ training_mode: Literal["lora", "full"] = Field(
+ default="lora",
+ description="Training mode - either LoRA fine-tuning or full model fine-tuning",
+ )
+
+ load_checkpoint: str | Path | None = Field(
+ default=None,
+ description="Path to a checkpoint file or directory to load from. "
+ "If a directory is provided, the latest checkpoint will be used.",
+ )
+
+ @field_validator("model_path")
+ @classmethod
+ def validate_model_path(cls, v: str | Path) -> str | Path:
+ """Validate that model_path is either a valid URL or an existing local path."""
+ is_url = str(v).startswith(("http://", "https://"))
+
+ if is_url:
+ raise ValueError(f"Model path cannot be a URL: {v}")
+
+ if not Path(v).exists():
+ raise ValueError(f"Model path does not exist: {v}")
+
+ return v
+
+
+class LoraConfig(ConfigBaseModel):
+ """Configuration for LoRA fine-tuning"""
+
+ rank: int = Field(
+ default=64,
+ description="Rank of LoRA adaptation",
+ ge=2,
+ )
+
+ alpha: int = Field(
+ default=64,
+ description="Alpha scaling factor for LoRA",
+ ge=1,
+ )
+
+ dropout: float = Field(
+ default=0.0,
+ description="Dropout probability for LoRA layers",
+ ge=0.0,
+ le=1.0,
+ )
+
+ target_modules: list[str] = Field(
+ default=["to_k", "to_q", "to_v", "to_out.0"],
+ description="List of modules to target with LoRA",
+ )
+
+
+def _get_strategy_discriminator(v: dict | TrainingStrategyConfigBase) -> str:
+ """Discriminator function for strategy config union."""
+ if isinstance(v, dict):
+ return v.get("name", "text_to_video")
+ return v.name
+
+
+# Union type for all strategy configs with discriminator
+TrainingStrategyConfig = Annotated[
+ Annotated[TextToVideoConfig, Tag("text_to_video")] | Annotated[VideoToVideoConfig, Tag("video_to_video")],
+ Discriminator(_get_strategy_discriminator),
+]
+
+
+class OptimizationConfig(ConfigBaseModel):
+ """Configuration for optimization parameters"""
+
+ learning_rate: float = Field(
+ default=5e-4,
+ description="Learning rate for optimization",
+ )
+
+ steps: int = Field(
+ default=3000,
+ description="Number of training steps",
+ )
+
+ batch_size: int = Field(
+ default=2,
+ description="Batch size for training",
+ )
+
+ gradient_accumulation_steps: int = Field(
+ default=1,
+ description="Number of steps to accumulate gradients",
+ )
+
+ max_grad_norm: float = Field(
+ default=1.0,
+ description="Maximum gradient norm for clipping",
+ )
+
+ optimizer_type: Literal["adamw", "adamw8bit"] = Field(
+ default="adamw",
+ description="Type of optimizer to use for training",
+ )
+
+ scheduler_type: Literal[
+ "constant",
+ "linear",
+ "cosine",
+ "cosine_with_restarts",
+ "polynomial",
+ ] = Field(
+ default="linear",
+ description="Type of scheduler to use for training",
+ )
+
+ scheduler_params: dict = Field(
+ default_factory=dict,
+ description="Parameters for the scheduler",
+ )
+
+ enable_gradient_checkpointing: bool = Field(
+ default=False,
+ description="Enable gradient checkpointing to save memory at the cost of slower training",
+ )
+
+
+class AccelerationConfig(ConfigBaseModel):
+ """Configuration for hardware acceleration and compute optimization"""
+
+ mixed_precision_mode: Literal["no", "fp16", "bf16"] | None = Field(
+ default="bf16",
+ description="Mixed precision training mode",
+ )
+
+ quantization: QuantizationOptions | None = Field(
+ default=None,
+ description="Quantization precision to use",
+ )
+
+ load_text_encoder_in_8bit: bool = Field(
+ default=False,
+ description="Whether to load the text encoder in 8-bit precision to save memory",
+ )
+
+
+class DataConfig(ConfigBaseModel):
+ """Configuration for data loading and processing"""
+
+ preprocessed_data_root: str = Field(
+ description="Path to folder containing preprocessed training data",
+ )
+
+ num_dataloader_workers: int = Field(
+ default=2,
+ description="Number of background processes for data loading (0 means synchronous loading)",
+ ge=0,
+ )
+
+
+class ValidationConfig(ConfigBaseModel):
+ """Configuration for validation during training"""
+
+ prompts: list[str] = Field(
+ default_factory=list,
+ description="List of prompts to use for validation",
+ )
+
+ negative_prompt: str = Field(
+ default="worst quality, inconsistent motion, blurry, jittery, distorted",
+ description="Negative prompt to use for validation examples",
+ )
+
+ images: list[str] | None = Field(
+ default=None,
+ description="List of image paths to use for validation. "
+ "One image path must be provided for each validation prompt",
+ )
+
+ reference_videos: list[str] | None = Field(
+ default=None,
+ description="List of reference video paths to use for validation. "
+ "One video path must be provided for each validation prompt",
+ )
+
+ video_dims: tuple[int, int, int] = Field(
+ default=(960, 544, 97),
+ description="Dimensions of validation videos (width, height, frames). "
+ "Width and height must be divisible by 32. Frames must satisfy frames % 8 == 1 for LTX-2.",
+ )
+
+ @field_validator("video_dims")
+ @classmethod
+ def validate_video_dims(cls, v: tuple[int, int, int]) -> tuple[int, int, int]:
+ """Validate video dimensions for LTX-2 compatibility."""
+ width, height, frames = v
+
+ if width % 32 != 0:
+ raise ValueError(f"Width ({width}) must be divisible by 32")
+ if height % 32 != 0:
+ raise ValueError(f"Height ({height}) must be divisible by 32")
+ if frames % 8 != 1:
+ raise ValueError(f"Frames ({frames}) must satisfy frames % 8 == 1 for LTX-2 (e.g., 1, 9, 17, 25, ...)")
+
+ return v
+
+ frame_rate: float = Field(
+ default=25.0,
+ description="Frame rate for validation videos",
+ gt=0,
+ )
+
+ seed: int = Field(
+ default=42,
+ description="Random seed used when sampling validation videos",
+ )
+
+ inference_steps: int = Field(
+ default=50,
+ description="Number of inference steps for validation",
+ gt=0,
+ )
+
+ interval: int | None = Field(
+ default=100,
+ description="Number of steps between validation runs. If None, validation is disabled.",
+ gt=0,
+ )
+
+ videos_per_prompt: int = Field(
+ default=1,
+ description="Number of videos to generate per validation prompt",
+ gt=0,
+ )
+
+ guidance_scale: float = Field(
+ default=4.0,
+ description="CFG guidance scale to use during validation",
+ ge=1.0,
+ )
+
+ stg_scale: float = Field(
+ default=1.0,
+ description="STG (Spatio-Temporal Guidance) scale. 0.0 disables STG. "
+ "Recommended value is 1.0. STG is combined with CFG for improved video quality.",
+ ge=0.0,
+ )
+
+ stg_blocks: list[int] | None = Field(
+ default=[29],
+ description="Which transformer blocks to perturb for STG. "
+ "None means all blocks are perturbed. Recommended for LTX-2: [29].",
+ )
+
+ stg_mode: Literal["stg_av", "stg_v"] = Field(
+ default="stg_av",
+ description="STG mode: 'stg_av' skips both audio and video self-attention, "
+ "'stg_v' skips only video self-attention.",
+ )
+
+ generate_audio: bool = Field(
+ default=True,
+ description="Whether to generate audio in validation samples. "
+ "Independent of training strategy setting - you can generate audio "
+ "in validation even when not training the audio branch.",
+ )
+
+ skip_initial_validation: bool = Field(
+ default=False,
+ description="Skip validation video sampling at step 0 (beginning of training)",
+ )
+
+ include_reference_in_output: bool = Field(
+ default=False,
+ description="For video-to-video training: concatenate the original reference video side-by-side "
+ "with the generated output. The reference comes from the input video, not from the model's output.",
+ )
+
+ @field_validator("images")
+ @classmethod
+ def validate_images(cls, v: list[str] | None, info: ValidationInfo) -> list[str] | None:
+ """Validate that number of images (if provided) matches number of prompts."""
+ if v is None:
+ return None
+
+ num_prompts = len(info.data.get("prompts", []))
+ if v is not None and len(v) != num_prompts:
+ raise ValueError(f"Number of images ({len(v)}) must match number of prompts ({num_prompts})")
+
+ for image_path in v:
+ if not Path(image_path).exists():
+ raise ValueError(f"Image path '{image_path}' does not exist")
+
+ return v
+
+ @field_validator("reference_videos")
+ @classmethod
+ def validate_reference_videos(cls, v: list[str] | None, info: ValidationInfo) -> list[str] | None:
+ """Validate that number of reference videos (if provided) matches number of prompts."""
+ if v is None:
+ return None
+
+ num_prompts = len(info.data.get("prompts", []))
+ if v is not None and len(v) != num_prompts:
+ raise ValueError(f"Number of reference videos ({len(v)}) must match number of prompts ({num_prompts})")
+
+ for video_path in v:
+ if not Path(video_path).exists():
+ raise ValueError(f"Reference video path '{video_path}' does not exist")
+
+ return v
+
+
+class CheckpointsConfig(ConfigBaseModel):
+ """Configuration for model checkpointing during training"""
+
+ interval: int | None = Field(
+ default=None,
+ description="Number of steps between checkpoint saves. If None, intermediate checkpoints are disabled.",
+ gt=0,
+ )
+
+ keep_last_n: int = Field(
+ default=1,
+ description="Number of most recent checkpoints to keep. Set to -1 to keep all checkpoints.",
+ ge=-1,
+ )
+
+
+class HubConfig(ConfigBaseModel):
+ """Configuration for Hugging Face Hub integration"""
+
+ push_to_hub: bool = Field(default=False, description="Whether to push the model weights to the Hugging Face Hub")
+ hub_model_id: str | None = Field(
+ default=None, description="Hugging Face Hub repository ID (e.g., 'username/repo-name')"
+ )
+
+ @model_validator(mode="after")
+ def validate_hub_config(self) -> "HubConfig":
+ """Validate that hub_model_id is not None when push_to_hub is True."""
+ if self.push_to_hub and not self.hub_model_id:
+ raise ValueError("hub_model_id must be specified when push_to_hub is True")
+ return self
+
+
+class WandbConfig(ConfigBaseModel):
+ """Configuration for Weights & Biases logging"""
+
+ enabled: bool = Field(
+ default=False,
+ description="Whether to enable W&B logging",
+ )
+
+ project: str = Field(
+ default="ltxv-trainer",
+ description="W&B project name",
+ )
+
+ entity: str | None = Field(
+ default=None,
+ description="W&B username or team",
+ )
+
+ tags: list[str] = Field(
+ default_factory=list,
+ description="Tags to add to the W&B run",
+ )
+
+ log_validation_videos: bool = Field(
+ default=True,
+ description="Whether to log validation videos to W&B",
+ )
+
+
+class FlowMatchingConfig(ConfigBaseModel):
+ """Configuration for flow matching training"""
+
+ timestep_sampling_mode: Literal["uniform", "shifted_logit_normal"] = Field(
+ default="shifted_logit_normal",
+ description="Mode to use for timestep sampling",
+ )
+
+ timestep_sampling_params: dict = Field(
+ default_factory=dict,
+ description="Parameters for timestep sampling",
+ )
+
+
+class LtxTrainerConfig(ConfigBaseModel):
+ """Unified configuration for LTXV training"""
+
+ # Sub-configurations
+ model: ModelConfig = Field(default_factory=ModelConfig)
+ lora: LoraConfig | None = Field(default=None)
+ training_strategy: TrainingStrategyConfig = Field(
+ default_factory=TextToVideoConfig,
+ description="Training strategy configuration. Determines the training mode and its parameters.",
+ )
+ optimization: OptimizationConfig = Field(default_factory=OptimizationConfig)
+ acceleration: AccelerationConfig = Field(default_factory=AccelerationConfig)
+ data: DataConfig
+ validation: ValidationConfig = Field(default_factory=ValidationConfig)
+ checkpoints: CheckpointsConfig = Field(default_factory=CheckpointsConfig)
+ hub: HubConfig = Field(default_factory=HubConfig)
+ flow_matching: FlowMatchingConfig = Field(default_factory=FlowMatchingConfig)
+ wandb: WandbConfig = Field(default_factory=WandbConfig)
+
+ # General configuration
+ seed: int = Field(
+ default=42,
+ description="Random seed for reproducibility",
+ )
+
+ output_dir: str = Field(
+ default="outputs",
+ description="Directory to save model outputs",
+ )
+
+ # noinspection PyNestedDecorators
+ @field_validator("output_dir")
+ @classmethod
+ def expand_output_path(cls, v: str) -> str:
+ """Expand user home directory in output path."""
+ return str(Path(v).expanduser().resolve())
+
+ @model_validator(mode="after")
+ def validate_strategy_compatibility(self) -> "LtxTrainerConfig":
+ """Validate that training strategy and other configurations are compatible."""
+
+ # Check that reference videos are provided when using video_to_video strategy
+ if (
+ self.training_strategy.name == "video_to_video"
+ and self.validation.interval
+ and not self.validation.reference_videos
+ ):
+ raise ValueError(
+ "reference_videos must be provided in validation config when using video_to_video strategy"
+ )
+
+ # Check that LoRA config is provided when training mode is lora
+ if self.model.training_mode == "lora" and self.lora is None:
+ raise ValueError("LoRA configuration must be provided when training_mode is 'lora'")
+
+ # Check that LoRA config is provided when using video_to_video strategy
+ if self.training_strategy.name == "video_to_video" and self.model.training_mode != "lora":
+ raise ValueError("Training mode must be 'lora' when using video_to_video strategy")
+
+ return self
diff --git a/packages/ltx-trainer/src/ltx_trainer/config_display.py b/packages/ltx-trainer/src/ltx_trainer/config_display.py
new file mode 100644
index 0000000..a80b1eb
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/config_display.py
@@ -0,0 +1,155 @@
+"""Display utilities for training configuration.
+This module provides formatted console output for LtxTrainerConfig.
+"""
+
+from rich import box
+from rich.console import Console
+from rich.table import Table
+
+from ltx_trainer.config import LtxTrainerConfig
+
+
+def print_config(config: LtxTrainerConfig) -> None:
+ """Print configuration as a nicely formatted table with sections."""
+
+ def fmt(v: object, max_len: int = 55) -> str:
+ """Format any value for display."""
+ if v is None:
+ return "[dim]—[/]"
+ if isinstance(v, bool):
+ return "[green]✓[/]" if v else "[dim]✗[/]"
+ if isinstance(v, (list, tuple)):
+ if not v:
+ return "[dim]—[/]"
+ return ", ".join(str(x) for x in v)
+ s = str(v)
+ return s[: max_len - 3] + "..." if len(s) > max_len else s
+
+ cfg = config
+ opt = cfg.optimization
+ val = cfg.validation
+ accel = cfg.acceleration
+
+ # Build sections: list of (section_title, [(key, value), ...])
+ sections: list[tuple[str, list[tuple[str, str]]]] = [
+ (
+ "🎬 Model",
+ [
+ ("Base", fmt(cfg.model.model_path)),
+ ("Text Encoder", fmt(cfg.model.text_encoder_path) or "[dim]Built-in[/]"),
+ ("Training Mode", f"[bold green]{cfg.model.training_mode.upper()}[/]"),
+ ("Load Checkpoint", fmt(cfg.model.load_checkpoint) if cfg.model.load_checkpoint else "[dim]—[/]"),
+ ],
+ ),
+ ]
+
+ if cfg.lora:
+ sections.append(
+ (
+ "🔗 LoRA",
+ [
+ ("Rank / Alpha", f"{cfg.lora.rank} / {cfg.lora.alpha}"),
+ ("Dropout", str(cfg.lora.dropout)),
+ ("Target Modules", fmt(cfg.lora.target_modules)),
+ ],
+ )
+ )
+
+ # Strategy section - include strategy-specific fields
+ strategy_items: list[tuple[str, str]] = [("Name", cfg.training_strategy.name)]
+ if hasattr(cfg.training_strategy, "with_audio"):
+ strategy_items.append(("Audio", fmt(cfg.training_strategy.with_audio)))
+ if hasattr(cfg.training_strategy, "first_frame_conditioning_p"):
+ strategy_items.append(("First Frame Cond P", str(cfg.training_strategy.first_frame_conditioning_p)))
+
+ sections.append(("🎯 Strategy", strategy_items))
+
+ sections.extend(
+ [
+ (
+ "⚡ Optimization",
+ [
+ ("Steps", f"[bold]{opt.steps:,}[/]"),
+ ("Learning Rate", f"{opt.learning_rate:.2e}"),
+ ("Batch Size", str(opt.batch_size)),
+ ("Grad Accumulation", str(opt.gradient_accumulation_steps)),
+ ("Optimizer", opt.optimizer_type),
+ ("Scheduler", opt.scheduler_type),
+ ("Max Grad Norm", str(opt.max_grad_norm)),
+ ("Grad Checkpointing", fmt(opt.enable_gradient_checkpointing)),
+ ],
+ ),
+ (
+ "🚀 Acceleration",
+ [
+ ("Mixed Precision", accel.mixed_precision_mode or "[dim]—[/]"),
+ ("Quantization", str(accel.quantization) if accel.quantization else "[dim]—[/]"),
+ ("Text Encoder 8bit", fmt(accel.load_text_encoder_in_8bit)),
+ ],
+ ),
+ (
+ "🎥 Validation",
+ [
+ ("Prompts", f"{len(val.prompts)} prompt(s)" if val.prompts else "[dim]—[/]"),
+ ("Interval", f"Every {val.interval} steps" if val.interval else "[dim]Disabled[/]"),
+ ("Video Dims", f"{val.video_dims[0]}x{val.video_dims[1]}, {val.video_dims[2]} frames"),
+ ("Frame Rate", f"{val.frame_rate} fps"),
+ ("Inference Steps", str(val.inference_steps)),
+ ("CFG Scale", str(val.guidance_scale)),
+ (
+ "STG",
+ f"scale={val.stg_scale}; blocks={fmt(val.stg_blocks)}; mode={val.stg_mode}"
+ if val.stg_scale > 0
+ else "[dim]Disabled[/]",
+ ),
+ ("Seed", str(val.seed)),
+ ],
+ ),
+ (
+ "📂 Data & Output",
+ [
+ ("Dataset", fmt(cfg.data.preprocessed_data_root)),
+ ("Dataloader Workers", str(cfg.data.num_dataloader_workers)),
+ ("Output Dir", fmt(cfg.output_dir)),
+ ("Seed", str(cfg.seed)),
+ ],
+ ),
+ (
+ "🔌 Integrations",
+ [
+ (
+ "Checkpoints",
+ f"Every {cfg.checkpoints.interval} steps (keep {cfg.checkpoints.keep_last_n})"
+ if cfg.checkpoints.interval
+ else "[dim]Disabled[/]",
+ ),
+ ("W&B", f"{cfg.wandb.project}" if cfg.wandb.enabled else "[dim]Disabled[/]"),
+ ("HF Hub", cfg.hub.hub_model_id if cfg.hub.push_to_hub else "[dim]Disabled[/]"),
+ ],
+ ),
+ ]
+ )
+
+ # Build table with section headers
+ table = Table(
+ title="[bold]⚙️ Training Configuration[/]",
+ show_header=False,
+ box=box.ROUNDED,
+ border_style="bright_blue",
+ padding=(0, 1),
+ title_style="bold bright_blue",
+ )
+ table.add_column("Key", style="white", width=20)
+ table.add_column("Value", style="cyan")
+
+ for i, (section_title, items) in enumerate(sections):
+ if i > 0:
+ table.add_row("", "") # Blank line between sections
+ table.add_row(f"[bold yellow]{section_title}[/]", "")
+ for key, value in items:
+ table.add_row(f" {key}", value)
+
+ console = Console()
+ console.print()
+ console.print(table)
+ console.print()
diff --git a/packages/ltx-trainer/src/ltx_trainer/datasets.py b/packages/ltx-trainer/src/ltx_trainer/datasets.py
new file mode 100644
index 0000000..9396881
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/datasets.py
@@ -0,0 +1,270 @@
+from pathlib import Path
+
+import torch
+from einops import rearrange
+from torch import Tensor
+from torch.utils.data import Dataset
+
+from ltx_trainer import logger
+
+# Constants for precomputed data directories
+PRECOMPUTED_DIR_NAME = ".precomputed"
+
+
+class DummyDataset(Dataset):
+ """Produce random latents and prompt embeddings. For minimal demonstration and benchmarking purposes"""
+
+ def __init__(
+ self,
+ width: int = 1024,
+ height: int = 1024,
+ num_frames: int = 25,
+ fps: int = 24,
+ dataset_length: int = 200,
+ latent_dim: int = 128,
+ latent_spatial_compression_ratio: int = 32,
+ latent_temporal_compression_ratio: int = 8,
+ prompt_embed_dim: int = 4096,
+ prompt_sequence_length: int = 256,
+ ) -> None:
+ if width % 32 != 0:
+ raise ValueError(f"Width must be divisible by 32, got {width=}")
+
+ if height % 32 != 0:
+ raise ValueError(f"Height must be divisible by 32, got {height=}")
+
+ if num_frames % 8 != 1:
+ raise ValueError(f"Number of frames must have a remainder of 1 when divided by 8, got {num_frames=}")
+
+ self.width = width
+ self.height = height
+ self.num_frames = num_frames
+ self.fps = fps
+ self.dataset_length = dataset_length
+ self.latent_dim = latent_dim
+ self.num_latent_frames = (num_frames - 1) // latent_temporal_compression_ratio + 1
+ self.latent_height = height // latent_spatial_compression_ratio
+ self.latent_width = width // latent_spatial_compression_ratio
+ self.latent_sequence_length = self.num_latent_frames * self.latent_height * self.latent_width
+ self.prompt_embed_dim = prompt_embed_dim
+ self.prompt_sequence_length = prompt_sequence_length
+
+ def __len__(self) -> int:
+ return self.dataset_length
+
+ def __getitem__(self, idx: int) -> dict[str, dict[str, Tensor]]:
+ return {
+ "latent_conditions": {
+ "latents": torch.randn(
+ self.latent_dim,
+ self.num_latent_frames,
+ self.latent_height,
+ self.latent_width,
+ ),
+ "num_frames": self.num_latent_frames,
+ "height": self.latent_height,
+ "width": self.latent_width,
+ "fps": self.fps,
+ },
+ "text_conditions": {
+ "prompt_embeds": torch.randn(
+ self.prompt_sequence_length,
+ self.prompt_embed_dim,
+ ), # random text embeddings
+ "prompt_attention_mask": torch.ones(
+ self.prompt_sequence_length,
+ dtype=torch.bool,
+ ), # random attention mask
+ },
+ }
+
+
+class PrecomputedDataset(Dataset):
+ def __init__(self, data_root: str, data_sources: dict[str, str] | list[str] | None = None) -> None:
+ """
+ Generic dataset for loading precomputed data from multiple sources.
+ Args:
+ data_root: Root directory containing preprocessed data
+ data_sources: Either:
+ - Dict mapping directory names to output keys
+ - List of directory names (keys will equal values)
+ - None (defaults to ["latents", "conditions"])
+ Example:
+ # Standard mode (list)
+ dataset = PrecomputedDataset("data/", ["latents", "conditions"])
+ # Standard mode (dict)
+ dataset = PrecomputedDataset("data/", {"latents": "latent_conditions", "conditions": "text_conditions"})
+ # IC-LoRA mode
+ dataset = PrecomputedDataset("data/", ["latents", "conditions", "reference_latents"])
+ Note:
+ Latents are always returned in non-patchified format [C, F, H, W].
+ Legacy patchified format [seq_len, C] is automatically converted.
+ """
+ super().__init__()
+
+ self.data_root = self._setup_data_root(data_root)
+ self.data_sources = self._normalize_data_sources(data_sources)
+ self.source_paths = self._setup_source_paths()
+ self.sample_files = self._discover_samples()
+ self._validate_setup()
+
+ @staticmethod
+ def _setup_data_root(data_root: str) -> Path:
+ """Setup and validate the data root directory."""
+ data_root = Path(data_root).expanduser().resolve()
+
+ if not data_root.exists():
+ raise FileNotFoundError(f"Data root directory does not exist: {data_root}")
+
+ # If the given path is the dataset root, use the precomputed subdirectory
+ if (data_root / PRECOMPUTED_DIR_NAME).exists():
+ data_root = data_root / PRECOMPUTED_DIR_NAME
+
+ return data_root
+
+ @staticmethod
+ def _normalize_data_sources(data_sources: dict[str, str] | list[str] | None) -> dict[str, str]:
+ """Normalize data_sources input to a consistent dict format."""
+ if data_sources is None:
+ # Default sources
+ return {"latents": "latent_conditions", "conditions": "text_conditions"}
+ elif isinstance(data_sources, list):
+ # Convert list to dict where keys equal values
+ return {source: source for source in data_sources}
+ elif isinstance(data_sources, dict):
+ return data_sources.copy()
+ else:
+ raise TypeError(f"data_sources must be dict, list, or None, got {type(data_sources)}")
+
+ def _setup_source_paths(self) -> dict[str, Path]:
+ """Map data source names to their actual directory paths."""
+ source_paths = {}
+
+ for dir_name in self.data_sources:
+ source_path = self.data_root / dir_name
+ source_paths[dir_name] = source_path
+
+ # Check that all sources exist.
+ if not source_path.exists():
+ raise FileNotFoundError(f"Required {dir_name} directory does not exist: {source_path}")
+
+ return source_paths
+
+ def _discover_samples(self) -> dict[str, list[Path]]:
+ """Discover all valid sample files across all data sources."""
+ # Use first data source as the reference to discover samples
+ data_key = "latents" if "latents" in self.data_sources else next(iter(self.data_sources.keys()))
+ data_path = self.source_paths[data_key]
+ data_files = list(data_path.glob("**/*.pt"))
+
+ if not data_files:
+ raise ValueError(f"No data files found in {data_path}")
+
+ # Initialize sample files dict
+ sample_files = {output_key: [] for output_key in self.data_sources.values()}
+
+ # For each data file, find corresponding files in other sources
+ for data_file in data_files:
+ rel_path = data_file.relative_to(data_path)
+
+ # Check if corresponding files exist in ALL sources
+ if self._all_source_files_exist(data_file, rel_path):
+ self._fill_sample_data_files(data_file, rel_path, sample_files)
+
+ return sample_files
+
+ def _all_source_files_exist(self, data_file: Path, rel_path: Path) -> bool:
+ """Check if corresponding files exist in all data sources."""
+ for dir_name in self.data_sources:
+ expected_path = self._get_expected_file_path(dir_name, data_file, rel_path)
+ if not expected_path.exists():
+ logger.warning(
+ f"No matching {dir_name} file found for: {data_file.name} (expected in: {expected_path})"
+ )
+ return False
+
+ return True
+
+ def _get_expected_file_path(self, dir_name: str, data_file: Path, rel_path: Path) -> Path:
+ """Get the expected file path for a given data source."""
+ source_path = self.source_paths[dir_name]
+
+ # For conditions, handle legacy naming where latent_X.pt maps to condition_X.pt
+ if dir_name == "conditions" and data_file.name.startswith("latent_"):
+ return source_path / f"condition_{data_file.stem[7:]}.pt"
+
+ return source_path / rel_path
+
+ def _fill_sample_data_files(self, data_file: Path, rel_path: Path, sample_files: dict[str, list[Path]]) -> None:
+ """Add a valid sample to the sample_files tracking."""
+ for dir_name, output_key in self.data_sources.items():
+ expected_path = self._get_expected_file_path(dir_name, data_file, rel_path)
+ sample_files[output_key].append(expected_path.relative_to(self.source_paths[dir_name]))
+
+ def _validate_setup(self) -> None:
+ """Validate that the dataset setup is correct."""
+ if not self.sample_files:
+ raise ValueError("No valid samples found - all data sources must have matching files")
+
+ # Verify all output keys have the same number of samples
+ sample_counts = {key: len(files) for key, files in self.sample_files.items()}
+ if len(set(sample_counts.values())) > 1:
+ raise ValueError(f"Mismatched sample counts across sources: {sample_counts}")
+
+ def __len__(self) -> int:
+ # Use the first output key as reference count
+ first_key = next(iter(self.sample_files.keys()))
+ return len(self.sample_files[first_key])
+
+ def __getitem__(self, index: int) -> dict[str, torch.Tensor]:
+ result = {}
+
+ for dir_name, output_key in self.data_sources.items():
+ source_path = self.source_paths[dir_name]
+ file_rel_path = self.sample_files[output_key][index]
+ file_path = source_path / file_rel_path
+
+ try:
+ data = torch.load(file_path, map_location="cpu", weights_only=True)
+
+ # Normalize video latent format if this is a latent source
+ if "latent" in dir_name.lower():
+ data = self._normalize_video_latents(data)
+
+ result[output_key] = data
+ except Exception as e:
+ raise RuntimeError(f"Failed to load {output_key} from {file_path}: {e}") from e
+
+ # Add index for debugging
+ result["idx"] = index
+ return result
+
+ @staticmethod
+ def _normalize_video_latents(data: dict) -> dict:
+ """
+ Normalize video latents to non-patchified format [C, F, H, W].
+ Used for keeping backward compatibility with legacy datasets.
+ """
+ latents = data["latents"]
+
+ # Check if latents are in legacy patchified format [seq_len, C]
+ if latents.dim() == 2:
+ # Legacy format: [seq_len, C] where seq_len = F * H * W
+ num_frames = data["num_frames"]
+ height = data["height"]
+ width = data["width"]
+
+ # Unpatchify: [seq_len, C] -> [C, F, H, W]
+ latents = rearrange(
+ latents,
+ "(f h w) c -> c f h w",
+ f=num_frames,
+ h=height,
+ w=width,
+ )
+
+ # Update the data dict with unpatchified latents
+ data = data.copy()
+ data["latents"] = latents
+
+ return data
diff --git a/packages/ltx-trainer/src/ltx_trainer/hf_hub_utils.py b/packages/ltx-trainer/src/ltx_trainer/hf_hub_utils.py
new file mode 100644
index 0000000..63ed56b
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/hf_hub_utils.py
@@ -0,0 +1,208 @@
+import shutil
+import tempfile
+from pathlib import Path
+from typing import List, Union
+
+import imageio
+from huggingface_hub import HfApi, create_repo
+from huggingface_hub.utils import are_progress_bars_disabled, disable_progress_bars, enable_progress_bars
+from rich.progress import Progress, SpinnerColumn, TextColumn
+
+from ltx_trainer import logger
+from ltx_trainer.config import LtxTrainerConfig
+
+
+def push_to_hub(weights_path: Path, sampled_videos_paths: List[Path], config: LtxTrainerConfig) -> None:
+ """Push the trained LoRA weights to HuggingFace Hub."""
+ if not config.hub.hub_model_id:
+ logger.warning("⚠️ HuggingFace hub_model_id not specified, skipping push to hub")
+ return
+
+ api = HfApi()
+
+ # Save original progress bar state
+ original_progress_state = are_progress_bars_disabled()
+ disable_progress_bars() # Disable during our custom progress tracking
+
+ try:
+ # Try to create repo if it doesn't exist
+ try:
+ repo = create_repo(
+ repo_id=config.hub.hub_model_id,
+ repo_type="model",
+ exist_ok=True, # Don't raise error if repo exists
+ )
+ repo_id = repo.repo_id
+ logger.info(f"🤗 Successfully created HuggingFace model repository at: {repo.url}")
+ except Exception as e:
+ logger.error(f"❌ Failed to create HuggingFace model repository: {e}")
+ return
+
+ # Create a single temporary directory for all files
+ with tempfile.TemporaryDirectory() as temp_dir:
+ temp_path = Path(temp_dir)
+
+ with Progress(
+ SpinnerColumn(),
+ TextColumn("[progress.description]{task.description}"),
+ transient=True,
+ ) as progress:
+ try:
+ # Copy weights
+ task_copy = progress.add_task("Copying weights...", total=None)
+ weights_dest = temp_path / weights_path.name
+ shutil.copy2(weights_path, weights_dest)
+ progress.update(task_copy, description="✓ Weights copied")
+
+ # Create model card and save samples
+ task_card = progress.add_task("Creating model card and samples...", total=None)
+ _create_model_card(
+ output_dir=temp_path,
+ videos=sampled_videos_paths,
+ config=config,
+ )
+ progress.update(task_card, description="✓ Model card and samples created")
+
+ # Upload everything at once
+ task_upload = progress.add_task("Pushing files to HuggingFace Hub...", total=None)
+ api.upload_folder(
+ folder_path=str(temp_path),
+ repo_id=repo_id,
+ repo_type="model",
+ )
+ progress.update(task_upload, description="✓ Files pushed to HuggingFace Hub")
+ logger.info("✅ Successfully pushed files to HuggingFace Hub")
+
+ except Exception as e:
+ logger.error(f"❌ Failed to process and push files to HuggingFace Hub: {e}")
+ raise # Re-raise to handle in outer try block
+
+ finally:
+ # Restore original progress bar state
+ if not original_progress_state:
+ enable_progress_bars()
+
+
+def convert_video_to_gif(video_path: Path, output_path: Path) -> None:
+ """Convert a video file to GIF format."""
+ try:
+ # Read the video file
+ reader = imageio.get_reader(str(video_path))
+ fps = reader.get_meta_data()["fps"]
+
+ # Write GIF file with infinite loop
+ writer = imageio.get_writer(
+ str(output_path),
+ fps=min(fps, 15), # Cap FPS at 15 for reasonable file size
+ loop=0, # 0 means infinite loop
+ )
+
+ for frame in reader:
+ writer.append_data(frame)
+
+ writer.close()
+ reader.close()
+ except Exception as e:
+ logger.error(f"Failed to convert video to GIF: {e}")
+
+
+def _create_model_card(
+ output_dir: Union[str, Path],
+ videos: List[Path],
+ config: LtxTrainerConfig,
+) -> Path:
+ """Generate and save a model card for the trained model."""
+
+ repo_id = config.hub.hub_model_id
+ pretrained_model_name_or_path = config.model.model_path
+ validation_prompts = config.validation.prompts
+ output_dir = Path(output_dir)
+ template_path = Path(__file__).parent.parent.parent / "templates" / "model_card.md"
+
+ # Read the template
+ template = template_path.read_text()
+
+ # Get model name from repo_id
+ model_name = repo_id.split("/")[-1]
+
+ # Get base model information
+ base_model_link = str(pretrained_model_name_or_path)
+ model_path_str = str(pretrained_model_name_or_path)
+ is_url = model_path_str.startswith(("http://", "https://"))
+
+ # For URLs, extract the filename from the URL. For local paths, use the filename stem
+ base_model_name = model_path_str.split("/")[-1] if is_url else Path(pretrained_model_name_or_path).name
+
+ # Format validation prompts and create grid layout
+ prompts_text = ""
+ sample_grid = []
+
+ if validation_prompts and videos:
+ prompts_text = "Example prompts used during validation:\n\n"
+
+ # Create samples directory
+ samples_dir = output_dir / "samples"
+ samples_dir.mkdir(exist_ok=True, parents=True)
+
+ # Process videos and create cells
+ cells = []
+ for i, (prompt, video) in enumerate(zip(validation_prompts, videos, strict=False)):
+ if video.exists():
+ # Add prompt to text section
+ prompts_text += f"- `{prompt}`\n"
+
+ # Convert video to GIF
+ gif_path = samples_dir / f"sample_{i}.gif"
+ try:
+ convert_video_to_gif(video, gif_path)
+
+ # Create grid cell with collapsible description
+ cell = (
+ f"![example{i + 1}](./samples/sample_{i}.gif)"
+ "<br>"
+ '<details style="max-width: 300px; margin: auto;">'
+ f"<summary>Prompt</summary>"
+ f"{prompt}"
+ "</details>"
+ )
+ cells.append(cell)
+ except Exception as e:
+ logger.error(f"Failed to process video {video}: {e}")
+
+ # Calculate optimal grid dimensions
+ num_cells = len(cells)
+ if num_cells > 0:
+ # Aim for a roughly square grid, with max 4 columns
+ num_cols = min(4, num_cells)
+ num_rows = (num_cells + num_cols - 1) // num_cols # Ceiling division
+
+ # Create grid rows
+ for row in range(num_rows):
+ start_idx = row * num_cols
+ end_idx = min(start_idx + num_cols, num_cells)
+ row_cells = cells[start_idx:end_idx]
+ # Properly format the row with table markers and exact number of cells
+ formatted_row = "| " + " | ".join(row_cells) + " |"
+ sample_grid.append(formatted_row)
+
+ # Join grid rows with just the content, no headers needed
+ grid_text = "\n".join(sample_grid) if sample_grid else ""
+
+ # Fill in the template
+ model_card_content = template.format(
+ base_model=base_model_name,
+ base_model_link=base_model_link,
+ model_name=model_name,
+ training_type="LoRA fine-tuning" if config.model.training_mode == "lora" else "Full model fine-tuning",
+ training_steps=config.optimization.steps,
+ learning_rate=config.optimization.learning_rate,
+ batch_size=config.optimization.batch_size,
+ validation_prompts=prompts_text,
+ sample_grid=grid_text,
+ )
+
+ # Save the model card directly
+ model_card_path = output_dir / "README.md"
+ model_card_path.write_text(model_card_content)
+
+ return model_card_path
diff --git a/packages/ltx-trainer/src/ltx_trainer/model_loader.py b/packages/ltx-trainer/src/ltx_trainer/model_loader.py
new file mode 100644
index 0000000..c7fd248
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/model_loader.py
@@ -0,0 +1,336 @@
+# ruff: noqa: PLC0415
+
+"""
+Model loader for LTX-2 trainer using the new ltx-core package.
+This module provides a unified interface for loading LTX-2 model components
+for training, using SingleGPUModelBuilder from ltx-core.
+Example usage:
+ # Load individual components
+ vae_encoder = load_video_vae_encoder("/path/to/checkpoint.safetensors", device="cuda")
+ vae_decoder = load_video_vae_decoder("/path/to/checkpoint.safetensors", device="cuda")
+ text_encoder = load_text_encoder("/path/to/checkpoint.safetensors", "/path/to/gemma", device="cuda")
+ # Load all components at once
+ components = load_model("/path/to/checkpoint.safetensors", text_encoder_path="/path/to/gemma")
+"""
+
+from __future__ import annotations
+
+from dataclasses import dataclass
+from pathlib import Path
+from typing import TYPE_CHECKING
+
+import torch
+
+from ltx_trainer import logger
+
+# Type alias for device specification
+Device = str | torch.device
+
+# Type checking imports (not loaded at runtime)
+if TYPE_CHECKING:
+ from ltx_core.components.schedulers import LTX2Scheduler
+ from ltx_core.model.audio_vae import AudioDecoder, AudioEncoder, Vocoder
+ from ltx_core.model.transformer import LTXModel
+ from ltx_core.model.video_vae import VideoDecoder, VideoEncoder
+ from ltx_core.text_encoders.gemma import AVGemmaTextEncoderModel
+
+
+def _to_torch_device(device: Device) -> torch.device:
+ """Convert device specification to torch.device."""
+ return torch.device(device) if isinstance(device, str) else device
+
+
+# =============================================================================
+# Individual Component Loaders
+# =============================================================================
+
+
+def load_transformer(
+ checkpoint_path: str | Path,
+ device: Device = "cpu",
+ dtype: torch.dtype = torch.bfloat16,
+) -> "LTXModel":
+ """Load the LTX transformer model.
+ Args:
+ checkpoint_path: Path to the safetensors checkpoint file
+ device: Device to load model on
+ dtype: Data type for model weights
+ Returns:
+ Loaded LTXModel transformer
+ """
+ from ltx_core.loader.single_gpu_model_builder import SingleGPUModelBuilder
+ from ltx_core.model.transformer.model_configurator import (
+ LTXV_MODEL_COMFY_RENAMING_MAP,
+ LTXModelConfigurator,
+ )
+
+ return SingleGPUModelBuilder(
+ model_path=str(checkpoint_path),
+ model_class_configurator=LTXModelConfigurator,
+ model_sd_ops=LTXV_MODEL_COMFY_RENAMING_MAP,
+ ).build(device=_to_torch_device(device), dtype=dtype)
+
+
+def load_video_vae_encoder(
+ checkpoint_path: str | Path,
+ device: Device = "cpu",
+ dtype: torch.dtype = torch.bfloat16,
+) -> "VideoEncoder":
+ """Load the video VAE encoder (for preprocessing).
+ Args:
+ checkpoint_path: Path to the safetensors checkpoint file
+ device: Device to load model on
+ dtype: Data type for model weights
+ Returns:
+ Loaded VideoEncoder
+ """
+ from ltx_core.loader.single_gpu_model_builder import SingleGPUModelBuilder
+ from ltx_core.model.video_vae import VAE_ENCODER_COMFY_KEYS_FILTER, VideoEncoderConfigurator
+
+ return SingleGPUModelBuilder(
+ model_path=str(checkpoint_path),
+ model_class_configurator=VideoEncoderConfigurator,
+ model_sd_ops=VAE_ENCODER_COMFY_KEYS_FILTER,
+ ).build(device=_to_torch_device(device), dtype=dtype)
+
+
+def load_video_vae_decoder(
+ checkpoint_path: str | Path,
+ device: Device = "cpu",
+ dtype: torch.dtype = torch.bfloat16,
+) -> "VideoDecoder":
+ """Load the video VAE decoder (for inference/validation).
+ Args:
+ checkpoint_path: Path to the safetensors checkpoint file
+ device: Device to load model on
+ dtype: Data type for model weights
+ Returns:
+ Loaded VideoDecoder
+ """
+ from ltx_core.loader.single_gpu_model_builder import SingleGPUModelBuilder
+ from ltx_core.model.video_vae import VAE_DECODER_COMFY_KEYS_FILTER, VideoDecoderConfigurator
+
+ return SingleGPUModelBuilder(
+ model_path=str(checkpoint_path),
+ model_class_configurator=VideoDecoderConfigurator,
+ model_sd_ops=VAE_DECODER_COMFY_KEYS_FILTER,
+ ).build(device=_to_torch_device(device), dtype=dtype)
+
+
+def load_audio_vae_encoder(
+ checkpoint_path: str | Path,
+ device: Device = "cpu",
+ dtype: torch.dtype = torch.bfloat16,
+) -> "AudioEncoder":
+ """Load the audio VAE encoder (for preprocessing).
+ Args:
+ checkpoint_path: Path to the safetensors checkpoint file
+ device: Device to load model on
+ dtype: Data type for model weights (default bfloat16, but float32 recommended for quality)
+ Returns:
+ Loaded AudioEncoder
+ """
+ from ltx_core.loader import SingleGPUModelBuilder
+ from ltx_core.model.audio_vae import AUDIO_VAE_ENCODER_COMFY_KEYS_FILTER, AudioEncoderConfigurator
+
+ return SingleGPUModelBuilder(
+ model_path=str(checkpoint_path),
+ model_class_configurator=AudioEncoderConfigurator,
+ model_sd_ops=AUDIO_VAE_ENCODER_COMFY_KEYS_FILTER,
+ ).build(device=_to_torch_device(device), dtype=dtype)
+
+
+def load_audio_vae_decoder(
+ checkpoint_path: str | Path,
+ device: Device = "cpu",
+ dtype: torch.dtype = torch.bfloat16,
+) -> "AudioDecoder":
+ """Load the audio VAE decoder.
+ Args:
+ checkpoint_path: Path to the safetensors checkpoint file
+ device: Device to load model on
+ dtype: Data type for model weights
+ Returns:
+ Loaded AudioDecoder
+ """
+ from ltx_core.loader import SingleGPUModelBuilder
+ from ltx_core.model.audio_vae import AUDIO_VAE_DECODER_COMFY_KEYS_FILTER, AudioDecoderConfigurator
+
+ return SingleGPUModelBuilder(
+ model_path=str(checkpoint_path),
+ model_class_configurator=AudioDecoderConfigurator,
+ model_sd_ops=AUDIO_VAE_DECODER_COMFY_KEYS_FILTER,
+ ).build(device=_to_torch_device(device), dtype=dtype)
+
+
+def load_vocoder(
+ checkpoint_path: str | Path,
+ device: Device = "cpu",
+ dtype: torch.dtype = torch.bfloat16,
+) -> "Vocoder":
+ """Load the vocoder (for audio waveform generation).
+ Args:
+ checkpoint_path: Path to the safetensors checkpoint file
+ device: Device to load model on
+ dtype: Data type for model weights
+ Returns:
+ Loaded Vocoder
+ """
+ from ltx_core.loader import SingleGPUModelBuilder
+ from ltx_core.model.audio_vae import VOCODER_COMFY_KEYS_FILTER, VocoderConfigurator
+
+ return SingleGPUModelBuilder(
+ model_path=str(checkpoint_path),
+ model_class_configurator=VocoderConfigurator,
+ model_sd_ops=VOCODER_COMFY_KEYS_FILTER,
+ ).build(device=_to_torch_device(device), dtype=dtype)
+
+
+def load_text_encoder(
+ checkpoint_path: str | Path,
+ gemma_model_path: str | Path,
+ device: Device = "cpu",
+ dtype: torch.dtype = torch.bfloat16,
+) -> "AVGemmaTextEncoderModel":
+ """Load the Gemma text encoder.
+ Args:
+ checkpoint_path: Path to the LTX-2 safetensors checkpoint file
+ gemma_model_path: Path to Gemma model directory
+ device: Device to load model on
+ dtype: Data type for model weights
+ Returns:
+ Loaded AVGemmaTextEncoderModel
+ """
+ from ltx_core.loader.single_gpu_model_builder import SingleGPUModelBuilder
+ from ltx_core.text_encoders.gemma.encoders.av_encoder import (
+ AV_GEMMA_TEXT_ENCODER_KEY_OPS,
+ AVGemmaTextEncoderModelConfigurator,
+ )
+ from ltx_core.text_encoders.gemma.encoders.base_encoder import module_ops_from_gemma_root
+
+ if not Path(gemma_model_path).is_dir():
+ raise ValueError(f"Gemma model path is not a directory: {gemma_model_path}")
+
+ torch_device = _to_torch_device(device)
+ text_encoder = SingleGPUModelBuilder(
+ model_path=str(checkpoint_path),
+ model_class_configurator=AVGemmaTextEncoderModelConfigurator,
+ model_sd_ops=AV_GEMMA_TEXT_ENCODER_KEY_OPS,
+ module_ops=module_ops_from_gemma_root(str(gemma_model_path)),
+ ).build(device=torch_device, dtype=dtype)
+
+ return text_encoder
+
+
+# =============================================================================
+# Combined Component Loader
+# =============================================================================
+
+
+@dataclass
+class LtxModelComponents:
+ """Container for all LTX-2 model components."""
+
+ transformer: "LTXModel"
+ video_vae_encoder: "VideoEncoder | None" = None
+ video_vae_decoder: "VideoDecoder | None" = None
+ audio_vae_decoder: "AudioDecoder | None" = None
+ vocoder: "Vocoder | None" = None
+ text_encoder: "AVGemmaTextEncoderModel | None" = None
+ scheduler: "LTX2Scheduler | None" = None
+
+
+def load_model(
+ checkpoint_path: str | Path,
+ text_encoder_path: str | Path | None = None,
+ device: Device = "cpu",
+ dtype: torch.dtype = torch.bfloat16,
+ with_video_vae_encoder: bool = False,
+ with_video_vae_decoder: bool = True,
+ with_audio_vae_decoder: bool = True,
+ with_vocoder: bool = True,
+ with_text_encoder: bool = True,
+) -> LtxModelComponents:
+ """
+ Load LTX-2 model components from a safetensors checkpoint.
+ This is a convenience function that loads multiple components at once.
+ For loading individual components, use the dedicated functions:
+ - load_transformer()
+ - load_video_vae_encoder()
+ - load_video_vae_decoder()
+ - load_audio_vae_decoder()
+ - load_vocoder()
+ - load_text_encoder()
+ Args:
+ checkpoint_path: Path to the safetensors checkpoint file
+ text_encoder_path: Path to Gemma model directory (required if with_text_encoder=True)
+ device: Device to load models on ("cuda", "cpu", etc.)
+ dtype: Data type for model weights
+ with_video_vae_encoder: Whether to load the video VAE encoder (for preprocessing)
+ with_video_vae_decoder: Whether to load the video VAE decoder (for inference/validation)
+ with_audio_vae_decoder: Whether to load the audio VAE decoder
+ with_vocoder: Whether to load the vocoder
+ with_text_encoder: Whether to load the text encoder
+ Returns:
+ LtxModelComponents containing all loaded model components
+ """
+ from ltx_core.components.schedulers import LTX2Scheduler
+
+ checkpoint_path = Path(checkpoint_path)
+
+ # Validate checkpoint exists
+ if not checkpoint_path.exists():
+ raise FileNotFoundError(f"Checkpoint not found: {checkpoint_path}")
+
+ logger.info(f"Loading LTX-2 model from {checkpoint_path}")
+
+ torch_device = _to_torch_device(device)
+
+ # Load transformer
+ logger.debug("Loading transformer...")
+ transformer = load_transformer(checkpoint_path, torch_device, dtype)
+
+ # Load video VAE encoder
+ video_vae_encoder = None
+ if with_video_vae_encoder:
+ logger.debug("Loading video VAE encoder...")
+ video_vae_encoder = load_video_vae_encoder(checkpoint_path, torch_device, dtype)
+
+ # Load video VAE decoder
+ video_vae_decoder = None
+ if with_video_vae_decoder:
+ logger.debug("Loading video VAE decoder...")
+ video_vae_decoder = load_video_vae_decoder(checkpoint_path, torch_device, dtype)
+
+ # Load audio VAE decoder
+ audio_vae_decoder = None
+ if with_audio_vae_decoder:
+ logger.debug("Loading audio VAE decoder...")
+ audio_vae_decoder = load_audio_vae_decoder(checkpoint_path, torch_device, dtype)
+
+ # Load vocoder
+ vocoder = None
+ if with_vocoder:
+ logger.debug("Loading vocoder...")
+ vocoder = load_vocoder(checkpoint_path, torch_device, dtype)
+
+ # Load text encoder
+ text_encoder = None
+ if with_text_encoder:
+ if text_encoder_path is None:
+ raise ValueError("text_encoder_path must be provided when with_text_encoder=True")
+ logger.debug("Loading Gemma text encoder...")
+ text_encoder = load_text_encoder(checkpoint_path, text_encoder_path, torch_device, dtype)
+
+ # Create scheduler (stateless, no loading needed)
+ scheduler = LTX2Scheduler()
+
+ return LtxModelComponents(
+ transformer=transformer,
+ video_vae_encoder=video_vae_encoder,
+ video_vae_decoder=video_vae_decoder,
+ audio_vae_decoder=audio_vae_decoder,
+ vocoder=vocoder,
+ text_encoder=text_encoder,
+ scheduler=scheduler,
+ )
diff --git a/packages/ltx-trainer/src/ltx_trainer/progress.py b/packages/ltx-trainer/src/ltx_trainer/progress.py
new file mode 100644
index 0000000..78fde56
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/progress.py
@@ -0,0 +1,236 @@
+"""Progress tracking for LTX training.
+This module provides a unified progress display for training and validation sampling,
+encapsulating all Rich progress bar logic in one place.
+"""
+
+from rich.progress import (
+ BarColumn,
+ Progress,
+ TaskID,
+ TextColumn,
+ TimeElapsedColumn,
+ TimeRemainingColumn,
+)
+
+
+class SamplingContext:
+ """Context for validation sampling progress tracking.
+ Provides a unified progress display showing current video and denoising step.
+ Display format: "Sampling X/Y [████████████] step Z/W"
+ The progress bar shows the denoising progress for the current video.
+ """
+
+ def __init__(self, progress: Progress | None, task: TaskID | None, num_prompts: int, num_steps: int):
+ self._progress = progress
+ self._task = task
+ self._num_prompts = num_prompts
+ self._num_steps = num_steps
+
+ def start_video(self, video_idx: int) -> None:
+ """Start tracking a new video (resets step progress)."""
+ if self._progress is None or self._task is None:
+ return
+ # Reset task for new video: completed=0, total=num_steps
+ self._progress.reset(self._task, total=self._num_steps)
+ self._progress.update(
+ self._task,
+ completed=0,
+ video=f"{video_idx + 1}/{self._num_prompts}",
+ info=f"step 0/{self._num_steps}",
+ )
+
+ def advance_step(self) -> None:
+ """Advance the denoising step by one."""
+ if self._progress is None or self._task is None:
+ return
+ self._progress.advance(self._task)
+ completed = int(self._progress.tasks[self._task].completed)
+ self._progress.update(self._task, info=f"step {completed}/{self._num_steps}")
+
+ def cleanup(self) -> None:
+ """Hide sampling task when done."""
+ if self._progress is None or self._task is None:
+ return
+ self._progress.update(self._task, visible=False)
+
+
+class StandaloneSamplingProgress:
+ """Standalone progress display for inference scripts.
+ Unlike SamplingContext (which integrates with TrainingProgress), this class
+ manages its own Rich Progress instance for use in standalone inference scripts.
+ Usage:
+ with StandaloneSamplingProgress(num_steps=30) as ctx:
+ for step in range(30):
+ # ... denoising step ...
+ ctx.advance_step()
+ """
+
+ def __init__(self, num_steps: int, description: str = "Generating"):
+ """Initialize standalone sampling progress.
+ Args:
+ num_steps: Total number of denoising steps
+ description: Description to show in progress bar
+ """
+ self._num_steps = num_steps
+ self._description = description
+ self._progress: Progress | None = None
+ self._task: TaskID | None = None
+
+ def __enter__(self) -> "StandaloneSamplingProgress":
+ """Start the progress display."""
+ self._progress = Progress(
+ TextColumn("[progress.description]{task.description}"),
+ BarColumn(bar_width=40, style="blue"),
+ TextColumn("{task.fields[info]}", style="cyan"),
+ TimeElapsedColumn(),
+ TextColumn("ETA:"),
+ TimeRemainingColumn(compact=True),
+ )
+ self._progress.__enter__()
+ self._task = self._progress.add_task(
+ self._description,
+ total=self._num_steps,
+ info=f"step 0/{self._num_steps}",
+ )
+ return self
+
+ def __exit__(self, *args) -> None:
+ """Stop the progress display."""
+ if self._progress is not None:
+ self._progress.__exit__(*args)
+
+ def advance_step(self) -> None:
+ """Advance the denoising step by one."""
+ if self._progress is None or self._task is None:
+ return
+ self._progress.advance(self._task)
+ completed = int(self._progress.tasks[self._task].completed)
+ self._progress.update(self._task, info=f"step {completed}/{self._num_steps}")
+
+
+class TrainingProgress:
+ """Manages Rich progress display for training and validation.
+ This class encapsulates all progress bar logic, providing a clean interface
+ for the trainer to update progress without dealing with Rich internals.
+ Usage:
+ with TrainingProgress(enabled=True, total_steps=1000) as progress:
+ for step in range(1000):
+ # ... training step ...
+ progress.update_training(loss=0.1, lr=1e-4, step_time=0.5)
+ if should_validate:
+ sampling_ctx = progress.start_sampling(num_prompts=3, num_steps=30)
+ sampler = ValidationSampler(..., sampling_context=sampling_ctx)
+ for prompt_idx, prompt in enumerate(prompts):
+ sampling_ctx.start_video(prompt_idx)
+ sampler.generate(...)
+ sampling_ctx.cleanup()
+ """
+
+ def __init__(self, enabled: bool, total_steps: int):
+ """Initialize progress tracking.
+ Args:
+ enabled: Whether to display progress bars (False for non-main processes)
+ total_steps: Total number of training steps
+ """
+ self._enabled = enabled
+ self._total_steps = total_steps
+ self._train_task: TaskID | None = None
+
+ if not enabled:
+ self._progress = None
+ return
+
+ # Single Progress instance with flexible columns
+ self._progress = Progress(
+ TextColumn("[progress.description]{task.description}"),
+ TextColumn("{task.fields[video]}", style="magenta"),
+ BarColumn(bar_width=40, style="blue"),
+ TextColumn("{task.fields[info]}", style="cyan"),
+ TimeElapsedColumn(),
+ TextColumn("ETA:"),
+ TimeRemainingColumn(compact=True),
+ )
+
+ def __enter__(self) -> "TrainingProgress":
+ """Enter the progress context, starting the live display."""
+ if self._progress is not None:
+ self._progress.__enter__()
+ self._train_task = self._progress.add_task(
+ "Training",
+ total=self._total_steps,
+ video=f"0/{self._total_steps}",
+ info="Starting...",
+ )
+ return self
+
+ def __exit__(self, *args) -> None:
+ """Exit the progress context, stopping the live display."""
+ if self._progress is not None:
+ self._progress.__exit__(*args)
+
+ @property
+ def enabled(self) -> bool:
+ """Whether progress display is enabled."""
+ return self._enabled
+
+ def update_training(
+ self,
+ *,
+ loss: float,
+ lr: float,
+ step_time: float,
+ advance: bool = True,
+ ) -> None:
+ """Update the training progress display.
+ Args:
+ loss: Current training loss
+ lr: Current learning rate
+ step_time: Time taken for this step in seconds
+ advance: Whether to advance the progress by one step
+ """
+ if self._progress is None or self._train_task is None:
+ return
+
+ info = f"Loss: {loss:.4f} | LR: {lr:.2e} | {step_time:.2f}s/step"
+ self._progress.update(
+ self._train_task,
+ advance=1 if advance else 0,
+ info=info,
+ )
+ # Update step count in video column
+ completed = int(self._progress.tasks[self._train_task].completed)
+ self._progress.update(self._train_task, video=f"{completed}/{self._total_steps}")
+
+ def start_sampling(self, num_prompts: int, num_steps: int) -> SamplingContext:
+ """Start validation sampling progress tracking.
+ Creates a task that shows current video and denoising step progress.
+ Format: "Sampling X/Y [████████████] step Z/W"
+ Args:
+ num_prompts: Number of validation prompts to sample
+ num_steps: Number of denoising steps per sample
+ Returns:
+ SamplingContext for tracking progress (no-op if progress is disabled)
+ """
+ if self._progress is None:
+ # Return a no-op context when progress is disabled
+ return SamplingContext(
+ progress=None,
+ task=None,
+ num_prompts=num_prompts,
+ num_steps=num_steps,
+ )
+
+ task = self._progress.add_task(
+ "Sampling",
+ total=num_steps,
+ completed=0,
+ video=f"0/{num_prompts}",
+ info=f"step 0/{num_steps}",
+ )
+
+ return SamplingContext(
+ progress=self._progress,
+ task=task,
+ num_prompts=num_prompts,
+ num_steps=num_steps,
+ )
diff --git a/packages/ltx-trainer/src/ltx_trainer/quantization.py b/packages/ltx-trainer/src/ltx_trainer/quantization.py
new file mode 100644
index 0000000..bfc95e2
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/quantization.py
@@ -0,0 +1,90 @@
+# Adapted from: https://github.com/bghira/SimpleTuner/blob/main/helpers/training/quantisation/__init__.py
+from typing import Literal
+
+import torch
+from optimum.quanto import qtype
+
+from ltx_trainer import logger
+
+QuantizationOptions = Literal[
+ "no_change",
+ "int8-quanto",
+ "int4-quanto",
+ "int2-quanto",
+ "fp8-quanto",
+ "fp8uz-quanto",
+]
+
+
+def quantize_model(
+ model: torch.nn.Module,
+ precision: QuantizationOptions,
+ quantize_activations: bool = False,
+) -> torch.nn.Module:
+ """
+ Quantize a model using the specified precision settings.
+ Args:
+ model: The model to quantize.
+ precision: The precision level to quantize to (e.g. "int8-quanto", "fp8-quanto").
+ quantize_activations: Whether to quantize activations in addition to weights.
+ Returns:
+ The quantized model, or the original model if no quantization is performed.
+ """
+ if precision is None or precision == "no_change":
+ return model
+
+ from optimum.quanto import freeze, quantize # noqa: PLC0415
+
+ weight_quant = _quanto_type_map(precision)
+ extra_quanto_args = {
+ "exclude": [
+ "proj_in",
+ "time_embed.*",
+ "caption_projection.*",
+ "rope",
+ "*norm*",
+ "proj_out",
+ ]
+ }
+ if quantize_activations:
+ logger.info("Freezing model weights and activations")
+ extra_quanto_args["activations"] = weight_quant
+ else:
+ logger.info("Freezing model weights only")
+
+ quantize(model, weights=weight_quant, **extra_quanto_args)
+ freeze(model)
+ return model
+
+
+def _quanto_type_map(precision: QuantizationOptions) -> torch.dtype | qtype | None: # noqa: PLR0911
+ if precision == "no_change":
+ return None
+
+ from optimum.quanto import ( # noqa: PLC0415
+ qfloat8,
+ qfloat8_e4m3fnuz,
+ qint2,
+ qint4,
+ qint8,
+ )
+
+ if precision == "int2-quanto":
+ return qint2
+ elif precision == "int4-quanto":
+ return qint4
+ elif precision == "int8-quanto":
+ return qint8
+ elif precision in ("fp8-quanto", "fp8uz-quanto"):
+ if torch.backends.mps.is_available():
+ logger.warning(
+ "MPS doesn't support dtype float8. "
+ "you must select another precision level such as int2, int8, or int8.",
+ )
+ return None
+ if precision == "fp8-quanto":
+ return qfloat8
+ elif precision == "fp8uz-quanto":
+ return qfloat8_e4m3fnuz
+
+ raise ValueError(f"Invalid quantisation level: {precision}")
diff --git a/packages/ltx-trainer/src/ltx_trainer/timestep_samplers.py b/packages/ltx-trainer/src/ltx_trainer/timestep_samplers.py
new file mode 100644
index 0000000..5c91b43
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/timestep_samplers.py
@@ -0,0 +1,128 @@
+import torch
+
+
+class TimestepSampler:
+ """Base class for timestep samplers.
+ Timestep samplers are used to sample timesteps for diffusion models.
+ They should implement both sample() and sample_for() methods.
+ """
+
+ def sample(self, batch_size: int, seq_length: int | None = None, device: torch.device = None) -> torch.Tensor:
+ """Sample timesteps for a batch.
+ Args:
+ batch_size: Number of timesteps to sample
+ seq_length: (optional) Length of the sequence being processed
+ device: Device to place the samples on
+ Returns:
+ Tensor of shape (batch_size,) containing timesteps
+ """
+ raise NotImplementedError
+
+ def sample_for(self, batch: torch.Tensor) -> torch.Tensor:
+ """Sample timesteps for a specific batch tensor.
+ Args:
+ batch: Input tensor of shape (batch_size, seq_length, ...)
+ Returns:
+ Tensor of shape (batch_size,) containing timesteps
+ """
+ raise NotImplementedError
+
+
+class UniformTimestepSampler(TimestepSampler):
+ """Samples timesteps uniformly between min_value and max_value (default 0 and 1)."""
+
+ def __init__(self, min_value: float = 0.0, max_value: float = 1.0):
+ self.min_value = min_value
+ self.max_value = max_value
+
+ def sample(self, batch_size: int, seq_length: int | None = None, device: torch.device = None) -> torch.Tensor: # noqa: ARG002
+ return torch.rand(batch_size, device=device) * (self.max_value - self.min_value) + self.min_value
+
+ def sample_for(self, batch: torch.Tensor) -> torch.Tensor:
+ if batch.ndim != 3:
+ raise ValueError(f"Batch should have 3 dimensions, got {batch.ndim}")
+
+ return self.sample(batch.shape[0], device=batch.device)
+
+
+class ShiftedLogitNormalTimestepSampler:
+ """
+ Samples timesteps from a shifted logit-normal distribution,
+ where the shift is determined by the sequence length.
+ """
+
+ def __init__(self, std: float = 1.0):
+ self.std = std
+
+ def sample(self, batch_size: int, seq_length: int, device: torch.device = None) -> torch.Tensor:
+ """Sample timesteps for a batch from a shifted logit-normal distribution.
+ Args:
+ batch_size: Number of timesteps to sample
+ seq_length: Length of the sequence being processed, used to determine the shift
+ device: Device to place the samples on
+ Returns:
+ Tensor of shape (batch_size,) containing timesteps sampled from a shifted
+ logit-normal distribution, where the shift is determined by seq_length
+ """
+ shift = self._get_shift_for_sequence_length(seq_length)
+ normal_samples = torch.randn((batch_size,), device=device) * self.std + shift
+ timesteps = torch.sigmoid(normal_samples)
+ return timesteps
+
+ def sample_for(self, batch: torch.Tensor) -> torch.Tensor:
+ """Sample timesteps for a specific batch tensor.
+ Args:
+ batch: Input tensor of shape (batch_size, seq_length, ...)
+ Returns:
+ Tensor of shape (batch_size,) containing timesteps sampled from a shifted
+ logit-normal distribution, where the shift is determined by the sequence length
+ of the input batch
+ Raises:
+ ValueError: If the input batch does not have 3 dimensions
+ """
+ if batch.ndim != 3:
+ raise ValueError(f"Batch should have 3 dimensions, got {batch.ndim}")
+
+ batch_size, seq_length, _ = batch.shape
+ return self.sample(batch_size, seq_length, device=batch.device)
+
+ @staticmethod
+ def _get_shift_for_sequence_length(
+ seq_length: int,
+ min_tokens: int = 1024,
+ max_tokens: int = 4096,
+ min_shift: float = 0.95,
+ max_shift: float = 2.05,
+ ) -> float:
+ # Calculate the shift value for a given sequence length using linear interpolation
+ # between min_shift and max_shift based on sequence length.
+ m = (max_shift - min_shift) / (max_tokens - min_tokens) # Calculate slope
+ b = min_shift - m * min_tokens # Calculate y-intercept
+ shift = m * seq_length + b # Apply linear equation y = mx + b
+ return shift
+
+
+SAMPLERS = {
+ "uniform": UniformTimestepSampler,
+ "shifted_logit_normal": ShiftedLogitNormalTimestepSampler,
+}
+
+
+def example() -> None:
+ # noinspection PyUnresolvedReferences
+ import matplotlib.pyplot as plt # noqa: PLC0415
+
+ sampler = ShiftedLogitNormalTimestepSampler()
+ for seq_length in [1024, 2048, 4096, 8192]:
+ samples = sampler.sample(batch_size=1_000_000, seq_length=seq_length)
+
+ # plot the histogram of the samples
+ plt.hist(samples.numpy(), bins=100, density=True)
+ plt.title(f"Timestep Samples for Sequence Length {seq_length}")
+ plt.xlabel("Timestep")
+ plt.ylabel("Density")
+ plt.show()
+
+
+if __name__ == "__main__":
+ example()
diff --git a/packages/ltx-trainer/src/ltx_trainer/trainer.py b/packages/ltx-trainer/src/ltx_trainer/trainer.py
new file mode 100644
index 0000000..72e6364
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/trainer.py
@@ -0,0 +1,955 @@
+import os
+import time
+import warnings
+from pathlib import Path
+from typing import Callable
+
+import torch
+import wandb
+import yaml
+from accelerate import Accelerator, DistributedType
+from accelerate.utils import set_seed
+from peft import LoraConfig, get_peft_model, get_peft_model_state_dict, set_peft_model_state_dict
+from peft.tuners.tuners_utils import BaseTunerLayer
+from peft.utils import ModulesToSaveWrapper
+from pydantic import BaseModel
+from safetensors.torch import load_file, save_file
+from torch import Tensor
+from torch.optim import AdamW
+from torch.optim.lr_scheduler import (
+ CosineAnnealingLR,
+ CosineAnnealingWarmRestarts,
+ LinearLR,
+ LRScheduler,
+ PolynomialLR,
+ StepLR,
+)
+from torch.utils.data import DataLoader
+from torchvision.transforms import functional as F # noqa: N812
+
+from ltx_trainer import logger
+from ltx_trainer.config import LtxTrainerConfig
+from ltx_trainer.config_display import print_config
+from ltx_trainer.datasets import PrecomputedDataset
+from ltx_trainer.hf_hub_utils import push_to_hub
+from ltx_trainer.model_loader import load_model as load_ltx_model
+from ltx_trainer.model_loader import load_text_encoder
+from ltx_trainer.progress import TrainingProgress
+from ltx_trainer.quantization import quantize_model
+from ltx_trainer.timestep_samplers import SAMPLERS
+from ltx_trainer.training_strategies import get_training_strategy
+from ltx_trainer.utils import get_gpu_memory_gb, open_image_as_srgb, save_image
+from ltx_trainer.validation_sampler import CachedPromptEmbeddings, GenerationConfig, ValidationSampler
+from ltx_trainer.video_utils import read_video, save_video
+
+# Disable irrelevant warnings from transformers
+os.environ["TOKENIZERS_PARALLELISM"] = "true"
+
+# Silence bitsandbytes warnings about casting
+warnings.filterwarnings(
+ "ignore", message="MatMul8bitLt: inputs will be cast from torch.bfloat16 to float16 during quantization"
+)
+
+# Disable progress bars if not main process
+IS_MAIN_PROCESS = os.environ.get("LOCAL_RANK", "0") == "0"
+if not IS_MAIN_PROCESS:
+ from transformers.utils.logging import disable_progress_bar
+
+ disable_progress_bar()
+
+StepCallback = Callable[[int, int, list[Path]], None] # (step, total, list[sampled_video_path]) -> None
+
+MEMORY_CHECK_INTERVAL = 200
+
+
+class TrainingStats(BaseModel):
+ """Statistics collected during training"""
+
+ total_time_seconds: float
+ steps_per_second: float
+ samples_per_second: float
+ peak_gpu_memory_gb: float
+ global_batch_size: int
+ num_processes: int
+
+
+class LtxvTrainer:
+ def __init__(self, trainer_config: LtxTrainerConfig) -> None:
+ self._config = trainer_config
+ if IS_MAIN_PROCESS:
+ print_config(trainer_config)
+ self._training_strategy = get_training_strategy(self._config.training_strategy)
+ self._cached_validation_embeddings = self._load_text_encoder_and_cache_embeddings()
+ self._load_models()
+ self._setup_accelerator()
+ self._collect_trainable_params()
+ self._load_checkpoint()
+ self._prepare_models_for_training()
+ self._dataset = None
+ self._global_step = -1
+ self._checkpoint_paths = []
+ self._init_wandb()
+
+ def train( # noqa: PLR0912, PLR0915
+ self,
+ disable_progress_bars: bool = False,
+ step_callback: StepCallback | None = None,
+ ) -> tuple[Path, TrainingStats]:
+ """
+ Start the training process.
+ Returns:
+ Tuple of (saved_model_path, training_stats)
+ """
+ device = self._accelerator.device
+ cfg = self._config
+ start_mem = get_gpu_memory_gb(device)
+
+ train_start_time = time.time()
+
+ # Use the same seed for all processes and ensure deterministic operations
+ set_seed(cfg.seed)
+ logger.debug(f"Process {self._accelerator.process_index} using seed: {cfg.seed}")
+
+ self._init_optimizer()
+ self._init_dataloader()
+ data_iter = iter(self._dataloader)
+ self._init_timestep_sampler()
+
+ # Synchronize all processes after initialization
+ self._accelerator.wait_for_everyone()
+
+ Path(cfg.output_dir).mkdir(parents=True, exist_ok=True)
+
+ # Save the training configuration as YAML
+ self._save_config()
+
+ logger.info("🚀 Starting training...")
+
+ # Create progress tracking (disabled for non-main processes or when explicitly disabled)
+ progress_enabled = IS_MAIN_PROCESS and not disable_progress_bars
+ progress = TrainingProgress(
+ enabled=progress_enabled,
+ total_steps=cfg.optimization.steps,
+ )
+
+ if IS_MAIN_PROCESS and disable_progress_bars:
+ logger.warning("Progress bars disabled. Intermediate status messages will be logged instead.")
+
+ self._transformer.train()
+ self._global_step = 0
+
+ peak_mem_during_training = start_mem
+
+ sampled_videos_paths = None
+
+ with progress:
+ # Initial validation before training starts
+ if cfg.validation.interval and not cfg.validation.skip_initial_validation:
+ sampled_videos_paths = self._sample_videos(progress)
+ if IS_MAIN_PROCESS and sampled_videos_paths and self._config.wandb.log_validation_videos:
+ self._log_validation_samples(sampled_videos_paths, cfg.validation.prompts)
+
+ self._accelerator.wait_for_everyone()
+
+ for step in range(cfg.optimization.steps * cfg.optimization.gradient_accumulation_steps):
+ # Get next batch, reset the dataloader if needed
+ try:
+ batch = next(data_iter)
+ except StopIteration:
+ data_iter = iter(self._dataloader)
+ batch = next(data_iter)
+
+ step_start_time = time.time()
+ with self._accelerator.accumulate(self._transformer):
+ is_optimization_step = (step + 1) % cfg.optimization.gradient_accumulation_steps == 0
+ if is_optimization_step:
+ self._global_step += 1
+
+ loss = self._training_step(batch)
+ self._accelerator.backward(loss)
+
+ if self._accelerator.sync_gradients and cfg.optimization.max_grad_norm > 0:
+ self._accelerator.clip_grad_norm_(
+ self._trainable_params,
+ cfg.optimization.max_grad_norm,
+ )
+
+ self._optimizer.step()
+ self._optimizer.zero_grad()
+
+ if self._lr_scheduler is not None:
+ self._lr_scheduler.step()
+
+ # Run validation if needed
+ if (
+ cfg.validation.interval
+ and self._global_step > 0
+ and self._global_step % cfg.validation.interval == 0
+ and is_optimization_step
+ ):
+ if self._accelerator.distributed_type == DistributedType.FSDP:
+ # FSDP: All processes must participate in validation
+ sampled_videos_paths = self._sample_videos(progress)
+ if IS_MAIN_PROCESS and sampled_videos_paths and self._config.wandb.log_validation_videos:
+ self._log_validation_samples(sampled_videos_paths, cfg.validation.prompts)
+ # DDP: Only main process runs validation
+ elif IS_MAIN_PROCESS:
+ sampled_videos_paths = self._sample_videos(progress)
+ if sampled_videos_paths and self._config.wandb.log_validation_videos:
+ self._log_validation_samples(sampled_videos_paths, cfg.validation.prompts)
+
+ # Save checkpoint if needed
+ if (
+ cfg.checkpoints.interval
+ and self._global_step > 0
+ and self._global_step % cfg.checkpoints.interval == 0
+ and is_optimization_step
+ ):
+ self._save_checkpoint()
+
+ self._accelerator.wait_for_everyone()
+
+ # Call step callback if provided
+ if step_callback and is_optimization_step:
+ step_callback(self._global_step, cfg.optimization.steps, sampled_videos_paths)
+
+ self._accelerator.wait_for_everyone()
+
+ # Update progress and log metrics
+ current_lr = self._optimizer.param_groups[0]["lr"]
+ step_time = (time.time() - step_start_time) * cfg.optimization.gradient_accumulation_steps
+
+ progress.update_training(
+ loss=loss.item(),
+ lr=current_lr,
+ step_time=step_time,
+ advance=is_optimization_step,
+ )
+
+ # Log metrics to W&B (only on main process and optimization steps)
+ if IS_MAIN_PROCESS and is_optimization_step:
+ self._log_metrics(
+ {
+ "train/loss": loss.item(),
+ "train/learning_rate": current_lr,
+ "train/step_time": step_time,
+ "train/global_step": self._global_step,
+ }
+ )
+
+ # Fallback logging when progress bars are disabled
+ if disable_progress_bars and IS_MAIN_PROCESS and self._global_step % 20 == 0:
+ elapsed = time.time() - train_start_time
+ progress_percentage = self._global_step / cfg.optimization.steps
+ if progress_percentage > 0:
+ total_estimated = elapsed / progress_percentage
+ total_time = f"{total_estimated // 3600:.0f}h {(total_estimated % 3600) // 60:.0f}m"
+ else:
+ total_time = "calculating..."
+ logger.info(
+ f"Step {self._global_step}/{cfg.optimization.steps} - "
+ f"Loss: {loss.item():.4f}, LR: {current_lr:.2e}, "
+ f"Time/Step: {step_time:.2f}s, Total Time: {total_time}",
+ )
+
+ # Sample GPU memory periodically
+ if step % MEMORY_CHECK_INTERVAL == 0:
+ current_mem = get_gpu_memory_gb(device)
+ peak_mem_during_training = max(peak_mem_during_training, current_mem)
+
+ # Collect final stats
+ train_end_time = time.time()
+ end_mem = get_gpu_memory_gb(device)
+ peak_mem = max(start_mem, end_mem, peak_mem_during_training)
+
+ # Calculate steps/second over entire training
+ total_time_seconds = train_end_time - train_start_time
+ steps_per_second = cfg.optimization.steps / total_time_seconds
+
+ samples_per_second = steps_per_second * self._accelerator.num_processes * cfg.optimization.batch_size
+
+ stats = TrainingStats(
+ total_time_seconds=total_time_seconds,
+ steps_per_second=steps_per_second,
+ samples_per_second=samples_per_second,
+ peak_gpu_memory_gb=peak_mem,
+ num_processes=self._accelerator.num_processes,
+ global_batch_size=cfg.optimization.batch_size * self._accelerator.num_processes,
+ )
+
+ saved_path = self._save_checkpoint()
+
+ if IS_MAIN_PROCESS:
+ # Log the training statistics
+ self._log_training_stats(stats)
+
+ # Upload artifacts to hub if enabled
+ if cfg.hub.push_to_hub:
+ push_to_hub(saved_path, sampled_videos_paths, self._config)
+
+ # Log final stats to W&B
+ if self._wandb_run is not None:
+ self._log_metrics(
+ {
+ "stats/total_time_minutes": stats.total_time_seconds / 60,
+ "stats/steps_per_second": stats.steps_per_second,
+ "stats/samples_per_second": stats.samples_per_second,
+ "stats/peak_gpu_memory_gb": stats.peak_gpu_memory_gb,
+ }
+ )
+ self._wandb_run.finish()
+
+ self._accelerator.wait_for_everyone()
+ self._accelerator.end_training()
+
+ return saved_path, stats
+
+ def _training_step(self, batch: dict[str, dict[str, Tensor]]) -> Tensor:
+ """Perform a single training step using the configured strategy."""
+ # Apply embedding connectors to transform pre-computed text embeddings
+ conditions = batch["conditions"]
+ video_embeds, audio_embeds, attention_mask = self._text_encoder._run_connectors(
+ conditions["prompt_embeds"], conditions["prompt_attention_mask"]
+ )
+ conditions["video_prompt_embeds"] = video_embeds
+ conditions["audio_prompt_embeds"] = audio_embeds
+ conditions["prompt_attention_mask"] = attention_mask
+
+ # Use strategy to prepare training inputs (returns ModelInputs with Modality objects)
+ model_inputs = self._training_strategy.prepare_training_inputs(batch, self._timestep_sampler)
+
+ # Run transformer forward pass with Modality-based interface
+ video_pred, audio_pred = self._transformer(
+ video=model_inputs.video,
+ audio=model_inputs.audio,
+ perturbations=None,
+ )
+
+ # Use strategy to compute loss
+ loss = self._training_strategy.compute_loss(video_pred, audio_pred, model_inputs)
+
+ return loss
+
+ def _load_text_encoder_and_cache_embeddings(self) -> list[CachedPromptEmbeddings] | None:
+ """Load text encoder, computes and returns validation embeddings."""
+
+ # This method:
+ # 1. Loads the text encoder on GPU
+ # 2. If validation prompts are configured, computes and caches their embeddings
+ # 3. Unloads the heavy Gemma model while keeping the lightweight embedding connectors
+ # The text encoder is kept (as self._text_encoder) but with model/tokenizer/feature_extractor
+ # set to None. Only the embedding connectors remain for use during training.
+
+ # Load text encoder on GPU
+ logger.debug("Loading text encoder...")
+ if self._config.acceleration.load_text_encoder_in_8bit:
+ logger.warning(
+ "⚠️ load_text_encoder_in_8bit is set to True but 8-bit text encoder loading "
+ "is not currently implemented. The text encoder will be loaded in bfloat16 precision."
+ )
+
+ self._text_encoder = load_text_encoder(
+ checkpoint_path=self._config.model.model_path,
+ gemma_model_path=self._config.model.text_encoder_path,
+ device="cuda",
+ dtype=torch.bfloat16,
+ )
+
+ # Cache validation embeddings if prompts are configured
+ cached_embeddings = None
+ if self._config.validation.prompts:
+ logger.info(f"Pre-computing embeddings for {len(self._config.validation.prompts)} validation prompts...")
+ cached_embeddings = []
+ with torch.inference_mode():
+ for prompt in self._config.validation.prompts:
+ v_ctx_pos, a_ctx_pos, _ = self._text_encoder(prompt)
+ v_ctx_neg, a_ctx_neg, _ = self._text_encoder(self._config.validation.negative_prompt)
+
+ cached_embeddings.append(
+ CachedPromptEmbeddings(
+ video_context_positive=v_ctx_pos.cpu(),
+ audio_context_positive=a_ctx_pos.cpu(),
+ video_context_negative=v_ctx_neg.cpu() if v_ctx_neg is not None else None,
+ audio_context_negative=a_ctx_neg.cpu() if a_ctx_neg is not None else None,
+ )
+ )
+
+ # Unload heavy components to free VRAM, keeping only the embedding connectors
+ self._text_encoder.model = None
+ self._text_encoder.tokenizer = None
+ self._text_encoder.feature_extractor_linear = None
+ torch.cuda.empty_cache()
+
+ logger.debug("Validation prompt embeddings cached. Gemma model unloaded")
+ return cached_embeddings
+
+ def _load_models(self) -> None:
+ """Load the LTX-2 model components."""
+ # Load audio components if:
+ # 1. Training strategy requires audio (training the audio branch), OR
+ # 2. Validation is configured to generate audio (even if not training audio)
+ load_audio = self._training_strategy.requires_audio or self._config.validation.generate_audio
+
+ # Check if we need VAE encoder (for image or reference video conditioning)
+ need_vae_encoder = (
+ self._config.validation.images is not None or self._config.validation.reference_videos is not None
+ )
+
+ # Load all model components (except text encoder - already handled)
+ components = load_ltx_model(
+ checkpoint_path=self._config.model.model_path,
+ device="cpu",
+ dtype=torch.bfloat16,
+ with_video_vae_encoder=need_vae_encoder, # Needed for image conditioning
+ with_video_vae_decoder=True, # Needed for validation sampling
+ with_audio_vae_decoder=load_audio,
+ with_vocoder=load_audio,
+ with_text_encoder=False, # Text encoder handled separately
+ )
+
+ # Extract components
+ self._transformer = components.transformer
+ self._vae_decoder = components.video_vae_decoder.to(dtype=torch.bfloat16)
+ self._vae_encoder = components.video_vae_encoder
+ if self._vae_encoder is not None:
+ self._vae_encoder = self._vae_encoder.to(dtype=torch.bfloat16)
+ self._scheduler = components.scheduler
+ self._audio_vae = components.audio_vae_decoder
+ self._vocoder = components.vocoder
+ # Note: self._text_encoder was set in _load_text_encoder_and_cache_embeddings
+
+ # Determine initial dtype based on training mode.
+ # Note: For FSDP + LoRA, we'll cast to FP32 later in _prepare_models_for_training()
+ # after the accelerator is set up, and we can detect FSDP.
+ transformer_dtype = torch.bfloat16 if self._config.model.training_mode == "lora" else torch.float32
+ self._transformer = self._transformer.to(dtype=transformer_dtype)
+
+ if self._config.acceleration.quantization is not None:
+ if self._config.model.training_mode == "full":
+ raise ValueError("Quantization is not supported in full training mode.")
+
+ logger.warning(f"Quantizing model with precision: {self._config.acceleration.quantization}")
+ self._transformer = quantize_model(
+ self._transformer,
+ precision=self._config.acceleration.quantization,
+ )
+
+ # Freeze all models. We later unfreeze the transformer based on training mode.
+ # Note: embedding_connectors are already frozen (they come from the frozen text encoder)
+ self._vae_decoder.requires_grad_(False)
+ if self._vae_encoder is not None:
+ self._vae_encoder.requires_grad_(False)
+ self._transformer.requires_grad_(False)
+ if self._audio_vae is not None:
+ self._audio_vae.requires_grad_(False)
+ if self._vocoder is not None:
+ self._vocoder.requires_grad_(False)
+
+ def _collect_trainable_params(self) -> None:
+ """Collect trainable parameters based on training mode."""
+ if self._config.model.training_mode == "lora":
+ # For LoRA training, first set up LoRA layers
+ self._setup_lora()
+ elif self._config.model.training_mode == "full":
+ # For full training, unfreeze all transformer parameters
+ self._transformer.requires_grad_(True)
+ else:
+ raise ValueError(f"Unknown training mode: {self._config.model.training_mode}")
+
+ self._trainable_params = [p for p in self._transformer.parameters() if p.requires_grad]
+ logger.debug(f"Trainable params count: {sum(p.numel() for p in self._trainable_params):,}")
+
+ def _init_timestep_sampler(self) -> None:
+ """Initialize the timestep sampler based on the config."""
+ sampler_cls = SAMPLERS[self._config.flow_matching.timestep_sampling_mode]
+ self._timestep_sampler = sampler_cls(**self._config.flow_matching.timestep_sampling_params)
+
+ def _setup_lora(self) -> None:
+ """Configure LoRA adapters for the transformer. Only called in LoRA training mode."""
+ logger.debug(f"Adding LoRA adapter with rank {self._config.lora.rank}")
+ lora_config = LoraConfig(
+ r=self._config.lora.rank,
+ lora_alpha=self._config.lora.alpha,
+ target_modules=self._config.lora.target_modules,
+ lora_dropout=self._config.lora.dropout,
+ init_lora_weights=True,
+ )
+ # Wrap the transformer with PEFT to add LoRA layers
+ # noinspection PyTypeChecker
+ self._transformer = get_peft_model(self._transformer, lora_config)
+
+ def _load_checkpoint(self) -> None:
+ """Load checkpoint if specified in config."""
+ if not self._config.model.load_checkpoint:
+ return
+
+ checkpoint_path = self._find_checkpoint(self._config.model.load_checkpoint)
+ if not checkpoint_path:
+ logger.warning(f"⚠️ Could not find checkpoint at {self._config.model.load_checkpoint}")
+ return
+
+ logger.info(f"📥 Loading checkpoint from {checkpoint_path}")
+
+ if self._config.model.training_mode == "full":
+ self._load_full_checkpoint(checkpoint_path)
+ else: # LoRA mode
+ self._load_lora_checkpoint(checkpoint_path)
+
+ def _load_full_checkpoint(self, checkpoint_path: Path) -> None:
+ """Load full model checkpoint."""
+ state_dict = load_file(checkpoint_path)
+ self._transformer.load_state_dict(state_dict, strict=True)
+
+ logger.info("✅ Full model checkpoint loaded successfully")
+
+ def _load_lora_checkpoint(self, checkpoint_path: Path) -> None:
+ """Load LoRA checkpoint with DDP/FSDP compatibility."""
+ state_dict = load_file(checkpoint_path)
+
+ # Adjust layer names to match internal format.
+ # (Weights are saved in ComfyUI-compatible format, with "diffusion_model." prefix)
+ state_dict = {k.replace("diffusion_model.", "", 1): v for k, v in state_dict.items()}
+
+ # Load LoRA weights and verify all weights were loaded
+ base_model = self._transformer.get_base_model()
+ set_peft_model_state_dict(base_model, state_dict)
+
+ logger.info("✅ LoRA checkpoint loaded successfully")
+
+ def _prepare_models_for_training(self) -> None:
+ """Prepare models for training with Accelerate."""
+
+ # For FSDP + LoRA: Cast entire model to FP32.
+ # FSDP requires uniform dtype across all parameters in wrapped modules.
+ # In LoRA mode, PEFT creates LoRA params in FP32 while base model is BF16.
+ # We cast the base model to FP32 to match the LoRA params.
+ if self._accelerator.distributed_type == DistributedType.FSDP and self._config.model.training_mode == "lora":
+ logger.debug("FSDP: casting transformer to FP32 for uniform dtype")
+ self._transformer = self._transformer.to(dtype=torch.float32)
+
+ # Enable gradient checkpointing if requested
+ # For PeftModel, we need to access the underlying base model
+ transformer = (
+ self._transformer.get_base_model() if hasattr(self._transformer, "get_base_model") else self._transformer
+ )
+
+ transformer.set_gradient_checkpointing(self._config.optimization.enable_gradient_checkpointing)
+
+ # Keep frozen models on CPU for memory efficiency
+ self._vae_decoder = self._vae_decoder.to("cpu")
+ if self._vae_encoder is not None:
+ self._vae_encoder = self._vae_encoder.to("cpu")
+
+ # Embedding connectors are already on GPU from _load_text_encoder_and_cache_embeddings
+
+ # noinspection PyTypeChecker
+ self._transformer = self._accelerator.prepare(self._transformer)
+
+ # Log GPU memory usage after model preparation
+ vram_usage_gb = torch.cuda.memory_allocated() / 1024**3
+ logger.debug(f"GPU memory usage after models preparation: {vram_usage_gb:.2f} GB")
+
+ @staticmethod
+ def _find_checkpoint(checkpoint_path: str | Path) -> Path | None:
+ """Find the checkpoint file to load, handling both file and directory paths."""
+ checkpoint_path = Path(checkpoint_path)
+
+ if checkpoint_path.is_file():
+ if not checkpoint_path.suffix == ".safetensors":
+ raise ValueError(f"Checkpoint file must have a .safetensors extension: {checkpoint_path}")
+ return checkpoint_path
+
+ if checkpoint_path.is_dir():
+ # Look for checkpoint files in the directory
+ checkpoints = list(checkpoint_path.rglob("*step_*.safetensors"))
+
+ if not checkpoints:
+ return None
+
+ # Sort by step number and return the latest
+ def _get_step_num(p: Path) -> int:
+ try:
+ return int(p.stem.split("step_")[1])
+ except (IndexError, ValueError):
+ return -1
+
+ latest = max(checkpoints, key=_get_step_num)
+ return latest
+
+ else:
+ raise ValueError(f"Invalid checkpoint path: {checkpoint_path}. Must be a file or directory.")
+
+ def _init_dataloader(self) -> None:
+ """Initialize the training data loader using the strategy's data sources."""
+ if self._dataset is None:
+ # Get data sources from the training strategy
+ data_sources = self._training_strategy.get_data_sources()
+
+ self._dataset = PrecomputedDataset(self._config.data.preprocessed_data_root, data_sources=data_sources)
+ logger.debug(f"Loaded dataset with {len(self._dataset):,} samples from sources: {list(data_sources)}")
+
+ num_workers = self._config.data.num_dataloader_workers
+ dataloader = DataLoader(
+ self._dataset,
+ batch_size=self._config.optimization.batch_size,
+ shuffle=True,
+ drop_last=True,
+ num_workers=num_workers,
+ pin_memory=num_workers > 0,
+ persistent_workers=num_workers > 0,
+ )
+
+ self._dataloader = self._accelerator.prepare(dataloader)
+
+ def _init_lora_weights(self) -> None:
+ """Initialize LoRA weights for the transformer."""
+ logger.debug("Initializing LoRA weights...")
+ for _, module in self._transformer.named_modules():
+ if isinstance(module, (BaseTunerLayer, ModulesToSaveWrapper)):
+ module.reset_lora_parameters(adapter_name="default", init_lora_weights=True)
+
+ def _init_optimizer(self) -> None:
+ """Initialize the optimizer and learning rate scheduler."""
+ opt_cfg = self._config.optimization
+
+ lr = opt_cfg.learning_rate
+ if opt_cfg.optimizer_type == "adamw":
+ optimizer = AdamW(self._trainable_params, lr=lr)
+ elif opt_cfg.optimizer_type == "adamw8bit":
+ # noinspection PyUnresolvedReferences
+ from bitsandbytes.optim import AdamW8bit # noqa: PLC0415
+
+ optimizer = AdamW8bit(self._trainable_params, lr=lr)
+ else:
+ raise ValueError(f"Unknown optimizer type: {opt_cfg.optimizer_type}")
+
+ # Add scheduler initialization
+ lr_scheduler = self._create_scheduler(optimizer)
+
+ # noinspection PyTypeChecker
+ self._optimizer, self._lr_scheduler = self._accelerator.prepare(optimizer, lr_scheduler)
+
+ def _create_scheduler(self, optimizer: torch.optim.Optimizer) -> LRScheduler | None:
+ """Create learning rate scheduler based on config."""
+ scheduler_type = self._config.optimization.scheduler_type
+ steps = self._config.optimization.steps
+ params = self._config.optimization.scheduler_params or {}
+
+ if scheduler_type is None:
+ return None
+
+ if scheduler_type == "linear":
+ scheduler = LinearLR(
+ optimizer,
+ start_factor=params.pop("start_factor", 1.0),
+ end_factor=params.pop("end_factor", 0.1),
+ total_iters=steps,
+ **params,
+ )
+ elif scheduler_type == "cosine":
+ scheduler = CosineAnnealingLR(
+ optimizer,
+ T_max=steps,
+ eta_min=params.pop("eta_min", 0),
+ **params,
+ )
+ elif scheduler_type == "cosine_with_restarts":
+ scheduler = CosineAnnealingWarmRestarts(
+ optimizer,
+ T_0=params.pop("T_0", steps // 4), # First restart cycle length
+ T_mult=params.pop("T_mult", 1), # Multiplicative factor for cycle lengths
+ eta_min=params.pop("eta_min", 5e-5),
+ **params,
+ )
+ elif scheduler_type == "polynomial":
+ scheduler = PolynomialLR(
+ optimizer,
+ total_iters=steps,
+ power=params.pop("power", 1.0),
+ **params,
+ )
+ elif scheduler_type == "step":
+ scheduler = StepLR(
+ optimizer,
+ step_size=params.pop("step_size", steps // 2),
+ gamma=params.pop("gamma", 0.1),
+ **params,
+ )
+ elif scheduler_type == "constant":
+ scheduler = None
+ else:
+ raise ValueError(f"Unknown scheduler type: {scheduler_type}")
+
+ return scheduler
+
+ def _setup_accelerator(self) -> None:
+ """Initialize the Accelerator with the appropriate settings."""
+
+ # All distributed setup (DDP/FSDP, number of processes, etc.) is controlled by
+ # the user's Accelerate configuration (accelerate config / accelerate launch).
+ self._accelerator = Accelerator(
+ mixed_precision=self._config.acceleration.mixed_precision_mode,
+ gradient_accumulation_steps=self._config.optimization.gradient_accumulation_steps,
+ )
+
+ if self._accelerator.num_processes > 1:
+ logger.info(
+ f"{self._accelerator.distributed_type.value} distributed training enabled "
+ f"with {self._accelerator.num_processes} processes"
+ )
+
+ local_batch = self._config.optimization.batch_size
+ global_batch = self._config.optimization.batch_size * self._accelerator.num_processes
+ logger.info(f"Local batch size: {local_batch}, global batch size: {global_batch}")
+
+ # Log torch.compile status from Accelerate's dynamo plugin
+ is_compile_enabled = (
+ hasattr(self._accelerator.state, "dynamo_plugin") and self._accelerator.state.dynamo_plugin.backend != "NO"
+ )
+ if is_compile_enabled:
+ plugin = self._accelerator.state.dynamo_plugin
+ logger.info(f"🔥 torch.compile enabled via Accelerate: backend={plugin.backend}, mode={plugin.mode}")
+
+ if self._accelerator.distributed_type == DistributedType.FSDP:
+ logger.warning(
+ "⚠️ FSDP + torch.compile is experimental and may hang on the first training iteration. "
+ "If this occurs, disable torch.compile by removing dynamo_config from your Accelerate config."
+ )
+
+ if self._accelerator.distributed_type == DistributedType.FSDP and self._config.acceleration.quantization:
+ logger.warning(
+ f"FSDP with quantization ({self._config.acceleration.quantization}) may have compatibility issues."
+ "Monitor training stability and consider disabling quantization if issues arise."
+ )
+
+ # Note: Use @torch.no_grad() instead of @torch.inference_mode() to avoid FSDP inplace update errors after validation
+ @torch.no_grad()
+ def _sample_videos(self, progress: TrainingProgress) -> list[Path] | None:
+ """Run validation by generating videos from validation prompts."""
+ use_images = self._config.validation.images is not None
+ use_reference_videos = self._config.validation.reference_videos is not None
+ generate_audio = self._config.validation.generate_audio
+ inference_steps = self._config.validation.inference_steps
+
+ # Free up GPU memory before validation sampling.
+ # Zero gradients and empty the cache to reclaim memory.
+ self._optimizer.zero_grad(set_to_none=True)
+ torch.cuda.empty_cache()
+
+ # Start sampling progress tracking
+ sampling_ctx = progress.start_sampling(
+ num_prompts=len(self._config.validation.prompts),
+ num_steps=inference_steps,
+ )
+
+ # Create validation sampler with loaded models and progress tracking
+ sampler = ValidationSampler(
+ transformer=self._transformer,
+ vae_decoder=self._vae_decoder,
+ vae_encoder=self._vae_encoder,
+ text_encoder=None,
+ audio_decoder=self._audio_vae if generate_audio else None,
+ vocoder=self._vocoder if generate_audio else None,
+ sampling_context=sampling_ctx,
+ )
+
+ output_dir = Path(self._config.output_dir) / "samples"
+ output_dir.mkdir(exist_ok=True, parents=True)
+
+ video_paths = []
+ width, height, num_frames = self._config.validation.video_dims
+
+ for prompt_idx, prompt in enumerate(self._config.validation.prompts):
+ # Update progress to show current video
+ sampling_ctx.start_video(prompt_idx)
+
+ # Load conditioning image if provided
+ condition_image = None
+ if use_images:
+ image_path = self._config.validation.images[prompt_idx]
+ image = open_image_as_srgb(image_path)
+ # Convert PIL image to tensor [C, H, W] in [0, 1]
+ condition_image = F.to_tensor(image)
+
+ # Load reference video if provided (for IC-LoRA)
+ reference_video = None
+ if use_reference_videos:
+ ref_video_path = self._config.validation.reference_videos[prompt_idx]
+ # read_video returns [F, C, H, W] in [0, 1]
+ reference_video, _ = read_video(ref_video_path, max_frames=num_frames)
+
+ # Get cached embeddings for this prompt if available
+ cached_embeddings = (
+ self._cached_validation_embeddings[prompt_idx]
+ if self._cached_validation_embeddings is not None
+ else None
+ )
+
+ # Create generation config
+ gen_config = GenerationConfig(
+ prompt=prompt,
+ negative_prompt=self._config.validation.negative_prompt,
+ height=height,
+ width=width,
+ num_frames=num_frames,
+ frame_rate=self._config.validation.frame_rate,
+ num_inference_steps=inference_steps,
+ guidance_scale=self._config.validation.guidance_scale,
+ seed=self._config.validation.seed,
+ condition_image=condition_image,
+ reference_video=reference_video,
+ generate_audio=generate_audio,
+ include_reference_in_output=self._config.validation.include_reference_in_output,
+ cached_embeddings=cached_embeddings,
+ stg_scale=self._config.validation.stg_scale,
+ stg_blocks=self._config.validation.stg_blocks,
+ stg_mode=self._config.validation.stg_mode,
+ )
+
+ # Generate sample
+ video, audio = sampler.generate(
+ config=gen_config,
+ device=self._accelerator.device,
+ )
+
+ # Save output (image for single frame, video otherwise)
+ if IS_MAIN_PROCESS:
+ ext = "png" if num_frames == 1 else "mp4"
+ output_path = output_dir / f"step_{self._global_step:06d}_{prompt_idx + 1}.{ext}"
+ if num_frames == 1:
+ save_image(video, output_path)
+ else:
+ save_video(
+ video_tensor=video,
+ output_path=output_path,
+ fps=self._config.validation.frame_rate,
+ audio=audio,
+ audio_sample_rate=self._vocoder.output_sample_rate if audio is not None else None,
+ )
+ video_paths.append(output_path)
+
+ # Clean up progress tasks
+ sampling_ctx.cleanup()
+
+ # Clear GPU cache after validation
+ torch.cuda.empty_cache()
+
+ rel_outputs_path = output_dir.relative_to(self._config.output_dir)
+ logger.info(f"🎥 Validation samples for step {self._global_step} saved in {rel_outputs_path}")
+ return video_paths
+
+ @staticmethod
+ def _log_training_stats(stats: TrainingStats) -> None:
+ """Log training statistics."""
+ stats_str = (
+ "📊 Training Statistics:\n"
+ f" - Total time: {stats.total_time_seconds / 60:.1f} minutes\n"
+ f" - Training speed: {stats.steps_per_second:.2f} steps/second\n"
+ f" - Samples/second: {stats.samples_per_second:.2f}\n"
+ f" - Peak GPU memory: {stats.peak_gpu_memory_gb:.2f} GB"
+ )
+ if stats.num_processes > 1:
+ stats_str += f"\n - Number of processes: {stats.num_processes}\n"
+ stats_str += f" - Global batch size: {stats.global_batch_size}"
+ logger.info(stats_str)
+
+ def _save_checkpoint(self) -> Path | None:
+ """Save the model weights."""
+ is_lora = self._config.model.training_mode == "lora"
+ is_fsdp = self._accelerator.distributed_type == DistributedType.FSDP
+
+ # Prepare paths
+ save_dir = Path(self._config.output_dir) / "checkpoints"
+ prefix = "lora" if is_lora else "model"
+ filename = f"{prefix}_weights_step_{self._global_step:05d}.safetensors"
+ saved_weights_path = save_dir / filename
+
+ # Get state dict (collective operation - all processes must participate)
+ self._accelerator.wait_for_everyone()
+ full_state_dict = self._accelerator.get_state_dict(self._transformer)
+
+ if not IS_MAIN_PROCESS:
+ return None
+
+ save_dir.mkdir(exist_ok=True, parents=True)
+
+ # For LoRA: extract only adapter weights; for full: use as-is
+ if is_lora:
+ unwrapped = self._accelerator.unwrap_model(self._transformer, keep_torch_compile=False)
+ # For FSDP, pass full_state_dict since model params aren't directly accessible
+ state_dict = get_peft_model_state_dict(unwrapped, state_dict=full_state_dict if is_fsdp else None)
+
+ # Remove "base_model.model." prefix added by PEFT
+ state_dict = {k.replace("base_model.model.", "", 1): v for k, v in state_dict.items()}
+
+ # Convert to ComfyUI-compatible format (add "diffusion_model." prefix)
+ state_dict = {f"diffusion_model.{k}": v for k, v in state_dict.items()}
+
+ # Save to disk
+ save_file(state_dict, saved_weights_path)
+ else:
+ # Save to disk
+ self._accelerator.save(full_state_dict, saved_weights_path)
+
+ rel_path = saved_weights_path.relative_to(self._config.output_dir)
+ logger.info(f"💾 {prefix.capitalize()} weights for step {self._global_step} saved in {rel_path}")
+
+ # Keep track of checkpoint paths, and cleanup old checkpoints if needed
+ self._checkpoint_paths.append(saved_weights_path)
+ self._cleanup_checkpoints()
+ return saved_weights_path
+
+ def _cleanup_checkpoints(self) -> None:
+ """Clean up old checkpoints."""
+ if 0 < self._config.checkpoints.keep_last_n < len(self._checkpoint_paths):
+ checkpoints_to_remove = self._checkpoint_paths[: -self._config.checkpoints.keep_last_n]
+ for old_checkpoint in checkpoints_to_remove:
+ if old_checkpoint.exists():
+ old_checkpoint.unlink()
+ logger.info(f"Removed old checkpoints: {old_checkpoint}")
+ # Update the list to only contain kept checkpoints
+ self._checkpoint_paths = self._checkpoint_paths[-self._config.checkpoints.keep_last_n :]
+
+ def _save_config(self) -> None:
+ """Save the training configuration as a YAML file in the output directory."""
+ if not IS_MAIN_PROCESS:
+ return
+
+ config_path = Path(self._config.output_dir) / "training_config.yaml"
+ with open(config_path, "w") as f:
+ yaml.dump(self._config.model_dump(), f, default_flow_style=False, indent=2)
+
+ logger.info(f"💾 Training configuration saved to: {config_path.relative_to(self._config.output_dir)}")
+
+ def _init_wandb(self) -> None:
+ """Initialize Weights & Biases run."""
+ if not self._config.wandb.enabled or not IS_MAIN_PROCESS:
+ self._wandb_run = None
+ return
+
+ wandb_config = self._config.wandb
+ run = wandb.init(
+ project=wandb_config.project,
+ entity=wandb_config.entity,
+ name=Path(self._config.output_dir).name,
+ tags=wandb_config.tags,
+ config=self._config.model_dump(),
+ )
+ self._wandb_run = run
+
+ def _log_metrics(self, metrics: dict[str, float]) -> None:
+ """Log metrics to Weights & Biases."""
+ if self._wandb_run is not None:
+ self._wandb_run.log(metrics)
+
+ def _log_validation_samples(self, sample_paths: list[Path], prompts: list[str]) -> None:
+ """Log validation samples (videos or images) to Weights & Biases."""
+ if not self._config.wandb.log_validation_videos or self._wandb_run is None:
+ return
+
+ # Determine if outputs are images or videos based on file extension
+ is_image = sample_paths and sample_paths[0].suffix.lower() in (".png", ".jpg", ".jpeg", ".heic", ".webp")
+ media_cls = wandb.Image if is_image else wandb.Video
+
+ samples = [media_cls(str(path), caption=prompt) for path, prompt in zip(sample_paths, prompts, strict=True)]
+ self._wandb_run.log({"validation_samples": samples}, step=self._global_step)
diff --git a/packages/ltx-trainer/src/ltx_trainer/training_strategies/__init__.py b/packages/ltx-trainer/src/ltx_trainer/training_strategies/__init__.py
new file mode 100644
index 0000000..d62408f
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/training_strategies/__init__.py
@@ -0,0 +1,58 @@
+"""Training strategies for different conditioning modes.
+This package implements the Strategy Pattern to handle different training modes:
+- Text-to-video training (standard generation, optionally with audio)
+- Video-to-video training (IC-LoRA mode with reference videos)
+Each strategy encapsulates the specific logic for preparing model inputs and computing loss.
+"""
+
+from ltx_trainer import logger
+from ltx_trainer.training_strategies.base_strategy import (
+ DEFAULT_FPS,
+ VIDEO_SCALE_FACTORS,
+ ModelInputs,
+ TrainingStrategy,
+ TrainingStrategyConfigBase,
+)
+from ltx_trainer.training_strategies.text_to_video import TextToVideoConfig, TextToVideoStrategy
+from ltx_trainer.training_strategies.video_to_video import VideoToVideoConfig, VideoToVideoStrategy
+
+# Type alias for all strategy config types
+TrainingStrategyConfig = TextToVideoConfig | VideoToVideoConfig
+
+__all__ = [
+ "DEFAULT_FPS",
+ "VIDEO_SCALE_FACTORS",
+ "ModelInputs",
+ "TextToVideoConfig",
+ "TextToVideoStrategy",
+ "TrainingStrategy",
+ "TrainingStrategyConfig",
+ "TrainingStrategyConfigBase",
+ "VideoToVideoConfig",
+ "VideoToVideoStrategy",
+ "get_training_strategy",
+]
+
+
+def get_training_strategy(config: TrainingStrategyConfig) -> TrainingStrategy:
+ """Factory function to create the appropriate training strategy.
+ The strategy is determined by the `name` field in the configuration.
+ Args:
+ config: Strategy-specific configuration with a `name` field
+ Returns:
+ The appropriate training strategy instance
+ Raises:
+ ValueError: If strategy name is not supported
+ """
+
+ match config:
+ case TextToVideoConfig():
+ strategy = TextToVideoStrategy(config)
+ case VideoToVideoConfig():
+ strategy = VideoToVideoStrategy(config)
+ case _:
+ raise ValueError(f"Unknown training strategy config type: {type(config).__name__}")
+
+ audio_mode = "(audio enabled 🔈)" if getattr(config, "with_audio", False) else "(audio disabled 🔇)"
+ logger.debug(f"🎯 Using {strategy.__class__.__name__} training strategy {audio_mode}")
+ return strategy
diff --git a/packages/ltx-trainer/src/ltx_trainer/training_strategies/base_strategy.py b/packages/ltx-trainer/src/ltx_trainer/training_strategies/base_strategy.py
new file mode 100644
index 0000000..6035b90
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/training_strategies/base_strategy.py
@@ -0,0 +1,253 @@
+"""Base class for training strategies.
+This module defines the abstract base class that all training strategies must implement,
+along with the base configuration class.
+"""
+
+import random
+from abc import ABC, abstractmethod
+from dataclasses import dataclass
+from typing import Any, Literal
+
+import torch
+from pydantic import BaseModel, ConfigDict, Field
+from torch import Tensor
+
+from ltx_core.components.patchifiers import (
+ AudioPatchifier,
+ VideoLatentPatchifier,
+ get_pixel_coords,
+)
+from ltx_core.model.transformer.modality import Modality
+from ltx_core.types import AudioLatentShape, SpatioTemporalScaleFactors, VideoLatentShape
+from ltx_trainer.timestep_samplers import TimestepSampler
+
+# Default frames per second for video missing in the FPS metadata
+DEFAULT_FPS = 24
+
+# VAE scale factors for LTX-2
+VIDEO_SCALE_FACTORS = SpatioTemporalScaleFactors.default()
+
+
+class TrainingStrategyConfigBase(BaseModel):
+ """Base configuration class for training strategies.
+ All strategy-specific configuration classes should inherit from this.
+ """
+
+ model_config = ConfigDict(extra="forbid")
+
+ name: Literal["text_to_video", "video_to_video"] = Field(
+ description="Unique name identifying the training strategy type"
+ )
+
+
+@dataclass
+class ModelInputs:
+ """Container for model inputs using the Modality-based interface."""
+
+ video: Modality
+ audio: Modality | None
+
+ # Training targets (for loss computation)
+ video_targets: Tensor
+ audio_targets: Tensor | None
+
+ # Masks for loss computation
+ video_loss_mask: Tensor # Boolean mask: True = compute loss for this token
+ audio_loss_mask: Tensor | None
+
+ # Metadata needed for loss computation in some strategies
+ ref_seq_len: int | None = None # For IC-LoRA: length of reference sequence
+
+
+class TrainingStrategy(ABC):
+ """Abstract base class for training strategies.
+ Each strategy encapsulates the logic for a specific training mode,
+ handling input preparation and loss computation.
+ """
+
+ def __init__(self, config: TrainingStrategyConfigBase):
+ """Initialize strategy with configuration.
+ Args:
+ config: Strategy-specific configuration
+ """
+ self.config = config
+ self._video_patchifier = VideoLatentPatchifier(patch_size=1)
+ self._audio_patchifier = AudioPatchifier(patch_size=1)
+
+ @property
+ def requires_audio(self) -> bool:
+ """Whether this training strategy requires audio components.
+ Override this property in subclasses that support audio training.
+ The trainer uses this to determine whether to load audio VAE and vocoder.
+ Returns:
+ True if audio components should be loaded, False otherwise.
+ """
+ return False
+
+ @abstractmethod
+ def get_data_sources(self) -> list[str] | dict[str, str]:
+ """Get the required data sources for this training strategy.
+ Returns:
+ Either a list of data directory names (where output keys match directory names)
+ or a dictionary mapping data directory names to custom output keys for the dataset
+ """
+
+ @abstractmethod
+ def prepare_training_inputs(
+ self,
+ batch: dict[str, Any],
+ timestep_sampler: TimestepSampler,
+ ) -> ModelInputs:
+ """Prepare training inputs from a raw data batch.
+ Args:
+ batch: Raw batch data from the dataset. Contains:
+ - "latents": Video latent data
+ - "conditions": Text embeddings with keys:
+ - "video_prompt_embeds": Already processed by embedding connectors
+ - "audio_prompt_embeds": Already processed by embedding connectors
+ - "prompt_attention_mask": Attention mask
+ - Additional keys depending on strategy (e.g., "ref_latents" for IC-LoRA)
+ timestep_sampler: Sampler for generating timesteps and noise
+ Returns:
+ ModelInputs containing Modality objects and training targets
+ """
+
+ @abstractmethod
+ def compute_loss(
+ self,
+ video_pred: Tensor,
+ audio_pred: Tensor | None,
+ inputs: ModelInputs,
+ ) -> Tensor:
+ """Compute the training loss.
+ Args:
+ video_pred: Video prediction from the transformer model
+ audio_pred: Audio prediction from the transformer model (None for video-only)
+ inputs: The prepared model inputs containing targets and masks
+ Returns:
+ Scalar loss tensor
+ """
+
+ def _get_video_positions(
+ self,
+ num_frames: int,
+ height: int,
+ width: int,
+ batch_size: int,
+ fps: float,
+ device: torch.device,
+ dtype: torch.dtype,
+ ) -> Tensor:
+ """Generate video position embeddings using ltx_core's native implementation.
+ Args:
+ num_frames: Number of latent frames
+ height: Latent height
+ width: Latent width
+ batch_size: Batch size
+ fps: Frames per second
+ device: Target device
+ dtype: Target dtype
+ Returns:
+ Position tensor of shape [B, 3, seq_len, 2]
+ """
+ latent_coords = self._video_patchifier.get_patch_grid_bounds(
+ output_shape=VideoLatentShape(
+ frames=num_frames,
+ height=height,
+ width=width,
+ batch=batch_size,
+ channels=128, # Video latent channels
+ ),
+ device=device,
+ )
+
+ # Convert latent coords to pixel coords with causal fix
+ pixel_coords = get_pixel_coords(
+ latent_coords=latent_coords,
+ scale_factors=VIDEO_SCALE_FACTORS,
+ causal_fix=True,
+ ).to(dtype)
+
+ # Scale temporal dimension by 1/fps to get time in seconds
+ pixel_coords[:, 0, ...] = pixel_coords[:, 0, ...] / fps
+
+ return pixel_coords
+
+ def _get_audio_positions(
+ self,
+ num_time_steps: int,
+ batch_size: int,
+ device: torch.device,
+ dtype: torch.dtype,
+ ) -> Tensor:
+ """Generate audio position embeddings using ltx_core's native implementation.
+ Args:
+ num_time_steps: Number of audio time steps (T, not T*mel_bins)
+ batch_size: Batch size
+ device: Target device
+ dtype: Target dtype
+ Returns:
+ Position tensor of shape [B, 1, num_time_steps, 2]
+ Note:
+ Audio latents should be in patchified format [B, T, C*F] = [B, T, 128]
+ where T is the number of time steps, C=8 channels, F=16 mel bins.
+ This matches the format produced by AudioPatchifier.patchify().
+ """
+ mel_bins = 16
+
+ latent_coords = self._audio_patchifier.get_patch_grid_bounds(
+ output_shape=AudioLatentShape(
+ frames=num_time_steps,
+ mel_bins=mel_bins,
+ batch=batch_size,
+ channels=8, # Audio latent channels
+ ),
+ device=device,
+ )
+
+ return latent_coords.to(dtype)
+
+ @staticmethod
+ def _create_per_token_timesteps(conditioning_mask: Tensor, sampled_sigma: Tensor) -> Tensor:
+ """Create per-token timesteps based on conditioning mask.
+ Args:
+ conditioning_mask: Boolean mask of shape (batch_size, sequence_length),
+ where True = conditioning token (timestep=0), False = target token (use sigma)
+ sampled_sigma: Sampled sigma values of shape (batch_size,) or (batch_size, 1, 1)
+ Returns:
+ Timesteps tensor of shape [batch_size, sequence_length]
+ """
+ # Expand to match conditioning mask shape [B, seq_len]
+ expanded_sigma = sampled_sigma.view(-1, 1).expand_as(conditioning_mask)
+
+ # Conditioning tokens get 0, target tokens get the sampled sigma
+ return torch.where(conditioning_mask, torch.zeros_like(expanded_sigma), expanded_sigma)
+
+ @staticmethod
+ def _create_first_frame_conditioning_mask(
+ batch_size: int,
+ sequence_length: int,
+ height: int,
+ width: int,
+ device: torch.device,
+ first_frame_conditioning_p: float = 0.0,
+ ) -> Tensor:
+ """Create conditioning mask for first frame conditioning.
+ Args:
+ batch_size: Batch size
+ sequence_length: Total sequence length
+ height: Latent height
+ width: Latent width
+ device: Target device
+ first_frame_conditioning_p: Probability of conditioning on the first frame
+ Returns:
+ Boolean mask where True indicates first frame tokens (if conditioning is enabled)
+ """
+ conditioning_mask = torch.zeros(batch_size, sequence_length, dtype=torch.bool, device=device)
+
+ if first_frame_conditioning_p > 0 and random.random() < first_frame_conditioning_p:
+ first_frame_end_idx = height * width
+ if first_frame_end_idx < sequence_length:
+ conditioning_mask[:, :first_frame_end_idx] = True
+
+ return conditioning_mask
diff --git a/packages/ltx-trainer/src/ltx_trainer/training_strategies/text_to_video.py b/packages/ltx-trainer/src/ltx_trainer/training_strategies/text_to_video.py
new file mode 100644
index 0000000..c8c7d7a
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/training_strategies/text_to_video.py
@@ -0,0 +1,289 @@
+"""Text-to-video training strategy.
+This strategy implements standard text-to-video generation training where:
+- Only target latents are used (no reference videos)
+- Standard noise application and loss computation
+- Supports first frame conditioning
+- Optionally supports joint audio-video training
+"""
+
+from typing import Any, Literal
+
+import torch
+from pydantic import Field
+from torch import Tensor
+
+from ltx_core.model.transformer.modality import Modality
+from ltx_trainer import logger
+from ltx_trainer.timestep_samplers import TimestepSampler
+from ltx_trainer.training_strategies.base_strategy import (
+ DEFAULT_FPS,
+ ModelInputs,
+ TrainingStrategy,
+ TrainingStrategyConfigBase,
+)
+
+
+class TextToVideoConfig(TrainingStrategyConfigBase):
+ """Configuration for text-to-video training strategy."""
+
+ name: Literal["text_to_video"] = "text_to_video"
+
+ first_frame_conditioning_p: float = Field(
+ default=0.1,
+ description="Probability of conditioning on the first frame during training",
+ ge=0.0,
+ le=1.0,
+ )
+
+ with_audio: bool = Field(
+ default=False,
+ description="Whether to include audio in training (joint audio-video generation)",
+ )
+
+ audio_latents_dir: str = Field(
+ default="audio_latents",
+ description="Directory name for audio latents when with_audio is True",
+ )
+
+
+class TextToVideoStrategy(TrainingStrategy):
+ """Text-to-video training strategy.
+ This strategy implements regular video generation training where:
+ - Only target latents are used (no reference videos)
+ - Standard noise application and loss computation
+ - Supports first frame conditioning
+ - Optionally supports joint audio-video training when with_audio=True
+ """
+
+ config: TextToVideoConfig
+
+ def __init__(self, config: TextToVideoConfig):
+ """Initialize strategy with configuration.
+ Args:
+ config: Text-to-video configuration
+ """
+ super().__init__(config)
+
+ @property
+ def requires_audio(self) -> bool:
+ """Whether this training strategy requires audio components."""
+ return self.config.with_audio
+
+ def get_data_sources(self) -> list[str] | dict[str, str]:
+ """
+ Text-to-video training requires latents and text conditions.
+ When with_audio is True, also requires audio latents.
+ """
+ sources = {
+ "latents": "latents",
+ "conditions": "conditions",
+ }
+
+ if self.config.with_audio:
+ sources[self.config.audio_latents_dir] = "audio_latents"
+
+ return sources
+
+ def prepare_training_inputs(
+ self,
+ batch: dict[str, Any],
+ timestep_sampler: TimestepSampler,
+ ) -> ModelInputs:
+ """Prepare inputs for text-to-video training."""
+ # Get pre-encoded latents - dataset provides uniform non-patchified format [B, C, F, H, W]
+ latents = batch["latents"]
+ video_latents = latents["latents"]
+
+ # Get video dimensions (assume same for all batch elements)
+ num_frames = latents["num_frames"][0].item()
+ height = latents["height"][0].item()
+ width = latents["width"][0].item()
+
+ # Patchify latents: [B, C, F, H, W] -> [B, seq_len, C]
+ video_latents = self._video_patchifier.patchify(video_latents)
+
+ # Handle FPS with backward compatibility
+ fps = latents.get("fps", None)
+ if fps is not None and not torch.all(fps == fps[0]):
+ logger.warning(
+ f"Different FPS values found in the batch. Found: {fps.tolist()}, using the first one: {fps[0].item()}"
+ )
+ fps = fps[0].item() if fps is not None else DEFAULT_FPS
+
+ # Get text embeddings (already processed by embedding connectors in trainer)
+ conditions = batch["conditions"]
+ video_prompt_embeds = conditions["video_prompt_embeds"]
+ audio_prompt_embeds = conditions["audio_prompt_embeds"]
+ prompt_attention_mask = conditions["prompt_attention_mask"]
+
+ batch_size = video_latents.shape[0]
+ video_seq_len = video_latents.shape[1]
+ device = video_latents.device
+ dtype = video_latents.dtype
+
+ # Create conditioning mask (first frame conditioning)
+ video_conditioning_mask = self._create_first_frame_conditioning_mask(
+ batch_size=batch_size,
+ sequence_length=video_seq_len,
+ height=height,
+ width=width,
+ device=device,
+ first_frame_conditioning_p=self.config.first_frame_conditioning_p,
+ )
+
+ # Sample noise and sigmas
+ sigmas = timestep_sampler.sample_for(video_latents)
+ video_noise = torch.randn_like(video_latents)
+
+ # Apply noise: noisy = (1 - sigma) * clean + sigma * noise
+ sigmas_expanded = sigmas.view(-1, 1, 1)
+ noisy_video = (1 - sigmas_expanded) * video_latents + sigmas_expanded * video_noise
+
+ # For conditioning tokens, use clean latents
+ conditioning_mask_expanded = video_conditioning_mask.unsqueeze(-1)
+ noisy_video = torch.where(conditioning_mask_expanded, video_latents, noisy_video)
+
+ # Compute video targets (velocity prediction)
+ video_targets = video_noise - video_latents
+
+ # Create per-token timesteps
+ video_timesteps = self._create_per_token_timesteps(video_conditioning_mask, sigmas.squeeze())
+
+ # Generate video positions using ltx_core's native implementation
+ video_positions = self._get_video_positions(
+ num_frames=num_frames,
+ height=height,
+ width=width,
+ batch_size=batch_size,
+ fps=fps,
+ device=device,
+ dtype=dtype,
+ )
+
+ # Create video Modality
+ video_modality = Modality(
+ enabled=True,
+ latent=noisy_video,
+ timesteps=video_timesteps,
+ positions=video_positions,
+ context=video_prompt_embeds,
+ context_mask=prompt_attention_mask,
+ )
+
+ # Video loss mask: True for tokens we want to compute loss on (non-conditioning tokens)
+ video_loss_mask = ~video_conditioning_mask
+
+ # Handle audio if enabled
+ audio_modality = None
+ audio_targets = None
+ audio_loss_mask = None
+
+ if self.config.with_audio:
+ audio_modality, audio_targets, audio_loss_mask = self._prepare_audio_inputs(
+ batch=batch,
+ sigmas=sigmas,
+ audio_prompt_embeds=audio_prompt_embeds,
+ prompt_attention_mask=prompt_attention_mask,
+ batch_size=batch_size,
+ device=device,
+ dtype=dtype,
+ )
+
+ return ModelInputs(
+ video=video_modality,
+ audio=audio_modality,
+ video_targets=video_targets,
+ audio_targets=audio_targets,
+ video_loss_mask=video_loss_mask,
+ audio_loss_mask=audio_loss_mask,
+ )
+
+ def _prepare_audio_inputs(
+ self,
+ batch: dict[str, Any],
+ sigmas: Tensor,
+ audio_prompt_embeds: Tensor,
+ prompt_attention_mask: Tensor,
+ batch_size: int,
+ device: torch.device,
+ dtype: torch.dtype,
+ ) -> tuple[Modality, Tensor, Tensor]:
+ """Prepare audio inputs for joint audio-video training.
+ Args:
+ batch: Raw batch data containing audio_latents
+ sigmas: Sampled sigma values (same as video)
+ audio_prompt_embeds: Audio context embeddings
+ prompt_attention_mask: Attention mask for context
+ batch_size: Batch size
+ device: Target device
+ dtype: Target dtype
+ Returns:
+ Tuple of (audio_modality, audio_targets, audio_loss_mask)
+ """
+ # Get audio latents - dataset provides uniform non-patchified format [B, C, T, F]
+ audio_data = batch["audio_latents"]
+ audio_latents = audio_data["latents"]
+
+ # Patchify audio latents: [B, C, T, F] -> [B, T, C*F]
+ audio_latents = self._audio_patchifier.patchify(audio_latents)
+
+ audio_seq_len = audio_latents.shape[1]
+
+ # Sample audio noise
+ audio_noise = torch.randn_like(audio_latents)
+
+ # Apply noise to audio (same sigma as video)
+ sigmas_expanded = sigmas.view(-1, 1, 1)
+ noisy_audio = (1 - sigmas_expanded) * audio_latents + sigmas_expanded * audio_noise
+
+ # Compute audio targets
+ audio_targets = audio_noise - audio_latents
+
+ # Audio timesteps: all tokens use the sampled sigma (no conditioning mask)
+ audio_timesteps = sigmas.view(-1, 1).expand(-1, audio_seq_len)
+
+ # Generate audio positions
+ audio_positions = self._get_audio_positions(
+ num_time_steps=audio_seq_len,
+ batch_size=batch_size,
+ device=device,
+ dtype=dtype,
+ )
+
+ # Create audio Modality
+ audio_modality = Modality(
+ enabled=True,
+ latent=noisy_audio,
+ timesteps=audio_timesteps,
+ positions=audio_positions,
+ context=audio_prompt_embeds,
+ context_mask=prompt_attention_mask,
+ )
+
+ # Audio loss mask: all tokens contribute to loss (no conditioning)
+ audio_loss_mask = torch.ones(batch_size, audio_seq_len, dtype=torch.bool, device=device)
+
+ return audio_modality, audio_targets, audio_loss_mask
+
+ def compute_loss(
+ self,
+ video_pred: Tensor,
+ audio_pred: Tensor | None,
+ inputs: ModelInputs,
+ ) -> Tensor:
+ """Compute masked MSE loss for video and optionally audio."""
+ # Video loss
+ video_loss = (video_pred - inputs.video_targets).pow(2)
+ video_loss_mask = inputs.video_loss_mask.unsqueeze(-1).float()
+ video_loss = video_loss.mul(video_loss_mask).div(video_loss_mask.mean())
+ video_loss = video_loss.mean()
+
+ # If no audio, return video loss only
+ if not self.config.with_audio or audio_pred is None or inputs.audio_targets is None:
+ return video_loss
+
+ # Audio loss (no conditioning mask)
+ audio_loss = (audio_pred - inputs.audio_targets).pow(2).mean()
+
+ # Combined loss
+ return video_loss + audio_loss
diff --git a/packages/ltx-trainer/src/ltx_trainer/training_strategies/video_to_video.py b/packages/ltx-trainer/src/ltx_trainer/training_strategies/video_to_video.py
new file mode 100644
index 0000000..bf51331
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/training_strategies/video_to_video.py
@@ -0,0 +1,223 @@
+"""Video-to-video training strategy for IC-LoRA.
+This strategy implements training with reference video conditioning where:
+- Reference latents (clean) are concatenated with target latents (noised)
+- Video coordinates handle both reference and target sequences
+- Loss is computed only on the target portion
+"""
+
+from typing import Any, Literal
+
+import torch
+from pydantic import Field
+from torch import Tensor
+
+from ltx_core.model.transformer.modality import Modality
+from ltx_trainer import logger
+from ltx_trainer.timestep_samplers import TimestepSampler
+from ltx_trainer.training_strategies.base_strategy import (
+ DEFAULT_FPS,
+ ModelInputs,
+ TrainingStrategy,
+ TrainingStrategyConfigBase,
+)
+
+
+class VideoToVideoConfig(TrainingStrategyConfigBase):
+ """Configuration for video-to-video (IC-LoRA) training strategy."""
+
+ name: Literal["video_to_video"] = "video_to_video"
+
+ first_frame_conditioning_p: float = Field(
+ default=0.1,
+ description="Probability of conditioning on the first frame during training",
+ ge=0.0,
+ le=1.0,
+ )
+
+ reference_latents_dir: str = Field(
+ default="reference_latents",
+ description="Directory name for latents of reference videos",
+ )
+
+
+class VideoToVideoStrategy(TrainingStrategy):
+ """Video-to-video training strategy for IC-LoRA.
+ This strategy implements training with reference video conditioning where:
+ - Reference latents (clean) are concatenated with target latents (noised)
+ - Video coordinates handle both reference and target sequences
+ - Loss is computed only on the target portion
+ """
+
+ config: VideoToVideoConfig
+
+ def __init__(self, config: VideoToVideoConfig):
+ """Initialize strategy with configuration.
+ Args:
+ config: Video-to-video configuration
+ """
+ super().__init__(config)
+
+ def get_data_sources(self) -> dict[str, str]:
+ """IC-LoRA training requires latents, conditions, and reference latents."""
+ return {
+ "latents": "latents",
+ "conditions": "conditions",
+ self.config.reference_latents_dir: "ref_latents",
+ }
+
+ def prepare_training_inputs(
+ self,
+ batch: dict[str, Any],
+ timestep_sampler: TimestepSampler,
+ ) -> ModelInputs:
+ """Prepare inputs for IC-LoRA training with reference videos."""
+ # Get pre-encoded latents - dataset provides uniform non-patchified format [B, C, F, H, W]
+ latents = batch["latents"]
+ target_latents = latents["latents"]
+ ref_latents = batch["ref_latents"]["latents"]
+
+ # Get dimensions
+ num_frames = latents["num_frames"][0].item()
+ height = latents["height"][0].item()
+ width = latents["width"][0].item()
+
+ ref_latents_info = batch["ref_latents"]
+ ref_frames = ref_latents_info["num_frames"][0].item()
+ ref_height = ref_latents_info["height"][0].item()
+ ref_width = ref_latents_info["width"][0].item()
+
+ # Patchify latents: [B, C, F, H, W] -> [B, seq_len, C]
+ target_latents = self._video_patchifier.patchify(target_latents)
+ ref_latents = self._video_patchifier.patchify(ref_latents)
+
+ # Handle FPS
+ fps = latents.get("fps", None)
+ if fps is not None and not torch.all(fps == fps[0]):
+ logger.warning(
+ f"Different FPS values found in the batch. Found: {fps.tolist()}, using the first one: {fps[0].item()}"
+ )
+ fps = fps[0].item() if fps is not None else DEFAULT_FPS
+
+ # Get text embeddings (already processed by embedding connectors in trainer)
+ # Video-to-video uses only video embeddings
+ conditions = batch["conditions"]
+ prompt_embeds = conditions["video_prompt_embeds"]
+ prompt_attention_mask = conditions["prompt_attention_mask"]
+
+ batch_size = target_latents.shape[0]
+ ref_seq_len = ref_latents.shape[1]
+ target_seq_len = target_latents.shape[1]
+ device = target_latents.device
+ dtype = target_latents.dtype
+
+ # Create conditioning mask
+ # Reference tokens are always conditioning (timestep=0)
+ ref_conditioning_mask = torch.ones(batch_size, ref_seq_len, dtype=torch.bool, device=device)
+
+ # Target tokens: check for first frame conditioning
+ target_conditioning_mask = self._create_first_frame_conditioning_mask(
+ batch_size=batch_size,
+ sequence_length=target_seq_len,
+ height=height,
+ width=width,
+ device=device,
+ first_frame_conditioning_p=self.config.first_frame_conditioning_p,
+ )
+
+ # Combined conditioning mask
+ conditioning_mask = torch.cat([ref_conditioning_mask, target_conditioning_mask], dim=1)
+
+ # Sample noise and sigmas for target
+ sigmas = timestep_sampler.sample_for(target_latents)
+ noise = torch.randn_like(target_latents)
+ sigmas_expanded = sigmas.view(-1, 1, 1)
+
+ # Apply noise to target
+ noisy_target = (1 - sigmas_expanded) * target_latents + sigmas_expanded * noise
+
+ # For first frame conditioning in target, use clean latents
+ target_conditioning_mask_expanded = target_conditioning_mask.unsqueeze(-1)
+ noisy_target = torch.where(target_conditioning_mask_expanded, target_latents, noisy_target)
+
+ # Targets for loss computation
+ targets = noise - target_latents
+
+ # Concatenate reference (clean) and target (noisy)
+ combined_latents = torch.cat([ref_latents, noisy_target], dim=1)
+
+ # Create per-token timesteps
+ timesteps = self._create_per_token_timesteps(conditioning_mask, sigmas.squeeze())
+
+ # Generate positions for reference and target separately, then concatenate
+ ref_positions = self._get_video_positions(
+ num_frames=ref_frames,
+ height=ref_height,
+ width=ref_width,
+ batch_size=batch_size,
+ fps=fps,
+ device=device,
+ dtype=dtype,
+ )
+
+ target_positions = self._get_video_positions(
+ num_frames=num_frames,
+ height=height,
+ width=width,
+ batch_size=batch_size,
+ fps=fps,
+ device=device,
+ dtype=dtype,
+ )
+
+ # Concatenate positions along sequence dimension
+ positions = torch.cat([ref_positions, target_positions], dim=2)
+
+ # Create video Modality
+ video_modality = Modality(
+ enabled=True,
+ latent=combined_latents,
+ timesteps=timesteps,
+ positions=positions,
+ context=prompt_embeds,
+ context_mask=prompt_attention_mask,
+ )
+
+ # Loss mask: only compute loss on non-conditioning target tokens
+ # Reference tokens: all False (no loss)
+ # Target tokens: True where not conditioning
+ ref_loss_mask = torch.zeros(batch_size, ref_seq_len, dtype=torch.bool, device=device)
+ target_loss_mask = ~target_conditioning_mask
+ video_loss_mask = torch.cat([ref_loss_mask, target_loss_mask], dim=1)
+
+ return ModelInputs(
+ video=video_modality,
+ audio=None,
+ video_targets=targets,
+ audio_targets=None,
+ video_loss_mask=video_loss_mask,
+ audio_loss_mask=None,
+ ref_seq_len=ref_seq_len,
+ )
+
+ def compute_loss(
+ self,
+ video_pred: Tensor,
+ _audio_pred: Tensor | None,
+ inputs: ModelInputs,
+ ) -> Tensor:
+ """Compute masked loss only on target portion."""
+ # Extract target portion of prediction
+ ref_seq_len = inputs.ref_seq_len
+ target_pred = video_pred[:, ref_seq_len:, :]
+
+ # Get target portion of loss mask
+ target_loss_mask = inputs.video_loss_mask[:, ref_seq_len:]
+
+ # Compute loss
+ loss = (target_pred - inputs.video_targets).pow(2)
+
+ # Apply loss mask
+ loss_mask = target_loss_mask.unsqueeze(-1).float()
+ loss = loss.mul(loss_mask).div(loss_mask.mean())
+
+ return loss.mean()
diff --git a/packages/ltx-trainer/src/ltx_trainer/utils.py b/packages/ltx-trainer/src/ltx_trainer/utils.py
new file mode 100644
index 0000000..4530e9b
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/utils.py
@@ -0,0 +1,118 @@
+import io
+import subprocess
+from pathlib import Path
+
+import numpy as np
+import torch
+from PIL import ExifTags, Image, ImageCms, ImageOps
+from PIL.Image import Image as PilImage
+
+from ltx_trainer import logger
+
+
+def get_gpu_memory_gb(device: torch.device) -> float:
+ """
+ Get current GPU memory usage in GB using nvidia-smi
+ Args:
+ device: torch.device to get memory usage for
+ Returns:
+ Current GPU memory usage in GB
+ """
+ try:
+ device_id = device.index if device.index is not None else 0
+ result = subprocess.check_output(
+ [
+ "nvidia-smi",
+ "--query-gpu=memory.used",
+ "--format=csv,nounits,noheader",
+ "-i",
+ str(device_id),
+ ],
+ encoding="utf-8",
+ )
+ return float(result.strip()) / 1024 # Convert MB to GB
+ except (subprocess.CalledProcessError, FileNotFoundError, ValueError) as e:
+ logger.error(f"Failed to get GPU memory from nvidia-smi: {e}")
+ # Fallback to torch
+ return torch.cuda.memory_allocated(device) / 1024**3
+
+
+def open_image_as_srgb(image_path: str | Path | io.BytesIO) -> PilImage:
+ """
+ Opens an image file, applies rotation (if it's set in metadata) and converts it
+ to the sRGB color space respecting the original image color space .
+ Args:
+ image_path: Path to the image file
+ Returns:
+ PIL Image in sRGB color space
+ """
+ exif_colorspace_srgb = 1
+
+ with Image.open(image_path) as img_raw:
+ img = ImageOps.exif_transpose(img_raw)
+
+ input_icc_profile = img.info.get("icc_profile")
+
+ # Try to convert to sRGB if the image has ICC profile metadata
+ srgb_profile = ImageCms.createProfile(colorSpace="sRGB")
+ if input_icc_profile is not None:
+ input_profile = ImageCms.ImageCmsProfile(io.BytesIO(input_icc_profile))
+ srgb_img = ImageCms.profileToProfile(img, input_profile, srgb_profile, outputMode="RGB")
+ else:
+ # Try fall back to checking EXIF
+ exif_data = img.getexif()
+ if exif_data is not None:
+ # Assume sRGB if no ICC profile and EXIF has no ColorSpace tag
+ color_space_value = exif_data.get(ExifTags.Base.ColorSpace.value)
+ if color_space_value is not None and color_space_value != exif_colorspace_srgb:
+ raise ValueError(
+ "Image has colorspace tag in EXIF but it isn't set to sRGB,"
+ " conversion is not supported."
+ f" EXIF ColorSpace tag value is {color_space_value}",
+ )
+
+ srgb_img = img.convert("RGB")
+
+ # Set sRGB profile in metadata since now the image is assumed to be in sRGB.
+ srgb_profile_data = ImageCms.ImageCmsProfile(srgb_profile).tobytes()
+ srgb_img.info["icc_profile"] = srgb_profile_data
+
+ return srgb_img
+
+
+def save_image(image_tensor: torch.Tensor, output_path: Path | str) -> None:
+ """Save an image tensor to a file.
+ Args:
+ image_tensor: Image tensor of shape [C, H, W] or [C, 1, H, W] in range [0, 1] or [0, 255].
+ C must be 3 (RGB).
+ output_path: Path to save the image (any PIL-supported format, e.g., .png or .jpg)
+ """
+ output_path = Path(output_path)
+ output_path.parent.mkdir(parents=True, exist_ok=True)
+
+ # Handle [C, 1, H, W] format (single frame from video tensor)
+ if image_tensor.ndim == 4:
+ # Squeeze frame dimension: [C, 1, H, W] -> [C, H, W]
+ if image_tensor.shape[1] == 1:
+ image_tensor = image_tensor.squeeze(1)
+ else:
+ raise ValueError(f"Expected single-frame tensor with shape [C, 1, H, W], got shape {image_tensor.shape}")
+
+ if image_tensor.ndim != 3:
+ raise ValueError(f"Expected 3D tensor [C, H, W], got {image_tensor.ndim}D tensor")
+
+ if image_tensor.shape[0] != 3:
+ raise ValueError(f"Expected 3 channels (RGB), got {image_tensor.shape[0]} channels")
+
+ # Normalize to [0, 255] uint8
+ if torch.is_floating_point(image_tensor) and image_tensor.max() <= 1.0:
+ image_tensor = image_tensor * 255
+
+ # Clamp to valid uint8 range to prevent overflow
+ image_tensor = image_tensor.clamp(0, 255)
+
+ # [C, H, W] -> [H, W, C]
+ image_np: np.ndarray = image_tensor.permute(1, 2, 0).to(torch.uint8).cpu().numpy()
+
+ # Save using PIL
+ Image.fromarray(image_np).save(output_path)
diff --git a/packages/ltx-trainer/src/ltx_trainer/validation_sampler.py b/packages/ltx-trainer/src/ltx_trainer/validation_sampler.py
new file mode 100644
index 0000000..93f3199
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/validation_sampler.py
@@ -0,0 +1,817 @@
+"""Validation sampling for LTX-2 training using ltx-core components.
+This module provides a simplified validation pipeline for generating samples during training,
+using the new ltx-core components (VideoLatentTools, AudioLatentTools, LatentState, etc.).
+"""
+
+from dataclasses import dataclass, replace
+from typing import TYPE_CHECKING, Literal
+
+import torch
+from einops import rearrange
+from torch import Tensor
+
+from ltx_core.components.diffusion_steps import EulerDiffusionStep
+from ltx_core.components.guiders import CFGGuider, STGGuider
+from ltx_core.components.noisers import GaussianNoiser
+from ltx_core.components.patchifiers import (
+ AudioPatchifier,
+ VideoLatentPatchifier,
+ get_pixel_coords,
+)
+from ltx_core.components.schedulers import LTX2Scheduler
+from ltx_core.guidance.perturbations import (
+ BatchedPerturbationConfig,
+ Perturbation,
+ PerturbationConfig,
+ PerturbationType,
+)
+from ltx_core.model.transformer.modality import Modality
+from ltx_core.model.transformer.model import X0Model
+from ltx_core.model.video_vae import SpatialTilingConfig, TemporalTilingConfig, TilingConfig
+from ltx_core.tools import AudioLatentTools, VideoLatentTools
+from ltx_core.types import AudioLatentShape, LatentState, SpatioTemporalScaleFactors, VideoLatentShape, VideoPixelShape
+from ltx_trainer.progress import SamplingContext
+
+if TYPE_CHECKING:
+ from ltx_core.model.audio_vae import AudioDecoder, Vocoder
+ from ltx_core.model.transformer import LTXModel
+ from ltx_core.model.video_vae import VideoDecoder, VideoEncoder
+ from ltx_core.text_encoders.gemma import AVGemmaTextEncoderModel
+
+VIDEO_SCALE_FACTORS = SpatioTemporalScaleFactors.default()
+
+
+@dataclass
+class CachedPromptEmbeddings:
+ """Pre-computed text embeddings for a validation prompt.
+ These embeddings are computed once at training start and reused for all validation runs,
+ avoiding the need to load the full Gemma text encoder during validation.
+ """
+
+ video_context_positive: Tensor # [1, seq_len, hidden_dim]
+ audio_context_positive: Tensor # [1, seq_len, hidden_dim]
+ video_context_negative: Tensor | None = None
+ audio_context_negative: Tensor | None = None
+
+
+@dataclass
+class TiledDecodingConfig:
+ """Configuration for tiled video decoding to reduce VRAM usage.
+ Tiled decoding splits the latent tensor into overlapping tiles, decodes each
+ tile individually, and blends them together. This significantly reduces peak
+ VRAM usage at the cost of slightly slower decoding.
+ Defaults match the recommended values from ltx-core tests.
+ """
+
+ enabled: bool = True # Whether to use tiled decoding (enabled by default)
+ tile_size_pixels: int = 192 # Spatial tile size in pixels (must be ≥64 and divisible by 32)
+ tile_overlap_pixels: int = 64 # Spatial tile overlap in pixels (must be divisible by 32)
+ tile_size_frames: int = 48 # Temporal tile size in frames (must be ≥16 and divisible by 8)
+ tile_overlap_frames: int = 24 # Temporal tile overlap in frames (must be divisible by 8)
+
+
+@dataclass
+class GenerationConfig:
+ """Configuration for video/audio generation."""
+
+ prompt: str # Text prompt for generation
+ negative_prompt: str = "" # Negative prompt to avoid unwanted artifacts
+ height: int = 544 # Output video height in pixels
+ width: int = 960 # Output video width in pixels
+ num_frames: int = 97 # Number of frames to generate
+ frame_rate: float = 25.0 # Frame rate for temporal position scaling
+ num_inference_steps: int = 30 # Number of denoising steps
+ guidance_scale: float = 4.0 # CFG guidance scale
+ seed: int = 42 # Random seed for reproducibility
+ condition_image: Tensor | None = None # Optional first frame image for image-to-video
+ reference_video: Tensor | None = None # For IC-LoRA: [F, C, H, W] in [0, 1]
+ generate_audio: bool = True # Whether to generate audio alongside video
+ include_reference_in_output: bool = False # For IC-LoRA: concatenate original reference with generated output
+ cached_embeddings: CachedPromptEmbeddings | None = None # Pre-computed text embeddings (avoids loading Gemma)
+ stg_scale: float = 0.0 # STG strength (0.0 = disabled, recommended: 1.0)
+ stg_blocks: list[int] | None = None # Transformer blocks to perturb (None = all, recommended: [29])
+ stg_mode: Literal["stg_av", "stg_v"] = "stg_av" # STG mode: "stg_av" (audio+video) or "stg_v" (video only)
+ # Tiled decoding config: None = use defaults (enabled), False = disable, or TiledDecodingConfig for custom settings
+ tiled_decoding: TiledDecodingConfig | Literal[False] | None = None
+
+ def __post_init__(self) -> None:
+ """Apply default tiled decoding config if not provided."""
+ if self.tiled_decoding is None:
+ # Use default config with tiling enabled
+ object.__setattr__(self, "tiled_decoding", TiledDecodingConfig())
+ elif self.tiled_decoding is False:
+ # Explicitly disabled - use config with enabled=False
+ object.__setattr__(self, "tiled_decoding", TiledDecodingConfig(enabled=False))
+
+
+class ValidationSampler:
+ """Generates validation samples during training using ltx-core components.
+ This class provides a simplified interface for generating video (and optionally audio)
+ samples during training validation. It supports:
+ - Text-to-video generation
+ - Image-to-video generation (first frame conditioning)
+ - Video-to-video generation (IC-LoRA reference video conditioning)
+ - Optional audio generation
+ The implementation follows the patterns from ltx_pipelines.single_stage.
+ Text embeddings can be provided either via:
+ - A full text_encoder (encodes prompts on-the-fly)
+ - Pre-computed cached_embeddings (avoids loading Gemma during validation)
+ """
+
+ def __init__(
+ self,
+ transformer: "LTXModel",
+ vae_decoder: "VideoDecoder",
+ vae_encoder: "VideoEncoder | None",
+ text_encoder: "AVGemmaTextEncoderModel | None" = None,
+ audio_decoder: "AudioDecoder | None" = None,
+ vocoder: "Vocoder | None" = None,
+ sampling_context: SamplingContext | None = None,
+ ):
+ """Initialize the validation sampler.
+ Args:
+ transformer: LTX-2 transformer model
+ vae_decoder: Video VAE decoder
+ vae_encoder: Video VAE encoder (for image/video conditioning), can be None if not needed
+ text_encoder: Gemma text encoder with embeddings connector (optional if cached_embeddings in config)
+ audio_decoder: Optional audio VAE decoder (for audio generation)
+ vocoder: Optional vocoder (for audio generation)
+ sampling_context: Optional SamplingContext for progress display during denoising
+ """
+ self._transformer = transformer
+ self._vae_decoder = vae_decoder
+ self._vae_encoder = vae_encoder
+ self._text_encoder = text_encoder
+ self._audio_decoder = audio_decoder
+ self._vocoder = vocoder
+ self._sampling_context = sampling_context
+
+ # Patchifiers
+ self._video_patchifier = VideoLatentPatchifier(patch_size=1)
+ self._audio_patchifier = AudioPatchifier(patch_size=1)
+
+ # Note: Use @torch.no_grad() instead of @torch.inference_mode() to avoid FSDP inplace update errors after validation
+ @torch.no_grad()
+ def generate(
+ self,
+ config: GenerationConfig,
+ device: torch.device | str = "cuda",
+ ) -> tuple[Tensor, Tensor | None]:
+ """Generate a video (and optionally audio) sample.
+ Args:
+ config: Generation configuration
+ device: Device to run generation on
+ Returns:
+ Tuple of:
+ - video: Video tensor [C, F, H, W] in [0, 1] (float32)
+ - audio: Audio waveform tensor [C, samples] or None
+ """
+ device = torch.device(device) if isinstance(device, str) else device
+ self._validate_config(config)
+
+ # Route to appropriate generation method
+ if config.reference_video is not None:
+ return self._generate_with_reference(config, device)
+ return self._generate_standard(config, device)
+
+ def _generate_standard(self, config: GenerationConfig, device: torch.device) -> tuple[Tensor, Tensor | None]:
+ """Standard generation (text-to-video or image-to-video)."""
+ # Get prompt embeddings (from cache or encode on-the-fly)
+ v_ctx_pos, a_ctx_pos, v_ctx_neg, a_ctx_neg = self._get_prompt_embeddings(config, device)
+
+ # Setup generator
+ generator = torch.Generator(device=device).manual_seed(config.seed)
+
+ # Create latent tools
+ video_tools = self._create_video_latent_tools(config)
+ audio_tools = self._create_audio_latent_tools(config) if config.generate_audio else None
+
+ # Create initial states
+ video_clean_state = video_tools.create_initial_state(device=device, dtype=torch.bfloat16)
+ audio_clean_state = (
+ audio_tools.create_initial_state(device=device, dtype=torch.bfloat16) if audio_tools else None
+ )
+
+ # Apply image conditioning if provided
+ if config.condition_image is not None:
+ video_clean_state = self._apply_image_conditioning(
+ video_clean_state, config.condition_image, config, device
+ )
+
+ # Add noise
+ noiser = GaussianNoiser(generator=generator)
+ video_state = noiser(latent_state=video_clean_state, noise_scale=1.0)
+ audio_state = noiser(latent_state=audio_clean_state, noise_scale=1.0) if audio_clean_state else None
+
+ # Run denoising loop
+ video_state, audio_state = self._run_denoising(
+ config=config,
+ video_state=video_state,
+ audio_state=audio_state,
+ video_clean_state=video_clean_state,
+ audio_clean_state=audio_clean_state,
+ v_ctx_pos=v_ctx_pos,
+ a_ctx_pos=a_ctx_pos,
+ v_ctx_neg=v_ctx_neg,
+ a_ctx_neg=a_ctx_neg,
+ device=device,
+ )
+
+ # Decode outputs
+ video_state = video_tools.clear_conditioning(video_state)
+ video_state = video_tools.unpatchify(video_state)
+ video_output = self._decode_video(video_state, device, config.tiled_decoding)
+
+ audio_output = None
+ if audio_state is not None and audio_tools is not None:
+ audio_state = audio_tools.clear_conditioning(audio_state)
+ audio_state = audio_tools.unpatchify(audio_state)
+ audio_output = self._decode_audio(audio_state, device)
+
+ return video_output, audio_output
+
+ def _generate_with_reference(self, config: GenerationConfig, device: torch.device) -> tuple[Tensor, Tensor | None]:
+ """Generate with reference video conditioning (IC-LoRA style).
+ For IC-LoRA:
+ - Reference video latents are concatenated with target latents
+ - Reference latents have timestep=0 (clean, not denoised)
+ - Target latents are denoised normally
+ - If condition_image is also provided, the first frame of the target is conditioned
+ - If include_reference_in_output is True, the preprocessed reference video
+ is concatenated side-by-side with the generated video
+ """
+ # Get prompt embeddings (from cache or encode on-the-fly)
+ v_ctx_pos, a_ctx_pos, v_ctx_neg, a_ctx_neg = self._get_prompt_embeddings(config, device)
+
+ # Setup generator
+ generator = torch.Generator(device=device).manual_seed(config.seed)
+
+ # Preprocess and encode reference video
+ ref_video_preprocessed = self._preprocess_reference_video(config)
+ ref_latent, ref_positions = self._encode_video(ref_video_preprocessed, config.frame_rate, device)
+ ref_seq_len = ref_latent.shape[1]
+
+ # Create target video state
+ video_tools = self._create_video_latent_tools(config)
+ target_clean_state = video_tools.create_initial_state(device=device, dtype=torch.bfloat16)
+
+ # Apply first-frame image conditioning to target if provided
+ if config.condition_image is not None:
+ target_clean_state = self._apply_image_conditioning(
+ target_clean_state, config.condition_image, config, device
+ )
+
+ # Create combined state (reference + target)
+ # denoise_mask shape is [B, seq_len, 1] after patchification
+ ref_denoise_mask = torch.zeros(1, ref_seq_len, 1, device=device, dtype=torch.float32)
+ combined_clean_state = LatentState(
+ latent=torch.cat([ref_latent, target_clean_state.latent], dim=1),
+ denoise_mask=torch.cat([ref_denoise_mask, target_clean_state.denoise_mask], dim=1),
+ positions=torch.cat([ref_positions, target_clean_state.positions], dim=2),
+ clean_latent=torch.cat([ref_latent, target_clean_state.clean_latent], dim=1),
+ )
+
+ # Add noise (only to the target portion via denoise_mask)
+ noiser = GaussianNoiser(generator=generator)
+ combined_state = noiser(latent_state=combined_clean_state, noise_scale=1.0)
+
+ # Create audio state if needed
+ audio_tools = self._create_audio_latent_tools(config) if config.generate_audio else None
+ audio_clean_state = (
+ audio_tools.create_initial_state(device=device, dtype=torch.bfloat16) if audio_tools else None
+ )
+ audio_state = noiser(latent_state=audio_clean_state, noise_scale=1.0) if audio_clean_state else None
+
+ # Run denoising loop
+ combined_state, audio_state = self._run_denoising(
+ config=config,
+ video_state=combined_state,
+ audio_state=audio_state,
+ video_clean_state=combined_clean_state,
+ audio_clean_state=audio_clean_state,
+ v_ctx_pos=v_ctx_pos,
+ a_ctx_pos=a_ctx_pos,
+ v_ctx_neg=v_ctx_neg,
+ a_ctx_neg=a_ctx_neg,
+ device=device,
+ )
+
+ # Extract target portion and decode
+ target_latent = combined_state.latent[:, ref_seq_len:]
+ video_output = self._decode_video_latent(target_latent, config, device)
+
+ # Optionally concatenate original reference video side-by-side
+ if config.include_reference_in_output:
+ # Use preprocessed reference (already resized/cropped, in pixel space)
+ # Convert from [B, C, F, H, W] to [C, F, H, W]
+ ref_video_pixels = ref_video_preprocessed[0].cpu()
+ # Normalize from [-1, 1] to [0, 1]
+ ref_video_pixels = ((ref_video_pixels + 1.0) / 2.0).clamp(0.0, 1.0)
+ video_output = self._concatenate_videos_side_by_side(ref_video_pixels, video_output)
+
+ # Decode audio
+ audio_output = None
+ if audio_state is not None and audio_tools is not None:
+ audio_state = audio_tools.clear_conditioning(audio_state)
+ audio_state = audio_tools.unpatchify(audio_state)
+ audio_output = self._decode_audio(audio_state, device)
+
+ return video_output, audio_output
+
+ def _create_video_latent_tools(self, config: GenerationConfig) -> VideoLatentTools:
+ """Create video latent tools for the given configuration."""
+ pixel_shape = VideoPixelShape(
+ batch=1,
+ frames=config.num_frames,
+ height=config.height,
+ width=config.width,
+ fps=config.frame_rate,
+ )
+ return VideoLatentTools(
+ patchifier=self._video_patchifier,
+ target_shape=VideoLatentShape.from_pixel_shape(shape=pixel_shape),
+ fps=config.frame_rate,
+ scale_factors=VIDEO_SCALE_FACTORS,
+ causal_fix=True,
+ )
+
+ def _create_audio_latent_tools(self, config: GenerationConfig) -> AudioLatentTools:
+ """Create audio latent tools for the given configuration."""
+ return AudioLatentTools(
+ patchifier=self._audio_patchifier,
+ target_shape=AudioLatentShape.from_duration(batch=1, duration=config.num_frames / config.frame_rate),
+ )
+
+ def _apply_image_conditioning(
+ self, video_state: LatentState, image: Tensor, config: GenerationConfig, device: torch.device
+ ) -> LatentState:
+ """Apply first-frame image conditioning to the video state."""
+ # Encode the image
+ encoded_image = self._encode_conditioning_image(image, config.height, config.width, device)
+
+ # Patchify the encoded image (single frame)
+ patchified_image = self._video_patchifier.patchify(encoded_image) # [1, 1, C] -> [1, num_patches, C]
+ num_image_tokens = patchified_image.shape[1]
+
+ # Update the first frame tokens in the latent
+ new_latent = video_state.latent.clone()
+ new_latent[:, :num_image_tokens] = patchified_image.to(new_latent.dtype)
+
+ # Update clean_latent as well (conditioning image is clean)
+ new_clean_latent = video_state.clean_latent.clone()
+ new_clean_latent[:, :num_image_tokens] = patchified_image.to(new_clean_latent.dtype)
+
+ # Set denoise_mask to 0 for conditioned tokens (don't denoise them)
+ new_denoise_mask = video_state.denoise_mask.clone()
+ new_denoise_mask[:, :num_image_tokens] = 0.0
+
+ return LatentState(
+ latent=new_latent,
+ denoise_mask=new_denoise_mask,
+ positions=video_state.positions,
+ clean_latent=new_clean_latent,
+ )
+
+ @staticmethod
+ def _preprocess_reference_video(config: GenerationConfig) -> Tensor:
+ """Preprocess reference video: resize, crop, and convert to model input format.
+ Args:
+ config: Generation configuration with reference_video
+ Returns:
+ Preprocessed video tensor [B, C, F, H, W] in [-1, 1] range
+ """
+ ref_video = config.reference_video # [F, C, H, W] in [0, 1]
+ target_height, target_width = config.height, config.width
+ current_height, current_width = ref_video.shape[2:]
+
+ # Resize maintaining aspect ratio and center crop if needed
+ if current_height != target_height or current_width != target_width:
+ aspect_ratio = current_width / current_height
+ target_aspect_ratio = target_width / target_height
+
+ if aspect_ratio > target_aspect_ratio:
+ resize_height, resize_width = target_height, int(target_height * aspect_ratio)
+ else:
+ resize_height, resize_width = int(target_width / aspect_ratio), target_width
+
+ ref_video = torch.nn.functional.interpolate(
+ ref_video, size=(resize_height, resize_width), mode="bilinear", align_corners=False
+ )
+
+ # Center crop
+ h_start = (resize_height - target_height) // 2
+ w_start = (resize_width - target_width) // 2
+ ref_video = ref_video[:, :, h_start : h_start + target_height, w_start : w_start + target_width]
+
+ # Convert to [B, C, F, H, W] and trim to valid frame count (k*8 + 1)
+ ref_video = rearrange(ref_video, "f c h w -> 1 c f h w")
+ valid_frames = (ref_video.shape[2] - 1) // 8 * 8 + 1
+ ref_video = ref_video[:, :, :valid_frames]
+
+ # Convert to [-1, 1] range
+ return ref_video * 2.0 - 1.0
+
+ def _encode_video(self, video: Tensor, fps: float, device: torch.device) -> tuple[Tensor, Tensor]:
+ """Encode video to patchified latents and compute positions.
+ Args:
+ video: Video tensor [B, C, F, H, W] in [-1, 1] range
+ fps: Frame rate for temporal position scaling
+ device: Device to run encoding on
+ Returns:
+ Tuple of (patchified_latents, positions)
+ """
+ video = video.to(device=device, dtype=torch.float32)
+
+ # Encode with VAE
+ self._vae_encoder.to(device)
+ with torch.autocast(device_type=str(device).split(":")[0], dtype=torch.bfloat16):
+ latents = self._vae_encoder(video)
+ self._vae_encoder.to("cpu")
+
+ latents = latents.to(torch.bfloat16)
+ patchified = self._video_patchifier.patchify(latents)
+
+ # Compute positions
+ latent_shape = VideoLatentShape(
+ batch=1,
+ channels=latents.shape[1],
+ frames=latents.shape[2],
+ height=latents.shape[3],
+ width=latents.shape[4],
+ )
+ latent_coords = self._video_patchifier.get_patch_grid_bounds(output_shape=latent_shape, device=device)
+ positions = get_pixel_coords(latent_coords, scale_factors=VIDEO_SCALE_FACTORS, causal_fix=True)
+ positions = positions.to(torch.bfloat16)
+ positions[:, 0, ...] = positions[:, 0, ...] / fps
+
+ return patchified, positions
+
+ def _run_denoising(
+ self,
+ config: GenerationConfig,
+ video_state: LatentState,
+ audio_state: LatentState | None,
+ video_clean_state: LatentState,
+ audio_clean_state: LatentState | None,
+ v_ctx_pos: Tensor,
+ a_ctx_pos: Tensor,
+ v_ctx_neg: Tensor | None,
+ a_ctx_neg: Tensor | None,
+ device: torch.device,
+ ) -> tuple[LatentState, LatentState | None]:
+ """Run the denoising loop using X0 prediction with CFG and optional STG."""
+ scheduler = LTX2Scheduler()
+ sigmas = scheduler.execute(steps=config.num_inference_steps).to(device).float()
+ stepper = EulerDiffusionStep()
+ cfg_guider = CFGGuider(config.guidance_scale)
+ stg_guider = STGGuider(config.stg_scale)
+
+ # Build STG perturbation config if STG is enabled
+ stg_perturbation_config = self._build_stg_perturbation_config(config) if stg_guider.enabled() else None
+
+ # Create initial modalities (will be updated each step via replace())
+ video = Modality(
+ enabled=True,
+ latent=video_state.latent,
+ timesteps=video_state.denoise_mask,
+ positions=video_state.positions,
+ context=v_ctx_pos,
+ context_mask=None,
+ )
+
+ # Audio modality is None when not generating audio
+ audio: Modality | None = None
+ if audio_state is not None:
+ audio = Modality(
+ enabled=True,
+ latent=audio_state.latent,
+ timesteps=audio_state.denoise_mask,
+ positions=audio_state.positions,
+ context=a_ctx_pos,
+ context_mask=None,
+ )
+
+ # Wrap transformer with X0Model to convert velocity predictions to denoised outputs
+ self._transformer.to(device)
+ x0_model = X0Model(self._transformer)
+
+ with torch.autocast(device_type=str(device).split(":")[0], dtype=torch.bfloat16):
+ for step_idx, sigma in enumerate(sigmas[:-1]):
+ # Update modalities with current state and timesteps
+ video = replace(
+ video,
+ latent=video_state.latent,
+ timesteps=sigma * video_state.denoise_mask,
+ positions=video_state.positions,
+ )
+
+ if audio is not None and audio_state is not None:
+ audio = replace(
+ audio,
+ latent=audio_state.latent,
+ timesteps=sigma * audio_state.denoise_mask,
+ positions=audio_state.positions,
+ )
+
+ # Run model (positive pass) - X0Model returns denoised outputs
+ pos_video, pos_audio = x0_model(video=video, audio=audio, perturbations=None)
+ denoised_video, denoised_audio = pos_video, pos_audio
+
+ # Apply CFG if guidance_scale != 1.0
+ if cfg_guider.enabled() and v_ctx_neg is not None:
+ video_neg = replace(video, context=v_ctx_neg)
+ audio_neg = replace(audio, context=a_ctx_neg) if audio is not None else None
+ neg_video, neg_audio = x0_model(video=video_neg, audio=audio_neg, perturbations=None)
+
+ denoised_video = denoised_video + cfg_guider.delta(pos_video, neg_video)
+ if audio is not None and denoised_audio is not None:
+ denoised_audio = denoised_audio + cfg_guider.delta(pos_audio, neg_audio)
+
+ # Apply STG if stg_scale != 0.0
+ if stg_guider.enabled() and stg_perturbation_config is not None:
+ perturbed_video, perturbed_audio = x0_model(
+ video=video, audio=audio, perturbations=stg_perturbation_config
+ )
+ denoised_video = denoised_video + stg_guider.delta(pos_video, perturbed_video)
+ if audio is not None and denoised_audio is not None and perturbed_audio is not None:
+ denoised_audio = denoised_audio + stg_guider.delta(pos_audio, perturbed_audio)
+
+ # Apply conditioning mask (keep conditioned tokens clean)
+ denoised_video = denoised_video * video_state.denoise_mask + video_clean_state.latent.float() * (
+ 1 - video_state.denoise_mask
+ )
+ if audio is not None and audio_state is not None and audio_clean_state is not None:
+ denoised_audio = denoised_audio * audio_state.denoise_mask + audio_clean_state.latent.float() * (
+ 1 - audio_state.denoise_mask
+ )
+
+ # Euler step
+ video_state = replace(
+ video_state,
+ latent=stepper.step(
+ sample=video.latent, denoised_sample=denoised_video, sigmas=sigmas, step_index=step_idx
+ ),
+ )
+ if audio is not None and audio_state is not None:
+ audio_state = replace(
+ audio_state,
+ latent=stepper.step(
+ sample=audio.latent, denoised_sample=denoised_audio, sigmas=sigmas, step_index=step_idx
+ ),
+ )
+
+ # Update progress
+ if self._sampling_context is not None:
+ self._sampling_context.advance_step()
+
+ return video_state, audio_state
+
+ @staticmethod
+ def _build_stg_perturbation_config(config: GenerationConfig) -> BatchedPerturbationConfig:
+ """Build the perturbation config for STG based on the stg_mode."""
+ # Always skip video self-attention for STG
+ perturbations: list[Perturbation] = [
+ Perturbation(type=PerturbationType.SKIP_VIDEO_SELF_ATTN, blocks=config.stg_blocks)
+ ]
+
+ # Optionally also skip audio self-attention (stg_av mode)
+ if config.stg_mode == "stg_av":
+ perturbations.append(Perturbation(type=PerturbationType.SKIP_AUDIO_SELF_ATTN, blocks=config.stg_blocks))
+
+ perturbation_config = PerturbationConfig(perturbations=perturbations)
+ # Batch size is 1 for validation
+ return BatchedPerturbationConfig(perturbations=[perturbation_config])
+
+ def _decode_video_latent(self, latent: Tensor, config: GenerationConfig, device: torch.device) -> Tensor:
+ """Decode patchified video latent to pixel space."""
+ # Unpatchify
+ latent_frames = config.num_frames // VIDEO_SCALE_FACTORS.time + 1
+ latent_height = config.height // VIDEO_SCALE_FACTORS.height
+ latent_width = config.width // VIDEO_SCALE_FACTORS.width
+
+ unpatchified = self._video_patchifier.unpatchify(
+ latent,
+ output_shape=VideoLatentShape(
+ height=latent_height,
+ width=latent_width,
+ frames=latent_frames,
+ batch=1,
+ channels=128,
+ ),
+ )
+
+ # Decode - ensure bfloat16 to match decoder weights
+ self._vae_decoder.to(device)
+ unpatchified = unpatchified.to(dtype=torch.bfloat16)
+ tiled_config = config.tiled_decoding
+
+ if tiled_config is not None and tiled_config.enabled:
+ # Use tiled decoding for reduced VRAM
+ tiling_config = TilingConfig(
+ spatial_config=SpatialTilingConfig(
+ tile_size_in_pixels=tiled_config.tile_size_pixels,
+ tile_overlap_in_pixels=tiled_config.tile_overlap_pixels,
+ ),
+ temporal_config=TemporalTilingConfig(
+ tile_size_in_frames=tiled_config.tile_size_frames,
+ tile_overlap_in_frames=tiled_config.tile_overlap_frames,
+ ),
+ )
+ chunks = []
+ for video_chunk in self._vae_decoder.tiled_decode(
+ unpatchified,
+ tiling_config=tiling_config,
+ ):
+ chunks.append(video_chunk)
+ decoded_video = torch.cat(chunks, dim=2)
+ else:
+ # Standard full decoding
+ decoded_video = self._vae_decoder(unpatchified)
+
+ decoded_video = ((decoded_video + 1.0) / 2.0).clamp(0.0, 1.0)
+ self._vae_decoder.to("cpu")
+
+ return decoded_video[0].float().cpu()
+
+ def _validate_config(self, config: GenerationConfig) -> None:
+ """Validate generation configuration."""
+ if config.height % 32 != 0 or config.width % 32 != 0:
+ raise ValueError(f"height and width must be divisible by 32, got {config.height}x{config.width}")
+ if config.num_frames % 8 != 1:
+ raise ValueError(f"num_frames must satisfy num_frames % 8 == 1, got {config.num_frames}")
+ if config.generate_audio and (self._audio_decoder is None or self._vocoder is None):
+ raise ValueError("Audio generation requires audio_decoder and vocoder")
+ if config.condition_image is not None and self._vae_encoder is None:
+ raise ValueError("Image conditioning requires vae_encoder")
+ if config.reference_video is not None and self._vae_encoder is None:
+ raise ValueError("Reference video conditioning requires vae_encoder")
+
+ # Validate prompt embedding source
+ if config.cached_embeddings is None and self._text_encoder is None:
+ raise ValueError("Either text_encoder or config.cached_embeddings must be provided")
+
+ def _get_prompt_embeddings(
+ self, config: GenerationConfig, device: torch.device
+ ) -> tuple[Tensor, Tensor, Tensor | None, Tensor | None]:
+ """Get prompt embeddings from config cache or encode on-the-fly."""
+ if config.cached_embeddings is not None:
+ # Use pre-computed embeddings from config
+ cached = config.cached_embeddings
+ v_ctx_pos = cached.video_context_positive.to(device)
+ a_ctx_pos = cached.audio_context_positive.to(device)
+ v_ctx_neg = cached.video_context_negative.to(device) if cached.video_context_negative is not None else None
+ a_ctx_neg = cached.audio_context_negative.to(device) if cached.audio_context_negative is not None else None
+ return v_ctx_pos, a_ctx_pos, v_ctx_neg, a_ctx_neg
+
+ # Fall back to encoding on-the-fly
+ return self._encode_prompts(config, device)
+
+ def _encode_prompts(
+ self, config: GenerationConfig, device: torch.device
+ ) -> tuple[Tensor, Tensor, Tensor | None, Tensor | None]:
+ """Encode positive and negative prompts using the text encoder."""
+ self._text_encoder.to(device)
+ v_ctx_pos, a_ctx_pos, _ = self._text_encoder(config.prompt)
+ v_ctx_neg, a_ctx_neg = None, None
+ if config.guidance_scale != 1.0:
+ v_ctx_neg, a_ctx_neg, _ = self._text_encoder(config.negative_prompt)
+
+ # Move the base Gemma model to CPU but keep embeddings connectors on GPU
+ # as this module is also used during training
+ self._text_encoder.model.to("cpu")
+ self._text_encoder.feature_extractor_linear.to("cpu")
+
+ return v_ctx_pos, a_ctx_pos, v_ctx_neg, a_ctx_neg
+
+ def _decode_video(
+ self, video_state: LatentState, device: torch.device, tiled_config: TiledDecodingConfig | None = None
+ ) -> Tensor:
+ """Decode video latents to pixel space.
+ Args:
+ video_state: Video latent state to decode
+ device: Device to run decoding on
+ tiled_config: Optional tiled decoding configuration for reduced VRAM usage
+ Returns:
+ Decoded video tensor [C, F, H, W] in [0, 1] range
+ """
+ self._vae_decoder.to(device)
+ # Ensure latent is bfloat16 to match decoder weights
+ latent = video_state.latent.to(dtype=torch.bfloat16)
+
+ if tiled_config is not None and tiled_config.enabled:
+ # Use tiled decoding for reduced VRAM
+ tiling_config = TilingConfig(
+ spatial_config=SpatialTilingConfig(
+ tile_size_in_pixels=tiled_config.tile_size_pixels,
+ tile_overlap_in_pixels=tiled_config.tile_overlap_pixels,
+ ),
+ temporal_config=TemporalTilingConfig(
+ tile_size_in_frames=tiled_config.tile_size_frames,
+ tile_overlap_in_frames=tiled_config.tile_overlap_frames,
+ ),
+ )
+ chunks = []
+ for video_chunk in self._vae_decoder.tiled_decode(
+ latent,
+ tiling_config=tiling_config,
+ ):
+ chunks.append(video_chunk)
+ decoded_video = torch.cat(chunks, dim=2)
+ else:
+ # Standard full decoding
+ decoded_video = self._vae_decoder(latent)
+
+ decoded_video = ((decoded_video + 1.0) / 2.0).clamp(0.0, 1.0)
+ self._vae_decoder.to("cpu")
+ return decoded_video[0].float().cpu()
+
+ def _decode_audio(self, audio_state: LatentState, device: torch.device) -> Tensor:
+ """Decode audio latents to waveform."""
+ self._audio_decoder.to(device)
+ # Ensure latent is bfloat16 to match decoder weights
+ latent = audio_state.latent.to(dtype=torch.bfloat16)
+ decoded_audio = self._audio_decoder(latent)
+ self._audio_decoder.to("cpu")
+
+ self._vocoder.to(device)
+ audio_waveform = self._vocoder(decoded_audio)
+ self._vocoder.to("cpu")
+
+ return audio_waveform.squeeze(0).float().cpu()
+
+ @staticmethod
+ def _concatenate_videos_side_by_side(left_video: Tensor, right_video: Tensor) -> Tensor:
+ """Concatenate two videos side-by-side (horizontally).
+ If the videos have different frame counts, the shorter one is padded with
+ its last frame repeated.
+ Args:
+ left_video: Left video tensor [C, F1, H, W] in [0, 1]
+ right_video: Right video tensor [C, F2, H, W] in [0, 1]
+ Returns:
+ Concatenated video tensor [C, max(F1,F2), H, W*2] in [0, 1]
+ """
+ left_frames = left_video.shape[1]
+ right_frames = right_video.shape[1]
+
+ # Pad shorter video by repeating last frame
+ if left_frames < right_frames:
+ padding = left_video[:, -1:, :, :].expand(-1, right_frames - left_frames, -1, -1)
+ left_video = torch.cat([left_video, padding], dim=1)
+ elif right_frames < left_frames:
+ padding = right_video[:, -1:, :, :].expand(-1, left_frames - right_frames, -1, -1)
+ right_video = torch.cat([right_video, padding], dim=1)
+
+ # Concatenate along width dimension
+ return torch.cat([left_video, right_video], dim=3)
+
+ def _encode_conditioning_image(
+ self,
+ image: Tensor,
+ target_height: int,
+ target_width: int,
+ device: torch.device,
+ ) -> Tensor:
+ """Encode a conditioning image to latent space.
+ The image is resized to cover the target dimensions while preserving aspect ratio,
+ then center-cropped to exactly match the target size.
+ """
+ # image is [C, H, W] in [0, 1] # noqa: ERA001
+ current_height, current_width = image.shape[1:]
+
+ # Resize maintaining aspect ratio (cover target, then center crop)
+ if current_height != target_height or current_width != target_width:
+ aspect_ratio = current_width / current_height
+ target_aspect_ratio = target_width / target_height
+
+ if aspect_ratio > target_aspect_ratio:
+ # Image is wider than target - resize to match height, crop width
+ resize_height = target_height
+ resize_width = int(target_height * aspect_ratio)
+ else:
+ # Image is taller than target - resize to match width, crop height
+ resize_height = int(target_width / aspect_ratio)
+ resize_width = target_width
+
+ image = rearrange(image, "c h w -> 1 c h w")
+ image = torch.nn.functional.interpolate(
+ image, size=(resize_height, resize_width), mode="bilinear", align_corners=False
+ )
+
+ # Center crop to target dimensions
+ h_start = (resize_height - target_height) // 2
+ w_start = (resize_width - target_width) // 2
+ image = image[:, :, h_start : h_start + target_height, w_start : w_start + target_width]
+ else:
+ image = rearrange(image, "c h w -> 1 c h w")
+
+ # Add frame dimension and convert to [-1, 1]
+ image = rearrange(image, "b c h w -> b c 1 h w")
+ image = (image * 2.0 - 1.0).to(device=device, dtype=torch.float32)
+
+ # Encode
+ self._vae_encoder.to(device)
+ with torch.autocast(device_type=str(device).split(":")[0], dtype=torch.bfloat16):
+ encoded = self._vae_encoder(image)
+ self._vae_encoder.to("cpu")
+
+ return encoded
diff --git a/packages/ltx-trainer/src/ltx_trainer/video_utils.py b/packages/ltx-trainer/src/ltx_trainer/video_utils.py
new file mode 100644
index 0000000..5e22f27
--- /dev/null
+++ b/packages/ltx-trainer/src/ltx_trainer/video_utils.py
@@ -0,0 +1,159 @@
+"""Video I/O utilities using PyAV.
+This module provides functions for reading and writing video files using PyAV,
+with optional audio support.
+"""
+
+from fractions import Fraction
+from pathlib import Path
+
+import av
+import numpy as np
+import torch
+from torch import Tensor
+
+
+def get_video_frame_count(video_path: str | Path) -> int:
+ """Get the number of frames in a video file.
+ Args:
+ video_path: Path to the video file
+ Returns:
+ Number of frames in the video
+ """
+ with av.open(str(video_path)) as container:
+ video_stream = container.streams.video[0]
+ frame_count = video_stream.frames
+ if frame_count == 0:
+ # Fallback: count frames by decoding
+ frame_count = sum(1 for _ in container.decode(video=0))
+ return frame_count
+
+
+def read_video(video_path: str | Path, max_frames: int | None = None) -> tuple[Tensor, float]:
+ """Load frames from a video file using PyAV.
+ Args:
+ video_path: Path to the video file
+ max_frames: Maximum number of frames to read. If None, reads all frames.
+ Returns:
+ Video tensor with shape [F, C, H, W] in range [0, 1] and frames per second (fps).
+ """
+ with av.open(str(video_path)) as container:
+ video_stream = container.streams.video[0]
+ fps = float(video_stream.average_rate or video_stream.base_rate or 24)
+
+ frames = []
+ for frame in container.decode(video=0):
+ if max_frames is not None and len(frames) >= max_frames:
+ break
+ frames.append(frame.to_ndarray(format="rgb24"))
+
+ frames_np = np.stack(frames, axis=0) # [F, H, W, C]
+ video = torch.from_numpy(frames_np).float().div(255.0) # [F, H, W, C] in [0, 1]
+ return video.permute(0, 3, 1, 2), fps # [F, C, H, W]
+
+
+def save_video(
+ video_tensor: torch.Tensor,
+ output_path: Path | str,
+ fps: float = 24.0,
+ audio: torch.Tensor | None = None,
+ audio_sample_rate: int | None = None,
+) -> None:
+ """Save a video tensor to a file using PyAV, optionally with audio.
+ Args:
+ video_tensor: Video tensor of shape [C, F, H, W] or [F, C, H, W] in range [0, 1] or [0, 255]
+ output_path: Path to save the video
+ fps: Frames per second for the output video
+ audio: Optional audio tensor of shape [C, samples] or [samples, C] in range [-1, 1]
+ audio_sample_rate: Sample rate for the audio (required if audio is provided)
+ """
+ output_path = Path(output_path)
+ output_path.parent.mkdir(parents=True, exist_ok=True)
+
+ # Normalize to [F, H, W, C] uint8 numpy array
+ video_np = _prepare_video_array(video_tensor)
+ _, height, width, _ = video_np.shape
+
+ with av.open(str(output_path), mode="w") as container:
+ # Setup video stream
+ video_stream = container.add_stream("libx264", rate=int(fps))
+ video_stream.width = width
+ video_stream.height = height
+ video_stream.pix_fmt = "yuv420p"
+ video_stream.options = {"crf": "18"}
+
+ # Setup audio stream if needed
+ if audio is not None:
+ if audio_sample_rate is None:
+ raise ValueError("audio_sample_rate must be provided when audio is given")
+ audio_stream = container.add_stream("aac", rate=audio_sample_rate)
+ audio_stream.layout = "stereo"
+ audio_stream.time_base = Fraction(1, audio_sample_rate)
+
+ # Write video frames
+ for frame_array in video_np:
+ frame = av.VideoFrame.from_ndarray(frame_array, format="rgb24")
+ for packet in video_stream.encode(frame):
+ container.mux(packet)
+ for packet in video_stream.encode():
+ container.mux(packet)
+
+ # Write audio if provided
+ if audio is not None:
+ _write_audio(container, audio_stream, audio, audio_sample_rate)
+
+
+def _prepare_video_array(video_tensor: torch.Tensor) -> np.ndarray:
+ """Convert video tensor to [F, H, W, C] uint8 numpy array."""
+ # Handle [C, F, H, W] vs [F, C, H, W] format
+ if video_tensor.shape[0] == 3 and video_tensor.shape[1] > 3:
+ video_tensor = video_tensor.permute(1, 0, 2, 3) # [C, F, H, W] -> [F, C, H, W]
+
+ # Normalize to [0, 255] uint8
+ if video_tensor.max() <= 1.0:
+ video_tensor = video_tensor * 255
+
+ # [F, C, H, W] -> [F, H, W, C]
+ return video_tensor.permute(0, 2, 3, 1).to(torch.uint8).cpu().numpy()
+
+
+def _write_audio(
+ container: av.container.Container,
+ audio_stream: av.audio.AudioStream,
+ audio: torch.Tensor,
+ sample_rate: int,
+) -> None:
+ """Write audio tensor to container as stereo AAC."""
+ audio = audio.cpu().float()
+
+ # Normalize to [samples, 2] stereo format
+ if audio.ndim == 1:
+ audio = audio.unsqueeze(1).repeat(1, 2) # Mono -> stereo
+ elif audio.shape[0] == 2 and audio.shape[1] != 2:
+ audio = audio.T # [2, samples] -> [samples, 2]
+ if audio.shape[1] == 1:
+ audio = audio.repeat(1, 2) # Mono -> stereo
+
+ # Convert to int16 interleaved: [samples, 2] -> [1, samples*2]
+ audio_int16 = (audio.clamp(-1, 1) * 32767).to(torch.int16)
+ audio_interleaved = audio_int16.contiguous().view(1, -1).numpy()
+
+ # Create audio frame
+ frame = av.AudioFrame.from_ndarray(audio_interleaved, format="s16", layout="stereo")
+ frame.sample_rate = sample_rate
+
+ # Resample to encoder format and write
+ resampler = av.audio.resampler.AudioResampler(
+ format=audio_stream.codec_context.format,
+ layout=audio_stream.codec_context.layout,
+ rate=sample_rate,
+ )
+
+ pts = 0
+ for resampled_frame in resampler.resample(frame):
+ resampled_frame.pts = pts
+ pts += resampled_frame.samples
+ for packet in audio_stream.encode(resampled_frame):
+ container.mux(packet)
+
+ for packet in audio_stream.encode():
+ container.mux(packet)
diff --git a/packages/ltx-trainer/templates/model_card.md b/packages/ltx-trainer/templates/model_card.md
new file mode 100644
index 0000000..accb8c4
--- /dev/null
+++ b/packages/ltx-trainer/templates/model_card.md
@@ -0,0 +1,59 @@
+---
+tags:
+ - ltx-2
+ - ltx-video
+ - text-to-video
+ - audio-video
+pinned: true
+language:
+ - en
+license: other
+pipeline_tag: text-to-video
+library_name: diffusers
+---
+
+# {model_name}
+
+This is a fine-tuned version of [`{base_model}`]({base_model_link}) trained on custom data.
+
+## Model Details
+
+- **Base Model:** [`{base_model}`]({base_model_link})
+- **Training Type:** {training_type}
+- **Training Steps:** {training_steps}
+- **Learning Rate:** {learning_rate}
+- **Batch Size:** {batch_size}
+
+## Sample Outputs
+
+| | | | |
+|:---:|:---:|:---:|:---:|
+{sample_grid}
+
+## Usage
+
+This model is designed to be used with the LTX-2 (Lightricks Audio-Video) pipeline.
+
+### 🔌 Using Trained LoRAs in ComfyUI
+
+In order to use the trained LoRA in ComfyUI, follow these steps:
+
+1. Copy your trained LoRA checkpoint (`.safetensors` file) to the `models/loras` folder in your ComfyUI installation.
+2. In your ComfyUI workflow:
+ - Add the "Load LoRA" node to choose your LoRA file
+ - Connect it to the "Load Checkpoint" node to apply the LoRA to the base model
+
+You can find reference Text-to-Video (T2V) and Image-to-Video (I2V) workflows in the
+official [LTX-2 repository](https://github.com/Lightricks/LTX-2).
+
+### Example Prompts
+
+{validation_prompts}
+
+
+This model inherits the license of the base model ([`{base_model}`]({base_model_link})).
+
+## Acknowledgments
+
+- Base model: [Lightricks](https://huggingface.co/Lightricks/LTX-2)
+- Trainer: [LTX-2](https://github.com/Lightricks/LTX-2)
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..249092c
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,62 @@
+[tool.uv.sources]
+ltx-core = { workspace = true }
+ltx-pipelines = { workspace = true }
+
+[tool.uv.workspace]
+members = ["packages/*"]
+
+[[tool.uv.index]]
+name = "pypi"
+url = "https://pypi.org/simple"
+
+[dependency-groups]
+dev = [
+ "pre-commit>=4.3.0",
+ "ruff>=0.14.3",
+ "pytest~=9.0",
+]
+
+[tool.ruff]
+target-version = "py311"
+line-length = 120
+exclude = []
+
+[tool.ruff.lint]
+select = [
+ "E", # pycodestyle
+ "F", # pyflakes
+ "W", # pycodestyle (warnings)
+ "I", # isort
+ "N", # pep8-naming
+ "ANN", # flake8-annotations
+ "B", # flake8-bugbear
+ "A", # flake8-builtins
+ "COM", # flake8-commas
+ "C4", # flake8-comprehensions
+ "DTZ", # flake8-datetimez
+ "EXE", # flake8-executable
+ "PIE", # flake8-pie
+ "T20", # flake8-print
+ "PT", # flake8-pytest
+ "SIM", # flake8-simplify
+ "ARG", # flake8-unused-arguments
+ "PTH", # flake8--use-pathlib
+ "ERA", # flake8-eradicate
+ "RUF", # ruff specific rules
+ "PL", # pylint
+]
+ignore = [
+ "ANN002", # Missing type annotation for *args
+ "ANN003", # Missing type annotation for **kwargs
+ "ANN204", # Missing type annotation for special method
+ "COM812", # Missing trailing comma
+ "PTH123", # `open()` should be replaced by `Path.open()`
+ "PLR2004", # Magic value used in comparison, consider replacing with a constant variable
+ "N812", # Lowercase imported as non-lowercase
+]
+
+[tool.ruff.lint.pylint]
+max-args = 10
+
+[tool.ruff.lint.isort]
+known-first-party = ["ltx_core", "ltx_pipelines", "ltx_trainer"]
diff --git a/uv.lock b/uv.lock
new file mode 100644
index 0000000..4454371
--- /dev/null
+++ b/uv.lock
@@ -0,0 +1,2696 @@
+version = 1
+revision = 1
+requires-python = ">=3.10"
+resolution-markers = [
+ "python_full_version >= '3.12' and sys_platform == 'darwin'",
+ "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux'",
+ "python_full_version == '3.11.*' and sys_platform == 'darwin'",
+ "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux'",
+ "python_full_version < '3.11' and sys_platform == 'darwin'",
+ "python_full_version < '3.11' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+
+[manifest]
+members = [
+ "ltx-core",
+ "ltx-pipelines",
+ "ltx-trainer",
+]
+
+[manifest.dependency-groups]
+dev = [
+ { name = "pre-commit", specifier = ">=4.3.0" },
+ { name = "pytest", specifier = "~=9.0" },
+ { name = "ruff", specifier = ">=0.14.3" },
+]
+
+[[package]]
+name = "accelerate"
+version = "1.12.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "huggingface-hub" },
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "packaging" },
+ { name = "psutil" },
+ { name = "pyyaml" },
+ { name = "safetensors" },
+ { name = "torch" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/4a/8e/ac2a9566747a93f8be36ee08532eb0160558b07630a081a6056a9f89bf1d/accelerate-1.12.0.tar.gz", hash = "sha256:70988c352feb481887077d2ab845125024b2a137a5090d6d7a32b57d03a45df6", size = 398399 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/9f/d2/c581486aa6c4fbd7394c23c47b83fa1a919d34194e16944241daf9e762dd/accelerate-1.12.0-py3-none-any.whl", hash = "sha256:3e2091cd341423207e2f084a6654b1efcd250dc326f2a37d6dde446e07cabb11", size = 380935 },
+]
+
+[[package]]
+name = "annotated-types"
+version = "0.7.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643 },
+]
+
+[[package]]
+name = "av"
+version = "16.0.1"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/15/c3/fd72a0315bc6c943ced1105aaac6e0ec1be57c70d8a616bd05acaa21ffee/av-16.0.1.tar.gz", hash = "sha256:dd2ce779fa0b5f5889a6d9e00fbbbc39f58e247e52d31044272648fe16ff1dbf", size = 3904030 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/e8/3c/eefa29b7d0f5afdf7af9197bbecad8ec2ad06bcb5ac7e909c05a624b00a6/av-16.0.1-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:8b141aaa29a3afc96a1d467d106790782c1914628b57309eaadb8c10c299c9c0", size = 27206679 },
+ { url = "https://files.pythonhosted.org/packages/ac/89/a474feb07d5b94aa5af3771b0fe328056e2e0a840039b329f4fa2a1fd13a/av-16.0.1-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:4b8a08a59a5be0082af063d3f4b216e3950340121c6ea95b505a3f5f5cc8f21d", size = 21774556 },
+ { url = "https://files.pythonhosted.org/packages/be/e5/4361010dcac398bc224823e4b2a47803845e159af9f95164662c523770dc/av-16.0.1-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:792e7fc3c08eae005ff36486983966476e553cbb55aaeb0ec99adc4909377320", size = 38176763 },
+ { url = "https://files.pythonhosted.org/packages/d4/db/b27bdd20c9dc80de5b8792dae16dd6f4edf16408c0c7b28070c6228a8057/av-16.0.1-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:4e8ef5df76d8d0ee56139789f80bb90ad1a82a7e6df6e080e2e95c06fa22aea7", size = 39696277 },
+ { url = "https://files.pythonhosted.org/packages/4e/c8/dd48e6a3ac1e922c141475a0dc30e2b6dfdef9751b3274829889a9281cce/av-16.0.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:4f7a6985784a7464f078e419c71f5528c3e550ee5d605e7149b4a37a111eb136", size = 39576660 },
+ { url = "https://files.pythonhosted.org/packages/b9/f0/223d047e2e60672a2fb5e51e28913de8d52195199f3e949cbfda1e6cd64b/av-16.0.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:3f45c8d7b803b6faa2a25a26de5964a0a897de68298d9c9672c7af9d65d8b48a", size = 40752775 },
+ { url = "https://files.pythonhosted.org/packages/18/73/73acad21c9203bc63d806e8baf42fe705eb5d36dafd1996b71ab5861a933/av-16.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:58e6faf1d9328d8cc6be14c5aadacb7d2965ed6d6ae1af32696993096543ff00", size = 32302328 },
+ { url = "https://files.pythonhosted.org/packages/49/d3/f2a483c5273fccd556dfa1fce14fab3b5d6d213b46e28e54e254465a2255/av-16.0.1-cp311-cp311-macosx_11_0_x86_64.whl", hash = "sha256:e310d1fb42879df9bad2152a8db6d2ff8bf332c8c36349a09d62cc122f5070fb", size = 27191982 },
+ { url = "https://files.pythonhosted.org/packages/e0/39/dff28bd252131b3befd09d8587992fe18c09d5125eaefc83a6434d5f56ff/av-16.0.1-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:2f4b357e5615457a84e6b6290916b22864b76b43d5079e1a73bc27581a5b9bac", size = 21760305 },
+ { url = "https://files.pythonhosted.org/packages/4a/4d/2312d50a09c84a9b4269f7fea5de84f05dd2b7c7113dd961d31fad6c64c4/av-16.0.1-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:286665c77034c3a98080169b8b5586d5568a15da81fbcdaf8099252f2d232d7c", size = 38691616 },
+ { url = "https://files.pythonhosted.org/packages/15/9a/3d2d30b56252f998e53fced13720e2ce809c4db477110f944034e0fa4c9f/av-16.0.1-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:f88de8e5b8ea29e41af4d8d61df108323d050ccfbc90f15b13ec1f99ce0e841e", size = 40216464 },
+ { url = "https://files.pythonhosted.org/packages/98/cb/3860054794a47715b4be0006105158c7119a57be58d9e8882b72e4d4e1dd/av-16.0.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0cdb71ebe4d1b241cf700f8f0c44a7d2a6602b921e16547dd68c0842113736e1", size = 40094077 },
+ { url = "https://files.pythonhosted.org/packages/41/58/79830fb8af0a89c015250f7864bbd427dff09c70575c97847055f8a302f7/av-16.0.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:28c27a65d40e8cf82b6db2543f8feeb8b56d36c1938f50773494cd3b073c7223", size = 41279948 },
+ { url = "https://files.pythonhosted.org/packages/83/79/6e1463b04382f379f857113b851cf5f9d580a2f7bd794211cd75352f4e04/av-16.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:ffea39ac7574f234f5168f9b9602e8d4ecdd81853238ec4d661001f03a6d3f64", size = 32297586 },
+ { url = "https://files.pythonhosted.org/packages/44/78/12a11d7a44fdd8b26a65e2efa1d8a5826733c8887a989a78306ec4785956/av-16.0.1-cp312-cp312-macosx_11_0_x86_64.whl", hash = "sha256:e41a8fef85dfb2c717349f9ff74f92f9560122a9f1a94b1c6c9a8a9c9462ba71", size = 27206375 },
+ { url = "https://files.pythonhosted.org/packages/27/19/3a4d3882852a0ee136121979ce46f6d2867b974eb217a2c9a070939f55ad/av-16.0.1-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:6352a64b25c9f985d4f279c2902db9a92424e6f2c972161e67119616f0796cb9", size = 21752603 },
+ { url = "https://files.pythonhosted.org/packages/cb/6e/f7abefba6e008e2f69bebb9a17ba38ce1df240c79b36a5b5fcacf8c8fcfd/av-16.0.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:5201f7b4b5ed2128118cb90c2a6d64feedb0586ca7c783176896c78ffb4bbd5c", size = 38931978 },
+ { url = "https://files.pythonhosted.org/packages/b2/7a/1305243ab47f724fdd99ddef7309a594e669af7f0e655e11bdd2c325dfae/av-16.0.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:daecc2072b82b6a942acbdaa9a2e00c05234c61fef976b22713983c020b07992", size = 40549383 },
+ { url = "https://files.pythonhosted.org/packages/32/b2/357cc063185043eb757b4a48782bff780826103bcad1eb40c3ddfc050b7e/av-16.0.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6573da96e8bebc3536860a7def108d7dbe1875c86517072431ced702447e6aea", size = 40241993 },
+ { url = "https://files.pythonhosted.org/packages/20/bb/ced42a4588ba168bf0ef1e9d016982e3ba09fde6992f1dda586fd20dcf71/av-16.0.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:4bc064e48a8de6c087b97dd27cf4ef8c13073f0793108fbce3ecd721201b2502", size = 41532235 },
+ { url = "https://files.pythonhosted.org/packages/15/37/c7811eca0f318d5fd3212f7e8c3d8335f75a54907c97a89213dc580b8056/av-16.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0c669b6b6668c8ae74451c15ec6d6d8a36e4c3803dc5d9910f607a174dd18f17", size = 32296912 },
+ { url = "https://files.pythonhosted.org/packages/86/59/972f199ccc4f8c9e51f59e0f8962a09407396b3f6d11355e2c697ba555f9/av-16.0.1-cp313-cp313-macosx_11_0_x86_64.whl", hash = "sha256:4c61c6c120f5c5d95c711caf54e2c4a9fb2f1e613ac0a9c273d895f6b2602e44", size = 27170433 },
+ { url = "https://files.pythonhosted.org/packages/53/9d/0514cbc185fb20353ab25da54197fbd169a233e39efcbb26533c36a9dbb9/av-16.0.1-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:7ecc2e41320c69095f44aff93470a0d32c30892b2dbad0a08040441c81efa379", size = 21717654 },
+ { url = "https://files.pythonhosted.org/packages/32/8c/881409dd124b4e07d909d2b70568acb21126fc747656390840a2238651c9/av-16.0.1-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:036f0554d6faef3f4a94acaeb0cedd388e3ab96eb0eb5a14ec27c17369c466c9", size = 38651601 },
+ { url = "https://files.pythonhosted.org/packages/35/fd/867ba4cc3ab504442dc89b0c117e6a994fc62782eb634c8f31304586f93e/av-16.0.1-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:876415470a62e4a3550cc38db2fc0094c25e64eea34d7293b7454125d5958190", size = 40278604 },
+ { url = "https://files.pythonhosted.org/packages/b3/87/63cde866c0af09a1fa9727b4f40b34d71b0535785f5665c27894306f1fbc/av-16.0.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:56902a06bd0828d13f13352874c370670882048267191ff5829534b611ba3956", size = 39984854 },
+ { url = "https://files.pythonhosted.org/packages/71/3b/8f40a708bff0e6b0f957836e2ef1f4d4429041cf8d99a415a77ead8ac8a3/av-16.0.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:fe988c2bf0fc2d952858f791f18377ea4ae4e19ba3504793799cd6c2a2562edf", size = 41270352 },
+ { url = "https://files.pythonhosted.org/packages/1e/b5/c114292cb58a7269405ae13b7ba48c7d7bfeebbb2e4e66c8073c065a4430/av-16.0.1-cp313-cp313-win_amd64.whl", hash = "sha256:708a66c248848029bf518f0482b81c5803846f1b597ef8013b19c014470b620f", size = 32273242 },
+ { url = "https://files.pythonhosted.org/packages/ff/e9/a5b714bc078fdcca8b46c8a0b38484ae5c24cd81d9c1703d3e8ae2b57259/av-16.0.1-cp313-cp313t-macosx_11_0_x86_64.whl", hash = "sha256:79a77ee452537030c21a0b41139bedaf16629636bf764b634e93b99c9d5f4558", size = 27248984 },
+ { url = "https://files.pythonhosted.org/packages/06/ef/ff777aaf1f88e3f6ce94aca4c5806a0c360e68d48f9d9f0214e42650f740/av-16.0.1-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:080823a6ff712f81e7089ae9756fb1512ca1742a138556a852ce50f58e457213", size = 21828098 },
+ { url = "https://files.pythonhosted.org/packages/34/d7/a484358d24a42bedde97f61f5d6ee568a7dd866d9df6e33731378db92d9e/av-16.0.1-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:04e00124afa8b46a850ed48951ddda61de874407fb8307d6a875bba659d5727e", size = 40051697 },
+ { url = "https://files.pythonhosted.org/packages/73/87/6772d6080837da5d5c810a98a95bde6977e1f5a6e2e759e8c9292af9ec69/av-16.0.1-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:bc098c1c6dc4e7080629a7e9560e67bd4b5654951e17e5ddfd2b1515cfcd37db", size = 41352596 },
+ { url = "https://files.pythonhosted.org/packages/bd/58/fe448c60cf7f85640a0ed8936f16bac874846aa35e1baa521028949c1ea3/av-16.0.1-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:e6ffd3559a72c46a76aa622630751a821499ba5a780b0047ecc75105d43a6b61", size = 41183156 },
+ { url = "https://files.pythonhosted.org/packages/85/c6/a039a0979d0c278e1bed6758d5a6186416c3ccb8081970df893fdf9a0d99/av-16.0.1-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:7a3f1a36b550adadd7513f4f5ee956f9e06b01a88e59f3150ef5fec6879d6f79", size = 42302331 },
+ { url = "https://files.pythonhosted.org/packages/18/7b/2ca4a9e3609ff155436dac384e360f530919cb1e328491f7df294be0f0dc/av-16.0.1-cp313-cp313t-win_amd64.whl", hash = "sha256:c6de794abe52b8c0be55d8bb09ade05905efa74b1a5ab4860b4b9c2bfb6578bf", size = 32462194 },
+ { url = "https://files.pythonhosted.org/packages/14/9a/6d17e379906cf53a7a44dfac9cf7e4b2e7df2082ba2dbf07126055effcc1/av-16.0.1-cp314-cp314-macosx_11_0_x86_64.whl", hash = "sha256:4b55ba69a943ae592ad7900da67129422954789de9dc384685d6b529925f542e", size = 27167101 },
+ { url = "https://files.pythonhosted.org/packages/6c/34/891816cd82d5646cb5a51d201d20be0a578232536d083b7d939734258067/av-16.0.1-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:d4a0c47b6c9bbadad8909b82847f5fe64a608ad392f0b01704e427349bcd9a47", size = 21722708 },
+ { url = "https://files.pythonhosted.org/packages/1d/20/c24ad34038423ab8c9728cef3301e0861727c188442dcfd70a4a10834c63/av-16.0.1-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:8bba52f3035708456f6b1994d10b0371b45cfd8f917b5e84ff81aef4ec2f08bf", size = 38638842 },
+ { url = "https://files.pythonhosted.org/packages/d7/32/034412309572ba3ad713079d07a3ffc13739263321aece54a3055d7a4f1f/av-16.0.1-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:08e34c7e7b5e55e29931180bbe21095e1874ac120992bf6b8615d39574487617", size = 40197789 },
+ { url = "https://files.pythonhosted.org/packages/fb/9c/40496298c32f9094e7df28641c5c58aa6fb07554dc232a9ac98a9894376f/av-16.0.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:0d6250ab9db80c641b299987027c987f14935ea837ea4c02c5f5182f6b69d9e5", size = 39980829 },
+ { url = "https://files.pythonhosted.org/packages/4a/7e/5c38268ac1d424f309b13b2de4597ad28daea6039ee5af061e62918b12a8/av-16.0.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:7b621f28d8bcbb07cdcd7b18943ddc040739ad304545715ae733873b6e1b739d", size = 41205928 },
+ { url = "https://files.pythonhosted.org/packages/e3/07/3176e02692d8753a6c4606021c60e4031341afb56292178eee633b6760a4/av-16.0.1-cp314-cp314-win_amd64.whl", hash = "sha256:92101f49082392580c9dba4ba2fe5b931b3bb0fb75a1a848bfb9a11ded68be91", size = 32272836 },
+ { url = "https://files.pythonhosted.org/packages/8a/47/10e03b88de097385d1550cbb6d8de96159131705c13adb92bd9b7e677425/av-16.0.1-cp314-cp314t-macosx_11_0_x86_64.whl", hash = "sha256:07c464bf2bc362a154eccc82e235ef64fd3aaf8d76fc8ed63d0ae520943c6d3f", size = 27248864 },
+ { url = "https://files.pythonhosted.org/packages/b1/60/7447f206bec3e55e81371f1989098baa2fe9adb7b46c149e6937b7e7c1ca/av-16.0.1-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:750da0673864b669c95882c7b25768cd93ece0e47010d74ebcc29dbb14d611f8", size = 21828185 },
+ { url = "https://files.pythonhosted.org/packages/68/48/ee2680e7a01bc4911bbe902b814346911fa2528697a44f3043ee68e0f07e/av-16.0.1-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:0b7c0d060863b2e341d07cd26851cb9057b7979814148b028fb7ee5d5eb8772d", size = 40040572 },
+ { url = "https://files.pythonhosted.org/packages/da/68/2c43d28871721ae07cde432d6e36ae2f7035197cbadb43764cc5bf3d4b33/av-16.0.1-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:e67c2eca6023ca7d76b0709c5f392b23a5defba499f4c262411f8155b1482cbd", size = 41344288 },
+ { url = "https://files.pythonhosted.org/packages/ec/7f/1d801bff43ae1af4758c45eee2eaae64f303bbb460e79f352f08587fd179/av-16.0.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e3243d54d84986e8fbdc1946db634b0c41fe69b6de35a99fa8b763e18503d040", size = 41175142 },
+ { url = "https://files.pythonhosted.org/packages/e4/06/bb363138687066bbf8997c1433dbd9c81762bae120955ea431fb72d69d26/av-16.0.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:a1bcf73efab5379601e6510abd7afe5f397d0f6defe69b1610c2f37a4a17996b", size = 42293932 },
+ { url = "https://files.pythonhosted.org/packages/92/15/5e713098a085f970ccf88550194d277d244464d7b3a7365ad92acb4b6dc1/av-16.0.1-cp314-cp314t-win_amd64.whl", hash = "sha256:6368d4ff153d75469d2a3217bc403630dc870a72fe0a014d9135de550d731a86", size = 32460624 },
+]
+
+[[package]]
+name = "bitsandbytes"
+version = "0.49.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11' and sys_platform == 'linux'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11' and sys_platform == 'linux'" },
+ { name = "packaging", marker = "sys_platform == 'linux'" },
+ { name = "torch", marker = "sys_platform == 'linux'" },
+]
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/d1/4f/9f6d161e9ea68cdd6b85585dee9b383748ca07431e31c4c134111f87489e/bitsandbytes-0.49.0-py3-none-manylinux_2_24_aarch64.whl", hash = "sha256:7e69951b4d207a676986fce967544d9599f23518d0f09d478295996aeff377c2", size = 31065242 },
+ { url = "https://files.pythonhosted.org/packages/a5/a8/26f7815b376b1d3dae615263471cb6d0d9f9792a472d5dab529502deac67/bitsandbytes-0.49.0-py3-none-manylinux_2_24_x86_64.whl", hash = "sha256:0c46cdef50b3174463b6bdf13715c9f1f00b360be3626e3c5d2f8d226af2cf3f", size = 59053880 },
+]
+
+[[package]]
+name = "certifi"
+version = "2026.1.4"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/e0/2d/a891ca51311197f6ad14a7ef42e2399f36cf2f9bd44752b3dc4eab60fdc5/certifi-2026.1.4.tar.gz", hash = "sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120", size = 154268 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/e6/ad/3cc14f097111b4de0040c83a525973216457bbeeb63739ef1ed275c1c021/certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c", size = 152900 },
+]
+
+[[package]]
+name = "cfgv"
+version = "3.5.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/4e/b5/721b8799b04bf9afe054a3899c6cf4e880fcf8563cc71c15610242490a0c/cfgv-3.5.0.tar.gz", hash = "sha256:d5b1034354820651caa73ede66a6294d6e95c1b00acc5e9b098e917404669132", size = 7334 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/db/3c/33bac158f8ab7f89b2e59426d5fe2e4f63f7ed25df84c036890172b412b5/cfgv-3.5.0-py2.py3-none-any.whl", hash = "sha256:a8dc6b26ad22ff227d2634a65cb388215ce6cc96bbcc5cfde7641ae87e8dacc0", size = 7445 },
+]
+
+[[package]]
+name = "charset-normalizer"
+version = "3.4.4"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/13/69/33ddede1939fdd074bce5434295f38fae7136463422fe4fd3e0e89b98062/charset_normalizer-3.4.4.tar.gz", hash = "sha256:94537985111c35f28720e43603b8e7b43a6ecfb2ce1d3058bbe955b73404e21a", size = 129418 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/1f/b8/6d51fc1d52cbd52cd4ccedd5b5b2f0f6a11bbf6765c782298b0f3e808541/charset_normalizer-3.4.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e824f1492727fa856dd6eda4f7cee25f8518a12f3c4a56a74e8095695089cf6d", size = 209709 },
+ { url = "https://files.pythonhosted.org/packages/5c/af/1f9d7f7faafe2ddfb6f72a2e07a548a629c61ad510fe60f9630309908fef/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4bd5d4137d500351a30687c2d3971758aac9a19208fc110ccb9d7188fbe709e8", size = 148814 },
+ { url = "https://files.pythonhosted.org/packages/79/3d/f2e3ac2bbc056ca0c204298ea4e3d9db9b4afe437812638759db2c976b5f/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:027f6de494925c0ab2a55eab46ae5129951638a49a34d87f4c3eda90f696b4ad", size = 144467 },
+ { url = "https://files.pythonhosted.org/packages/ec/85/1bf997003815e60d57de7bd972c57dc6950446a3e4ccac43bc3070721856/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f820802628d2694cb7e56db99213f930856014862f3fd943d290ea8438d07ca8", size = 162280 },
+ { url = "https://files.pythonhosted.org/packages/3e/8e/6aa1952f56b192f54921c436b87f2aaf7c7a7c3d0d1a765547d64fd83c13/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:798d75d81754988d2565bff1b97ba5a44411867c0cf32b77a7e8f8d84796b10d", size = 159454 },
+ { url = "https://files.pythonhosted.org/packages/36/3b/60cbd1f8e93aa25d1c669c649b7a655b0b5fb4c571858910ea9332678558/charset_normalizer-3.4.4-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9d1bb833febdff5c8927f922386db610b49db6e0d4f4ee29601d71e7c2694313", size = 153609 },
+ { url = "https://files.pythonhosted.org/packages/64/91/6a13396948b8fd3c4b4fd5bc74d045f5637d78c9675585e8e9fbe5636554/charset_normalizer-3.4.4-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:9cd98cdc06614a2f768d2b7286d66805f94c48cde050acdbbb7db2600ab3197e", size = 151849 },
+ { url = "https://files.pythonhosted.org/packages/b7/7a/59482e28b9981d105691e968c544cc0df3b7d6133152fb3dcdc8f135da7a/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:077fbb858e903c73f6c9db43374fd213b0b6a778106bc7032446a8e8b5b38b93", size = 151586 },
+ { url = "https://files.pythonhosted.org/packages/92/59/f64ef6a1c4bdd2baf892b04cd78792ed8684fbc48d4c2afe467d96b4df57/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:244bfb999c71b35de57821b8ea746b24e863398194a4014e4c76adc2bbdfeff0", size = 145290 },
+ { url = "https://files.pythonhosted.org/packages/6b/63/3bf9f279ddfa641ffa1962b0db6a57a9c294361cc2f5fcac997049a00e9c/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:64b55f9dce520635f018f907ff1b0df1fdc31f2795a922fb49dd14fbcdf48c84", size = 163663 },
+ { url = "https://files.pythonhosted.org/packages/ed/09/c9e38fc8fa9e0849b172b581fd9803bdf6e694041127933934184e19f8c3/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:faa3a41b2b66b6e50f84ae4a68c64fcd0c44355741c6374813a800cd6695db9e", size = 151964 },
+ { url = "https://files.pythonhosted.org/packages/d2/d1/d28b747e512d0da79d8b6a1ac18b7ab2ecfd81b2944c4c710e166d8dd09c/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:6515f3182dbe4ea06ced2d9e8666d97b46ef4c75e326b79bb624110f122551db", size = 161064 },
+ { url = "https://files.pythonhosted.org/packages/bb/9a/31d62b611d901c3b9e5500c36aab0ff5eb442043fb3a1c254200d3d397d9/charset_normalizer-3.4.4-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:cc00f04ed596e9dc0da42ed17ac5e596c6ccba999ba6bd92b0e0aef2f170f2d6", size = 155015 },
+ { url = "https://files.pythonhosted.org/packages/1f/f3/107e008fa2bff0c8b9319584174418e5e5285fef32f79d8ee6a430d0039c/charset_normalizer-3.4.4-cp310-cp310-win32.whl", hash = "sha256:f34be2938726fc13801220747472850852fe6b1ea75869a048d6f896838c896f", size = 99792 },
+ { url = "https://files.pythonhosted.org/packages/eb/66/e396e8a408843337d7315bab30dbf106c38966f1819f123257f5520f8a96/charset_normalizer-3.4.4-cp310-cp310-win_amd64.whl", hash = "sha256:a61900df84c667873b292c3de315a786dd8dac506704dea57bc957bd31e22c7d", size = 107198 },
+ { url = "https://files.pythonhosted.org/packages/b5/58/01b4f815bf0312704c267f2ccb6e5d42bcc7752340cd487bc9f8c3710597/charset_normalizer-3.4.4-cp310-cp310-win_arm64.whl", hash = "sha256:cead0978fc57397645f12578bfd2d5ea9138ea0fac82b2f63f7f7c6877986a69", size = 100262 },
+ { url = "https://files.pythonhosted.org/packages/ed/27/c6491ff4954e58a10f69ad90aca8a1b6fe9c5d3c6f380907af3c37435b59/charset_normalizer-3.4.4-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6e1fcf0720908f200cd21aa4e6750a48ff6ce4afe7ff5a79a90d5ed8a08296f8", size = 206988 },
+ { url = "https://files.pythonhosted.org/packages/94/59/2e87300fe67ab820b5428580a53cad894272dbb97f38a7a814a2a1ac1011/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5f819d5fe9234f9f82d75bdfa9aef3a3d72c4d24a6e57aeaebba32a704553aa0", size = 147324 },
+ { url = "https://files.pythonhosted.org/packages/07/fb/0cf61dc84b2b088391830f6274cb57c82e4da8bbc2efeac8c025edb88772/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:a59cb51917aa591b1c4e6a43c132f0cdc3c76dbad6155df4e28ee626cc77a0a3", size = 142742 },
+ { url = "https://files.pythonhosted.org/packages/62/8b/171935adf2312cd745d290ed93cf16cf0dfe320863ab7cbeeae1dcd6535f/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8ef3c867360f88ac904fd3f5e1f902f13307af9052646963ee08ff4f131adafc", size = 160863 },
+ { url = "https://files.pythonhosted.org/packages/09/73/ad875b192bda14f2173bfc1bc9a55e009808484a4b256748d931b6948442/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d9e45d7faa48ee908174d8fe84854479ef838fc6a705c9315372eacbc2f02897", size = 157837 },
+ { url = "https://files.pythonhosted.org/packages/6d/fc/de9cce525b2c5b94b47c70a4b4fb19f871b24995c728e957ee68ab1671ea/charset_normalizer-3.4.4-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:840c25fb618a231545cbab0564a799f101b63b9901f2569faecd6b222ac72381", size = 151550 },
+ { url = "https://files.pythonhosted.org/packages/55/c2/43edd615fdfba8c6f2dfbd459b25a6b3b551f24ea21981e23fb768503ce1/charset_normalizer-3.4.4-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ca5862d5b3928c4940729dacc329aa9102900382fea192fc5e52eb69d6093815", size = 149162 },
+ { url = "https://files.pythonhosted.org/packages/03/86/bde4ad8b4d0e9429a4e82c1e8f5c659993a9a863ad62c7df05cf7b678d75/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d9c7f57c3d666a53421049053eaacdd14bbd0a528e2186fcb2e672effd053bb0", size = 150019 },
+ { url = "https://files.pythonhosted.org/packages/1f/86/a151eb2af293a7e7bac3a739b81072585ce36ccfb4493039f49f1d3cae8c/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:277e970e750505ed74c832b4bf75dac7476262ee2a013f5574dd49075879e161", size = 143310 },
+ { url = "https://files.pythonhosted.org/packages/b5/fe/43dae6144a7e07b87478fdfc4dbe9efd5defb0e7ec29f5f58a55aeef7bf7/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:31fd66405eaf47bb62e8cd575dc621c56c668f27d46a61d975a249930dd5e2a4", size = 162022 },
+ { url = "https://files.pythonhosted.org/packages/80/e6/7aab83774f5d2bca81f42ac58d04caf44f0cc2b65fc6db2b3b2e8a05f3b3/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:0d3d8f15c07f86e9ff82319b3d9ef6f4bf907608f53fe9d92b28ea9ae3d1fd89", size = 149383 },
+ { url = "https://files.pythonhosted.org/packages/4f/e8/b289173b4edae05c0dde07f69f8db476a0b511eac556dfe0d6bda3c43384/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:9f7fcd74d410a36883701fafa2482a6af2ff5ba96b9a620e9e0721e28ead5569", size = 159098 },
+ { url = "https://files.pythonhosted.org/packages/d8/df/fe699727754cae3f8478493c7f45f777b17c3ef0600e28abfec8619eb49c/charset_normalizer-3.4.4-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ebf3e58c7ec8a8bed6d66a75d7fb37b55e5015b03ceae72a8e7c74495551e224", size = 152991 },
+ { url = "https://files.pythonhosted.org/packages/1a/86/584869fe4ddb6ffa3bd9f491b87a01568797fb9bd8933f557dba9771beaf/charset_normalizer-3.4.4-cp311-cp311-win32.whl", hash = "sha256:eecbc200c7fd5ddb9a7f16c7decb07b566c29fa2161a16cf67b8d068bd21690a", size = 99456 },
+ { url = "https://files.pythonhosted.org/packages/65/f6/62fdd5feb60530f50f7e38b4f6a1d5203f4d16ff4f9f0952962c044e919a/charset_normalizer-3.4.4-cp311-cp311-win_amd64.whl", hash = "sha256:5ae497466c7901d54b639cf42d5b8c1b6a4fead55215500d2f486d34db48d016", size = 106978 },
+ { url = "https://files.pythonhosted.org/packages/7a/9d/0710916e6c82948b3be62d9d398cb4fcf4e97b56d6a6aeccd66c4b2f2bd5/charset_normalizer-3.4.4-cp311-cp311-win_arm64.whl", hash = "sha256:65e2befcd84bc6f37095f5961e68a6f077bf44946771354a28ad434c2cce0ae1", size = 99969 },
+ { url = "https://files.pythonhosted.org/packages/f3/85/1637cd4af66fa687396e757dec650f28025f2a2f5a5531a3208dc0ec43f2/charset_normalizer-3.4.4-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0a98e6759f854bd25a58a73fa88833fba3b7c491169f86ce1180c948ab3fd394", size = 208425 },
+ { url = "https://files.pythonhosted.org/packages/9d/6a/04130023fef2a0d9c62d0bae2649b69f7b7d8d24ea5536feef50551029df/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b5b290ccc2a263e8d185130284f8501e3e36c5e02750fc6b6bdeb2e9e96f1e25", size = 148162 },
+ { url = "https://files.pythonhosted.org/packages/78/29/62328d79aa60da22c9e0b9a66539feae06ca0f5a4171ac4f7dc285b83688/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:74bb723680f9f7a6234dcf67aea57e708ec1fbdf5699fb91dfd6f511b0a320ef", size = 144558 },
+ { url = "https://files.pythonhosted.org/packages/86/bb/b32194a4bf15b88403537c2e120b817c61cd4ecffa9b6876e941c3ee38fe/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f1e34719c6ed0b92f418c7c780480b26b5d9c50349e9a9af7d76bf757530350d", size = 161497 },
+ { url = "https://files.pythonhosted.org/packages/19/89/a54c82b253d5b9b111dc74aca196ba5ccfcca8242d0fb64146d4d3183ff1/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2437418e20515acec67d86e12bf70056a33abdacb5cb1655042f6538d6b085a8", size = 159240 },
+ { url = "https://files.pythonhosted.org/packages/c0/10/d20b513afe03acc89ec33948320a5544d31f21b05368436d580dec4e234d/charset_normalizer-3.4.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11d694519d7f29d6cd09f6ac70028dba10f92f6cdd059096db198c283794ac86", size = 153471 },
+ { url = "https://files.pythonhosted.org/packages/61/fa/fbf177b55bdd727010f9c0a3c49eefa1d10f960e5f09d1d887bf93c2e698/charset_normalizer-3.4.4-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:ac1c4a689edcc530fc9d9aa11f5774b9e2f33f9a0c6a57864e90908f5208d30a", size = 150864 },
+ { url = "https://files.pythonhosted.org/packages/05/12/9fbc6a4d39c0198adeebbde20b619790e9236557ca59fc40e0e3cebe6f40/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:21d142cc6c0ec30d2efee5068ca36c128a30b0f2c53c1c07bd78cb6bc1d3be5f", size = 150647 },
+ { url = "https://files.pythonhosted.org/packages/ad/1f/6a9a593d52e3e8c5d2b167daf8c6b968808efb57ef4c210acb907c365bc4/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:5dbe56a36425d26d6cfb40ce79c314a2e4dd6211d51d6d2191c00bed34f354cc", size = 145110 },
+ { url = "https://files.pythonhosted.org/packages/30/42/9a52c609e72471b0fc54386dc63c3781a387bb4fe61c20231a4ebcd58bdd/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:5bfbb1b9acf3334612667b61bd3002196fe2a1eb4dd74d247e0f2a4d50ec9bbf", size = 162839 },
+ { url = "https://files.pythonhosted.org/packages/c4/5b/c0682bbf9f11597073052628ddd38344a3d673fda35a36773f7d19344b23/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:d055ec1e26e441f6187acf818b73564e6e6282709e9bcb5b63f5b23068356a15", size = 150667 },
+ { url = "https://files.pythonhosted.org/packages/e4/24/a41afeab6f990cf2daf6cb8c67419b63b48cf518e4f56022230840c9bfb2/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:af2d8c67d8e573d6de5bc30cdb27e9b95e49115cd9baad5ddbd1a6207aaa82a9", size = 160535 },
+ { url = "https://files.pythonhosted.org/packages/2a/e5/6a4ce77ed243c4a50a1fecca6aaaab419628c818a49434be428fe24c9957/charset_normalizer-3.4.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:780236ac706e66881f3b7f2f32dfe90507a09e67d1d454c762cf642e6e1586e0", size = 154816 },
+ { url = "https://files.pythonhosted.org/packages/a8/ef/89297262b8092b312d29cdb2517cb1237e51db8ecef2e9af5edbe7b683b1/charset_normalizer-3.4.4-cp312-cp312-win32.whl", hash = "sha256:5833d2c39d8896e4e19b689ffc198f08ea58116bee26dea51e362ecc7cd3ed26", size = 99694 },
+ { url = "https://files.pythonhosted.org/packages/3d/2d/1e5ed9dd3b3803994c155cd9aacb60c82c331bad84daf75bcb9c91b3295e/charset_normalizer-3.4.4-cp312-cp312-win_amd64.whl", hash = "sha256:a79cfe37875f822425b89a82333404539ae63dbdddf97f84dcbc3d339aae9525", size = 107131 },
+ { url = "https://files.pythonhosted.org/packages/d0/d9/0ed4c7098a861482a7b6a95603edce4c0d9db2311af23da1fb2b75ec26fc/charset_normalizer-3.4.4-cp312-cp312-win_arm64.whl", hash = "sha256:376bec83a63b8021bb5c8ea75e21c4ccb86e7e45ca4eb81146091b56599b80c3", size = 100390 },
+ { url = "https://files.pythonhosted.org/packages/97/45/4b3a1239bbacd321068ea6e7ac28875b03ab8bc0aa0966452db17cd36714/charset_normalizer-3.4.4-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:e1f185f86a6f3403aa2420e815904c67b2f9ebc443f045edd0de921108345794", size = 208091 },
+ { url = "https://files.pythonhosted.org/packages/7d/62/73a6d7450829655a35bb88a88fca7d736f9882a27eacdca2c6d505b57e2e/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6b39f987ae8ccdf0d2642338faf2abb1862340facc796048b604ef14919e55ed", size = 147936 },
+ { url = "https://files.pythonhosted.org/packages/89/c5/adb8c8b3d6625bef6d88b251bbb0d95f8205831b987631ab0c8bb5d937c2/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:3162d5d8ce1bb98dd51af660f2121c55d0fa541b46dff7bb9b9f86ea1d87de72", size = 144180 },
+ { url = "https://files.pythonhosted.org/packages/91/ed/9706e4070682d1cc219050b6048bfd293ccf67b3d4f5a4f39207453d4b99/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:81d5eb2a312700f4ecaa977a8235b634ce853200e828fbadf3a9c50bab278328", size = 161346 },
+ { url = "https://files.pythonhosted.org/packages/d5/0d/031f0d95e4972901a2f6f09ef055751805ff541511dc1252ba3ca1f80cf5/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5bd2293095d766545ec1a8f612559f6b40abc0eb18bb2f5d1171872d34036ede", size = 158874 },
+ { url = "https://files.pythonhosted.org/packages/f5/83/6ab5883f57c9c801ce5e5677242328aa45592be8a00644310a008d04f922/charset_normalizer-3.4.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a8a8b89589086a25749f471e6a900d3f662d1d3b6e2e59dcecf787b1cc3a1894", size = 153076 },
+ { url = "https://files.pythonhosted.org/packages/75/1e/5ff781ddf5260e387d6419959ee89ef13878229732732ee73cdae01800f2/charset_normalizer-3.4.4-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bc7637e2f80d8530ee4a78e878bce464f70087ce73cf7c1caf142416923b98f1", size = 150601 },
+ { url = "https://files.pythonhosted.org/packages/d7/57/71be810965493d3510a6ca79b90c19e48696fb1ff964da319334b12677f0/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f8bf04158c6b607d747e93949aa60618b61312fe647a6369f88ce2ff16043490", size = 150376 },
+ { url = "https://files.pythonhosted.org/packages/e5/d5/c3d057a78c181d007014feb7e9f2e65905a6c4ef182c0ddf0de2924edd65/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:554af85e960429cf30784dd47447d5125aaa3b99a6f0683589dbd27e2f45da44", size = 144825 },
+ { url = "https://files.pythonhosted.org/packages/e6/8c/d0406294828d4976f275ffbe66f00266c4b3136b7506941d87c00cab5272/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:74018750915ee7ad843a774364e13a3db91682f26142baddf775342c3f5b1133", size = 162583 },
+ { url = "https://files.pythonhosted.org/packages/d7/24/e2aa1f18c8f15c4c0e932d9287b8609dd30ad56dbe41d926bd846e22fb8d/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:c0463276121fdee9c49b98908b3a89c39be45d86d1dbaa22957e38f6321d4ce3", size = 150366 },
+ { url = "https://files.pythonhosted.org/packages/e4/5b/1e6160c7739aad1e2df054300cc618b06bf784a7a164b0f238360721ab86/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:362d61fd13843997c1c446760ef36f240cf81d3ebf74ac62652aebaf7838561e", size = 160300 },
+ { url = "https://files.pythonhosted.org/packages/7a/10/f882167cd207fbdd743e55534d5d9620e095089d176d55cb22d5322f2afd/charset_normalizer-3.4.4-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:9a26f18905b8dd5d685d6d07b0cdf98a79f3c7a918906af7cc143ea2e164c8bc", size = 154465 },
+ { url = "https://files.pythonhosted.org/packages/89/66/c7a9e1b7429be72123441bfdbaf2bc13faab3f90b933f664db506dea5915/charset_normalizer-3.4.4-cp313-cp313-win32.whl", hash = "sha256:9b35f4c90079ff2e2edc5b26c0c77925e5d2d255c42c74fdb70fb49b172726ac", size = 99404 },
+ { url = "https://files.pythonhosted.org/packages/c4/26/b9924fa27db384bdcd97ab83b4f0a8058d96ad9626ead570674d5e737d90/charset_normalizer-3.4.4-cp313-cp313-win_amd64.whl", hash = "sha256:b435cba5f4f750aa6c0a0d92c541fb79f69a387c91e61f1795227e4ed9cece14", size = 107092 },
+ { url = "https://files.pythonhosted.org/packages/af/8f/3ed4bfa0c0c72a7ca17f0380cd9e4dd842b09f664e780c13cff1dcf2ef1b/charset_normalizer-3.4.4-cp313-cp313-win_arm64.whl", hash = "sha256:542d2cee80be6f80247095cc36c418f7bddd14f4a6de45af91dfad36d817bba2", size = 100408 },
+ { url = "https://files.pythonhosted.org/packages/2a/35/7051599bd493e62411d6ede36fd5af83a38f37c4767b92884df7301db25d/charset_normalizer-3.4.4-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:da3326d9e65ef63a817ecbcc0df6e94463713b754fe293eaa03da99befb9a5bd", size = 207746 },
+ { url = "https://files.pythonhosted.org/packages/10/9a/97c8d48ef10d6cd4fcead2415523221624bf58bcf68a802721a6bc807c8f/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8af65f14dc14a79b924524b1e7fffe304517b2bff5a58bf64f30b98bbc5079eb", size = 147889 },
+ { url = "https://files.pythonhosted.org/packages/10/bf/979224a919a1b606c82bd2c5fa49b5c6d5727aa47b4312bb27b1734f53cd/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:74664978bb272435107de04e36db5a9735e78232b85b77d45cfb38f758efd33e", size = 143641 },
+ { url = "https://files.pythonhosted.org/packages/ba/33/0ad65587441fc730dc7bd90e9716b30b4702dc7b617e6ba4997dc8651495/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:752944c7ffbfdd10c074dc58ec2d5a8a4cd9493b314d367c14d24c17684ddd14", size = 160779 },
+ { url = "https://files.pythonhosted.org/packages/67/ed/331d6b249259ee71ddea93f6f2f0a56cfebd46938bde6fcc6f7b9a3d0e09/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d1f13550535ad8cff21b8d757a3257963e951d96e20ec82ab44bc64aeb62a191", size = 159035 },
+ { url = "https://files.pythonhosted.org/packages/67/ff/f6b948ca32e4f2a4576aa129d8bed61f2e0543bf9f5f2b7fc3758ed005c9/charset_normalizer-3.4.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ecaae4149d99b1c9e7b88bb03e3221956f68fd6d50be2ef061b2381b61d20838", size = 152542 },
+ { url = "https://files.pythonhosted.org/packages/16/85/276033dcbcc369eb176594de22728541a925b2632f9716428c851b149e83/charset_normalizer-3.4.4-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cb6254dc36b47a990e59e1068afacdcd02958bdcce30bb50cc1700a8b9d624a6", size = 149524 },
+ { url = "https://files.pythonhosted.org/packages/9e/f2/6a2a1f722b6aba37050e626530a46a68f74e63683947a8acff92569f979a/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c8ae8a0f02f57a6e61203a31428fa1d677cbe50c93622b4149d5c0f319c1d19e", size = 150395 },
+ { url = "https://files.pythonhosted.org/packages/60/bb/2186cb2f2bbaea6338cad15ce23a67f9b0672929744381e28b0592676824/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:47cc91b2f4dd2833fddaedd2893006b0106129d4b94fdb6af1f4ce5a9965577c", size = 143680 },
+ { url = "https://files.pythonhosted.org/packages/7d/a5/bf6f13b772fbb2a90360eb620d52ed8f796f3c5caee8398c3b2eb7b1c60d/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:82004af6c302b5d3ab2cfc4cc5f29db16123b1a8417f2e25f9066f91d4411090", size = 162045 },
+ { url = "https://files.pythonhosted.org/packages/df/c5/d1be898bf0dc3ef9030c3825e5d3b83f2c528d207d246cbabe245966808d/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:2b7d8f6c26245217bd2ad053761201e9f9680f8ce52f0fcd8d0755aeae5b2152", size = 149687 },
+ { url = "https://files.pythonhosted.org/packages/a5/42/90c1f7b9341eef50c8a1cb3f098ac43b0508413f33affd762855f67a410e/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:799a7a5e4fb2d5898c60b640fd4981d6a25f1c11790935a44ce38c54e985f828", size = 160014 },
+ { url = "https://files.pythonhosted.org/packages/76/be/4d3ee471e8145d12795ab655ece37baed0929462a86e72372fd25859047c/charset_normalizer-3.4.4-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:99ae2cffebb06e6c22bdc25801d7b30f503cc87dbd283479e7b606f70aff57ec", size = 154044 },
+ { url = "https://files.pythonhosted.org/packages/b0/6f/8f7af07237c34a1defe7defc565a9bc1807762f672c0fde711a4b22bf9c0/charset_normalizer-3.4.4-cp314-cp314-win32.whl", hash = "sha256:f9d332f8c2a2fcbffe1378594431458ddbef721c1769d78e2cbc06280d8155f9", size = 99940 },
+ { url = "https://files.pythonhosted.org/packages/4b/51/8ade005e5ca5b0d80fb4aff72a3775b325bdc3d27408c8113811a7cbe640/charset_normalizer-3.4.4-cp314-cp314-win_amd64.whl", hash = "sha256:8a6562c3700cce886c5be75ade4a5db4214fda19fede41d9792d100288d8f94c", size = 107104 },
+ { url = "https://files.pythonhosted.org/packages/da/5f/6b8f83a55bb8278772c5ae54a577f3099025f9ade59d0136ac24a0df4bde/charset_normalizer-3.4.4-cp314-cp314-win_arm64.whl", hash = "sha256:de00632ca48df9daf77a2c65a484531649261ec9f25489917f09e455cb09ddb2", size = 100743 },
+ { url = "https://files.pythonhosted.org/packages/0a/4c/925909008ed5a988ccbb72dcc897407e5d6d3bd72410d69e051fc0c14647/charset_normalizer-3.4.4-py3-none-any.whl", hash = "sha256:7a32c560861a02ff789ad905a2fe94e3f840803362c84fecf1851cb4cf3dc37f", size = 53402 },
+]
+
+[[package]]
+name = "click"
+version = "8.3.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "colorama", marker = "sys_platform == 'win32'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/3d/fa/656b739db8587d7b5dfa22e22ed02566950fbfbcdc20311993483657a5c0/click-8.3.1.tar.gz", hash = "sha256:12ff4785d337a1bb490bb7e9c2b1ee5da3112e94a8622f26a6c77f5d2fc6842a", size = 295065 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/98/78/01c019cdb5d6498122777c1a43056ebb3ebfeef2076d9d026bfe15583b2b/click-8.3.1-py3-none-any.whl", hash = "sha256:981153a64e25f12d547d3426c367a4857371575ee7ad18df2a6183ab0545b2a6", size = 108274 },
+]
+
+[[package]]
+name = "colorama"
+version = "0.4.6"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 },
+]
+
+[[package]]
+name = "distlib"
+version = "0.4.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/96/8e/709914eb2b5749865801041647dc7f4e6d00b549cfe88b65ca192995f07c/distlib-0.4.0.tar.gz", hash = "sha256:feec40075be03a04501a973d81f633735b4b69f98b05450592310c0f401a4e0d", size = 614605 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/33/6b/e0547afaf41bf2c42e52430072fa5658766e3d65bd4b03a563d1b6336f57/distlib-0.4.0-py2.py3-none-any.whl", hash = "sha256:9659f7d87e46584a30b5780e43ac7a2143098441670ff0a49d5f9034c54a6c16", size = 469047 },
+]
+
+[[package]]
+name = "einops"
+version = "0.8.1"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/e5/81/df4fbe24dff8ba3934af99044188e20a98ed441ad17a274539b74e82e126/einops-0.8.1.tar.gz", hash = "sha256:de5d960a7a761225532e0f1959e5315ebeafc0cd43394732f103ca44b9837e84", size = 54805 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/87/62/9773de14fe6c45c23649e98b83231fffd7b9892b6cf863251dc2afa73643/einops-0.8.1-py3-none-any.whl", hash = "sha256:919387eb55330f5757c6bea9165c5ff5cfe63a642682ea788a6d472576d81737", size = 64359 },
+]
+
+[[package]]
+name = "exceptiongroup"
+version = "1.3.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "typing-extensions", marker = "python_full_version < '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/50/79/66800aadf48771f6b62f7eb014e352e5d06856655206165d775e675a02c9/exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219", size = 30371 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/8a/0e/97c33bf5009bdbac74fd2beace167cab3f978feb69cc36f1ef79360d6c4e/exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598", size = 16740 },
+]
+
+[[package]]
+name = "filelock"
+version = "3.20.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/c1/e0/a75dbe4bca1e7d41307323dad5ea2efdd95408f74ab2de8bd7dba9b51a1a/filelock-3.20.2.tar.gz", hash = "sha256:a2241ff4ddde2a7cebddf78e39832509cb045d18ec1a09d7248d6bfc6bfbbe64", size = 19510 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/9a/30/ab407e2ec752aa541704ed8f93c11e2a5d92c168b8a755d818b74a3c5c2d/filelock-3.20.2-py3-none-any.whl", hash = "sha256:fbba7237d6ea277175a32c54bb71ef814a8546d8601269e1bfc388de333974e8", size = 16697 },
+]
+
+[[package]]
+name = "fsspec"
+version = "2025.12.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/b6/27/954057b0d1f53f086f681755207dda6de6c660ce133c829158e8e8fe7895/fsspec-2025.12.0.tar.gz", hash = "sha256:c505de011584597b1060ff778bb664c1bc022e87921b0e4f10cc9c44f9635973", size = 309748 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/51/c7/b64cae5dba3a1b138d7123ec36bb5ccd39d39939f18454407e5468f4763f/fsspec-2025.12.0-py3-none-any.whl", hash = "sha256:8bf1fe301b7d8acfa6e8571e3b1c3d158f909666642431cc78a1b7b4dbc5ec5b", size = 201422 },
+]
+
+[[package]]
+name = "gitdb"
+version = "4.0.12"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "smmap" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/72/94/63b0fc47eb32792c7ba1fe1b694daec9a63620db1e313033d18140c2320a/gitdb-4.0.12.tar.gz", hash = "sha256:5ef71f855d191a3326fcfbc0d5da835f26b13fbcba60c32c21091c349ffdb571", size = 394684 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/a0/61/5c78b91c3143ed5c14207f463aecfc8f9dbb5092fb2869baf37c273b2705/gitdb-4.0.12-py3-none-any.whl", hash = "sha256:67073e15955400952c6565cc3e707c554a4eea2e428946f7a4c162fab9bd9bcf", size = 62794 },
+]
+
+[[package]]
+name = "gitpython"
+version = "3.1.46"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "gitdb" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/df/b5/59d16470a1f0dfe8c793f9ef56fd3826093fc52b3bd96d6b9d6c26c7e27b/gitpython-3.1.46.tar.gz", hash = "sha256:400124c7d0ef4ea03f7310ac2fbf7151e09ff97f2a3288d64a440c584a29c37f", size = 215371 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/6a/09/e21df6aef1e1ffc0c816f0522ddc3f6dcded766c3261813131c78a704470/gitpython-3.1.46-py3-none-any.whl", hash = "sha256:79812ed143d9d25b6d176a10bb511de0f9c67b1fa641d82097b0ab90398a2058", size = 208620 },
+]
+
+[[package]]
+name = "hf-xet"
+version = "1.2.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/5e/6e/0f11bacf08a67f7fb5ee09740f2ca54163863b07b70d579356e9222ce5d8/hf_xet-1.2.0.tar.gz", hash = "sha256:a8c27070ca547293b6890c4bf389f713f80e8c478631432962bb7f4bc0bd7d7f", size = 506020 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/9e/a5/85ef910a0aa034a2abcfadc360ab5ac6f6bc4e9112349bd40ca97551cff0/hf_xet-1.2.0-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:ceeefcd1b7aed4956ae8499e2199607765fbd1c60510752003b6cc0b8413b649", size = 2861870 },
+ { url = "https://files.pythonhosted.org/packages/ea/40/e2e0a7eb9a51fe8828ba2d47fe22a7e74914ea8a0db68a18c3aa7449c767/hf_xet-1.2.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:b70218dd548e9840224df5638fdc94bd033552963cfa97f9170829381179c813", size = 2717584 },
+ { url = "https://files.pythonhosted.org/packages/a5/7d/daf7f8bc4594fdd59a8a596f9e3886133fdc68e675292218a5e4c1b7e834/hf_xet-1.2.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7d40b18769bb9a8bc82a9ede575ce1a44c75eb80e7375a01d76259089529b5dc", size = 3315004 },
+ { url = "https://files.pythonhosted.org/packages/b1/ba/45ea2f605fbf6d81c8b21e4d970b168b18a53515923010c312c06cd83164/hf_xet-1.2.0-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:cd3a6027d59cfb60177c12d6424e31f4b5ff13d8e3a1247b3a584bf8977e6df5", size = 3222636 },
+ { url = "https://files.pythonhosted.org/packages/4a/1d/04513e3cab8f29ab8c109d309ddd21a2705afab9d52f2ba1151e0c14f086/hf_xet-1.2.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6de1fc44f58f6dd937956c8d304d8c2dea264c80680bcfa61ca4a15e7b76780f", size = 3408448 },
+ { url = "https://files.pythonhosted.org/packages/f0/7c/60a2756d7feec7387db3a1176c632357632fbe7849fce576c5559d4520c7/hf_xet-1.2.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:f182f264ed2acd566c514e45da9f2119110e48a87a327ca271027904c70c5832", size = 3503401 },
+ { url = "https://files.pythonhosted.org/packages/4e/64/48fffbd67fb418ab07451e4ce641a70de1c40c10a13e25325e24858ebe5a/hf_xet-1.2.0-cp313-cp313t-win_amd64.whl", hash = "sha256:293a7a3787e5c95d7be1857358a9130694a9c6021de3f27fa233f37267174382", size = 2900866 },
+ { url = "https://files.pythonhosted.org/packages/e2/51/f7e2caae42f80af886db414d4e9885fac959330509089f97cccb339c6b87/hf_xet-1.2.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:10bfab528b968c70e062607f663e21e34e2bba349e8038db546646875495179e", size = 2861861 },
+ { url = "https://files.pythonhosted.org/packages/6e/1d/a641a88b69994f9371bd347f1dd35e5d1e2e2460a2e350c8d5165fc62005/hf_xet-1.2.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:2a212e842647b02eb6a911187dc878e79c4aa0aa397e88dd3b26761676e8c1f8", size = 2717699 },
+ { url = "https://files.pythonhosted.org/packages/df/e0/e5e9bba7d15f0318955f7ec3f4af13f92e773fbb368c0b8008a5acbcb12f/hf_xet-1.2.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:30e06daccb3a7d4c065f34fc26c14c74f4653069bb2b194e7f18f17cbe9939c0", size = 3314885 },
+ { url = "https://files.pythonhosted.org/packages/21/90/b7fe5ff6f2b7b8cbdf1bd56145f863c90a5807d9758a549bf3d916aa4dec/hf_xet-1.2.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:29c8fc913a529ec0a91867ce3d119ac1aac966e098cf49501800c870328cc090", size = 3221550 },
+ { url = "https://files.pythonhosted.org/packages/6f/cb/73f276f0a7ce46cc6a6ec7d6c7d61cbfe5f2e107123d9bbd0193c355f106/hf_xet-1.2.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:66e159cbfcfbb29f920db2c09ed8b660eb894640d284f102ada929b6e3dc410a", size = 3408010 },
+ { url = "https://files.pythonhosted.org/packages/b8/1e/d642a12caa78171f4be64f7cd9c40e3ca5279d055d0873188a58c0f5fbb9/hf_xet-1.2.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:9c91d5ae931510107f148874e9e2de8a16052b6f1b3ca3c1b12f15ccb491390f", size = 3503264 },
+ { url = "https://files.pythonhosted.org/packages/17/b5/33764714923fa1ff922770f7ed18c2daae034d21ae6e10dbf4347c854154/hf_xet-1.2.0-cp314-cp314t-win_amd64.whl", hash = "sha256:210d577732b519ac6ede149d2f2f34049d44e8622bf14eb3d63bbcd2d4b332dc", size = 2901071 },
+ { url = "https://files.pythonhosted.org/packages/96/2d/22338486473df5923a9ab7107d375dbef9173c338ebef5098ef593d2b560/hf_xet-1.2.0-cp37-abi3-macosx_10_12_x86_64.whl", hash = "sha256:46740d4ac024a7ca9b22bebf77460ff43332868b661186a8e46c227fdae01848", size = 2866099 },
+ { url = "https://files.pythonhosted.org/packages/7f/8c/c5becfa53234299bc2210ba314eaaae36c2875e0045809b82e40a9544f0c/hf_xet-1.2.0-cp37-abi3-macosx_11_0_arm64.whl", hash = "sha256:27df617a076420d8845bea087f59303da8be17ed7ec0cd7ee3b9b9f579dff0e4", size = 2722178 },
+ { url = "https://files.pythonhosted.org/packages/9a/92/cf3ab0b652b082e66876d08da57fcc6fa2f0e6c70dfbbafbd470bb73eb47/hf_xet-1.2.0-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3651fd5bfe0281951b988c0facbe726aa5e347b103a675f49a3fa8144c7968fd", size = 3320214 },
+ { url = "https://files.pythonhosted.org/packages/46/92/3f7ec4a1b6a65bf45b059b6d4a5d38988f63e193056de2f420137e3c3244/hf_xet-1.2.0-cp37-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:d06fa97c8562fb3ee7a378dd9b51e343bc5bc8190254202c9771029152f5e08c", size = 3229054 },
+ { url = "https://files.pythonhosted.org/packages/0b/dd/7ac658d54b9fb7999a0ccb07ad863b413cbaf5cf172f48ebcd9497ec7263/hf_xet-1.2.0-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:4c1428c9ae73ec0939410ec73023c4f842927f39db09b063b9482dac5a3bb737", size = 3413812 },
+ { url = "https://files.pythonhosted.org/packages/92/68/89ac4e5b12a9ff6286a12174c8538a5930e2ed662091dd2572bbe0a18c8a/hf_xet-1.2.0-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a55558084c16b09b5ed32ab9ed38421e2d87cf3f1f89815764d1177081b99865", size = 3508920 },
+ { url = "https://files.pythonhosted.org/packages/cb/44/870d44b30e1dcfb6a65932e3e1506c103a8a5aea9103c337e7a53180322c/hf_xet-1.2.0-cp37-abi3-win_amd64.whl", hash = "sha256:e6584a52253f72c9f52f9e549d5895ca7a471608495c4ecaa6cc73dba2b24d69", size = 2905735 },
+]
+
+[[package]]
+name = "huggingface-hub"
+version = "0.36.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "filelock" },
+ { name = "fsspec" },
+ { name = "hf-xet", marker = "platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'" },
+ { name = "packaging" },
+ { name = "pyyaml" },
+ { name = "requests" },
+ { name = "tqdm" },
+ { name = "typing-extensions" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/98/63/4910c5fa9128fdadf6a9c5ac138e8b1b6cee4ca44bf7915bbfbce4e355ee/huggingface_hub-0.36.0.tar.gz", hash = "sha256:47b3f0e2539c39bf5cde015d63b72ec49baff67b6931c3d97f3f84532e2b8d25", size = 463358 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/cb/bd/1a875e0d592d447cbc02805fd3fe0f497714d6a2583f59d14fa9ebad96eb/huggingface_hub-0.36.0-py3-none-any.whl", hash = "sha256:7bcc9ad17d5b3f07b57c78e79d527102d08313caa278a641993acddcb894548d", size = 566094 },
+]
+
+[package.optional-dependencies]
+hf-xet = [
+ { name = "hf-xet" },
+]
+
+[[package]]
+name = "identify"
+version = "2.6.15"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/ff/e7/685de97986c916a6d93b3876139e00eef26ad5bbbd61925d670ae8013449/identify-2.6.15.tar.gz", hash = "sha256:e4f4864b96c6557ef2a1e1c951771838f4edc9df3a72ec7118b338801b11c7bf", size = 99311 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/0f/1c/e5fd8f973d4f375adb21565739498e2e9a1e54c858a97b9a8ccfdc81da9b/identify-2.6.15-py2.py3-none-any.whl", hash = "sha256:1181ef7608e00704db228516541eb83a88a9f94433a8c80bb9b5bd54b1d81757", size = 99183 },
+]
+
+[[package]]
+name = "idna"
+version = "3.11"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/6f/6d/0703ccc57f3a7233505399edb88de3cbd678da106337b9fcde432b65ed60/idna-3.11.tar.gz", hash = "sha256:795dafcc9c04ed0c1fb032c2aa73654d8e8c5023a7df64a53f39190ada629902", size = 194582 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/0e/61/66938bbb5fc52dbdf84594873d5b51fb1f7c7794e9c0f5bd885f30bc507b/idna-3.11-py3-none-any.whl", hash = "sha256:771a87f49d9defaf64091e6e6fe9c18d4833f140bd19464795bc32d966ca37ea", size = 71008 },
+]
+
+[[package]]
+name = "imageio"
+version = "2.37.2"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "pillow" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/a3/6f/606be632e37bf8d05b253e8626c2291d74c691ddc7bcdf7d6aaf33b32f6a/imageio-2.37.2.tar.gz", hash = "sha256:0212ef2727ac9caa5ca4b2c75ae89454312f440a756fcfc8ef1993e718f50f8a", size = 389600 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/fb/fe/301e0936b79bcab4cacc7548bf2853fc28dced0a578bab1f7ef53c9aa75b/imageio-2.37.2-py3-none-any.whl", hash = "sha256:ad9adfb20335d718c03de457358ed69f141021a333c40a53e57273d8a5bd0b9b", size = 317646 },
+]
+
+[[package]]
+name = "imageio-ffmpeg"
+version = "0.6.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/44/bd/c3343c721f2a1b0c9fc71c1aebf1966a3b7f08c2eea8ed5437a2865611d6/imageio_ffmpeg-0.6.0.tar.gz", hash = "sha256:e2556bed8e005564a9f925bb7afa4002d82770d6b08825078b7697ab88ba1755", size = 25210 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/da/58/87ef68ac83f4c7690961bce288fd8e382bc5f1513860fc7f90a9c1c1c6bf/imageio_ffmpeg-0.6.0-py3-none-macosx_10_9_intel.macosx_10_9_x86_64.whl", hash = "sha256:9d2baaf867088508d4a3458e61eeb30e945c4ad8016025545f66c4b5aaef0a61", size = 24932969 },
+ { url = "https://files.pythonhosted.org/packages/40/5c/f3d8a657d362cc93b81aab8feda487317da5b5d31c0e1fdfd5e986e55d17/imageio_ffmpeg-0.6.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:b1ae3173414b5fc5f538a726c4e48ea97edc0d2cdc11f103afee655c463fa742", size = 21113891 },
+ { url = "https://files.pythonhosted.org/packages/33/e7/1925bfbc563c39c1d2e82501d8372734a5c725e53ac3b31b4c2d081e895b/imageio_ffmpeg-0.6.0-py3-none-manylinux2014_aarch64.whl", hash = "sha256:1d47bebd83d2c5fc770720d211855f208af8a596c82d17730aa51e815cdee6dc", size = 25632706 },
+ { url = "https://files.pythonhosted.org/packages/a0/2d/43c8522a2038e9d0e7dbdf3a61195ecc31ca576fb1527a528c877e87d973/imageio_ffmpeg-0.6.0-py3-none-manylinux2014_x86_64.whl", hash = "sha256:c7e46fcec401dd990405049d2e2f475e2b397779df2519b544b8aab515195282", size = 29498237 },
+ { url = "https://files.pythonhosted.org/packages/a0/13/59da54728351883c3c1d9fca1710ab8eee82c7beba585df8f25ca925f08f/imageio_ffmpeg-0.6.0-py3-none-win32.whl", hash = "sha256:196faa79366b4a82f95c0f4053191d2013f4714a715780f0ad2a68ff37483cc2", size = 19652251 },
+ { url = "https://files.pythonhosted.org/packages/2c/c6/fa760e12a2483469e2bf5058c5faff664acf66cadb4df2ad6205b016a73d/imageio_ffmpeg-0.6.0-py3-none-win_amd64.whl", hash = "sha256:02fa47c83703c37df6bfe4896aab339013f62bf02c5ebf2dce6da56af04ffc0a", size = 31246824 },
+]
+
+[[package]]
+name = "iniconfig"
+version = "2.3.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/72/34/14ca021ce8e5dfedc35312d08ba8bf51fdd999c576889fc2c24cb97f4f10/iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730", size = 20503 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/cb/b1/3846dd7f199d53cb17f49cba7e651e9ce294d8497c8c150530ed11865bb8/iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12", size = 7484 },
+]
+
+[[package]]
+name = "jinja2"
+version = "3.1.6"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "markupsafe" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d", size = 245115 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/62/a1/3d680cbfd5f4b8f15abc1d571870c5fc3e594bb582bc3b64ea099db13e56/jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67", size = 134899 },
+]
+
+[[package]]
+name = "lazy-loader"
+version = "0.4"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "packaging" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/6f/6b/c875b30a1ba490860c93da4cabf479e03f584eba06fe5963f6f6644653d8/lazy_loader-0.4.tar.gz", hash = "sha256:47c75182589b91a4e1a85a136c074285a5ad4d9f39c63e0d7fb76391c4574cd1", size = 15431 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/83/60/d497a310bde3f01cb805196ac61b7ad6dc5dcf8dce66634dc34364b20b4f/lazy_loader-0.4-py3-none-any.whl", hash = "sha256:342aa8e14d543a154047afb4ba8ef17f5563baad3fc610d7b15b213b0f119efc", size = 12097 },
+]
+
+[[package]]
+name = "ltx-core"
+version = "0.1.0"
+source = { editable = "packages/ltx-core" }
+dependencies = [
+ { name = "accelerate" },
+ { name = "einops" },
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "safetensors" },
+ { name = "scipy", version = "1.15.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "scipy", version = "1.16.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "torch" },
+ { name = "torchaudio" },
+ { name = "transformers" },
+]
+
+[package.optional-dependencies]
+xformers = [
+ { name = "xformers" },
+]
+
+[package.dev-dependencies]
+dev = [
+ { name = "scikit-image", version = "0.25.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "scikit-image", version = "0.26.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+]
+
+[package.metadata]
+requires-dist = [
+ { name = "accelerate" },
+ { name = "einops" },
+ { name = "numpy" },
+ { name = "safetensors" },
+ { name = "scipy", specifier = ">=1.14" },
+ { name = "torch", specifier = "~=2.7" },
+ { name = "torchaudio" },
+ { name = "transformers" },
+ { name = "xformers", marker = "extra == 'xformers'", index = "https://download.pytorch.org/whl/cu129" },
+]
+provides-extras = ["xformers"]
+
+[package.metadata.requires-dev]
+dev = [{ name = "scikit-image", specifier = ">=0.25.2" }]
+
+[[package]]
+name = "ltx-pipelines"
+version = "0.1.0"
+source = { editable = "packages/ltx-pipelines" }
+dependencies = [
+ { name = "av" },
+ { name = "ltx-core" },
+ { name = "pillow" },
+ { name = "tqdm" },
+]
+
+[package.metadata]
+requires-dist = [
+ { name = "av" },
+ { name = "ltx-core", editable = "packages/ltx-core" },
+ { name = "pillow" },
+ { name = "tqdm" },
+]
+
+[[package]]
+name = "ltx-trainer"
+version = "0.1.0"
+source = { editable = "packages/ltx-trainer" }
+dependencies = [
+ { name = "accelerate" },
+ { name = "av" },
+ { name = "bitsandbytes", marker = "sys_platform == 'linux'" },
+ { name = "huggingface-hub", extra = ["hf-xet"] },
+ { name = "imageio" },
+ { name = "imageio-ffmpeg" },
+ { name = "ltx-core" },
+ { name = "opencv-python" },
+ { name = "optimum-quanto" },
+ { name = "pandas" },
+ { name = "peft" },
+ { name = "pillow-heif" },
+ { name = "pydantic" },
+ { name = "rich" },
+ { name = "safetensors" },
+ { name = "scenedetect" },
+ { name = "sentencepiece" },
+ { name = "setuptools" },
+ { name = "torch" },
+ { name = "torchaudio" },
+ { name = "torchcodec" },
+ { name = "torchvision" },
+ { name = "typer" },
+ { name = "wandb" },
+]
+
+[package.dev-dependencies]
+dev = [
+ { name = "pre-commit" },
+ { name = "ruff" },
+]
+
+[package.metadata]
+requires-dist = [
+ { name = "accelerate", specifier = ">=1.2.1" },
+ { name = "av", specifier = ">=14.2.1" },
+ { name = "bitsandbytes", marker = "sys_platform == 'linux'", specifier = ">=0.45.2" },
+ { name = "huggingface-hub", extras = ["hf-xet"], specifier = ">=0.31.4" },
+ { name = "imageio", specifier = ">=2.37.0" },
+ { name = "imageio-ffmpeg", specifier = ">=0.6.0" },
+ { name = "ltx-core", editable = "packages/ltx-core" },
+ { name = "opencv-python", specifier = ">=4.11.0.86" },
+ { name = "optimum-quanto", specifier = ">=0.2.6" },
+ { name = "pandas", specifier = ">=2.2.3" },
+ { name = "peft", specifier = ">=0.14.0" },
+ { name = "pillow-heif", specifier = ">=0.21.0" },
+ { name = "pydantic", specifier = ">=2.10.4" },
+ { name = "rich", specifier = ">=13.9.4" },
+ { name = "safetensors", specifier = ">=0.5.0" },
+ { name = "scenedetect", specifier = ">=0.6.5.2" },
+ { name = "sentencepiece", specifier = ">=0.2.0" },
+ { name = "setuptools", specifier = ">=80.9.0" },
+ { name = "torch", specifier = ">=2.6.0" },
+ { name = "torchaudio", specifier = ">=2.9.0" },
+ { name = "torchcodec", specifier = ">=0.8.1" },
+ { name = "torchvision", specifier = ">=0.21.0" },
+ { name = "typer", specifier = ">=0.15.1" },
+ { name = "wandb", specifier = ">=0.19.11" },
+]
+
+[package.metadata.requires-dev]
+dev = [
+ { name = "pre-commit", specifier = ">=4.0.1" },
+ { name = "ruff", specifier = ">=0.8.6" },
+]
+
+[[package]]
+name = "markdown-it-py"
+version = "4.0.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "mdurl" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/5b/f5/4ec618ed16cc4f8fb3b701563655a69816155e79e24a17b651541804721d/markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3", size = 73070 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/94/54/e7d793b573f298e1c9013b8c4dade17d481164aa517d1d7148619c2cedbf/markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147", size = 87321 },
+]
+
+[[package]]
+name = "markupsafe"
+version = "3.0.3"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/7e/99/7690b6d4034fffd95959cbe0c02de8deb3098cc577c67bb6a24fe5d7caa7/markupsafe-3.0.3.tar.gz", hash = "sha256:722695808f4b6457b320fdc131280796bdceb04ab50fe1795cd540799ebe1698", size = 80313 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/e8/4b/3541d44f3937ba468b75da9eebcae497dcf67adb65caa16760b0a6807ebb/markupsafe-3.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2f981d352f04553a7171b8e44369f2af4055f888dfb147d55e42d29e29e74559", size = 11631 },
+ { url = "https://files.pythonhosted.org/packages/98/1b/fbd8eed11021cabd9226c37342fa6ca4e8a98d8188a8d9b66740494960e4/markupsafe-3.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e1c1493fb6e50ab01d20a22826e57520f1284df32f2d8601fdd90b6304601419", size = 12057 },
+ { url = "https://files.pythonhosted.org/packages/40/01/e560d658dc0bb8ab762670ece35281dec7b6c1b33f5fbc09ebb57a185519/markupsafe-3.0.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1ba88449deb3de88bd40044603fafffb7bc2b055d626a330323a9ed736661695", size = 22050 },
+ { url = "https://files.pythonhosted.org/packages/af/cd/ce6e848bbf2c32314c9b237839119c5a564a59725b53157c856e90937b7a/markupsafe-3.0.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f42d0984e947b8adf7dd6dde396e720934d12c506ce84eea8476409563607591", size = 20681 },
+ { url = "https://files.pythonhosted.org/packages/c9/2a/b5c12c809f1c3045c4d580b035a743d12fcde53cf685dbc44660826308da/markupsafe-3.0.3-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c0c0b3ade1c0b13b936d7970b1d37a57acde9199dc2aecc4c336773e1d86049c", size = 20705 },
+ { url = "https://files.pythonhosted.org/packages/cf/e3/9427a68c82728d0a88c50f890d0fc072a1484de2f3ac1ad0bfc1a7214fd5/markupsafe-3.0.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:0303439a41979d9e74d18ff5e2dd8c43ed6c6001fd40e5bf2e43f7bd9bbc523f", size = 21524 },
+ { url = "https://files.pythonhosted.org/packages/bc/36/23578f29e9e582a4d0278e009b38081dbe363c5e7165113fad546918a232/markupsafe-3.0.3-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:d2ee202e79d8ed691ceebae8e0486bd9a2cd4794cec4824e1c99b6f5009502f6", size = 20282 },
+ { url = "https://files.pythonhosted.org/packages/56/21/dca11354e756ebd03e036bd8ad58d6d7168c80ce1fe5e75218e4945cbab7/markupsafe-3.0.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:177b5253b2834fe3678cb4a5f0059808258584c559193998be2601324fdeafb1", size = 20745 },
+ { url = "https://files.pythonhosted.org/packages/87/99/faba9369a7ad6e4d10b6a5fbf71fa2a188fe4a593b15f0963b73859a1bbd/markupsafe-3.0.3-cp310-cp310-win32.whl", hash = "sha256:2a15a08b17dd94c53a1da0438822d70ebcd13f8c3a95abe3a9ef9f11a94830aa", size = 14571 },
+ { url = "https://files.pythonhosted.org/packages/d6/25/55dc3ab959917602c96985cb1253efaa4ff42f71194bddeb61eb7278b8be/markupsafe-3.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:c4ffb7ebf07cfe8931028e3e4c85f0357459a3f9f9490886198848f4fa002ec8", size = 15056 },
+ { url = "https://files.pythonhosted.org/packages/d0/9e/0a02226640c255d1da0b8d12e24ac2aa6734da68bff14c05dd53b94a0fc3/markupsafe-3.0.3-cp310-cp310-win_arm64.whl", hash = "sha256:e2103a929dfa2fcaf9bb4e7c091983a49c9ac3b19c9061b6d5427dd7d14d81a1", size = 13932 },
+ { url = "https://files.pythonhosted.org/packages/08/db/fefacb2136439fc8dd20e797950e749aa1f4997ed584c62cfb8ef7c2be0e/markupsafe-3.0.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:1cc7ea17a6824959616c525620e387f6dd30fec8cb44f649e31712db02123dad", size = 11631 },
+ { url = "https://files.pythonhosted.org/packages/e1/2e/5898933336b61975ce9dc04decbc0a7f2fee78c30353c5efba7f2d6ff27a/markupsafe-3.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4bd4cd07944443f5a265608cc6aab442e4f74dff8088b0dfc8238647b8f6ae9a", size = 12058 },
+ { url = "https://files.pythonhosted.org/packages/1d/09/adf2df3699d87d1d8184038df46a9c80d78c0148492323f4693df54e17bb/markupsafe-3.0.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6b5420a1d9450023228968e7e6a9ce57f65d148ab56d2313fcd589eee96a7a50", size = 24287 },
+ { url = "https://files.pythonhosted.org/packages/30/ac/0273f6fcb5f42e314c6d8cd99effae6a5354604d461b8d392b5ec9530a54/markupsafe-3.0.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0bf2a864d67e76e5c9a34dc26ec616a66b9888e25e7b9460e1c76d3293bd9dbf", size = 22940 },
+ { url = "https://files.pythonhosted.org/packages/19/ae/31c1be199ef767124c042c6c3e904da327a2f7f0cd63a0337e1eca2967a8/markupsafe-3.0.3-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:bc51efed119bc9cfdf792cdeaa4d67e8f6fcccab66ed4bfdd6bde3e59bfcbb2f", size = 21887 },
+ { url = "https://files.pythonhosted.org/packages/b2/76/7edcab99d5349a4532a459e1fe64f0b0467a3365056ae550d3bcf3f79e1e/markupsafe-3.0.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:068f375c472b3e7acbe2d5318dea141359e6900156b5b2ba06a30b169086b91a", size = 23692 },
+ { url = "https://files.pythonhosted.org/packages/a4/28/6e74cdd26d7514849143d69f0bf2399f929c37dc2b31e6829fd2045b2765/markupsafe-3.0.3-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:7be7b61bb172e1ed687f1754f8e7484f1c8019780f6f6b0786e76bb01c2ae115", size = 21471 },
+ { url = "https://files.pythonhosted.org/packages/62/7e/a145f36a5c2945673e590850a6f8014318d5577ed7e5920a4b3448e0865d/markupsafe-3.0.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:f9e130248f4462aaa8e2552d547f36ddadbeaa573879158d721bbd33dfe4743a", size = 22923 },
+ { url = "https://files.pythonhosted.org/packages/0f/62/d9c46a7f5c9adbeeeda52f5b8d802e1094e9717705a645efc71b0913a0a8/markupsafe-3.0.3-cp311-cp311-win32.whl", hash = "sha256:0db14f5dafddbb6d9208827849fad01f1a2609380add406671a26386cdf15a19", size = 14572 },
+ { url = "https://files.pythonhosted.org/packages/83/8a/4414c03d3f891739326e1783338e48fb49781cc915b2e0ee052aa490d586/markupsafe-3.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:de8a88e63464af587c950061a5e6a67d3632e36df62b986892331d4620a35c01", size = 15077 },
+ { url = "https://files.pythonhosted.org/packages/35/73/893072b42e6862f319b5207adc9ae06070f095b358655f077f69a35601f0/markupsafe-3.0.3-cp311-cp311-win_arm64.whl", hash = "sha256:3b562dd9e9ea93f13d53989d23a7e775fdfd1066c33494ff43f5418bc8c58a5c", size = 13876 },
+ { url = "https://files.pythonhosted.org/packages/5a/72/147da192e38635ada20e0a2e1a51cf8823d2119ce8883f7053879c2199b5/markupsafe-3.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d53197da72cc091b024dd97249dfc7794d6a56530370992a5e1a08983ad9230e", size = 11615 },
+ { url = "https://files.pythonhosted.org/packages/9a/81/7e4e08678a1f98521201c3079f77db69fb552acd56067661f8c2f534a718/markupsafe-3.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1872df69a4de6aead3491198eaf13810b565bdbeec3ae2dc8780f14458ec73ce", size = 12020 },
+ { url = "https://files.pythonhosted.org/packages/1e/2c/799f4742efc39633a1b54a92eec4082e4f815314869865d876824c257c1e/markupsafe-3.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3a7e8ae81ae39e62a41ec302f972ba6ae23a5c5396c8e60113e9066ef893da0d", size = 24332 },
+ { url = "https://files.pythonhosted.org/packages/3c/2e/8d0c2ab90a8c1d9a24f0399058ab8519a3279d1bd4289511d74e909f060e/markupsafe-3.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d6dd0be5b5b189d31db7cda48b91d7e0a9795f31430b7f271219ab30f1d3ac9d", size = 22947 },
+ { url = "https://files.pythonhosted.org/packages/2c/54/887f3092a85238093a0b2154bd629c89444f395618842e8b0c41783898ea/markupsafe-3.0.3-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:94c6f0bb423f739146aec64595853541634bde58b2135f27f61c1ffd1cd4d16a", size = 21962 },
+ { url = "https://files.pythonhosted.org/packages/c9/2f/336b8c7b6f4a4d95e91119dc8521402461b74a485558d8f238a68312f11c/markupsafe-3.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:be8813b57049a7dc738189df53d69395eba14fb99345e0a5994914a3864c8a4b", size = 23760 },
+ { url = "https://files.pythonhosted.org/packages/32/43/67935f2b7e4982ffb50a4d169b724d74b62a3964bc1a9a527f5ac4f1ee2b/markupsafe-3.0.3-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:83891d0e9fb81a825d9a6d61e3f07550ca70a076484292a70fde82c4b807286f", size = 21529 },
+ { url = "https://files.pythonhosted.org/packages/89/e0/4486f11e51bbba8b0c041098859e869e304d1c261e59244baa3d295d47b7/markupsafe-3.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:77f0643abe7495da77fb436f50f8dab76dbc6e5fd25d39589a0f1fe6548bfa2b", size = 23015 },
+ { url = "https://files.pythonhosted.org/packages/2f/e1/78ee7a023dac597a5825441ebd17170785a9dab23de95d2c7508ade94e0e/markupsafe-3.0.3-cp312-cp312-win32.whl", hash = "sha256:d88b440e37a16e651bda4c7c2b930eb586fd15ca7406cb39e211fcff3bf3017d", size = 14540 },
+ { url = "https://files.pythonhosted.org/packages/aa/5b/bec5aa9bbbb2c946ca2733ef9c4ca91c91b6a24580193e891b5f7dbe8e1e/markupsafe-3.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:26a5784ded40c9e318cfc2bdb30fe164bdb8665ded9cd64d500a34fb42067b1c", size = 15105 },
+ { url = "https://files.pythonhosted.org/packages/e5/f1/216fc1bbfd74011693a4fd837e7026152e89c4bcf3e77b6692fba9923123/markupsafe-3.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:35add3b638a5d900e807944a078b51922212fb3dedb01633a8defc4b01a3c85f", size = 13906 },
+ { url = "https://files.pythonhosted.org/packages/38/2f/907b9c7bbba283e68f20259574b13d005c121a0fa4c175f9bed27c4597ff/markupsafe-3.0.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:e1cf1972137e83c5d4c136c43ced9ac51d0e124706ee1c8aa8532c1287fa8795", size = 11622 },
+ { url = "https://files.pythonhosted.org/packages/9c/d9/5f7756922cdd676869eca1c4e3c0cd0df60ed30199ffd775e319089cb3ed/markupsafe-3.0.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:116bb52f642a37c115f517494ea5feb03889e04df47eeff5b130b1808ce7c219", size = 12029 },
+ { url = "https://files.pythonhosted.org/packages/00/07/575a68c754943058c78f30db02ee03a64b3c638586fba6a6dd56830b30a3/markupsafe-3.0.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:133a43e73a802c5562be9bbcd03d090aa5a1fe899db609c29e8c8d815c5f6de6", size = 24374 },
+ { url = "https://files.pythonhosted.org/packages/a9/21/9b05698b46f218fc0e118e1f8168395c65c8a2c750ae2bab54fc4bd4e0e8/markupsafe-3.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ccfcd093f13f0f0b7fdd0f198b90053bf7b2f02a3927a30e63f3ccc9df56b676", size = 22980 },
+ { url = "https://files.pythonhosted.org/packages/7f/71/544260864f893f18b6827315b988c146b559391e6e7e8f7252839b1b846a/markupsafe-3.0.3-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:509fa21c6deb7a7a273d629cf5ec029bc209d1a51178615ddf718f5918992ab9", size = 21990 },
+ { url = "https://files.pythonhosted.org/packages/c2/28/b50fc2f74d1ad761af2f5dcce7492648b983d00a65b8c0e0cb457c82ebbe/markupsafe-3.0.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4afe79fb3de0b7097d81da19090f4df4f8d3a2b3adaa8764138aac2e44f3af1", size = 23784 },
+ { url = "https://files.pythonhosted.org/packages/ed/76/104b2aa106a208da8b17a2fb72e033a5a9d7073c68f7e508b94916ed47a9/markupsafe-3.0.3-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:795e7751525cae078558e679d646ae45574b47ed6e7771863fcc079a6171a0fc", size = 21588 },
+ { url = "https://files.pythonhosted.org/packages/b5/99/16a5eb2d140087ebd97180d95249b00a03aa87e29cc224056274f2e45fd6/markupsafe-3.0.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:8485f406a96febb5140bfeca44a73e3ce5116b2501ac54fe953e488fb1d03b12", size = 23041 },
+ { url = "https://files.pythonhosted.org/packages/19/bc/e7140ed90c5d61d77cea142eed9f9c303f4c4806f60a1044c13e3f1471d0/markupsafe-3.0.3-cp313-cp313-win32.whl", hash = "sha256:bdd37121970bfd8be76c5fb069c7751683bdf373db1ed6c010162b2a130248ed", size = 14543 },
+ { url = "https://files.pythonhosted.org/packages/05/73/c4abe620b841b6b791f2edc248f556900667a5a1cf023a6646967ae98335/markupsafe-3.0.3-cp313-cp313-win_amd64.whl", hash = "sha256:9a1abfdc021a164803f4d485104931fb8f8c1efd55bc6b748d2f5774e78b62c5", size = 15113 },
+ { url = "https://files.pythonhosted.org/packages/f0/3a/fa34a0f7cfef23cf9500d68cb7c32dd64ffd58a12b09225fb03dd37d5b80/markupsafe-3.0.3-cp313-cp313-win_arm64.whl", hash = "sha256:7e68f88e5b8799aa49c85cd116c932a1ac15caaa3f5db09087854d218359e485", size = 13911 },
+ { url = "https://files.pythonhosted.org/packages/e4/d7/e05cd7efe43a88a17a37b3ae96e79a19e846f3f456fe79c57ca61356ef01/markupsafe-3.0.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:218551f6df4868a8d527e3062d0fb968682fe92054e89978594c28e642c43a73", size = 11658 },
+ { url = "https://files.pythonhosted.org/packages/99/9e/e412117548182ce2148bdeacdda3bb494260c0b0184360fe0d56389b523b/markupsafe-3.0.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:3524b778fe5cfb3452a09d31e7b5adefeea8c5be1d43c4f810ba09f2ceb29d37", size = 12066 },
+ { url = "https://files.pythonhosted.org/packages/bc/e6/fa0ffcda717ef64a5108eaa7b4f5ed28d56122c9a6d70ab8b72f9f715c80/markupsafe-3.0.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4e885a3d1efa2eadc93c894a21770e4bc67899e3543680313b09f139e149ab19", size = 25639 },
+ { url = "https://files.pythonhosted.org/packages/96/ec/2102e881fe9d25fc16cb4b25d5f5cde50970967ffa5dddafdb771237062d/markupsafe-3.0.3-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8709b08f4a89aa7586de0aadc8da56180242ee0ada3999749b183aa23df95025", size = 23569 },
+ { url = "https://files.pythonhosted.org/packages/4b/30/6f2fce1f1f205fc9323255b216ca8a235b15860c34b6798f810f05828e32/markupsafe-3.0.3-cp313-cp313t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b8512a91625c9b3da6f127803b166b629725e68af71f8184ae7e7d54686a56d6", size = 23284 },
+ { url = "https://files.pythonhosted.org/packages/58/47/4a0ccea4ab9f5dcb6f79c0236d954acb382202721e704223a8aafa38b5c8/markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:9b79b7a16f7fedff2495d684f2b59b0457c3b493778c9eed31111be64d58279f", size = 24801 },
+ { url = "https://files.pythonhosted.org/packages/6a/70/3780e9b72180b6fecb83a4814d84c3bf4b4ae4bf0b19c27196104149734c/markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_riscv64.whl", hash = "sha256:12c63dfb4a98206f045aa9563db46507995f7ef6d83b2f68eda65c307c6829eb", size = 22769 },
+ { url = "https://files.pythonhosted.org/packages/98/c5/c03c7f4125180fc215220c035beac6b9cb684bc7a067c84fc69414d315f5/markupsafe-3.0.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:8f71bc33915be5186016f675cd83a1e08523649b0e33efdb898db577ef5bb009", size = 23642 },
+ { url = "https://files.pythonhosted.org/packages/80/d6/2d1b89f6ca4bff1036499b1e29a1d02d282259f3681540e16563f27ebc23/markupsafe-3.0.3-cp313-cp313t-win32.whl", hash = "sha256:69c0b73548bc525c8cb9a251cddf1931d1db4d2258e9599c28c07ef3580ef354", size = 14612 },
+ { url = "https://files.pythonhosted.org/packages/2b/98/e48a4bfba0a0ffcf9925fe2d69240bfaa19c6f7507b8cd09c70684a53c1e/markupsafe-3.0.3-cp313-cp313t-win_amd64.whl", hash = "sha256:1b4b79e8ebf6b55351f0d91fe80f893b4743f104bff22e90697db1590e47a218", size = 15200 },
+ { url = "https://files.pythonhosted.org/packages/0e/72/e3cc540f351f316e9ed0f092757459afbc595824ca724cbc5a5d4263713f/markupsafe-3.0.3-cp313-cp313t-win_arm64.whl", hash = "sha256:ad2cf8aa28b8c020ab2fc8287b0f823d0a7d8630784c31e9ee5edea20f406287", size = 13973 },
+ { url = "https://files.pythonhosted.org/packages/33/8a/8e42d4838cd89b7dde187011e97fe6c3af66d8c044997d2183fbd6d31352/markupsafe-3.0.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:eaa9599de571d72e2daf60164784109f19978b327a3910d3e9de8c97b5b70cfe", size = 11619 },
+ { url = "https://files.pythonhosted.org/packages/b5/64/7660f8a4a8e53c924d0fa05dc3a55c9cee10bbd82b11c5afb27d44b096ce/markupsafe-3.0.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c47a551199eb8eb2121d4f0f15ae0f923d31350ab9280078d1e5f12b249e0026", size = 12029 },
+ { url = "https://files.pythonhosted.org/packages/da/ef/e648bfd021127bef5fa12e1720ffed0c6cbb8310c8d9bea7266337ff06de/markupsafe-3.0.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f34c41761022dd093b4b6896d4810782ffbabe30f2d443ff5f083e0cbbb8c737", size = 24408 },
+ { url = "https://files.pythonhosted.org/packages/41/3c/a36c2450754618e62008bf7435ccb0f88053e07592e6028a34776213d877/markupsafe-3.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:457a69a9577064c05a97c41f4e65148652db078a3a509039e64d3467b9e7ef97", size = 23005 },
+ { url = "https://files.pythonhosted.org/packages/bc/20/b7fdf89a8456b099837cd1dc21974632a02a999ec9bf7ca3e490aacd98e7/markupsafe-3.0.3-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:e8afc3f2ccfa24215f8cb28dcf43f0113ac3c37c2f0f0806d8c70e4228c5cf4d", size = 22048 },
+ { url = "https://files.pythonhosted.org/packages/9a/a7/591f592afdc734f47db08a75793a55d7fbcc6902a723ae4cfbab61010cc5/markupsafe-3.0.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:ec15a59cf5af7be74194f7ab02d0f59a62bdcf1a537677ce67a2537c9b87fcda", size = 23821 },
+ { url = "https://files.pythonhosted.org/packages/7d/33/45b24e4f44195b26521bc6f1a82197118f74df348556594bd2262bda1038/markupsafe-3.0.3-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:0eb9ff8191e8498cca014656ae6b8d61f39da5f95b488805da4bb029cccbfbaf", size = 21606 },
+ { url = "https://files.pythonhosted.org/packages/ff/0e/53dfaca23a69fbfbbf17a4b64072090e70717344c52eaaaa9c5ddff1e5f0/markupsafe-3.0.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:2713baf880df847f2bece4230d4d094280f4e67b1e813eec43b4c0e144a34ffe", size = 23043 },
+ { url = "https://files.pythonhosted.org/packages/46/11/f333a06fc16236d5238bfe74daccbca41459dcd8d1fa952e8fbd5dccfb70/markupsafe-3.0.3-cp314-cp314-win32.whl", hash = "sha256:729586769a26dbceff69f7a7dbbf59ab6572b99d94576a5592625d5b411576b9", size = 14747 },
+ { url = "https://files.pythonhosted.org/packages/28/52/182836104b33b444e400b14f797212f720cbc9ed6ba34c800639d154e821/markupsafe-3.0.3-cp314-cp314-win_amd64.whl", hash = "sha256:bdc919ead48f234740ad807933cdf545180bfbe9342c2bb451556db2ed958581", size = 15341 },
+ { url = "https://files.pythonhosted.org/packages/6f/18/acf23e91bd94fd7b3031558b1f013adfa21a8e407a3fdb32745538730382/markupsafe-3.0.3-cp314-cp314-win_arm64.whl", hash = "sha256:5a7d5dc5140555cf21a6fefbdbf8723f06fcd2f63ef108f2854de715e4422cb4", size = 14073 },
+ { url = "https://files.pythonhosted.org/packages/3c/f0/57689aa4076e1b43b15fdfa646b04653969d50cf30c32a102762be2485da/markupsafe-3.0.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:1353ef0c1b138e1907ae78e2f6c63ff67501122006b0f9abad68fda5f4ffc6ab", size = 11661 },
+ { url = "https://files.pythonhosted.org/packages/89/c3/2e67a7ca217c6912985ec766c6393b636fb0c2344443ff9d91404dc4c79f/markupsafe-3.0.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:1085e7fbddd3be5f89cc898938f42c0b3c711fdcb37d75221de2666af647c175", size = 12069 },
+ { url = "https://files.pythonhosted.org/packages/f0/00/be561dce4e6ca66b15276e184ce4b8aec61fe83662cce2f7d72bd3249d28/markupsafe-3.0.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1b52b4fb9df4eb9ae465f8d0c228a00624de2334f216f178a995ccdcf82c4634", size = 25670 },
+ { url = "https://files.pythonhosted.org/packages/50/09/c419f6f5a92e5fadde27efd190eca90f05e1261b10dbd8cbcb39cd8ea1dc/markupsafe-3.0.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fed51ac40f757d41b7c48425901843666a6677e3e8eb0abcff09e4ba6e664f50", size = 23598 },
+ { url = "https://files.pythonhosted.org/packages/22/44/a0681611106e0b2921b3033fc19bc53323e0b50bc70cffdd19f7d679bb66/markupsafe-3.0.3-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f190daf01f13c72eac4efd5c430a8de82489d9cff23c364c3ea822545032993e", size = 23261 },
+ { url = "https://files.pythonhosted.org/packages/5f/57/1b0b3f100259dc9fffe780cfb60d4be71375510e435efec3d116b6436d43/markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:e56b7d45a839a697b5eb268c82a71bd8c7f6c94d6fd50c3d577fa39a9f1409f5", size = 24835 },
+ { url = "https://files.pythonhosted.org/packages/26/6a/4bf6d0c97c4920f1597cc14dd720705eca0bf7c787aebc6bb4d1bead5388/markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:f3e98bb3798ead92273dc0e5fd0f31ade220f59a266ffd8a4f6065e0a3ce0523", size = 22733 },
+ { url = "https://files.pythonhosted.org/packages/14/c7/ca723101509b518797fedc2fdf79ba57f886b4aca8a7d31857ba3ee8281f/markupsafe-3.0.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:5678211cb9333a6468fb8d8be0305520aa073f50d17f089b5b4b477ea6e67fdc", size = 23672 },
+ { url = "https://files.pythonhosted.org/packages/fb/df/5bd7a48c256faecd1d36edc13133e51397e41b73bb77e1a69deab746ebac/markupsafe-3.0.3-cp314-cp314t-win32.whl", hash = "sha256:915c04ba3851909ce68ccc2b8e2cd691618c4dc4c4232fb7982bca3f41fd8c3d", size = 14819 },
+ { url = "https://files.pythonhosted.org/packages/1a/8a/0402ba61a2f16038b48b39bccca271134be00c5c9f0f623208399333c448/markupsafe-3.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4faffd047e07c38848ce017e8725090413cd80cbc23d86e55c587bf979e579c9", size = 15426 },
+ { url = "https://files.pythonhosted.org/packages/70/bc/6f1c2f612465f5fa89b95bead1f44dcb607670fd42891d8fdcd5d039f4f4/markupsafe-3.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:32001d6a8fc98c8cb5c947787c5d08b0a50663d139f1305bac5885d98d9b40fa", size = 14146 },
+]
+
+[[package]]
+name = "mdurl"
+version = "0.1.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979 },
+]
+
+[[package]]
+name = "mpmath"
+version = "1.3.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/e0/47/dd32fa426cc72114383ac549964eecb20ecfd886d1e5ccf5340b55b02f57/mpmath-1.3.0.tar.gz", hash = "sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f", size = 508106 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/43/e3/7d92a15f894aa0c9c4b49b8ee9ac9850d6e63b03c9c32c0367a13ae62209/mpmath-1.3.0-py3-none-any.whl", hash = "sha256:a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c", size = 536198 },
+]
+
+[[package]]
+name = "networkx"
+version = "3.4.2"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version < '3.11' and sys_platform == 'darwin'",
+ "python_full_version < '3.11' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+sdist = { url = "https://files.pythonhosted.org/packages/fd/1d/06475e1cd5264c0b870ea2cc6fdb3e37177c1e565c43f56ff17a10e3937f/networkx-3.4.2.tar.gz", hash = "sha256:307c3669428c5362aab27c8a1260aa8f47c4e91d3891f48be0141738d8d053e1", size = 2151368 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/b9/54/dd730b32ea14ea797530a4479b2ed46a6fb250f682a9cfb997e968bf0261/networkx-3.4.2-py3-none-any.whl", hash = "sha256:df5d4365b724cf81b8c6a7312509d0c22386097011ad1abe274afd5e9d3bbc5f", size = 1723263 },
+]
+
+[[package]]
+name = "networkx"
+version = "3.6.1"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version >= '3.12' and sys_platform == 'darwin'",
+ "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux'",
+ "python_full_version == '3.11.*' and sys_platform == 'darwin'",
+ "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+sdist = { url = "https://files.pythonhosted.org/packages/6a/51/63fe664f3908c97be9d2e4f1158eb633317598cfa6e1fc14af5383f17512/networkx-3.6.1.tar.gz", hash = "sha256:26b7c357accc0c8cde558ad486283728b65b6a95d85ee1cd66bafab4c8168509", size = 2517025 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/9e/c9/b2622292ea83fbb4ec318f5b9ab867d0a28ab43c5717bb85b0a5f6b3b0a4/networkx-3.6.1-py3-none-any.whl", hash = "sha256:d47fbf302e7d9cbbb9e2555a0d267983d2aa476bac30e90dfbe5669bd57f3762", size = 2068504 },
+]
+
+[[package]]
+name = "ninja"
+version = "1.13.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/43/73/79a0b22fc731989c708068427579e840a6cf4e937fe7ae5c5d0b7356ac22/ninja-1.13.0.tar.gz", hash = "sha256:4a40ce995ded54d9dc24f8ea37ff3bf62ad192b547f6c7126e7e25045e76f978", size = 242558 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/3c/74/d02409ed2aa865e051b7edda22ad416a39d81a84980f544f8de717cab133/ninja-1.13.0-py3-none-macosx_10_9_universal2.whl", hash = "sha256:fa2a8bfc62e31b08f83127d1613d10821775a0eb334197154c4d6067b7068ff1", size = 310125 },
+ { url = "https://files.pythonhosted.org/packages/8e/de/6e1cd6b84b412ac1ef327b76f0641aeb5dcc01e9d3f9eee0286d0c34fd93/ninja-1.13.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:3d00c692fb717fd511abeb44b8c5d00340c36938c12d6538ba989fe764e79630", size = 177467 },
+ { url = "https://files.pythonhosted.org/packages/c8/83/49320fb6e58ae3c079381e333575fdbcf1cca3506ee160a2dcce775046fa/ninja-1.13.0-py3-none-manylinux2014_i686.manylinux_2_17_i686.whl", hash = "sha256:be7f478ff9f96a128b599a964fc60a6a87b9fa332ee1bd44fa243ac88d50291c", size = 187834 },
+ { url = "https://files.pythonhosted.org/packages/56/c7/ba22748fb59f7f896b609cd3e568d28a0a367a6d953c24c461fe04fc4433/ninja-1.13.0-py3-none-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:60056592cf495e9a6a4bea3cd178903056ecb0943e4de45a2ea825edb6dc8d3e", size = 202736 },
+ { url = "https://files.pythonhosted.org/packages/79/22/d1de07632b78ac8e6b785f41fa9aad7a978ec8c0a1bf15772def36d77aac/ninja-1.13.0-py3-none-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:1c97223cdda0417f414bf864cfb73b72d8777e57ebb279c5f6de368de0062988", size = 179034 },
+ { url = "https://files.pythonhosted.org/packages/ed/de/0e6edf44d6a04dabd0318a519125ed0415ce437ad5a1ec9b9be03d9048cf/ninja-1.13.0-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:fb46acf6b93b8dd0322adc3a4945452a4e774b75b91293bafcc7b7f8e6517dfa", size = 180716 },
+ { url = "https://files.pythonhosted.org/packages/54/28/938b562f9057aaa4d6bfbeaa05e81899a47aebb3ba6751e36c027a7f5ff7/ninja-1.13.0-py3-none-manylinux_2_28_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:4be9c1b082d244b1ad7ef41eb8ab088aae8c109a9f3f0b3e56a252d3e00f42c1", size = 146843 },
+ { url = "https://files.pythonhosted.org/packages/2a/fb/d06a3838de4f8ab866e44ee52a797b5491df823901c54943b2adb0389fbb/ninja-1.13.0-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:6739d3352073341ad284246f81339a384eec091d9851a886dfa5b00a6d48b3e2", size = 154402 },
+ { url = "https://files.pythonhosted.org/packages/31/bf/0d7808af695ceddc763cf251b84a9892cd7f51622dc8b4c89d5012779f06/ninja-1.13.0-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:11be2d22027bde06f14c343f01d31446747dbb51e72d00decca2eb99be911e2f", size = 552388 },
+ { url = "https://files.pythonhosted.org/packages/9d/70/c99d0c2c809f992752453cce312848abb3b1607e56d4cd1b6cded317351a/ninja-1.13.0-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:aa45b4037b313c2f698bc13306239b8b93b4680eb47e287773156ac9e9304714", size = 472501 },
+ { url = "https://files.pythonhosted.org/packages/9f/43/c217b1153f0e499652f5e0766da8523ce3480f0a951039c7af115e224d55/ninja-1.13.0-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5f8e1e8a1a30835eeb51db05cf5a67151ad37542f5a4af2a438e9490915e5b72", size = 638280 },
+ { url = "https://files.pythonhosted.org/packages/8c/45/9151bba2c8d0ae2b6260f71696330590de5850e5574b7b5694dce6023e20/ninja-1.13.0-py3-none-musllinux_1_2_ppc64le.whl", hash = "sha256:3d7d7779d12cb20c6d054c61b702139fd23a7a964ec8f2c823f1ab1b084150db", size = 642420 },
+ { url = "https://files.pythonhosted.org/packages/3c/fb/95752eb635bb8ad27d101d71bef15bc63049de23f299e312878fc21cb2da/ninja-1.13.0-py3-none-musllinux_1_2_riscv64.whl", hash = "sha256:d741a5e6754e0bda767e3274a0f0deeef4807f1fec6c0d7921a0244018926ae5", size = 585106 },
+ { url = "https://files.pythonhosted.org/packages/c1/31/aa56a1a286703800c0cbe39fb4e82811c277772dc8cd084f442dd8e2938a/ninja-1.13.0-py3-none-musllinux_1_2_s390x.whl", hash = "sha256:e8bad11f8a00b64137e9b315b137d8bb6cbf3086fbdc43bf1f90fd33324d2e96", size = 707138 },
+ { url = "https://files.pythonhosted.org/packages/34/6f/5f5a54a1041af945130abdb2b8529cbef0cdcbbf9bcf3f4195378319d29a/ninja-1.13.0-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:b4f2a072db3c0f944c32793e91532d8948d20d9ab83da9c0c7c15b5768072200", size = 581758 },
+ { url = "https://files.pythonhosted.org/packages/95/97/51359c77527d45943fe7a94d00a3843b81162e6c4244b3579fe8fc54cb9c/ninja-1.13.0-py3-none-win32.whl", hash = "sha256:8cfbb80b4a53456ae8a39f90ae3d7a2129f45ea164f43fadfa15dc38c4aef1c9", size = 267201 },
+ { url = "https://files.pythonhosted.org/packages/29/45/c0adfbfb0b5895aa18cec400c535b4f7ff3e52536e0403602fc1a23f7de9/ninja-1.13.0-py3-none-win_amd64.whl", hash = "sha256:fb8ee8719f8af47fed145cced4a85f0755dd55d45b2bddaf7431fa89803c5f3e", size = 309975 },
+ { url = "https://files.pythonhosted.org/packages/df/93/a7b983643d1253bb223234b5b226e69de6cda02b76cdca7770f684b795f5/ninja-1.13.0-py3-none-win_arm64.whl", hash = "sha256:3c0b40b1f0bba764644385319028650087b4c1b18cdfa6f45cb39a3669b81aa9", size = 290806 },
+]
+
+[[package]]
+name = "nodeenv"
+version = "1.10.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/24/bf/d1bda4f6168e0b2e9e5958945e01910052158313224ada5ce1fb2e1113b8/nodeenv-1.10.0.tar.gz", hash = "sha256:996c191ad80897d076bdfba80a41994c2b47c68e224c542b48feba42ba00f8bb", size = 55611 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/88/b2/d0896bdcdc8d28a7fc5717c305f1a861c26e18c05047949fb371034d98bd/nodeenv-1.10.0-py2.py3-none-any.whl", hash = "sha256:5bb13e3eed2923615535339b3c620e76779af4cb4c6a90deccc9e36b274d3827", size = 23438 },
+]
+
+[[package]]
+name = "numpy"
+version = "2.2.6"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version < '3.11' and sys_platform == 'darwin'",
+ "python_full_version < '3.11' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+sdist = { url = "https://files.pythonhosted.org/packages/76/21/7d2a95e4bba9dc13d043ee156a356c0a8f0c6309dff6b21b4d71a073b8a8/numpy-2.2.6.tar.gz", hash = "sha256:e29554e2bef54a90aa5cc07da6ce955accb83f21ab5de01a62c8478897b264fd", size = 20276440 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/9a/3e/ed6db5be21ce87955c0cbd3009f2803f59fa08df21b5df06862e2d8e2bdd/numpy-2.2.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b412caa66f72040e6d268491a59f2c43bf03eb6c96dd8f0307829feb7fa2b6fb", size = 21165245 },
+ { url = "https://files.pythonhosted.org/packages/22/c2/4b9221495b2a132cc9d2eb862e21d42a009f5a60e45fc44b00118c174bff/numpy-2.2.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e41fd67c52b86603a91c1a505ebaef50b3314de0213461c7a6e99c9a3beff90", size = 14360048 },
+ { url = "https://files.pythonhosted.org/packages/fd/77/dc2fcfc66943c6410e2bf598062f5959372735ffda175b39906d54f02349/numpy-2.2.6-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:37e990a01ae6ec7fe7fa1c26c55ecb672dd98b19c3d0e1d1f326fa13cb38d163", size = 5340542 },
+ { url = "https://files.pythonhosted.org/packages/7a/4f/1cb5fdc353a5f5cc7feb692db9b8ec2c3d6405453f982435efc52561df58/numpy-2.2.6-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:5a6429d4be8ca66d889b7cf70f536a397dc45ba6faeb5f8c5427935d9592e9cf", size = 6878301 },
+ { url = "https://files.pythonhosted.org/packages/eb/17/96a3acd228cec142fcb8723bd3cc39c2a474f7dcf0a5d16731980bcafa95/numpy-2.2.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:efd28d4e9cd7d7a8d39074a4d44c63eda73401580c5c76acda2ce969e0a38e83", size = 14297320 },
+ { url = "https://files.pythonhosted.org/packages/b4/63/3de6a34ad7ad6646ac7d2f55ebc6ad439dbbf9c4370017c50cf403fb19b5/numpy-2.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc7b73d02efb0e18c000e9ad8b83480dfcd5dfd11065997ed4c6747470ae8915", size = 16801050 },
+ { url = "https://files.pythonhosted.org/packages/07/b6/89d837eddef52b3d0cec5c6ba0456c1bf1b9ef6a6672fc2b7873c3ec4e2e/numpy-2.2.6-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:74d4531beb257d2c3f4b261bfb0fc09e0f9ebb8842d82a7b4209415896adc680", size = 15807034 },
+ { url = "https://files.pythonhosted.org/packages/01/c8/dc6ae86e3c61cfec1f178e5c9f7858584049b6093f843bca541f94120920/numpy-2.2.6-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8fc377d995680230e83241d8a96def29f204b5782f371c532579b4f20607a289", size = 18614185 },
+ { url = "https://files.pythonhosted.org/packages/5b/c5/0064b1b7e7c89137b471ccec1fd2282fceaae0ab3a9550f2568782d80357/numpy-2.2.6-cp310-cp310-win32.whl", hash = "sha256:b093dd74e50a8cba3e873868d9e93a85b78e0daf2e98c6797566ad8044e8363d", size = 6527149 },
+ { url = "https://files.pythonhosted.org/packages/a3/dd/4b822569d6b96c39d1215dbae0582fd99954dcbcf0c1a13c61783feaca3f/numpy-2.2.6-cp310-cp310-win_amd64.whl", hash = "sha256:f0fd6321b839904e15c46e0d257fdd101dd7f530fe03fd6359c1ea63738703f3", size = 12904620 },
+ { url = "https://files.pythonhosted.org/packages/da/a8/4f83e2aa666a9fbf56d6118faaaf5f1974d456b1823fda0a176eff722839/numpy-2.2.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f9f1adb22318e121c5c69a09142811a201ef17ab257a1e66ca3025065b7f53ae", size = 21176963 },
+ { url = "https://files.pythonhosted.org/packages/b3/2b/64e1affc7972decb74c9e29e5649fac940514910960ba25cd9af4488b66c/numpy-2.2.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c820a93b0255bc360f53eca31a0e676fd1101f673dda8da93454a12e23fc5f7a", size = 14406743 },
+ { url = "https://files.pythonhosted.org/packages/4a/9f/0121e375000b5e50ffdd8b25bf78d8e1a5aa4cca3f185d41265198c7b834/numpy-2.2.6-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:3d70692235e759f260c3d837193090014aebdf026dfd167834bcba43e30c2a42", size = 5352616 },
+ { url = "https://files.pythonhosted.org/packages/31/0d/b48c405c91693635fbe2dcd7bc84a33a602add5f63286e024d3b6741411c/numpy-2.2.6-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:481b49095335f8eed42e39e8041327c05b0f6f4780488f61286ed3c01368d491", size = 6889579 },
+ { url = "https://files.pythonhosted.org/packages/52/b8/7f0554d49b565d0171eab6e99001846882000883998e7b7d9f0d98b1f934/numpy-2.2.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b64d8d4d17135e00c8e346e0a738deb17e754230d7e0810ac5012750bbd85a5a", size = 14312005 },
+ { url = "https://files.pythonhosted.org/packages/b3/dd/2238b898e51bd6d389b7389ffb20d7f4c10066d80351187ec8e303a5a475/numpy-2.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba10f8411898fc418a521833e014a77d3ca01c15b0c6cdcce6a0d2897e6dbbdf", size = 16821570 },
+ { url = "https://files.pythonhosted.org/packages/83/6c/44d0325722cf644f191042bf47eedad61c1e6df2432ed65cbe28509d404e/numpy-2.2.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bd48227a919f1bafbdda0583705e547892342c26fb127219d60a5c36882609d1", size = 15818548 },
+ { url = "https://files.pythonhosted.org/packages/ae/9d/81e8216030ce66be25279098789b665d49ff19eef08bfa8cb96d4957f422/numpy-2.2.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9551a499bf125c1d4f9e250377c1ee2eddd02e01eac6644c080162c0c51778ab", size = 18620521 },
+ { url = "https://files.pythonhosted.org/packages/6a/fd/e19617b9530b031db51b0926eed5345ce8ddc669bb3bc0044b23e275ebe8/numpy-2.2.6-cp311-cp311-win32.whl", hash = "sha256:0678000bb9ac1475cd454c6b8c799206af8107e310843532b04d49649c717a47", size = 6525866 },
+ { url = "https://files.pythonhosted.org/packages/31/0a/f354fb7176b81747d870f7991dc763e157a934c717b67b58456bc63da3df/numpy-2.2.6-cp311-cp311-win_amd64.whl", hash = "sha256:e8213002e427c69c45a52bbd94163084025f533a55a59d6f9c5b820774ef3303", size = 12907455 },
+ { url = "https://files.pythonhosted.org/packages/82/5d/c00588b6cf18e1da539b45d3598d3557084990dcc4331960c15ee776ee41/numpy-2.2.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:41c5a21f4a04fa86436124d388f6ed60a9343a6f767fced1a8a71c3fbca038ff", size = 20875348 },
+ { url = "https://files.pythonhosted.org/packages/66/ee/560deadcdde6c2f90200450d5938f63a34b37e27ebff162810f716f6a230/numpy-2.2.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:de749064336d37e340f640b05f24e9e3dd678c57318c7289d222a8a2f543e90c", size = 14119362 },
+ { url = "https://files.pythonhosted.org/packages/3c/65/4baa99f1c53b30adf0acd9a5519078871ddde8d2339dc5a7fde80d9d87da/numpy-2.2.6-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:894b3a42502226a1cac872f840030665f33326fc3dac8e57c607905773cdcde3", size = 5084103 },
+ { url = "https://files.pythonhosted.org/packages/cc/89/e5a34c071a0570cc40c9a54eb472d113eea6d002e9ae12bb3a8407fb912e/numpy-2.2.6-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:71594f7c51a18e728451bb50cc60a3ce4e6538822731b2933209a1f3614e9282", size = 6625382 },
+ { url = "https://files.pythonhosted.org/packages/f8/35/8c80729f1ff76b3921d5c9487c7ac3de9b2a103b1cd05e905b3090513510/numpy-2.2.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f2618db89be1b4e05f7a1a847a9c1c0abd63e63a1607d892dd54668dd92faf87", size = 14018462 },
+ { url = "https://files.pythonhosted.org/packages/8c/3d/1e1db36cfd41f895d266b103df00ca5b3cbe965184df824dec5c08c6b803/numpy-2.2.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd83c01228a688733f1ded5201c678f0c53ecc1006ffbc404db9f7a899ac6249", size = 16527618 },
+ { url = "https://files.pythonhosted.org/packages/61/c6/03ed30992602c85aa3cd95b9070a514f8b3c33e31124694438d88809ae36/numpy-2.2.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:37c0ca431f82cd5fa716eca9506aefcabc247fb27ba69c5062a6d3ade8cf8f49", size = 15505511 },
+ { url = "https://files.pythonhosted.org/packages/b7/25/5761d832a81df431e260719ec45de696414266613c9ee268394dd5ad8236/numpy-2.2.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:fe27749d33bb772c80dcd84ae7e8df2adc920ae8297400dabec45f0dedb3f6de", size = 18313783 },
+ { url = "https://files.pythonhosted.org/packages/57/0a/72d5a3527c5ebffcd47bde9162c39fae1f90138c961e5296491ce778e682/numpy-2.2.6-cp312-cp312-win32.whl", hash = "sha256:4eeaae00d789f66c7a25ac5f34b71a7035bb474e679f410e5e1a94deb24cf2d4", size = 6246506 },
+ { url = "https://files.pythonhosted.org/packages/36/fa/8c9210162ca1b88529ab76b41ba02d433fd54fecaf6feb70ef9f124683f1/numpy-2.2.6-cp312-cp312-win_amd64.whl", hash = "sha256:c1f9540be57940698ed329904db803cf7a402f3fc200bfe599334c9bd84a40b2", size = 12614190 },
+ { url = "https://files.pythonhosted.org/packages/f9/5c/6657823f4f594f72b5471f1db1ab12e26e890bb2e41897522d134d2a3e81/numpy-2.2.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:0811bb762109d9708cca4d0b13c4f67146e3c3b7cf8d34018c722adb2d957c84", size = 20867828 },
+ { url = "https://files.pythonhosted.org/packages/dc/9e/14520dc3dadf3c803473bd07e9b2bd1b69bc583cb2497b47000fed2fa92f/numpy-2.2.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:287cc3162b6f01463ccd86be154f284d0893d2b3ed7292439ea97eafa8170e0b", size = 14143006 },
+ { url = "https://files.pythonhosted.org/packages/4f/06/7e96c57d90bebdce9918412087fc22ca9851cceaf5567a45c1f404480e9e/numpy-2.2.6-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:f1372f041402e37e5e633e586f62aa53de2eac8d98cbfb822806ce4bbefcb74d", size = 5076765 },
+ { url = "https://files.pythonhosted.org/packages/73/ed/63d920c23b4289fdac96ddbdd6132e9427790977d5457cd132f18e76eae0/numpy-2.2.6-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:55a4d33fa519660d69614a9fad433be87e5252f4b03850642f88993f7b2ca566", size = 6617736 },
+ { url = "https://files.pythonhosted.org/packages/85/c5/e19c8f99d83fd377ec8c7e0cf627a8049746da54afc24ef0a0cb73d5dfb5/numpy-2.2.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f92729c95468a2f4f15e9bb94c432a9229d0d50de67304399627a943201baa2f", size = 14010719 },
+ { url = "https://files.pythonhosted.org/packages/19/49/4df9123aafa7b539317bf6d342cb6d227e49f7a35b99c287a6109b13dd93/numpy-2.2.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1bc23a79bfabc5d056d106f9befb8d50c31ced2fbc70eedb8155aec74a45798f", size = 16526072 },
+ { url = "https://files.pythonhosted.org/packages/b2/6c/04b5f47f4f32f7c2b0e7260442a8cbcf8168b0e1a41ff1495da42f42a14f/numpy-2.2.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e3143e4451880bed956e706a3220b4e5cf6172ef05fcc397f6f36a550b1dd868", size = 15503213 },
+ { url = "https://files.pythonhosted.org/packages/17/0a/5cd92e352c1307640d5b6fec1b2ffb06cd0dabe7d7b8227f97933d378422/numpy-2.2.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b4f13750ce79751586ae2eb824ba7e1e8dba64784086c98cdbbcc6a42112ce0d", size = 18316632 },
+ { url = "https://files.pythonhosted.org/packages/f0/3b/5cba2b1d88760ef86596ad0f3d484b1cbff7c115ae2429678465057c5155/numpy-2.2.6-cp313-cp313-win32.whl", hash = "sha256:5beb72339d9d4fa36522fc63802f469b13cdbe4fdab4a288f0c441b74272ebfd", size = 6244532 },
+ { url = "https://files.pythonhosted.org/packages/cb/3b/d58c12eafcb298d4e6d0d40216866ab15f59e55d148a5658bb3132311fcf/numpy-2.2.6-cp313-cp313-win_amd64.whl", hash = "sha256:b0544343a702fa80c95ad5d3d608ea3599dd54d4632df855e4c8d24eb6ecfa1c", size = 12610885 },
+ { url = "https://files.pythonhosted.org/packages/6b/9e/4bf918b818e516322db999ac25d00c75788ddfd2d2ade4fa66f1f38097e1/numpy-2.2.6-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:0bca768cd85ae743b2affdc762d617eddf3bcf8724435498a1e80132d04879e6", size = 20963467 },
+ { url = "https://files.pythonhosted.org/packages/61/66/d2de6b291507517ff2e438e13ff7b1e2cdbdb7cb40b3ed475377aece69f9/numpy-2.2.6-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:fc0c5673685c508a142ca65209b4e79ed6740a4ed6b2267dbba90f34b0b3cfda", size = 14225144 },
+ { url = "https://files.pythonhosted.org/packages/e4/25/480387655407ead912e28ba3a820bc69af9adf13bcbe40b299d454ec011f/numpy-2.2.6-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:5bd4fc3ac8926b3819797a7c0e2631eb889b4118a9898c84f585a54d475b7e40", size = 5200217 },
+ { url = "https://files.pythonhosted.org/packages/aa/4a/6e313b5108f53dcbf3aca0c0f3e9c92f4c10ce57a0a721851f9785872895/numpy-2.2.6-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:fee4236c876c4e8369388054d02d0e9bb84821feb1a64dd59e137e6511a551f8", size = 6712014 },
+ { url = "https://files.pythonhosted.org/packages/b7/30/172c2d5c4be71fdf476e9de553443cf8e25feddbe185e0bd88b096915bcc/numpy-2.2.6-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e1dda9c7e08dc141e0247a5b8f49cf05984955246a327d4c48bda16821947b2f", size = 14077935 },
+ { url = "https://files.pythonhosted.org/packages/12/fb/9e743f8d4e4d3c710902cf87af3512082ae3d43b945d5d16563f26ec251d/numpy-2.2.6-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f447e6acb680fd307f40d3da4852208af94afdfab89cf850986c3ca00562f4fa", size = 16600122 },
+ { url = "https://files.pythonhosted.org/packages/12/75/ee20da0e58d3a66f204f38916757e01e33a9737d0b22373b3eb5a27358f9/numpy-2.2.6-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:389d771b1623ec92636b0786bc4ae56abafad4a4c513d36a55dce14bd9ce8571", size = 15586143 },
+ { url = "https://files.pythonhosted.org/packages/76/95/bef5b37f29fc5e739947e9ce5179ad402875633308504a52d188302319c8/numpy-2.2.6-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:8e9ace4a37db23421249ed236fdcdd457d671e25146786dfc96835cd951aa7c1", size = 18385260 },
+ { url = "https://files.pythonhosted.org/packages/09/04/f2f83279d287407cf36a7a8053a5abe7be3622a4363337338f2585e4afda/numpy-2.2.6-cp313-cp313t-win32.whl", hash = "sha256:038613e9fb8c72b0a41f025a7e4c3f0b7a1b5d768ece4796b674c8f3fe13efff", size = 6377225 },
+ { url = "https://files.pythonhosted.org/packages/67/0e/35082d13c09c02c011cf21570543d202ad929d961c02a147493cb0c2bdf5/numpy-2.2.6-cp313-cp313t-win_amd64.whl", hash = "sha256:6031dd6dfecc0cf9f668681a37648373bddd6421fff6c66ec1624eed0180ee06", size = 12771374 },
+ { url = "https://files.pythonhosted.org/packages/9e/3b/d94a75f4dbf1ef5d321523ecac21ef23a3cd2ac8b78ae2aac40873590229/numpy-2.2.6-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:0b605b275d7bd0c640cad4e5d30fa701a8d59302e127e5f79138ad62762c3e3d", size = 21040391 },
+ { url = "https://files.pythonhosted.org/packages/17/f4/09b2fa1b58f0fb4f7c7963a1649c64c4d315752240377ed74d9cd878f7b5/numpy-2.2.6-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:7befc596a7dc9da8a337f79802ee8adb30a552a94f792b9c9d18c840055907db", size = 6786754 },
+ { url = "https://files.pythonhosted.org/packages/af/30/feba75f143bdc868a1cc3f44ccfa6c4b9ec522b36458e738cd00f67b573f/numpy-2.2.6-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ce47521a4754c8f4593837384bd3424880629f718d87c5d44f8ed763edd63543", size = 16643476 },
+ { url = "https://files.pythonhosted.org/packages/37/48/ac2a9584402fb6c0cd5b5d1a91dcf176b15760130dd386bbafdbfe3640bf/numpy-2.2.6-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:d042d24c90c41b54fd506da306759e06e568864df8ec17ccc17e9e884634fd00", size = 12812666 },
+]
+
+[[package]]
+name = "numpy"
+version = "2.4.0"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version >= '3.12' and sys_platform == 'darwin'",
+ "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux'",
+ "python_full_version == '3.11.*' and sys_platform == 'darwin'",
+ "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+sdist = { url = "https://files.pythonhosted.org/packages/a4/7a/6a3d14e205d292b738db449d0de649b373a59edb0d0b4493821d0a3e8718/numpy-2.4.0.tar.gz", hash = "sha256:6e504f7b16118198f138ef31ba24d985b124c2c469fe8467007cf30fd992f934", size = 20685720 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/26/7e/7bae7cbcc2f8132271967aa03e03954fc1e48aa1f3bf32b29ca95fbef352/numpy-2.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:316b2f2584682318539f0bcaca5a496ce9ca78c88066579ebd11fd06f8e4741e", size = 16940166 },
+ { url = "https://files.pythonhosted.org/packages/0f/27/6c13f5b46776d6246ec884ac5817452672156a506d08a1f2abb39961930a/numpy-2.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a2718c1de8504121714234b6f8241d0019450353276c88b9453c9c3d92e101db", size = 12641781 },
+ { url = "https://files.pythonhosted.org/packages/14/1c/83b4998d4860d15283241d9e5215f28b40ac31f497c04b12fa7f428ff370/numpy-2.4.0-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:21555da4ec4a0c942520ead42c3b0dc9477441e085c42b0fbdd6a084869a6f6b", size = 5470247 },
+ { url = "https://files.pythonhosted.org/packages/54/08/cbce72c835d937795571b0464b52069f869c9e78b0c076d416c5269d2718/numpy-2.4.0-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:413aa561266a4be2d06cd2b9665e89d9f54c543f418773076a76adcf2af08bc7", size = 6799807 },
+ { url = "https://files.pythonhosted.org/packages/ff/be/2e647961cd8c980591d75cdcd9e8f647d69fbe05e2a25613dc0a2ea5fb1a/numpy-2.4.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0feafc9e03128074689183031181fac0897ff169692d8492066e949041096548", size = 14701992 },
+ { url = "https://files.pythonhosted.org/packages/a2/fb/e1652fb8b6fd91ce6ed429143fe2e01ce714711e03e5b762615e7b36172c/numpy-2.4.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a8fdfed3deaf1928fb7667d96e0567cdf58c2b370ea2ee7e586aa383ec2cb346", size = 16646871 },
+ { url = "https://files.pythonhosted.org/packages/62/23/d841207e63c4322842f7cd042ae981cffe715c73376dcad8235fb31debf1/numpy-2.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:e06a922a469cae9a57100864caf4f8a97a1026513793969f8ba5b63137a35d25", size = 16487190 },
+ { url = "https://files.pythonhosted.org/packages/bc/a0/6a842c8421ebfdec0a230e65f61e0dabda6edbef443d999d79b87c273965/numpy-2.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:927ccf5cd17c48f801f4ed43a7e5673a2724bd2171460be3e3894e6e332ef83a", size = 18580762 },
+ { url = "https://files.pythonhosted.org/packages/0a/d1/c79e0046641186f2134dde05e6181825b911f8bdcef31b19ddd16e232847/numpy-2.4.0-cp311-cp311-win32.whl", hash = "sha256:882567b7ae57c1b1a0250208cc21a7976d8cbcc49d5a322e607e6f09c9e0bd53", size = 6233359 },
+ { url = "https://files.pythonhosted.org/packages/fc/f0/74965001d231f28184d6305b8cdc1b6fcd4bf23033f6cb039cfe76c9fca7/numpy-2.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:8b986403023c8f3bf8f487c2e6186afda156174d31c175f747d8934dfddf3479", size = 12601132 },
+ { url = "https://files.pythonhosted.org/packages/65/32/55408d0f46dfebce38017f5bd931affa7256ad6beac1a92a012e1fbc67a7/numpy-2.4.0-cp311-cp311-win_arm64.whl", hash = "sha256:3f3096405acc48887458bbf9f6814d43785ac7ba2a57ea6442b581dedbc60ce6", size = 10573977 },
+ { url = "https://files.pythonhosted.org/packages/8b/ff/f6400ffec95de41c74b8e73df32e3fff1830633193a7b1e409be7fb1bb8c/numpy-2.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:2a8b6bb8369abefb8bd1801b054ad50e02b3275c8614dc6e5b0373c305291037", size = 16653117 },
+ { url = "https://files.pythonhosted.org/packages/fd/28/6c23e97450035072e8d830a3c411bf1abd1f42c611ff9d29e3d8f55c6252/numpy-2.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2e284ca13d5a8367e43734148622caf0b261b275673823593e3e3634a6490f83", size = 12369711 },
+ { url = "https://files.pythonhosted.org/packages/bc/af/acbef97b630ab1bb45e6a7d01d1452e4251aa88ce680ac36e56c272120ec/numpy-2.4.0-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:49ff32b09f5aa0cd30a20c2b39db3e669c845589f2b7fc910365210887e39344", size = 5198355 },
+ { url = "https://files.pythonhosted.org/packages/c1/c8/4e0d436b66b826f2e53330adaa6311f5cac9871a5b5c31ad773b27f25a74/numpy-2.4.0-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:36cbfb13c152b1c7c184ddac43765db8ad672567e7bafff2cc755a09917ed2e6", size = 6545298 },
+ { url = "https://files.pythonhosted.org/packages/ef/27/e1f5d144ab54eac34875e79037011d511ac57b21b220063310cb96c80fbc/numpy-2.4.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:35ddc8f4914466e6fc954c76527aa91aa763682a4f6d73249ef20b418fe6effb", size = 14398387 },
+ { url = "https://files.pythonhosted.org/packages/67/64/4cb909dd5ab09a9a5d086eff9586e69e827b88a5585517386879474f4cf7/numpy-2.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dc578891de1db95b2a35001b695451767b580bb45753717498213c5ff3c41d63", size = 16363091 },
+ { url = "https://files.pythonhosted.org/packages/9d/9c/8efe24577523ec6809261859737cf117b0eb6fdb655abdfdc81b2e468ce4/numpy-2.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:98e81648e0b36e325ab67e46b5400a7a6d4a22b8a7c8e8bbfe20e7db7906bf95", size = 16176394 },
+ { url = "https://files.pythonhosted.org/packages/61/f0/1687441ece7b47a62e45a1f82015352c240765c707928edd8aef875d5951/numpy-2.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:d57b5046c120561ba8fa8e4030fbb8b822f3063910fa901ffadf16e2b7128ad6", size = 18287378 },
+ { url = "https://files.pythonhosted.org/packages/d3/6f/f868765d44e6fc466467ed810ba9d8d6db1add7d4a748abfa2a4c99a3194/numpy-2.4.0-cp312-cp312-win32.whl", hash = "sha256:92190db305a6f48734d3982f2c60fa30d6b5ee9bff10f2887b930d7b40119f4c", size = 5955432 },
+ { url = "https://files.pythonhosted.org/packages/d4/b5/94c1e79fcbab38d1ca15e13777477b2914dd2d559b410f96949d6637b085/numpy-2.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:680060061adb2d74ce352628cb798cfdec399068aa7f07ba9fb818b2b3305f98", size = 12306201 },
+ { url = "https://files.pythonhosted.org/packages/70/09/c39dadf0b13bb0768cd29d6a3aaff1fb7c6905ac40e9aaeca26b1c086e06/numpy-2.4.0-cp312-cp312-win_arm64.whl", hash = "sha256:39699233bc72dd482da1415dcb06076e32f60eddc796a796c5fb6c5efce94667", size = 10308234 },
+ { url = "https://files.pythonhosted.org/packages/a7/0d/853fd96372eda07c824d24adf02e8bc92bb3731b43a9b2a39161c3667cc4/numpy-2.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a152d86a3ae00ba5f47b3acf3b827509fd0b6cb7d3259665e63dafbad22a75ea", size = 16649088 },
+ { url = "https://files.pythonhosted.org/packages/e3/37/cc636f1f2a9f585434e20a3e6e63422f70bfe4f7f6698e941db52ea1ac9a/numpy-2.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:39b19251dec4de8ff8496cd0806cbe27bf0684f765abb1f4809554de93785f2d", size = 12364065 },
+ { url = "https://files.pythonhosted.org/packages/ed/69/0b78f37ca3690969beee54103ce5f6021709134e8020767e93ba691a72f1/numpy-2.4.0-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:009bd0ea12d3c784b6639a8457537016ce5172109e585338e11334f6a7bb88ee", size = 5192640 },
+ { url = "https://files.pythonhosted.org/packages/1d/2a/08569f8252abf590294dbb09a430543ec8f8cc710383abfb3e75cc73aeda/numpy-2.4.0-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:5fe44e277225fd3dff6882d86d3d447205d43532c3627313d17e754fb3905a0e", size = 6541556 },
+ { url = "https://files.pythonhosted.org/packages/93/e9/a949885a4e177493d61519377952186b6cbfdf1d6002764c664ba28349b5/numpy-2.4.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f935c4493eda9069851058fa0d9e39dbf6286be690066509305e52912714dbb2", size = 14396562 },
+ { url = "https://files.pythonhosted.org/packages/99/98/9d4ad53b0e9ef901c2ef1d550d2136f5ac42d3fd2988390a6def32e23e48/numpy-2.4.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8cfa5f29a695cb7438965e6c3e8d06e0416060cf0d709c1b1c1653a939bf5c2a", size = 16351719 },
+ { url = "https://files.pythonhosted.org/packages/28/de/5f3711a38341d6e8dd619f6353251a0cdd07f3d6d101a8fd46f4ef87f895/numpy-2.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:ba0cb30acd3ef11c94dc27fbfba68940652492bc107075e7ffe23057f9425681", size = 16176053 },
+ { url = "https://files.pythonhosted.org/packages/2a/5b/2a3753dc43916501b4183532e7ace862e13211042bceafa253afb5c71272/numpy-2.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:60e8c196cd82cbbd4f130b5290007e13e6de3eca79f0d4d38014769d96a7c475", size = 18277859 },
+ { url = "https://files.pythonhosted.org/packages/2c/c5/a18bcdd07a941db3076ef489d036ab16d2bfc2eae0cf27e5a26e29189434/numpy-2.4.0-cp313-cp313-win32.whl", hash = "sha256:5f48cb3e88fbc294dc90e215d86fbaf1c852c63dbdb6c3a3e63f45c4b57f7344", size = 5953849 },
+ { url = "https://files.pythonhosted.org/packages/4f/f1/719010ff8061da6e8a26e1980cf090412d4f5f8060b31f0c45d77dd67a01/numpy-2.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:a899699294f28f7be8992853c0c60741f16ff199205e2e6cdca155762cbaa59d", size = 12302840 },
+ { url = "https://files.pythonhosted.org/packages/f5/5a/b3d259083ed8b4d335270c76966cb6cf14a5d1b69e1a608994ac57a659e6/numpy-2.4.0-cp313-cp313-win_arm64.whl", hash = "sha256:9198f447e1dc5647d07c9a6bbe2063cc0132728cc7175b39dbc796da5b54920d", size = 10308509 },
+ { url = "https://files.pythonhosted.org/packages/31/01/95edcffd1bb6c0633df4e808130545c4f07383ab629ac7e316fb44fff677/numpy-2.4.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:74623f2ab5cc3f7c886add4f735d1031a1d2be4a4ae63c0546cfd74e7a31ddf6", size = 12491815 },
+ { url = "https://files.pythonhosted.org/packages/59/ea/5644b8baa92cc1c7163b4b4458c8679852733fa74ca49c942cfa82ded4e0/numpy-2.4.0-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:0804a8e4ab070d1d35496e65ffd3cf8114c136a2b81f61dfab0de4b218aacfd5", size = 5320321 },
+ { url = "https://files.pythonhosted.org/packages/26/4e/e10938106d70bc21319bd6a86ae726da37edc802ce35a3a71ecdf1fdfe7f/numpy-2.4.0-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:02a2038eb27f9443a8b266a66911e926566b5a6ffd1a689b588f7f35b81e7dc3", size = 6641635 },
+ { url = "https://files.pythonhosted.org/packages/b3/8d/a8828e3eaf5c0b4ab116924df82f24ce3416fa38d0674d8f708ddc6c8aac/numpy-2.4.0-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1889b3a3f47a7b5bee16bc25a2145bd7cb91897f815ce3499db64c7458b6d91d", size = 14456053 },
+ { url = "https://files.pythonhosted.org/packages/68/a1/17d97609d87d4520aa5ae2dcfb32305654550ac6a35effb946d303e594ce/numpy-2.4.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:85eef4cb5625c47ee6425c58a3502555e10f45ee973da878ac8248ad58c136f3", size = 16401702 },
+ { url = "https://files.pythonhosted.org/packages/18/32/0f13c1b2d22bea1118356b8b963195446f3af124ed7a5adfa8fdecb1b6ca/numpy-2.4.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:6dc8b7e2f4eb184b37655195f421836cfae6f58197b67e3ffc501f1333d993fa", size = 16242493 },
+ { url = "https://files.pythonhosted.org/packages/ae/23/48f21e3d309fbc137c068a1475358cbd3a901b3987dcfc97a029ab3068e2/numpy-2.4.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:44aba2f0cafd287871a495fb3163408b0bd25bbce135c6f621534a07f4f7875c", size = 18324222 },
+ { url = "https://files.pythonhosted.org/packages/ac/52/41f3d71296a3dcaa4f456aaa3c6fc8e745b43d0552b6bde56571bb4b4a0f/numpy-2.4.0-cp313-cp313t-win32.whl", hash = "sha256:20c115517513831860c573996e395707aa9fb691eb179200125c250e895fcd93", size = 6076216 },
+ { url = "https://files.pythonhosted.org/packages/35/ff/46fbfe60ab0710d2a2b16995f708750307d30eccbb4c38371ea9e986866e/numpy-2.4.0-cp313-cp313t-win_amd64.whl", hash = "sha256:b48e35f4ab6f6a7597c46e301126ceba4c44cd3280e3750f85db48b082624fa4", size = 12444263 },
+ { url = "https://files.pythonhosted.org/packages/a3/e3/9189ab319c01d2ed556c932ccf55064c5d75bb5850d1df7a482ce0badead/numpy-2.4.0-cp313-cp313t-win_arm64.whl", hash = "sha256:4d1cfce39e511069b11e67cd0bd78ceff31443b7c9e5c04db73c7a19f572967c", size = 10378265 },
+ { url = "https://files.pythonhosted.org/packages/ab/ed/52eac27de39d5e5a6c9aadabe672bc06f55e24a3d9010cd1183948055d76/numpy-2.4.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:c95eb6db2884917d86cde0b4d4cf31adf485c8ec36bf8696dd66fa70de96f36b", size = 16647476 },
+ { url = "https://files.pythonhosted.org/packages/77/c0/990ce1b7fcd4e09aeaa574e2a0a839589e4b08b2ca68070f1acb1fea6736/numpy-2.4.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:65167da969cd1ec3a1df31cb221ca3a19a8aaa25370ecb17d428415e93c1935e", size = 12374563 },
+ { url = "https://files.pythonhosted.org/packages/37/7c/8c5e389c6ae8f5fd2277a988600d79e9625db3fff011a2d87ac80b881a4c/numpy-2.4.0-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:3de19cfecd1465d0dcf8a5b5ea8b3155b42ed0b639dba4b71e323d74f2a3be5e", size = 5203107 },
+ { url = "https://files.pythonhosted.org/packages/e6/94/ca5b3bd6a8a70a5eec9a0b8dd7f980c1eff4b8a54970a9a7fef248ef564f/numpy-2.4.0-cp314-cp314-macosx_14_0_x86_64.whl", hash = "sha256:6c05483c3136ac4c91b4e81903cb53a8707d316f488124d0398499a4f8e8ef51", size = 6538067 },
+ { url = "https://files.pythonhosted.org/packages/79/43/993eb7bb5be6761dde2b3a3a594d689cec83398e3f58f4758010f3b85727/numpy-2.4.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:36667db4d6c1cea79c8930ab72fadfb4060feb4bfe724141cd4bd064d2e5f8ce", size = 14411926 },
+ { url = "https://files.pythonhosted.org/packages/03/75/d4c43b61de473912496317a854dac54f1efec3eeb158438da6884b70bb90/numpy-2.4.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9a818668b674047fd88c4cddada7ab8f1c298812783e8328e956b78dc4807f9f", size = 16354295 },
+ { url = "https://files.pythonhosted.org/packages/b8/0a/b54615b47ee8736a6461a4bb6749128dd3435c5a759d5663f11f0e9af4ac/numpy-2.4.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:1ee32359fb7543b7b7bd0b2f46294db27e29e7bbdf70541e81b190836cd83ded", size = 16190242 },
+ { url = "https://files.pythonhosted.org/packages/98/ce/ea207769aacad6246525ec6c6bbd66a2bf56c72443dc10e2f90feed29290/numpy-2.4.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:e493962256a38f58283de033d8af176c5c91c084ea30f15834f7545451c42059", size = 18280875 },
+ { url = "https://files.pythonhosted.org/packages/17/ef/ec409437aa962ea372ed601c519a2b141701683ff028f894b7466f0ab42b/numpy-2.4.0-cp314-cp314-win32.whl", hash = "sha256:6bbaebf0d11567fa8926215ae731e1d58e6ec28a8a25235b8a47405d301332db", size = 6002530 },
+ { url = "https://files.pythonhosted.org/packages/5f/4a/5cb94c787a3ed1ac65e1271b968686521169a7b3ec0b6544bb3ca32960b0/numpy-2.4.0-cp314-cp314-win_amd64.whl", hash = "sha256:3d857f55e7fdf7c38ab96c4558c95b97d1c685be6b05c249f5fdafcbd6f9899e", size = 12435890 },
+ { url = "https://files.pythonhosted.org/packages/48/a0/04b89db963af9de1104975e2544f30de89adbf75b9e75f7dd2599be12c79/numpy-2.4.0-cp314-cp314-win_arm64.whl", hash = "sha256:bb50ce5fb202a26fd5404620e7ef820ad1ab3558b444cb0b55beb7ef66cd2d63", size = 10591892 },
+ { url = "https://files.pythonhosted.org/packages/53/e5/d74b5ccf6712c06c7a545025a6a71bfa03bdc7e0568b405b0d655232fd92/numpy-2.4.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:355354388cba60f2132df297e2d53053d4063f79077b67b481d21276d61fc4df", size = 12494312 },
+ { url = "https://files.pythonhosted.org/packages/c2/08/3ca9cc2ddf54dfee7ae9a6479c071092a228c68aef08252aa08dac2af002/numpy-2.4.0-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:1d8f9fde5f6dc1b6fc34df8162f3b3079365468703fee7f31d4e0cc8c63baed9", size = 5322862 },
+ { url = "https://files.pythonhosted.org/packages/87/74/0bb63a68394c0c1e52670cfff2e309afa41edbe11b3327d9af29e4383f34/numpy-2.4.0-cp314-cp314t-macosx_14_0_x86_64.whl", hash = "sha256:e0434aa22c821f44eeb4c650b81c7fbdd8c0122c6c4b5a576a76d5a35625ecd9", size = 6644986 },
+ { url = "https://files.pythonhosted.org/packages/06/8f/9264d9bdbcf8236af2823623fe2f3981d740fc3461e2787e231d97c38c28/numpy-2.4.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:40483b2f2d3ba7aad426443767ff5632ec3156ef09742b96913787d13c336471", size = 14457958 },
+ { url = "https://files.pythonhosted.org/packages/8c/d9/f9a69ae564bbc7236a35aa883319364ef5fd41f72aa320cc1cbe66148fe2/numpy-2.4.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d9e6a7664ddd9746e20b7325351fe1a8408d0a2bf9c63b5e898290ddc8f09544", size = 16398394 },
+ { url = "https://files.pythonhosted.org/packages/34/c7/39241501408dde7f885d241a98caba5421061a2c6d2b2197ac5e3aa842d8/numpy-2.4.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:ecb0019d44f4cdb50b676c5d0cb4b1eae8e15d1ed3d3e6639f986fc92b2ec52c", size = 16241044 },
+ { url = "https://files.pythonhosted.org/packages/7c/95/cae7effd90e065a95e59fe710eeee05d7328ed169776dfdd9f789e032125/numpy-2.4.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:d0ffd9e2e4441c96a9c91ec1783285d80bf835b677853fc2770a89d50c1e48ac", size = 18321772 },
+ { url = "https://files.pythonhosted.org/packages/96/df/3c6c279accd2bfb968a76298e5b276310bd55d243df4fa8ac5816d79347d/numpy-2.4.0-cp314-cp314t-win32.whl", hash = "sha256:77f0d13fa87036d7553bf81f0e1fe3ce68d14c9976c9851744e4d3e91127e95f", size = 6148320 },
+ { url = "https://files.pythonhosted.org/packages/92/8d/f23033cce252e7a75cae853d17f582e86534c46404dea1c8ee094a9d6d84/numpy-2.4.0-cp314-cp314t-win_amd64.whl", hash = "sha256:b1f5b45829ac1848893f0ddf5cb326110604d6df96cdc255b0bf9edd154104d4", size = 12623460 },
+ { url = "https://files.pythonhosted.org/packages/a4/4f/1f8475907d1a7c4ef9020edf7f39ea2422ec896849245f00688e4b268a71/numpy-2.4.0-cp314-cp314t-win_arm64.whl", hash = "sha256:23a3e9d1a6f360267e8fbb38ba5db355a6a7e9be71d7fce7ab3125e88bb646c8", size = 10661799 },
+ { url = "https://files.pythonhosted.org/packages/4b/ef/088e7c7342f300aaf3ee5f2c821c4b9996a1bef2aaf6a49cc8ab4883758e/numpy-2.4.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:b54c83f1c0c0f1d748dca0af516062b8829d53d1f0c402be24b4257a9c48ada6", size = 16819003 },
+ { url = "https://files.pythonhosted.org/packages/ff/ce/a53017b5443b4b84517182d463fc7bcc2adb4faa8b20813f8e5f5aeb5faa/numpy-2.4.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:aabb081ca0ec5d39591fc33018cd4b3f96e1a2dd6756282029986d00a785fba4", size = 12567105 },
+ { url = "https://files.pythonhosted.org/packages/77/58/5ff91b161f2ec650c88a626c3905d938c89aaadabd0431e6d9c1330c83e2/numpy-2.4.0-pp311-pypy311_pp73-macosx_14_0_arm64.whl", hash = "sha256:8eafe7c36c8430b7794edeab3087dec7bf31d634d92f2af9949434b9d1964cba", size = 5395590 },
+ { url = "https://files.pythonhosted.org/packages/1d/4e/f1a084106df8c2df8132fc437e56987308e0524836aa7733721c8429d4fe/numpy-2.4.0-pp311-pypy311_pp73-macosx_14_0_x86_64.whl", hash = "sha256:2f585f52b2baf07ff3356158d9268ea095e221371f1074fadea2f42544d58b4d", size = 6709947 },
+ { url = "https://files.pythonhosted.org/packages/63/09/3d8aeb809c0332c3f642da812ac2e3d74fc9252b3021f8c30c82e99e3f3d/numpy-2.4.0-pp311-pypy311_pp73-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:32ed06d0fe9cae27d8fb5f400c63ccee72370599c75e683a6358dd3a4fb50aaf", size = 14535119 },
+ { url = "https://files.pythonhosted.org/packages/fd/7f/68f0fc43a2cbdc6bb239160c754d87c922f60fbaa0fa3cd3d312b8a7f5ee/numpy-2.4.0-pp311-pypy311_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:57c540ed8fb1f05cb997c6761cd56db72395b0d6985e90571ff660452ade4f98", size = 16475815 },
+ { url = "https://files.pythonhosted.org/packages/11/73/edeacba3167b1ca66d51b1a5a14697c2c40098b5ffa01811c67b1785a5ab/numpy-2.4.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:a39fb973a726e63223287adc6dafe444ce75af952d711e400f3bf2b36ef55a7b", size = 12489376 },
+]
+
+[[package]]
+name = "nvidia-cublas-cu12"
+version = "12.8.4.1"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/dc/61/e24b560ab2e2eaeb3c839129175fb330dfcfc29e5203196e5541a4c44682/nvidia_cublas_cu12-12.8.4.1-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:8ac4e771d5a348c551b2a426eda6193c19aa630236b418086020df5ba9667142", size = 594346921 },
+]
+
+[[package]]
+name = "nvidia-cuda-cupti-cu12"
+version = "12.8.90"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/f8/02/2adcaa145158bf1a8295d83591d22e4103dbfd821bcaf6f3f53151ca4ffa/nvidia_cuda_cupti_cu12-12.8.90-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ea0cb07ebda26bb9b29ba82cda34849e73c166c18162d3913575b0c9db9a6182", size = 10248621 },
+]
+
+[[package]]
+name = "nvidia-cuda-nvrtc-cu12"
+version = "12.8.93"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/05/6b/32f747947df2da6994e999492ab306a903659555dddc0fbdeb9d71f75e52/nvidia_cuda_nvrtc_cu12-12.8.93-py3-none-manylinux2010_x86_64.manylinux_2_12_x86_64.whl", hash = "sha256:a7756528852ef889772a84c6cd89d41dfa74667e24cca16bb31f8f061e3e9994", size = 88040029 },
+]
+
+[[package]]
+name = "nvidia-cuda-runtime-cu12"
+version = "12.8.90"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/0d/9b/a997b638fcd068ad6e4d53b8551a7d30fe8b404d6f1804abf1df69838932/nvidia_cuda_runtime_cu12-12.8.90-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:adade8dcbd0edf427b7204d480d6066d33902cab2a4707dcfc48a2d0fd44ab90", size = 954765 },
+]
+
+[[package]]
+name = "nvidia-cudnn-cu12"
+version = "9.10.2.21"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "nvidia-cublas-cu12", marker = "platform_machine != 'aarch64' and sys_platform == 'linux'" },
+]
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/ba/51/e123d997aa098c61d029f76663dedbfb9bc8dcf8c60cbd6adbe42f76d049/nvidia_cudnn_cu12-9.10.2.21-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:949452be657fa16687d0930933f032835951ef0892b37d2d53824d1a84dc97a8", size = 706758467 },
+]
+
+[[package]]
+name = "nvidia-cufft-cu12"
+version = "11.3.3.83"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "nvidia-nvjitlink-cu12", marker = "platform_machine != 'aarch64' and sys_platform == 'linux'" },
+]
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/1f/13/ee4e00f30e676b66ae65b4f08cb5bcbb8392c03f54f2d5413ea99a5d1c80/nvidia_cufft_cu12-11.3.3.83-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4d2dd21ec0b88cf61b62e6b43564355e5222e4a3fb394cac0db101f2dd0d4f74", size = 193118695 },
+]
+
+[[package]]
+name = "nvidia-cufile-cu12"
+version = "1.13.1.3"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/bb/fe/1bcba1dfbfb8d01be8d93f07bfc502c93fa23afa6fd5ab3fc7c1df71038a/nvidia_cufile_cu12-1.13.1.3-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:1d069003be650e131b21c932ec3d8969c1715379251f8d23a1860554b1cb24fc", size = 1197834 },
+]
+
+[[package]]
+name = "nvidia-curand-cu12"
+version = "10.3.9.90"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/fb/aa/6584b56dc84ebe9cf93226a5cde4d99080c8e90ab40f0c27bda7a0f29aa1/nvidia_curand_cu12-10.3.9.90-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:b32331d4f4df5d6eefa0554c565b626c7216f87a06a4f56fab27c3b68a830ec9", size = 63619976 },
+]
+
+[[package]]
+name = "nvidia-cusolver-cu12"
+version = "11.7.3.90"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "nvidia-cublas-cu12", marker = "platform_machine != 'aarch64' and sys_platform == 'linux'" },
+ { name = "nvidia-cusparse-cu12", marker = "platform_machine != 'aarch64' and sys_platform == 'linux'" },
+ { name = "nvidia-nvjitlink-cu12", marker = "platform_machine != 'aarch64' and sys_platform == 'linux'" },
+]
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/85/48/9a13d2975803e8cf2777d5ed57b87a0b6ca2cc795f9a4f59796a910bfb80/nvidia_cusolver_cu12-11.7.3.90-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:4376c11ad263152bd50ea295c05370360776f8c3427b30991df774f9fb26c450", size = 267506905 },
+]
+
+[[package]]
+name = "nvidia-cusparse-cu12"
+version = "12.5.8.93"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "nvidia-nvjitlink-cu12", marker = "platform_machine != 'aarch64' and sys_platform == 'linux'" },
+]
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/c2/f5/e1854cb2f2bcd4280c44736c93550cc300ff4b8c95ebe370d0aa7d2b473d/nvidia_cusparse_cu12-12.5.8.93-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:1ec05d76bbbd8b61b06a80e1eaf8cf4959c3d4ce8e711b65ebd0443bb0ebb13b", size = 288216466 },
+]
+
+[[package]]
+name = "nvidia-cusparselt-cu12"
+version = "0.7.1"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/56/79/12978b96bd44274fe38b5dde5cfb660b1d114f70a65ef962bcbbed99b549/nvidia_cusparselt_cu12-0.7.1-py3-none-manylinux2014_x86_64.whl", hash = "sha256:f1bb701d6b930d5a7cea44c19ceb973311500847f81b634d802b7b539dc55623", size = 287193691 },
+]
+
+[[package]]
+name = "nvidia-nccl-cu12"
+version = "2.27.5"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/6e/89/f7a07dc961b60645dbbf42e80f2bc85ade7feb9a491b11a1e973aa00071f/nvidia_nccl_cu12-2.27.5-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:ad730cf15cb5d25fe849c6e6ca9eb5b76db16a80f13f425ac68d8e2e55624457", size = 322348229 },
+]
+
+[[package]]
+name = "nvidia-nvjitlink-cu12"
+version = "12.8.93"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/f6/74/86a07f1d0f42998ca31312f998bd3b9a7eff7f52378f4f270c8679c77fb9/nvidia_nvjitlink_cu12-12.8.93-py3-none-manylinux2010_x86_64.manylinux_2_12_x86_64.whl", hash = "sha256:81ff63371a7ebd6e6451970684f916be2eab07321b73c9d244dc2b4da7f73b88", size = 39254836 },
+]
+
+[[package]]
+name = "nvidia-nvshmem-cu12"
+version = "3.3.20"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/3b/6c/99acb2f9eb85c29fc6f3a7ac4dccfd992e22666dd08a642b303311326a97/nvidia_nvshmem_cu12-3.3.20-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d00f26d3f9b2e3c3065be895e3059d6479ea5c638a3f38c9fec49b1b9dd7c1e5", size = 124657145 },
+]
+
+[[package]]
+name = "nvidia-nvtx-cu12"
+version = "12.8.90"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/a2/eb/86626c1bbc2edb86323022371c39aa48df6fd8b0a1647bc274577f72e90b/nvidia_nvtx_cu12-12.8.90-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:5b17e2001cc0d751a5bc2c6ec6d26ad95913324a4adb86788c944f8ce9ba441f", size = 89954 },
+]
+
+[[package]]
+name = "opencv-python"
+version = "4.11.0.86"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/17/06/68c27a523103dad5837dc5b87e71285280c4f098c60e4fe8a8db6486ab09/opencv-python-4.11.0.86.tar.gz", hash = "sha256:03d60ccae62304860d232272e4a4fda93c39d595780cb40b161b310244b736a4", size = 95171956 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/05/4d/53b30a2a3ac1f75f65a59eb29cf2ee7207ce64867db47036ad61743d5a23/opencv_python-4.11.0.86-cp37-abi3-macosx_13_0_arm64.whl", hash = "sha256:432f67c223f1dc2824f5e73cdfcd9db0efc8710647d4e813012195dc9122a52a", size = 37326322 },
+ { url = "https://files.pythonhosted.org/packages/3b/84/0a67490741867eacdfa37bc18df96e08a9d579583b419010d7f3da8ff503/opencv_python-4.11.0.86-cp37-abi3-macosx_13_0_x86_64.whl", hash = "sha256:9d05ef13d23fe97f575153558653e2d6e87103995d54e6a35db3f282fe1f9c66", size = 56723197 },
+ { url = "https://files.pythonhosted.org/packages/f3/bd/29c126788da65c1fb2b5fb621b7fed0ed5f9122aa22a0868c5e2c15c6d23/opencv_python-4.11.0.86-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b92ae2c8852208817e6776ba1ea0d6b1e0a1b5431e971a2a0ddd2a8cc398202", size = 42230439 },
+ { url = "https://files.pythonhosted.org/packages/2c/8b/90eb44a40476fa0e71e05a0283947cfd74a5d36121a11d926ad6f3193cc4/opencv_python-4.11.0.86-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6b02611523803495003bd87362db3e1d2a0454a6a63025dc6658a9830570aa0d", size = 62986597 },
+ { url = "https://files.pythonhosted.org/packages/fb/d7/1d5941a9dde095468b288d989ff6539dd69cd429dbf1b9e839013d21b6f0/opencv_python-4.11.0.86-cp37-abi3-win32.whl", hash = "sha256:810549cb2a4aedaa84ad9a1c92fbfdfc14090e2749cedf2c1589ad8359aa169b", size = 29384337 },
+ { url = "https://files.pythonhosted.org/packages/a4/7d/f1c30a92854540bf789e9cd5dde7ef49bbe63f855b85a2e6b3db8135c591/opencv_python-4.11.0.86-cp37-abi3-win_amd64.whl", hash = "sha256:085ad9b77c18853ea66283e98affefe2de8cc4c1f43eda4c100cf9b2721142ec", size = 39488044 },
+]
+
+[[package]]
+name = "optimum-quanto"
+version = "0.2.7"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "huggingface-hub" },
+ { name = "ninja" },
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "safetensors" },
+ { name = "torch" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/3e/df/03ae85090b33d81f06b4dd7a43b16cef6ee5f1d36d8fdcce864964895c70/optimum_quanto-0.2.7.tar.gz", hash = "sha256:91b5c2dc8a9100297dc7924a93747fb77ab010784b5e1f6d0208976ba054dade", size = 361601 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/8d/33/4ad914b0ae7e46296fe00d76d084be351fef69816b3498ed32a178471c8a/optimum_quanto-0.2.7-py3-none-any.whl", hash = "sha256:1369b1d9a4a197f88c0d1c67e8d950694e5b86ce4c9f3878e178d5be35339f61", size = 165285 },
+]
+
+[[package]]
+name = "packaging"
+version = "25.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469 },
+]
+
+[[package]]
+name = "pandas"
+version = "2.3.3"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "python-dateutil" },
+ { name = "pytz" },
+ { name = "tzdata" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/33/01/d40b85317f86cf08d853a4f495195c73815fdf205eef3993821720274518/pandas-2.3.3.tar.gz", hash = "sha256:e05e1af93b977f7eafa636d043f9f94c7ee3ac81af99c13508215942e64c993b", size = 4495223 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/3d/f7/f425a00df4fcc22b292c6895c6831c0c8ae1d9fac1e024d16f98a9ce8749/pandas-2.3.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:376c6446ae31770764215a6c937f72d917f214b43560603cd60da6408f183b6c", size = 11555763 },
+ { url = "https://files.pythonhosted.org/packages/13/4f/66d99628ff8ce7857aca52fed8f0066ce209f96be2fede6cef9f84e8d04f/pandas-2.3.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e19d192383eab2f4ceb30b412b22ea30690c9e618f78870357ae1d682912015a", size = 10801217 },
+ { url = "https://files.pythonhosted.org/packages/1d/03/3fc4a529a7710f890a239cc496fc6d50ad4a0995657dccc1d64695adb9f4/pandas-2.3.3-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5caf26f64126b6c7aec964f74266f435afef1c1b13da3b0636c7518a1fa3e2b1", size = 12148791 },
+ { url = "https://files.pythonhosted.org/packages/40/a8/4dac1f8f8235e5d25b9955d02ff6f29396191d4e665d71122c3722ca83c5/pandas-2.3.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dd7478f1463441ae4ca7308a70e90b33470fa593429f9d4c578dd00d1fa78838", size = 12769373 },
+ { url = "https://files.pythonhosted.org/packages/df/91/82cc5169b6b25440a7fc0ef3a694582418d875c8e3ebf796a6d6470aa578/pandas-2.3.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:4793891684806ae50d1288c9bae9330293ab4e083ccd1c5e383c34549c6e4250", size = 13200444 },
+ { url = "https://files.pythonhosted.org/packages/10/ae/89b3283800ab58f7af2952704078555fa60c807fff764395bb57ea0b0dbd/pandas-2.3.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:28083c648d9a99a5dd035ec125d42439c6c1c525098c58af0fc38dd1a7a1b3d4", size = 13858459 },
+ { url = "https://files.pythonhosted.org/packages/85/72/530900610650f54a35a19476eca5104f38555afccda1aa11a92ee14cb21d/pandas-2.3.3-cp310-cp310-win_amd64.whl", hash = "sha256:503cf027cf9940d2ceaa1a93cfb5f8c8c7e6e90720a2850378f0b3f3b1e06826", size = 11346086 },
+ { url = "https://files.pythonhosted.org/packages/c1/fa/7ac648108144a095b4fb6aa3de1954689f7af60a14cf25583f4960ecb878/pandas-2.3.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:602b8615ebcc4a0c1751e71840428ddebeb142ec02c786e8ad6b1ce3c8dec523", size = 11578790 },
+ { url = "https://files.pythonhosted.org/packages/9b/35/74442388c6cf008882d4d4bdfc4109be87e9b8b7ccd097ad1e7f006e2e95/pandas-2.3.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:8fe25fc7b623b0ef6b5009149627e34d2a4657e880948ec3c840e9402e5c1b45", size = 10833831 },
+ { url = "https://files.pythonhosted.org/packages/fe/e4/de154cbfeee13383ad58d23017da99390b91d73f8c11856f2095e813201b/pandas-2.3.3-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b468d3dad6ff947df92dcb32ede5b7bd41a9b3cceef0a30ed925f6d01fb8fa66", size = 12199267 },
+ { url = "https://files.pythonhosted.org/packages/bf/c9/63f8d545568d9ab91476b1818b4741f521646cbdd151c6efebf40d6de6f7/pandas-2.3.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b98560e98cb334799c0b07ca7967ac361a47326e9b4e5a7dfb5ab2b1c9d35a1b", size = 12789281 },
+ { url = "https://files.pythonhosted.org/packages/f2/00/a5ac8c7a0e67fd1a6059e40aa08fa1c52cc00709077d2300e210c3ce0322/pandas-2.3.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1d37b5848ba49824e5c30bedb9c830ab9b7751fd049bc7914533e01c65f79791", size = 13240453 },
+ { url = "https://files.pythonhosted.org/packages/27/4d/5c23a5bc7bd209231618dd9e606ce076272c9bc4f12023a70e03a86b4067/pandas-2.3.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:db4301b2d1f926ae677a751eb2bd0e8c5f5319c9cb3f88b0becbbb0b07b34151", size = 13890361 },
+ { url = "https://files.pythonhosted.org/packages/8e/59/712db1d7040520de7a4965df15b774348980e6df45c129b8c64d0dbe74ef/pandas-2.3.3-cp311-cp311-win_amd64.whl", hash = "sha256:f086f6fe114e19d92014a1966f43a3e62285109afe874f067f5abbdcbb10e59c", size = 11348702 },
+ { url = "https://files.pythonhosted.org/packages/9c/fb/231d89e8637c808b997d172b18e9d4a4bc7bf31296196c260526055d1ea0/pandas-2.3.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:6d21f6d74eb1725c2efaa71a2bfc661a0689579b58e9c0ca58a739ff0b002b53", size = 11597846 },
+ { url = "https://files.pythonhosted.org/packages/5c/bd/bf8064d9cfa214294356c2d6702b716d3cf3bb24be59287a6a21e24cae6b/pandas-2.3.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3fd2f887589c7aa868e02632612ba39acb0b8948faf5cc58f0850e165bd46f35", size = 10729618 },
+ { url = "https://files.pythonhosted.org/packages/57/56/cf2dbe1a3f5271370669475ead12ce77c61726ffd19a35546e31aa8edf4e/pandas-2.3.3-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ecaf1e12bdc03c86ad4a7ea848d66c685cb6851d807a26aa245ca3d2017a1908", size = 11737212 },
+ { url = "https://files.pythonhosted.org/packages/e5/63/cd7d615331b328e287d8233ba9fdf191a9c2d11b6af0c7a59cfcec23de68/pandas-2.3.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b3d11d2fda7eb164ef27ffc14b4fcab16a80e1ce67e9f57e19ec0afaf715ba89", size = 12362693 },
+ { url = "https://files.pythonhosted.org/packages/a6/de/8b1895b107277d52f2b42d3a6806e69cfef0d5cf1d0ba343470b9d8e0a04/pandas-2.3.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a68e15f780eddf2b07d242e17a04aa187a7ee12b40b930bfdd78070556550e98", size = 12771002 },
+ { url = "https://files.pythonhosted.org/packages/87/21/84072af3187a677c5893b170ba2c8fbe450a6ff911234916da889b698220/pandas-2.3.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:371a4ab48e950033bcf52b6527eccb564f52dc826c02afd9a1bc0ab731bba084", size = 13450971 },
+ { url = "https://files.pythonhosted.org/packages/86/41/585a168330ff063014880a80d744219dbf1dd7a1c706e75ab3425a987384/pandas-2.3.3-cp312-cp312-win_amd64.whl", hash = "sha256:a16dcec078a01eeef8ee61bf64074b4e524a2a3f4b3be9326420cabe59c4778b", size = 10992722 },
+ { url = "https://files.pythonhosted.org/packages/cd/4b/18b035ee18f97c1040d94debd8f2e737000ad70ccc8f5513f4eefad75f4b/pandas-2.3.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:56851a737e3470de7fa88e6131f41281ed440d29a9268dcbf0002da5ac366713", size = 11544671 },
+ { url = "https://files.pythonhosted.org/packages/31/94/72fac03573102779920099bcac1c3b05975c2cb5f01eac609faf34bed1ca/pandas-2.3.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:bdcd9d1167f4885211e401b3036c0c8d9e274eee67ea8d0758a256d60704cfe8", size = 10680807 },
+ { url = "https://files.pythonhosted.org/packages/16/87/9472cf4a487d848476865321de18cc8c920b8cab98453ab79dbbc98db63a/pandas-2.3.3-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e32e7cc9af0f1cc15548288a51a3b681cc2a219faa838e995f7dc53dbab1062d", size = 11709872 },
+ { url = "https://files.pythonhosted.org/packages/15/07/284f757f63f8a8d69ed4472bfd85122bd086e637bf4ed09de572d575a693/pandas-2.3.3-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:318d77e0e42a628c04dc56bcef4b40de67918f7041c2b061af1da41dcff670ac", size = 12306371 },
+ { url = "https://files.pythonhosted.org/packages/33/81/a3afc88fca4aa925804a27d2676d22dcd2031c2ebe08aabd0ae55b9ff282/pandas-2.3.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:4e0a175408804d566144e170d0476b15d78458795bb18f1304fb94160cabf40c", size = 12765333 },
+ { url = "https://files.pythonhosted.org/packages/8d/0f/b4d4ae743a83742f1153464cf1a8ecfafc3ac59722a0b5c8602310cb7158/pandas-2.3.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:93c2d9ab0fc11822b5eece72ec9587e172f63cff87c00b062f6e37448ced4493", size = 13418120 },
+ { url = "https://files.pythonhosted.org/packages/4f/c7/e54682c96a895d0c808453269e0b5928a07a127a15704fedb643e9b0a4c8/pandas-2.3.3-cp313-cp313-win_amd64.whl", hash = "sha256:f8bfc0e12dc78f777f323f55c58649591b2cd0c43534e8355c51d3fede5f4dee", size = 10993991 },
+ { url = "https://files.pythonhosted.org/packages/f9/ca/3f8d4f49740799189e1395812f3bf23b5e8fc7c190827d55a610da72ce55/pandas-2.3.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:75ea25f9529fdec2d2e93a42c523962261e567d250b0013b16210e1d40d7c2e5", size = 12048227 },
+ { url = "https://files.pythonhosted.org/packages/0e/5a/f43efec3e8c0cc92c4663ccad372dbdff72b60bdb56b2749f04aa1d07d7e/pandas-2.3.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:74ecdf1d301e812db96a465a525952f4dde225fdb6d8e5a521d47e1f42041e21", size = 11411056 },
+ { url = "https://files.pythonhosted.org/packages/46/b1/85331edfc591208c9d1a63a06baa67b21d332e63b7a591a5ba42a10bb507/pandas-2.3.3-cp313-cp313t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6435cb949cb34ec11cc9860246ccb2fdc9ecd742c12d3304989017d53f039a78", size = 11645189 },
+ { url = "https://files.pythonhosted.org/packages/44/23/78d645adc35d94d1ac4f2a3c4112ab6f5b8999f4898b8cdf01252f8df4a9/pandas-2.3.3-cp313-cp313t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:900f47d8f20860de523a1ac881c4c36d65efcb2eb850e6948140fa781736e110", size = 12121912 },
+ { url = "https://files.pythonhosted.org/packages/53/da/d10013df5e6aaef6b425aa0c32e1fc1f3e431e4bcabd420517dceadce354/pandas-2.3.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:a45c765238e2ed7d7c608fc5bc4a6f88b642f2f01e70c0c23d2224dd21829d86", size = 12712160 },
+ { url = "https://files.pythonhosted.org/packages/bd/17/e756653095a083d8a37cbd816cb87148debcfcd920129b25f99dd8d04271/pandas-2.3.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:c4fc4c21971a1a9f4bdb4c73978c7f7256caa3e62b323f70d6cb80db583350bc", size = 13199233 },
+ { url = "https://files.pythonhosted.org/packages/04/fd/74903979833db8390b73b3a8a7d30d146d710bd32703724dd9083950386f/pandas-2.3.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:ee15f284898e7b246df8087fc82b87b01686f98ee67d85a17b7ab44143a3a9a0", size = 11540635 },
+ { url = "https://files.pythonhosted.org/packages/21/00/266d6b357ad5e6d3ad55093a7e8efc7dd245f5a842b584db9f30b0f0a287/pandas-2.3.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1611aedd912e1ff81ff41c745822980c49ce4a7907537be8692c8dbc31924593", size = 10759079 },
+ { url = "https://files.pythonhosted.org/packages/ca/05/d01ef80a7a3a12b2f8bbf16daba1e17c98a2f039cbc8e2f77a2c5a63d382/pandas-2.3.3-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6d2cefc361461662ac48810cb14365a365ce864afe85ef1f447ff5a1e99ea81c", size = 11814049 },
+ { url = "https://files.pythonhosted.org/packages/15/b2/0e62f78c0c5ba7e3d2c5945a82456f4fac76c480940f805e0b97fcbc2f65/pandas-2.3.3-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ee67acbbf05014ea6c763beb097e03cd629961c8a632075eeb34247120abcb4b", size = 12332638 },
+ { url = "https://files.pythonhosted.org/packages/c5/33/dd70400631b62b9b29c3c93d2feee1d0964dc2bae2e5ad7a6c73a7f25325/pandas-2.3.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c46467899aaa4da076d5abc11084634e2d197e9460643dd455ac3db5856b24d6", size = 12886834 },
+ { url = "https://files.pythonhosted.org/packages/d3/18/b5d48f55821228d0d2692b34fd5034bb185e854bdb592e9c640f6290e012/pandas-2.3.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:6253c72c6a1d990a410bc7de641d34053364ef8bcd3126f7e7450125887dffe3", size = 13409925 },
+ { url = "https://files.pythonhosted.org/packages/a6/3d/124ac75fcd0ecc09b8fdccb0246ef65e35b012030defb0e0eba2cbbbe948/pandas-2.3.3-cp314-cp314-win_amd64.whl", hash = "sha256:1b07204a219b3b7350abaae088f451860223a52cfb8a6c53358e7948735158e5", size = 11109071 },
+ { url = "https://files.pythonhosted.org/packages/89/9c/0e21c895c38a157e0faa1fb64587a9226d6dd46452cac4532d80c3c4a244/pandas-2.3.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:2462b1a365b6109d275250baaae7b760fd25c726aaca0054649286bcfbb3e8ec", size = 12048504 },
+ { url = "https://files.pythonhosted.org/packages/d7/82/b69a1c95df796858777b68fbe6a81d37443a33319761d7c652ce77797475/pandas-2.3.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0242fe9a49aa8b4d78a4fa03acb397a58833ef6199e9aa40a95f027bb3a1b6e7", size = 11410702 },
+ { url = "https://files.pythonhosted.org/packages/f9/88/702bde3ba0a94b8c73a0181e05144b10f13f29ebfc2150c3a79062a8195d/pandas-2.3.3-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a21d830e78df0a515db2b3d2f5570610f5e6bd2e27749770e8bb7b524b89b450", size = 11634535 },
+ { url = "https://files.pythonhosted.org/packages/a4/1e/1bac1a839d12e6a82ec6cb40cda2edde64a2013a66963293696bbf31fbbb/pandas-2.3.3-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2e3ebdb170b5ef78f19bfb71b0dc5dc58775032361fa188e814959b74d726dd5", size = 12121582 },
+ { url = "https://files.pythonhosted.org/packages/44/91/483de934193e12a3b1d6ae7c8645d083ff88dec75f46e827562f1e4b4da6/pandas-2.3.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:d051c0e065b94b7a3cea50eb1ec32e912cd96dba41647eb24104b6c6c14c5788", size = 12699963 },
+ { url = "https://files.pythonhosted.org/packages/70/44/5191d2e4026f86a2a109053e194d3ba7a31a2d10a9c2348368c63ed4e85a/pandas-2.3.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:3869faf4bd07b3b66a9f462417d0ca3a9df29a9f6abd5d0d0dbab15dac7abe87", size = 13202175 },
+]
+
+[[package]]
+name = "peft"
+version = "0.18.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "accelerate" },
+ { name = "huggingface-hub" },
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "packaging" },
+ { name = "psutil" },
+ { name = "pyyaml" },
+ { name = "safetensors" },
+ { name = "torch" },
+ { name = "tqdm" },
+ { name = "transformers" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/4b/0c/f2938db546ac7fc961ab5917cd50fcf5d0d70b406de93e3faccaa504e152/peft-0.18.0.tar.gz", hash = "sha256:c81c80b2056ab40c23d58ef25f74daab417ac653970718589a11a8af28218588", size = 634141 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/0f/55/481bf25613d40ef53534f664deba7b138fe566356b6ca10304e2b3b2529c/peft-0.18.0-py3-none-any.whl", hash = "sha256:624f69ca6393b765ccc6734adda7ca57d80b238f0900a42c357d8b67a03d62ff", size = 556427 },
+]
+
+[[package]]
+name = "pillow"
+version = "12.1.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/d0/02/d52c733a2452ef1ffcc123b68e6606d07276b0e358db70eabad7e40042b7/pillow-12.1.0.tar.gz", hash = "sha256:5c5ae0a06e9ea030ab786b0251b32c7e4ce10e58d983c0d5c56029455180b5b9", size = 46977283 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/fe/41/f73d92b6b883a579e79600d391f2e21cb0df767b2714ecbd2952315dfeef/pillow-12.1.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:fb125d860738a09d363a88daa0f59c4533529a90e564785e20fe875b200b6dbd", size = 5304089 },
+ { url = "https://files.pythonhosted.org/packages/94/55/7aca2891560188656e4a91ed9adba305e914a4496800da6b5c0a15f09edf/pillow-12.1.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cad302dc10fac357d3467a74a9561c90609768a6f73a1923b0fd851b6486f8b0", size = 4657815 },
+ { url = "https://files.pythonhosted.org/packages/e9/d2/b28221abaa7b4c40b7dba948f0f6a708bd7342c4d47ce342f0ea39643974/pillow-12.1.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:a40905599d8079e09f25027423aed94f2823adaf2868940de991e53a449e14a8", size = 6222593 },
+ { url = "https://files.pythonhosted.org/packages/71/b8/7a61fb234df6a9b0b479f69e66901209d89ff72a435b49933f9122f94cac/pillow-12.1.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:92a7fe4225365c5e3a8e598982269c6d6698d3e783b3b1ae979e7819f9cd55c1", size = 8027579 },
+ { url = "https://files.pythonhosted.org/packages/ea/51/55c751a57cc524a15a0e3db20e5cde517582359508d62305a627e77fd295/pillow-12.1.0-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f10c98f49227ed8383d28174ee95155a675c4ed7f85e2e573b04414f7e371bda", size = 6335760 },
+ { url = "https://files.pythonhosted.org/packages/dc/7c/60e3e6f5e5891a1a06b4c910f742ac862377a6fe842f7184df4a274ce7bf/pillow-12.1.0-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8637e29d13f478bc4f153d8daa9ffb16455f0a6cb287da1b432fdad2bfbd66c7", size = 7027127 },
+ { url = "https://files.pythonhosted.org/packages/06/37/49d47266ba50b00c27ba63a7c898f1bb41a29627ced8c09e25f19ebec0ff/pillow-12.1.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:21e686a21078b0f9cb8c8a961d99e6a4ddb88e0fc5ea6e130172ddddc2e5221a", size = 6449896 },
+ { url = "https://files.pythonhosted.org/packages/f9/e5/67fd87d2913902462cd9b79c6211c25bfe95fcf5783d06e1367d6d9a741f/pillow-12.1.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:2415373395a831f53933c23ce051021e79c8cd7979822d8cc478547a3f4da8ef", size = 7151345 },
+ { url = "https://files.pythonhosted.org/packages/bd/15/f8c7abf82af68b29f50d77c227e7a1f87ce02fdc66ded9bf603bc3b41180/pillow-12.1.0-cp310-cp310-win32.whl", hash = "sha256:e75d3dba8fc1ddfec0cd752108f93b83b4f8d6ab40e524a95d35f016b9683b09", size = 6325568 },
+ { url = "https://files.pythonhosted.org/packages/d4/24/7d1c0e160b6b5ac2605ef7d8be537e28753c0db5363d035948073f5513d7/pillow-12.1.0-cp310-cp310-win_amd64.whl", hash = "sha256:64efdf00c09e31efd754448a383ea241f55a994fd079866b92d2bbff598aad91", size = 7032367 },
+ { url = "https://files.pythonhosted.org/packages/f4/03/41c038f0d7a06099254c60f618d0ec7be11e79620fc23b8e85e5b31d9a44/pillow-12.1.0-cp310-cp310-win_arm64.whl", hash = "sha256:f188028b5af6b8fb2e9a76ac0f841a575bd1bd396e46ef0840d9b88a48fdbcea", size = 2452345 },
+ { url = "https://files.pythonhosted.org/packages/43/c4/bf8328039de6cc22182c3ef007a2abfbbdab153661c0a9aa78af8d706391/pillow-12.1.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:a83e0850cb8f5ac975291ebfc4170ba481f41a28065277f7f735c202cd8e0af3", size = 5304057 },
+ { url = "https://files.pythonhosted.org/packages/43/06/7264c0597e676104cc22ca73ee48f752767cd4b1fe084662620b17e10120/pillow-12.1.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:b6e53e82ec2db0717eabb276aa56cf4e500c9a7cec2c2e189b55c24f65a3e8c0", size = 4657811 },
+ { url = "https://files.pythonhosted.org/packages/72/64/f9189e44474610daf83da31145fa56710b627b5c4c0b9c235e34058f6b31/pillow-12.1.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:40a8e3b9e8773876d6e30daed22f016509e3987bab61b3b7fe309d7019a87451", size = 6232243 },
+ { url = "https://files.pythonhosted.org/packages/ef/30/0df458009be6a4caca4ca2c52975e6275c387d4e5c95544e34138b41dc86/pillow-12.1.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:800429ac32c9b72909c671aaf17ecd13110f823ddb7db4dfef412a5587c2c24e", size = 8037872 },
+ { url = "https://files.pythonhosted.org/packages/e4/86/95845d4eda4f4f9557e25381d70876aa213560243ac1a6d619c46caaedd9/pillow-12.1.0-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0b022eaaf709541b391ee069f0022ee5b36c709df71986e3f7be312e46f42c84", size = 6345398 },
+ { url = "https://files.pythonhosted.org/packages/5c/1f/8e66ab9be3aaf1435bc03edd1ebdf58ffcd17f7349c1d970cafe87af27d9/pillow-12.1.0-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1f345e7bc9d7f368887c712aa5054558bad44d2a301ddf9248599f4161abc7c0", size = 7034667 },
+ { url = "https://files.pythonhosted.org/packages/f9/f6/683b83cb9b1db1fb52b87951b1c0b99bdcfceaa75febf11406c19f82cb5e/pillow-12.1.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d70347c8a5b7ccd803ec0c85c8709f036e6348f1e6a5bf048ecd9c64d3550b8b", size = 6458743 },
+ { url = "https://files.pythonhosted.org/packages/9a/7d/de833d63622538c1d58ce5395e7c6cb7e7dce80decdd8bde4a484e095d9f/pillow-12.1.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:1fcc52d86ce7a34fd17cb04e87cfdb164648a3662a6f20565910a99653d66c18", size = 7159342 },
+ { url = "https://files.pythonhosted.org/packages/8c/40/50d86571c9e5868c42b81fe7da0c76ca26373f3b95a8dd675425f4a92ec1/pillow-12.1.0-cp311-cp311-win32.whl", hash = "sha256:3ffaa2f0659e2f740473bcf03c702c39a8d4b2b7ffc629052028764324842c64", size = 6328655 },
+ { url = "https://files.pythonhosted.org/packages/6c/af/b1d7e301c4cd26cd45d4af884d9ee9b6fab893b0ad2450d4746d74a6968c/pillow-12.1.0-cp311-cp311-win_amd64.whl", hash = "sha256:806f3987ffe10e867bab0ddad45df1148a2b98221798457fa097ad85d6e8bc75", size = 7031469 },
+ { url = "https://files.pythonhosted.org/packages/48/36/d5716586d887fb2a810a4a61518a327a1e21c8b7134c89283af272efe84b/pillow-12.1.0-cp311-cp311-win_arm64.whl", hash = "sha256:9f5fefaca968e700ad1a4a9de98bf0869a94e397fe3524c4c9450c1445252304", size = 2452515 },
+ { url = "https://files.pythonhosted.org/packages/20/31/dc53fe21a2f2996e1b7d92bf671cdb157079385183ef7c1ae08b485db510/pillow-12.1.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:a332ac4ccb84b6dde65dbace8431f3af08874bf9770719d32a635c4ef411b18b", size = 5262642 },
+ { url = "https://files.pythonhosted.org/packages/ab/c1/10e45ac9cc79419cedf5121b42dcca5a50ad2b601fa080f58c22fb27626e/pillow-12.1.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:907bfa8a9cb790748a9aa4513e37c88c59660da3bcfffbd24a7d9e6abf224551", size = 4657464 },
+ { url = "https://files.pythonhosted.org/packages/ad/26/7b82c0ab7ef40ebede7a97c72d473bda5950f609f8e0c77b04af574a0ddb/pillow-12.1.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:efdc140e7b63b8f739d09a99033aa430accce485ff78e6d311973a67b6bf3208", size = 6234878 },
+ { url = "https://files.pythonhosted.org/packages/76/25/27abc9792615b5e886ca9411ba6637b675f1b77af3104710ac7353fe5605/pillow-12.1.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:bef9768cab184e7ae6e559c032e95ba8d07b3023c289f79a2bd36e8bf85605a5", size = 8044868 },
+ { url = "https://files.pythonhosted.org/packages/0a/ea/f200a4c36d836100e7bc738fc48cd963d3ba6372ebc8298a889e0cfc3359/pillow-12.1.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:742aea052cf5ab5034a53c3846165bc3ce88d7c38e954120db0ab867ca242661", size = 6349468 },
+ { url = "https://files.pythonhosted.org/packages/11/8f/48d0b77ab2200374c66d344459b8958c86693be99526450e7aee714e03e4/pillow-12.1.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a6dfc2af5b082b635af6e08e0d1f9f1c4e04d17d4e2ca0ef96131e85eda6eb17", size = 7041518 },
+ { url = "https://files.pythonhosted.org/packages/1d/23/c281182eb986b5d31f0a76d2a2c8cd41722d6fb8ed07521e802f9bba52de/pillow-12.1.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:609e89d9f90b581c8d16358c9087df76024cf058fa693dd3e1e1620823f39670", size = 6462829 },
+ { url = "https://files.pythonhosted.org/packages/25/ef/7018273e0faac099d7b00982abdcc39142ae6f3bd9ceb06de09779c4a9d6/pillow-12.1.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:43b4899cfd091a9693a1278c4982f3e50f7fb7cff5153b05174b4afc9593b616", size = 7166756 },
+ { url = "https://files.pythonhosted.org/packages/8f/c8/993d4b7ab2e341fe02ceef9576afcf5830cdec640be2ac5bee1820d693d4/pillow-12.1.0-cp312-cp312-win32.whl", hash = "sha256:aa0c9cc0b82b14766a99fbe6084409972266e82f459821cd26997a488a7261a7", size = 6328770 },
+ { url = "https://files.pythonhosted.org/packages/a7/87/90b358775a3f02765d87655237229ba64a997b87efa8ccaca7dd3e36e7a7/pillow-12.1.0-cp312-cp312-win_amd64.whl", hash = "sha256:d70534cea9e7966169ad29a903b99fc507e932069a881d0965a1a84bb57f6c6d", size = 7033406 },
+ { url = "https://files.pythonhosted.org/packages/5d/cf/881b457eccacac9e5b2ddd97d5071fb6d668307c57cbf4e3b5278e06e536/pillow-12.1.0-cp312-cp312-win_arm64.whl", hash = "sha256:65b80c1ee7e14a87d6a068dd3b0aea268ffcabfe0498d38661b00c5b4b22e74c", size = 2452612 },
+ { url = "https://files.pythonhosted.org/packages/dd/c7/2530a4aa28248623e9d7f27316b42e27c32ec410f695929696f2e0e4a778/pillow-12.1.0-cp313-cp313-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7b5dd7cbae20285cdb597b10eb5a2c13aa9de6cde9bb64a3c1317427b1db1ae1", size = 4062543 },
+ { url = "https://files.pythonhosted.org/packages/8f/1f/40b8eae823dc1519b87d53c30ed9ef085506b05281d313031755c1705f73/pillow-12.1.0-cp313-cp313-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:29a4cef9cb672363926f0470afc516dbf7305a14d8c54f7abbb5c199cd8f8179", size = 4138373 },
+ { url = "https://files.pythonhosted.org/packages/d4/77/6fa60634cf06e52139fd0e89e5bbf055e8166c691c42fb162818b7fda31d/pillow-12.1.0-cp313-cp313-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:681088909d7e8fa9e31b9799aaa59ba5234c58e5e4f1951b4c4d1082a2e980e0", size = 3601241 },
+ { url = "https://files.pythonhosted.org/packages/4f/bf/28ab865de622e14b747f0cd7877510848252d950e43002e224fb1c9ababf/pillow-12.1.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:983976c2ab753166dc66d36af6e8ec15bb511e4a25856e2227e5f7e00a160587", size = 5262410 },
+ { url = "https://files.pythonhosted.org/packages/1c/34/583420a1b55e715937a85bd48c5c0991598247a1fd2eb5423188e765ea02/pillow-12.1.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:db44d5c160a90df2d24a24760bbd37607d53da0b34fb546c4c232af7192298ac", size = 4657312 },
+ { url = "https://files.pythonhosted.org/packages/1d/fd/f5a0896839762885b3376ff04878f86ab2b097c2f9a9cdccf4eda8ba8dc0/pillow-12.1.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:6b7a9d1db5dad90e2991645874f708e87d9a3c370c243c2d7684d28f7e133e6b", size = 6232605 },
+ { url = "https://files.pythonhosted.org/packages/98/aa/938a09d127ac1e70e6ed467bd03834350b33ef646b31edb7452d5de43792/pillow-12.1.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:6258f3260986990ba2fa8a874f8b6e808cf5abb51a94015ca3dc3c68aa4f30ea", size = 8041617 },
+ { url = "https://files.pythonhosted.org/packages/17/e8/538b24cb426ac0186e03f80f78bc8dc7246c667f58b540bdd57c71c9f79d/pillow-12.1.0-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e115c15e3bc727b1ca3e641a909f77f8ca72a64fff150f666fcc85e57701c26c", size = 6346509 },
+ { url = "https://files.pythonhosted.org/packages/01/9a/632e58ec89a32738cabfd9ec418f0e9898a2b4719afc581f07c04a05e3c9/pillow-12.1.0-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6741e6f3074a35e47c77b23a4e4f2d90db3ed905cb1c5e6e0d49bff2045632bc", size = 7038117 },
+ { url = "https://files.pythonhosted.org/packages/c7/a2/d40308cf86eada842ca1f3ffa45d0ca0df7e4ab33c83f81e73f5eaed136d/pillow-12.1.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:935b9d1aed48fcfb3f838caac506f38e29621b44ccc4f8a64d575cb1b2a88644", size = 6460151 },
+ { url = "https://files.pythonhosted.org/packages/f1/88/f5b058ad6453a085c5266660a1417bdad590199da1b32fb4efcff9d33b05/pillow-12.1.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:5fee4c04aad8932da9f8f710af2c1a15a83582cfb884152a9caa79d4efcdbf9c", size = 7164534 },
+ { url = "https://files.pythonhosted.org/packages/19/ce/c17334caea1db789163b5d855a5735e47995b0b5dc8745e9a3605d5f24c0/pillow-12.1.0-cp313-cp313-win32.whl", hash = "sha256:a786bf667724d84aa29b5db1c61b7bfdde380202aaca12c3461afd6b71743171", size = 6332551 },
+ { url = "https://files.pythonhosted.org/packages/e5/07/74a9d941fa45c90a0d9465098fe1ec85de3e2afbdc15cc4766622d516056/pillow-12.1.0-cp313-cp313-win_amd64.whl", hash = "sha256:461f9dfdafa394c59cd6d818bdfdbab4028b83b02caadaff0ffd433faf4c9a7a", size = 7040087 },
+ { url = "https://files.pythonhosted.org/packages/88/09/c99950c075a0e9053d8e880595926302575bc742b1b47fe1bbcc8d388d50/pillow-12.1.0-cp313-cp313-win_arm64.whl", hash = "sha256:9212d6b86917a2300669511ed094a9406888362e085f2431a7da985a6b124f45", size = 2452470 },
+ { url = "https://files.pythonhosted.org/packages/b5/ba/970b7d85ba01f348dee4d65412476321d40ee04dcb51cd3735b9dc94eb58/pillow-12.1.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:00162e9ca6d22b7c3ee8e61faa3c3253cd19b6a37f126cad04f2f88b306f557d", size = 5264816 },
+ { url = "https://files.pythonhosted.org/packages/10/60/650f2fb55fdba7a510d836202aa52f0baac633e50ab1cf18415d332188fb/pillow-12.1.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:7d6daa89a00b58c37cb1747ec9fb7ac3bc5ffd5949f5888657dfddde6d1312e0", size = 4660472 },
+ { url = "https://files.pythonhosted.org/packages/2b/c0/5273a99478956a099d533c4f46cbaa19fd69d606624f4334b85e50987a08/pillow-12.1.0-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:e2479c7f02f9d505682dc47df8c0ea1fc5e264c4d1629a5d63fe3e2334b89554", size = 6268974 },
+ { url = "https://files.pythonhosted.org/packages/b4/26/0bf714bc2e73d5267887d47931d53c4ceeceea6978148ed2ab2a4e6463c4/pillow-12.1.0-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:f188d580bd870cda1e15183790d1cc2fa78f666e76077d103edf048eed9c356e", size = 8073070 },
+ { url = "https://files.pythonhosted.org/packages/43/cf/1ea826200de111a9d65724c54f927f3111dc5ae297f294b370a670c17786/pillow-12.1.0-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0fde7ec5538ab5095cc02df38ee99b0443ff0e1c847a045554cf5f9af1f4aa82", size = 6380176 },
+ { url = "https://files.pythonhosted.org/packages/03/e0/7938dd2b2013373fd85d96e0f38d62b7a5a262af21ac274250c7ca7847c9/pillow-12.1.0-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0ed07dca4a8464bada6139ab38f5382f83e5f111698caf3191cb8dbf27d908b4", size = 7067061 },
+ { url = "https://files.pythonhosted.org/packages/86/ad/a2aa97d37272a929a98437a8c0ac37b3cf012f4f8721e1bd5154699b2518/pillow-12.1.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:f45bd71d1fa5e5749587613037b172e0b3b23159d1c00ef2fc920da6f470e6f0", size = 6491824 },
+ { url = "https://files.pythonhosted.org/packages/a4/44/80e46611b288d51b115826f136fb3465653c28f491068a72d3da49b54cd4/pillow-12.1.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:277518bf4fe74aa91489e1b20577473b19ee70fb97c374aa50830b279f25841b", size = 7190911 },
+ { url = "https://files.pythonhosted.org/packages/86/77/eacc62356b4cf81abe99ff9dbc7402750044aed02cfd6a503f7c6fc11f3e/pillow-12.1.0-cp313-cp313t-win32.whl", hash = "sha256:7315f9137087c4e0ee73a761b163fc9aa3b19f5f606a7fc08d83fd3e4379af65", size = 6336445 },
+ { url = "https://files.pythonhosted.org/packages/e7/3c/57d81d0b74d218706dafccb87a87ea44262c43eef98eb3b164fd000e0491/pillow-12.1.0-cp313-cp313t-win_amd64.whl", hash = "sha256:0ddedfaa8b5f0b4ffbc2fa87b556dc59f6bb4ecb14a53b33f9189713ae8053c0", size = 7045354 },
+ { url = "https://files.pythonhosted.org/packages/ac/82/8b9b97bba2e3576a340f93b044a3a3a09841170ab4c1eb0d5c93469fd32f/pillow-12.1.0-cp313-cp313t-win_arm64.whl", hash = "sha256:80941e6d573197a0c28f394753de529bb436b1ca990ed6e765cf42426abc39f8", size = 2454547 },
+ { url = "https://files.pythonhosted.org/packages/8c/87/bdf971d8bbcf80a348cc3bacfcb239f5882100fe80534b0ce67a784181d8/pillow-12.1.0-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:5cb7bc1966d031aec37ddb9dcf15c2da5b2e9f7cc3ca7c54473a20a927e1eb91", size = 4062533 },
+ { url = "https://files.pythonhosted.org/packages/ff/4f/5eb37a681c68d605eb7034c004875c81f86ec9ef51f5be4a63eadd58859a/pillow-12.1.0-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:97e9993d5ed946aba26baf9c1e8cf18adbab584b99f452ee72f7ee8acb882796", size = 4138546 },
+ { url = "https://files.pythonhosted.org/packages/11/6d/19a95acb2edbace40dcd582d077b991646b7083c41b98da4ed7555b59733/pillow-12.1.0-cp314-cp314-ios_13_0_x86_64_iphonesimulator.whl", hash = "sha256:414b9a78e14ffeb98128863314e62c3f24b8a86081066625700b7985b3f529bd", size = 3601163 },
+ { url = "https://files.pythonhosted.org/packages/fc/36/2b8138e51cb42e4cc39c3297713455548be855a50558c3ac2beebdc251dd/pillow-12.1.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:e6bdb408f7c9dd2a5ff2b14a3b0bb6d4deb29fb9961e6eb3ae2031ae9a5cec13", size = 5266086 },
+ { url = "https://files.pythonhosted.org/packages/53/4b/649056e4d22e1caa90816bf99cef0884aed607ed38075bd75f091a607a38/pillow-12.1.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:3413c2ae377550f5487991d444428f1a8ae92784aac79caa8b1e3b89b175f77e", size = 4657344 },
+ { url = "https://files.pythonhosted.org/packages/6c/6b/c5742cea0f1ade0cd61485dc3d81f05261fc2276f537fbdc00802de56779/pillow-12.1.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:e5dcbe95016e88437ecf33544ba5db21ef1b8dd6e1b434a2cb2a3d605299e643", size = 6232114 },
+ { url = "https://files.pythonhosted.org/packages/bf/8f/9f521268ce22d63991601aafd3d48d5ff7280a246a1ef62d626d67b44064/pillow-12.1.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d0a7735df32ccbcc98b98a1ac785cc4b19b580be1bdf0aeb5c03223220ea09d5", size = 8042708 },
+ { url = "https://files.pythonhosted.org/packages/1a/eb/257f38542893f021502a1bbe0c2e883c90b5cff26cc33b1584a841a06d30/pillow-12.1.0-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0c27407a2d1b96774cbc4a7594129cc027339fd800cd081e44497722ea1179de", size = 6347762 },
+ { url = "https://files.pythonhosted.org/packages/c4/5a/8ba375025701c09b309e8d5163c5a4ce0102fa86bbf8800eb0d7ac87bc51/pillow-12.1.0-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:15c794d74303828eaa957ff8070846d0efe8c630901a1c753fdc63850e19ecd9", size = 7039265 },
+ { url = "https://files.pythonhosted.org/packages/cf/dc/cf5e4cdb3db533f539e88a7bbf9f190c64ab8a08a9bc7a4ccf55067872e4/pillow-12.1.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:c990547452ee2800d8506c4150280757f88532f3de2a58e3022e9b179107862a", size = 6462341 },
+ { url = "https://files.pythonhosted.org/packages/d0/47/0291a25ac9550677e22eda48510cfc4fa4b2ef0396448b7fbdc0a6946309/pillow-12.1.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b63e13dd27da389ed9475b3d28510f0f954bca0041e8e551b2a4eb1eab56a39a", size = 7165395 },
+ { url = "https://files.pythonhosted.org/packages/4f/4c/e005a59393ec4d9416be06e6b45820403bb946a778e39ecec62f5b2b991e/pillow-12.1.0-cp314-cp314-win32.whl", hash = "sha256:1a949604f73eb07a8adab38c4fe50791f9919344398bdc8ac6b307f755fc7030", size = 6431413 },
+ { url = "https://files.pythonhosted.org/packages/1c/af/f23697f587ac5f9095d67e31b81c95c0249cd461a9798a061ed6709b09b5/pillow-12.1.0-cp314-cp314-win_amd64.whl", hash = "sha256:4f9f6a650743f0ddee5593ac9e954ba1bdbc5e150bc066586d4f26127853ab94", size = 7176779 },
+ { url = "https://files.pythonhosted.org/packages/b3/36/6a51abf8599232f3e9afbd16d52829376a68909fe14efe29084445db4b73/pillow-12.1.0-cp314-cp314-win_arm64.whl", hash = "sha256:808b99604f7873c800c4840f55ff389936ef1948e4e87645eaf3fccbc8477ac4", size = 2543105 },
+ { url = "https://files.pythonhosted.org/packages/82/54/2e1dd20c8749ff225080d6ba465a0cab4387f5db0d1c5fb1439e2d99923f/pillow-12.1.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:bc11908616c8a283cf7d664f77411a5ed2a02009b0097ff8abbba5e79128ccf2", size = 5268571 },
+ { url = "https://files.pythonhosted.org/packages/57/61/571163a5ef86ec0cf30d265ac2a70ae6fc9e28413d1dc94fa37fae6bda89/pillow-12.1.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:896866d2d436563fa2a43a9d72f417874f16b5545955c54a64941e87c1376c61", size = 4660426 },
+ { url = "https://files.pythonhosted.org/packages/5e/e1/53ee5163f794aef1bf84243f755ee6897a92c708505350dd1923f4afec48/pillow-12.1.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8e178e3e99d3c0ea8fc64b88447f7cac8ccf058af422a6cedc690d0eadd98c51", size = 6269908 },
+ { url = "https://files.pythonhosted.org/packages/bc/0b/b4b4106ff0ee1afa1dc599fde6ab230417f800279745124f6c50bcffed8e/pillow-12.1.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:079af2fb0c599c2ec144ba2c02766d1b55498e373b3ac64687e43849fbbef5bc", size = 8074733 },
+ { url = "https://files.pythonhosted.org/packages/19/9f/80b411cbac4a732439e629a26ad3ef11907a8c7fc5377b7602f04f6fe4e7/pillow-12.1.0-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bdec5e43377761c5dbca620efb69a77f6855c5a379e32ac5b158f54c84212b14", size = 6381431 },
+ { url = "https://files.pythonhosted.org/packages/8f/b7/d65c45db463b66ecb6abc17c6ba6917a911202a07662247e1355ce1789e7/pillow-12.1.0-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:565c986f4b45c020f5421a4cea13ef294dde9509a8577f29b2fc5edc7587fff8", size = 7068529 },
+ { url = "https://files.pythonhosted.org/packages/50/96/dfd4cd726b4a45ae6e3c669fc9e49deb2241312605d33aba50499e9d9bd1/pillow-12.1.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:43aca0a55ce1eefc0aefa6253661cb54571857b1a7b2964bd8a1e3ef4b729924", size = 6492981 },
+ { url = "https://files.pythonhosted.org/packages/4d/1c/b5dc52cf713ae46033359c5ca920444f18a6359ce1020dd3e9c553ea5bc6/pillow-12.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0deedf2ea233722476b3a81e8cdfbad786f7adbed5d848469fa59fe52396e4ef", size = 7191878 },
+ { url = "https://files.pythonhosted.org/packages/53/26/c4188248bd5edaf543864fe4834aebe9c9cb4968b6f573ce014cc42d0720/pillow-12.1.0-cp314-cp314t-win32.whl", hash = "sha256:b17fbdbe01c196e7e159aacb889e091f28e61020a8abeac07b68079b6e626988", size = 6438703 },
+ { url = "https://files.pythonhosted.org/packages/b8/0e/69ed296de8ea05cb03ee139cee600f424ca166e632567b2d66727f08c7ed/pillow-12.1.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27b9baecb428899db6c0de572d6d305cfaf38ca1596b5c0542a5182e3e74e8c6", size = 7182927 },
+ { url = "https://files.pythonhosted.org/packages/fc/f5/68334c015eed9b5cff77814258717dec591ded209ab5b6fb70e2ae873d1d/pillow-12.1.0-cp314-cp314t-win_arm64.whl", hash = "sha256:f61333d817698bdcdd0f9d7793e365ac3d2a21c1f1eb02b32ad6aefb8d8ea831", size = 2545104 },
+ { url = "https://files.pythonhosted.org/packages/8b/bc/224b1d98cffd7164b14707c91aac83c07b047fbd8f58eba4066a3e53746a/pillow-12.1.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:ca94b6aac0d7af2a10ba08c0f888b3d5114439b6b3ef39968378723622fed377", size = 5228605 },
+ { url = "https://files.pythonhosted.org/packages/0c/ca/49ca7769c4550107de049ed85208240ba0f330b3f2e316f24534795702ce/pillow-12.1.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:351889afef0f485b84078ea40fe33727a0492b9af3904661b0abbafee0355b72", size = 4622245 },
+ { url = "https://files.pythonhosted.org/packages/73/48/fac807ce82e5955bcc2718642b94b1bd22a82a6d452aea31cbb678cddf12/pillow-12.1.0-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:bb0984b30e973f7e2884362b7d23d0a348c7143ee559f38ef3eaab640144204c", size = 5247593 },
+ { url = "https://files.pythonhosted.org/packages/d2/95/3e0742fe358c4664aed4fd05d5f5373dcdad0b27af52aa0972568541e3f4/pillow-12.1.0-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:84cabc7095dd535ca934d57e9ce2a72ffd216e435a84acb06b2277b1de2689bd", size = 6989008 },
+ { url = "https://files.pythonhosted.org/packages/5a/74/fe2ac378e4e202e56d50540d92e1ef4ff34ed687f3c60f6a121bcf99437e/pillow-12.1.0-pp311-pypy311_pp73-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:53d8b764726d3af1a138dd353116f774e3862ec7e3794e0c8781e30db0f35dfc", size = 5313824 },
+ { url = "https://files.pythonhosted.org/packages/f3/77/2a60dee1adee4e2655ac328dd05c02a955c1cd683b9f1b82ec3feb44727c/pillow-12.1.0-pp311-pypy311_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5da841d81b1a05ef940a8567da92decaa15bc4d7dedb540a8c219ad83d91808a", size = 5963278 },
+ { url = "https://files.pythonhosted.org/packages/2d/71/64e9b1c7f04ae0027f788a248e6297d7fcc29571371fe7d45495a78172c0/pillow-12.1.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:75af0b4c229ac519b155028fa1be632d812a519abba9b46b20e50c6caa184f19", size = 7029809 },
+]
+
+[[package]]
+name = "pillow-heif"
+version = "1.1.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "pillow" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/64/65/77284daf2a8a2849b9040889bd8e1b845e693ed97973a28ba2122b8922ad/pillow_heif-1.1.1.tar.gz", hash = "sha256:f60e8c8a8928556104cec4fff39d43caa1da105625bdb53b11ce3c89d09b6bde", size = 18271952 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/be/58/365e2678cd74db7f36af1faafb9ed626273c73000cf951bac4761a399415/pillow_heif-1.1.1-cp310-cp310-macosx_10_15_x86_64.whl", hash = "sha256:7048eb0ecae3b230f086ec913ab2798dcf21d0301edecf3061b34ed50a5d4411", size = 4696597 },
+ { url = "https://files.pythonhosted.org/packages/33/ab/66359a2674aa8d7b220761b154d18928b67d46a43c7480468f95d98f730b/pillow_heif-1.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e2a1eca5eca44336ea213a7acd9b50572e15d77b6065c962cc9f61137b6a5b55", size = 3451082 },
+ { url = "https://files.pythonhosted.org/packages/5c/81/11ca3798065b765a5b592d0ccc567d19b835f85f8ba5908b7566b318630b/pillow_heif-1.1.1-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:dcc25739ceff0701d32693de8e5b65ff92163638f1c3c2466e203b7b978b8ddc", size = 5772935 },
+ { url = "https://files.pythonhosted.org/packages/af/52/752eaa40f015a01ae5ea453baee9affdd87a332bfaa5bd9f95d56a41282e/pillow_heif-1.1.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:75d79393fcbcc50ef7a01b7dd5b716e08f78bd5542ded6e4c51121f59d5be8da", size = 5503711 },
+ { url = "https://files.pythonhosted.org/packages/29/28/eca3d19eea58d24bb5d24ac04bc9432028b4a128437d2ce1bcccf52159d1/pillow_heif-1.1.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:03ba3f7e8b13b07636f5a87a6ec5ed1e39b2aa20d4b645b83c80d40be0abeb50", size = 6808883 },
+ { url = "https://files.pythonhosted.org/packages/8a/18/db7020967c7e0d1dbd2f375f01bafd0e48034ef09ef6a47ce4958ed5f7a0/pillow_heif-1.1.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:c85fa6f9c0c2c572b1b146443813519ca9a942ef51e92858387c6dca2bbc42f9", size = 6430877 },
+ { url = "https://files.pythonhosted.org/packages/7b/88/ec468eff5cfed8501c354d46abd7371b69265da55c7b4e64261ce07cab9e/pillow_heif-1.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:36e98bee9cd707b1daa865fec0ff505431746587ce471b44b5eab61a115e800a", size = 5422268 },
+ { url = "https://files.pythonhosted.org/packages/ec/13/dd7908c39ea368abd2d25e4fa3eef97a29cc5446c9ba0d47b1fe13564f79/pillow_heif-1.1.1-cp311-cp311-macosx_10_15_x86_64.whl", hash = "sha256:57c140368c7ddefa20ecb9b737b4af2d2d5ea0806d1d59be4c525e6a73e6aa72", size = 4696596 },
+ { url = "https://files.pythonhosted.org/packages/93/a2/dbcbfd4264d19ce5b1776327f25633cc20b2b2840fc602d85341dcfce782/pillow_heif-1.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0b6ae0b002ecc7873273ded99aaffa567f7806f4bc57ee1eff7ab5fe1f70e5e7", size = 3451082 },
+ { url = "https://files.pythonhosted.org/packages/a7/7b/2488882acf9756c8d22108e1828232cdd216a3d333a1824cd41eee102632/pillow_heif-1.1.1-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:39ea2fe8878e722bdfaf30a9b711629c3a4b8a0627b70a833f7381cbd3ef8e87", size = 5774792 },
+ { url = "https://files.pythonhosted.org/packages/97/aa/c048f7e337ef40a86a2501d264a0f430ab8772c35306c907b1e00ddf5099/pillow_heif-1.1.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8a01644c3c4bc576437c05e1ece4b89814fc381684f5d7926850e01d6e9b6502", size = 5505379 },
+ { url = "https://files.pythonhosted.org/packages/a0/6a/28ca3dbfdd1bf2e0aaebcb38b2c375ab76ee647588a8a91200f0a0c3cb5b/pillow_heif-1.1.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:5ebe3b7f707b984c8886f367697531d004967b7d8949a34645c7bc1c6a888fe6", size = 6810454 },
+ { url = "https://files.pythonhosted.org/packages/64/87/a1909c6c8514b9cc451633e92d9c1088268ea0e913deabd7bb5740a5abe7/pillow_heif-1.1.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:c8c8e1a561877006a5a0b654392e614c879d9e4db89d0786a94fe9f5773bcacb", size = 6432367 },
+ { url = "https://files.pythonhosted.org/packages/99/48/fa2407203087be5424d514c40a816eee517450e98772c1f00fe846b87a8b/pillow_heif-1.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:3d296f874bea4dd17bab7309b843a766834d2b5df53c591eaf3f7cdc91a4c1a3", size = 5422266 },
+ { url = "https://files.pythonhosted.org/packages/1d/fc/d9180eda35144105b6ffd3ed27363d699f0d83bbc4264bbe5638438a3b69/pillow_heif-1.1.1-cp312-cp312-macosx_10_15_x86_64.whl", hash = "sha256:b3a66c7d3a4ad2f9f6d08b81e102210e1b676039dbd2522b88b6957ada2186e3", size = 4696824 },
+ { url = "https://files.pythonhosted.org/packages/fd/b0/73050dd10e7d40f01ed92f6611b0acd60d502c1fa1f1c177d89ee2869616/pillow_heif-1.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9b31fd9b5b3c3f056f98f806e2ffe0f54710700045e28f68568753e56101d2ca", size = 3451081 },
+ { url = "https://files.pythonhosted.org/packages/c8/dd/82e638077bc2fa197229e200af028375e6665bb863599d9e3833abf88803/pillow_heif-1.1.1-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:dea5f8a304e6b7fee3f76ac7756962af72e51bafab1bba07993a8c8fc57d5a79", size = 5773351 },
+ { url = "https://files.pythonhosted.org/packages/e0/08/c108b3490f745b2ed191e728c89437310ea5e587a9d4c76f0118f66a038f/pillow_heif-1.1.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34e36485409468816227fbbf59b8ae4c7567702e066ca6e2a8b5e423a7a2fe92", size = 5504698 },
+ { url = "https://files.pythonhosted.org/packages/c4/65/98f5593dfdf65488a24441dfcd703f4281118e2da2396789153285ee89e1/pillow_heif-1.1.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:561e8086128df0aeb6ea68b4fd60bb18428a65099f95349a6674718e4f8132bd", size = 6809294 },
+ { url = "https://files.pythonhosted.org/packages/e0/69/2f8a985d51593bd66f051744fdfde67f78b78bc10274d63b4568d7c6c8c3/pillow_heif-1.1.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:da66c0c6b119042dda6efb67ca30fcb00f0715eb6205e5636ab487d76f1699ad", size = 6431689 },
+ { url = "https://files.pythonhosted.org/packages/80/65/b3f9324385caa494f4cd9255f9e6423791520fa07b4ca79fe4632f841ef6/pillow_heif-1.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:9af92c2a3492b9bb4625b1f6ec7da17ec185e6b77d519d71c06d7e79c65a6f9e", size = 5422359 },
+ { url = "https://files.pythonhosted.org/packages/c2/1d/2ea075d537b4ac9f5fb0c53fd543a764f5f1dee1fe6bea8fb5b34018cf94/pillow_heif-1.1.1-cp313-cp313-macosx_10_15_x86_64.whl", hash = "sha256:8269cae2e0232f73bda5128181a42fbbb562c29b76fbcced22fef70a61b94dbe", size = 4696826 },
+ { url = "https://files.pythonhosted.org/packages/2e/6f/860fab6d6e6f04f13b97a8d9150816fa16feb3f7a2fe2d8ab4b460adc711/pillow_heif-1.1.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:08787cc64b4a519789a348f137b914981ce520d4b906e09e2b8e974c87e3e215", size = 3451076 },
+ { url = "https://files.pythonhosted.org/packages/b1/9a/711f77c7c6e00fa1ae0e890a36a5be03c47170b6cbb88fc92761bee0fff5/pillow_heif-1.1.1-cp313-cp313-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ac0fc8523a77c351991f78766d41290241dd87fbe036b6f777c49f2bd3561119", size = 5773389 },
+ { url = "https://files.pythonhosted.org/packages/50/c8/50e2d1adede807dc1d3b35f2cfa28d7f8e73e9d56cb560dc94b1d7053b75/pillow_heif-1.1.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:18db6c78b8fa52065339ffb69739f5c45748c0b5f836349f0aba786f7bb905ab", size = 5504774 },
+ { url = "https://files.pythonhosted.org/packages/03/c2/0fa0ebaaec2a7e548989b84a2561300137d9999fc780d24ad7d6d4ef9417/pillow_heif-1.1.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:c5db8a8ee7ee4b1311f81d223d32538d63a73adc2ece7610a9f19519856c8e68", size = 6809350 },
+ { url = "https://files.pythonhosted.org/packages/85/cc/b0eee2b939a362dcccb96483f8d172b64df192ec93445103be04634255c8/pillow_heif-1.1.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:a2e6d4f7209aade2d55bbbcdbbbe623118722bcc7a12edef15cf4ee0d8586c3e", size = 6431750 },
+ { url = "https://files.pythonhosted.org/packages/dd/0b/a559ad48a5c03db5ecdc7c8b8dd04df3cb1072c0f983bcaebd26e1e63442/pillow_heif-1.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:ff158ff338082d39864abd31c69ae2ee57de3f193c85ccbe365f4d7260712229", size = 5422353 },
+ { url = "https://files.pythonhosted.org/packages/8e/f8/6c3fd8a28ea16236d40d6885b3babd801a2e7bdb73ee52a293eb34de7afc/pillow_heif-1.1.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:7f19389ffeb3866f95370eb917e6a32706c110a9fa670daefb63b5660948a82e", size = 4696793 },
+ { url = "https://files.pythonhosted.org/packages/28/09/f2ffdac98465d00b6244c4333d2f73e815351beb6fa1d22f489797f0411c/pillow_heif-1.1.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:8d5fa5539ff3c7bbe64aa446c10bf10f6d8c1604997a66b195bec02e2965eb10", size = 3451160 },
+ { url = "https://files.pythonhosted.org/packages/84/93/a801624eb86e8e0a2a6212a10da6c69beb7060be569fe36100d96a2d9e2c/pillow_heif-1.1.1-cp314-cp314-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f9b08c81602ffd660cd27456fbfa3cbf396cf23bb39d3015cc7a6cd56ade82fd", size = 5773568 },
+ { url = "https://files.pythonhosted.org/packages/e8/fd/7d619b7b9386abd6228b1465450ea0bb8a3875b1e22c4f9e5bbd598224ae/pillow_heif-1.1.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0f2d68af87d5e1f6af0db021b61f62e456f413eba98ea7723d7f49f2a6f1f01", size = 5504865 },
+ { url = "https://files.pythonhosted.org/packages/44/72/35b5a8a5cbdcb38968328a8d8f2385f38328141dca6dc52d8e192a36e256/pillow_heif-1.1.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:e486b15696a958a04178aa9ff7f7db4f803d1ec7bbded924671576125c052ed5", size = 6809536 },
+ { url = "https://files.pythonhosted.org/packages/23/70/fc0e0cc6b864f53be2833b23cadd1d1a480a51d6b2d5efd5c4c119e8112e/pillow_heif-1.1.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:a37999e53c0cd32401667303e0b34c43240c32530809827091fabc7eb04d7cad", size = 6431784 },
+ { url = "https://files.pythonhosted.org/packages/96/0e/af38e5cbca622fceaa1ee8eba8e68b3c6bf1bd6e6a37eca3817bf3dcebdc/pillow_heif-1.1.1-cp314-cp314-win_amd64.whl", hash = "sha256:1d35e973b2463b03f7b0bd5c898c7a424a46d69f7c20a9c251b322dfe4f45068", size = 5577269 },
+ { url = "https://files.pythonhosted.org/packages/d6/fc/cf4d27be4a367fedfb76a92e8134ea2cacb3112dfb0dbb159ec4248bec29/pillow_heif-1.1.1-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:a3cdb939e4d6d4879f09edd9225d0813350ecae1901b8ea7a1172caf9e644ba5", size = 4685374 },
+ { url = "https://files.pythonhosted.org/packages/0a/a6/30be7dca129a7d35352270d93dee746efbecb52b5e24839f6aa850d742c1/pillow_heif-1.1.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:9c9f6911a6107f9ac4194d3793a36df0b43352ceb13dd379c8ecfbd24b6ca53f", size = 3447638 },
+ { url = "https://files.pythonhosted.org/packages/a8/e6/b6bb6dc64904fb471c49d7012135a029bce48cc236812d1f0c6aba27db2b/pillow_heif-1.1.1-pp310-pypy310_pp73-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bbcebadabbce24134f602c50db0ebf5632d9ef80a04c5167964c419b3d2f14a5", size = 5733397 },
+ { url = "https://files.pythonhosted.org/packages/db/47/eff35ab7f2e0bf1bac61c895fe07afa88e4a51deea098b63855c8936493e/pillow_heif-1.1.1-pp310-pypy310_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2fa5253dc6491d457425db34326f78638ea65938be4a631edd4b7198d7d088ab", size = 5461116 },
+ { url = "https://files.pythonhosted.org/packages/e4/b1/666aeeee67d8de3d9e0d38170eb754718727c61f2cf7bc183261ff1a6123/pillow_heif-1.1.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:aac2c3634ee420bb30e19090a1e1870e6ed12717020891cd6ffd34c3cca5c412", size = 5422660 },
+ { url = "https://files.pythonhosted.org/packages/17/7e/e7182fd74e911993ac3d4522ce43af439888baff14d8bc75fe9ee5a95580/pillow_heif-1.1.1-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:0ea9c72f5cbe1b35229be883797eb7f113d2e7353dc21a66fd813a33d95a16b3", size = 4685305 },
+ { url = "https://files.pythonhosted.org/packages/aa/92/181b49961411b89c857cbb984030aa6ab0886a059be574b0f7f402e098cf/pillow_heif-1.1.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:16f83a7e0ad3aa4209ae592db2842d35faab21b44d269fb3b1145e07ecbecebc", size = 3447553 },
+ { url = "https://files.pythonhosted.org/packages/d5/c5/2ce061f60d52a1603c0e8634409a480c8ff799379ab0822b8e9c1d9a78bd/pillow_heif-1.1.1-pp311-pypy311_pp73-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7fc8273124fe96d83fd6dee9476a5b58b6338cb41ffe97581fc2e8f17c97864c", size = 5733421 },
+ { url = "https://files.pythonhosted.org/packages/49/9a/9e6cfc339b2de5cb19e7762f89b59e6ef15fb41219f7e382bb2d507245bb/pillow_heif-1.1.1-pp311-pypy311_pp73-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ca64d2e83b28ae7f194640e1c6d5d842de8f061845a4fd700a4ab7efb9df15f9", size = 5461117 },
+ { url = "https://files.pythonhosted.org/packages/20/c5/1912f3b9220a91ef449a710bce1a3128a633b44d86a17ef58fb376403bfd/pillow_heif-1.1.1-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:7520b37f183f5339c9a0dbdd4cae468cc7d7f191fff26fd18d8d96cf69089994", size = 5422656 },
+]
+
+[[package]]
+name = "platformdirs"
+version = "4.5.1"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/cf/86/0248f086a84f01b37aaec0fa567b397df1a119f73c16f6c7a9aac73ea309/platformdirs-4.5.1.tar.gz", hash = "sha256:61d5cdcc6065745cdd94f0f878977f8de9437be93de97c1c12f853c9c0cdcbda", size = 21715 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/cb/28/3bfe2fa5a7b9c46fe7e13c97bda14c895fb10fa2ebf1d0abb90e0cea7ee1/platformdirs-4.5.1-py3-none-any.whl", hash = "sha256:d03afa3963c806a9bed9d5125c8f4cb2fdaf74a55ab60e5d59b3fde758104d31", size = 18731 },
+]
+
+[[package]]
+name = "pluggy"
+version = "1.6.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538 },
+]
+
+[[package]]
+name = "pre-commit"
+version = "4.5.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "cfgv" },
+ { name = "identify" },
+ { name = "nodeenv" },
+ { name = "pyyaml" },
+ { name = "virtualenv" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/40/f1/6d86a29246dfd2e9b6237f0b5823717f60cad94d47ddc26afa916d21f525/pre_commit-4.5.1.tar.gz", hash = "sha256:eb545fcff725875197837263e977ea257a402056661f09dae08e4b149b030a61", size = 198232 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/5d/19/fd3ef348460c80af7bb4669ea7926651d1f95c23ff2df18b9d24bab4f3fa/pre_commit-4.5.1-py2.py3-none-any.whl", hash = "sha256:3b3afd891e97337708c1674210f8eba659b52a38ea5f822ff142d10786221f77", size = 226437 },
+]
+
+[[package]]
+name = "protobuf"
+version = "6.33.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/34/44/e49ecff446afeec9d1a66d6bbf9adc21e3c7cea7803a920ca3773379d4f6/protobuf-6.33.2.tar.gz", hash = "sha256:56dc370c91fbb8ac85bc13582c9e373569668a290aa2e66a590c2a0d35ddb9e4", size = 444296 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/bc/91/1e3a34881a88697a7354ffd177e8746e97a722e5e8db101544b47e84afb1/protobuf-6.33.2-cp310-abi3-win32.whl", hash = "sha256:87eb388bd2d0f78febd8f4c8779c79247b26a5befad525008e49a6955787ff3d", size = 425603 },
+ { url = "https://files.pythonhosted.org/packages/64/20/4d50191997e917ae13ad0a235c8b42d8c1ab9c3e6fd455ca16d416944355/protobuf-6.33.2-cp310-abi3-win_amd64.whl", hash = "sha256:fc2a0e8b05b180e5fc0dd1559fe8ebdae21a27e81ac77728fb6c42b12c7419b4", size = 436930 },
+ { url = "https://files.pythonhosted.org/packages/b2/ca/7e485da88ba45c920fb3f50ae78de29ab925d9e54ef0de678306abfbb497/protobuf-6.33.2-cp39-abi3-macosx_10_9_universal2.whl", hash = "sha256:d9b19771ca75935b3a4422957bc518b0cecb978b31d1dd12037b088f6bcc0e43", size = 427621 },
+ { url = "https://files.pythonhosted.org/packages/7d/4f/f743761e41d3b2b2566748eb76bbff2b43e14d5fcab694f494a16458b05f/protobuf-6.33.2-cp39-abi3-manylinux2014_aarch64.whl", hash = "sha256:b5d3b5625192214066d99b2b605f5783483575656784de223f00a8d00754fc0e", size = 324460 },
+ { url = "https://files.pythonhosted.org/packages/b1/fa/26468d00a92824020f6f2090d827078c09c9c587e34cbfd2d0c7911221f8/protobuf-6.33.2-cp39-abi3-manylinux2014_s390x.whl", hash = "sha256:8cd7640aee0b7828b6d03ae518b5b4806fdfc1afe8de82f79c3454f8aef29872", size = 339168 },
+ { url = "https://files.pythonhosted.org/packages/56/13/333b8f421738f149d4fe5e49553bc2a2ab75235486259f689b4b91f96cec/protobuf-6.33.2-cp39-abi3-manylinux2014_x86_64.whl", hash = "sha256:1f8017c48c07ec5859106533b682260ba3d7c5567b1ca1f24297ce03384d1b4f", size = 323270 },
+ { url = "https://files.pythonhosted.org/packages/0e/15/4f02896cc3df04fc465010a4c6a0cd89810f54617a32a70ef531ed75d61c/protobuf-6.33.2-py3-none-any.whl", hash = "sha256:7636aad9bb01768870266de5dc009de2d1b936771b38a793f73cbbf279c91c5c", size = 170501 },
+]
+
+[[package]]
+name = "psutil"
+version = "7.2.1"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/73/cb/09e5184fb5fc0358d110fc3ca7f6b1d033800734d34cac10f4136cfac10e/psutil-7.2.1.tar.gz", hash = "sha256:f7583aec590485b43ca601dd9cea0dcd65bd7bb21d30ef4ddbf4ea6b5ed1bdd3", size = 490253 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/77/8e/f0c242053a368c2aa89584ecd1b054a18683f13d6e5a318fc9ec36582c94/psutil-7.2.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:ba9f33bb525b14c3ea563b2fd521a84d2fa214ec59e3e6a2858f78d0844dd60d", size = 129624 },
+ { url = "https://files.pythonhosted.org/packages/26/97/a58a4968f8990617decee234258a2b4fc7cd9e35668387646c1963e69f26/psutil-7.2.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:81442dac7abfc2f4f4385ea9e12ddf5a796721c0f6133260687fec5c3780fa49", size = 130132 },
+ { url = "https://files.pythonhosted.org/packages/db/6d/ed44901e830739af5f72a85fa7ec5ff1edea7f81bfbf4875e409007149bd/psutil-7.2.1-cp313-cp313t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ea46c0d060491051d39f0d2cff4f98d5c72b288289f57a21556cc7d504db37fc", size = 180612 },
+ { url = "https://files.pythonhosted.org/packages/c7/65/b628f8459bca4efbfae50d4bf3feaab803de9a160b9d5f3bd9295a33f0c2/psutil-7.2.1-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:35630d5af80d5d0d49cfc4d64c1c13838baf6717a13effb35869a5919b854cdf", size = 183201 },
+ { url = "https://files.pythonhosted.org/packages/fb/23/851cadc9764edcc18f0effe7d0bf69f727d4cf2442deb4a9f78d4e4f30f2/psutil-7.2.1-cp313-cp313t-win_amd64.whl", hash = "sha256:923f8653416604e356073e6e0bccbe7c09990acef442def2f5640dd0faa9689f", size = 139081 },
+ { url = "https://files.pythonhosted.org/packages/59/82/d63e8494ec5758029f31c6cb06d7d161175d8281e91d011a4a441c8a43b5/psutil-7.2.1-cp313-cp313t-win_arm64.whl", hash = "sha256:cfbe6b40ca48019a51827f20d830887b3107a74a79b01ceb8cc8de4ccb17b672", size = 134767 },
+ { url = "https://files.pythonhosted.org/packages/05/c2/5fb764bd61e40e1fe756a44bd4c21827228394c17414ade348e28f83cd79/psutil-7.2.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:494c513ccc53225ae23eec7fe6e1482f1b8a44674241b54561f755a898650679", size = 129716 },
+ { url = "https://files.pythonhosted.org/packages/c9/d2/935039c20e06f615d9ca6ca0ab756cf8408a19d298ffaa08666bc18dc805/psutil-7.2.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:3fce5f92c22b00cdefd1645aa58ab4877a01679e901555067b1bd77039aa589f", size = 130133 },
+ { url = "https://files.pythonhosted.org/packages/77/69/19f1eb0e01d24c2b3eacbc2f78d3b5add8a89bf0bb69465bc8d563cc33de/psutil-7.2.1-cp314-cp314t-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:93f3f7b0bb07711b49626e7940d6fe52aa9940ad86e8f7e74842e73189712129", size = 181518 },
+ { url = "https://files.pythonhosted.org/packages/e1/6d/7e18b1b4fa13ad370787626c95887b027656ad4829c156bb6569d02f3262/psutil-7.2.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d34d2ca888208eea2b5c68186841336a7f5e0b990edec929be909353a202768a", size = 184348 },
+ { url = "https://files.pythonhosted.org/packages/98/60/1672114392dd879586d60dd97896325df47d9a130ac7401318005aab28ec/psutil-7.2.1-cp314-cp314t-win_amd64.whl", hash = "sha256:2ceae842a78d1603753561132d5ad1b2f8a7979cb0c283f5b52fb4e6e14b1a79", size = 140400 },
+ { url = "https://files.pythonhosted.org/packages/fb/7b/d0e9d4513c46e46897b46bcfc410d51fc65735837ea57a25170f298326e6/psutil-7.2.1-cp314-cp314t-win_arm64.whl", hash = "sha256:08a2f175e48a898c8eb8eace45ce01777f4785bc744c90aa2cc7f2fa5462a266", size = 135430 },
+ { url = "https://files.pythonhosted.org/packages/c5/cf/5180eb8c8bdf6a503c6919f1da28328bd1e6b3b1b5b9d5b01ae64f019616/psutil-7.2.1-cp36-abi3-macosx_10_9_x86_64.whl", hash = "sha256:b2e953fcfaedcfbc952b44744f22d16575d3aa78eb4f51ae74165b4e96e55f42", size = 128137 },
+ { url = "https://files.pythonhosted.org/packages/c5/2c/78e4a789306a92ade5000da4f5de3255202c534acdadc3aac7b5458fadef/psutil-7.2.1-cp36-abi3-macosx_11_0_arm64.whl", hash = "sha256:05cc68dbb8c174828624062e73078e7e35406f4ca2d0866c272c2410d8ef06d1", size = 128947 },
+ { url = "https://files.pythonhosted.org/packages/29/f8/40e01c350ad9a2b3cb4e6adbcc8a83b17ee50dd5792102b6142385937db5/psutil-7.2.1-cp36-abi3-manylinux2010_x86_64.manylinux_2_12_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5e38404ca2bb30ed7267a46c02f06ff842e92da3bb8c5bfdadbd35a5722314d8", size = 154694 },
+ { url = "https://files.pythonhosted.org/packages/06/e4/b751cdf839c011a9714a783f120e6a86b7494eb70044d7d81a25a5cd295f/psutil-7.2.1-cp36-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ab2b98c9fc19f13f59628d94df5cc4cc4844bc572467d113a8b517d634e362c6", size = 156136 },
+ { url = "https://files.pythonhosted.org/packages/44/ad/bbf6595a8134ee1e94a4487af3f132cef7fce43aef4a93b49912a48c3af7/psutil-7.2.1-cp36-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:f78baafb38436d5a128f837fab2d92c276dfb48af01a240b861ae02b2413ada8", size = 148108 },
+ { url = "https://files.pythonhosted.org/packages/1c/15/dd6fd869753ce82ff64dcbc18356093471a5a5adf4f77ed1f805d473d859/psutil-7.2.1-cp36-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:99a4cd17a5fdd1f3d014396502daa70b5ec21bf4ffe38393e152f8e449757d67", size = 147402 },
+ { url = "https://files.pythonhosted.org/packages/34/68/d9317542e3f2b180c4306e3f45d3c922d7e86d8ce39f941bb9e2e9d8599e/psutil-7.2.1-cp37-abi3-win_amd64.whl", hash = "sha256:b1b0671619343aa71c20ff9767eced0483e4fc9e1f489d50923738caf6a03c17", size = 136938 },
+ { url = "https://files.pythonhosted.org/packages/3e/73/2ce007f4198c80fcf2cb24c169884f833fe93fbc03d55d302627b094ee91/psutil-7.2.1-cp37-abi3-win_arm64.whl", hash = "sha256:0d67c1822c355aa6f7314d92018fb4268a76668a536f133599b91edd48759442", size = 133836 },
+]
+
+[[package]]
+name = "pydantic"
+version = "2.12.5"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "annotated-types" },
+ { name = "pydantic-core" },
+ { name = "typing-extensions" },
+ { name = "typing-inspection" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/69/44/36f1a6e523abc58ae5f928898e4aca2e0ea509b5aa6f6f392a5d882be928/pydantic-2.12.5.tar.gz", hash = "sha256:4d351024c75c0f085a9febbb665ce8c0c6ec5d30e903bdb6394b7ede26aebb49", size = 821591 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/5a/87/b70ad306ebb6f9b585f114d0ac2137d792b48be34d732d60e597c2f8465a/pydantic-2.12.5-py3-none-any.whl", hash = "sha256:e561593fccf61e8a20fc46dfc2dfe075b8be7d0188df33f221ad1f0139180f9d", size = 463580 },
+]
+
+[[package]]
+name = "pydantic-core"
+version = "2.41.5"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "typing-extensions" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/71/70/23b021c950c2addd24ec408e9ab05d59b035b39d97cdc1130e1bce647bb6/pydantic_core-2.41.5.tar.gz", hash = "sha256:08daa51ea16ad373ffd5e7606252cc32f07bc72b28284b6bc9c6df804816476e", size = 460952 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/c6/90/32c9941e728d564b411d574d8ee0cf09b12ec978cb22b294995bae5549a5/pydantic_core-2.41.5-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:77b63866ca88d804225eaa4af3e664c5faf3568cea95360d21f4725ab6e07146", size = 2107298 },
+ { url = "https://files.pythonhosted.org/packages/fb/a8/61c96a77fe28993d9a6fb0f4127e05430a267b235a124545d79fea46dd65/pydantic_core-2.41.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:dfa8a0c812ac681395907e71e1274819dec685fec28273a28905df579ef137e2", size = 1901475 },
+ { url = "https://files.pythonhosted.org/packages/5d/b6/338abf60225acc18cdc08b4faef592d0310923d19a87fba1faf05af5346e/pydantic_core-2.41.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5921a4d3ca3aee735d9fd163808f5e8dd6c6972101e4adbda9a4667908849b97", size = 1918815 },
+ { url = "https://files.pythonhosted.org/packages/d1/1c/2ed0433e682983d8e8cba9c8d8ef274d4791ec6a6f24c58935b90e780e0a/pydantic_core-2.41.5-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e25c479382d26a2a41b7ebea1043564a937db462816ea07afa8a44c0866d52f9", size = 2065567 },
+ { url = "https://files.pythonhosted.org/packages/b3/24/cf84974ee7d6eae06b9e63289b7b8f6549d416b5c199ca2d7ce13bbcf619/pydantic_core-2.41.5-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f547144f2966e1e16ae626d8ce72b4cfa0caedc7fa28052001c94fb2fcaa1c52", size = 2230442 },
+ { url = "https://files.pythonhosted.org/packages/fd/21/4e287865504b3edc0136c89c9c09431be326168b1eb7841911cbc877a995/pydantic_core-2.41.5-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6f52298fbd394f9ed112d56f3d11aabd0d5bd27beb3084cc3d8ad069483b8941", size = 2350956 },
+ { url = "https://files.pythonhosted.org/packages/a8/76/7727ef2ffa4b62fcab916686a68a0426b9b790139720e1934e8ba797e238/pydantic_core-2.41.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:100baa204bb412b74fe285fb0f3a385256dad1d1879f0a5cb1499ed2e83d132a", size = 2068253 },
+ { url = "https://files.pythonhosted.org/packages/d5/8c/a4abfc79604bcb4c748e18975c44f94f756f08fb04218d5cb87eb0d3a63e/pydantic_core-2.41.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:05a2c8852530ad2812cb7914dc61a1125dc4e06252ee98e5638a12da6cc6fb6c", size = 2177050 },
+ { url = "https://files.pythonhosted.org/packages/67/b1/de2e9a9a79b480f9cb0b6e8b6ba4c50b18d4e89852426364c66aa82bb7b3/pydantic_core-2.41.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:29452c56df2ed968d18d7e21f4ab0ac55e71dc59524872f6fc57dcf4a3249ed2", size = 2147178 },
+ { url = "https://files.pythonhosted.org/packages/16/c1/dfb33f837a47b20417500efaa0378adc6635b3c79e8369ff7a03c494b4ac/pydantic_core-2.41.5-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:d5160812ea7a8a2ffbe233d8da666880cad0cbaf5d4de74ae15c313213d62556", size = 2341833 },
+ { url = "https://files.pythonhosted.org/packages/47/36/00f398642a0f4b815a9a558c4f1dca1b4020a7d49562807d7bc9ff279a6c/pydantic_core-2.41.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:df3959765b553b9440adfd3c795617c352154e497a4eaf3752555cfb5da8fc49", size = 2321156 },
+ { url = "https://files.pythonhosted.org/packages/7e/70/cad3acd89fde2010807354d978725ae111ddf6d0ea46d1ea1775b5c1bd0c/pydantic_core-2.41.5-cp310-cp310-win32.whl", hash = "sha256:1f8d33a7f4d5a7889e60dc39856d76d09333d8a6ed0f5f1190635cbec70ec4ba", size = 1989378 },
+ { url = "https://files.pythonhosted.org/packages/76/92/d338652464c6c367e5608e4488201702cd1cbb0f33f7b6a85a60fe5f3720/pydantic_core-2.41.5-cp310-cp310-win_amd64.whl", hash = "sha256:62de39db01b8d593e45871af2af9e497295db8d73b085f6bfd0b18c83c70a8f9", size = 2013622 },
+ { url = "https://files.pythonhosted.org/packages/e8/72/74a989dd9f2084b3d9530b0915fdda64ac48831c30dbf7c72a41a5232db8/pydantic_core-2.41.5-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:a3a52f6156e73e7ccb0f8cced536adccb7042be67cb45f9562e12b319c119da6", size = 2105873 },
+ { url = "https://files.pythonhosted.org/packages/12/44/37e403fd9455708b3b942949e1d7febc02167662bf1a7da5b78ee1ea2842/pydantic_core-2.41.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7f3bf998340c6d4b0c9a2f02d6a400e51f123b59565d74dc60d252ce888c260b", size = 1899826 },
+ { url = "https://files.pythonhosted.org/packages/33/7f/1d5cab3ccf44c1935a359d51a8a2a9e1a654b744b5e7f80d41b88d501eec/pydantic_core-2.41.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:378bec5c66998815d224c9ca994f1e14c0c21cb95d2f52b6021cc0b2a58f2a5a", size = 1917869 },
+ { url = "https://files.pythonhosted.org/packages/6e/6a/30d94a9674a7fe4f4744052ed6c5e083424510be1e93da5bc47569d11810/pydantic_core-2.41.5-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e7b576130c69225432866fe2f4a469a85a54ade141d96fd396dffcf607b558f8", size = 2063890 },
+ { url = "https://files.pythonhosted.org/packages/50/be/76e5d46203fcb2750e542f32e6c371ffa9b8ad17364cf94bb0818dbfb50c/pydantic_core-2.41.5-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6cb58b9c66f7e4179a2d5e0f849c48eff5c1fca560994d6eb6543abf955a149e", size = 2229740 },
+ { url = "https://files.pythonhosted.org/packages/d3/ee/fed784df0144793489f87db310a6bbf8118d7b630ed07aa180d6067e653a/pydantic_core-2.41.5-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:88942d3a3dff3afc8288c21e565e476fc278902ae4d6d134f1eeda118cc830b1", size = 2350021 },
+ { url = "https://files.pythonhosted.org/packages/c8/be/8fed28dd0a180dca19e72c233cbf58efa36df055e5b9d90d64fd1740b828/pydantic_core-2.41.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f31d95a179f8d64d90f6831d71fa93290893a33148d890ba15de25642c5d075b", size = 2066378 },
+ { url = "https://files.pythonhosted.org/packages/b0/3b/698cf8ae1d536a010e05121b4958b1257f0b5522085e335360e53a6b1c8b/pydantic_core-2.41.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c1df3d34aced70add6f867a8cf413e299177e0c22660cc767218373d0779487b", size = 2175761 },
+ { url = "https://files.pythonhosted.org/packages/b8/ba/15d537423939553116dea94ce02f9c31be0fa9d0b806d427e0308ec17145/pydantic_core-2.41.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:4009935984bd36bd2c774e13f9a09563ce8de4abaa7226f5108262fa3e637284", size = 2146303 },
+ { url = "https://files.pythonhosted.org/packages/58/7f/0de669bf37d206723795f9c90c82966726a2ab06c336deba4735b55af431/pydantic_core-2.41.5-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:34a64bc3441dc1213096a20fe27e8e128bd3ff89921706e83c0b1ac971276594", size = 2340355 },
+ { url = "https://files.pythonhosted.org/packages/e5/de/e7482c435b83d7e3c3ee5ee4451f6e8973cff0eb6007d2872ce6383f6398/pydantic_core-2.41.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:c9e19dd6e28fdcaa5a1de679aec4141f691023916427ef9bae8584f9c2fb3b0e", size = 2319875 },
+ { url = "https://files.pythonhosted.org/packages/fe/e6/8c9e81bb6dd7560e33b9053351c29f30c8194b72f2d6932888581f503482/pydantic_core-2.41.5-cp311-cp311-win32.whl", hash = "sha256:2c010c6ded393148374c0f6f0bf89d206bf3217f201faa0635dcd56bd1520f6b", size = 1987549 },
+ { url = "https://files.pythonhosted.org/packages/11/66/f14d1d978ea94d1bc21fc98fcf570f9542fe55bfcc40269d4e1a21c19bf7/pydantic_core-2.41.5-cp311-cp311-win_amd64.whl", hash = "sha256:76ee27c6e9c7f16f47db7a94157112a2f3a00e958bc626e2f4ee8bec5c328fbe", size = 2011305 },
+ { url = "https://files.pythonhosted.org/packages/56/d8/0e271434e8efd03186c5386671328154ee349ff0354d83c74f5caaf096ed/pydantic_core-2.41.5-cp311-cp311-win_arm64.whl", hash = "sha256:4bc36bbc0b7584de96561184ad7f012478987882ebf9f9c389b23f432ea3d90f", size = 1972902 },
+ { url = "https://files.pythonhosted.org/packages/5f/5d/5f6c63eebb5afee93bcaae4ce9a898f3373ca23df3ccaef086d0233a35a7/pydantic_core-2.41.5-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:f41a7489d32336dbf2199c8c0a215390a751c5b014c2c1c5366e817202e9cdf7", size = 2110990 },
+ { url = "https://files.pythonhosted.org/packages/aa/32/9c2e8ccb57c01111e0fd091f236c7b371c1bccea0fa85247ac55b1e2b6b6/pydantic_core-2.41.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:070259a8818988b9a84a449a2a7337c7f430a22acc0859c6b110aa7212a6d9c0", size = 1896003 },
+ { url = "https://files.pythonhosted.org/packages/68/b8/a01b53cb0e59139fbc9e4fda3e9724ede8de279097179be4ff31f1abb65a/pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e96cea19e34778f8d59fe40775a7a574d95816eb150850a85a7a4c8f4b94ac69", size = 1919200 },
+ { url = "https://files.pythonhosted.org/packages/38/de/8c36b5198a29bdaade07b5985e80a233a5ac27137846f3bc2d3b40a47360/pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed2e99c456e3fadd05c991f8f437ef902e00eedf34320ba2b0842bd1c3ca3a75", size = 2052578 },
+ { url = "https://files.pythonhosted.org/packages/00/b5/0e8e4b5b081eac6cb3dbb7e60a65907549a1ce035a724368c330112adfdd/pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:65840751b72fbfd82c3c640cff9284545342a4f1eb1586ad0636955b261b0b05", size = 2208504 },
+ { url = "https://files.pythonhosted.org/packages/77/56/87a61aad59c7c5b9dc8caad5a41a5545cba3810c3e828708b3d7404f6cef/pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e536c98a7626a98feb2d3eaf75944ef6f3dbee447e1f841eae16f2f0a72d8ddc", size = 2335816 },
+ { url = "https://files.pythonhosted.org/packages/0d/76/941cc9f73529988688a665a5c0ecff1112b3d95ab48f81db5f7606f522d3/pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eceb81a8d74f9267ef4081e246ffd6d129da5d87e37a77c9bde550cb04870c1c", size = 2075366 },
+ { url = "https://files.pythonhosted.org/packages/d3/43/ebef01f69baa07a482844faaa0a591bad1ef129253ffd0cdaa9d8a7f72d3/pydantic_core-2.41.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d38548150c39b74aeeb0ce8ee1d8e82696f4a4e16ddc6de7b1d8823f7de4b9b5", size = 2171698 },
+ { url = "https://files.pythonhosted.org/packages/b1/87/41f3202e4193e3bacfc2c065fab7706ebe81af46a83d3e27605029c1f5a6/pydantic_core-2.41.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:c23e27686783f60290e36827f9c626e63154b82b116d7fe9adba1fda36da706c", size = 2132603 },
+ { url = "https://files.pythonhosted.org/packages/49/7d/4c00df99cb12070b6bccdef4a195255e6020a550d572768d92cc54dba91a/pydantic_core-2.41.5-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:482c982f814460eabe1d3bb0adfdc583387bd4691ef00b90575ca0d2b6fe2294", size = 2329591 },
+ { url = "https://files.pythonhosted.org/packages/cc/6a/ebf4b1d65d458f3cda6a7335d141305dfa19bdc61140a884d165a8a1bbc7/pydantic_core-2.41.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:bfea2a5f0b4d8d43adf9d7b8bf019fb46fdd10a2e5cde477fbcb9d1fa08c68e1", size = 2319068 },
+ { url = "https://files.pythonhosted.org/packages/49/3b/774f2b5cd4192d5ab75870ce4381fd89cf218af999515baf07e7206753f0/pydantic_core-2.41.5-cp312-cp312-win32.whl", hash = "sha256:b74557b16e390ec12dca509bce9264c3bbd128f8a2c376eaa68003d7f327276d", size = 1985908 },
+ { url = "https://files.pythonhosted.org/packages/86/45/00173a033c801cacf67c190fef088789394feaf88a98a7035b0e40d53dc9/pydantic_core-2.41.5-cp312-cp312-win_amd64.whl", hash = "sha256:1962293292865bca8e54702b08a4f26da73adc83dd1fcf26fbc875b35d81c815", size = 2020145 },
+ { url = "https://files.pythonhosted.org/packages/f9/22/91fbc821fa6d261b376a3f73809f907cec5ca6025642c463d3488aad22fb/pydantic_core-2.41.5-cp312-cp312-win_arm64.whl", hash = "sha256:1746d4a3d9a794cacae06a5eaaccb4b8643a131d45fbc9af23e353dc0a5ba5c3", size = 1976179 },
+ { url = "https://files.pythonhosted.org/packages/87/06/8806241ff1f70d9939f9af039c6c35f2360cf16e93c2ca76f184e76b1564/pydantic_core-2.41.5-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:941103c9be18ac8daf7b7adca8228f8ed6bb7a1849020f643b3a14d15b1924d9", size = 2120403 },
+ { url = "https://files.pythonhosted.org/packages/94/02/abfa0e0bda67faa65fef1c84971c7e45928e108fe24333c81f3bfe35d5f5/pydantic_core-2.41.5-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:112e305c3314f40c93998e567879e887a3160bb8689ef3d2c04b6cc62c33ac34", size = 1896206 },
+ { url = "https://files.pythonhosted.org/packages/15/df/a4c740c0943e93e6500f9eb23f4ca7ec9bf71b19e608ae5b579678c8d02f/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cbaad15cb0c90aa221d43c00e77bb33c93e8d36e0bf74760cd00e732d10a6a0", size = 1919307 },
+ { url = "https://files.pythonhosted.org/packages/9a/e3/6324802931ae1d123528988e0e86587c2072ac2e5394b4bc2bc34b61ff6e/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:03ca43e12fab6023fc79d28ca6b39b05f794ad08ec2feccc59a339b02f2b3d33", size = 2063258 },
+ { url = "https://files.pythonhosted.org/packages/c9/d4/2230d7151d4957dd79c3044ea26346c148c98fbf0ee6ebd41056f2d62ab5/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dc799088c08fa04e43144b164feb0c13f9a0bc40503f8df3e9fde58a3c0c101e", size = 2214917 },
+ { url = "https://files.pythonhosted.org/packages/e6/9f/eaac5df17a3672fef0081b6c1bb0b82b33ee89aa5cec0d7b05f52fd4a1fa/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:97aeba56665b4c3235a0e52b2c2f5ae9cd071b8a8310ad27bddb3f7fb30e9aa2", size = 2332186 },
+ { url = "https://files.pythonhosted.org/packages/cf/4e/35a80cae583a37cf15604b44240e45c05e04e86f9cfd766623149297e971/pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:406bf18d345822d6c21366031003612b9c77b3e29ffdb0f612367352aab7d586", size = 2073164 },
+ { url = "https://files.pythonhosted.org/packages/bf/e3/f6e262673c6140dd3305d144d032f7bd5f7497d3871c1428521f19f9efa2/pydantic_core-2.41.5-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b93590ae81f7010dbe380cdeab6f515902ebcbefe0b9327cc4804d74e93ae69d", size = 2179146 },
+ { url = "https://files.pythonhosted.org/packages/75/c7/20bd7fc05f0c6ea2056a4565c6f36f8968c0924f19b7d97bbfea55780e73/pydantic_core-2.41.5-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:01a3d0ab748ee531f4ea6c3e48ad9dac84ddba4b0d82291f87248f2f9de8d740", size = 2137788 },
+ { url = "https://files.pythonhosted.org/packages/3a/8d/34318ef985c45196e004bc46c6eab2eda437e744c124ef0dbe1ff2c9d06b/pydantic_core-2.41.5-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:6561e94ba9dacc9c61bce40e2d6bdc3bfaa0259d3ff36ace3b1e6901936d2e3e", size = 2340133 },
+ { url = "https://files.pythonhosted.org/packages/9c/59/013626bf8c78a5a5d9350d12e7697d3d4de951a75565496abd40ccd46bee/pydantic_core-2.41.5-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:915c3d10f81bec3a74fbd4faebe8391013ba61e5a1a8d48c4455b923bdda7858", size = 2324852 },
+ { url = "https://files.pythonhosted.org/packages/1a/d9/c248c103856f807ef70c18a4f986693a46a8ffe1602e5d361485da502d20/pydantic_core-2.41.5-cp313-cp313-win32.whl", hash = "sha256:650ae77860b45cfa6e2cdafc42618ceafab3a2d9a3811fcfbd3bbf8ac3c40d36", size = 1994679 },
+ { url = "https://files.pythonhosted.org/packages/9e/8b/341991b158ddab181cff136acd2552c9f35bd30380422a639c0671e99a91/pydantic_core-2.41.5-cp313-cp313-win_amd64.whl", hash = "sha256:79ec52ec461e99e13791ec6508c722742ad745571f234ea6255bed38c6480f11", size = 2019766 },
+ { url = "https://files.pythonhosted.org/packages/73/7d/f2f9db34af103bea3e09735bb40b021788a5e834c81eedb541991badf8f5/pydantic_core-2.41.5-cp313-cp313-win_arm64.whl", hash = "sha256:3f84d5c1b4ab906093bdc1ff10484838aca54ef08de4afa9de0f5f14d69639cd", size = 1981005 },
+ { url = "https://files.pythonhosted.org/packages/ea/28/46b7c5c9635ae96ea0fbb779e271a38129df2550f763937659ee6c5dbc65/pydantic_core-2.41.5-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:3f37a19d7ebcdd20b96485056ba9e8b304e27d9904d233d7b1015db320e51f0a", size = 2119622 },
+ { url = "https://files.pythonhosted.org/packages/74/1a/145646e5687e8d9a1e8d09acb278c8535ebe9e972e1f162ed338a622f193/pydantic_core-2.41.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1d1d9764366c73f996edd17abb6d9d7649a7eb690006ab6adbda117717099b14", size = 1891725 },
+ { url = "https://files.pythonhosted.org/packages/23/04/e89c29e267b8060b40dca97bfc64a19b2a3cf99018167ea1677d96368273/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:25e1c2af0fce638d5f1988b686f3b3ea8cd7de5f244ca147c777769e798a9cd1", size = 1915040 },
+ { url = "https://files.pythonhosted.org/packages/84/a3/15a82ac7bd97992a82257f777b3583d3e84bdb06ba6858f745daa2ec8a85/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:506d766a8727beef16b7adaeb8ee6217c64fc813646b424d0804d67c16eddb66", size = 2063691 },
+ { url = "https://files.pythonhosted.org/packages/74/9b/0046701313c6ef08c0c1cf0e028c67c770a4e1275ca73131563c5f2a310a/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4819fa52133c9aa3c387b3328f25c1facc356491e6135b459f1de698ff64d869", size = 2213897 },
+ { url = "https://files.pythonhosted.org/packages/8a/cd/6bac76ecd1b27e75a95ca3a9a559c643b3afcd2dd62086d4b7a32a18b169/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2b761d210c9ea91feda40d25b4efe82a1707da2ef62901466a42492c028553a2", size = 2333302 },
+ { url = "https://files.pythonhosted.org/packages/4c/d2/ef2074dc020dd6e109611a8be4449b98cd25e1b9b8a303c2f0fca2f2bcf7/pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:22f0fb8c1c583a3b6f24df2470833b40207e907b90c928cc8d3594b76f874375", size = 2064877 },
+ { url = "https://files.pythonhosted.org/packages/18/66/e9db17a9a763d72f03de903883c057b2592c09509ccfe468187f2a2eef29/pydantic_core-2.41.5-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2782c870e99878c634505236d81e5443092fba820f0373997ff75f90f68cd553", size = 2180680 },
+ { url = "https://files.pythonhosted.org/packages/d3/9e/3ce66cebb929f3ced22be85d4c2399b8e85b622db77dad36b73c5387f8f8/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:0177272f88ab8312479336e1d777f6b124537d47f2123f89cb37e0accea97f90", size = 2138960 },
+ { url = "https://files.pythonhosted.org/packages/a6/62/205a998f4327d2079326b01abee48e502ea739d174f0a89295c481a2272e/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:63510af5e38f8955b8ee5687740d6ebf7c2a0886d15a6d65c32814613681bc07", size = 2339102 },
+ { url = "https://files.pythonhosted.org/packages/3c/0d/f05e79471e889d74d3d88f5bd20d0ed189ad94c2423d81ff8d0000aab4ff/pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:e56ba91f47764cc14f1daacd723e3e82d1a89d783f0f5afe9c364b8bb491ccdb", size = 2326039 },
+ { url = "https://files.pythonhosted.org/packages/ec/e1/e08a6208bb100da7e0c4b288eed624a703f4d129bde2da475721a80cab32/pydantic_core-2.41.5-cp314-cp314-win32.whl", hash = "sha256:aec5cf2fd867b4ff45b9959f8b20ea3993fc93e63c7363fe6851424c8a7e7c23", size = 1995126 },
+ { url = "https://files.pythonhosted.org/packages/48/5d/56ba7b24e9557f99c9237e29f5c09913c81eeb2f3217e40e922353668092/pydantic_core-2.41.5-cp314-cp314-win_amd64.whl", hash = "sha256:8e7c86f27c585ef37c35e56a96363ab8de4e549a95512445b85c96d3e2f7c1bf", size = 2015489 },
+ { url = "https://files.pythonhosted.org/packages/4e/bb/f7a190991ec9e3e0ba22e4993d8755bbc4a32925c0b5b42775c03e8148f9/pydantic_core-2.41.5-cp314-cp314-win_arm64.whl", hash = "sha256:e672ba74fbc2dc8eea59fb6d4aed6845e6905fc2a8afe93175d94a83ba2a01a0", size = 1977288 },
+ { url = "https://files.pythonhosted.org/packages/92/ed/77542d0c51538e32e15afe7899d79efce4b81eee631d99850edc2f5e9349/pydantic_core-2.41.5-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:8566def80554c3faa0e65ac30ab0932b9e3a5cd7f8323764303d468e5c37595a", size = 2120255 },
+ { url = "https://files.pythonhosted.org/packages/bb/3d/6913dde84d5be21e284439676168b28d8bbba5600d838b9dca99de0fad71/pydantic_core-2.41.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b80aa5095cd3109962a298ce14110ae16b8c1aece8b72f9dafe81cf597ad80b3", size = 1863760 },
+ { url = "https://files.pythonhosted.org/packages/5a/f0/e5e6b99d4191da102f2b0eb9687aaa7f5bea5d9964071a84effc3e40f997/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3006c3dd9ba34b0c094c544c6006cc79e87d8612999f1a5d43b769b89181f23c", size = 1878092 },
+ { url = "https://files.pythonhosted.org/packages/71/48/36fb760642d568925953bcc8116455513d6e34c4beaa37544118c36aba6d/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:72f6c8b11857a856bcfa48c86f5368439f74453563f951e473514579d44aa612", size = 2053385 },
+ { url = "https://files.pythonhosted.org/packages/20/25/92dc684dd8eb75a234bc1c764b4210cf2646479d54b47bf46061657292a8/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5cb1b2f9742240e4bb26b652a5aeb840aa4b417c7748b6f8387927bc6e45e40d", size = 2218832 },
+ { url = "https://files.pythonhosted.org/packages/e2/09/f53e0b05023d3e30357d82eb35835d0f6340ca344720a4599cd663dca599/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd3d54f38609ff308209bd43acea66061494157703364ae40c951f83ba99a1a9", size = 2327585 },
+ { url = "https://files.pythonhosted.org/packages/aa/4e/2ae1aa85d6af35a39b236b1b1641de73f5a6ac4d5a7509f77b814885760c/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2ff4321e56e879ee8d2a879501c8e469414d948f4aba74a2d4593184eb326660", size = 2041078 },
+ { url = "https://files.pythonhosted.org/packages/cd/13/2e215f17f0ef326fc72afe94776edb77525142c693767fc347ed6288728d/pydantic_core-2.41.5-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d0d2568a8c11bf8225044aa94409e21da0cb09dcdafe9ecd10250b2baad531a9", size = 2173914 },
+ { url = "https://files.pythonhosted.org/packages/02/7a/f999a6dcbcd0e5660bc348a3991c8915ce6599f4f2c6ac22f01d7a10816c/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:a39455728aabd58ceabb03c90e12f71fd30fa69615760a075b9fec596456ccc3", size = 2129560 },
+ { url = "https://files.pythonhosted.org/packages/3a/b1/6c990ac65e3b4c079a4fb9f5b05f5b013afa0f4ed6780a3dd236d2cbdc64/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:239edca560d05757817c13dc17c50766136d21f7cd0fac50295499ae24f90fdf", size = 2329244 },
+ { url = "https://files.pythonhosted.org/packages/d9/02/3c562f3a51afd4d88fff8dffb1771b30cfdfd79befd9883ee094f5b6c0d8/pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:2a5e06546e19f24c6a96a129142a75cee553cc018ffee48a460059b1185f4470", size = 2331955 },
+ { url = "https://files.pythonhosted.org/packages/5c/96/5fb7d8c3c17bc8c62fdb031c47d77a1af698f1d7a406b0f79aaa1338f9ad/pydantic_core-2.41.5-cp314-cp314t-win32.whl", hash = "sha256:b4ececa40ac28afa90871c2cc2b9ffd2ff0bf749380fbdf57d165fd23da353aa", size = 1988906 },
+ { url = "https://files.pythonhosted.org/packages/22/ed/182129d83032702912c2e2d8bbe33c036f342cc735737064668585dac28f/pydantic_core-2.41.5-cp314-cp314t-win_amd64.whl", hash = "sha256:80aa89cad80b32a912a65332f64a4450ed00966111b6615ca6816153d3585a8c", size = 1981607 },
+ { url = "https://files.pythonhosted.org/packages/9f/ed/068e41660b832bb0b1aa5b58011dea2a3fe0ba7861ff38c4d4904c1c1a99/pydantic_core-2.41.5-cp314-cp314t-win_arm64.whl", hash = "sha256:35b44f37a3199f771c3eaa53051bc8a70cd7b54f333531c59e29fd4db5d15008", size = 1974769 },
+ { url = "https://files.pythonhosted.org/packages/e6/b0/1a2aa41e3b5a4ba11420aba2d091b2d17959c8d1519ece3627c371951e73/pydantic_core-2.41.5-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:b5819cd790dbf0c5eb9f82c73c16b39a65dd6dd4d1439dcdea7816ec9adddab8", size = 2103351 },
+ { url = "https://files.pythonhosted.org/packages/a4/ee/31b1f0020baaf6d091c87900ae05c6aeae101fa4e188e1613c80e4f1ea31/pydantic_core-2.41.5-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:5a4e67afbc95fa5c34cf27d9089bca7fcab4e51e57278d710320a70b956d1b9a", size = 1925363 },
+ { url = "https://files.pythonhosted.org/packages/e1/89/ab8e86208467e467a80deaca4e434adac37b10a9d134cd2f99b28a01e483/pydantic_core-2.41.5-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ece5c59f0ce7d001e017643d8d24da587ea1f74f6993467d85ae8a5ef9d4f42b", size = 2135615 },
+ { url = "https://files.pythonhosted.org/packages/99/0a/99a53d06dd0348b2008f2f30884b34719c323f16c3be4e6cc1203b74a91d/pydantic_core-2.41.5-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:16f80f7abe3351f8ea6858914ddc8c77e02578544a0ebc15b4c2e1a0e813b0b2", size = 2175369 },
+ { url = "https://files.pythonhosted.org/packages/6d/94/30ca3b73c6d485b9bb0bc66e611cff4a7138ff9736b7e66bcf0852151636/pydantic_core-2.41.5-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:33cb885e759a705b426baada1fe68cbb0a2e68e34c5d0d0289a364cf01709093", size = 2144218 },
+ { url = "https://files.pythonhosted.org/packages/87/57/31b4f8e12680b739a91f472b5671294236b82586889ef764b5fbc6669238/pydantic_core-2.41.5-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:c8d8b4eb992936023be7dee581270af5c6e0697a8559895f527f5b7105ecd36a", size = 2329951 },
+ { url = "https://files.pythonhosted.org/packages/7d/73/3c2c8edef77b8f7310e6fb012dbc4b8551386ed575b9eb6fb2506e28a7eb/pydantic_core-2.41.5-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:242a206cd0318f95cd21bdacff3fcc3aab23e79bba5cac3db5a841c9ef9c6963", size = 2318428 },
+ { url = "https://files.pythonhosted.org/packages/2f/02/8559b1f26ee0d502c74f9cca5c0d2fd97e967e083e006bbbb4e97f3a043a/pydantic_core-2.41.5-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:d3a978c4f57a597908b7e697229d996d77a6d3c94901e9edee593adada95ce1a", size = 2147009 },
+ { url = "https://files.pythonhosted.org/packages/5f/9b/1b3f0e9f9305839d7e84912f9e8bfbd191ed1b1ef48083609f0dabde978c/pydantic_core-2.41.5-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:b2379fa7ed44ddecb5bfe4e48577d752db9fc10be00a6b7446e9663ba143de26", size = 2101980 },
+ { url = "https://files.pythonhosted.org/packages/a4/ed/d71fefcb4263df0da6a85b5d8a7508360f2f2e9b3bf5814be9c8bccdccc1/pydantic_core-2.41.5-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:266fb4cbf5e3cbd0b53669a6d1b039c45e3ce651fd5442eff4d07c2cc8d66808", size = 1923865 },
+ { url = "https://files.pythonhosted.org/packages/ce/3a/626b38db460d675f873e4444b4bb030453bbe7b4ba55df821d026a0493c4/pydantic_core-2.41.5-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58133647260ea01e4d0500089a8c4f07bd7aa6ce109682b1426394988d8aaacc", size = 2134256 },
+ { url = "https://files.pythonhosted.org/packages/83/d9/8412d7f06f616bbc053d30cb4e5f76786af3221462ad5eee1f202021eb4e/pydantic_core-2.41.5-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:287dad91cfb551c363dc62899a80e9e14da1f0e2b6ebde82c806612ca2a13ef1", size = 2174762 },
+ { url = "https://files.pythonhosted.org/packages/55/4c/162d906b8e3ba3a99354e20faa1b49a85206c47de97a639510a0e673f5da/pydantic_core-2.41.5-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:03b77d184b9eb40240ae9fd676ca364ce1085f203e1b1256f8ab9984dca80a84", size = 2143141 },
+ { url = "https://files.pythonhosted.org/packages/1f/f2/f11dd73284122713f5f89fc940f370d035fa8e1e078d446b3313955157fe/pydantic_core-2.41.5-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:a668ce24de96165bb239160b3d854943128f4334822900534f2fe947930e5770", size = 2330317 },
+ { url = "https://files.pythonhosted.org/packages/88/9d/b06ca6acfe4abb296110fb1273a4d848a0bfb2ff65f3ee92127b3244e16b/pydantic_core-2.41.5-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f14f8f046c14563f8eb3f45f499cc658ab8d10072961e07225e507adb700e93f", size = 2316992 },
+ { url = "https://files.pythonhosted.org/packages/36/c7/cfc8e811f061c841d7990b0201912c3556bfeb99cdcb7ed24adc8d6f8704/pydantic_core-2.41.5-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:56121965f7a4dc965bff783d70b907ddf3d57f6eba29b6d2e5dabfaf07799c51", size = 2145302 },
+]
+
+[[package]]
+name = "pygments"
+version = "2.19.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/b0/77/a5b8c569bf593b0140bde72ea885a803b82086995367bf2037de0159d924/pygments-2.19.2.tar.gz", hash = "sha256:636cb2477cec7f8952536970bc533bc43743542f70392ae026374600add5b887", size = 4968631 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/c7/21/705964c7812476f378728bdf590ca4b771ec72385c533964653c68e86bdc/pygments-2.19.2-py3-none-any.whl", hash = "sha256:86540386c03d588bb81d44bc3928634ff26449851e99741617ecb9037ee5ec0b", size = 1225217 },
+]
+
+[[package]]
+name = "pytest"
+version = "9.0.2"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "colorama", marker = "sys_platform == 'win32'" },
+ { name = "exceptiongroup", marker = "python_full_version < '3.11'" },
+ { name = "iniconfig" },
+ { name = "packaging" },
+ { name = "pluggy" },
+ { name = "pygments" },
+ { name = "tomli", marker = "python_full_version < '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/d1/db/7ef3487e0fb0049ddb5ce41d3a49c235bf9ad299b6a25d5780a89f19230f/pytest-9.0.2.tar.gz", hash = "sha256:75186651a92bd89611d1d9fc20f0b4345fd827c41ccd5c299a868a05d70edf11", size = 1568901 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/3b/ab/b3226f0bd7cdcf710fbede2b3548584366da3b19b5021e74f5bde2a8fa3f/pytest-9.0.2-py3-none-any.whl", hash = "sha256:711ffd45bf766d5264d487b917733b453d917afd2b0ad65223959f59089f875b", size = 374801 },
+]
+
+[[package]]
+name = "python-dateutil"
+version = "2.9.0.post0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "six" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/66/c0/0c8b6ad9f17a802ee498c46e004a0eb49bc148f2fd230864601a86dcf6db/python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3", size = 342432 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/ec/57/56b9bcc3c9c6a792fcbaf139543cee77261f3651ca9da0c93f5c1221264b/python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427", size = 229892 },
+]
+
+[[package]]
+name = "pytz"
+version = "2025.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/f8/bf/abbd3cdfb8fbc7fb3d4d38d320f2441b1e7cbe29be4f23797b4a2b5d8aac/pytz-2025.2.tar.gz", hash = "sha256:360b9e3dbb49a209c21ad61809c7fb453643e048b38924c765813546746e81c3", size = 320884 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/81/c4/34e93fe5f5429d7570ec1fa436f1986fb1f00c3e0f43a589fe2bbcd22c3f/pytz-2025.2-py2.py3-none-any.whl", hash = "sha256:5ddf76296dd8c44c26eb8f4b6f35488f3ccbf6fbbd7adee0b7262d43f0ec2f00", size = 509225 },
+]
+
+[[package]]
+name = "pyyaml"
+version = "6.0.3"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/05/8e/961c0007c59b8dd7729d542c61a4d537767a59645b82a0b521206e1e25c2/pyyaml-6.0.3.tar.gz", hash = "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f", size = 130960 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/f4/a0/39350dd17dd6d6c6507025c0e53aef67a9293a6d37d3511f23ea510d5800/pyyaml-6.0.3-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:214ed4befebe12df36bcc8bc2b64b396ca31be9304b8f59e25c11cf94a4c033b", size = 184227 },
+ { url = "https://files.pythonhosted.org/packages/05/14/52d505b5c59ce73244f59c7a50ecf47093ce4765f116cdb98286a71eeca2/pyyaml-6.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:02ea2dfa234451bbb8772601d7b8e426c2bfa197136796224e50e35a78777956", size = 174019 },
+ { url = "https://files.pythonhosted.org/packages/43/f7/0e6a5ae5599c838c696adb4e6330a59f463265bfa1e116cfd1fbb0abaaae/pyyaml-6.0.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b30236e45cf30d2b8e7b3e85881719e98507abed1011bf463a8fa23e9c3e98a8", size = 740646 },
+ { url = "https://files.pythonhosted.org/packages/2f/3a/61b9db1d28f00f8fd0ae760459a5c4bf1b941baf714e207b6eb0657d2578/pyyaml-6.0.3-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:66291b10affd76d76f54fad28e22e51719ef9ba22b29e1d7d03d6777a9174198", size = 840793 },
+ { url = "https://files.pythonhosted.org/packages/7a/1e/7acc4f0e74c4b3d9531e24739e0ab832a5edf40e64fbae1a9c01941cabd7/pyyaml-6.0.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9c7708761fccb9397fe64bbc0395abcae8c4bf7b0eac081e12b809bf47700d0b", size = 770293 },
+ { url = "https://files.pythonhosted.org/packages/8b/ef/abd085f06853af0cd59fa5f913d61a8eab65d7639ff2a658d18a25d6a89d/pyyaml-6.0.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:418cf3f2111bc80e0933b2cd8cd04f286338bb88bdc7bc8e6dd775ebde60b5e0", size = 732872 },
+ { url = "https://files.pythonhosted.org/packages/1f/15/2bc9c8faf6450a8b3c9fc5448ed869c599c0a74ba2669772b1f3a0040180/pyyaml-6.0.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:5e0b74767e5f8c593e8c9b5912019159ed0533c70051e9cce3e8b6aa699fcd69", size = 758828 },
+ { url = "https://files.pythonhosted.org/packages/a3/00/531e92e88c00f4333ce359e50c19b8d1de9fe8d581b1534e35ccfbc5f393/pyyaml-6.0.3-cp310-cp310-win32.whl", hash = "sha256:28c8d926f98f432f88adc23edf2e6d4921ac26fb084b028c733d01868d19007e", size = 142415 },
+ { url = "https://files.pythonhosted.org/packages/2a/fa/926c003379b19fca39dd4634818b00dec6c62d87faf628d1394e137354d4/pyyaml-6.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:bdb2c67c6c1390b63c6ff89f210c8fd09d9a1217a465701eac7316313c915e4c", size = 158561 },
+ { url = "https://files.pythonhosted.org/packages/6d/16/a95b6757765b7b031c9374925bb718d55e0a9ba8a1b6a12d25962ea44347/pyyaml-6.0.3-cp311-cp311-macosx_10_13_x86_64.whl", hash = "sha256:44edc647873928551a01e7a563d7452ccdebee747728c1080d881d68af7b997e", size = 185826 },
+ { url = "https://files.pythonhosted.org/packages/16/19/13de8e4377ed53079ee996e1ab0a9c33ec2faf808a4647b7b4c0d46dd239/pyyaml-6.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:652cb6edd41e718550aad172851962662ff2681490a8a711af6a4d288dd96824", size = 175577 },
+ { url = "https://files.pythonhosted.org/packages/0c/62/d2eb46264d4b157dae1275b573017abec435397aa59cbcdab6fc978a8af4/pyyaml-6.0.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:10892704fc220243f5305762e276552a0395f7beb4dbf9b14ec8fd43b57f126c", size = 775556 },
+ { url = "https://files.pythonhosted.org/packages/10/cb/16c3f2cf3266edd25aaa00d6c4350381c8b012ed6f5276675b9eba8d9ff4/pyyaml-6.0.3-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:850774a7879607d3a6f50d36d04f00ee69e7fc816450e5f7e58d7f17f1ae5c00", size = 882114 },
+ { url = "https://files.pythonhosted.org/packages/71/60/917329f640924b18ff085ab889a11c763e0b573da888e8404ff486657602/pyyaml-6.0.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b8bb0864c5a28024fac8a632c443c87c5aa6f215c0b126c449ae1a150412f31d", size = 806638 },
+ { url = "https://files.pythonhosted.org/packages/dd/6f/529b0f316a9fd167281a6c3826b5583e6192dba792dd55e3203d3f8e655a/pyyaml-6.0.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1d37d57ad971609cf3c53ba6a7e365e40660e3be0e5175fa9f2365a379d6095a", size = 767463 },
+ { url = "https://files.pythonhosted.org/packages/f2/6a/b627b4e0c1dd03718543519ffb2f1deea4a1e6d42fbab8021936a4d22589/pyyaml-6.0.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:37503bfbfc9d2c40b344d06b2199cf0e96e97957ab1c1b546fd4f87e53e5d3e4", size = 794986 },
+ { url = "https://files.pythonhosted.org/packages/45/91/47a6e1c42d9ee337c4839208f30d9f09caa9f720ec7582917b264defc875/pyyaml-6.0.3-cp311-cp311-win32.whl", hash = "sha256:8098f252adfa6c80ab48096053f512f2321f0b998f98150cea9bd23d83e1467b", size = 142543 },
+ { url = "https://files.pythonhosted.org/packages/da/e3/ea007450a105ae919a72393cb06f122f288ef60bba2dc64b26e2646fa315/pyyaml-6.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:9f3bfb4965eb874431221a3ff3fdcddc7e74e3b07799e0e84ca4a0f867d449bf", size = 158763 },
+ { url = "https://files.pythonhosted.org/packages/d1/33/422b98d2195232ca1826284a76852ad5a86fe23e31b009c9886b2d0fb8b2/pyyaml-6.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7f047e29dcae44602496db43be01ad42fc6f1cc0d8cd6c83d342306c32270196", size = 182063 },
+ { url = "https://files.pythonhosted.org/packages/89/a0/6cf41a19a1f2f3feab0e9c0b74134aa2ce6849093d5517a0c550fe37a648/pyyaml-6.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fc09d0aa354569bc501d4e787133afc08552722d3ab34836a80547331bb5d4a0", size = 173973 },
+ { url = "https://files.pythonhosted.org/packages/ed/23/7a778b6bd0b9a8039df8b1b1d80e2e2ad78aa04171592c8a5c43a56a6af4/pyyaml-6.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9149cad251584d5fb4981be1ecde53a1ca46c891a79788c0df828d2f166bda28", size = 775116 },
+ { url = "https://files.pythonhosted.org/packages/65/30/d7353c338e12baef4ecc1b09e877c1970bd3382789c159b4f89d6a70dc09/pyyaml-6.0.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5fdec68f91a0c6739b380c83b951e2c72ac0197ace422360e6d5a959d8d97b2c", size = 844011 },
+ { url = "https://files.pythonhosted.org/packages/8b/9d/b3589d3877982d4f2329302ef98a8026e7f4443c765c46cfecc8858c6b4b/pyyaml-6.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ba1cc08a7ccde2d2ec775841541641e4548226580ab850948cbfda66a1befcdc", size = 807870 },
+ { url = "https://files.pythonhosted.org/packages/05/c0/b3be26a015601b822b97d9149ff8cb5ead58c66f981e04fedf4e762f4bd4/pyyaml-6.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8dc52c23056b9ddd46818a57b78404882310fb473d63f17b07d5c40421e47f8e", size = 761089 },
+ { url = "https://files.pythonhosted.org/packages/be/8e/98435a21d1d4b46590d5459a22d88128103f8da4c2d4cb8f14f2a96504e1/pyyaml-6.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:41715c910c881bc081f1e8872880d3c650acf13dfa8214bad49ed4cede7c34ea", size = 790181 },
+ { url = "https://files.pythonhosted.org/packages/74/93/7baea19427dcfbe1e5a372d81473250b379f04b1bd3c4c5ff825e2327202/pyyaml-6.0.3-cp312-cp312-win32.whl", hash = "sha256:96b533f0e99f6579b3d4d4995707cf36df9100d67e0c8303a0c55b27b5f99bc5", size = 137658 },
+ { url = "https://files.pythonhosted.org/packages/86/bf/899e81e4cce32febab4fb42bb97dcdf66bc135272882d1987881a4b519e9/pyyaml-6.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:5fcd34e47f6e0b794d17de1b4ff496c00986e1c83f7ab2fb8fcfe9616ff7477b", size = 154003 },
+ { url = "https://files.pythonhosted.org/packages/1a/08/67bd04656199bbb51dbed1439b7f27601dfb576fb864099c7ef0c3e55531/pyyaml-6.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:64386e5e707d03a7e172c0701abfb7e10f0fb753ee1d773128192742712a98fd", size = 140344 },
+ { url = "https://files.pythonhosted.org/packages/d1/11/0fd08f8192109f7169db964b5707a2f1e8b745d4e239b784a5a1dd80d1db/pyyaml-6.0.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:8da9669d359f02c0b91ccc01cac4a67f16afec0dac22c2ad09f46bee0697eba8", size = 181669 },
+ { url = "https://files.pythonhosted.org/packages/b1/16/95309993f1d3748cd644e02e38b75d50cbc0d9561d21f390a76242ce073f/pyyaml-6.0.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:2283a07e2c21a2aa78d9c4442724ec1eb15f5e42a723b99cb3d822d48f5f7ad1", size = 173252 },
+ { url = "https://files.pythonhosted.org/packages/50/31/b20f376d3f810b9b2371e72ef5adb33879b25edb7a6d072cb7ca0c486398/pyyaml-6.0.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ee2922902c45ae8ccada2c5b501ab86c36525b883eff4255313a253a3160861c", size = 767081 },
+ { url = "https://files.pythonhosted.org/packages/49/1e/a55ca81e949270d5d4432fbbd19dfea5321eda7c41a849d443dc92fd1ff7/pyyaml-6.0.3-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a33284e20b78bd4a18c8c2282d549d10bc8408a2a7ff57653c0cf0b9be0afce5", size = 841159 },
+ { url = "https://files.pythonhosted.org/packages/74/27/e5b8f34d02d9995b80abcef563ea1f8b56d20134d8f4e5e81733b1feceb2/pyyaml-6.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0f29edc409a6392443abf94b9cf89ce99889a1dd5376d94316ae5145dfedd5d6", size = 801626 },
+ { url = "https://files.pythonhosted.org/packages/f9/11/ba845c23988798f40e52ba45f34849aa8a1f2d4af4b798588010792ebad6/pyyaml-6.0.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f7057c9a337546edc7973c0d3ba84ddcdf0daa14533c2065749c9075001090e6", size = 753613 },
+ { url = "https://files.pythonhosted.org/packages/3d/e0/7966e1a7bfc0a45bf0a7fb6b98ea03fc9b8d84fa7f2229e9659680b69ee3/pyyaml-6.0.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:eda16858a3cab07b80edaf74336ece1f986ba330fdb8ee0d6c0d68fe82bc96be", size = 794115 },
+ { url = "https://files.pythonhosted.org/packages/de/94/980b50a6531b3019e45ddeada0626d45fa85cbe22300844a7983285bed3b/pyyaml-6.0.3-cp313-cp313-win32.whl", hash = "sha256:d0eae10f8159e8fdad514efdc92d74fd8d682c933a6dd088030f3834bc8e6b26", size = 137427 },
+ { url = "https://files.pythonhosted.org/packages/97/c9/39d5b874e8b28845e4ec2202b5da735d0199dbe5b8fb85f91398814a9a46/pyyaml-6.0.3-cp313-cp313-win_amd64.whl", hash = "sha256:79005a0d97d5ddabfeeea4cf676af11e647e41d81c9a7722a193022accdb6b7c", size = 154090 },
+ { url = "https://files.pythonhosted.org/packages/73/e8/2bdf3ca2090f68bb3d75b44da7bbc71843b19c9f2b9cb9b0f4ab7a5a4329/pyyaml-6.0.3-cp313-cp313-win_arm64.whl", hash = "sha256:5498cd1645aa724a7c71c8f378eb29ebe23da2fc0d7a08071d89469bf1d2defb", size = 140246 },
+ { url = "https://files.pythonhosted.org/packages/9d/8c/f4bd7f6465179953d3ac9bc44ac1a8a3e6122cf8ada906b4f96c60172d43/pyyaml-6.0.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:8d1fab6bb153a416f9aeb4b8763bc0f22a5586065f86f7664fc23339fc1c1fac", size = 181814 },
+ { url = "https://files.pythonhosted.org/packages/bd/9c/4d95bb87eb2063d20db7b60faa3840c1b18025517ae857371c4dd55a6b3a/pyyaml-6.0.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:34d5fcd24b8445fadc33f9cf348c1047101756fd760b4dacb5c3e99755703310", size = 173809 },
+ { url = "https://files.pythonhosted.org/packages/92/b5/47e807c2623074914e29dabd16cbbdd4bf5e9b2db9f8090fa64411fc5382/pyyaml-6.0.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:501a031947e3a9025ed4405a168e6ef5ae3126c59f90ce0cd6f2bfc477be31b7", size = 766454 },
+ { url = "https://files.pythonhosted.org/packages/02/9e/e5e9b168be58564121efb3de6859c452fccde0ab093d8438905899a3a483/pyyaml-6.0.3-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:b3bc83488de33889877a0f2543ade9f70c67d66d9ebb4ac959502e12de895788", size = 836355 },
+ { url = "https://files.pythonhosted.org/packages/88/f9/16491d7ed2a919954993e48aa941b200f38040928474c9e85ea9e64222c3/pyyaml-6.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c458b6d084f9b935061bc36216e8a69a7e293a2f1e68bf956dcd9e6cbcd143f5", size = 794175 },
+ { url = "https://files.pythonhosted.org/packages/dd/3f/5989debef34dc6397317802b527dbbafb2b4760878a53d4166579111411e/pyyaml-6.0.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7c6610def4f163542a622a73fb39f534f8c101d690126992300bf3207eab9764", size = 755228 },
+ { url = "https://files.pythonhosted.org/packages/d7/ce/af88a49043cd2e265be63d083fc75b27b6ed062f5f9fd6cdc223ad62f03e/pyyaml-6.0.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:5190d403f121660ce8d1d2c1bb2ef1bd05b5f68533fc5c2ea899bd15f4399b35", size = 789194 },
+ { url = "https://files.pythonhosted.org/packages/23/20/bb6982b26a40bb43951265ba29d4c246ef0ff59c9fdcdf0ed04e0687de4d/pyyaml-6.0.3-cp314-cp314-win_amd64.whl", hash = "sha256:4a2e8cebe2ff6ab7d1050ecd59c25d4c8bd7e6f400f5f82b96557ac0abafd0ac", size = 156429 },
+ { url = "https://files.pythonhosted.org/packages/f4/f4/a4541072bb9422c8a883ab55255f918fa378ecf083f5b85e87fc2b4eda1b/pyyaml-6.0.3-cp314-cp314-win_arm64.whl", hash = "sha256:93dda82c9c22deb0a405ea4dc5f2d0cda384168e466364dec6255b293923b2f3", size = 143912 },
+ { url = "https://files.pythonhosted.org/packages/7c/f9/07dd09ae774e4616edf6cda684ee78f97777bdd15847253637a6f052a62f/pyyaml-6.0.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:02893d100e99e03eda1c8fd5c441d8c60103fd175728e23e431db1b589cf5ab3", size = 189108 },
+ { url = "https://files.pythonhosted.org/packages/4e/78/8d08c9fb7ce09ad8c38ad533c1191cf27f7ae1effe5bb9400a46d9437fcf/pyyaml-6.0.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c1ff362665ae507275af2853520967820d9124984e0f7466736aea23d8611fba", size = 183641 },
+ { url = "https://files.pythonhosted.org/packages/7b/5b/3babb19104a46945cf816d047db2788bcaf8c94527a805610b0289a01c6b/pyyaml-6.0.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6adc77889b628398debc7b65c073bcb99c4a0237b248cacaf3fe8a557563ef6c", size = 831901 },
+ { url = "https://files.pythonhosted.org/packages/8b/cc/dff0684d8dc44da4d22a13f35f073d558c268780ce3c6ba1b87055bb0b87/pyyaml-6.0.3-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a80cb027f6b349846a3bf6d73b5e95e782175e52f22108cfa17876aaeff93702", size = 861132 },
+ { url = "https://files.pythonhosted.org/packages/b1/5e/f77dc6b9036943e285ba76b49e118d9ea929885becb0a29ba8a7c75e29fe/pyyaml-6.0.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:00c4bdeba853cc34e7dd471f16b4114f4162dc03e6b7afcc2128711f0eca823c", size = 839261 },
+ { url = "https://files.pythonhosted.org/packages/ce/88/a9db1376aa2a228197c58b37302f284b5617f56a5d959fd1763fb1675ce6/pyyaml-6.0.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:66e1674c3ef6f541c35191caae2d429b967b99e02040f5ba928632d9a7f0f065", size = 805272 },
+ { url = "https://files.pythonhosted.org/packages/da/92/1446574745d74df0c92e6aa4a7b0b3130706a4142b2d1a5869f2eaa423c6/pyyaml-6.0.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:16249ee61e95f858e83976573de0f5b2893b3677ba71c9dd36b9cf8be9ac6d65", size = 829923 },
+ { url = "https://files.pythonhosted.org/packages/f0/7a/1c7270340330e575b92f397352af856a8c06f230aa3e76f86b39d01b416a/pyyaml-6.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4ad1906908f2f5ae4e5a8ddfce73c320c2a1429ec52eafd27138b7f1cbe341c9", size = 174062 },
+ { url = "https://files.pythonhosted.org/packages/f1/12/de94a39c2ef588c7e6455cfbe7343d3b2dc9d6b6b2f40c4c6565744c873d/pyyaml-6.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b", size = 149341 },
+]
+
+[[package]]
+name = "regex"
+version = "2025.11.3"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/cc/a9/546676f25e573a4cf00fe8e119b78a37b6a8fe2dc95cda877b30889c9c45/regex-2025.11.3.tar.gz", hash = "sha256:1fedc720f9bb2494ce31a58a1631f9c82df6a09b49c19517ea5cc280b4541e01", size = 414669 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/8a/d6/d788d52da01280a30a3f6268aef2aa71043bff359c618fea4c5b536654d5/regex-2025.11.3-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:2b441a4ae2c8049106e8b39973bfbddfb25a179dda2bdb99b0eeb60c40a6a3af", size = 488087 },
+ { url = "https://files.pythonhosted.org/packages/69/39/abec3bd688ec9bbea3562de0fd764ff802976185f5ff22807bf0a2697992/regex-2025.11.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2fa2eed3f76677777345d2f81ee89f5de2f5745910e805f7af7386a920fa7313", size = 290544 },
+ { url = "https://files.pythonhosted.org/packages/39/b3/9a231475d5653e60002508f41205c61684bb2ffbf2401351ae2186897fc4/regex-2025.11.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:d8b4a27eebd684319bdf473d39f1d79eed36bf2cd34bd4465cdb4618d82b3d56", size = 288408 },
+ { url = "https://files.pythonhosted.org/packages/c3/c5/1929a0491bd5ac2d1539a866768b88965fa8c405f3e16a8cef84313098d6/regex-2025.11.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5cf77eac15bd264986c4a2c63353212c095b40f3affb2bc6b4ef80c4776c1a28", size = 781584 },
+ { url = "https://files.pythonhosted.org/packages/ce/fd/16aa16cf5d497ef727ec966f74164fbe75d6516d3d58ac9aa989bc9cdaad/regex-2025.11.3-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b7f9ee819f94c6abfa56ec7b1dbab586f41ebbdc0a57e6524bd5e7f487a878c7", size = 850733 },
+ { url = "https://files.pythonhosted.org/packages/e6/49/3294b988855a221cb6565189edf5dc43239957427df2d81d4a6b15244f64/regex-2025.11.3-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:838441333bc90b829406d4a03cb4b8bf7656231b84358628b0406d803931ef32", size = 898691 },
+ { url = "https://files.pythonhosted.org/packages/14/62/b56d29e70b03666193369bdbdedfdc23946dbe9f81dd78ce262c74d988ab/regex-2025.11.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:cfe6d3f0c9e3b7e8c0c694b24d25e677776f5ca26dce46fd6b0489f9c8339391", size = 791662 },
+ { url = "https://files.pythonhosted.org/packages/15/fc/e4c31d061eced63fbf1ce9d853975f912c61a7d406ea14eda2dd355f48e7/regex-2025.11.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:2ab815eb8a96379a27c3b6157fcb127c8f59c36f043c1678110cea492868f1d5", size = 782587 },
+ { url = "https://files.pythonhosted.org/packages/b2/bb/5e30c7394bcf63f0537121c23e796be67b55a8847c3956ae6068f4c70702/regex-2025.11.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:728a9d2d173a65b62bdc380b7932dd8e74ed4295279a8fe1021204ce210803e7", size = 774709 },
+ { url = "https://files.pythonhosted.org/packages/c5/c4/fce773710af81b0cb37cb4ff0947e75d5d17dee304b93d940b87a67fc2f4/regex-2025.11.3-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:509dc827f89c15c66a0c216331260d777dd6c81e9a4e4f830e662b0bb296c313", size = 845773 },
+ { url = "https://files.pythonhosted.org/packages/7b/5e/9466a7ec4b8ec282077095c6eb50a12a389d2e036581134d4919e8ca518c/regex-2025.11.3-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:849202cd789e5f3cf5dcc7822c34b502181b4824a65ff20ce82da5524e45e8e9", size = 836164 },
+ { url = "https://files.pythonhosted.org/packages/95/18/82980a60e8ed1594eb3c89eb814fb276ef51b9af7caeab1340bfd8564af6/regex-2025.11.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:b6f78f98741dcc89607c16b1e9426ee46ce4bf31ac5e6b0d40e81c89f3481ea5", size = 779832 },
+ { url = "https://files.pythonhosted.org/packages/03/cc/90ab0fdbe6dce064a42015433f9152710139fb04a8b81b4fb57a1cb63ffa/regex-2025.11.3-cp310-cp310-win32.whl", hash = "sha256:149eb0bba95231fb4f6d37c8f760ec9fa6fabf65bab555e128dde5f2475193ec", size = 265802 },
+ { url = "https://files.pythonhosted.org/packages/34/9d/e9e8493a85f3b1ddc4a5014465f5c2b78c3ea1cbf238dcfde78956378041/regex-2025.11.3-cp310-cp310-win_amd64.whl", hash = "sha256:ee3a83ce492074c35a74cc76cf8235d49e77b757193a5365ff86e3f2f93db9fd", size = 277722 },
+ { url = "https://files.pythonhosted.org/packages/15/c4/b54b24f553966564506dbf873a3e080aef47b356a3b39b5d5aba992b50db/regex-2025.11.3-cp310-cp310-win_arm64.whl", hash = "sha256:38af559ad934a7b35147716655d4a2f79fcef2d695ddfe06a06ba40ae631fa7e", size = 270289 },
+ { url = "https://files.pythonhosted.org/packages/f7/90/4fb5056e5f03a7048abd2b11f598d464f0c167de4f2a51aa868c376b8c70/regex-2025.11.3-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:eadade04221641516fa25139273505a1c19f9bf97589a05bc4cfcd8b4a618031", size = 488081 },
+ { url = "https://files.pythonhosted.org/packages/85/23/63e481293fac8b069d84fba0299b6666df720d875110efd0338406b5d360/regex-2025.11.3-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:feff9e54ec0dd3833d659257f5c3f5322a12eee58ffa360984b716f8b92983f4", size = 290554 },
+ { url = "https://files.pythonhosted.org/packages/2b/9d/b101d0262ea293a0066b4522dfb722eb6a8785a8c3e084396a5f2c431a46/regex-2025.11.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:3b30bc921d50365775c09a7ed446359e5c0179e9e2512beec4a60cbcef6ddd50", size = 288407 },
+ { url = "https://files.pythonhosted.org/packages/0c/64/79241c8209d5b7e00577ec9dca35cd493cc6be35b7d147eda367d6179f6d/regex-2025.11.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f99be08cfead2020c7ca6e396c13543baea32343b7a9a5780c462e323bd8872f", size = 793418 },
+ { url = "https://files.pythonhosted.org/packages/3d/e2/23cd5d3573901ce8f9757c92ca4db4d09600b865919b6d3e7f69f03b1afd/regex-2025.11.3-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:6dd329a1b61c0ee95ba95385fb0c07ea0d3fe1a21e1349fa2bec272636217118", size = 860448 },
+ { url = "https://files.pythonhosted.org/packages/2a/4c/aecf31beeaa416d0ae4ecb852148d38db35391aac19c687b5d56aedf3a8b/regex-2025.11.3-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4c5238d32f3c5269d9e87be0cf096437b7622b6920f5eac4fd202468aaeb34d2", size = 907139 },
+ { url = "https://files.pythonhosted.org/packages/61/22/b8cb00df7d2b5e0875f60628594d44dba283e951b1ae17c12f99e332cc0a/regex-2025.11.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:10483eefbfb0adb18ee9474498c9a32fcf4e594fbca0543bb94c48bac6183e2e", size = 800439 },
+ { url = "https://files.pythonhosted.org/packages/02/a8/c4b20330a5cdc7a8eb265f9ce593f389a6a88a0c5f280cf4d978f33966bc/regex-2025.11.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:78c2d02bb6e1da0720eedc0bad578049cad3f71050ef8cd065ecc87691bed2b0", size = 782965 },
+ { url = "https://files.pythonhosted.org/packages/b4/4c/ae3e52988ae74af4b04d2af32fee4e8077f26e51b62ec2d12d246876bea2/regex-2025.11.3-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:e6b49cd2aad93a1790ce9cffb18964f6d3a4b0b3dbdbd5de094b65296fce6e58", size = 854398 },
+ { url = "https://files.pythonhosted.org/packages/06/d1/a8b9cf45874eda14b2e275157ce3b304c87e10fb38d9fc26a6e14eb18227/regex-2025.11.3-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:885b26aa3ee56433b630502dc3d36ba78d186a00cc535d3806e6bfd9ed3c70ab", size = 845897 },
+ { url = "https://files.pythonhosted.org/packages/ea/fe/1830eb0236be93d9b145e0bd8ab499f31602fe0999b1f19e99955aa8fe20/regex-2025.11.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ddd76a9f58e6a00f8772e72cff8ebcff78e022be95edf018766707c730593e1e", size = 788906 },
+ { url = "https://files.pythonhosted.org/packages/66/47/dc2577c1f95f188c1e13e2e69d8825a5ac582ac709942f8a03af42ed6e93/regex-2025.11.3-cp311-cp311-win32.whl", hash = "sha256:3e816cc9aac1cd3cc9a4ec4d860f06d40f994b5c7b4d03b93345f44e08cc68bf", size = 265812 },
+ { url = "https://files.pythonhosted.org/packages/50/1e/15f08b2f82a9bbb510621ec9042547b54d11e83cb620643ebb54e4eb7d71/regex-2025.11.3-cp311-cp311-win_amd64.whl", hash = "sha256:087511f5c8b7dfbe3a03f5d5ad0c2a33861b1fc387f21f6f60825a44865a385a", size = 277737 },
+ { url = "https://files.pythonhosted.org/packages/f4/fc/6500eb39f5f76c5e47a398df82e6b535a5e345f839581012a418b16f9cc3/regex-2025.11.3-cp311-cp311-win_arm64.whl", hash = "sha256:1ff0d190c7f68ae7769cd0313fe45820ba07ffebfddfaa89cc1eb70827ba0ddc", size = 270290 },
+ { url = "https://files.pythonhosted.org/packages/e8/74/18f04cb53e58e3fb107439699bd8375cf5a835eec81084e0bddbd122e4c2/regex-2025.11.3-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:bc8ab71e2e31b16e40868a40a69007bc305e1109bd4658eb6cad007e0bf67c41", size = 489312 },
+ { url = "https://files.pythonhosted.org/packages/78/3f/37fcdd0d2b1e78909108a876580485ea37c91e1acf66d3bb8e736348f441/regex-2025.11.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:22b29dda7e1f7062a52359fca6e58e548e28c6686f205e780b02ad8ef710de36", size = 291256 },
+ { url = "https://files.pythonhosted.org/packages/bf/26/0a575f58eb23b7ebd67a45fccbc02ac030b737b896b7e7a909ffe43ffd6a/regex-2025.11.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3a91e4a29938bc1a082cc28fdea44be420bf2bebe2665343029723892eb073e1", size = 288921 },
+ { url = "https://files.pythonhosted.org/packages/ea/98/6a8dff667d1af907150432cf5abc05a17ccd32c72a3615410d5365ac167a/regex-2025.11.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:08b884f4226602ad40c5d55f52bf91a9df30f513864e0054bad40c0e9cf1afb7", size = 798568 },
+ { url = "https://files.pythonhosted.org/packages/64/15/92c1db4fa4e12733dd5a526c2dd2b6edcbfe13257e135fc0f6c57f34c173/regex-2025.11.3-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:3e0b11b2b2433d1c39c7c7a30e3f3d0aeeea44c2a8d0bae28f6b95f639927a69", size = 864165 },
+ { url = "https://files.pythonhosted.org/packages/f9/e7/3ad7da8cdee1ce66c7cd37ab5ab05c463a86ffeb52b1a25fe7bd9293b36c/regex-2025.11.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:87eb52a81ef58c7ba4d45c3ca74e12aa4b4e77816f72ca25258a85b3ea96cb48", size = 912182 },
+ { url = "https://files.pythonhosted.org/packages/84/bd/9ce9f629fcb714ffc2c3faf62b6766ecb7a585e1e885eb699bcf130a5209/regex-2025.11.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a12ab1f5c29b4e93db518f5e3872116b7e9b1646c9f9f426f777b50d44a09e8c", size = 803501 },
+ { url = "https://files.pythonhosted.org/packages/7c/0f/8dc2e4349d8e877283e6edd6c12bdcebc20f03744e86f197ab6e4492bf08/regex-2025.11.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:7521684c8c7c4f6e88e35ec89680ee1aa8358d3f09d27dfbdf62c446f5d4c695", size = 787842 },
+ { url = "https://files.pythonhosted.org/packages/f9/73/cff02702960bc185164d5619c0c62a2f598a6abff6695d391b096237d4ab/regex-2025.11.3-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:7fe6e5440584e94cc4b3f5f4d98a25e29ca12dccf8873679a635638349831b98", size = 858519 },
+ { url = "https://files.pythonhosted.org/packages/61/83/0e8d1ae71e15bc1dc36231c90b46ee35f9d52fab2e226b0e039e7ea9c10a/regex-2025.11.3-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:8e026094aa12b43f4fd74576714e987803a315c76edb6b098b9809db5de58f74", size = 850611 },
+ { url = "https://files.pythonhosted.org/packages/c8/f5/70a5cdd781dcfaa12556f2955bf170cd603cb1c96a1827479f8faea2df97/regex-2025.11.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:435bbad13e57eb5606a68443af62bed3556de2f46deb9f7d4237bc2f1c9fb3a0", size = 789759 },
+ { url = "https://files.pythonhosted.org/packages/59/9b/7c29be7903c318488983e7d97abcf8ebd3830e4c956c4c540005fcfb0462/regex-2025.11.3-cp312-cp312-win32.whl", hash = "sha256:3839967cf4dc4b985e1570fd8d91078f0c519f30491c60f9ac42a8db039be204", size = 266194 },
+ { url = "https://files.pythonhosted.org/packages/1a/67/3b92df89f179d7c367be654ab5626ae311cb28f7d5c237b6bb976cd5fbbb/regex-2025.11.3-cp312-cp312-win_amd64.whl", hash = "sha256:e721d1b46e25c481dc5ded6f4b3f66c897c58d2e8cfdf77bbced84339108b0b9", size = 277069 },
+ { url = "https://files.pythonhosted.org/packages/d7/55/85ba4c066fe5094d35b249c3ce8df0ba623cfd35afb22d6764f23a52a1c5/regex-2025.11.3-cp312-cp312-win_arm64.whl", hash = "sha256:64350685ff08b1d3a6fff33f45a9ca183dc1d58bbfe4981604e70ec9801bbc26", size = 270330 },
+ { url = "https://files.pythonhosted.org/packages/e1/a7/dda24ebd49da46a197436ad96378f17df30ceb40e52e859fc42cac45b850/regex-2025.11.3-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:c1e448051717a334891f2b9a620fe36776ebf3dd8ec46a0b877c8ae69575feb4", size = 489081 },
+ { url = "https://files.pythonhosted.org/packages/19/22/af2dc751aacf88089836aa088a1a11c4f21a04707eb1b0478e8e8fb32847/regex-2025.11.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:9b5aca4d5dfd7fbfbfbdaf44850fcc7709a01146a797536a8f84952e940cca76", size = 291123 },
+ { url = "https://files.pythonhosted.org/packages/a3/88/1a3ea5672f4b0a84802ee9891b86743438e7c04eb0b8f8c4e16a42375327/regex-2025.11.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:04d2765516395cf7dda331a244a3282c0f5ae96075f728629287dfa6f76ba70a", size = 288814 },
+ { url = "https://files.pythonhosted.org/packages/fb/8c/f5987895bf42b8ddeea1b315c9fedcfe07cadee28b9c98cf50d00adcb14d/regex-2025.11.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5d9903ca42bfeec4cebedba8022a7c97ad2aab22e09573ce9976ba01b65e4361", size = 798592 },
+ { url = "https://files.pythonhosted.org/packages/99/2a/6591ebeede78203fa77ee46a1c36649e02df9eaa77a033d1ccdf2fcd5d4e/regex-2025.11.3-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:639431bdc89d6429f6721625e8129413980ccd62e9d3f496be618a41d205f160", size = 864122 },
+ { url = "https://files.pythonhosted.org/packages/94/d6/be32a87cf28cf8ed064ff281cfbd49aefd90242a83e4b08b5a86b38e8eb4/regex-2025.11.3-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f117efad42068f9715677c8523ed2be1518116d1c49b1dd17987716695181efe", size = 912272 },
+ { url = "https://files.pythonhosted.org/packages/62/11/9bcef2d1445665b180ac7f230406ad80671f0fc2a6ffb93493b5dd8cd64c/regex-2025.11.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4aecb6f461316adf9f1f0f6a4a1a3d79e045f9b71ec76055a791affa3b285850", size = 803497 },
+ { url = "https://files.pythonhosted.org/packages/e5/a7/da0dc273d57f560399aa16d8a68ae7f9b57679476fc7ace46501d455fe84/regex-2025.11.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:3b3a5f320136873cc5561098dfab677eea139521cb9a9e8db98b7e64aef44cbc", size = 787892 },
+ { url = "https://files.pythonhosted.org/packages/da/4b/732a0c5a9736a0b8d6d720d4945a2f1e6f38f87f48f3173559f53e8d5d82/regex-2025.11.3-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:75fa6f0056e7efb1f42a1c34e58be24072cb9e61a601340cc1196ae92326a4f9", size = 858462 },
+ { url = "https://files.pythonhosted.org/packages/0c/f5/a2a03df27dc4c2d0c769220f5110ba8c4084b0bfa9ab0f9b4fcfa3d2b0fc/regex-2025.11.3-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:dbe6095001465294f13f1adcd3311e50dd84e5a71525f20a10bd16689c61ce0b", size = 850528 },
+ { url = "https://files.pythonhosted.org/packages/d6/09/e1cd5bee3841c7f6eb37d95ca91cdee7100b8f88b81e41c2ef426910891a/regex-2025.11.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:454d9b4ae7881afbc25015b8627c16d88a597479b9dea82b8c6e7e2e07240dc7", size = 789866 },
+ { url = "https://files.pythonhosted.org/packages/eb/51/702f5ea74e2a9c13d855a6a85b7f80c30f9e72a95493260193c07f3f8d74/regex-2025.11.3-cp313-cp313-win32.whl", hash = "sha256:28ba4d69171fc6e9896337d4fc63a43660002b7da53fc15ac992abcf3410917c", size = 266189 },
+ { url = "https://files.pythonhosted.org/packages/8b/00/6e29bb314e271a743170e53649db0fdb8e8ff0b64b4f425f5602f4eb9014/regex-2025.11.3-cp313-cp313-win_amd64.whl", hash = "sha256:bac4200befe50c670c405dc33af26dad5a3b6b255dd6c000d92fe4629f9ed6a5", size = 277054 },
+ { url = "https://files.pythonhosted.org/packages/25/f1/b156ff9f2ec9ac441710764dda95e4edaf5f36aca48246d1eea3f1fd96ec/regex-2025.11.3-cp313-cp313-win_arm64.whl", hash = "sha256:2292cd5a90dab247f9abe892ac584cb24f0f54680c73fcb4a7493c66c2bf2467", size = 270325 },
+ { url = "https://files.pythonhosted.org/packages/20/28/fd0c63357caefe5680b8ea052131acbd7f456893b69cc2a90cc3e0dc90d4/regex-2025.11.3-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:1eb1ebf6822b756c723e09f5186473d93236c06c579d2cc0671a722d2ab14281", size = 491984 },
+ { url = "https://files.pythonhosted.org/packages/df/ec/7014c15626ab46b902b3bcc4b28a7bae46d8f281fc7ea9c95e22fcaaa917/regex-2025.11.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:1e00ec2970aab10dc5db34af535f21fcf32b4a31d99e34963419636e2f85ae39", size = 292673 },
+ { url = "https://files.pythonhosted.org/packages/23/ab/3b952ff7239f20d05f1f99e9e20188513905f218c81d52fb5e78d2bf7634/regex-2025.11.3-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:a4cb042b615245d5ff9b3794f56be4138b5adc35a4166014d31d1814744148c7", size = 291029 },
+ { url = "https://files.pythonhosted.org/packages/21/7e/3dc2749fc684f455f162dcafb8a187b559e2614f3826877d3844a131f37b/regex-2025.11.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:44f264d4bf02f3176467d90b294d59bf1db9fe53c141ff772f27a8b456b2a9ed", size = 807437 },
+ { url = "https://files.pythonhosted.org/packages/1b/0b/d529a85ab349c6a25d1ca783235b6e3eedf187247eab536797021f7126c6/regex-2025.11.3-cp313-cp313t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:7be0277469bf3bd7a34a9c57c1b6a724532a0d235cd0dc4e7f4316f982c28b19", size = 873368 },
+ { url = "https://files.pythonhosted.org/packages/7d/18/2d868155f8c9e3e9d8f9e10c64e9a9f496bb8f7e037a88a8bed26b435af6/regex-2025.11.3-cp313-cp313t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:0d31e08426ff4b5b650f68839f5af51a92a5b51abd8554a60c2fbc7c71f25d0b", size = 914921 },
+ { url = "https://files.pythonhosted.org/packages/2d/71/9d72ff0f354fa783fe2ba913c8734c3b433b86406117a8db4ea2bf1c7a2f/regex-2025.11.3-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e43586ce5bd28f9f285a6e729466841368c4a0353f6fd08d4ce4630843d3648a", size = 812708 },
+ { url = "https://files.pythonhosted.org/packages/e7/19/ce4bf7f5575c97f82b6e804ffb5c4e940c62609ab2a0d9538d47a7fdf7d4/regex-2025.11.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:0f9397d561a4c16829d4e6ff75202c1c08b68a3bdbfe29dbfcdb31c9830907c6", size = 795472 },
+ { url = "https://files.pythonhosted.org/packages/03/86/fd1063a176ffb7b2315f9a1b08d17b18118b28d9df163132615b835a26ee/regex-2025.11.3-cp313-cp313t-musllinux_1_2_ppc64le.whl", hash = "sha256:dd16e78eb18ffdb25ee33a0682d17912e8cc8a770e885aeee95020046128f1ce", size = 868341 },
+ { url = "https://files.pythonhosted.org/packages/12/43/103fb2e9811205e7386366501bc866a164a0430c79dd59eac886a2822950/regex-2025.11.3-cp313-cp313t-musllinux_1_2_s390x.whl", hash = "sha256:ffcca5b9efe948ba0661e9df0fa50d2bc4b097c70b9810212d6b62f05d83b2dd", size = 854666 },
+ { url = "https://files.pythonhosted.org/packages/7d/22/e392e53f3869b75804762c7c848bd2dd2abf2b70fb0e526f58724638bd35/regex-2025.11.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:c56b4d162ca2b43318ac671c65bd4d563e841a694ac70e1a976ac38fcf4ca1d2", size = 799473 },
+ { url = "https://files.pythonhosted.org/packages/4f/f9/8bd6b656592f925b6845fcbb4d57603a3ac2fb2373344ffa1ed70aa6820a/regex-2025.11.3-cp313-cp313t-win32.whl", hash = "sha256:9ddc42e68114e161e51e272f667d640f97e84a2b9ef14b7477c53aac20c2d59a", size = 268792 },
+ { url = "https://files.pythonhosted.org/packages/e5/87/0e7d603467775ff65cd2aeabf1b5b50cc1c3708556a8b849a2fa4dd1542b/regex-2025.11.3-cp313-cp313t-win_amd64.whl", hash = "sha256:7a7c7fdf755032ffdd72c77e3d8096bdcb0eb92e89e17571a196f03d88b11b3c", size = 280214 },
+ { url = "https://files.pythonhosted.org/packages/8d/d0/2afc6f8e94e2b64bfb738a7c2b6387ac1699f09f032d363ed9447fd2bb57/regex-2025.11.3-cp313-cp313t-win_arm64.whl", hash = "sha256:df9eb838c44f570283712e7cff14c16329a9f0fb19ca492d21d4b7528ee6821e", size = 271469 },
+ { url = "https://files.pythonhosted.org/packages/31/e9/f6e13de7e0983837f7b6d238ad9458800a874bf37c264f7923e63409944c/regex-2025.11.3-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:9697a52e57576c83139d7c6f213d64485d3df5bf84807c35fa409e6c970801c6", size = 489089 },
+ { url = "https://files.pythonhosted.org/packages/a3/5c/261f4a262f1fa65141c1b74b255988bd2fa020cc599e53b080667d591cfc/regex-2025.11.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:e18bc3f73bd41243c9b38a6d9f2366cd0e0137a9aebe2d8ff76c5b67d4c0a3f4", size = 291059 },
+ { url = "https://files.pythonhosted.org/packages/8e/57/f14eeb7f072b0e9a5a090d1712741fd8f214ec193dba773cf5410108bb7d/regex-2025.11.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:61a08bcb0ec14ff4e0ed2044aad948d0659604f824cbd50b55e30b0ec6f09c73", size = 288900 },
+ { url = "https://files.pythonhosted.org/packages/3c/6b/1d650c45e99a9b327586739d926a1cd4e94666b1bd4af90428b36af66dc7/regex-2025.11.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c9c30003b9347c24bcc210958c5d167b9e4f9be786cb380a7d32f14f9b84674f", size = 799010 },
+ { url = "https://files.pythonhosted.org/packages/99/ee/d66dcbc6b628ce4e3f7f0cbbb84603aa2fc0ffc878babc857726b8aab2e9/regex-2025.11.3-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:4e1e592789704459900728d88d41a46fe3969b82ab62945560a31732ffc19a6d", size = 864893 },
+ { url = "https://files.pythonhosted.org/packages/bf/2d/f238229f1caba7ac87a6c4153d79947fb0261415827ae0f77c304260c7d3/regex-2025.11.3-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:6538241f45eb5a25aa575dbba1069ad786f68a4f2773a29a2bd3dd1f9de787be", size = 911522 },
+ { url = "https://files.pythonhosted.org/packages/bd/3d/22a4eaba214a917c80e04f6025d26143690f0419511e0116508e24b11c9b/regex-2025.11.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bce22519c989bb72a7e6b36a199384c53db7722fe669ba891da75907fe3587db", size = 803272 },
+ { url = "https://files.pythonhosted.org/packages/84/b1/03188f634a409353a84b5ef49754b97dbcc0c0f6fd6c8ede505a8960a0a4/regex-2025.11.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:66d559b21d3640203ab9075797a55165d79017520685fb407b9234d72ab63c62", size = 787958 },
+ { url = "https://files.pythonhosted.org/packages/99/6a/27d072f7fbf6fadd59c64d210305e1ff865cc3b78b526fd147db768c553b/regex-2025.11.3-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:669dcfb2e38f9e8c69507bace46f4889e3abbfd9b0c29719202883c0a603598f", size = 859289 },
+ { url = "https://files.pythonhosted.org/packages/9a/70/1b3878f648e0b6abe023172dacb02157e685564853cc363d9961bcccde4e/regex-2025.11.3-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:32f74f35ff0f25a5021373ac61442edcb150731fbaa28286bbc8bb1582c89d02", size = 850026 },
+ { url = "https://files.pythonhosted.org/packages/dd/d5/68e25559b526b8baab8e66839304ede68ff6727237a47727d240006bd0ff/regex-2025.11.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:e6c7a21dffba883234baefe91bc3388e629779582038f75d2a5be918e250f0ed", size = 789499 },
+ { url = "https://files.pythonhosted.org/packages/fc/df/43971264857140a350910d4e33df725e8c94dd9dee8d2e4729fa0d63d49e/regex-2025.11.3-cp314-cp314-win32.whl", hash = "sha256:795ea137b1d809eb6836b43748b12634291c0ed55ad50a7d72d21edf1cd565c4", size = 271604 },
+ { url = "https://files.pythonhosted.org/packages/01/6f/9711b57dc6894a55faf80a4c1b5aa4f8649805cb9c7aef46f7d27e2b9206/regex-2025.11.3-cp314-cp314-win_amd64.whl", hash = "sha256:9f95fbaa0ee1610ec0fc6b26668e9917a582ba80c52cc6d9ada15e30aa9ab9ad", size = 280320 },
+ { url = "https://files.pythonhosted.org/packages/f1/7e/f6eaa207d4377481f5e1775cdeb5a443b5a59b392d0065f3417d31d80f87/regex-2025.11.3-cp314-cp314-win_arm64.whl", hash = "sha256:dfec44d532be4c07088c3de2876130ff0fbeeacaa89a137decbbb5f665855a0f", size = 273372 },
+ { url = "https://files.pythonhosted.org/packages/c3/06/49b198550ee0f5e4184271cee87ba4dfd9692c91ec55289e6282f0f86ccf/regex-2025.11.3-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:ba0d8a5d7f04f73ee7d01d974d47c5834f8a1b0224390e4fe7c12a3a92a78ecc", size = 491985 },
+ { url = "https://files.pythonhosted.org/packages/ce/bf/abdafade008f0b1c9da10d934034cb670432d6cf6cbe38bbb53a1cfd6cf8/regex-2025.11.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:442d86cf1cfe4faabf97db7d901ef58347efd004934da045c745e7b5bd57ac49", size = 292669 },
+ { url = "https://files.pythonhosted.org/packages/f9/ef/0c357bb8edbd2ad8e273fcb9e1761bc37b8acbc6e1be050bebd6475f19c1/regex-2025.11.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:fd0a5e563c756de210bb964789b5abe4f114dacae9104a47e1a649b910361536", size = 291030 },
+ { url = "https://files.pythonhosted.org/packages/79/06/edbb67257596649b8fb088d6aeacbcb248ac195714b18a65e018bf4c0b50/regex-2025.11.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bf3490bcbb985a1ae97b2ce9ad1c0f06a852d5b19dde9b07bdf25bf224248c95", size = 807674 },
+ { url = "https://files.pythonhosted.org/packages/f4/d9/ad4deccfce0ea336296bd087f1a191543bb99ee1c53093dcd4c64d951d00/regex-2025.11.3-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:3809988f0a8b8c9dcc0f92478d6501fac7200b9ec56aecf0ec21f4a2ec4b6009", size = 873451 },
+ { url = "https://files.pythonhosted.org/packages/13/75/a55a4724c56ef13e3e04acaab29df26582f6978c000ac9cd6810ad1f341f/regex-2025.11.3-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f4ff94e58e84aedb9c9fce66d4ef9f27a190285b451420f297c9a09f2b9abee9", size = 914980 },
+ { url = "https://files.pythonhosted.org/packages/67/1e/a1657ee15bd9116f70d4a530c736983eed997b361e20ecd8f5ca3759d5c5/regex-2025.11.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7eb542fd347ce61e1321b0a6b945d5701528dca0cd9759c2e3bb8bd57e47964d", size = 812852 },
+ { url = "https://files.pythonhosted.org/packages/b8/6f/f7516dde5506a588a561d296b2d0044839de06035bb486b326065b4c101e/regex-2025.11.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:d6c2d5919075a1f2e413c00b056ea0c2f065b3f5fe83c3d07d325ab92dce51d6", size = 795566 },
+ { url = "https://files.pythonhosted.org/packages/d9/dd/3d10b9e170cc16fb34cb2cef91513cf3df65f440b3366030631b2984a264/regex-2025.11.3-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:3f8bf11a4827cc7ce5a53d4ef6cddd5ad25595d3c1435ef08f76825851343154", size = 868463 },
+ { url = "https://files.pythonhosted.org/packages/f5/8e/935e6beff1695aa9085ff83195daccd72acc82c81793df480f34569330de/regex-2025.11.3-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:22c12d837298651e5550ac1d964e4ff57c3f56965fc1812c90c9fb2028eaf267", size = 854694 },
+ { url = "https://files.pythonhosted.org/packages/92/12/10650181a040978b2f5720a6a74d44f841371a3d984c2083fc1752e4acf6/regex-2025.11.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:62ba394a3dda9ad41c7c780f60f6e4a70988741415ae96f6d1bf6c239cf01379", size = 799691 },
+ { url = "https://files.pythonhosted.org/packages/67/90/8f37138181c9a7690e7e4cb388debbd389342db3c7381d636d2875940752/regex-2025.11.3-cp314-cp314t-win32.whl", hash = "sha256:4bf146dca15cdd53224a1bf46d628bd7590e4a07fbb69e720d561aea43a32b38", size = 274583 },
+ { url = "https://files.pythonhosted.org/packages/8f/cd/867f5ec442d56beb56f5f854f40abcfc75e11d10b11fdb1869dd39c63aaf/regex-2025.11.3-cp314-cp314t-win_amd64.whl", hash = "sha256:adad1a1bcf1c9e76346e091d22d23ac54ef28e1365117d99521631078dfec9de", size = 284286 },
+ { url = "https://files.pythonhosted.org/packages/20/31/32c0c4610cbc070362bf1d2e4ea86d1ea29014d400a6d6c2486fcfd57766/regex-2025.11.3-cp314-cp314t-win_arm64.whl", hash = "sha256:c54f768482cef41e219720013cd05933b6f971d9562544d691c68699bf2b6801", size = 274741 },
+]
+
+[[package]]
+name = "requests"
+version = "2.32.5"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "certifi" },
+ { name = "charset-normalizer" },
+ { name = "idna" },
+ { name = "urllib3" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/c9/74/b3ff8e6c8446842c3f5c837e9c3dfcfe2018ea6ecef224c710c85ef728f4/requests-2.32.5.tar.gz", hash = "sha256:dbba0bac56e100853db0ea71b82b4dfd5fe2bf6d3754a8893c3af500cec7d7cf", size = 134517 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/1e/db/4254e3eabe8020b458f1a747140d32277ec7a271daf1d235b70dc0b4e6e3/requests-2.32.5-py3-none-any.whl", hash = "sha256:2462f94637a34fd532264295e186976db0f5d453d1cdd31473c85a6a161affb6", size = 64738 },
+]
+
+[[package]]
+name = "rich"
+version = "14.2.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "markdown-it-py" },
+ { name = "pygments" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/fb/d2/8920e102050a0de7bfabeb4c4614a49248cf8d5d7a8d01885fbb24dc767a/rich-14.2.0.tar.gz", hash = "sha256:73ff50c7c0c1c77c8243079283f4edb376f0f6442433aecb8ce7e6d0b92d1fe4", size = 219990 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/25/7a/b0178788f8dc6cafce37a212c99565fa1fe7872c70c6c9c1e1a372d9d88f/rich-14.2.0-py3-none-any.whl", hash = "sha256:76bc51fe2e57d2b1be1f96c524b890b816e334ab4c1e45888799bfaab0021edd", size = 243393 },
+]
+
+[[package]]
+name = "ruff"
+version = "0.14.10"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/57/08/52232a877978dd8f9cf2aeddce3e611b40a63287dfca29b6b8da791f5e8d/ruff-0.14.10.tar.gz", hash = "sha256:9a2e830f075d1a42cd28420d7809ace390832a490ed0966fe373ba288e77aaf4", size = 5859763 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/60/01/933704d69f3f05ee16ef11406b78881733c186fe14b6a46b05cfcaf6d3b2/ruff-0.14.10-py3-none-linux_armv6l.whl", hash = "sha256:7a3ce585f2ade3e1f29ec1b92df13e3da262178df8c8bdf876f48fa0e8316c49", size = 13527080 },
+ { url = "https://files.pythonhosted.org/packages/df/58/a0349197a7dfa603ffb7f5b0470391efa79ddc327c1e29c4851e85b09cc5/ruff-0.14.10-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:674f9be9372907f7257c51f1d4fc902cb7cf014b9980152b802794317941f08f", size = 13797320 },
+ { url = "https://files.pythonhosted.org/packages/7b/82/36be59f00a6082e38c23536df4e71cdbc6af8d7c707eade97fcad5c98235/ruff-0.14.10-py3-none-macosx_11_0_arm64.whl", hash = "sha256:d85713d522348837ef9df8efca33ccb8bd6fcfc86a2cde3ccb4bc9d28a18003d", size = 12918434 },
+ { url = "https://files.pythonhosted.org/packages/a6/00/45c62a7f7e34da92a25804f813ebe05c88aa9e0c25e5cb5a7d23dd7450e3/ruff-0.14.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6987ebe0501ae4f4308d7d24e2d0fe3d7a98430f5adfd0f1fead050a740a3a77", size = 13371961 },
+ { url = "https://files.pythonhosted.org/packages/40/31/a5906d60f0405f7e57045a70f2d57084a93ca7425f22e1d66904769d1628/ruff-0.14.10-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:16a01dfb7b9e4eee556fbfd5392806b1b8550c9b4a9f6acd3dbe6812b193c70a", size = 13275629 },
+ { url = "https://files.pythonhosted.org/packages/3e/60/61c0087df21894cf9d928dc04bcd4fb10e8b2e8dca7b1a276ba2155b2002/ruff-0.14.10-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7165d31a925b7a294465fa81be8c12a0e9b60fb02bf177e79067c867e71f8b1f", size = 14029234 },
+ { url = "https://files.pythonhosted.org/packages/44/84/77d911bee3b92348b6e5dab5a0c898d87084ea03ac5dc708f46d88407def/ruff-0.14.10-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:c561695675b972effb0c0a45db233f2c816ff3da8dcfbe7dfc7eed625f218935", size = 15449890 },
+ { url = "https://files.pythonhosted.org/packages/e9/36/480206eaefa24a7ec321582dda580443a8f0671fdbf6b1c80e9c3e93a16a/ruff-0.14.10-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4bb98fcbbc61725968893682fd4df8966a34611239c9fd07a1f6a07e7103d08e", size = 15123172 },
+ { url = "https://files.pythonhosted.org/packages/5c/38/68e414156015ba80cef5473d57919d27dfb62ec804b96180bafdeaf0e090/ruff-0.14.10-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f24b47993a9d8cb858429e97bdf8544c78029f09b520af615c1d261bf827001d", size = 14460260 },
+ { url = "https://files.pythonhosted.org/packages/b3/19/9e050c0dca8aba824d67cc0db69fb459c28d8cd3f6855b1405b3f29cc91d/ruff-0.14.10-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:59aabd2e2c4fd614d2862e7939c34a532c04f1084476d6833dddef4afab87e9f", size = 14229978 },
+ { url = "https://files.pythonhosted.org/packages/51/eb/e8dd1dd6e05b9e695aa9dd420f4577debdd0f87a5ff2fedda33c09e9be8c/ruff-0.14.10-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:213db2b2e44be8625002dbea33bb9c60c66ea2c07c084a00d55732689d697a7f", size = 14338036 },
+ { url = "https://files.pythonhosted.org/packages/6a/12/f3e3a505db7c19303b70af370d137795fcfec136d670d5de5391e295c134/ruff-0.14.10-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:b914c40ab64865a17a9a5b67911d14df72346a634527240039eb3bd650e5979d", size = 13264051 },
+ { url = "https://files.pythonhosted.org/packages/08/64/8c3a47eaccfef8ac20e0484e68e0772013eb85802f8a9f7603ca751eb166/ruff-0.14.10-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:1484983559f026788e3a5c07c81ef7d1e97c1c78ed03041a18f75df104c45405", size = 13283998 },
+ { url = "https://files.pythonhosted.org/packages/12/84/534a5506f4074e5cc0529e5cd96cfc01bb480e460c7edf5af70d2bcae55e/ruff-0.14.10-py3-none-musllinux_1_2_i686.whl", hash = "sha256:c70427132db492d25f982fffc8d6c7535cc2fd2c83fc8888f05caaa248521e60", size = 13601891 },
+ { url = "https://files.pythonhosted.org/packages/0d/1e/14c916087d8598917dbad9b2921d340f7884824ad6e9c55de948a93b106d/ruff-0.14.10-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:5bcf45b681e9f1ee6445d317ce1fa9d6cba9a6049542d1c3d5b5958986be8830", size = 14336660 },
+ { url = "https://files.pythonhosted.org/packages/f2/1c/d7b67ab43f30013b47c12b42d1acd354c195351a3f7a1d67f59e54227ede/ruff-0.14.10-py3-none-win32.whl", hash = "sha256:104c49fc7ab73f3f3a758039adea978869a918f31b73280db175b43a2d9b51d6", size = 13196187 },
+ { url = "https://files.pythonhosted.org/packages/fb/9c/896c862e13886fae2af961bef3e6312db9ebc6adc2b156fe95e615dee8c1/ruff-0.14.10-py3-none-win_amd64.whl", hash = "sha256:466297bd73638c6bdf06485683e812db1c00c7ac96d4ddd0294a338c62fdc154", size = 14661283 },
+ { url = "https://files.pythonhosted.org/packages/74/31/b0e29d572670dca3674eeee78e418f20bdf97fa8aa9ea71380885e175ca0/ruff-0.14.10-py3-none-win_arm64.whl", hash = "sha256:e51d046cf6dda98a4633b8a8a771451107413b0f07183b2bef03f075599e44e6", size = 13729839 },
+]
+
+[[package]]
+name = "safetensors"
+version = "0.7.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/29/9c/6e74567782559a63bd040a236edca26fd71bc7ba88de2ef35d75df3bca5e/safetensors-0.7.0.tar.gz", hash = "sha256:07663963b67e8bd9f0b8ad15bb9163606cd27cc5a1b96235a50d8369803b96b0", size = 200878 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/fa/47/aef6c06649039accf914afef490268e1067ed82be62bcfa5b7e886ad15e8/safetensors-0.7.0-cp38-abi3-macosx_10_12_x86_64.whl", hash = "sha256:c82f4d474cf725255d9e6acf17252991c3c8aac038d6ef363a4bf8be2f6db517", size = 467781 },
+ { url = "https://files.pythonhosted.org/packages/e8/00/374c0c068e30cd31f1e1b46b4b5738168ec79e7689ca82ee93ddfea05109/safetensors-0.7.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:94fd4858284736bb67a897a41608b5b0c2496c9bdb3bf2af1fa3409127f20d57", size = 447058 },
+ { url = "https://files.pythonhosted.org/packages/f1/06/578ffed52c2296f93d7fd2d844cabfa92be51a587c38c8afbb8ae449ca89/safetensors-0.7.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e07d91d0c92a31200f25351f4acb2bc6aff7f48094e13ebb1d0fb995b54b6542", size = 491748 },
+ { url = "https://files.pythonhosted.org/packages/ae/33/1debbbb70e4791dde185edb9413d1fe01619255abb64b300157d7f15dddd/safetensors-0.7.0-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8469155f4cb518bafb4acf4865e8bb9d6804110d2d9bdcaa78564b9fd841e104", size = 503881 },
+ { url = "https://files.pythonhosted.org/packages/8e/1c/40c2ca924d60792c3be509833df711b553c60effbd91da6f5284a83f7122/safetensors-0.7.0-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:54bef08bf00a2bff599982f6b08e8770e09cc012d7bba00783fc7ea38f1fb37d", size = 623463 },
+ { url = "https://files.pythonhosted.org/packages/9b/3a/13784a9364bd43b0d61eef4bea2845039bc2030458b16594a1bd787ae26e/safetensors-0.7.0-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:42cb091236206bb2016d245c377ed383aa7f78691748f3bb6ee1bfa51ae2ce6a", size = 532855 },
+ { url = "https://files.pythonhosted.org/packages/a0/60/429e9b1cb3fc651937727befe258ea24122d9663e4d5709a48c9cbfceecb/safetensors-0.7.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dac7252938f0696ddea46f5e855dd3138444e82236e3be475f54929f0c510d48", size = 507152 },
+ { url = "https://files.pythonhosted.org/packages/3c/a8/4b45e4e059270d17af60359713ffd83f97900d45a6afa73aaa0d737d48b6/safetensors-0.7.0-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1d060c70284127fa805085d8f10fbd0962792aed71879d00864acda69dbab981", size = 541856 },
+ { url = "https://files.pythonhosted.org/packages/06/87/d26d8407c44175d8ae164a95b5a62707fcc445f3c0c56108e37d98070a3d/safetensors-0.7.0-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:cdab83a366799fa730f90a4ebb563e494f28e9e92c4819e556152ad55e43591b", size = 674060 },
+ { url = "https://files.pythonhosted.org/packages/11/f5/57644a2ff08dc6325816ba7217e5095f17269dada2554b658442c66aed51/safetensors-0.7.0-cp38-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:672132907fcad9f2aedcb705b2d7b3b93354a2aec1b2f706c4db852abe338f85", size = 771715 },
+ { url = "https://files.pythonhosted.org/packages/86/31/17883e13a814bd278ae6e266b13282a01049b0c81341da7fd0e3e71a80a3/safetensors-0.7.0-cp38-abi3-musllinux_1_2_i686.whl", hash = "sha256:5d72abdb8a4d56d4020713724ba81dac065fedb7f3667151c4a637f1d3fb26c0", size = 714377 },
+ { url = "https://files.pythonhosted.org/packages/4a/d8/0c8a7dc9b41dcac53c4cbf9df2b9c83e0e0097203de8b37a712b345c0be5/safetensors-0.7.0-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:b0f6d66c1c538d5a94a73aa9ddca8ccc4227e6c9ff555322ea40bdd142391dd4", size = 677368 },
+ { url = "https://files.pythonhosted.org/packages/05/e5/cb4b713c8a93469e3c5be7c3f8d77d307e65fe89673e731f5c2bfd0a9237/safetensors-0.7.0-cp38-abi3-win32.whl", hash = "sha256:c74af94bf3ac15ac4d0f2a7c7b4663a15f8c2ab15ed0fc7531ca61d0835eccba", size = 326423 },
+ { url = "https://files.pythonhosted.org/packages/5d/e6/ec8471c8072382cb91233ba7267fd931219753bb43814cbc71757bfd4dab/safetensors-0.7.0-cp38-abi3-win_amd64.whl", hash = "sha256:d1239932053f56f3456f32eb9625590cc7582e905021f94636202a864d470755", size = 341380 },
+ { url = "https://files.pythonhosted.org/packages/a7/6a/4d08d89a6fcbe905c5ae68b8b34f0791850882fc19782d0d02c65abbdf3b/safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f4729811a6640d019a4b7ba8638ee2fd21fa5ca8c7e7bdf0fed62068fcaac737", size = 492430 },
+ { url = "https://files.pythonhosted.org/packages/dd/29/59ed8152b30f72c42d00d241e58eaca558ae9dbfa5695206e2e0f54c7063/safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:12f49080303fa6bb424b362149a12949dfbbf1e06811a88f2307276b0c131afd", size = 503977 },
+ { url = "https://files.pythonhosted.org/packages/d3/0b/4811bfec67fa260e791369b16dab105e4bae82686120554cc484064e22b4/safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:0071bffba4150c2f46cae1432d31995d77acfd9f8db598b5d1a2ce67e8440ad2", size = 623890 },
+ { url = "https://files.pythonhosted.org/packages/58/5b/632a58724221ef03d78ab65062e82a1010e1bef8e8e0b9d7c6d7b8044841/safetensors-0.7.0-pp310-pypy310_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:473b32699f4200e69801bf5abf93f1a4ecd432a70984df164fc22ccf39c4a6f3", size = 531885 },
+]
+
+[[package]]
+name = "scenedetect"
+version = "0.6.7"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "click" },
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "platformdirs" },
+ { name = "tqdm" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/bd/b1/800d4c1d4da24cd673b921c0b5ffd5bbdcaa2a7f4f4dd86dd2c202a673c6/scenedetect-0.6.7.tar.gz", hash = "sha256:1a2c73b57de2e1656f7896edc8523de7217f361179a8966e947f79d33e40830f", size = 164213 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/e7/e9/05a20eaeed21d2e0761fc4d3819f1f5013a49945133323ba0ce7be8be291/scenedetect-0.6.7-py3-none-any.whl", hash = "sha256:935571453142f5d7d44a8d9bb713fdd89bdb69efdbce92c7dfe09d52c523ac2b", size = 130834 },
+]
+
+[[package]]
+name = "scikit-image"
+version = "0.25.2"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version < '3.11' and sys_platform == 'darwin'",
+ "python_full_version < '3.11' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+dependencies = [
+ { name = "imageio", marker = "python_full_version < '3.11'" },
+ { name = "lazy-loader", marker = "python_full_version < '3.11'" },
+ { name = "networkx", version = "3.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "packaging", marker = "python_full_version < '3.11'" },
+ { name = "pillow", marker = "python_full_version < '3.11'" },
+ { name = "scipy", version = "1.15.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "tifffile", version = "2025.5.10", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/c7/a8/3c0f256012b93dd2cb6fda9245e9f4bff7dc0486880b248005f15ea2255e/scikit_image-0.25.2.tar.gz", hash = "sha256:e5a37e6cd4d0c018a7a55b9d601357e3382826d3888c10d0213fc63bff977dde", size = 22693594 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/11/cb/016c63f16065c2d333c8ed0337e18a5cdf9bc32d402e4f26b0db362eb0e2/scikit_image-0.25.2-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d3278f586793176599df6a4cf48cb6beadae35c31e58dc01a98023af3dc31c78", size = 13988922 },
+ { url = "https://files.pythonhosted.org/packages/30/ca/ff4731289cbed63c94a0c9a5b672976603118de78ed21910d9060c82e859/scikit_image-0.25.2-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:5c311069899ce757d7dbf1d03e32acb38bb06153236ae77fcd820fd62044c063", size = 13192698 },
+ { url = "https://files.pythonhosted.org/packages/39/6d/a2aadb1be6d8e149199bb9b540ccde9e9622826e1ab42fe01de4c35ab918/scikit_image-0.25.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:be455aa7039a6afa54e84f9e38293733a2622b8c2fb3362b822d459cc5605e99", size = 14153634 },
+ { url = "https://files.pythonhosted.org/packages/96/08/916e7d9ee4721031b2f625db54b11d8379bd51707afaa3e5a29aecf10bc4/scikit_image-0.25.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a4c464b90e978d137330be433df4e76d92ad3c5f46a22f159520ce0fdbea8a09", size = 14767545 },
+ { url = "https://files.pythonhosted.org/packages/5f/ee/c53a009e3997dda9d285402f19226fbd17b5b3cb215da391c4ed084a1424/scikit_image-0.25.2-cp310-cp310-win_amd64.whl", hash = "sha256:60516257c5a2d2f74387c502aa2f15a0ef3498fbeaa749f730ab18f0a40fd054", size = 12812908 },
+ { url = "https://files.pythonhosted.org/packages/c4/97/3051c68b782ee3f1fb7f8f5bb7d535cf8cb92e8aae18fa9c1cdf7e15150d/scikit_image-0.25.2-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f4bac9196fb80d37567316581c6060763b0f4893d3aca34a9ede3825bc035b17", size = 14003057 },
+ { url = "https://files.pythonhosted.org/packages/19/23/257fc696c562639826065514d551b7b9b969520bd902c3a8e2fcff5b9e17/scikit_image-0.25.2-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:d989d64ff92e0c6c0f2018c7495a5b20e2451839299a018e0e5108b2680f71e0", size = 13180335 },
+ { url = "https://files.pythonhosted.org/packages/ef/14/0c4a02cb27ca8b1e836886b9ec7c9149de03053650e9e2ed0625f248dd92/scikit_image-0.25.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b2cfc96b27afe9a05bc92f8c6235321d3a66499995675b27415e0d0c76625173", size = 14144783 },
+ { url = "https://files.pythonhosted.org/packages/dd/9b/9fb556463a34d9842491d72a421942c8baff4281025859c84fcdb5e7e602/scikit_image-0.25.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:24cc986e1f4187a12aa319f777b36008764e856e5013666a4a83f8df083c2641", size = 14785376 },
+ { url = "https://files.pythonhosted.org/packages/de/ec/b57c500ee85885df5f2188f8bb70398481393a69de44a00d6f1d055f103c/scikit_image-0.25.2-cp311-cp311-win_amd64.whl", hash = "sha256:b4f6b61fc2db6340696afe3db6b26e0356911529f5f6aee8c322aa5157490c9b", size = 12791698 },
+ { url = "https://files.pythonhosted.org/packages/35/8c/5df82881284459f6eec796a5ac2a0a304bb3384eec2e73f35cfdfcfbf20c/scikit_image-0.25.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:8db8dd03663112783221bf01ccfc9512d1cc50ac9b5b0fe8f4023967564719fb", size = 13986000 },
+ { url = "https://files.pythonhosted.org/packages/ce/e6/93bebe1abcdce9513ffec01d8af02528b4c41fb3c1e46336d70b9ed4ef0d/scikit_image-0.25.2-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:483bd8cc10c3d8a7a37fae36dfa5b21e239bd4ee121d91cad1f81bba10cfb0ed", size = 13235893 },
+ { url = "https://files.pythonhosted.org/packages/53/4b/eda616e33f67129e5979a9eb33c710013caa3aa8a921991e6cc0b22cea33/scikit_image-0.25.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9d1e80107bcf2bf1291acfc0bf0425dceb8890abe9f38d8e94e23497cbf7ee0d", size = 14178389 },
+ { url = "https://files.pythonhosted.org/packages/6b/b5/b75527c0f9532dd8a93e8e7cd8e62e547b9f207d4c11e24f0006e8646b36/scikit_image-0.25.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a17e17eb8562660cc0d31bb55643a4da996a81944b82c54805c91b3fe66f4824", size = 15003435 },
+ { url = "https://files.pythonhosted.org/packages/34/e3/49beb08ebccda3c21e871b607c1cb2f258c3fa0d2f609fed0a5ba741b92d/scikit_image-0.25.2-cp312-cp312-win_amd64.whl", hash = "sha256:bdd2b8c1de0849964dbc54037f36b4e9420157e67e45a8709a80d727f52c7da2", size = 12899474 },
+ { url = "https://files.pythonhosted.org/packages/e6/7c/9814dd1c637f7a0e44342985a76f95a55dd04be60154247679fd96c7169f/scikit_image-0.25.2-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:7efa888130f6c548ec0439b1a7ed7295bc10105458a421e9bf739b457730b6da", size = 13921841 },
+ { url = "https://files.pythonhosted.org/packages/84/06/66a2e7661d6f526740c309e9717d3bd07b473661d5cdddef4dd978edab25/scikit_image-0.25.2-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:dd8011efe69c3641920614d550f5505f83658fe33581e49bed86feab43a180fc", size = 13196862 },
+ { url = "https://files.pythonhosted.org/packages/4e/63/3368902ed79305f74c2ca8c297dfeb4307269cbe6402412668e322837143/scikit_image-0.25.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:28182a9d3e2ce3c2e251383bdda68f8d88d9fff1a3ebe1eb61206595c9773341", size = 14117785 },
+ { url = "https://files.pythonhosted.org/packages/cd/9b/c3da56a145f52cd61a68b8465d6a29d9503bc45bc993bb45e84371c97d94/scikit_image-0.25.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b8abd3c805ce6944b941cfed0406d88faeb19bab3ed3d4b50187af55cf24d147", size = 14977119 },
+ { url = "https://files.pythonhosted.org/packages/8a/97/5fcf332e1753831abb99a2525180d3fb0d70918d461ebda9873f66dcc12f/scikit_image-0.25.2-cp313-cp313-win_amd64.whl", hash = "sha256:64785a8acefee460ec49a354706db0b09d1f325674107d7fa3eadb663fb56d6f", size = 12885116 },
+ { url = "https://files.pythonhosted.org/packages/10/cc/75e9f17e3670b5ed93c32456fda823333c6279b144cd93e2c03aa06aa472/scikit_image-0.25.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:330d061bd107d12f8d68f1d611ae27b3b813b8cdb0300a71d07b1379178dd4cd", size = 13862801 },
+]
+
+[[package]]
+name = "scikit-image"
+version = "0.26.0"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version >= '3.12' and sys_platform == 'darwin'",
+ "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux'",
+ "python_full_version == '3.11.*' and sys_platform == 'darwin'",
+ "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+dependencies = [
+ { name = "imageio", marker = "python_full_version >= '3.11'" },
+ { name = "lazy-loader", marker = "python_full_version >= '3.11'" },
+ { name = "networkx", version = "3.6.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "packaging", marker = "python_full_version >= '3.11'" },
+ { name = "pillow", marker = "python_full_version >= '3.11'" },
+ { name = "scipy", version = "1.16.3", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "tifffile", version = "2025.12.20", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/a1/b4/2528bb43c67d48053a7a649a9666432dc307d66ba02e3a6d5c40f46655df/scikit_image-0.26.0.tar.gz", hash = "sha256:f5f970ab04efad85c24714321fcc91613fcb64ef2a892a13167df2f3e59199fa", size = 22729739 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/76/16/8a407688b607f86f81f8c649bf0d68a2a6d67375f18c2d660aba20f5b648/scikit_image-0.26.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b1ede33a0fb3731457eaf53af6361e73dd510f449dac437ab54573b26788baf0", size = 12355510 },
+ { url = "https://files.pythonhosted.org/packages/6b/f9/7efc088ececb6f6868fd4475e16cfafc11f242ce9ab5fc3557d78b5da0d4/scikit_image-0.26.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7af7aa331c6846bd03fa28b164c18d0c3fd419dbb888fb05e958ac4257a78fdd", size = 12056334 },
+ { url = "https://files.pythonhosted.org/packages/9f/1e/bc7fb91fb5ff65ef42346c8b7ee8b09b04eabf89235ab7dbfdfd96cbd1ea/scikit_image-0.26.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9ea6207d9e9d21c3f464efe733121c0504e494dbdc7728649ff3e23c3c5a4953", size = 13297768 },
+ { url = "https://files.pythonhosted.org/packages/a5/2a/e71c1a7d90e70da67b88ccc609bd6ae54798d5847369b15d3a8052232f9d/scikit_image-0.26.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:74aa5518ccea28121f57a95374581d3b979839adc25bb03f289b1bc9b99c58af", size = 13711217 },
+ { url = "https://files.pythonhosted.org/packages/d4/59/9637ee12c23726266b91296791465218973ce1ad3e4c56fc81e4d8e7d6e1/scikit_image-0.26.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d5c244656de905e195a904e36dbc18585e06ecf67d90f0482cbde63d7f9ad59d", size = 14337782 },
+ { url = "https://files.pythonhosted.org/packages/e7/5c/a3e1e0860f9294663f540c117e4bf83d55e5b47c281d475cc06227e88411/scikit_image-0.26.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:21a818ee6ca2f2131b9e04d8eb7637b5c18773ebe7b399ad23dcc5afaa226d2d", size = 14805997 },
+ { url = "https://files.pythonhosted.org/packages/d3/c6/2eeacf173da041a9e388975f54e5c49df750757fcfc3ee293cdbbae1ea0a/scikit_image-0.26.0-cp311-cp311-win_amd64.whl", hash = "sha256:9490360c8d3f9a7e85c8de87daf7c0c66507960cf4947bb9610d1751928721c7", size = 11878486 },
+ { url = "https://files.pythonhosted.org/packages/c3/a4/a852c4949b9058d585e762a66bf7e9a2cd3be4795cd940413dfbfbb0ce79/scikit_image-0.26.0-cp311-cp311-win_arm64.whl", hash = "sha256:0baa0108d2d027f34d748e84e592b78acc23e965a5de0e4bb03cf371de5c0581", size = 11346518 },
+ { url = "https://files.pythonhosted.org/packages/99/e8/e13757982264b33a1621628f86b587e9a73a13f5256dad49b19ba7dc9083/scikit_image-0.26.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d454b93a6fa770ac5ae2d33570f8e7a321bb80d29511ce4b6b78058ebe176e8c", size = 12376452 },
+ { url = "https://files.pythonhosted.org/packages/e3/be/f8dd17d0510f9911f9f17ba301f7455328bf13dae416560126d428de9568/scikit_image-0.26.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3409e89d66eff5734cd2b672d1c48d2759360057e714e1d92a11df82c87cba37", size = 12061567 },
+ { url = "https://files.pythonhosted.org/packages/b3/2b/c70120a6880579fb42b91567ad79feb4772f7be72e8d52fec403a3dde0c6/scikit_image-0.26.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4c717490cec9e276afb0438dd165b7c3072d6c416709cc0f9f5a4c1070d23a44", size = 13084214 },
+ { url = "https://files.pythonhosted.org/packages/f4/a2/70401a107d6d7466d64b466927e6b96fcefa99d57494b972608e2f8be50f/scikit_image-0.26.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7df650e79031634ac90b11e64a9eedaf5a5e06fcd09bcd03a34be01745744466", size = 13561683 },
+ { url = "https://files.pythonhosted.org/packages/13/a5/48bdfd92794c5002d664e0910a349d0a1504671ef5ad358150f21643c79a/scikit_image-0.26.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:cefd85033e66d4ea35b525bb0937d7f42d4cdcfed2d1888e1570d5ce450d3932", size = 14112147 },
+ { url = "https://files.pythonhosted.org/packages/ee/b5/ac71694da92f5def5953ca99f18a10fe98eac2dd0a34079389b70b4d0394/scikit_image-0.26.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3f5bf622d7c0435884e1e141ebbe4b2804e16b2dd23ae4c6183e2ea99233be70", size = 14661625 },
+ { url = "https://files.pythonhosted.org/packages/23/4d/a3cc1e96f080e253dad2251bfae7587cf2b7912bcd76fd43fd366ff35a87/scikit_image-0.26.0-cp312-cp312-win_amd64.whl", hash = "sha256:abed017474593cd3056ae0fe948d07d0747b27a085e92df5474f4955dd65aec0", size = 11911059 },
+ { url = "https://files.pythonhosted.org/packages/35/8a/d1b8055f584acc937478abf4550d122936f420352422a1a625eef2c605d8/scikit_image-0.26.0-cp312-cp312-win_arm64.whl", hash = "sha256:4d57e39ef67a95d26860c8caf9b14b8fb130f83b34c6656a77f191fa6d1d04d8", size = 11348740 },
+ { url = "https://files.pythonhosted.org/packages/4f/48/02357ffb2cca35640f33f2cfe054a4d6d5d7a229b88880a64f1e45c11f4e/scikit_image-0.26.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:a2e852eccf41d2d322b8e60144e124802873a92b8d43a6f96331aa42888491c7", size = 12346329 },
+ { url = "https://files.pythonhosted.org/packages/67/b9/b792c577cea2c1e94cda83b135a656924fc57c428e8a6d302cd69aac1b60/scikit_image-0.26.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:98329aab3bc87db352b9887f64ce8cdb8e75f7c2daa19927f2e121b797b678d5", size = 12031726 },
+ { url = "https://files.pythonhosted.org/packages/07/a9/9564250dfd65cb20404a611016db52afc6268b2b371cd19c7538ea47580f/scikit_image-0.26.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:915bb3ba66455cf8adac00dc8fdf18a4cd29656aec7ddd38cb4dda90289a6f21", size = 13094910 },
+ { url = "https://files.pythonhosted.org/packages/a3/b8/0d8eeb5a9fd7d34ba84f8a55753a0a3e2b5b51b2a5a0ade648a8db4a62f7/scikit_image-0.26.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b36ab5e778bf50af5ff386c3ac508027dc3aaeccf2161bdf96bde6848f44d21b", size = 13660939 },
+ { url = "https://files.pythonhosted.org/packages/2f/d6/91d8973584d4793d4c1a847d388e34ef1218d835eeddecfc9108d735b467/scikit_image-0.26.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:09bad6a5d5949c7896c8347424c4cca899f1d11668030e5548813ab9c2865dcb", size = 14138938 },
+ { url = "https://files.pythonhosted.org/packages/39/9a/7e15d8dc10d6bbf212195fb39bdeb7f226c46dd53f9c63c312e111e2e175/scikit_image-0.26.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:aeb14db1ed09ad4bee4ceb9e635547a8d5f3549be67fc6c768c7f923e027e6cd", size = 14752243 },
+ { url = "https://files.pythonhosted.org/packages/8f/58/2b11b933097bc427e42b4a8b15f7de8f24f2bac1fd2779d2aea1431b2c31/scikit_image-0.26.0-cp313-cp313-win_amd64.whl", hash = "sha256:ac529eb9dbd5954f9aaa2e3fe9a3fd9661bfe24e134c688587d811a0233127f1", size = 11906770 },
+ { url = "https://files.pythonhosted.org/packages/ad/ec/96941474a18a04b69b6f6562a5bd79bd68049fa3728d3b350976eccb8b93/scikit_image-0.26.0-cp313-cp313-win_arm64.whl", hash = "sha256:a2d211bc355f59725efdcae699b93b30348a19416cc9e017f7b2fb599faf7219", size = 11342506 },
+ { url = "https://files.pythonhosted.org/packages/03/e5/c1a9962b0cf1952f42d32b4a2e48eed520320dbc4d2ff0b981c6fa508b6b/scikit_image-0.26.0-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:9eefb4adad066da408a7601c4c24b07af3b472d90e08c3e7483d4e9e829d8c49", size = 12663278 },
+ { url = "https://files.pythonhosted.org/packages/ae/97/c1a276a59ce8e4e24482d65c1a3940d69c6b3873279193b7ebd04e5ee56b/scikit_image-0.26.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:6caec76e16c970c528d15d1c757363334d5cb3069f9cea93d2bead31820511f3", size = 12405142 },
+ { url = "https://files.pythonhosted.org/packages/d4/4a/f1cbd1357caef6c7993f7efd514d6e53d8fd6f7fe01c4714d51614c53289/scikit_image-0.26.0-cp313-cp313t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a07200fe09b9d99fcdab959859fe0f7db8df6333d6204344425d476850ce3604", size = 12942086 },
+ { url = "https://files.pythonhosted.org/packages/5b/6f/74d9fb87c5655bd64cf00b0c44dc3d6206d9002e5f6ba1c9aeb13236f6bf/scikit_image-0.26.0-cp313-cp313t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:92242351bccf391fc5df2d1529d15470019496d2498d615beb68da85fe7fdf37", size = 13265667 },
+ { url = "https://files.pythonhosted.org/packages/a7/73/faddc2413ae98d863f6fa2e3e14da4467dd38e788e1c23346cf1a2b06b97/scikit_image-0.26.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:52c496f75a7e45844d951557f13c08c81487c6a1da2e3c9c8a39fcde958e02cc", size = 14001966 },
+ { url = "https://files.pythonhosted.org/packages/02/94/9f46966fa042b5d57c8cd641045372b4e0df0047dd400e77ea9952674110/scikit_image-0.26.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:20ef4a155e2e78b8ab973998e04d8a361d49d719e65412405f4dadd9155a61d9", size = 14359526 },
+ { url = "https://files.pythonhosted.org/packages/5d/b4/2840fe38f10057f40b1c9f8fb98a187a370936bf144a4ac23452c5ef1baf/scikit_image-0.26.0-cp313-cp313t-win_amd64.whl", hash = "sha256:c9087cf7d0e7f33ab5c46d2068d86d785e70b05400a891f73a13400f1e1faf6a", size = 12287629 },
+ { url = "https://files.pythonhosted.org/packages/22/ba/73b6ca70796e71f83ab222690e35a79612f0117e5aaf167151b7d46f5f2c/scikit_image-0.26.0-cp313-cp313t-win_arm64.whl", hash = "sha256:27d58bc8b2acd351f972c6508c1b557cfed80299826080a4d803dd29c51b707e", size = 11647755 },
+ { url = "https://files.pythonhosted.org/packages/51/44/6b744f92b37ae2833fd423cce8f806d2368859ec325a699dc30389e090b9/scikit_image-0.26.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:63af3d3a26125f796f01052052f86806da5b5e54c6abef152edb752683075a9c", size = 12365810 },
+ { url = "https://files.pythonhosted.org/packages/40/f5/83590d9355191f86ac663420fec741b82cc547a4afe7c4c1d986bf46e4db/scikit_image-0.26.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ce00600cd70d4562ed59f80523e18cdcc1fae0e10676498a01f73c255774aefd", size = 12075717 },
+ { url = "https://files.pythonhosted.org/packages/72/48/253e7cf5aee6190459fe136c614e2cbccc562deceb4af96e0863f1b8ee29/scikit_image-0.26.0-cp314-cp314-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6381edf972b32e4f54085449afde64365a57316637496c1325a736987083e2ab", size = 13161520 },
+ { url = "https://files.pythonhosted.org/packages/73/c3/cec6a3cbaadfdcc02bd6ff02f3abfe09eaa7f4d4e0a525a1e3a3f4bce49c/scikit_image-0.26.0-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c6624a76c6085218248154cc7e1500e6b488edcd9499004dd0d35040607d7505", size = 13684340 },
+ { url = "https://files.pythonhosted.org/packages/d4/0d/39a776f675d24164b3a267aa0db9f677a4cb20127660d8bf4fd7fef66817/scikit_image-0.26.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:f775f0e420faac9c2aa6757135f4eb468fb7b70e0b67fa77a5e79be3c30ee331", size = 14203839 },
+ { url = "https://files.pythonhosted.org/packages/ee/25/2514df226bbcedfe9b2caafa1ba7bc87231a0c339066981b182b08340e06/scikit_image-0.26.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ede4d6d255cc5da9faeb2f9ba7fedbc990abbc652db429f40a16b22e770bb578", size = 14770021 },
+ { url = "https://files.pythonhosted.org/packages/8d/5b/0671dc91c0c79340c3fe202f0549c7d3681eb7640fe34ab68a5f090a7c7f/scikit_image-0.26.0-cp314-cp314-win_amd64.whl", hash = "sha256:0660b83968c15293fd9135e8d860053ee19500d52bf55ca4fb09de595a1af650", size = 12023490 },
+ { url = "https://files.pythonhosted.org/packages/65/08/7c4cb59f91721f3de07719085212a0b3962e3e3f2d1818cbac4eeb1ea53e/scikit_image-0.26.0-cp314-cp314-win_arm64.whl", hash = "sha256:b8d14d3181c21c11170477a42542c1addc7072a90b986675a71266ad17abc37f", size = 11473782 },
+ { url = "https://files.pythonhosted.org/packages/49/41/65c4258137acef3d73cb561ac55512eacd7b30bb4f4a11474cad526bc5db/scikit_image-0.26.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:cde0bbd57e6795eba83cb10f71a677f7239271121dc950bc060482834a668ad1", size = 12686060 },
+ { url = "https://files.pythonhosted.org/packages/e7/32/76971f8727b87f1420a962406388a50e26667c31756126444baf6668f559/scikit_image-0.26.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:163e9afb5b879562b9aeda0dd45208a35316f26cc7a3aed54fd601604e5cf46f", size = 12422628 },
+ { url = "https://files.pythonhosted.org/packages/37/0d/996febd39f757c40ee7b01cdb861867327e5c8e5f595a634e8201462d958/scikit_image-0.26.0-cp314-cp314t-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:724f79fd9b6cb6f4a37864fe09f81f9f5d5b9646b6868109e1b100d1a7019e59", size = 12962369 },
+ { url = "https://files.pythonhosted.org/packages/48/b4/612d354f946c9600e7dea012723c11d47e8d455384e530f6daaaeb9bf62c/scikit_image-0.26.0-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3268f13310e6857508bd87202620df996199a016a1d281b309441d227c822394", size = 13272431 },
+ { url = "https://files.pythonhosted.org/packages/0a/6e/26c00b466e06055a086de2c6e2145fe189ccdc9a1d11ccc7de020f2591ad/scikit_image-0.26.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:fac96a1f9b06cd771cbbb3cd96c5332f36d4efd839b1d8b053f79e5887acde62", size = 14016362 },
+ { url = "https://files.pythonhosted.org/packages/47/88/00a90402e1775634043c2a0af8a3c76ad450866d9fa444efcc43b553ba2d/scikit_image-0.26.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:2c1e7bd342f43e7a97e571b3f03ba4c1293ea1a35c3f13f41efdc8a81c1dc8f2", size = 14364151 },
+ { url = "https://files.pythonhosted.org/packages/da/ca/918d8d306bd43beacff3b835c6d96fac0ae64c0857092f068b88db531a7c/scikit_image-0.26.0-cp314-cp314t-win_amd64.whl", hash = "sha256:b702c3bb115e1dcf4abf5297429b5c90f2189655888cbed14921f3d26f81d3a4", size = 12413484 },
+ { url = "https://files.pythonhosted.org/packages/dc/cd/4da01329b5a8d47ff7ec3c99a2b02465a8017b186027590dc7425cee0b56/scikit_image-0.26.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0608aa4a9ec39e0843de10d60edb2785a30c1c47819b67866dd223ebd149acaf", size = 11769501 },
+]
+
+[[package]]
+name = "scipy"
+version = "1.15.3"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version < '3.11' and sys_platform == 'darwin'",
+ "python_full_version < '3.11' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+dependencies = [
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/0f/37/6964b830433e654ec7485e45a00fc9a27cf868d622838f6b6d9c5ec0d532/scipy-1.15.3.tar.gz", hash = "sha256:eae3cf522bc7df64b42cad3925c876e1b0b6c35c1337c93e12c0f366f55b0eaf", size = 59419214 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/78/2f/4966032c5f8cc7e6a60f1b2e0ad686293b9474b65246b0c642e3ef3badd0/scipy-1.15.3-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:a345928c86d535060c9c2b25e71e87c39ab2f22fc96e9636bd74d1dbf9de448c", size = 38702770 },
+ { url = "https://files.pythonhosted.org/packages/a0/6e/0c3bf90fae0e910c274db43304ebe25a6b391327f3f10b5dcc638c090795/scipy-1.15.3-cp310-cp310-macosx_12_0_arm64.whl", hash = "sha256:ad3432cb0f9ed87477a8d97f03b763fd1d57709f1bbde3c9369b1dff5503b253", size = 30094511 },
+ { url = "https://files.pythonhosted.org/packages/ea/b1/4deb37252311c1acff7f101f6453f0440794f51b6eacb1aad4459a134081/scipy-1.15.3-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:aef683a9ae6eb00728a542b796f52a5477b78252edede72b8327a886ab63293f", size = 22368151 },
+ { url = "https://files.pythonhosted.org/packages/38/7d/f457626e3cd3c29b3a49ca115a304cebb8cc6f31b04678f03b216899d3c6/scipy-1.15.3-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:1c832e1bd78dea67d5c16f786681b28dd695a8cb1fb90af2e27580d3d0967e92", size = 25121732 },
+ { url = "https://files.pythonhosted.org/packages/db/0a/92b1de4a7adc7a15dcf5bddc6e191f6f29ee663b30511ce20467ef9b82e4/scipy-1.15.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:263961f658ce2165bbd7b99fa5135195c3a12d9bef045345016b8b50c315cb82", size = 35547617 },
+ { url = "https://files.pythonhosted.org/packages/8e/6d/41991e503e51fc1134502694c5fa7a1671501a17ffa12716a4a9151af3df/scipy-1.15.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9e2abc762b0811e09a0d3258abee2d98e0c703eee49464ce0069590846f31d40", size = 37662964 },
+ { url = "https://files.pythonhosted.org/packages/25/e1/3df8f83cb15f3500478c889be8fb18700813b95e9e087328230b98d547ff/scipy-1.15.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:ed7284b21a7a0c8f1b6e5977ac05396c0d008b89e05498c8b7e8f4a1423bba0e", size = 37238749 },
+ { url = "https://files.pythonhosted.org/packages/93/3e/b3257cf446f2a3533ed7809757039016b74cd6f38271de91682aa844cfc5/scipy-1.15.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:5380741e53df2c566f4d234b100a484b420af85deb39ea35a1cc1be84ff53a5c", size = 40022383 },
+ { url = "https://files.pythonhosted.org/packages/d1/84/55bc4881973d3f79b479a5a2e2df61c8c9a04fcb986a213ac9c02cfb659b/scipy-1.15.3-cp310-cp310-win_amd64.whl", hash = "sha256:9d61e97b186a57350f6d6fd72640f9e99d5a4a2b8fbf4b9ee9a841eab327dc13", size = 41259201 },
+ { url = "https://files.pythonhosted.org/packages/96/ab/5cc9f80f28f6a7dff646c5756e559823614a42b1939d86dd0ed550470210/scipy-1.15.3-cp311-cp311-macosx_10_13_x86_64.whl", hash = "sha256:993439ce220d25e3696d1b23b233dd010169b62f6456488567e830654ee37a6b", size = 38714255 },
+ { url = "https://files.pythonhosted.org/packages/4a/4a/66ba30abe5ad1a3ad15bfb0b59d22174012e8056ff448cb1644deccbfed2/scipy-1.15.3-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:34716e281f181a02341ddeaad584205bd2fd3c242063bd3423d61ac259ca7eba", size = 30111035 },
+ { url = "https://files.pythonhosted.org/packages/4b/fa/a7e5b95afd80d24313307f03624acc65801846fa75599034f8ceb9e2cbf6/scipy-1.15.3-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:3b0334816afb8b91dab859281b1b9786934392aa3d527cd847e41bb6f45bee65", size = 22384499 },
+ { url = "https://files.pythonhosted.org/packages/17/99/f3aaddccf3588bb4aea70ba35328c204cadd89517a1612ecfda5b2dd9d7a/scipy-1.15.3-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:6db907c7368e3092e24919b5e31c76998b0ce1684d51a90943cb0ed1b4ffd6c1", size = 25152602 },
+ { url = "https://files.pythonhosted.org/packages/56/c5/1032cdb565f146109212153339f9cb8b993701e9fe56b1c97699eee12586/scipy-1.15.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:721d6b4ef5dc82ca8968c25b111e307083d7ca9091bc38163fb89243e85e3889", size = 35503415 },
+ { url = "https://files.pythonhosted.org/packages/bd/37/89f19c8c05505d0601ed5650156e50eb881ae3918786c8fd7262b4ee66d3/scipy-1.15.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:39cb9c62e471b1bb3750066ecc3a3f3052b37751c7c3dfd0fd7e48900ed52982", size = 37652622 },
+ { url = "https://files.pythonhosted.org/packages/7e/31/be59513aa9695519b18e1851bb9e487de66f2d31f835201f1b42f5d4d475/scipy-1.15.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:795c46999bae845966368a3c013e0e00947932d68e235702b5c3f6ea799aa8c9", size = 37244796 },
+ { url = "https://files.pythonhosted.org/packages/10/c0/4f5f3eeccc235632aab79b27a74a9130c6c35df358129f7ac8b29f562ac7/scipy-1.15.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:18aaacb735ab38b38db42cb01f6b92a2d0d4b6aabefeb07f02849e47f8fb3594", size = 40047684 },
+ { url = "https://files.pythonhosted.org/packages/ab/a7/0ddaf514ce8a8714f6ed243a2b391b41dbb65251affe21ee3077ec45ea9a/scipy-1.15.3-cp311-cp311-win_amd64.whl", hash = "sha256:ae48a786a28412d744c62fd7816a4118ef97e5be0bee968ce8f0a2fba7acf3bb", size = 41246504 },
+ { url = "https://files.pythonhosted.org/packages/37/4b/683aa044c4162e10ed7a7ea30527f2cbd92e6999c10a8ed8edb253836e9c/scipy-1.15.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:6ac6310fdbfb7aa6612408bd2f07295bcbd3fda00d2d702178434751fe48e019", size = 38766735 },
+ { url = "https://files.pythonhosted.org/packages/7b/7e/f30be3d03de07f25dc0ec926d1681fed5c732d759ac8f51079708c79e680/scipy-1.15.3-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:185cd3d6d05ca4b44a8f1595af87f9c372bb6acf9c808e99aa3e9aa03bd98cf6", size = 30173284 },
+ { url = "https://files.pythonhosted.org/packages/07/9c/0ddb0d0abdabe0d181c1793db51f02cd59e4901da6f9f7848e1f96759f0d/scipy-1.15.3-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:05dc6abcd105e1a29f95eada46d4a3f251743cfd7d3ae8ddb4088047f24ea477", size = 22446958 },
+ { url = "https://files.pythonhosted.org/packages/af/43/0bce905a965f36c58ff80d8bea33f1f9351b05fad4beaad4eae34699b7a1/scipy-1.15.3-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:06efcba926324df1696931a57a176c80848ccd67ce6ad020c810736bfd58eb1c", size = 25242454 },
+ { url = "https://files.pythonhosted.org/packages/56/30/a6f08f84ee5b7b28b4c597aca4cbe545535c39fe911845a96414700b64ba/scipy-1.15.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c05045d8b9bfd807ee1b9f38761993297b10b245f012b11b13b91ba8945f7e45", size = 35210199 },
+ { url = "https://files.pythonhosted.org/packages/0b/1f/03f52c282437a168ee2c7c14a1a0d0781a9a4a8962d84ac05c06b4c5b555/scipy-1.15.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:271e3713e645149ea5ea3e97b57fdab61ce61333f97cfae392c28ba786f9bb49", size = 37309455 },
+ { url = "https://files.pythonhosted.org/packages/89/b1/fbb53137f42c4bf630b1ffdfc2151a62d1d1b903b249f030d2b1c0280af8/scipy-1.15.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:6cfd56fc1a8e53f6e89ba3a7a7251f7396412d655bca2aa5611c8ec9a6784a1e", size = 36885140 },
+ { url = "https://files.pythonhosted.org/packages/2e/2e/025e39e339f5090df1ff266d021892694dbb7e63568edcfe43f892fa381d/scipy-1.15.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0ff17c0bb1cb32952c09217d8d1eed9b53d1463e5f1dd6052c7857f83127d539", size = 39710549 },
+ { url = "https://files.pythonhosted.org/packages/e6/eb/3bf6ea8ab7f1503dca3a10df2e4b9c3f6b3316df07f6c0ded94b281c7101/scipy-1.15.3-cp312-cp312-win_amd64.whl", hash = "sha256:52092bc0472cfd17df49ff17e70624345efece4e1a12b23783a1ac59a1b728ed", size = 40966184 },
+ { url = "https://files.pythonhosted.org/packages/73/18/ec27848c9baae6e0d6573eda6e01a602e5649ee72c27c3a8aad673ebecfd/scipy-1.15.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:2c620736bcc334782e24d173c0fdbb7590a0a436d2fdf39310a8902505008759", size = 38728256 },
+ { url = "https://files.pythonhosted.org/packages/74/cd/1aef2184948728b4b6e21267d53b3339762c285a46a274ebb7863c9e4742/scipy-1.15.3-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:7e11270a000969409d37ed399585ee530b9ef6aa99d50c019de4cb01e8e54e62", size = 30109540 },
+ { url = "https://files.pythonhosted.org/packages/5b/d8/59e452c0a255ec352bd0a833537a3bc1bfb679944c4938ab375b0a6b3a3e/scipy-1.15.3-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:8c9ed3ba2c8a2ce098163a9bdb26f891746d02136995df25227a20e71c396ebb", size = 22383115 },
+ { url = "https://files.pythonhosted.org/packages/08/f5/456f56bbbfccf696263b47095291040655e3cbaf05d063bdc7c7517f32ac/scipy-1.15.3-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:0bdd905264c0c9cfa74a4772cdb2070171790381a5c4d312c973382fc6eaf730", size = 25163884 },
+ { url = "https://files.pythonhosted.org/packages/a2/66/a9618b6a435a0f0c0b8a6d0a2efb32d4ec5a85f023c2b79d39512040355b/scipy-1.15.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:79167bba085c31f38603e11a267d862957cbb3ce018d8b38f79ac043bc92d825", size = 35174018 },
+ { url = "https://files.pythonhosted.org/packages/b5/09/c5b6734a50ad4882432b6bb7c02baf757f5b2f256041da5df242e2d7e6b6/scipy-1.15.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c9deabd6d547aee2c9a81dee6cc96c6d7e9a9b1953f74850c179f91fdc729cb7", size = 37269716 },
+ { url = "https://files.pythonhosted.org/packages/77/0a/eac00ff741f23bcabd352731ed9b8995a0a60ef57f5fd788d611d43d69a1/scipy-1.15.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:dde4fc32993071ac0c7dd2d82569e544f0bdaff66269cb475e0f369adad13f11", size = 36872342 },
+ { url = "https://files.pythonhosted.org/packages/fe/54/4379be86dd74b6ad81551689107360d9a3e18f24d20767a2d5b9253a3f0a/scipy-1.15.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:f77f853d584e72e874d87357ad70f44b437331507d1c311457bed8ed2b956126", size = 39670869 },
+ { url = "https://files.pythonhosted.org/packages/87/2e/892ad2862ba54f084ffe8cc4a22667eaf9c2bcec6d2bff1d15713c6c0703/scipy-1.15.3-cp313-cp313-win_amd64.whl", hash = "sha256:b90ab29d0c37ec9bf55424c064312930ca5f4bde15ee8619ee44e69319aab163", size = 40988851 },
+ { url = "https://files.pythonhosted.org/packages/1b/e9/7a879c137f7e55b30d75d90ce3eb468197646bc7b443ac036ae3fe109055/scipy-1.15.3-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:3ac07623267feb3ae308487c260ac684b32ea35fd81e12845039952f558047b8", size = 38863011 },
+ { url = "https://files.pythonhosted.org/packages/51/d1/226a806bbd69f62ce5ef5f3ffadc35286e9fbc802f606a07eb83bf2359de/scipy-1.15.3-cp313-cp313t-macosx_12_0_arm64.whl", hash = "sha256:6487aa99c2a3d509a5227d9a5e889ff05830a06b2ce08ec30df6d79db5fcd5c5", size = 30266407 },
+ { url = "https://files.pythonhosted.org/packages/e5/9b/f32d1d6093ab9eeabbd839b0f7619c62e46cc4b7b6dbf05b6e615bbd4400/scipy-1.15.3-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:50f9e62461c95d933d5c5ef4a1f2ebf9a2b4e83b0db374cb3f1de104d935922e", size = 22540030 },
+ { url = "https://files.pythonhosted.org/packages/e7/29/c278f699b095c1a884f29fda126340fcc201461ee8bfea5c8bdb1c7c958b/scipy-1.15.3-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:14ed70039d182f411ffc74789a16df3835e05dc469b898233a245cdfd7f162cb", size = 25218709 },
+ { url = "https://files.pythonhosted.org/packages/24/18/9e5374b617aba742a990581373cd6b68a2945d65cc588482749ef2e64467/scipy-1.15.3-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0a769105537aa07a69468a0eefcd121be52006db61cdd8cac8a0e68980bbb723", size = 34809045 },
+ { url = "https://files.pythonhosted.org/packages/e1/fe/9c4361e7ba2927074360856db6135ef4904d505e9b3afbbcb073c4008328/scipy-1.15.3-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9db984639887e3dffb3928d118145ffe40eff2fa40cb241a306ec57c219ebbbb", size = 36703062 },
+ { url = "https://files.pythonhosted.org/packages/b7/8e/038ccfe29d272b30086b25a4960f757f97122cb2ec42e62b460d02fe98e9/scipy-1.15.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:40e54d5c7e7ebf1aa596c374c49fa3135f04648a0caabcb66c52884b943f02b4", size = 36393132 },
+ { url = "https://files.pythonhosted.org/packages/10/7e/5c12285452970be5bdbe8352c619250b97ebf7917d7a9a9e96b8a8140f17/scipy-1.15.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:5e721fed53187e71d0ccf382b6bf977644c533e506c4d33c3fb24de89f5c3ed5", size = 38979503 },
+ { url = "https://files.pythonhosted.org/packages/81/06/0a5e5349474e1cbc5757975b21bd4fad0e72ebf138c5592f191646154e06/scipy-1.15.3-cp313-cp313t-win_amd64.whl", hash = "sha256:76ad1fb5f8752eabf0fa02e4cc0336b4e8f021e2d5f061ed37d6d264db35e3ca", size = 40308097 },
+]
+
+[[package]]
+name = "scipy"
+version = "1.16.3"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version >= '3.12' and sys_platform == 'darwin'",
+ "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux'",
+ "python_full_version == '3.11.*' and sys_platform == 'darwin'",
+ "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+dependencies = [
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/0a/ca/d8ace4f98322d01abcd52d381134344bf7b431eba7ed8b42bdea5a3c2ac9/scipy-1.16.3.tar.gz", hash = "sha256:01e87659402762f43bd2fee13370553a17ada367d42e7487800bf2916535aecb", size = 30597883 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/9b/5f/6f37d7439de1455ce9c5a556b8d1db0979f03a796c030bafdf08d35b7bf9/scipy-1.16.3-cp311-cp311-macosx_10_14_x86_64.whl", hash = "sha256:40be6cf99e68b6c4321e9f8782e7d5ff8265af28ef2cd56e9c9b2638fa08ad97", size = 36630881 },
+ { url = "https://files.pythonhosted.org/packages/7c/89/d70e9f628749b7e4db2aa4cd89735502ff3f08f7b9b27d2e799485987cd9/scipy-1.16.3-cp311-cp311-macosx_12_0_arm64.whl", hash = "sha256:8be1ca9170fcb6223cc7c27f4305d680ded114a1567c0bd2bfcbf947d1b17511", size = 28941012 },
+ { url = "https://files.pythonhosted.org/packages/a8/a8/0e7a9a6872a923505dbdf6bb93451edcac120363131c19013044a1e7cb0c/scipy-1.16.3-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:bea0a62734d20d67608660f69dcda23e7f90fb4ca20974ab80b6ed40df87a005", size = 20931935 },
+ { url = "https://files.pythonhosted.org/packages/bd/c7/020fb72bd79ad798e4dbe53938543ecb96b3a9ac3fe274b7189e23e27353/scipy-1.16.3-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:2a207a6ce9c24f1951241f4693ede2d393f59c07abc159b2cb2be980820e01fb", size = 23534466 },
+ { url = "https://files.pythonhosted.org/packages/be/a0/668c4609ce6dbf2f948e167836ccaf897f95fb63fa231c87da7558a374cd/scipy-1.16.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:532fb5ad6a87e9e9cd9c959b106b73145a03f04c7d57ea3e6f6bb60b86ab0876", size = 33593618 },
+ { url = "https://files.pythonhosted.org/packages/ca/6e/8942461cf2636cdae083e3eb72622a7fbbfa5cf559c7d13ab250a5dbdc01/scipy-1.16.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:0151a0749efeaaab78711c78422d413c583b8cdd2011a3c1d6c794938ee9fdb2", size = 35899798 },
+ { url = "https://files.pythonhosted.org/packages/79/e8/d0f33590364cdbd67f28ce79368b373889faa4ee959588beddf6daef9abe/scipy-1.16.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:b7180967113560cca57418a7bc719e30366b47959dd845a93206fbed693c867e", size = 36226154 },
+ { url = "https://files.pythonhosted.org/packages/39/c1/1903de608c0c924a1749c590064e65810f8046e437aba6be365abc4f7557/scipy-1.16.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:deb3841c925eeddb6afc1e4e4a45e418d19ec7b87c5df177695224078e8ec733", size = 38878540 },
+ { url = "https://files.pythonhosted.org/packages/f1/d0/22ec7036ba0b0a35bccb7f25ab407382ed34af0b111475eb301c16f8a2e5/scipy-1.16.3-cp311-cp311-win_amd64.whl", hash = "sha256:53c3844d527213631e886621df5695d35e4f6a75f620dca412bcd292f6b87d78", size = 38722107 },
+ { url = "https://files.pythonhosted.org/packages/7b/60/8a00e5a524bb3bf8898db1650d350f50e6cffb9d7a491c561dc9826c7515/scipy-1.16.3-cp311-cp311-win_arm64.whl", hash = "sha256:9452781bd879b14b6f055b26643703551320aa8d79ae064a71df55c00286a184", size = 25506272 },
+ { url = "https://files.pythonhosted.org/packages/40/41/5bf55c3f386b1643812f3a5674edf74b26184378ef0f3e7c7a09a7e2ca7f/scipy-1.16.3-cp312-cp312-macosx_10_14_x86_64.whl", hash = "sha256:81fc5827606858cf71446a5e98715ba0e11f0dbc83d71c7409d05486592a45d6", size = 36659043 },
+ { url = "https://files.pythonhosted.org/packages/1e/0f/65582071948cfc45d43e9870bf7ca5f0e0684e165d7c9ef4e50d783073eb/scipy-1.16.3-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:c97176013d404c7346bf57874eaac5187d969293bf40497140b0a2b2b7482e07", size = 28898986 },
+ { url = "https://files.pythonhosted.org/packages/96/5e/36bf3f0ac298187d1ceadde9051177d6a4fe4d507e8f59067dc9dd39e650/scipy-1.16.3-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:2b71d93c8a9936046866acebc915e2af2e292b883ed6e2cbe5c34beb094b82d9", size = 20889814 },
+ { url = "https://files.pythonhosted.org/packages/80/35/178d9d0c35394d5d5211bbff7ac4f2986c5488b59506fef9e1de13ea28d3/scipy-1.16.3-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:3d4a07a8e785d80289dfe66b7c27d8634a773020742ec7187b85ccc4b0e7b686", size = 23565795 },
+ { url = "https://files.pythonhosted.org/packages/fa/46/d1146ff536d034d02f83c8afc3c4bab2eddb634624d6529a8512f3afc9da/scipy-1.16.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0553371015692a898e1aa858fed67a3576c34edefa6b7ebdb4e9dde49ce5c203", size = 33349476 },
+ { url = "https://files.pythonhosted.org/packages/79/2e/415119c9ab3e62249e18c2b082c07aff907a273741b3f8160414b0e9193c/scipy-1.16.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:72d1717fd3b5e6ec747327ce9bda32d5463f472c9dce9f54499e81fbd50245a1", size = 35676692 },
+ { url = "https://files.pythonhosted.org/packages/27/82/df26e44da78bf8d2aeaf7566082260cfa15955a5a6e96e6a29935b64132f/scipy-1.16.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:1fb2472e72e24d1530debe6ae078db70fb1605350c88a3d14bc401d6306dbffe", size = 36019345 },
+ { url = "https://files.pythonhosted.org/packages/82/31/006cbb4b648ba379a95c87262c2855cd0d09453e500937f78b30f02fa1cd/scipy-1.16.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:c5192722cffe15f9329a3948c4b1db789fbb1f05c97899187dcf009b283aea70", size = 38678975 },
+ { url = "https://files.pythonhosted.org/packages/c2/7f/acbd28c97e990b421af7d6d6cd416358c9c293fc958b8529e0bd5d2a2a19/scipy-1.16.3-cp312-cp312-win_amd64.whl", hash = "sha256:56edc65510d1331dae01ef9b658d428e33ed48b4f77b1d51caf479a0253f96dc", size = 38555926 },
+ { url = "https://files.pythonhosted.org/packages/ce/69/c5c7807fd007dad4f48e0a5f2153038dc96e8725d3345b9ee31b2b7bed46/scipy-1.16.3-cp312-cp312-win_arm64.whl", hash = "sha256:a8a26c78ef223d3e30920ef759e25625a0ecdd0d60e5a8818b7513c3e5384cf2", size = 25463014 },
+ { url = "https://files.pythonhosted.org/packages/72/f1/57e8327ab1508272029e27eeef34f2302ffc156b69e7e233e906c2a5c379/scipy-1.16.3-cp313-cp313-macosx_10_14_x86_64.whl", hash = "sha256:d2ec56337675e61b312179a1ad124f5f570c00f920cc75e1000025451b88241c", size = 36617856 },
+ { url = "https://files.pythonhosted.org/packages/44/13/7e63cfba8a7452eb756306aa2fd9b37a29a323b672b964b4fdeded9a3f21/scipy-1.16.3-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:16b8bc35a4cc24db80a0ec836a9286d0e31b2503cb2fd7ff7fb0e0374a97081d", size = 28874306 },
+ { url = "https://files.pythonhosted.org/packages/15/65/3a9400efd0228a176e6ec3454b1fa998fbbb5a8defa1672c3f65706987db/scipy-1.16.3-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:5803c5fadd29de0cf27fa08ccbfe7a9e5d741bf63e4ab1085437266f12460ff9", size = 20865371 },
+ { url = "https://files.pythonhosted.org/packages/33/d7/eda09adf009a9fb81827194d4dd02d2e4bc752cef16737cc4ef065234031/scipy-1.16.3-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:b81c27fc41954319a943d43b20e07c40bdcd3ff7cf013f4fb86286faefe546c4", size = 23524877 },
+ { url = "https://files.pythonhosted.org/packages/7d/6b/3f911e1ebc364cb81320223a3422aab7d26c9c7973109a9cd0f27c64c6c0/scipy-1.16.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:0c3b4dd3d9b08dbce0f3440032c52e9e2ab9f96ade2d3943313dfe51a7056959", size = 33342103 },
+ { url = "https://files.pythonhosted.org/packages/21/f6/4bfb5695d8941e5c570a04d9fcd0d36bce7511b7d78e6e75c8f9791f82d0/scipy-1.16.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7dc1360c06535ea6116a2220f760ae572db9f661aba2d88074fe30ec2aa1ff88", size = 35697297 },
+ { url = "https://files.pythonhosted.org/packages/04/e1/6496dadbc80d8d896ff72511ecfe2316b50313bfc3ebf07a3f580f08bd8c/scipy-1.16.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:663b8d66a8748051c3ee9c96465fb417509315b99c71550fda2591d7dd634234", size = 36021756 },
+ { url = "https://files.pythonhosted.org/packages/fe/bd/a8c7799e0136b987bda3e1b23d155bcb31aec68a4a472554df5f0937eef7/scipy-1.16.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:eab43fae33a0c39006a88096cd7b4f4ef545ea0447d250d5ac18202d40b6611d", size = 38696566 },
+ { url = "https://files.pythonhosted.org/packages/cd/01/1204382461fcbfeb05b6161b594f4007e78b6eba9b375382f79153172b4d/scipy-1.16.3-cp313-cp313-win_amd64.whl", hash = "sha256:062246acacbe9f8210de8e751b16fc37458213f124bef161a5a02c7a39284304", size = 38529877 },
+ { url = "https://files.pythonhosted.org/packages/7f/14/9d9fbcaa1260a94f4bb5b64ba9213ceb5d03cd88841fe9fd1ffd47a45b73/scipy-1.16.3-cp313-cp313-win_arm64.whl", hash = "sha256:50a3dbf286dbc7d84f176f9a1574c705f277cb6565069f88f60db9eafdbe3ee2", size = 25455366 },
+ { url = "https://files.pythonhosted.org/packages/e2/a3/9ec205bd49f42d45d77f1730dbad9ccf146244c1647605cf834b3a8c4f36/scipy-1.16.3-cp313-cp313t-macosx_10_14_x86_64.whl", hash = "sha256:fb4b29f4cf8cc5a8d628bc8d8e26d12d7278cd1f219f22698a378c3d67db5e4b", size = 37027931 },
+ { url = "https://files.pythonhosted.org/packages/25/06/ca9fd1f3a4589cbd825b1447e5db3a8ebb969c1eaf22c8579bd286f51b6d/scipy-1.16.3-cp313-cp313t-macosx_12_0_arm64.whl", hash = "sha256:8d09d72dc92742988b0e7750bddb8060b0c7079606c0d24a8cc8e9c9c11f9079", size = 29400081 },
+ { url = "https://files.pythonhosted.org/packages/6a/56/933e68210d92657d93fb0e381683bc0e53a965048d7358ff5fbf9e6a1b17/scipy-1.16.3-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:03192a35e661470197556de24e7cb1330d84b35b94ead65c46ad6f16f6b28f2a", size = 21391244 },
+ { url = "https://files.pythonhosted.org/packages/a8/7e/779845db03dc1418e215726329674b40576879b91814568757ff0014ad65/scipy-1.16.3-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:57d01cb6f85e34f0946b33caa66e892aae072b64b034183f3d87c4025802a119", size = 23929753 },
+ { url = "https://files.pythonhosted.org/packages/4c/4b/f756cf8161d5365dcdef9e5f460ab226c068211030a175d2fc7f3f41ca64/scipy-1.16.3-cp313-cp313t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:96491a6a54e995f00a28a3c3badfff58fd093bf26cd5fb34a2188c8c756a3a2c", size = 33496912 },
+ { url = "https://files.pythonhosted.org/packages/09/b5/222b1e49a58668f23839ca1542a6322bb095ab8d6590d4f71723869a6c2c/scipy-1.16.3-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:cd13e354df9938598af2be05822c323e97132d5e6306b83a3b4ee6724c6e522e", size = 35802371 },
+ { url = "https://files.pythonhosted.org/packages/c1/8d/5964ef68bb31829bde27611f8c9deeac13764589fe74a75390242b64ca44/scipy-1.16.3-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:63d3cdacb8a824a295191a723ee5e4ea7768ca5ca5f2838532d9f2e2b3ce2135", size = 36190477 },
+ { url = "https://files.pythonhosted.org/packages/ab/f2/b31d75cb9b5fa4dd39a0a931ee9b33e7f6f36f23be5ef560bf72e0f92f32/scipy-1.16.3-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:e7efa2681ea410b10dde31a52b18b0154d66f2485328830e45fdf183af5aefc6", size = 38796678 },
+ { url = "https://files.pythonhosted.org/packages/b4/1e/b3723d8ff64ab548c38d87055483714fefe6ee20e0189b62352b5e015bb1/scipy-1.16.3-cp313-cp313t-win_amd64.whl", hash = "sha256:2d1ae2cf0c350e7705168ff2429962a89ad90c2d49d1dd300686d8b2a5af22fc", size = 38640178 },
+ { url = "https://files.pythonhosted.org/packages/8e/f3/d854ff38789aca9b0cc23008d607ced9de4f7ab14fa1ca4329f86b3758ca/scipy-1.16.3-cp313-cp313t-win_arm64.whl", hash = "sha256:0c623a54f7b79dd88ef56da19bc2873afec9673a48f3b85b18e4d402bdd29a5a", size = 25803246 },
+ { url = "https://files.pythonhosted.org/packages/99/f6/99b10fd70f2d864c1e29a28bbcaa0c6340f9d8518396542d9ea3b4aaae15/scipy-1.16.3-cp314-cp314-macosx_10_14_x86_64.whl", hash = "sha256:875555ce62743e1d54f06cdf22c1e0bc47b91130ac40fe5d783b6dfa114beeb6", size = 36606469 },
+ { url = "https://files.pythonhosted.org/packages/4d/74/043b54f2319f48ea940dd025779fa28ee360e6b95acb7cd188fad4391c6b/scipy-1.16.3-cp314-cp314-macosx_12_0_arm64.whl", hash = "sha256:bb61878c18a470021fb515a843dc7a76961a8daceaaaa8bad1332f1bf4b54657", size = 28872043 },
+ { url = "https://files.pythonhosted.org/packages/4d/e1/24b7e50cc1c4ee6ffbcb1f27fe9f4c8b40e7911675f6d2d20955f41c6348/scipy-1.16.3-cp314-cp314-macosx_14_0_arm64.whl", hash = "sha256:f2622206f5559784fa5c4b53a950c3c7c1cf3e84ca1b9c4b6c03f062f289ca26", size = 20862952 },
+ { url = "https://files.pythonhosted.org/packages/dd/3a/3e8c01a4d742b730df368e063787c6808597ccb38636ed821d10b39ca51b/scipy-1.16.3-cp314-cp314-macosx_14_0_x86_64.whl", hash = "sha256:7f68154688c515cdb541a31ef8eb66d8cd1050605be9dcd74199cbd22ac739bc", size = 23508512 },
+ { url = "https://files.pythonhosted.org/packages/1f/60/c45a12b98ad591536bfe5330cb3cfe1850d7570259303563b1721564d458/scipy-1.16.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8b3c820ddb80029fe9f43d61b81d8b488d3ef8ca010d15122b152db77dc94c22", size = 33413639 },
+ { url = "https://files.pythonhosted.org/packages/71/bc/35957d88645476307e4839712642896689df442f3e53b0fa016ecf8a3357/scipy-1.16.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d3837938ae715fc0fe3c39c0202de3a8853aff22ca66781ddc2ade7554b7e2cc", size = 35704729 },
+ { url = "https://files.pythonhosted.org/packages/3b/15/89105e659041b1ca11c386e9995aefacd513a78493656e57789f9d9eab61/scipy-1.16.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:aadd23f98f9cb069b3bd64ddc900c4d277778242e961751f77a8cb5c4b946fb0", size = 36086251 },
+ { url = "https://files.pythonhosted.org/packages/1a/87/c0ea673ac9c6cc50b3da2196d860273bc7389aa69b64efa8493bdd25b093/scipy-1.16.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b7c5f1bda1354d6a19bc6af73a649f8285ca63ac6b52e64e658a5a11d4d69800", size = 38716681 },
+ { url = "https://files.pythonhosted.org/packages/91/06/837893227b043fb9b0d13e4bd7586982d8136cb249ffb3492930dab905b8/scipy-1.16.3-cp314-cp314-win_amd64.whl", hash = "sha256:e5d42a9472e7579e473879a1990327830493a7047506d58d73fc429b84c1d49d", size = 39358423 },
+ { url = "https://files.pythonhosted.org/packages/95/03/28bce0355e4d34a7c034727505a02d19548549e190bedd13a721e35380b7/scipy-1.16.3-cp314-cp314-win_arm64.whl", hash = "sha256:6020470b9d00245926f2d5bb93b119ca0340f0d564eb6fbaad843eaebf9d690f", size = 26135027 },
+ { url = "https://files.pythonhosted.org/packages/b2/6f/69f1e2b682efe9de8fe9f91040f0cd32f13cfccba690512ba4c582b0bc29/scipy-1.16.3-cp314-cp314t-macosx_10_14_x86_64.whl", hash = "sha256:e1d27cbcb4602680a49d787d90664fa4974063ac9d4134813332a8c53dbe667c", size = 37028379 },
+ { url = "https://files.pythonhosted.org/packages/7c/2d/e826f31624a5ebbab1cd93d30fd74349914753076ed0593e1d56a98c4fb4/scipy-1.16.3-cp314-cp314t-macosx_12_0_arm64.whl", hash = "sha256:9b9c9c07b6d56a35777a1b4cc8966118fb16cfd8daf6743867d17d36cfad2d40", size = 29400052 },
+ { url = "https://files.pythonhosted.org/packages/69/27/d24feb80155f41fd1f156bf144e7e049b4e2b9dd06261a242905e3bc7a03/scipy-1.16.3-cp314-cp314t-macosx_14_0_arm64.whl", hash = "sha256:3a4c460301fb2cffb7f88528f30b3127742cff583603aa7dc964a52c463b385d", size = 21391183 },
+ { url = "https://files.pythonhosted.org/packages/f8/d3/1b229e433074c5738a24277eca520a2319aac7465eea7310ea6ae0e98ae2/scipy-1.16.3-cp314-cp314t-macosx_14_0_x86_64.whl", hash = "sha256:f667a4542cc8917af1db06366d3f78a5c8e83badd56409f94d1eac8d8d9133fa", size = 23930174 },
+ { url = "https://files.pythonhosted.org/packages/16/9d/d9e148b0ec680c0f042581a2be79a28a7ab66c0c4946697f9e7553ead337/scipy-1.16.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:f379b54b77a597aa7ee5e697df0d66903e41b9c85a6dd7946159e356319158e8", size = 33497852 },
+ { url = "https://files.pythonhosted.org/packages/2f/22/4e5f7561e4f98b7bea63cf3fd7934bff1e3182e9f1626b089a679914d5c8/scipy-1.16.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4aff59800a3b7f786b70bfd6ab551001cb553244988d7d6b8299cb1ea653b353", size = 35798595 },
+ { url = "https://files.pythonhosted.org/packages/83/42/6644d714c179429fc7196857866f219fef25238319b650bb32dde7bf7a48/scipy-1.16.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:da7763f55885045036fabcebd80144b757d3db06ab0861415d1c3b7c69042146", size = 36186269 },
+ { url = "https://files.pythonhosted.org/packages/ac/70/64b4d7ca92f9cf2e6fc6aaa2eecf80bb9b6b985043a9583f32f8177ea122/scipy-1.16.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:ffa6eea95283b2b8079b821dc11f50a17d0571c92b43e2b5b12764dc5f9b285d", size = 38802779 },
+ { url = "https://files.pythonhosted.org/packages/61/82/8d0e39f62764cce5ffd5284131e109f07cf8955aef9ab8ed4e3aa5e30539/scipy-1.16.3-cp314-cp314t-win_amd64.whl", hash = "sha256:d9f48cafc7ce94cf9b15c6bffdc443a81a27bf7075cf2dcd5c8b40f85d10c4e7", size = 39471128 },
+ { url = "https://files.pythonhosted.org/packages/64/47/a494741db7280eae6dc033510c319e34d42dd41b7ac0c7ead39354d1a2b5/scipy-1.16.3-cp314-cp314t-win_arm64.whl", hash = "sha256:21d9d6b197227a12dcbf9633320a4e34c6b0e51c57268df255a0942983bac562", size = 26464127 },
+]
+
+[[package]]
+name = "sentencepiece"
+version = "0.2.1"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/15/15/2e7a025fc62d764b151ae6d0f2a92f8081755ebe8d4a64099accc6f77ba6/sentencepiece-0.2.1.tar.gz", hash = "sha256:8138cec27c2f2282f4a34d9a016e3374cd40e5c6e9cb335063db66a0a3b71fad", size = 3228515 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/af/31/5b7cccb307b485db1a2372d6d2980b0a65d067f8be5ca943a103b4acd5b3/sentencepiece-0.2.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:e10fa50bdbaa5e2445dbd387979980d391760faf0ec99a09bd7780ff37eaec44", size = 1942557 },
+ { url = "https://files.pythonhosted.org/packages/1f/41/0ac923a8e685ad290c5afc8ae55c5844977b8d75076fcc04302b9a324274/sentencepiece-0.2.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2f27ae6deea72efdb6f361750c92f6c21fd0ad087445082770cc34015213c526", size = 1325384 },
+ { url = "https://files.pythonhosted.org/packages/fc/ef/3751555d67daf9003384978f169d31c775cb5c7baf28633caaf1eb2b2b4d/sentencepiece-0.2.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:60937c959e6f44159fdd9f56fbdd302501f96114a5ba436829496d5f32d8de3f", size = 1253317 },
+ { url = "https://files.pythonhosted.org/packages/46/a5/742c69b7bd144eb32b6e5fd50dbd8abbbc7a95fce2fe16e50156fa400e3b/sentencepiece-0.2.1-cp310-cp310-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d8b1d91545578852f128650b8cce4ec20f93d39b378ff554ebe66290f2dabb92", size = 1316379 },
+ { url = "https://files.pythonhosted.org/packages/c8/89/8deeafbba2871e8fa10f20f17447786f4ac38085925335728d360eaf4cae/sentencepiece-0.2.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:27e38eee653abc3d387862e67bc5c8b6f428cd604e688b85d29170b7e725c26c", size = 1387926 },
+ { url = "https://files.pythonhosted.org/packages/c3/ca/67fe73005f0ab617c6a970b199754e28e524b6873aa7025224fad3cda252/sentencepiece-0.2.1-cp310-cp310-win32.whl", hash = "sha256:251874d720ac7f28024a168501f3c7bb15d1802245f6e66de565f18bbb9b5eaa", size = 999550 },
+ { url = "https://files.pythonhosted.org/packages/6d/33/dc5b54042050d2dda4229c3ce1f862541c99966390b6aa20f54d520d2dc2/sentencepiece-0.2.1-cp310-cp310-win_amd64.whl", hash = "sha256:e52144670738b4b477fade6c2a9b6af71a8d0094514c9853ac9f6fc1fcfabae7", size = 1054613 },
+ { url = "https://files.pythonhosted.org/packages/fa/19/1ea47f46ff97fe04422b78997da1a37cd632f414aae042d27a9009c5b733/sentencepiece-0.2.1-cp310-cp310-win_arm64.whl", hash = "sha256:9076430ac25dfa7147d9d05751dbc66a04bc1aaac371c07f84952979ea59f0d0", size = 1033884 },
+ { url = "https://files.pythonhosted.org/packages/d8/15/46afbab00733d81788b64be430ca1b93011bb9388527958e26cc31832de5/sentencepiece-0.2.1-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:6356d0986b8b8dc351b943150fcd81a1c6e6e4d439772e8584c64230e58ca987", size = 1942560 },
+ { url = "https://files.pythonhosted.org/packages/fa/79/7c01b8ef98a0567e9d84a4e7a910f8e7074fcbf398a5cd76f93f4b9316f9/sentencepiece-0.2.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:8f8ba89a3acb3dc1ae90f65ec1894b0b9596fdb98ab003ff38e058f898b39bc7", size = 1325385 },
+ { url = "https://files.pythonhosted.org/packages/bb/88/2b41e07bd24f33dcf2f18ec3b74247aa4af3526bad8907b8727ea3caba03/sentencepiece-0.2.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:02593eca45440ef39247cee8c47322a34bdcc1d8ae83ad28ba5a899a2cf8d79a", size = 1253319 },
+ { url = "https://files.pythonhosted.org/packages/a0/54/38a1af0c6210a3c6f95aa46d23d6640636d020fba7135cd0d9a84ada05a7/sentencepiece-0.2.1-cp311-cp311-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0a0d15781a171d188b661ae4bde1d998c303f6bd8621498c50c671bd45a4798e", size = 1316162 },
+ { url = "https://files.pythonhosted.org/packages/ef/66/fb191403ade791ad2c3c1e72fe8413e63781b08cfa3aa4c9dfc536d6e795/sentencepiece-0.2.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f5a3e0d9f445ed9d66c0fec47d4b23d12cfc858b407a03c194c1b26c2ac2a63", size = 1387785 },
+ { url = "https://files.pythonhosted.org/packages/a9/2d/3bd9b08e70067b2124518b308db6a84a4f8901cc8a4317e2e4288cdd9b4d/sentencepiece-0.2.1-cp311-cp311-win32.whl", hash = "sha256:6d297a1748d429ba8534eebe5535448d78b8acc32d00a29b49acf28102eeb094", size = 999555 },
+ { url = "https://files.pythonhosted.org/packages/32/b8/f709977f5fda195ae1ea24f24e7c581163b6f142b1005bc3d0bbfe4d7082/sentencepiece-0.2.1-cp311-cp311-win_amd64.whl", hash = "sha256:82d9ead6591015f009cb1be1cb1c015d5e6f04046dbb8c9588b931e869a29728", size = 1054617 },
+ { url = "https://files.pythonhosted.org/packages/7a/40/a1fc23be23067da0f703709797b464e8a30a1c78cc8a687120cd58d4d509/sentencepiece-0.2.1-cp311-cp311-win_arm64.whl", hash = "sha256:39f8651bd10974eafb9834ce30d9bcf5b73e1fc798a7f7d2528f9820ca86e119", size = 1033877 },
+ { url = "https://files.pythonhosted.org/packages/4a/be/32ce495aa1d0e0c323dcb1ba87096037358edee539cac5baf8755a6bd396/sentencepiece-0.2.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:57cae326c8727de58c85977b175af132a7138d84c764635d7e71bbee7e774133", size = 1943152 },
+ { url = "https://files.pythonhosted.org/packages/88/7e/ff23008899a58678e98c6ff592bf4d368eee5a71af96d0df6b38a039dd4f/sentencepiece-0.2.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:56dd39a3c4d6493db3cdca7e8cc68c6b633f0d4195495cbadfcf5af8a22d05a6", size = 1325651 },
+ { url = "https://files.pythonhosted.org/packages/19/84/42eb3ce4796777a1b5d3699dfd4dca85113e68b637f194a6c8d786f16a04/sentencepiece-0.2.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:d9381351182ff9888cc80e41c632e7e274b106f450de33d67a9e8f6043da6f76", size = 1253645 },
+ { url = "https://files.pythonhosted.org/packages/89/fa/d3d5ebcba3cb9e6d3775a096251860c41a6bc53a1b9461151df83fe93255/sentencepiece-0.2.1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:99f955df238021bf11f0fc37cdb54fd5e5b5f7fd30ecc3d93fb48b6815437167", size = 1316273 },
+ { url = "https://files.pythonhosted.org/packages/04/88/14f2f4a2b922d8b39be45bf63d79e6cd3a9b2f248b2fcb98a69b12af12f5/sentencepiece-0.2.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0cdfecef430d985f1c2bcbfff3defd1d95dae876fbd0173376012d2d7d24044b", size = 1387881 },
+ { url = "https://files.pythonhosted.org/packages/fd/b8/903e5ccb77b4ef140605d5d71b4f9e0ad95d456d6184688073ed11712809/sentencepiece-0.2.1-cp312-cp312-win32.whl", hash = "sha256:a483fd29a34c3e34c39ac5556b0a90942bec253d260235729e50976f5dba1068", size = 999540 },
+ { url = "https://files.pythonhosted.org/packages/2d/81/92df5673c067148c2545b1bfe49adfd775bcc3a169a047f5a0e6575ddaca/sentencepiece-0.2.1-cp312-cp312-win_amd64.whl", hash = "sha256:4cdc7c36234fda305e85c32949c5211faaf8dd886096c7cea289ddc12a2d02de", size = 1054671 },
+ { url = "https://files.pythonhosted.org/packages/fe/02/c5e3bc518655d714622bec87d83db9cdba1cd0619a4a04e2109751c4f47f/sentencepiece-0.2.1-cp312-cp312-win_arm64.whl", hash = "sha256:daeb5e9e9fcad012324807856113708614d534f596d5008638eb9b40112cd9e4", size = 1033923 },
+ { url = "https://files.pythonhosted.org/packages/ba/4a/85fbe1706d4d04a7e826b53f327c4b80f849cf1c7b7c5e31a20a97d8f28b/sentencepiece-0.2.1-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:dcd8161eee7b41aae57ded06272905dbd680a0a04b91edd0f64790c796b2f706", size = 1943150 },
+ { url = "https://files.pythonhosted.org/packages/c2/83/4cfb393e287509fc2155480b9d184706ef8d9fa8cbf5505d02a5792bf220/sentencepiece-0.2.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:c6c8f42949f419ff8c7e9960dbadcfbc982d7b5efc2f6748210d3dd53a7de062", size = 1325651 },
+ { url = "https://files.pythonhosted.org/packages/8d/de/5a007fb53b1ab0aafc69d11a5a3dd72a289d5a3e78dcf2c3a3d9b14ffe93/sentencepiece-0.2.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:097f3394e99456e9e4efba1737c3749d7e23563dd1588ce71a3d007f25475fff", size = 1253641 },
+ { url = "https://files.pythonhosted.org/packages/2c/d2/f552be5928105588f4f4d66ee37dd4c61460d8097e62d0e2e0eec41bc61d/sentencepiece-0.2.1-cp313-cp313-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d7b670879c370d350557edabadbad1f6561a9e6968126e6debca4029e5547820", size = 1316271 },
+ { url = "https://files.pythonhosted.org/packages/96/df/0cfe748ace5485be740fed9476dee7877f109da32ed0d280312c94ec259f/sentencepiece-0.2.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c7f0fd2f2693309e6628aeeb2e2faf6edd221134dfccac3308ca0de01f8dab47", size = 1387882 },
+ { url = "https://files.pythonhosted.org/packages/ac/dd/f7774d42a881ced8e1739f393ab1e82ece39fc9abd4779e28050c2e975b5/sentencepiece-0.2.1-cp313-cp313-win32.whl", hash = "sha256:92b3816aa2339355fda2c8c4e021a5de92180b00aaccaf5e2808972e77a4b22f", size = 999541 },
+ { url = "https://files.pythonhosted.org/packages/dd/e9/932b9eae6fd7019548321eee1ab8d5e3b3d1294df9d9a0c9ac517c7b636d/sentencepiece-0.2.1-cp313-cp313-win_amd64.whl", hash = "sha256:10ed3dab2044c47f7a2e7b4969b0c430420cdd45735d78c8f853191fa0e3148b", size = 1054669 },
+ { url = "https://files.pythonhosted.org/packages/c9/3a/76488a00ea7d6931689cda28726a1447d66bf1a4837943489314593d5596/sentencepiece-0.2.1-cp313-cp313-win_arm64.whl", hash = "sha256:ac650534e2251083c5f75dde4ff28896ce7c8904133dc8fef42780f4d5588fcd", size = 1033922 },
+ { url = "https://files.pythonhosted.org/packages/4a/b6/08fe2ce819e02ccb0296f4843e3f195764ce9829cbda61b7513f29b95718/sentencepiece-0.2.1-cp313-cp313t-macosx_10_13_universal2.whl", hash = "sha256:8dd4b477a7b069648d19363aad0cab9bad2f4e83b2d179be668efa672500dc94", size = 1946052 },
+ { url = "https://files.pythonhosted.org/packages/ab/d9/1ea0e740591ff4c6fc2b6eb1d7510d02f3fb885093f19b2f3abd1363b402/sentencepiece-0.2.1-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:0c0f672da370cc490e4c59d89e12289778310a0e71d176c541e4834759e1ae07", size = 1327408 },
+ { url = "https://files.pythonhosted.org/packages/99/7e/1fb26e8a21613f6200e1ab88824d5d203714162cf2883248b517deb500b7/sentencepiece-0.2.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:ad8493bea8432dae8d6830365352350f3b4144415a1d09c4c8cb8d30cf3b6c3c", size = 1254857 },
+ { url = "https://files.pythonhosted.org/packages/bc/85/c72fd1f3c7a6010544d6ae07f8ddb38b5e2a7e33bd4318f87266c0bbafbf/sentencepiece-0.2.1-cp313-cp313t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b81a24733726e3678d2db63619acc5a8dccd074f7aa7a54ecd5ca33ca6d2d596", size = 1315722 },
+ { url = "https://files.pythonhosted.org/packages/4a/e8/661e5bd82a8aa641fd6c1020bd0e890ef73230a2b7215ddf9c8cd8e941c2/sentencepiece-0.2.1-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0a81799d0a68d618e89063fb423c3001a034c893069135ffe51fee439ae474d6", size = 1387452 },
+ { url = "https://files.pythonhosted.org/packages/99/5e/ae66c361023a470afcbc1fbb8da722c72ea678a2fcd9a18f1a12598c7501/sentencepiece-0.2.1-cp313-cp313t-win32.whl", hash = "sha256:89a3ea015517c42c0341d0d962f3e6aaf2cf10d71b1932d475c44ba48d00aa2b", size = 1002501 },
+ { url = "https://files.pythonhosted.org/packages/c1/03/d332828c4ff764e16c1b56c2c8f9a33488bbe796b53fb6b9c4205ddbf167/sentencepiece-0.2.1-cp313-cp313t-win_amd64.whl", hash = "sha256:33f068c9382dc2e7c228eedfd8163b52baa86bb92f50d0488bf2b7da7032e484", size = 1057555 },
+ { url = "https://files.pythonhosted.org/packages/88/14/5aee0bf0864df9bd82bd59e7711362908e4935e3f9cdc1f57246b5d5c9b9/sentencepiece-0.2.1-cp313-cp313t-win_arm64.whl", hash = "sha256:b3616ad246f360e52c85781e47682d31abfb6554c779e42b65333d4b5f44ecc0", size = 1036042 },
+ { url = "https://files.pythonhosted.org/packages/24/9c/89eb8b2052f720a612478baf11c8227dcf1dc28cd4ea4c0c19506b5af2a2/sentencepiece-0.2.1-cp314-cp314-macosx_10_13_universal2.whl", hash = "sha256:5d0350b686c320068702116276cfb26c066dc7e65cfef173980b11bb4d606719", size = 1943147 },
+ { url = "https://files.pythonhosted.org/packages/82/0b/a1432bc87f97c2ace36386ca23e8bd3b91fb40581b5e6148d24b24186419/sentencepiece-0.2.1-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:c7f54a31cde6fa5cb030370566f68152a742f433f8d2be458463d06c208aef33", size = 1325624 },
+ { url = "https://files.pythonhosted.org/packages/ea/99/bbe054ebb5a5039457c590e0a4156ed073fb0fe9ce4f7523404dd5b37463/sentencepiece-0.2.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c83b85ab2d6576607f31df77ff86f28182be4a8de6d175d2c33ca609925f5da1", size = 1253670 },
+ { url = "https://files.pythonhosted.org/packages/19/ad/d5c7075f701bd97971d7c2ac2904f227566f51ef0838dfbdfdccb58cd212/sentencepiece-0.2.1-cp314-cp314-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1855f57db07b51fb51ed6c9c452f570624d2b169b36f0f79ef71a6e6c618cd8b", size = 1316247 },
+ { url = "https://files.pythonhosted.org/packages/fb/03/35fbe5f3d9a7435eebd0b473e09584bd3cc354ce118b960445b060d33781/sentencepiece-0.2.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:01e6912125cb45d3792f530a4d38f8e21bf884d6b4d4ade1b2de5cf7a8d2a52b", size = 1387894 },
+ { url = "https://files.pythonhosted.org/packages/dc/aa/956ef729aafb6c8f9c443104c9636489093bb5c61d6b90fc27aa1a865574/sentencepiece-0.2.1-cp314-cp314-win32.whl", hash = "sha256:c415c9de1447e0a74ae3fdb2e52f967cb544113a3a5ce3a194df185cbc1f962f", size = 1096698 },
+ { url = "https://files.pythonhosted.org/packages/b8/cb/fe400d8836952cc535c81a0ce47dc6875160e5fedb71d2d9ff0e9894c2a6/sentencepiece-0.2.1-cp314-cp314-win_amd64.whl", hash = "sha256:881b2e44b14fc19feade3cbed314be37de639fc415375cefaa5bc81a4be137fd", size = 1155115 },
+ { url = "https://files.pythonhosted.org/packages/32/89/047921cf70f36c7b6b6390876b2399b3633ab73b8d0cb857e5a964238941/sentencepiece-0.2.1-cp314-cp314-win_arm64.whl", hash = "sha256:2005242a16d2dc3ac5fe18aa7667549134d37854823df4c4db244752453b78a8", size = 1133890 },
+ { url = "https://files.pythonhosted.org/packages/a1/11/5b414b9fae6255b5fb1e22e2ed3dc3a72d3a694e5703910e640ac78346bb/sentencepiece-0.2.1-cp314-cp314t-macosx_10_13_universal2.whl", hash = "sha256:a19adcec27c524cb7069a1c741060add95f942d1cbf7ad0d104dffa0a7d28a2b", size = 1946081 },
+ { url = "https://files.pythonhosted.org/packages/77/eb/7a5682bb25824db8545f8e5662e7f3e32d72a508fdce086029d89695106b/sentencepiece-0.2.1-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:e37e4b4c4a11662b5db521def4e44d4d30ae69a1743241412a93ae40fdcab4bb", size = 1327406 },
+ { url = "https://files.pythonhosted.org/packages/03/b0/811dae8fb9f2784e138785d481469788f2e0d0c109c5737372454415f55f/sentencepiece-0.2.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:477c81505db072b3ab627e7eab972ea1025331bd3a92bacbf798df2b75ea86ec", size = 1254846 },
+ { url = "https://files.pythonhosted.org/packages/ef/23/195b2e7ec85ebb6a547969f60b723c7aca5a75800ece6cc3f41da872d14e/sentencepiece-0.2.1-cp314-cp314t-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:010f025a544ef770bb395091d57cb94deb9652d8972e0d09f71d85d5a0816c8c", size = 1315721 },
+ { url = "https://files.pythonhosted.org/packages/7e/aa/553dbe4178b5f23eb28e59393dddd64186178b56b81d9b8d5c3ff1c28395/sentencepiece-0.2.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:733e59ff1794d26db706cd41fc2d7ca5f6c64a820709cb801dc0ea31780d64ab", size = 1387458 },
+ { url = "https://files.pythonhosted.org/packages/66/7c/08ff0012507297a4dd74a5420fdc0eb9e3e80f4e88cab1538d7f28db303d/sentencepiece-0.2.1-cp314-cp314t-win32.whl", hash = "sha256:d3233770f78e637dc8b1fda2cd7c3b99ec77e7505041934188a4e7fe751de3b0", size = 1099765 },
+ { url = "https://files.pythonhosted.org/packages/91/d5/2a69e1ce15881beb9ddfc7e3f998322f5cedcd5e4d244cb74dade9441663/sentencepiece-0.2.1-cp314-cp314t-win_amd64.whl", hash = "sha256:5e4366c97b68218fd30ea72d70c525e6e78a6c0a88650f57ac4c43c63b234a9d", size = 1157807 },
+ { url = "https://files.pythonhosted.org/packages/f3/16/54f611fcfc2d1c46cbe3ec4169780b2cfa7cf63708ef2b71611136db7513/sentencepiece-0.2.1-cp314-cp314t-win_arm64.whl", hash = "sha256:105e36e75cbac1292642045458e8da677b2342dcd33df503e640f0b457cb6751", size = 1136264 },
+]
+
+[[package]]
+name = "sentry-sdk"
+version = "2.48.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "certifi" },
+ { name = "urllib3" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/40/f0/0e9dc590513d5e742d7799e2038df3a05167cba084c6ca4f3cdd75b55164/sentry_sdk-2.48.0.tar.gz", hash = "sha256:5213190977ff7fdff8a58b722fb807f8d5524a80488626ebeda1b5676c0c1473", size = 384828 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/4d/19/8d77f9992e5cbfcaa9133c3bf63b4fbbb051248802e1e803fed5c552fbb2/sentry_sdk-2.48.0-py2.py3-none-any.whl", hash = "sha256:6b12ac256769d41825d9b7518444e57fa35b5642df4c7c5e322af4d2c8721172", size = 414555 },
+]
+
+[[package]]
+name = "setuptools"
+version = "80.9.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/18/5d/3bf57dcd21979b887f014ea83c24ae194cfcd12b9e0fda66b957c69d1fca/setuptools-80.9.0.tar.gz", hash = "sha256:f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c", size = 1319958 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/a3/dc/17031897dae0efacfea57dfd3a82fdd2a2aeb58e0ff71b77b87e44edc772/setuptools-80.9.0-py3-none-any.whl", hash = "sha256:062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922", size = 1201486 },
+]
+
+[[package]]
+name = "shellingham"
+version = "1.5.4"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/58/15/8b3609fd3830ef7b27b655beb4b4e9c62313a4e8da8c676e142cc210d58e/shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de", size = 10310 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/e0/f9/0595336914c5619e5f28a1fb793285925a8cd4b432c9da0a987836c7f822/shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686", size = 9755 },
+]
+
+[[package]]
+name = "six"
+version = "1.17.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/94/e7/b2c673351809dca68a0e064b6af791aa332cf192da575fd474ed7d6f16a2/six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81", size = 34031 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050 },
+]
+
+[[package]]
+name = "smmap"
+version = "5.0.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/44/cd/a040c4b3119bbe532e5b0732286f805445375489fceaec1f48306068ee3b/smmap-5.0.2.tar.gz", hash = "sha256:26ea65a03958fa0c8a1c7e8c7a58fdc77221b8910f6be2131affade476898ad5", size = 22329 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/04/be/d09147ad1ec7934636ad912901c5fd7667e1c858e19d355237db0d0cd5e4/smmap-5.0.2-py3-none-any.whl", hash = "sha256:b30115f0def7d7531d22a0fb6502488d879e75b260a9db4d0819cfb25403af5e", size = 24303 },
+]
+
+[[package]]
+name = "sympy"
+version = "1.14.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "mpmath" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/83/d3/803453b36afefb7c2bb238361cd4ae6125a569b4db67cd9e79846ba2d68c/sympy-1.14.0.tar.gz", hash = "sha256:d3d3fe8df1e5a0b42f0e7bdf50541697dbe7d23746e894990c030e2b05e72517", size = 7793921 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/a2/09/77d55d46fd61b4a135c444fc97158ef34a095e5681d0a6c10b75bf356191/sympy-1.14.0-py3-none-any.whl", hash = "sha256:e091cc3e99d2141a0ba2847328f5479b05d94a6635cb96148ccb3f34671bd8f5", size = 6299353 },
+]
+
+[[package]]
+name = "tifffile"
+version = "2025.5.10"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version < '3.11' and sys_platform == 'darwin'",
+ "python_full_version < '3.11' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version < '3.11' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+dependencies = [
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/44/d0/18fed0fc0916578a4463f775b0fbd9c5fed2392152d039df2fb533bfdd5d/tifffile-2025.5.10.tar.gz", hash = "sha256:018335d34283aa3fd8c263bae5c3c2b661ebc45548fde31504016fcae7bf1103", size = 365290 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/5d/06/bd0a6097da704a7a7c34a94cfd771c3ea3c2f405dd214e790d22c93f6be1/tifffile-2025.5.10-py3-none-any.whl", hash = "sha256:e37147123c0542d67bc37ba5cdd67e12ea6fbe6e86c52bee037a9eb6a064e5ad", size = 226533 },
+]
+
+[[package]]
+name = "tifffile"
+version = "2025.12.20"
+source = { registry = "https://pypi.org/simple" }
+resolution-markers = [
+ "python_full_version >= '3.12' and sys_platform == 'darwin'",
+ "python_full_version >= '3.12' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version >= '3.12' and sys_platform != 'darwin' and sys_platform != 'linux'",
+ "python_full_version == '3.11.*' and sys_platform == 'darwin'",
+ "python_full_version == '3.11.*' and platform_machine == 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and platform_machine != 'aarch64' and sys_platform == 'linux'",
+ "python_full_version == '3.11.*' and sys_platform != 'darwin' and sys_platform != 'linux'",
+]
+dependencies = [
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/f8/a6/85e8ecfd7cb4167f8bd17136b2d42cba296fbc08a247bba70d5747e2046a/tifffile-2025.12.20.tar.gz", hash = "sha256:cb8a4fee327d15b3e3eeac80bbdd8a53b323c80473330bcfb99418ee4c1c827f", size = 373364 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/1b/fe/e59859aa1134fac065d36864752daf13215c98b379cb5d93f954dc0ec830/tifffile-2025.12.20-py3-none-any.whl", hash = "sha256:bc0345a20675149353cfcb3f1c48d0a3654231ee26bd46beebaab4d2168feeb6", size = 232031 },
+]
+
+[[package]]
+name = "tokenizers"
+version = "0.22.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "huggingface-hub" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/1c/46/fb6854cec3278fbfa4a75b50232c77622bc517ac886156e6afbfa4d8fc6e/tokenizers-0.22.1.tar.gz", hash = "sha256:61de6522785310a309b3407bac22d99c4db5dba349935e99e4d15ea2226af2d9", size = 363123 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/bf/33/f4b2d94ada7ab297328fc671fed209368ddb82f965ec2224eb1892674c3a/tokenizers-0.22.1-cp39-abi3-macosx_10_12_x86_64.whl", hash = "sha256:59fdb013df17455e5f950b4b834a7b3ee2e0271e6378ccb33aa74d178b513c73", size = 3069318 },
+ { url = "https://files.pythonhosted.org/packages/1c/58/2aa8c874d02b974990e89ff95826a4852a8b2a273c7d1b4411cdd45a4565/tokenizers-0.22.1-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:8d4e484f7b0827021ac5f9f71d4794aaef62b979ab7608593da22b1d2e3c4edc", size = 2926478 },
+ { url = "https://files.pythonhosted.org/packages/1e/3b/55e64befa1e7bfea963cf4b787b2cea1011362c4193f5477047532ce127e/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:19d2962dd28bc67c1f205ab180578a78eef89ac60ca7ef7cbe9635a46a56422a", size = 3256994 },
+ { url = "https://files.pythonhosted.org/packages/71/0b/fbfecf42f67d9b7b80fde4aabb2b3110a97fac6585c9470b5bff103a80cb/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:38201f15cdb1f8a6843e6563e6e79f4abd053394992b9bbdf5213ea3469b4ae7", size = 3153141 },
+ { url = "https://files.pythonhosted.org/packages/17/a9/b38f4e74e0817af8f8ef925507c63c6ae8171e3c4cb2d5d4624bf58fca69/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d1cbe5454c9a15df1b3443c726063d930c16f047a3cc724b9e6e1a91140e5a21", size = 3508049 },
+ { url = "https://files.pythonhosted.org/packages/d2/48/dd2b3dac46bb9134a88e35d72e1aa4869579eacc1a27238f1577270773ff/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e7d094ae6312d69cc2a872b54b91b309f4f6fbce871ef28eb27b52a98e4d0214", size = 3710730 },
+ { url = "https://files.pythonhosted.org/packages/93/0e/ccabc8d16ae4ba84a55d41345207c1e2ea88784651a5a487547d80851398/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:afd7594a56656ace95cdd6df4cca2e4059d294c5cfb1679c57824b605556cb2f", size = 3412560 },
+ { url = "https://files.pythonhosted.org/packages/d0/c6/dc3a0db5a6766416c32c034286d7c2d406da1f498e4de04ab1b8959edd00/tokenizers-0.22.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e2ef6063d7a84994129732b47e7915e8710f27f99f3a3260b8a38fc7ccd083f4", size = 3250221 },
+ { url = "https://files.pythonhosted.org/packages/d7/a6/2c8486eef79671601ff57b093889a345dd3d576713ef047776015dc66de7/tokenizers-0.22.1-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:ba0a64f450b9ef412c98f6bcd2a50c6df6e2443b560024a09fa6a03189726879", size = 9345569 },
+ { url = "https://files.pythonhosted.org/packages/6b/16/32ce667f14c35537f5f605fe9bea3e415ea1b0a646389d2295ec348d5657/tokenizers-0.22.1-cp39-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:331d6d149fa9c7d632cde4490fb8bbb12337fa3a0232e77892be656464f4b446", size = 9271599 },
+ { url = "https://files.pythonhosted.org/packages/51/7c/a5f7898a3f6baa3fc2685c705e04c98c1094c523051c805cdd9306b8f87e/tokenizers-0.22.1-cp39-abi3-musllinux_1_2_i686.whl", hash = "sha256:607989f2ea68a46cb1dfbaf3e3aabdf3f21d8748312dbeb6263d1b3b66c5010a", size = 9533862 },
+ { url = "https://files.pythonhosted.org/packages/36/65/7e75caea90bc73c1dd8d40438adf1a7bc26af3b8d0a6705ea190462506e1/tokenizers-0.22.1-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:a0f307d490295717726598ef6fa4f24af9d484809223bbc253b201c740a06390", size = 9681250 },
+ { url = "https://files.pythonhosted.org/packages/30/2c/959dddef581b46e6209da82df3b78471e96260e2bc463f89d23b1bf0e52a/tokenizers-0.22.1-cp39-abi3-win32.whl", hash = "sha256:b5120eed1442765cd90b903bb6cfef781fd8fe64e34ccaecbae4c619b7b12a82", size = 2472003 },
+ { url = "https://files.pythonhosted.org/packages/b3/46/e33a8c93907b631a99377ef4c5f817ab453d0b34f93529421f42ff559671/tokenizers-0.22.1-cp39-abi3-win_amd64.whl", hash = "sha256:65fd6e3fb11ca1e78a6a93602490f134d1fdeb13bcef99389d5102ea318ed138", size = 2674684 },
+]
+
+[[package]]
+name = "tomli"
+version = "2.3.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/52/ed/3f73f72945444548f33eba9a87fc7a6e969915e7b1acc8260b30e1f76a2f/tomli-2.3.0.tar.gz", hash = "sha256:64be704a875d2a59753d80ee8a533c3fe183e3f06807ff7dc2232938ccb01549", size = 17392 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/b3/2e/299f62b401438d5fe1624119c723f5d877acc86a4c2492da405626665f12/tomli-2.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:88bd15eb972f3664f5ed4b57c1634a97153b4bac4479dcb6a495f41921eb7f45", size = 153236 },
+ { url = "https://files.pythonhosted.org/packages/86/7f/d8fffe6a7aefdb61bced88fcb5e280cfd71e08939da5894161bd71bea022/tomli-2.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:883b1c0d6398a6a9d29b508c331fa56adbcdff647f6ace4dfca0f50e90dfd0ba", size = 148084 },
+ { url = "https://files.pythonhosted.org/packages/47/5c/24935fb6a2ee63e86d80e4d3b58b222dafaf438c416752c8b58537c8b89a/tomli-2.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d1381caf13ab9f300e30dd8feadb3de072aeb86f1d34a8569453ff32a7dea4bf", size = 234832 },
+ { url = "https://files.pythonhosted.org/packages/89/da/75dfd804fc11e6612846758a23f13271b76d577e299592b4371a4ca4cd09/tomli-2.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0e285d2649b78c0d9027570d4da3425bdb49830a6156121360b3f8511ea3441", size = 242052 },
+ { url = "https://files.pythonhosted.org/packages/70/8c/f48ac899f7b3ca7eb13af73bacbc93aec37f9c954df3c08ad96991c8c373/tomli-2.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0a154a9ae14bfcf5d8917a59b51ffd5a3ac1fd149b71b47a3a104ca4edcfa845", size = 239555 },
+ { url = "https://files.pythonhosted.org/packages/ba/28/72f8afd73f1d0e7829bfc093f4cb98ce0a40ffc0cc997009ee1ed94ba705/tomli-2.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:74bf8464ff93e413514fefd2be591c3b0b23231a77f901db1eb30d6f712fc42c", size = 245128 },
+ { url = "https://files.pythonhosted.org/packages/b6/eb/a7679c8ac85208706d27436e8d421dfa39d4c914dcf5fa8083a9305f58d9/tomli-2.3.0-cp311-cp311-win32.whl", hash = "sha256:00b5f5d95bbfc7d12f91ad8c593a1659b6387b43f054104cda404be6bda62456", size = 96445 },
+ { url = "https://files.pythonhosted.org/packages/0a/fe/3d3420c4cb1ad9cb462fb52967080575f15898da97e21cb6f1361d505383/tomli-2.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:4dc4ce8483a5d429ab602f111a93a6ab1ed425eae3122032db7e9acf449451be", size = 107165 },
+ { url = "https://files.pythonhosted.org/packages/ff/b7/40f36368fcabc518bb11c8f06379a0fd631985046c038aca08c6d6a43c6e/tomli-2.3.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d7d86942e56ded512a594786a5ba0a5e521d02529b3826e7761a05138341a2ac", size = 154891 },
+ { url = "https://files.pythonhosted.org/packages/f9/3f/d9dd692199e3b3aab2e4e4dd948abd0f790d9ded8cd10cbaae276a898434/tomli-2.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:73ee0b47d4dad1c5e996e3cd33b8a76a50167ae5f96a2607cbe8cc773506ab22", size = 148796 },
+ { url = "https://files.pythonhosted.org/packages/60/83/59bff4996c2cf9f9387a0f5a3394629c7efa5ef16142076a23a90f1955fa/tomli-2.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:792262b94d5d0a466afb5bc63c7daa9d75520110971ee269152083270998316f", size = 242121 },
+ { url = "https://files.pythonhosted.org/packages/45/e5/7c5119ff39de8693d6baab6c0b6dcb556d192c165596e9fc231ea1052041/tomli-2.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f195fe57ecceac95a66a75ac24d9d5fbc98ef0962e09b2eddec5d39375aae52", size = 250070 },
+ { url = "https://files.pythonhosted.org/packages/45/12/ad5126d3a278f27e6701abde51d342aa78d06e27ce2bb596a01f7709a5a2/tomli-2.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e31d432427dcbf4d86958c184b9bfd1e96b5b71f8eb17e6d02531f434fd335b8", size = 245859 },
+ { url = "https://files.pythonhosted.org/packages/fb/a1/4d6865da6a71c603cfe6ad0e6556c73c76548557a8d658f9e3b142df245f/tomli-2.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b0882799624980785240ab732537fcfc372601015c00f7fc367c55308c186f6", size = 250296 },
+ { url = "https://files.pythonhosted.org/packages/a0/b7/a7a7042715d55c9ba6e8b196d65d2cb662578b4d8cd17d882d45322b0d78/tomli-2.3.0-cp312-cp312-win32.whl", hash = "sha256:ff72b71b5d10d22ecb084d345fc26f42b5143c5533db5e2eaba7d2d335358876", size = 97124 },
+ { url = "https://files.pythonhosted.org/packages/06/1e/f22f100db15a68b520664eb3328fb0ae4e90530887928558112c8d1f4515/tomli-2.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:1cb4ed918939151a03f33d4242ccd0aa5f11b3547d0cf30f7c74a408a5b99878", size = 107698 },
+ { url = "https://files.pythonhosted.org/packages/89/48/06ee6eabe4fdd9ecd48bf488f4ac783844fd777f547b8d1b61c11939974e/tomli-2.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5192f562738228945d7b13d4930baffda67b69425a7f0da96d360b0a3888136b", size = 154819 },
+ { url = "https://files.pythonhosted.org/packages/f1/01/88793757d54d8937015c75dcdfb673c65471945f6be98e6a0410fba167ed/tomli-2.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:be71c93a63d738597996be9528f4abe628d1adf5e6eb11607bc8fe1a510b5dae", size = 148766 },
+ { url = "https://files.pythonhosted.org/packages/42/17/5e2c956f0144b812e7e107f94f1cc54af734eb17b5191c0bbfb72de5e93e/tomli-2.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c4665508bcbac83a31ff8ab08f424b665200c0e1e645d2bd9ab3d3e557b6185b", size = 240771 },
+ { url = "https://files.pythonhosted.org/packages/d5/f4/0fbd014909748706c01d16824eadb0307115f9562a15cbb012cd9b3512c5/tomli-2.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4021923f97266babc6ccab9f5068642a0095faa0a51a246a6a02fccbb3514eaf", size = 248586 },
+ { url = "https://files.pythonhosted.org/packages/30/77/fed85e114bde5e81ecf9bc5da0cc69f2914b38f4708c80ae67d0c10180c5/tomli-2.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4ea38c40145a357d513bffad0ed869f13c1773716cf71ccaa83b0fa0cc4e42f", size = 244792 },
+ { url = "https://files.pythonhosted.org/packages/55/92/afed3d497f7c186dc71e6ee6d4fcb0acfa5f7d0a1a2878f8beae379ae0cc/tomli-2.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ad805ea85eda330dbad64c7ea7a4556259665bdf9d2672f5dccc740eb9d3ca05", size = 248909 },
+ { url = "https://files.pythonhosted.org/packages/f8/84/ef50c51b5a9472e7265ce1ffc7f24cd4023d289e109f669bdb1553f6a7c2/tomli-2.3.0-cp313-cp313-win32.whl", hash = "sha256:97d5eec30149fd3294270e889b4234023f2c69747e555a27bd708828353ab606", size = 96946 },
+ { url = "https://files.pythonhosted.org/packages/b2/b7/718cd1da0884f281f95ccfa3a6cc572d30053cba64603f79d431d3c9b61b/tomli-2.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:0c95ca56fbe89e065c6ead5b593ee64b84a26fca063b5d71a1122bf26e533999", size = 107705 },
+ { url = "https://files.pythonhosted.org/packages/19/94/aeafa14a52e16163008060506fcb6aa1949d13548d13752171a755c65611/tomli-2.3.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:cebc6fe843e0733ee827a282aca4999b596241195f43b4cc371d64fc6639da9e", size = 154244 },
+ { url = "https://files.pythonhosted.org/packages/db/e4/1e58409aa78eefa47ccd19779fc6f36787edbe7d4cd330eeeedb33a4515b/tomli-2.3.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:4c2ef0244c75aba9355561272009d934953817c49f47d768070c3c94355c2aa3", size = 148637 },
+ { url = "https://files.pythonhosted.org/packages/26/b6/d1eccb62f665e44359226811064596dd6a366ea1f985839c566cd61525ae/tomli-2.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c22a8bf253bacc0cf11f35ad9808b6cb75ada2631c2d97c971122583b129afbc", size = 241925 },
+ { url = "https://files.pythonhosted.org/packages/70/91/7cdab9a03e6d3d2bb11beae108da5bdc1c34bdeb06e21163482544ddcc90/tomli-2.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0eea8cc5c5e9f89c9b90c4896a8deefc74f518db5927d0e0e8d4a80953d774d0", size = 249045 },
+ { url = "https://files.pythonhosted.org/packages/15/1b/8c26874ed1f6e4f1fcfeb868db8a794cbe9f227299402db58cfcc858766c/tomli-2.3.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b74a0e59ec5d15127acdabd75ea17726ac4c5178ae51b85bfe39c4f8a278e879", size = 245835 },
+ { url = "https://files.pythonhosted.org/packages/fd/42/8e3c6a9a4b1a1360c1a2a39f0b972cef2cc9ebd56025168c4137192a9321/tomli-2.3.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b5870b50c9db823c595983571d1296a6ff3e1b88f734a4c8f6fc6188397de005", size = 253109 },
+ { url = "https://files.pythonhosted.org/packages/22/0c/b4da635000a71b5f80130937eeac12e686eefb376b8dee113b4a582bba42/tomli-2.3.0-cp314-cp314-win32.whl", hash = "sha256:feb0dacc61170ed7ab602d3d972a58f14ee3ee60494292d384649a3dc38ef463", size = 97930 },
+ { url = "https://files.pythonhosted.org/packages/b9/74/cb1abc870a418ae99cd5c9547d6bce30701a954e0e721821df483ef7223c/tomli-2.3.0-cp314-cp314-win_amd64.whl", hash = "sha256:b273fcbd7fc64dc3600c098e39136522650c49bca95df2d11cf3b626422392c8", size = 107964 },
+ { url = "https://files.pythonhosted.org/packages/54/78/5c46fff6432a712af9f792944f4fcd7067d8823157949f4e40c56b8b3c83/tomli-2.3.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:940d56ee0410fa17ee1f12b817b37a4d4e4dc4d27340863cc67236c74f582e77", size = 163065 },
+ { url = "https://files.pythonhosted.org/packages/39/67/f85d9bd23182f45eca8939cd2bc7050e1f90c41f4a2ecbbd5963a1d1c486/tomli-2.3.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f85209946d1fe94416debbb88d00eb92ce9cd5266775424ff81bc959e001acaf", size = 159088 },
+ { url = "https://files.pythonhosted.org/packages/26/5a/4b546a0405b9cc0659b399f12b6adb750757baf04250b148d3c5059fc4eb/tomli-2.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a56212bdcce682e56b0aaf79e869ba5d15a6163f88d5451cbde388d48b13f530", size = 268193 },
+ { url = "https://files.pythonhosted.org/packages/42/4f/2c12a72ae22cf7b59a7fe75b3465b7aba40ea9145d026ba41cb382075b0e/tomli-2.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c5f3ffd1e098dfc032d4d3af5c0ac64f6d286d98bc148698356847b80fa4de1b", size = 275488 },
+ { url = "https://files.pythonhosted.org/packages/92/04/a038d65dbe160c3aa5a624e93ad98111090f6804027d474ba9c37c8ae186/tomli-2.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e01decd096b1530d97d5d85cb4dff4af2d8347bd35686654a004f8dea20fc67", size = 272669 },
+ { url = "https://files.pythonhosted.org/packages/be/2f/8b7c60a9d1612a7cbc39ffcca4f21a73bf368a80fc25bccf8253e2563267/tomli-2.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8a35dd0e643bb2610f156cca8db95d213a90015c11fee76c946aa62b7ae7e02f", size = 279709 },
+ { url = "https://files.pythonhosted.org/packages/7e/46/cc36c679f09f27ded940281c38607716c86cf8ba4a518d524e349c8b4874/tomli-2.3.0-cp314-cp314t-win32.whl", hash = "sha256:a1f7f282fe248311650081faafa5f4732bdbfef5d45fe3f2e702fbc6f2d496e0", size = 107563 },
+ { url = "https://files.pythonhosted.org/packages/84/ff/426ca8683cf7b753614480484f6437f568fd2fda2edbdf57a2d3d8b27a0b/tomli-2.3.0-cp314-cp314t-win_amd64.whl", hash = "sha256:70a251f8d4ba2d9ac2542eecf008b3c8a9fc5c3f9f02c56a9d7952612be2fdba", size = 119756 },
+ { url = "https://files.pythonhosted.org/packages/77/b8/0135fadc89e73be292b473cb820b4f5a08197779206b33191e801feeae40/tomli-2.3.0-py3-none-any.whl", hash = "sha256:e95b1af3c5b07d9e643909b5abbec77cd9f1217e6d0bca72b0234736b9fb1f1b", size = 14408 },
+]
+
+[[package]]
+name = "torch"
+version = "2.9.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "filelock" },
+ { name = "fsspec" },
+ { name = "jinja2" },
+ { name = "networkx", version = "3.4.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "networkx", version = "3.6.1", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "nvidia-cublas-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-cuda-cupti-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-cuda-nvrtc-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-cuda-runtime-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-cudnn-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-cufft-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-cufile-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-curand-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-cusolver-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-cusparse-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-cusparselt-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-nccl-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-nvjitlink-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-nvshmem-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "nvidia-nvtx-cu12", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "setuptools", marker = "python_full_version >= '3.12'" },
+ { name = "sympy" },
+ { name = "triton", marker = "platform_machine == 'x86_64' and sys_platform == 'linux'" },
+ { name = "typing-extensions" },
+]
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/5f/56/9577683b23072075ed2e40d725c52c2019d71a972fab8e083763da8e707e/torch-2.9.1-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:1cc208435f6c379f9b8fdfd5ceb5be1e3b72a6bdf1cb46c0d2812aa73472db9e", size = 104207681 },
+ { url = "https://files.pythonhosted.org/packages/38/45/be5a74f221df8f4b609b78ff79dc789b0cc9017624544ac4dd1c03973150/torch-2.9.1-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:9fd35c68b3679378c11f5eb73220fdcb4e6f4592295277fbb657d31fd053237c", size = 899794036 },
+ { url = "https://files.pythonhosted.org/packages/67/95/a581e8a382596b69385a44bab2733f1273d45c842f5d4a504c0edc3133b6/torch-2.9.1-cp310-cp310-win_amd64.whl", hash = "sha256:2af70e3be4a13becba4655d6cc07dcfec7ae844db6ac38d6c1dafeb245d17d65", size = 110969861 },
+ { url = "https://files.pythonhosted.org/packages/ad/51/1756dc128d2bf6ea4e0a915cb89ea5e730315ff33d60c1ff56fd626ba3eb/torch-2.9.1-cp310-none-macosx_11_0_arm64.whl", hash = "sha256:a83b0e84cc375e3318a808d032510dde99d696a85fe9473fc8575612b63ae951", size = 74452222 },
+ { url = "https://files.pythonhosted.org/packages/15/db/c064112ac0089af3d2f7a2b5bfbabf4aa407a78b74f87889e524b91c5402/torch-2.9.1-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:62b3fd888277946918cba4478cf849303da5359f0fb4e3bfb86b0533ba2eaf8d", size = 104220430 },
+ { url = "https://files.pythonhosted.org/packages/56/be/76eaa36c9cd032d3b01b001e2c5a05943df75f26211f68fae79e62f87734/torch-2.9.1-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:d033ff0ac3f5400df862a51bdde9bad83561f3739ea0046e68f5401ebfa67c1b", size = 899821446 },
+ { url = "https://files.pythonhosted.org/packages/47/cc/7a2949e38dfe3244c4df21f0e1c27bce8aedd6c604a587dd44fc21017cb4/torch-2.9.1-cp311-cp311-win_amd64.whl", hash = "sha256:0d06b30a9207b7c3516a9e0102114024755a07045f0c1d2f2a56b1819ac06bcb", size = 110973074 },
+ { url = "https://files.pythonhosted.org/packages/1e/ce/7d251155a783fb2c1bb6837b2b7023c622a2070a0a72726ca1df47e7ea34/torch-2.9.1-cp311-none-macosx_11_0_arm64.whl", hash = "sha256:52347912d868653e1528b47cafaf79b285b98be3f4f35d5955389b1b95224475", size = 74463887 },
+ { url = "https://files.pythonhosted.org/packages/0f/27/07c645c7673e73e53ded71705045d6cb5bae94c4b021b03aa8d03eee90ab/torch-2.9.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:da5f6f4d7f4940a173e5572791af238cb0b9e21b1aab592bd8b26da4c99f1cd6", size = 104126592 },
+ { url = "https://files.pythonhosted.org/packages/19/17/e377a460603132b00760511299fceba4102bd95db1a0ee788da21298ccff/torch-2.9.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:27331cd902fb4322252657f3902adf1c4f6acad9dcad81d8df3ae14c7c4f07c4", size = 899742281 },
+ { url = "https://files.pythonhosted.org/packages/b1/1a/64f5769025db846a82567fa5b7d21dba4558a7234ee631712ee4771c436c/torch-2.9.1-cp312-cp312-win_amd64.whl", hash = "sha256:81a285002d7b8cfd3fdf1b98aa8df138d41f1a8334fd9ea37511517cedf43083", size = 110940568 },
+ { url = "https://files.pythonhosted.org/packages/6e/ab/07739fd776618e5882661d04c43f5b5586323e2f6a2d7d84aac20d8f20bd/torch-2.9.1-cp312-none-macosx_11_0_arm64.whl", hash = "sha256:c0d25d1d8e531b8343bea0ed811d5d528958f1dcbd37e7245bc686273177ad7e", size = 74479191 },
+ { url = "https://files.pythonhosted.org/packages/20/60/8fc5e828d050bddfab469b3fe78e5ab9a7e53dda9c3bdc6a43d17ce99e63/torch-2.9.1-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:c29455d2b910b98738131990394da3e50eea8291dfeb4b12de71ecf1fdeb21cb", size = 104135743 },
+ { url = "https://files.pythonhosted.org/packages/f2/b7/6d3f80e6918213babddb2a37b46dbb14c15b14c5f473e347869a51f40e1f/torch-2.9.1-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:524de44cd13931208ba2c4bde9ec7741fd4ae6bfd06409a604fc32f6520c2bc9", size = 899749493 },
+ { url = "https://files.pythonhosted.org/packages/a6/47/c7843d69d6de8938c1cbb1eba426b1d48ddf375f101473d3e31a5fc52b74/torch-2.9.1-cp313-cp313-win_amd64.whl", hash = "sha256:545844cc16b3f91e08ce3b40e9c2d77012dd33a48d505aed34b7740ed627a1b2", size = 110944162 },
+ { url = "https://files.pythonhosted.org/packages/28/0e/2a37247957e72c12151b33a01e4df651d9d155dd74d8cfcbfad15a79b44a/torch-2.9.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:5be4bf7496f1e3ffb1dd44b672adb1ac3f081f204c5ca81eba6442f5f634df8e", size = 74830751 },
+ { url = "https://files.pythonhosted.org/packages/4b/f7/7a18745edcd7b9ca2381aa03353647bca8aace91683c4975f19ac233809d/torch-2.9.1-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:30a3e170a84894f3652434b56d59a64a2c11366b0ed5776fab33c2439396bf9a", size = 104142929 },
+ { url = "https://files.pythonhosted.org/packages/f4/dd/f1c0d879f2863ef209e18823a988dc7a1bf40470750e3ebe927efdb9407f/torch-2.9.1-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:8301a7b431e51764629208d0edaa4f9e4c33e6df0f2f90b90e261d623df6a4e2", size = 899748978 },
+ { url = "https://files.pythonhosted.org/packages/1f/9f/6986b83a53b4d043e36f3f898b798ab51f7f20fdf1a9b01a2720f445043d/torch-2.9.1-cp313-cp313t-win_amd64.whl", hash = "sha256:2e1c42c0ae92bf803a4b2409fdfed85e30f9027a66887f5e7dcdbc014c7531db", size = 111176995 },
+ { url = "https://files.pythonhosted.org/packages/40/60/71c698b466dd01e65d0e9514b5405faae200c52a76901baf6906856f17e4/torch-2.9.1-cp313-none-macosx_11_0_arm64.whl", hash = "sha256:2c14b3da5df416cf9cb5efab83aa3056f5b8cd8620b8fde81b4987ecab730587", size = 74480347 },
+ { url = "https://files.pythonhosted.org/packages/48/50/c4b5112546d0d13cc9eaa1c732b823d676a9f49ae8b6f97772f795874a03/torch-2.9.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1edee27a7c9897f4e0b7c14cfc2f3008c571921134522d5b9b5ec4ebbc69041a", size = 74433245 },
+ { url = "https://files.pythonhosted.org/packages/81/c9/2628f408f0518b3bae49c95f5af3728b6ab498c8624ab1e03a43dd53d650/torch-2.9.1-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:19d144d6b3e29921f1fc70503e9f2fc572cde6a5115c0c0de2f7ca8b1483e8b6", size = 104134804 },
+ { url = "https://files.pythonhosted.org/packages/28/fc/5bc91d6d831ae41bf6e9e6da6468f25330522e92347c9156eb3f1cb95956/torch-2.9.1-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:c432d04376f6d9767a9852ea0def7b47a7bbc8e7af3b16ac9cf9ce02b12851c9", size = 899747132 },
+ { url = "https://files.pythonhosted.org/packages/63/5d/e8d4e009e52b6b2cf1684bde2a6be157b96fb873732542fb2a9a99e85a83/torch-2.9.1-cp314-cp314-win_amd64.whl", hash = "sha256:d187566a2cdc726fc80138c3cdb260970fab1c27e99f85452721f7759bbd554d", size = 110934845 },
+ { url = "https://files.pythonhosted.org/packages/bd/b2/2d15a52516b2ea3f414643b8de68fa4cb220d3877ac8b1028c83dc8ca1c4/torch-2.9.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:cb10896a1f7fedaddbccc2017ce6ca9ecaaf990f0973bdfcf405439750118d2c", size = 74823558 },
+ { url = "https://files.pythonhosted.org/packages/86/5c/5b2e5d84f5b9850cd1e71af07524d8cbb74cba19379800f1f9f7c997fc70/torch-2.9.1-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:0a2bd769944991c74acf0c4ef23603b9c777fdf7637f115605a4b2d8023110c7", size = 104145788 },
+ { url = "https://files.pythonhosted.org/packages/a9/8c/3da60787bcf70add986c4ad485993026ac0ca74f2fc21410bc4eb1bb7695/torch-2.9.1-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:07c8a9660bc9414c39cac530ac83b1fb1b679d7155824144a40a54f4a47bfa73", size = 899735500 },
+ { url = "https://files.pythonhosted.org/packages/db/2b/f7818f6ec88758dfd21da46b6cd46af9d1b3433e53ddbb19ad1e0da17f9b/torch-2.9.1-cp314-cp314t-win_amd64.whl", hash = "sha256:c88d3299ddeb2b35dcc31753305612db485ab6f1823e37fb29451c8b2732b87e", size = 111163659 },
+]
+
+[[package]]
+name = "torchaudio"
+version = "2.9.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "torch" },
+]
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/1c/87/7de58c8f4c1946ec4d9070354eae73d1e4f3d2426e5cfa45febbd8451ce5/torchaudio-2.9.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fd13541197e035338bd43225b2067532056486d357c661e12d49ace4fc37f8bb", size = 805912 },
+ { url = "https://files.pythonhosted.org/packages/6d/1b/680ca01211a39746aedf54e475783f846fbd7961dfeb17bce7d123f931f0/torchaudio-2.9.1-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:31ec46b718b7caa0182221bfb42e2ad223947b752a996dcdc0388c34a678c966", size = 472829 },
+ { url = "https://files.pythonhosted.org/packages/c1/ee/d71e6d78d203d72f99c426fbbf2bcd801cf084d8f1891bb1f42c95bc5ec5/torchaudio-2.9.1-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:ee11695b367f64638b4a0340cc9abb9be2173c6537bfe4ab286c6fbff68a1444", size = 2055454 },
+ { url = "https://files.pythonhosted.org/packages/19/43/dcfadd58a21704835da8bcc43bbb999887a7a1f8965aab527bd50459272c/torchaudio-2.9.1-cp310-cp310-win_amd64.whl", hash = "sha256:acffac66d0908baa4ef16ce5ce6d2a7bc10c2534fce719b146744f306ba08c4a", size = 663868 },
+ { url = "https://files.pythonhosted.org/packages/3f/6b/34e489fcb4adc4b571a166f2670cc7f156cbe3337867a892fade0a1a5224/torchaudio-2.9.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:6e3f5943135701168d30196e2befd46290180cdbb9ee508b167730d51f43208f", size = 807349 },
+ { url = "https://files.pythonhosted.org/packages/a6/52/66830da8b638368bc0aef064f3307c88d28b526ff8e60a1fda681466b1b3/torchaudio-2.9.1-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:d192cf3b1b677f6666dad60caf0ce7bab66965751570c694645dd905a6c61724", size = 474291 },
+ { url = "https://files.pythonhosted.org/packages/cb/6f/d8f1f36c9f63ddef78f00f8f8ddb9638128ceb5f6824c28bead5af48fc63/torchaudio-2.9.1-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:8327e21f51dced2b6de3ac6a63f04bae9be9bc213e151f85c76164568c7ebc3d", size = 2058677 },
+ { url = "https://files.pythonhosted.org/packages/c3/ef/0ec42e783774bd1dda8bc2489e18b3e9c0a250384e0131cec9f35949f385/torchaudio-2.9.1-cp311-cp311-win_amd64.whl", hash = "sha256:b41339a71b186bad238d94cfb68d4c202db0033088a7b824ce5484674bf67057", size = 664681 },
+ { url = "https://files.pythonhosted.org/packages/f1/83/71cbadd7b66753818b5775f2088bad4f721d581de276996df4968000a626/torchaudio-2.9.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7581ef170794c599aed55918e00d0acd9e5c9a0f19400c9a9a840955180365c5", size = 808098 },
+ { url = "https://files.pythonhosted.org/packages/ef/2d/32e8bec360459107f9b451cc1a5b6fdd5f1d3e653e65a111502084f21e3a/torchaudio-2.9.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:742f9d24db5f1f46d8c7e29c599fe55b866d92c4a8181fcb95eab12da225ceb0", size = 474604 },
+ { url = "https://files.pythonhosted.org/packages/fe/0d/b5af1d55ede1ca07769a2cf71256073d8958e2a5521fc734fc19f5343283/torchaudio-2.9.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:4533fdafba73d7bcfcb5f1225b2cc8974a290ed0fe54c44638d6f440e91b8999", size = 2059899 },
+ { url = "https://files.pythonhosted.org/packages/2e/7c/df90eb0b337cbad59296ed91778e32be069330f5186256d4ce9ea603d324/torchaudio-2.9.1-cp312-cp312-win_amd64.whl", hash = "sha256:923dccc67be4a6cbb45c3dcc2d69ee182bda75b09b69bc88cd3bcdfc739883a2", size = 665337 },
+ { url = "https://files.pythonhosted.org/packages/c0/1b/3321ad6379ac2d968064704e8d015c31ccae5d1ece070f87fb44b17d90e6/torchaudio-2.9.1-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:bb69557484c92513a980027ec4cb314b0f43cf4442bbfd97440e66528dbad22d", size = 808136 },
+ { url = "https://files.pythonhosted.org/packages/76/e2/fe55b3882157fd57aa131f5bcad90f0329be90827e1c0e0c482662ddef38/torchaudio-2.9.1-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:ba2799ceec5e4373a0aa26df30d608f1eaaefd8ac4a7ae0c3446f63106f5b5a5", size = 474349 },
+ { url = "https://files.pythonhosted.org/packages/74/d3/0b090c03cac5a20691507e0945589a696fb10402ccd2457eea47dbf8a71b/torchaudio-2.9.1-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:bc3c8e9a240bfad8bc61f769324a4f3ce5d60eec161369d457c595c35dbb10c7", size = 2060343 },
+ { url = "https://files.pythonhosted.org/packages/a0/db/2555cfd428f4bf09a4df1c6f9204d0acc217c46edb35776c16e7a2a9a1c9/torchaudio-2.9.1-cp313-cp313-win_amd64.whl", hash = "sha256:13ee96ea9bbbc85e198cb671273af06f010e6981d7b912d001eef6bc74e23f4f", size = 665301 },
+ { url = "https://files.pythonhosted.org/packages/0c/58/e82d8b5f447abdddc950965f1395f36baef3602643dd069100c6369ba73e/torchaudio-2.9.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:9290f6a6409deb1f9113d5aef97ec646eeee6410b6bcc57ab8b57066b54da7c1", size = 813456 },
+ { url = "https://files.pythonhosted.org/packages/ce/45/dd9ad6af9bb595095cd98028d270f933760968b92a3497282e31289ef3b4/torchaudio-2.9.1-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:eeae7ca60b64c4bfb78fbd104a089d072b151423d5d2f90da1da00787f03b800", size = 476577 },
+ { url = "https://files.pythonhosted.org/packages/79/97/c49aeb01d8a9ced2b8215a38b69b8eafd1afe295a487a73b7030c6ff3396/torchaudio-2.9.1-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:5f445e896215e6f7bba497dc68aab1e6cb077ae0ab3a90095067f16df6a9bb98", size = 2062158 },
+ { url = "https://files.pythonhosted.org/packages/ba/70/30b2a0ecca2a0a5e6a8cee8952fdea3872854ea5bcd86fe3df369fdc2543/torchaudio-2.9.1-cp313-cp313t-win_amd64.whl", hash = "sha256:c558ba70d548f7491245ed7a35310f6310d83fc7591f073ab5fed9fd38cef987", size = 669253 },
+ { url = "https://files.pythonhosted.org/packages/5b/38/0dabf362f946ab5773d3db3322718d652d70ad12a82f500d54c6c8b9cc88/torchaudio-2.9.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:69a582650279ee16ff9087f99b4234fe5d766e1bf7f0be352db5f46991854c1e", size = 810496 },
+ { url = "https://files.pythonhosted.org/packages/05/1c/e05a32ee6868dc05463242db672f23dba5d042423fefcf294db4dac343a8/torchaudio-2.9.1-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:9c0d004f784c49078017f8217fdc901df0eb9724e50fb269b3a6c99b1d4eae75", size = 474566 },
+ { url = "https://files.pythonhosted.org/packages/15/52/8cec1fe90f05b888f9060467e1eb8c27f9295b8729a83d443e3bd7c471d3/torchaudio-2.9.1-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:d2743b28ff5538d5fdf2ff6657d392852ccdfe640ede46f566b2907ca32d8dca", size = 2060358 },
+ { url = "https://files.pythonhosted.org/packages/04/73/6ba396813d714f895f86c82be61b590fbe14255ebe6866f5ea5916c075a3/torchaudio-2.9.1-cp314-cp314-win_amd64.whl", hash = "sha256:234c7a9d4d0a6ed735cd37965baa9a89ca36bdbebece8a6a5ff7727acbb43026", size = 665039 },
+ { url = "https://files.pythonhosted.org/packages/9c/f6/237e00a04dea497a40a8567d024dfb39193abec3ca3695ad51919ad633d1/torchaudio-2.9.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:e13cb38971ac259fc4e102282a3e48f6df5f0ab00eb785ca5155e3392d1e86f1", size = 813463 },
+ { url = "https://files.pythonhosted.org/packages/57/99/5fcd46a80086030899badeb5a934fab337c88325b3f68c60faa0b672d4d2/torchaudio-2.9.1-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:35c96ed1011b50eaf17948da173b09450cdc5bb7f908687571adb4a4c072c05e", size = 476577 },
+ { url = "https://files.pythonhosted.org/packages/a4/4c/bc428f71d5ef728fba2ecb151a3a6d187e6f0b9446b76e4f87e46d2206a3/torchaudio-2.9.1-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:c220c4acf9914cce2dc81c3624d7c84008ef436dc31bcbb89e8f4416d3615a34", size = 2062170 },
+ { url = "https://files.pythonhosted.org/packages/07/0e/be41f412e1225bdbd9b7fd7f41a20f070c707f5274b82542eeccf6dc2b79/torchaudio-2.9.1-cp314-cp314t-win_amd64.whl", hash = "sha256:cfd12934c7b54b41d4c79dfd26fbfe88fafa9cc5cc77c074e953bb7018d9322c", size = 669265 },
+]
+
+[[package]]
+name = "torchcodec"
+version = "0.9.1"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/4a/c3/ae904a2a8cb4b6288684f022a6d5061a74435bc2d6f1c4742c16d441a9ee/torchcodec-0.9.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:72738d7870edbcd6982207609efe314352e0bf90f4e3895a549e23a49ee0673c", size = 3397284 },
+ { url = "https://files.pythonhosted.org/packages/30/96/c693d75e32b4f07828c2b8a4b894be7366d0e46366ff10dad5825d891148/torchcodec-0.9.1-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:53dfecabc843e4d78b77453732129bd8572dd9d022ab81a94f5305cd5e920ded", size = 2043848 },
+ { url = "https://files.pythonhosted.org/packages/68/dd/cbda16eb33d380c3e7b3cb6dbcfa59aa21e676ddebe3627e834be3b1c124/torchcodec-0.9.1-cp310-cp310-win_amd64.whl", hash = "sha256:d5267e6112b0d0b948d653dc3ffa486bb9a01febc81606d3dfd75cf5a4dcc9f3", size = 2170387 },
+ { url = "https://files.pythonhosted.org/packages/c0/37/169238bb55017b08a93530d6f4474a112780df4c05c26c78df7dd58401f1/torchcodec-0.9.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7a81d29e67cebefaec08f9c817635d1ff47205814884e527ef4b135a6c795612", size = 3899002 },
+ { url = "https://files.pythonhosted.org/packages/75/74/11c59e0592e555df78cfee2fd4b8ba5c725e4bf160002af88ce09de99d9d/torchcodec-0.9.1-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:5e959c7abf95de62f78653d416f00f7ca32936fbfd23371b23d5c8dc199f3670", size = 2048262 },
+ { url = "https://files.pythonhosted.org/packages/53/66/0612c7852cb7854dec45db9357397b4dbd4d6274832cc8949a8d1c0e518a/torchcodec-0.9.1-cp311-cp311-win_amd64.whl", hash = "sha256:508e0ce6da1e4af186b131cdbdd3d998bc4313e9f3a3f5b78f64aa5f9685ed88", size = 2181959 },
+ { url = "https://files.pythonhosted.org/packages/4b/60/3bfa459e09987af08e188811b191437c9d8215a74f4d418be6ff7df87b5c/torchcodec-0.9.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8996ec62b72c69545c30246df64df386d06d7ec7de0689be5d20dfc06aad6442", size = 4064264 },
+ { url = "https://files.pythonhosted.org/packages/17/c8/bfb74babec98aff11ab4f239b0901f39e1a93338b3438e842d864dc46935/torchcodec-0.9.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:a50568ce73b70395d113833fb07394c223f5546ef5d4fafe0fdcd91627fca270", size = 2061978 },
+ { url = "https://files.pythonhosted.org/packages/b2/12/c0bbf01b0ed52b69aaeed4af1043dc8308ccc522a47fcc082b34882e2ba2/torchcodec-0.9.1-cp312-cp312-win_amd64.whl", hash = "sha256:d9c8efe5845bde45a428f96493b4a041511f47f5bd53b333a0ad90426be4623a", size = 2187178 },
+ { url = "https://files.pythonhosted.org/packages/6f/c7/67fc8417f9efa8a25c00a44f0d674761a0bad9c45e9725e3fd116b3c48ed/torchcodec-0.9.1-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:5c9cdcba50c75be70ef6ec919ec1f7f14d9d5163d93cf6bd94403e134f03734c", size = 4034415 },
+ { url = "https://files.pythonhosted.org/packages/68/05/06240f661e9aa08b20765305e3b88f60bff706bbe54ac35830af74612443/torchcodec-0.9.1-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:0643c5e9c3a51fdafdea87935d5b0a38e99626c664f47a150482d77ab370a877", size = 2067767 },
+ { url = "https://files.pythonhosted.org/packages/13/a2/d78cd65863fb805d9e35fe90ae7574eab86ff0ae63438208bd07d2cf1fd2/torchcodec-0.9.1-cp313-cp313-win_amd64.whl", hash = "sha256:df0b5a15998fd7457625c2af2a6276e0e710fac158d145045340dbbcd1cfdb65", size = 2186788 },
+ { url = "https://files.pythonhosted.org/packages/01/02/f8ae9443d3bcbe8a8d6d0bbc3992296e5476e5afa1f244100a3a7967a36c/torchcodec-0.9.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:b9bc5a5dff925df96d11bf90bd0ce964b8086bb11ae09adf353518192b5da483", size = 3812248 },
+ { url = "https://files.pythonhosted.org/packages/59/a1/8462b55571286847ea31edb7634583125400824267db9ba8301f4ce3f137/torchcodec-0.9.1-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:65634bb28b3155cf99f980dac31ecedb414c07b8156f8473ec9fb74bedbd2a1f", size = 2068456 },
+ { url = "https://files.pythonhosted.org/packages/f2/63/752d0fc1c6e8f799ae880ca1087510def663a7f9aa1a70074ae334c6908f/torchcodec-0.9.1-cp314-cp314-win_amd64.whl", hash = "sha256:2d01c8b3685a3a38f050ed2b526808a2938dba6f56cb9f9e967884fd858bba15", size = 2188320 },
+]
+
+[[package]]
+name = "torchvision"
+version = "0.24.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "pillow" },
+ { name = "torch" },
+]
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/f7/09/d51aadf8591138e08b74c64a6eb783630c7a31ca2634416277115a9c3a2b/torchvision-0.24.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ded5e625788572e4e1c4d155d1bbc48805c113794100d70e19c76e39e4d53465", size = 1891441 },
+ { url = "https://files.pythonhosted.org/packages/6b/49/a35df863e7c153aad82af7505abd8264a5b510306689712ef86bea862822/torchvision-0.24.1-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:54ed17c3d30e718e08d8da3fd5b30ea44b0311317e55647cb97077a29ecbc25b", size = 2386226 },
+ { url = "https://files.pythonhosted.org/packages/49/20/f2d7cd1eea052887c1083afff0b8df5228ec93b53e03759f20b1a3c6d22a/torchvision-0.24.1-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:f476da4e085b7307aaab6f540219617d46d5926aeda24be33e1359771c83778f", size = 8046093 },
+ { url = "https://files.pythonhosted.org/packages/d8/cf/0ff4007c09903199307da5f53a192ff5d62b45447069e9ef3a19bdc5ff12/torchvision-0.24.1-cp310-cp310-win_amd64.whl", hash = "sha256:fbdbdae5e540b868a681240b7dbd6473986c862445ee8a138680a6a97d6c34ff", size = 3696202 },
+ { url = "https://files.pythonhosted.org/packages/e7/69/30f5f03752aa1a7c23931d2519b31e557f3f10af5089d787cddf3b903ecf/torchvision-0.24.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:056c525dc875f18fe8e9c27079ada166a7b2755cea5a2199b0bc7f1f8364e600", size = 1891436 },
+ { url = "https://files.pythonhosted.org/packages/0c/69/49aae86edb75fe16460b59a191fcc0f568c2378f780bb063850db0fe007a/torchvision-0.24.1-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:1e39619de698e2821d71976c92c8a9e50cdfd1e993507dfb340f2688bfdd8283", size = 2387757 },
+ { url = "https://files.pythonhosted.org/packages/11/c9/1dfc3db98797b326f1d0c3f3bb61c83b167a813fc7eab6fcd2edb8c7eb9d/torchvision-0.24.1-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:a0f106663e60332aa4fcb1ca2159ef8c3f2ed266b0e6df88de261048a840e0df", size = 8047682 },
+ { url = "https://files.pythonhosted.org/packages/fa/bb/cfc6a6f6ccc84a534ed1fdf029ae5716dd6ff04e57ed9dc2dab38bf652d5/torchvision-0.24.1-cp311-cp311-win_amd64.whl", hash = "sha256:a9308cdd37d8a42e14a3e7fd9d271830c7fecb150dd929b642f3c1460514599a", size = 4037588 },
+ { url = "https://files.pythonhosted.org/packages/f0/af/18e2c6b9538a045f60718a0c5a058908ccb24f88fde8e6f0fc12d5ff7bd3/torchvision-0.24.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e48bf6a8ec95872eb45763f06499f87bd2fb246b9b96cb00aae260fda2f96193", size = 1891433 },
+ { url = "https://files.pythonhosted.org/packages/9d/43/600e5cfb0643d10d633124f5982d7abc2170dfd7ce985584ff16edab3e76/torchvision-0.24.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:7fb7590c737ebe3e1c077ad60c0e5e2e56bb26e7bccc3b9d04dbfc34fd09f050", size = 2386737 },
+ { url = "https://files.pythonhosted.org/packages/93/b1/db2941526ecddd84884132e2742a55c9311296a6a38627f9e2627f5ac889/torchvision-0.24.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:66a98471fc18cad9064123106d810a75f57f0838eee20edc56233fd8484b0cc7", size = 8049868 },
+ { url = "https://files.pythonhosted.org/packages/69/98/16e583f59f86cd59949f59d52bfa8fc286f86341a229a9d15cbe7a694f0c/torchvision-0.24.1-cp312-cp312-win_amd64.whl", hash = "sha256:4aa6cb806eb8541e92c9b313e96192c6b826e9eb0042720e2fa250d021079952", size = 4302006 },
+ { url = "https://files.pythonhosted.org/packages/e4/97/ab40550f482577f2788304c27220e8ba02c63313bd74cf2f8920526aac20/torchvision-0.24.1-cp313-cp313-macosx_12_0_arm64.whl", hash = "sha256:8a6696db7fb71eadb2c6a48602106e136c785642e598eb1533e0b27744f2cce6", size = 1891435 },
+ { url = "https://files.pythonhosted.org/packages/30/65/ac0a3f9be6abdbe4e1d82c915d7e20de97e7fd0e9a277970508b015309f3/torchvision-0.24.1-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:db2125c46f9cb25dc740be831ce3ce99303cfe60439249a41b04fd9f373be671", size = 2338718 },
+ { url = "https://files.pythonhosted.org/packages/10/b5/5bba24ff9d325181508501ed7f0c3de8ed3dd2edca0784d48b144b6c5252/torchvision-0.24.1-cp313-cp313-manylinux_2_28_x86_64.whl", hash = "sha256:f035f0cacd1f44a8ff6cb7ca3627d84c54d685055961d73a1a9fb9827a5414c8", size = 8049661 },
+ { url = "https://files.pythonhosted.org/packages/5c/ec/54a96ae9ab6a0dd66d4bba27771f892e36478a9c3489fa56e51c70abcc4d/torchvision-0.24.1-cp313-cp313-win_amd64.whl", hash = "sha256:16274823b93048e0a29d83415166a2e9e0bf4e1b432668357b657612a4802864", size = 4319808 },
+ { url = "https://files.pythonhosted.org/packages/d5/f3/a90a389a7e547f3eb8821b13f96ea7c0563cdefbbbb60a10e08dda9720ff/torchvision-0.24.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:e3f96208b4bef54cd60e415545f5200346a65024e04f29a26cd0006dbf9e8e66", size = 2005342 },
+ { url = "https://files.pythonhosted.org/packages/a9/fe/ff27d2ed1b524078164bea1062f23d2618a5fc3208e247d6153c18c91a76/torchvision-0.24.1-cp313-cp313t-manylinux_2_28_aarch64.whl", hash = "sha256:f231f6a4f2aa6522713326d0d2563538fa72d613741ae364f9913027fa52ea35", size = 2341708 },
+ { url = "https://files.pythonhosted.org/packages/b1/b9/d6c903495cbdfd2533b3ef6f7b5643ff589ea062f8feb5c206ee79b9d9e5/torchvision-0.24.1-cp313-cp313t-manylinux_2_28_x86_64.whl", hash = "sha256:1540a9e7f8cf55fe17554482f5a125a7e426347b71de07327d5de6bfd8d17caa", size = 8177239 },
+ { url = "https://files.pythonhosted.org/packages/4f/2b/ba02e4261369c3798310483028495cf507e6cb3f394f42e4796981ecf3a7/torchvision-0.24.1-cp313-cp313t-win_amd64.whl", hash = "sha256:d83e16d70ea85d2f196d678bfb702c36be7a655b003abed84e465988b6128938", size = 4251604 },
+ { url = "https://files.pythonhosted.org/packages/42/84/577b2cef8f32094add5f52887867da4c2a3e6b4261538447e9b48eb25812/torchvision-0.24.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:cccf4b4fec7fdfcd3431b9ea75d1588c0a8596d0333245dafebee0462abe3388", size = 2005319 },
+ { url = "https://files.pythonhosted.org/packages/5f/34/ecb786bffe0159a3b49941a61caaae089853132f3cd1e8f555e3621f7e6f/torchvision-0.24.1-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:1b495edd3a8f9911292424117544f0b4ab780452e998649425d1f4b2bed6695f", size = 2338844 },
+ { url = "https://files.pythonhosted.org/packages/51/99/a84623786a6969504c87f2dc3892200f586ee13503f519d282faab0bb4f0/torchvision-0.24.1-cp314-cp314-manylinux_2_28_x86_64.whl", hash = "sha256:ab211e1807dc3e53acf8f6638df9a7444c80c0ad050466e8d652b3e83776987b", size = 8175144 },
+ { url = "https://files.pythonhosted.org/packages/6d/ba/8fae3525b233e109317ce6a9c1de922ab2881737b029a7e88021f81e068f/torchvision-0.24.1-cp314-cp314-win_amd64.whl", hash = "sha256:18f9cb60e64b37b551cd605a3d62c15730c086362b40682d23e24b616a697d41", size = 4234459 },
+ { url = "https://files.pythonhosted.org/packages/50/33/481602c1c72d0485d4b3a6b48c9534b71c2957c9d83bf860eb837bf5a620/torchvision-0.24.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:ec9d7379c519428395e4ffda4dbb99ec56be64b0a75b95989e00f9ec7ae0b2d7", size = 2005336 },
+ { url = "https://files.pythonhosted.org/packages/d0/7f/372de60bf3dd8f5593bd0d03f4aecf0d1fd58f5bc6943618d9d913f5e6d5/torchvision-0.24.1-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:af9201184c2712d808bd4eb656899011afdfce1e83721c7cb08000034df353fe", size = 2341704 },
+ { url = "https://files.pythonhosted.org/packages/36/9b/0f3b9ff3d0225ee2324ec663de0e7fb3eb855615ca958ac1875f22f1f8e5/torchvision-0.24.1-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:9ef95d819fd6df81bc7cc97b8f21a15d2c0d3ac5dbfaab5cbc2d2ce57114b19e", size = 8177422 },
+ { url = "https://files.pythonhosted.org/packages/d6/ab/e2bcc7c2f13d882a58f8b30ff86f794210b075736587ea50f8c545834f8a/torchvision-0.24.1-cp314-cp314t-win_amd64.whl", hash = "sha256:480b271d6edff83ac2e8d69bbb4cf2073f93366516a50d48f140ccfceedb002e", size = 4335190 },
+]
+
+[[package]]
+name = "tqdm"
+version = "4.67.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "colorama", marker = "sys_platform == 'win32'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/a8/4b/29b4ef32e036bb34e4ab51796dd745cdba7ed47ad142a9f4a1eb8e0c744d/tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2", size = 169737 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/d0/30/dc54f88dd4a2b5dc8a0279bdd7270e735851848b762aeb1c1184ed1f6b14/tqdm-4.67.1-py3-none-any.whl", hash = "sha256:26445eca388f82e72884e0d580d5464cd801a3ea01e63e5601bdff9ba6a48de2", size = 78540 },
+]
+
+[[package]]
+name = "transformers"
+version = "4.57.3"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "filelock" },
+ { name = "huggingface-hub" },
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "packaging" },
+ { name = "pyyaml" },
+ { name = "regex" },
+ { name = "requests" },
+ { name = "safetensors" },
+ { name = "tokenizers" },
+ { name = "tqdm" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/dd/70/d42a739e8dfde3d92bb2fff5819cbf331fe9657323221e79415cd5eb65ee/transformers-4.57.3.tar.gz", hash = "sha256:df4945029aaddd7c09eec5cad851f30662f8bd1746721b34cc031d70c65afebc", size = 10139680 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/6a/6b/2f416568b3c4c91c96e5a365d164f8a4a4a88030aa8ab4644181fdadce97/transformers-4.57.3-py3-none-any.whl", hash = "sha256:c77d353a4851b1880191603d36acb313411d3577f6e2897814f333841f7003f4", size = 11993463 },
+]
+
+[[package]]
+name = "triton"
+version = "3.5.1"
+source = { registry = "https://pypi.org/simple" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/fd/6e/676ab5019b4dde8b9b7bab71245102fc02778ef3df48218b298686b9ffd6/triton-3.5.1-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5fc53d849f879911ea13f4a877243afc513187bc7ee92d1f2c0f1ba3169e3c94", size = 170320692 },
+ { url = "https://files.pythonhosted.org/packages/b0/72/ec90c3519eaf168f22cb1757ad412f3a2add4782ad3a92861c9ad135d886/triton-3.5.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:61413522a48add32302353fdbaaf92daaaab06f6b5e3229940d21b5207f47579", size = 170425802 },
+ { url = "https://files.pythonhosted.org/packages/f2/50/9a8358d3ef58162c0a415d173cfb45b67de60176e1024f71fbc4d24c0b6d/triton-3.5.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d2c6b915a03888ab931a9fd3e55ba36785e1fe70cbea0b40c6ef93b20fc85232", size = 170470207 },
+ { url = "https://files.pythonhosted.org/packages/27/46/8c3bbb5b0a19313f50edcaa363b599e5a1a5ac9683ead82b9b80fe497c8d/triton-3.5.1-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f3f4346b6ebbd4fad18773f5ba839114f4826037c9f2f34e0148894cd5dd3dba", size = 170470410 },
+ { url = "https://files.pythonhosted.org/packages/37/92/e97fcc6b2c27cdb87ce5ee063d77f8f26f19f06916aa680464c8104ef0f6/triton-3.5.1-cp313-cp313t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0b4d2c70127fca6a23e247f9348b8adde979d2e7a20391bfbabaac6aebc7e6a8", size = 170579924 },
+ { url = "https://files.pythonhosted.org/packages/a4/e6/c595c35e5c50c4bc56a7bac96493dad321e9e29b953b526bbbe20f9911d0/triton-3.5.1-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d0637b1efb1db599a8e9dc960d53ab6e4637db7d4ab6630a0974705d77b14b60", size = 170480488 },
+ { url = "https://files.pythonhosted.org/packages/16/b5/b0d3d8b901b6a04ca38df5e24c27e53afb15b93624d7fd7d658c7cd9352a/triton-3.5.1-cp314-cp314t-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:bac7f7d959ad0f48c0e97d6643a1cc0fd5786fe61cb1f83b537c6b2d54776478", size = 170582192 },
+]
+
+[[package]]
+name = "typer"
+version = "0.21.0"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "click" },
+ { name = "rich" },
+ { name = "shellingham" },
+ { name = "typing-extensions" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/85/30/ff9ede605e3bd086b4dd842499814e128500621f7951ca1e5ce84bbf61b1/typer-0.21.0.tar.gz", hash = "sha256:c87c0d2b6eee3b49c5c64649ec92425492c14488096dfbc8a0c2799b2f6f9c53", size = 106781 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/e1/e4/5ebc1899d31d2b1601b32d21cfb4bba022ae6fce323d365f0448031b1660/typer-0.21.0-py3-none-any.whl", hash = "sha256:c79c01ca6b30af9fd48284058a7056ba0d3bf5cf10d0ff3d0c5b11b68c258ac6", size = 47109 },
+]
+
+[[package]]
+name = "typing-extensions"
+version = "4.15.0"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/72/94/1a15dd82efb362ac84269196e94cf00f187f7ed21c242792a923cdb1c61f/typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466", size = 109391 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/18/67/36e9267722cc04a6b9f15c7f3441c2363321a3ea07da7ae0c0707beb2a9c/typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548", size = 44614 },
+]
+
+[[package]]
+name = "typing-inspection"
+version = "0.4.2"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "typing-extensions" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/55/e3/70399cb7dd41c10ac53367ae42139cf4b1ca5f36bb3dc6c9d33acdb43655/typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464", size = 75949 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/dc/9b/47798a6c91d8bdb567fe2698fe81e0c6b7cb7ef4d13da4114b41d239f65d/typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7", size = 14611 },
+]
+
+[[package]]
+name = "tzdata"
+version = "2025.3"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/5e/a7/c202b344c5ca7daf398f3b8a477eeb205cf3b6f32e7ec3a6bac0629ca975/tzdata-2025.3.tar.gz", hash = "sha256:de39c2ca5dc7b0344f2eba86f49d614019d29f060fc4ebc8a417896a620b56a7", size = 196772 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/c7/b0/003792df09decd6849a5e39c28b513c06e84436a54440380862b5aeff25d/tzdata-2025.3-py2.py3-none-any.whl", hash = "sha256:06a47e5700f3081aab02b2e513160914ff0694bce9947d6b76ebd6bf57cfc5d1", size = 348521 },
+]
+
+[[package]]
+name = "urllib3"
+version = "2.6.2"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/1e/24/a2a2ed9addd907787d7aa0355ba36a6cadf1768b934c652ea78acbd59dcd/urllib3-2.6.2.tar.gz", hash = "sha256:016f9c98bb7e98085cb2b4b17b87d2c702975664e4f060c6532e64d1c1a5e797", size = 432930 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/6d/b9/4095b668ea3678bf6a0af005527f39de12fb026516fb3df17495a733b7f8/urllib3-2.6.2-py3-none-any.whl", hash = "sha256:ec21cddfe7724fc7cb4ba4bea7aa8e2ef36f607a4bab81aa6ce42a13dc3f03dd", size = 131182 },
+]
+
+[[package]]
+name = "virtualenv"
+version = "20.35.4"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "distlib" },
+ { name = "filelock" },
+ { name = "platformdirs" },
+ { name = "typing-extensions", marker = "python_full_version < '3.11'" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/20/28/e6f1a6f655d620846bd9df527390ecc26b3805a0c5989048c210e22c5ca9/virtualenv-20.35.4.tar.gz", hash = "sha256:643d3914d73d3eeb0c552cbb12d7e82adf0e504dbf86a3182f8771a153a1971c", size = 6028799 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/79/0c/c05523fa3181fdf0c9c52a6ba91a23fbf3246cc095f26f6516f9c60e6771/virtualenv-20.35.4-py3-none-any.whl", hash = "sha256:c21c9cede36c9753eeade68ba7d523529f228a403463376cf821eaae2b650f1b", size = 6005095 },
+]
+
+[[package]]
+name = "wandb"
+version = "0.23.1"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "click" },
+ { name = "gitpython" },
+ { name = "packaging" },
+ { name = "platformdirs" },
+ { name = "protobuf" },
+ { name = "pydantic" },
+ { name = "pyyaml" },
+ { name = "requests" },
+ { name = "sentry-sdk" },
+ { name = "typing-extensions" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/0a/cc/770ae3aa7ae44f6792f7ecb81c14c0e38b672deb35235719bb1006519487/wandb-0.23.1.tar.gz", hash = "sha256:f6fb1e3717949b29675a69359de0eeb01e67d3360d581947d5b3f98c273567d6", size = 44298053 }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/12/0b/c3d7053dfd93fd259a63c7818d9c4ac2ba0642ff8dc8db98662ea0cf9cc0/wandb-0.23.1-py3-none-macosx_12_0_arm64.whl", hash = "sha256:358e15471d19b7d73fc464e37371c19d44d39e433252ac24df107aff993a286b", size = 21527293 },
+ { url = "https://files.pythonhosted.org/packages/ee/9f/059420fa0cb6c511dc5c5a50184122b6aca7b178cb2aa210139e354020da/wandb-0.23.1-py3-none-macosx_12_0_x86_64.whl", hash = "sha256:110304407f4b38f163bdd50ed5c5225365e4df3092f13089c30171a75257b575", size = 22745926 },
+ { url = "https://files.pythonhosted.org/packages/96/b6/fd465827c14c64d056d30b4c9fcf4dac889a6969dba64489a88fc4ffa333/wandb-0.23.1-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:6cc984cf85feb2f8ee0451d76bc9fb7f39da94956bb8183e30d26284cf203b65", size = 21212973 },
+ { url = "https://files.pythonhosted.org/packages/5c/ee/9a8bb9a39cc1f09c3060456cc79565110226dc4099a719af5c63432da21d/wandb-0.23.1-py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:67431cd3168d79fdb803e503bd669c577872ffd5dadfa86de733b3274b93088e", size = 22887885 },
+ { url = "https://files.pythonhosted.org/packages/6d/4d/8d9e75add529142e037b05819cb3ab1005679272950128d69d218b7e5b2e/wandb-0.23.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:07be70c0baa97ea25fadc4a9d0097f7371eef6dcacc5ceb525c82491a31e9244", size = 21250967 },
+ { url = "https://files.pythonhosted.org/packages/97/72/0b35cddc4e4168f03c759b96d9f671ad18aec8bdfdd84adfea7ecb3f5701/wandb-0.23.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:216c95b08e0a2ec6a6008373b056d597573d565e30b43a7a93c35a171485ee26", size = 22988382 },
+ { url = "https://files.pythonhosted.org/packages/c0/6d/e78093d49d68afb26f5261a70fc7877c34c114af5c2ee0ab3b1af85f5e76/wandb-0.23.1-py3-none-win32.whl", hash = "sha256:fb5cf0f85692f758a5c36ab65fea96a1284126de64e836610f92ddbb26df5ded", size = 22150756 },
+ { url = "https://files.pythonhosted.org/packages/05/27/4f13454b44c9eceaac3d6e4e4efa2230b6712d613ff9bf7df010eef4fd18/wandb-0.23.1-py3-none-win_amd64.whl", hash = "sha256:21c8c56e436eb707b7d54f705652e030d48e5cfcba24cf953823eb652e30e714", size = 22150760 },
+ { url = "https://files.pythonhosted.org/packages/30/20/6c091d451e2a07689bfbfaeb7592d488011420e721de170884fedd68c644/wandb-0.23.1-py3-none-win_arm64.whl", hash = "sha256:8aee7f3bb573f2c0acf860f497ca9c684f9b35f2ca51011ba65af3d4592b77c1", size = 20137463 },
+]
+
+[[package]]
+name = "xformers"
+version = "0.0.33+5d4b92a5.d20251029"
+source = { registry = "https://download.pytorch.org/whl/cu129" }
+dependencies = [
+ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },
+ { name = "numpy", version = "2.4.0", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.11'" },
+ { name = "torch" },
+]
+wheels = [
+ { url = "https://download.pytorch.org/whl/cu129/xformers-0.0.33%2B5d4b92a5.d20251029-cp39-abi3-linux_x86_64.whl" },
+]