Instructions to use nvidia/Cosmos3-Edge-Policy-DROID with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Cosmos
How to use nvidia/Cosmos3-Edge-Policy-DROID with Cosmos:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Commit ·
3ea407a
0
Parent(s):
Initial release
Browse filesCo-authored-by: fsergiy <fsergiy@users.noreply.huggingface.co>
Co-authored-by: yaoxuhf <yaoxuhf@users.noreply.huggingface.co>
Co-authored-by: rickznv <rickznv@users.noreply.huggingface.co>
Co-authored-by: atharvajoshi10 <atharvajoshi10@users.noreply.huggingface.co>
Co-authored-by: ychao-nvidia <ychao-nvidia@users.noreply.huggingface.co>
- .gitattributes +38 -0
- BIAS.md +11 -0
- EXPLAINABILITY.md +16 -0
- PRIVACY.md +6 -0
- README.md +475 -0
- SAFETY.md +11 -0
- chat_template.jinja +324 -0
- checkpoint.json +10 -0
- config.json +244 -0
- convert_cosmos3_to_diffusers.py +1286 -0
- generation_config.json +8 -0
- images/benchmark-robolab.png +3 -0
- model.safetensors.index.json +0 -0
- model_index.json +31 -0
- modular_model_index.json +58 -0
- preprocessor_config.json +21 -0
- processor_config.json +44 -0
- scheduler/scheduler_config.json +33 -0
- special_tokens_map.json +30 -0
- text_tokenizer/chat_template.jinja +324 -0
- text_tokenizer/special_tokens_map.json +30 -0
- text_tokenizer/tokenizer.json +3 -0
- text_tokenizer/tokenizer_config.json +0 -0
- tokenizer.json +3 -0
- tokenizer_config.json +0 -0
- transformer/config.json +44 -0
- transformer/cosmos_framework_model.safetensors +3 -0
- transformer/diffusion_pytorch_model-00001-of-00002.safetensors +3 -0
- transformer/diffusion_pytorch_model-00002-of-00002.safetensors +3 -0
- transformer/diffusion_pytorch_model.safetensors.index.json +556 -0
- vae/config.json +129 -0
- vae/diffusion_pytorch_model.safetensors +3 -0
- video_preprocessor_config.json +22 -0
- vision_encoder/model.safetensors +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
text_tokenizer/tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
BIAS.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Bias
|
| 2 |
+
|
| 3 |
+
| Field | Response |
|
| 4 |
+
| :---- | :---- |
|
| 5 |
+
| Participation considerations from adversely impacted groups [protected classes](https://www.senate.ca.gov/content/protected-classes) in model design and testing | None. |
|
| 6 |
+
| Measures taken to mitigate against unwanted bias | Training, evaluation, and testing data are curated before release to filter restricted content, including content relating to protected classes. Model behavior is evaluated across Physical AI domains — robotics, autonomous vehicles, human-centric scenes, common scenes, industry, miscellaneous, and physics-oriented benchmarks — with attention to coverage across diverse demographic and contextual characteristics that affect protected-class outcomes. |
|
| 7 |
+
| Which characteristic (feature) show(s) the greatest difference in performance?: | Greatest performance differences are observed in tasks requiring long-horizon temporal consistency, fine-grained physical interactions, and embodiment-specific action generation. Performance is generally stronger on common visual reasoning and world-generation tasks than on complex multi-agent, robotics-control, or tightly synchronized multimodal generation scenarios. |
|
| 8 |
+
| Which feature(s) have the worst performance overall? | Performance is generally weakest in tasks requiring long-horizon temporal consistency, precise physical interactions, embodiment-specific action control, and strict audio-visual synchronization. |
|
| 9 |
+
| If using internal data, description of methods implemented in data acquisition or processing, if any, to address the prevalence of identifiable biases in the training, testing, and validation data: | Bias-specific methods applied during data processing include person-presence screening, demographic-taxonomy classification (age, gender, ethnicity), embedding-based diversity analysis, and dataset balancing across sources. Internal analysis surfaced: non-person scenes are more prevalent than person-centric content; demographic-taxonomy outputs on person-present samples are most frequently "uncertain" across age, gender, and ethnicity dimensions; and source-type variation, with people-centric image and video datasets showing higher demographic signal than document-, object-, robotics-, or scene-focused datasets. *(Quantitative details in the row below.)* Downstream deployments should add bias audits, fairness evaluation, red-teaming, demographically balanced fine-tuning, or counterfactual augmentation as mitigations. |
|
| 10 |
+
| Tools used to assess statistical imbalances and highlight patterns that may introduce bias into AI models: | Dataset analytics pipelines, metadata distribution analysis, heuristic quality checks, embedding-based clustering, model-assisted filtering systems, and benchmark evaluation suites are used to assess statistical imbalances and identify patterns that may introduce bias into model behavior. |
|
| 11 |
+
| Tools used to assess statistical imbalances and highlight patterns that may introduce bias into AI models: | These datasets, such as OpenImages-derived detection-to-NLP datasets, visual grounding and VQA datasets, document/image understanding datasets, video/action understanding datasets, and NVIDIA-created or curated visual datasets, do not collectively or exhaustively represent all demographic groups (and proportionally therein). For instance, automated person-presence screening did not identify a person in approximately 58% of visual samples analyzed across approximately 400 datasets, while person-present signals were identified in approximately 42% of analyzed samples. In the subset where person-present signals were identified, these datasets contain uneven representation splits across the measured visual taxonomies: age outputs were most frequently uncertain, followed by child and adult; gender outputs were most frequently uncertain, followed by male and female; and ethnicity outputs were most frequently uncertain, followed by Hispanic and White as the most frequent identified categories. Dataset-level results vary by source type, with people-centric image and video datasets containing higher person-present and demographic-taxonomy signals than document-, object-, robotics-, or scene-focused datasets. To mitigate these imbalances, we recommend considering evaluation techniques such as bias audits, task-specific fairness evaluation, and red-teaming, along with fine-tuning with demographically balanced datasets and counterfactual data augmentation to align with the desired model behavior. This evaluation used a baseline of 200 samples across all datasets, with larger subsets of up to 3,000 samples utilized for certain in-depth analyses, identified as optimal thresholds for maximizing embedder accuracy. |
|
EXPLAINABILITY.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Explainability
|
| 2 |
+
|
| 3 |
+
| Field | Response |
|
| 4 |
+
| :---- | :---- |
|
| 5 |
+
| Intended Application & Domain | World reasoning and generation for Physical AI. |
|
| 6 |
+
| Model Type | Mixture-of-Transformers architecture with two towers. One is an autoregressive model for Physical AI reasoning; the other is a diffusion model for Physical AI generation. |
|
| 7 |
+
| Intended Users | Physical AI developers, researchers, and practitioners building or evaluating autonomous vehicle, robotics, and world-generation workflows. |
|
| 8 |
+
| Output | Images, videos, audio, and action commands. |
|
| 9 |
+
| Tools used to evaluate datasets to identify synthetic data and ensure data authenticity. | Dataset provenance analysis, metadata validation, watermark and artifact detection, embedding-based clustering, heuristic quality checks, and model-assisted data validation pipelines are used to identify synthetic content patterns, assess dataset authenticity, and improve data quality during dataset curation. |
|
| 10 |
+
| Describe how the model works | Cosmos3 is an Omni world foundation model that generates texts, images, videos, audio, and action commands from combinations of text, images, videos, and action trajectory inputs. Input tokens from multiple modalities are packed into a shared sequence and processed by our mixture-of-transformer backbone with modality-specific output heads. |
|
| 11 |
+
| Name the adversely impacted groups this has been tested to deliver comparable outcomes regardless of: | None. |
|
| 12 |
+
| Technical Limitations | The model may not follow text, image, video, audio, or action trajectory inputs accurately in challenging cases, especially where the input contains complex scene composition, unusual camera motion, multiple interacting agents, low lighting, high motion blur, or fine-grained physical interactions. Generated outputs may contain temporal inconsistency, object morphing, inaccurate 3D structure, or implausible physical dynamics. Generated audio may not accurately render intelligible speech, or maintain strict temporal and semantic alignment with the visual context. |
|
| 13 |
+
| Verified to have met prescribed NVIDIA quality standards | Yes. |
|
| 14 |
+
| Performance Metrics | Video generation is measured using PAIBench-G, RBench, PhysicsIQ, and Artifical Analysis Image2Video benchmark. Image generation uses UniGenBench and Artifical Analysis Text2Image benchmark. For transfer evaluation, we use PAIBench-C and AVBench-C. Audio generation uses internal benchmarks. Action prediction uses metrics such as action MSE, Absolute Translation Error, Relative Translation Error, Relative Rotation Error, PSNR, and robotic task completion success rate. |
|
| 15 |
+
| Potential Known Risks | This model can generate synthetic media and may produce content that is offensive, unsafe, misleading, indecent, or unsuitable for a target deployment. Users should implement robust safety guardrails — including content filtering, abuse monitoring, and access controls — to reduce the risk of harmful outputs. Users are responsible for ensuring that their use of the model complies with all applicable laws and regulations, and for regularly reviewing and updating their guardrails as risks evolve. |
|
| 16 |
+
| Licensing | [OpenMDW1.1](https://openmdw.ai/) |
|
PRIVACY.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Privacy
|
| 2 |
+
| Privacy Information |
|
| 3 |
+
|---|
|
| 4 |
+
| The model was trained on large-scale publicly available data that may contain images, audio-video, and text relating to people. NVIDIA collected and used this data in compliance with applicable data protection and privacy laws. This model was not designed to derive insights or otherwise learn from any personal data contained in the datasets. |
|
| 5 |
+
| NVIDIA uses a combination of filters, data minimization techniques, and other guardrails to help prevent personal data from being recited by our models. We employ automated tools and data processing techniques during pre-training or training to identify and filter certain categories of personal data. For example, for text-bearing source and document components, our automated tools identified potential personal data such as person names, locations, and possible business or public-facing contact information such as email addresses and phone numbers. We reviewed and removed any verified instances of personal data through a combination of automated filtering and human-in-the-loop validation. |
|
| 6 |
+
| Please review NVIDIA's [Privacy Policy](https://www.nvidia.com/en-us/about-nvidia/privacy-policy/) for more information. |
|
README.md
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
library_name: cosmos
|
| 7 |
+
tags:
|
| 8 |
+
- nvidia
|
| 9 |
+
- cosmos
|
| 10 |
+
- cosmos3
|
| 11 |
+
- world action model
|
| 12 |
+
- policy model
|
| 13 |
+
countDownloads:
|
| 14 |
+
- checkpoint.json
|
| 15 |
+
- config.json
|
| 16 |
+
- generation_config.json
|
| 17 |
+
- model.safetensors.index.json
|
| 18 |
+
- model_index.json
|
| 19 |
+
- tokenizer.json
|
| 20 |
+
- tokenizer_config.json
|
| 21 |
+
- sound_tokenizer/config.json
|
| 22 |
+
- sound_tokenizer/diffusion_pytorch_model.safetensors
|
| 23 |
+
- text_tokenizer/tokenizer.json
|
| 24 |
+
- text_tokenizer/tokenizer_config.json
|
| 25 |
+
- transformer/config.json
|
| 26 |
+
- transformer/diffusion_pytorch_model-00001-of-00007.safetensors
|
| 27 |
+
- transformer/diffusion_pytorch_model-00002-of-00007.safetensors
|
| 28 |
+
- transformer/diffusion_pytorch_model-00003-of-00007.safetensors
|
| 29 |
+
- transformer/diffusion_pytorch_model-00004-of-00007.safetensors
|
| 30 |
+
- transformer/diffusion_pytorch_model-00005-of-00007.safetensors
|
| 31 |
+
- transformer/diffusion_pytorch_model-00006-of-00007.safetensors
|
| 32 |
+
- transformer/diffusion_pytorch_model-00007-of-00007.safetensors
|
| 33 |
+
- transformer/diffusion_pytorch_model.safetensors.index.json
|
| 34 |
+
- vae/config.json
|
| 35 |
+
- vae/diffusion_pytorch_model.safetensors
|
| 36 |
+
- vision_encoder/config.json
|
| 37 |
+
- vision_encoder/model.safetensors
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
# **Cosmos 3: Omnimodal World Models for Physical AI**
|
| 41 |
+
**[Model Collection](https://huggingface.co/collections/nvidia/cosmos3)** | **[Code](https://github.com/nvidia/cosmos)** | **[White Paper](https://research.nvidia.com/labs/cosmos-lab/cosmos3/technical-report.pdf)** | **[Website](https://research.nvidia.com/labs/cosmos-lab/cosmos3/)**
|
| 42 |
+
|
| 43 |
+
[NVIDIA Cosmos™](https://github.com/nvidia/cosmos) is a world foundation model platform designed to accelerate the development of Physical AI by enabling machines to understand, simulate, and interact with the physical world across robotics, autonomous driving, and smart space environments, including industrial and factory-scale applications.
|
| 44 |
+
|
| 45 |
+
# Model Overview: Cosmos3-Edge-Policy-DROID
|
| 46 |
+
|
| 47 |
+
## Description
|
| 48 |
+
|
| 49 |
+
Cosmos3 is a collection of Omnimodal world models capable of generating dynamic, high-quality video, image, audio, and action commands from combinations of text, image, video, and action trajectory inputs. It serves as a foundational building block for a broad range of Physical AI applications and research spanning world understanding, world generation, simulation, and embodied policy learning.
|
| 50 |
+
|
| 51 |
+
This model is ready for commercial and non-commercial use.
|
| 52 |
+
|
| 53 |
+
**Model Developer:** NVIDIA
|
| 54 |
+
|
| 55 |
+
### Model Versions
|
| 56 |
+
|
| 57 |
+
**Released on: 07/20/2026**
|
| 58 |
+
- Cosmos3-Edge:
|
| 59 |
+
- Given multimodal inputs including text, images, video, and action trajectories, generate coherent text, images, video, and action outputs for multimodal understanding, world simulation, future prediction, action reasoning, and Physical AI applications.
|
| 60 |
+
|
| 61 |
+
- Cosmos3-Edge-Policy-DROID:
|
| 62 |
+
- Given language instructions and visual observations from the DROID robot platform, generate robot action trajectories for manipulation and control tasks.
|
| 63 |
+
|
| 64 |
+
- Cosmos3-Super-Image2Video-4Step:
|
| 65 |
+
- Given one or more input images and optional text instructions, generate temporally coherent video sequences that are consistent with the provided visual content. Distilled from Cosmos3-Super-Image2Video using [Improved Distribution Matching Distillation (DMD2)](https://arxiv.org/abs/2405.14867), enabling high-quality generation in 4 steps.
|
| 66 |
+
|
| 67 |
+
- Cosmos3-Super-Text2Image-4Step:
|
| 68 |
+
- Given text input, generate high-fidelity images that are consistent with the provided description. Distilled from Cosmos3-Super-Text2Image using [Improved Distribution Matching Distillation (DMD2)](https://arxiv.org/abs/2405.14867), enabling high-quality generation in 4 steps.
|
| 69 |
+
|
| 70 |
+
**Released on: 05/31/2026**
|
| 71 |
+
- Cosmos3-Nano:
|
| 72 |
+
- Given multimodal inputs including text, images, video, audio, and action trajectories, generate coherent text, images, video, audio, and action outputs for multimodal understanding, world simulation, future prediction, action reasoning, and Physical AI applications.
|
| 73 |
+
|
| 74 |
+
- Cosmos3-Super:
|
| 75 |
+
- Given multimodal inputs including text, images, video, audio, and action trajectories, generate coherent text, images, video, audio, and action outputs for multimodal understanding, world simulation, future prediction, action reasoning, and Physical AI applications.
|
| 76 |
+
|
| 77 |
+
- Cosmos3-Nano-Policy-DROID:
|
| 78 |
+
- Given language instructions and visual observations from the DROID robot platform, generate robot action trajectories for manipulation and control tasks.
|
| 79 |
+
|
| 80 |
+
- Cosmos3-Super-Image2Video:
|
| 81 |
+
- Given one or more input images and optional text instructions, generate temporally coherent video sequences that are consistent with the provided visual content.
|
| 82 |
+
|
| 83 |
+
- Cosmos3-Super-Text2Image:
|
| 84 |
+
- Given text input, generate high-fidelity images that are consistent with the provided description.
|
| 85 |
+
|
| 86 |
+
### License
|
| 87 |
+
|
| 88 |
+
This model is released under the [OpenMDW1.1](https://openmdw.ai/license/1-1/)
|
| 89 |
+
|
| 90 |
+
### Deployment Geography
|
| 91 |
+
|
| 92 |
+
Global
|
| 93 |
+
|
| 94 |
+
### Use Case
|
| 95 |
+
|
| 96 |
+
Physical AI: Encompassing robotics, autonomous vehicles (AV), and smart space environments, including industrial and factory-scale applications.
|
| 97 |
+
|
| 98 |
+
### Release Date
|
| 99 |
+
|
| 100 |
+
Hugging Face 07/20/2026 via [https://huggingface.co/collections/nvidia/cosmos3](https://huggingface.co/collections/nvidia/cosmos3)
|
| 101 |
+
GitHub 07/20/2026 via [https://github.com/nvidia/cosmos](https://github.com/nvidia/cosmos)
|
| 102 |
+
|
| 103 |
+
## Model Architecture
|
| 104 |
+
|
| 105 |
+
**Architecture Type:** Transformer
|
| 106 |
+
|
| 107 |
+
**Network Architecture:** Mixture-of-Transformers (MoT)
|
| 108 |
+
|
| 109 |
+
Cosmos3 is an Omni-modal foundation model built on a Mixture-of-Transformers (MoT) architecture consisting of two complementary transformer towers: an autoregressive transformer for discrete token generation and a diffusion transformer for continuous multimodal generation. During inference, text is generated through standard next-token autoregressive decoding, while non-text modalities, such as images, video, audio, and actions, are synthesized through iterative denoising. This unified architecture enables Cosmos3 to model heterogeneous modalities within a single framework while preserving generation mechanisms best suited to each modality.
|
| 110 |
+
|
| 111 |
+
**This model was developed based on:** [Cosmos Framework](https://github.com/nvidia/cosmos-framework)
|
| 112 |
+
|
| 113 |
+
**Number of trainable model parameters:**
|
| 114 |
+
|
| 115 |
+
**Released on: 07/20/2026**
|
| 116 |
+
- Cosmos3-Edge: 4B
|
| 117 |
+
- Cosmos3-Edge-Policy-DROID: 4B
|
| 118 |
+
- Cosmos3-Super-Image2Video-4Step: 64B
|
| 119 |
+
- Cosmos3-Super-Text2Image-4Step: 64B
|
| 120 |
+
|
| 121 |
+
**Released on: 05/31/2026**
|
| 122 |
+
- Cosmos3-Nano: 16B
|
| 123 |
+
- Cosmos3-Super: 64B
|
| 124 |
+
- Cosmos3-Nano-Policy-DROID: 16B
|
| 125 |
+
- Cosmos3-Super-Image2Video: 64B
|
| 126 |
+
- Cosmos3-Super-Text2Image: 64B
|
| 127 |
+
|
| 128 |
+
## Input/Output Specifications
|
| 129 |
+
|
| 130 |
+
- **Generator Input**
|
| 131 |
+
- **Input Type(s)**: Text, Image, Video, Action Trajectory
|
| 132 |
+
- **Input Format(s)**:
|
| 133 |
+
- Text: String
|
| 134 |
+
- Image: jpg, png, jpeg, webp
|
| 135 |
+
- Video: mp4
|
| 136 |
+
- Action: json (1D list)
|
| 137 |
+
- **Input Parameters**:
|
| 138 |
+
- Text: One-dimensional (1D)
|
| 139 |
+
- Image: Two-dimensional (2D)
|
| 140 |
+
- Video: Three-dimensional (3D)
|
| 141 |
+
- Action trajectory: One-dimensional (1D)
|
| 142 |
+
- **Other Properties Related to Input**:
|
| 143 |
+
- For video inputs, we accept various resolutions, including 480p and 256p.
|
| 144 |
+
- Image and video inputs are RGB color (8 bits per channel, sRGB color space); grayscale inputs are not supported.
|
| 145 |
+
- Action input is a per-frame sequence of robot/agent state or control values (e.g., joint positions, gripper state, camera pose). The full input is a 2D array shaped (T, D), where T is the number of frames and D is the embodiment-specific dimensionality listed below.
|
| 146 |
+
- Input action is only supported for the DROID robot platform (8D).
|
| 147 |
+
- **Input Size and Length limits:**
|
| 148 |
+
- **Text:** 4096 tokens
|
| 149 |
+
- **Image:** 256p and 480p resolution at one of these aspect ratios (16:9, 4:3, 1:1, 3:4, 9:16)
|
| 150 |
+
- **Video:** 256p and 480p resolution at one of these aspect ratios (16:9, 4:3, 1:1, 3:4, 9:16). Max number of frames = 5.
|
| 151 |
+
- **Action:** 16 – 400 video frames
|
| 152 |
+
- **Generator Output**
|
| 153 |
+
- **Output Type(s)**: Image, video, action, text
|
| 154 |
+
- **Output Format(s)**:
|
| 155 |
+
- Image: JPG
|
| 156 |
+
- Video: MP4
|
| 157 |
+
- Action: 1D list (.json)
|
| 158 |
+
- Text: string
|
| 159 |
+
- **Output Parameters**:
|
| 160 |
+
- Image: Two-dimensional (2D)
|
| 161 |
+
- Video: Three-dimensional (3D)
|
| 162 |
+
- Action: One-dimensional (1D)
|
| 163 |
+
- Text: One-dimensional (1D)
|
| 164 |
+
- **Other Properties Related to Output**:
|
| 165 |
+
- The generated video is an MP4 file, with the resolution, frame rate, and duration specified in the input.
|
| 166 |
+
- Video generation supports durations from 5 to 400 frames, with 189 frames as the default generation duration.
|
| 167 |
+
- The generated action is only supported for the DROID robot platform (8D).
|
| 168 |
+
- Video: mp4 at the FPS specified in input
|
| 169 |
+
- Image: JPEG
|
| 170 |
+
- **Reasoner Input**
|
| 171 |
+
- **Input Type(s)**: Text, Text+Image, Text+Video
|
| 172 |
+
- **Input Format(s)**:
|
| 173 |
+
- Text: String
|
| 174 |
+
- Image: jpg, png, jpeg, webp
|
| 175 |
+
- Video: mp4
|
| 176 |
+
- **Input Parameters**:
|
| 177 |
+
- Text: One-dimensional (1D)
|
| 178 |
+
- Image: Two-dimensional (2D)
|
| 179 |
+
- Video: Three-dimensional (3D)
|
| 180 |
+
- **Other Properties Related to Input**:
|
| 181 |
+
- Video inputs are recommended at a frame rate of 4 fps.
|
| 182 |
+
- Long-context inputs supported up to 256K tokens.
|
| 183 |
+
- **Input Size and Length limits:**
|
| 184 |
+
- **Text:** Up to 256K tokens (context window).
|
| 185 |
+
- **Image:** Standard input image formats; passed as file or URL.
|
| 186 |
+
- **Video:** mp4 at the recommended 4 fps.
|
| 187 |
+
- **Reasoner Output**
|
| 188 |
+
- **Output Type(s)**: Text
|
| 189 |
+
- **Output Format(s)**:
|
| 190 |
+
- Text: string
|
| 191 |
+
- **Output Parameters**:
|
| 192 |
+
- Text: One-dimensional (1D)
|
| 193 |
+
- **Other Properties Related to Output**:
|
| 194 |
+
- Default `max_tokens=4096+` is recommended for reasoning outputs; longer outputs may be requested.
|
| 195 |
+
- Reasoning outputs may include structured chain-of-thought, 2D/3D point localization, and bounding-box coordinates for vision-based tasks.
|
| 196 |
+
|
| 197 |
+
The video content visualizes the input text description as a short animated scene, capturing key elements within the specified time constraints.
|
| 198 |
+
|
| 199 |
+
Our AI models are designed and/or optimized to run on NVIDIA GPU-accelerated systems. By leveraging NVIDIA's hardware (e.g., GPU cores) and software frameworks (e.g., CUDA libraries), the model achieves faster training and inference times compared to CPU-only solutions.
|
| 200 |
+
|
| 201 |
+
## Software Integration
|
| 202 |
+
|
| 203 |
+
**Runtime Engine(s):**
|
| 204 |
+
|
| 205 |
+
- [PyTorch](https://github.com/nvidia/cosmos3)
|
| 206 |
+
|
| 207 |
+
**Supported Hardware Microarchitecture Compatibility:**
|
| 208 |
+
|
| 209 |
+
- NVIDIA Ampere
|
| 210 |
+
- NVIDIA Blackwell
|
| 211 |
+
- NVIDIA Hopper
|
| 212 |
+
|
| 213 |
+
**Operating System(s):**
|
| 214 |
+
|
| 215 |
+
- Linux (We have not tested on other operating systems.)
|
| 216 |
+
|
| 217 |
+
**Note:** Only BF16 precision is tested. Other precisions like FP4, FP8, and FP16 are not officially supported.
|
| 218 |
+
|
| 219 |
+
The integration of foundation and fine-tuned models into AI systems requires additional testing using use-case-specific data to ensure safe and effective deployment. Following the V-model methodology, iterative testing and validation at both unit and system levels are essential to mitigate risks, meet technical and functional requirements, and ensure compliance with safety and ethical standards before deployment.
|
| 220 |
+
|
| 221 |
+
## Training, Testing, and Evaluation Datasets
|
| 222 |
+
|
| 223 |
+
### Dataset Overview
|
| 224 |
+
|
| 225 |
+
- **Total Size:** 1.3B data points
|
| 226 |
+
- **Total Number of Datasets:** 393 dataset entries
|
| 227 |
+
- **Dataset partition:** Training [100%], Testing [N/A — evaluation benchmarks used separately], Validation [N/A — evaluation benchmarks used separately]
|
| 228 |
+
- **Time period for training data collection:** 2024–2026
|
| 229 |
+
- **Time period for testing data collection:** N/A (standard public benchmarks)
|
| 230 |
+
- **Time period for validation data collection:** N/A (standard public benchmarks)
|
| 231 |
+
|
| 232 |
+
Raw data from internal and external sources is transformed into training-ready data through multiple stages of curation, filtering, and quality review. Data acquisition spans diverse multimodal sources — robotics, autonomous driving, industrial environments, indoor and outdoor scenes, varied lighting and weather conditions, camera viewpoints, object categories, and human activities — to broaden coverage across Physical AI operating environments. Automated filtering pipelines remove corrupted, duplicate, low-quality, and restricted content. Metadata analysis, heuristic rules, and model-assisted classifiers are applied during preprocessing to flag anomalous distributions and low-diversity subsets. Human review supplements automated filtering for selected datasets, benchmark construction, and targeted quality analysis. Datasets are balanced across modalities and task categories — visual reasoning, text-to-image, text-to-video, image-to-video, audio generation, video transfer, action-conditioned generation, and action command generation — to reduce overrepresentation of narrow domains. Synthetic and simulation-based augmentation supplements coverage of rare physical interactions and edge-case scenarios. Deduplication and provenance tracking are applied across the corpus. The resulting processed data is converted into model-ready tokenized or encoded representations through modality-specific preprocessors before training begins.
|
| 233 |
+
|
| 234 |
+
Training datasets passed through multiple layers of automated and manual safeguards designed to reduce the presence of harmful or policy-violating content across categories including weapons and weapons-related instructional content, criminal planning, child sexual abuse material (CSAM), non-consensual intimate imagery (NCII), sexual content involving minors, harassment, hate speech, profanity, threats and incitement to violence, self-harm or suicide-related content, and graphic violence. Data sources are reviewed for licensing compatibility, provenance, and alignment with internal data governance and safety policies before admission into training corpora. Automated filtering pipelines combine multiple detection strategies: hash-matching against known CSAM and NCII reference databases; classifier-based moderation models trained for explicit sexual content, hate speech, violence, weapons imagery, and other restricted categories; keyword and regex-based screening for criminal-planning, threats, and self-harm phrases in text data; metadata and provenance heuristics for source-level risk signals; and embedding-based anomaly detection to surface samples that fall outside expected distributions. Human review and targeted audits supplement automated filtering for selected datasets, benchmark construction, and safety-sensitive evaluation. For multimodal Physical AI data (robotics, autonomous driving, industrial scenes), additional filtering targets invalid action trajectories, physically implausible interactions, and unsafe control sequences. Synthetic and simulation-generated data are evaluated through internal validation before inclusion. Benchmark evaluations and red-team testing are applied post-training to surface remaining safety gaps across world generation, reasoning, audio, and action tasks. No large-scale data-filtering process can guarantee complete removal of all harmful content; residual risks may remain, particularly in rare edge cases or open-world deployment settings. Ongoing monitoring and dataset review continue post-release.
|
| 235 |
+
|
| 236 |
+
**Data Modality and Training Data Size**
|
| 237 |
+
|
| 238 |
+
| Modality | Reasoning Data Sample Count | Generation Data Sample Count |
|
| 239 |
+
| -------- | ------------------- | -------------------- |
|
| 240 |
+
| Text | 22M | Not Applicable |
|
| 241 |
+
| Image | 19M | 767M |
|
| 242 |
+
| Video | 1M | 348M |
|
| 243 |
+
| Audio | Not Applicable | 139M |
|
| 244 |
+
| Action | Not Applicable | 7M |
|
| 245 |
+
|
| 246 |
+
**Data Collection Method by dataset**
|
| 247 |
+
|
| 248 |
+
- Hybrid: Automatic/Sensors, Synthetic, Automated
|
| 249 |
+
|
| 250 |
+
**Labeling Method by dataset**
|
| 251 |
+
|
| 252 |
+
- Hybrid: Human, Automated
|
| 253 |
+
|
| 254 |
+
**Properties:** The training, testing, and evaluation datasets consist of diverse multimodal video, image, audio, action, synthetic, and sensor-conditioned data sourced from NVIDIA-owned data and publicly available, commercially permissive datasets. These datasets are curated to exclude known restricted content and to support building an Omni model that learns to generate and reason about dynamic physical environments across world reasoning and generation tasks.
|
| 255 |
+
|
| 256 |
+
### Public Datasets
|
| 257 |
+
|
| 258 |
+
| Dataset | Samples |
|
| 259 |
+
|---------------------------|-------------|
|
| 260 |
+
| OpenImage | 1.2M |
|
| 261 |
+
| Coyo700M | 100M |
|
| 262 |
+
| YouTube Video | 340M |
|
| 263 |
+
| UMI | 4.5M |
|
| 264 |
+
|
| 265 |
+
### Private Datasets
|
| 266 |
+
|
| 267 |
+
| Dataset | Samples |
|
| 268 |
+
|---------------------------|-------------|
|
| 269 |
+
| Egocentric | 7M |
|
| 270 |
+
| Nexar | 0.6M |
|
| 271 |
+
| AgiBot | 0.2M |
|
| 272 |
+
| HOI | 0.3M |
|
| 273 |
+
|
| 274 |
+
### Synthetic Datasets
|
| 275 |
+
|
| 276 |
+
| Dataset | Samples |
|
| 277 |
+
|-----------------------------------------|-------------|
|
| 278 |
+
| synthetic images generated using HiDream-I1 | 15M |
|
| 279 |
+
| synthetic images generated using Qwen-Image-2512 | 14M |
|
| 280 |
+
| synthetic captions generated using Qwen3-VL | 1115M |
|
| 281 |
+
|
| 282 |
+
## Evaluation Datasets
|
| 283 |
+
|
| 284 |
+
**Data Collection Method by dataset**
|
| 285 |
+
|
| 286 |
+
- Hybrid: Automatic/Sensors, Synthetic, Automated
|
| 287 |
+
|
| 288 |
+
**Labeling Method by dataset**
|
| 289 |
+
|
| 290 |
+
- Hybrid: Human, Automated
|
| 291 |
+
|
| 292 |
+
**Properties:** The training, testing, and evaluation datasets consist of diverse multimodal video, image, audio, action, synthetic, and sensor-conditioned data sourced from NVIDIA-owned data and publicly available, commercially permissive datasets. These datasets are curated to exclude known restricted content and to support building an Omni model that learns to generate and reason about dynamic physical environments across world reasoning and generation tasks.
|
| 293 |
+
|
| 294 |
+
## Benchmarks
|
| 295 |
+
|
| 296 |
+
### Action
|
| 297 |
+
|
| 298 |
+
#### RoboLab
|
| 299 |
+
|
| 300 |
+

|
| 301 |
+
|
| 302 |
+
### PBR (Performance Benchmark Reporting)
|
| 303 |
+
|
| 304 |
+
|
| 305 |
+
- Single-GPU end-to-end inference latency (seconds) for Cosmos3-Edge-Policy-DROID.
|
| 306 |
+
- Policy DROID generates an action chunk with shape `[16, 8]`: 16 future action timesteps with 8 action values per timestep.
|
| 307 |
+
- The canonical policy request uses one input image, `num_frames=17`, `fps=5`, and `action_chunk_size=16`.
|
| 308 |
+
- The 17 generated frames represent the rollout associated with the action chunk; they are not a 17-frame input video.
|
| 309 |
+
- An empty cell means not measured, not unsupported.
|
| 310 |
+
|
| 311 |
+
| Platform | Memory | Configuration | vLLM-Omni E2E Latency (s) | PyTorch E2E Latency (s) |
|
| 312 |
+
|---|---:|---|---:|---:|
|
| 313 |
+
| NVIDIA B200 SXM | 192 GB | Default | 0.99 | — |
|
| 314 |
+
| NVIDIA H100 SXM | 80 GB | Default | 1.41 | 1.25 |
|
| 315 |
+
| NVIDIA H100 NVL | 96 GB | Default | 1.37 | 1.28 |
|
| 316 |
+
| NVIDIA H20 SXM | 96 GB | Default | 3.41 | 2.92 |
|
| 317 |
+
| NVIDIA RTX PRO 6000 Blackwell Server Edition | 96 GB | Default | 1.87 | 1.65 |
|
| 318 |
+
| NVIDIA DGX Station | 128 GB unified memory | Default | 8.11 | 1.77 |
|
| 319 |
+
| NVIDIA DGX Spark | 128 GB unified memory | Default | 7.66 | 6.56 |
|
| 320 |
+
| NVIDIA Jetson AGX Thor T5000 | 128 GB | MAXN | 6.32 | — |
|
| 321 |
+
| NVIDIA Jetson T3000 | 32 GB | 1100 MHz | 8.63 | — |
|
| 322 |
+
| NVIDIA Jetson T2000 | 16 GB | 702 MHz, `THOR_NANO` | — | — |
|
| 323 |
+
|
| 324 |
+
#### Real-time vLLM-Omni Policy DROID with `[32, 8]` action chunks
|
| 325 |
+
|
| 326 |
+
These measurements use 320 × 192 observations, 33 generated rollout frames, 30 denoising steps, guidance 1.0, and a 5 Hz control rate. For a 32-action chunk, the real-time budget at 5 Hz is 6.4 seconds. End-to-end (E2E) latency includes client-side HTTP overhead, while inference latency is reported by the server. Each value follows one discarded warmup and two timed runs.
|
| 327 |
+
|
| 328 |
+
| Platform | E2E Latency | Inference Latency | RTF at 5 Hz | Real-time at 5 Hz |
|
| 329 |
+
|---|---:|---:|---:|---|
|
| 330 |
+
| NVIDIA Jetson AGX Thor T5000, 128 GB, MAXN | 2.59 s | 2.43 s | 2.47 | Yes |
|
| 331 |
+
| NVIDIA Jetson AGX Thor T4000, 64 GB, MAXN, 1530 MHz | 3.24 s | 3.14 s | 1.98 | Yes |
|
| 332 |
+
| NVIDIA Jetson Thor T3000, 32 GB, 1100 MHz (emulated) | 4.05 s | 3.84 s | 1.58 | Yes |
|
| 333 |
+
| NVIDIA Jetson Thor T2000, 16 GB, 765 MHz, `THOR_NANO` | 7.63 s | 7.38 s | 0.84 | No |
|
| 334 |
+
|
| 335 |
+
#### Real-time PyTorch Policy DROID with `[32, 8]` action chunks
|
| 336 |
+
|
| 337 |
+
These measurements use an action chunk of `[32, 8]`: 32 future action timesteps with 8 action values per timestep. They are reported separately from the `[16, 8]` Policy DROID measurements above because the action chunk, input processing, and inference configuration differ.
|
| 338 |
+
|
| 339 |
+
Real-time factor (RTF) is the available time per action chunk divided by measured end-to-end latency; values greater than or equal to 1.0 meet the corresponding real-time budget. For a 32-action chunk, the budgets are 6.4 seconds at 5 Hz and 2.133 seconds at 15 Hz.
|
| 340 |
+
|
| 341 |
+
These loopback measurements use the PyTorch Policy DROID implementation with one request at a time over a persistent connection, a 640 × 540 observation mapped to a 544 × 736 processing bucket, four UniPC denoising steps, guidance 3.0, and `conditioning_fps=15`. The table evaluates each measured latency against both the 5 Hz and 15 Hz budgets; these are not separate timing runs at the two control rates.
|
| 342 |
+
|
| 343 |
+
| Platform | Median E2E | Observed Range | Timed Requests | RTF at 5 Hz | RTF at 15 Hz | Real-time at 5 / 15 Hz |
|
| 344 |
+
|---|---:|---:|---:|---:|---:|---|
|
| 345 |
+
| NVIDIA Jetson AGX Thor T5000, 128 GB, MAXN, 1575 MHz | 1.528 s | 1.503–1.673 s | 16 | 4.19 | 1.40 | Yes / Yes |
|
| 346 |
+
| NVIDIA Jetson AGX Thor T4000, 64 GB-class, MAXN, 1530 MHz | 2.208 s | 2.148–2.425 s | 9 | 2.90 | 0.97 | Yes / No |
|
| 347 |
+
| NVIDIA Jetson Thor T3000, 32 GB, 1100 MHz (emulated) | 2.632 s | 2.595–2.687 s | 4 | 2.43 | 0.81 | Yes / No |
|
| 348 |
+
| NVIDIA Jetson Thor T2000, 16 GB, 765 MHz, `THOR_NANO` | 5.195 s | 5.176–5.224 s | 9 | 1.23 | 0.41 | Yes / No |
|
| 349 |
+
|
| 350 |
+
The T4000 median is approximately 3.5% above the 15 Hz budget. Its fastest observed request was 2.148 seconds, approximately 0.7% above the budget.
|
| 351 |
+
|
| 352 |
+
The real-time vLLM-Omni and PyTorch measurements should not be compared directly because they use different input processing, denoising configurations, runtime stacks, and measurement protocols. The T3000 results were measured on an emulated configuration with a 32 GB memory limit, 12 SMs, a 1100 MHz GPU clock cap, and CPU caps. DRAM bandwidth was not capped, so a production T3000 may be slower. The T2000 PyTorch measurement used expandable-segment memory allocation and 2.6 GB of swap, with other Cosmos containers stopped; no swap-out was observed during the audited inference calls.
|
| 353 |
+
|
| 354 |
+
## Usage
|
| 355 |
+
|
| 356 |
+
- See [Cosmos](https://github.com/nvidia/cosmos) for details.
|
| 357 |
+
|
| 358 |
+
### Quickstart
|
| 359 |
+
|
| 360 |
+
Cosmos3-Edge-Policy-DROID is served by a policy **Server** that streams actions to a **Client** driving a simulated or real robot. This example uses [`RoboLab`](https://github.com/NVlabs/RoboLab), a simulation benchmark for task-generalist policies, as the client. Start the server first, then connect the client.
|
| 361 |
+
|
| 362 |
+
#### Server
|
| 363 |
+
|
| 364 |
+
First, clone [`cosmos-framework`](https://github.com/NVIDIA/cosmos-framework):
|
| 365 |
+
|
| 366 |
+
```bash
|
| 367 |
+
git clone https://github.com/NVIDIA/cosmos-framework.git
|
| 368 |
+
cd cosmos-framework
|
| 369 |
+
```
|
| 370 |
+
|
| 371 |
+
Build the Docker image:
|
| 372 |
+
|
| 373 |
+
```bash
|
| 374 |
+
docker build \
|
| 375 |
+
-t cosmos-framework:latest \
|
| 376 |
+
.
|
| 377 |
+
```
|
| 378 |
+
|
| 379 |
+
Set your Hugging Face token and launch the container, which installs the dependencies:
|
| 380 |
+
|
| 381 |
+
```bash
|
| 382 |
+
# Set your Hugging Face token (https://huggingface.co/settings/tokens):
|
| 383 |
+
export HF_TOKEN=<your_hf_token>
|
| 384 |
+
docker run \
|
| 385 |
+
-it \
|
| 386 |
+
-e HF_HOME=/workspace/.cache/huggingface \
|
| 387 |
+
-e HF_TOKEN=$HF_TOKEN \
|
| 388 |
+
--net host \
|
| 389 |
+
--rm \
|
| 390 |
+
--runtime nvidia \
|
| 391 |
+
-v .:/workspace \
|
| 392 |
+
-v /workspace/.venv \
|
| 393 |
+
-v $HOME/.cache/huggingface:/root/.cache/huggingface \
|
| 394 |
+
cosmos-framework:latest \
|
| 395 |
+
bash -c '\
|
| 396 |
+
uv sync \
|
| 397 |
+
--all-extras \
|
| 398 |
+
--group=cu130-train \
|
| 399 |
+
--group=policy-server && \
|
| 400 |
+
exec bash; \
|
| 401 |
+
'
|
| 402 |
+
```
|
| 403 |
+
|
| 404 |
+
Inside the container, start the policy server:
|
| 405 |
+
|
| 406 |
+
```
|
| 407 |
+
python -m cosmos_framework.scripts.action_policy_server_robolab \
|
| 408 |
+
--checkpoint_path nvidia/Cosmos3-Edge-Policy-DROID \
|
| 409 |
+
--port 8000 \
|
| 410 |
+
--format-prompt-as-json True
|
| 411 |
+
```
|
| 412 |
+
|
| 413 |
+
#### Client
|
| 414 |
+
|
| 415 |
+
Clone [`RoboLab`](https://github.com/NVlabs/RoboLab):
|
| 416 |
+
|
| 417 |
+
```bash
|
| 418 |
+
git clone https://github.com/NVlabs/RoboLab.git
|
| 419 |
+
cd RoboLab
|
| 420 |
+
```
|
| 421 |
+
|
| 422 |
+
Build the Docker image:
|
| 423 |
+
|
| 424 |
+
```bash
|
| 425 |
+
./docker/build_docker.sh latest
|
| 426 |
+
```
|
| 427 |
+
|
| 428 |
+
Launch the container:
|
| 429 |
+
|
| 430 |
+
```bash
|
| 431 |
+
./docker/run_docker.sh latest
|
| 432 |
+
```
|
| 433 |
+
|
| 434 |
+
Run a task against the policy server. This opens a viewer window for real-time visualization of the simulation:
|
| 435 |
+
|
| 436 |
+
```bash
|
| 437 |
+
python policies/cosmos3/run.py \
|
| 438 |
+
--task BananaInBowlTask
|
| 439 |
+
```
|
| 440 |
+
|
| 441 |
+
To evaluate across multiple sub-environments in parallel in headless mode:
|
| 442 |
+
|
| 443 |
+
```bash
|
| 444 |
+
python policies/cosmos3/run.py \
|
| 445 |
+
--task BananaInBowlTask \
|
| 446 |
+
--num-envs 10 \
|
| 447 |
+
--headless
|
| 448 |
+
```
|
| 449 |
+
|
| 450 |
+
Example output:
|
| 451 |
+
|
| 452 |
+
<video controls width="864" height="480" src="
|
| 453 |
+
https://huggingface.co/nvidia/Cosmos3-Nano-Policy-DROID/resolve/main/assets/Pick_up_the_banana_and_place_it_in_the_bowl_0_env0_viewport.mp4"></video>
|
| 454 |
+
|
| 455 |
+
## Limitations
|
| 456 |
+
|
| 457 |
+
Cosmos3 may produce imperfect outputs in challenging scenarios. Generation artifacts include temporal inconsistency, unstable camera or object motion, imprecise physical interactions, inaccurate audio-video synchronization, and action-state drift — especially in long-horizon or high-resolution outputs. Reasoning may also be incorrect: object states, causal relationships, spatial geometry, temporal ordering, agent intent, and future outcomes can be misinferred, and complex or long-context inputs may yield hallucinated entities, inconsistent interpretations, or implausible predictions. Because the model lacks an explicit physics simulator, 3D geometry, 4D space-time evolution, object permanence, contact dynamics, and physical laws are only approximated — producing artifacts such as disappearing or morphing objects, unrealistic collisions, and physically implausible motions. Quality further degrades in out-of-distribution environments, safety-critical edge cases, and domains underrepresented in training.
|
| 458 |
+
|
| 459 |
+
Cosmos3 outputs should not be treated as physically accurate simulation, reliable ground-truth reasoning, or safety-certified decision making. Applications involving robotics control, autonomous systems, scientific simulation, or safety-critical planning require additional validation, external constraints, system-level safety analysis, and domain-specific guardrails before deployment.
|
| 460 |
+
|
| 461 |
+
## Inference
|
| 462 |
+
|
| 463 |
+
**Acceleration Engine:** [PyTorch](https://pytorch.org/)
|
| 464 |
+
|
| 465 |
+
**Test Hardware:** B200, H100, H20, RTX PRO 6000, DGX Station, DGX Spark, Jetson Thor
|
| 466 |
+
|
| 467 |
+
## Ethical Considerations
|
| 468 |
+
|
| 469 |
+
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. Developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
|
| 470 |
+
|
| 471 |
+
Please make sure you have proper rights and permissions for all input image and video content; if image or video includes people, personal health information, or intellectual property, the image or video generated will not blur or maintain proportions of image subjects included.
|
| 472 |
+
|
| 473 |
+
Users are responsible for model inputs and outputs. Users are responsible for ensuring safe integration of this model, including implementing guardrails as well as other safety mechanisms, prior to deployment.
|
| 474 |
+
|
| 475 |
+
For more detailed information on ethical considerations for this model, please see the Model Card++ [Explainability](EXPLAINABILITY.md), [Bias](BIAS.md), [Safety & Security](SAFETY.md), and [Privacy](PRIVACY.md) subcards. Please report model quality, risk, security vulnerabilities or NVIDIA AI Concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
|
SAFETY.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Safety & Security
|
| 2 |
+
|
| 3 |
+
| Field | Response |
|
| 4 |
+
| :---- | :---- |
|
| 5 |
+
| Model Application(s) | World reasoning and generation for Physical AI. |
|
| 6 |
+
| Describe the life critical impact: | This model is not a safety-certified component and must not be used as the sole basis for life-critical decisions or control without additional system-level validation, safety analysis, and safeguards. The model is not designed or tested by NVIDIA for use in any system or application where the use of or failure of such system or application developed with the model could result in injury, death, or catastrophic damage. NVIDIA is not liable to any party, in whole or in part, for any claims or damages arising from those uses. Any system or application developed with the model must include sufficient safety and redundancy features and comply with applicable legal and regulatory standards and requirements. |
|
| 7 |
+
| Description of methods implemented in data acquisition or processing, if any, to address other types of potentially harmful data in the training, testing, and validation data: | Training, evaluation, and validation datasets pass through multi-stage automated and manual filtering to reduce harmful, unsafe, restricted, or policy-violating content. Pipelines include source-licensing review, deduplication, metadata-based and classifier-based moderation, embedding-based anomaly detection, and human audits on selected datasets. For Physical AI data (robotics, autonomous driving, industrial scenes), filtering also targets invalid action trajectories, physically implausible interactions, and unsafe control sequences. Synthetic and simulation-generated data are evaluated through internal validation before inclusion. Benchmark and red-team testing surface remaining safety gaps across world generation, reasoning, audio, and action tasks. No data-filtering process can guarantee complete removal; developers are responsible for application-specific safeguards and validation before deployment. |
|
| 8 |
+
| Description of any methods implemented in data acquisition or processing, if any, to address illegal or harmful content in the training data, including, but not limited to, child sexual abuse material (CSAM) and non-consensual intimate imagery (NCII) | In addition to the general unsafe-content filtering described above, training data acquisition and preprocessing apply CSAM- and NCII-specific safeguards: hash-matching systems against known CSAM databases, classifier-based moderation models trained specifically for explicit content and NCII detection, and provenance and licensing review for sources containing human imagery. Identified content is removed at ingest, with human review and targeted audits supplementing automated filtering for selected datasets. Despite these safeguards, no large-scale data-filtering system can guarantee complete detection. Ongoing monitoring and dataset review continue post-release. |
|
| 9 |
+
| Use Case Restrictions | Use is governed by the [OpenMDW1.1](https://openmdw.ai/) |
|
| 10 |
+
| Model and dataset restrictions | The Principle of least privilege (PoLP) is applied limiting access for dataset generation and model development. Restrictions enforce dataset access during training, and dataset license constraints adhered to. |
|
| 11 |
+
| Responsible Data Handling | This AI model was developed based on our policies to ensure responsible data handling and risk mitigation. The datasets used for training have been scanned for harmful content and illegal content, consistent with our policies including scanning for Child Sexual Abuse Material (CSAM). Ongoing review and monitoring mechanisms are in place based on our policies and to maintain data integrity. |
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
{% macro render_extra_keys(json_dict, handled_keys) %}
|
| 3 |
+
{%- if json_dict is mapping %}
|
| 4 |
+
{%- for json_key in json_dict if json_key not in handled_keys %}
|
| 5 |
+
{%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) %}
|
| 6 |
+
{{- '
|
| 7 |
+
<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson | safe) ~ '</' ~ json_key ~ '>' }}
|
| 8 |
+
{%- else %}
|
| 9 |
+
{{-'
|
| 10 |
+
<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' }}
|
| 11 |
+
{%- endif %}
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{%- endif %}
|
| 14 |
+
{% endmacro %}
|
| 15 |
+
{%- set enable_thinking = enable_thinking if enable_thinking is defined else True %}
|
| 16 |
+
{%- set truncate_history_thinking = truncate_history_thinking if truncate_history_thinking is defined else True %}
|
| 17 |
+
|
| 18 |
+
{%- set ns = namespace(last_user_idx = -1) %}
|
| 19 |
+
{%- set loop_messages = messages %}
|
| 20 |
+
{%- for m in loop_messages %}
|
| 21 |
+
{%- if m["role"] == "user" %}
|
| 22 |
+
{%- set ns.last_user_idx = loop.index0 %}
|
| 23 |
+
{%- endif %}
|
| 24 |
+
{%- endfor %}
|
| 25 |
+
|
| 26 |
+
{%- if messages[0]["role"] == "system" %}
|
| 27 |
+
{%- if messages[0]["content"] is string %}
|
| 28 |
+
{%- set system_message = messages[0]["content"] %}
|
| 29 |
+
{%- else %}
|
| 30 |
+
{%- set ns = namespace(system_text="") %}
|
| 31 |
+
{%- for part in messages[0]["content"] %}
|
| 32 |
+
{%- if 'text' in part %}
|
| 33 |
+
{%- set ns.system_text = ns.system_text + part.text %}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- endfor %}
|
| 36 |
+
{%- set system_message = ns.system_text %}
|
| 37 |
+
{%- endif %}
|
| 38 |
+
|
| 39 |
+
{%- set loop_messages = messages[1:] %}
|
| 40 |
+
{%- else %}
|
| 41 |
+
{%- set system_message = "" %}
|
| 42 |
+
{%- set loop_messages = messages %}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{%- if not tools is defined %}
|
| 45 |
+
{%- set tools = [] %}
|
| 46 |
+
{%- endif %}
|
| 47 |
+
{# Recompute last_user_idx relative to loop_messages after handling system #}
|
| 48 |
+
{%- set ns = namespace(last_user_idx = -1) %}
|
| 49 |
+
{%- for m in loop_messages %}
|
| 50 |
+
{%- if m["role"] == "user" %}
|
| 51 |
+
{%- set ns.last_user_idx = loop.index0 %}
|
| 52 |
+
{%- endif %}
|
| 53 |
+
{%- endfor %}
|
| 54 |
+
{%- if system_message is defined %}
|
| 55 |
+
{{- "<|im_start|>system
|
| 56 |
+
" + system_message }}
|
| 57 |
+
{%- else %}
|
| 58 |
+
{%- if tools is iterable and tools | length > 0 %}
|
| 59 |
+
{{- "<|im_start|>system
|
| 60 |
+
" }}
|
| 61 |
+
{%- endif %}
|
| 62 |
+
{%- endif %}
|
| 63 |
+
{%- if tools is iterable and tools | length > 0 %}
|
| 64 |
+
{%- if system_message is defined and system_message | length > 0 %}
|
| 65 |
+
{{- "
|
| 66 |
+
|
| 67 |
+
" }}
|
| 68 |
+
{%- endif %}
|
| 69 |
+
{{- "# Tools
|
| 70 |
+
|
| 71 |
+
You have access to the following functions:
|
| 72 |
+
|
| 73 |
+
" }}
|
| 74 |
+
{{- "<tools>" }}
|
| 75 |
+
{%- for tool in tools %}
|
| 76 |
+
{%- if tool.function is defined %}
|
| 77 |
+
{%- set tool = tool.function %}
|
| 78 |
+
{%- endif %}
|
| 79 |
+
{{- "
|
| 80 |
+
<function>
|
| 81 |
+
<name>" ~ tool.name ~ "</name>" }}
|
| 82 |
+
{%- if tool.description is defined %}
|
| 83 |
+
{{- '
|
| 84 |
+
<description>' ~ (tool.description | trim) ~ '</description>' }}
|
| 85 |
+
{%- endif %}
|
| 86 |
+
{{- '
|
| 87 |
+
<parameters>' }}
|
| 88 |
+
{%- if tool.parameters is defined and tool.parameters is mapping and tool.parameters.properties is defined and tool.parameters.properties is mapping %}
|
| 89 |
+
{%- for param_name, param_fields in tool.parameters.properties|items %}
|
| 90 |
+
{{- '
|
| 91 |
+
<parameter>' }}
|
| 92 |
+
{{- '
|
| 93 |
+
<name>' ~ param_name ~ '</name>' }}
|
| 94 |
+
{%- if param_fields.type is defined %}
|
| 95 |
+
{{- '
|
| 96 |
+
<type>' ~ (param_fields.type | string) ~ '</type>' }}
|
| 97 |
+
{%- endif %}
|
| 98 |
+
{%- if param_fields.description is defined %}
|
| 99 |
+
{{- '
|
| 100 |
+
<description>' ~ (param_fields.description | trim) ~ '</description>' }}
|
| 101 |
+
{%- endif %}
|
| 102 |
+
{%- if param_fields.enum is defined %}
|
| 103 |
+
{{- '
|
| 104 |
+
<enum>' ~ (param_fields.enum | tojson | safe) ~ '</enum>' }}
|
| 105 |
+
{%- endif %}
|
| 106 |
+
{%- set handled_keys = ['name', 'type', 'description', 'enum'] %}
|
| 107 |
+
{{- render_extra_keys(param_fields, handled_keys) }}
|
| 108 |
+
{{- '
|
| 109 |
+
</parameter>' }}
|
| 110 |
+
{%- endfor %}
|
| 111 |
+
{%- endif %}
|
| 112 |
+
{% set handled_keys = ['type', 'properties', 'required'] %}
|
| 113 |
+
{{- render_extra_keys(tool.parameters, handled_keys) }}
|
| 114 |
+
{%- if tool.parameters is defined and tool.parameters.required is defined %}
|
| 115 |
+
{{- '
|
| 116 |
+
<required>' ~ (tool.parameters.required | tojson | safe) ~ '</required>' }}
|
| 117 |
+
{%- endif %}
|
| 118 |
+
{{- '
|
| 119 |
+
</parameters>' }}
|
| 120 |
+
{%- set handled_keys = ['type', 'name', 'description', 'parameters'] %}
|
| 121 |
+
{{- render_extra_keys(tool, handled_keys) }}
|
| 122 |
+
{{- '
|
| 123 |
+
</function>' }}
|
| 124 |
+
{%- endfor %}
|
| 125 |
+
{{- "
|
| 126 |
+
</tools>" }}
|
| 127 |
+
|
| 128 |
+
{{- '
|
| 129 |
+
|
| 130 |
+
If you choose to call a function ONLY reply in the following format with NO suffix:
|
| 131 |
+
|
| 132 |
+
<tool_call>
|
| 133 |
+
<function=example_function_name>
|
| 134 |
+
<parameter=example_parameter_1>
|
| 135 |
+
value_1
|
| 136 |
+
</parameter>
|
| 137 |
+
<parameter=example_parameter_2>
|
| 138 |
+
This is the value for the second parameter
|
| 139 |
+
that can span
|
| 140 |
+
multiple lines
|
| 141 |
+
</parameter>
|
| 142 |
+
</function>
|
| 143 |
+
</tool_call>
|
| 144 |
+
|
| 145 |
+
<IMPORTANT>
|
| 146 |
+
Reminder:
|
| 147 |
+
- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags
|
| 148 |
+
- Required parameters MUST be specified
|
| 149 |
+
- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after
|
| 150 |
+
- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls
|
| 151 |
+
</IMPORTANT>' }}
|
| 152 |
+
{%- endif %}
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
{%- if system_message is defined %}
|
| 156 |
+
{{- '<|im_end|>
|
| 157 |
+
' }}
|
| 158 |
+
{%- else %}
|
| 159 |
+
{%- if tools is iterable and tools | length > 0 %}
|
| 160 |
+
{{- '<|im_end|>
|
| 161 |
+
' }}
|
| 162 |
+
{%- endif %}
|
| 163 |
+
{%- endif %}
|
| 164 |
+
|
| 165 |
+
{%- set image_count = namespace(value=0) %}
|
| 166 |
+
{%- set video_count = namespace(value=0) %}
|
| 167 |
+
{%- for message in loop_messages %}
|
| 168 |
+
{%- if message.role == "assistant" %}
|
| 169 |
+
{# Add reasoning content in to content field for unified processing below. #}
|
| 170 |
+
{%- set text_content = namespace(text_content="") -%}
|
| 171 |
+
{%- if message.content is string %}
|
| 172 |
+
{%- set text_content.text_content = message.content %}
|
| 173 |
+
{%- else %}
|
| 174 |
+
{%- for content in message.content %}
|
| 175 |
+
{%- if 'text' in content %}
|
| 176 |
+
{%- set text_content.text_content = content.text %}
|
| 177 |
+
{%- break %}
|
| 178 |
+
{%- endif %}
|
| 179 |
+
{%- endfor %}
|
| 180 |
+
{%- endif %}
|
| 181 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is string and message.reasoning_content | trim | length > 0 %}
|
| 182 |
+
{%- set content = "<think>
|
| 183 |
+
" ~ message.reasoning_content ~ "
|
| 184 |
+
</think>
|
| 185 |
+
" ~ (text_content.text_content | default('', true)) %}
|
| 186 |
+
{%- else %}
|
| 187 |
+
{%- set content = text_content.text_content | default('', true) %}
|
| 188 |
+
{# Allow downstream logic to to take care of broken thought, only handle coherent reasoning here. #}
|
| 189 |
+
{%- if '<think>' not in content and '</think>' not in content %}
|
| 190 |
+
{%- set content = "<think></think>" ~ content %}
|
| 191 |
+
{%- else %}
|
| 192 |
+
{%- set content = content %}
|
| 193 |
+
{%- endif -%}
|
| 194 |
+
{%- endif %}
|
| 195 |
+
{%- if message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}
|
| 196 |
+
{# Assistant message has tool calls. #}
|
| 197 |
+
{{- '<|im_start|>assistant
|
| 198 |
+
' }}
|
| 199 |
+
{%- set include_content = not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}
|
| 200 |
+
{%- if content is string and content | trim | length > 0 %}
|
| 201 |
+
{%- if include_content %}
|
| 202 |
+
{{- (content | trim) ~ '
|
| 203 |
+
' -}}
|
| 204 |
+
{%- else %}
|
| 205 |
+
{%- set c = (content | string) %}
|
| 206 |
+
{%- if '</think>' in c %}
|
| 207 |
+
{# Keep only content after the last closing think. Also generation prompt causes this. #}
|
| 208 |
+
{%- set c = c.split('</think>')[-1] %}
|
| 209 |
+
{%- elif '<think>' in c %}
|
| 210 |
+
{# If <think> was opened but never closed, drop the trailing think segment #}
|
| 211 |
+
{%- set c = c.split('<think>')[0] %}
|
| 212 |
+
{%- endif %}
|
| 213 |
+
{%- set c = "<think></think>" ~ c | trim %}
|
| 214 |
+
{%- if c | length > 0 %}
|
| 215 |
+
{{- c ~ '
|
| 216 |
+
' -}}
|
| 217 |
+
{%- endif %}
|
| 218 |
+
{%- endif %}
|
| 219 |
+
{%- else %}
|
| 220 |
+
{{- "<think></think>" -}}
|
| 221 |
+
{%- endif %}
|
| 222 |
+
{%- for tool_call in message.tool_calls %}
|
| 223 |
+
{%- if tool_call.function is defined %}
|
| 224 |
+
{%- set tool_call = tool_call.function %}
|
| 225 |
+
{%- endif %}
|
| 226 |
+
{{- '<tool_call>
|
| 227 |
+
<function=' ~ tool_call.name ~ '>
|
| 228 |
+
' -}}
|
| 229 |
+
{%- if tool_call.arguments is defined %}
|
| 230 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 231 |
+
{{- '<parameter=' ~ args_name ~ '>
|
| 232 |
+
' -}}
|
| 233 |
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
| 234 |
+
{{- args_value ~ '
|
| 235 |
+
</parameter>
|
| 236 |
+
' -}}
|
| 237 |
+
{%- endfor %}
|
| 238 |
+
{%- endif %}
|
| 239 |
+
{{- '</function>
|
| 240 |
+
</tool_call>
|
| 241 |
+
' -}}
|
| 242 |
+
{%- endfor %}
|
| 243 |
+
{{- '<|im_end|>
|
| 244 |
+
' }}
|
| 245 |
+
{%- else %}
|
| 246 |
+
{# Assistant message doesn't have tool calls. #}
|
| 247 |
+
{%- if not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}
|
| 248 |
+
{{- '<|im_start|>assistant
|
| 249 |
+
' ~ (content | default('', true) | string | trim) ~ '<|im_end|>
|
| 250 |
+
' }}
|
| 251 |
+
{%- else %}
|
| 252 |
+
{%- set c = (content | default('', true) | string) %}
|
| 253 |
+
{%- if '<think>' in c and '</think>' in c %}
|
| 254 |
+
{%- set c = "<think></think>" ~ c.split('</think>')[-1] %}
|
| 255 |
+
{%- endif %}
|
| 256 |
+
{%- set c = c | trim %}
|
| 257 |
+
{%- if c | length > 0 %}
|
| 258 |
+
{{- '<|im_start|>assistant
|
| 259 |
+
' ~ c ~ '<|im_end|>
|
| 260 |
+
' }}
|
| 261 |
+
{%- else %}
|
| 262 |
+
{{- '<|im_start|>assistant
|
| 263 |
+
<|im_end|>
|
| 264 |
+
' }}
|
| 265 |
+
{%- endif %}
|
| 266 |
+
{%- endif %}
|
| 267 |
+
{%- endif %}
|
| 268 |
+
{%- elif message.role == "user" or message.role == "system" %}
|
| 269 |
+
{{- '<|im_start|>' + message.role + '
|
| 270 |
+
' }}
|
| 271 |
+
{%- if message.content is string %}
|
| 272 |
+
{{- message.content }}
|
| 273 |
+
{%- else %}
|
| 274 |
+
{%- for content in message.content %}
|
| 275 |
+
{%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
|
| 276 |
+
{%- set image_count.value = image_count.value + 1 %}
|
| 277 |
+
{%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
|
| 278 |
+
<|vision_start|><|image_pad|><|vision_end|>
|
| 279 |
+
{%- elif content.type == 'video' or 'video' in content %}
|
| 280 |
+
{%- set video_count.value = video_count.value + 1 %}
|
| 281 |
+
{%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
|
| 282 |
+
<|vision_start|><|video_pad|><|vision_end|>
|
| 283 |
+
{%- elif 'text' in content %}
|
| 284 |
+
{{- content.text }}
|
| 285 |
+
{%- endif %}
|
| 286 |
+
{%- endfor %}
|
| 287 |
+
{%- endif %}
|
| 288 |
+
{{- '<|im_end|>
|
| 289 |
+
' }}
|
| 290 |
+
{%- elif message.role == "tool" %}
|
| 291 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 292 |
+
{{- '<|im_start|>user
|
| 293 |
+
' }}
|
| 294 |
+
{%- endif %}
|
| 295 |
+
{{- '<tool_response>
|
| 296 |
+
' }}
|
| 297 |
+
{{- message.content }}
|
| 298 |
+
{{- '
|
| 299 |
+
</tool_response>
|
| 300 |
+
' }}
|
| 301 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 302 |
+
{{- '<|im_end|>
|
| 303 |
+
' }}
|
| 304 |
+
{%- elif loop.last %}
|
| 305 |
+
{{- '<|im_end|>
|
| 306 |
+
' }}
|
| 307 |
+
{%- endif %}
|
| 308 |
+
{%- else %}
|
| 309 |
+
{{- '<|im_start|>' + message.role + '
|
| 310 |
+
' + message.content + '<|im_end|>
|
| 311 |
+
' }}
|
| 312 |
+
{%- endif %}
|
| 313 |
+
{%- endfor %}
|
| 314 |
+
|
| 315 |
+
{%- if add_generation_prompt %}
|
| 316 |
+
{%- if enable_thinking %}
|
| 317 |
+
{{- '<|im_start|>assistant
|
| 318 |
+
<think>
|
| 319 |
+
' }}
|
| 320 |
+
{%- else %}
|
| 321 |
+
{{- '<|im_start|>assistant
|
| 322 |
+
<think></think>' }}
|
| 323 |
+
{%- endif %}
|
| 324 |
+
{%- endif %}
|
checkpoint.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"config_file": null,
|
| 3 |
+
"experiment": null,
|
| 4 |
+
"experiment_overrides": null,
|
| 5 |
+
"policy": {
|
| 6 |
+
"action_chunk_size": 32,
|
| 7 |
+
"conditioning_fps": 15.0,
|
| 8 |
+
"domain_name": "droid_lerobot"
|
| 9 |
+
}
|
| 10 |
+
}
|
config.json
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"allow_patterns_overrides": [
|
| 3 |
+
"*/*.safetensors"
|
| 4 |
+
],
|
| 5 |
+
"architectures": [
|
| 6 |
+
"Cosmos3ForConditionalGeneration"
|
| 7 |
+
],
|
| 8 |
+
"image_token_id": 19,
|
| 9 |
+
"model": {
|
| 10 |
+
"_recursive_": false,
|
| 11 |
+
"_target": "omni_mot_model",
|
| 12 |
+
"config": {
|
| 13 |
+
"_type": "omni_mot_model_config",
|
| 14 |
+
"action_gen": true,
|
| 15 |
+
"activation_checkpointing": {
|
| 16 |
+
"_type": "activation_checkpointing_config",
|
| 17 |
+
"determinism_check": "default",
|
| 18 |
+
"mode": "full",
|
| 19 |
+
"preserve_rng_state": true,
|
| 20 |
+
"save_ops_regex": [
|
| 21 |
+
"fmha"
|
| 22 |
+
]
|
| 23 |
+
},
|
| 24 |
+
"causal_training_strategy": "none",
|
| 25 |
+
"compile": {
|
| 26 |
+
"_type": "compile_config",
|
| 27 |
+
"compile_dynamic": true,
|
| 28 |
+
"compiled_region": "language",
|
| 29 |
+
"coordinate_descent_tuning": false,
|
| 30 |
+
"enabled": false,
|
| 31 |
+
"max_autotune_pointwise": false,
|
| 32 |
+
"use_cuda_graphs": false
|
| 33 |
+
},
|
| 34 |
+
"diffusion_expert_config": {
|
| 35 |
+
"_type": "diffusion_expert_config",
|
| 36 |
+
"base_fps": 24,
|
| 37 |
+
"enable_fps_modulation": true,
|
| 38 |
+
"load_weights_from_pretrained": false,
|
| 39 |
+
"max_vae_latent_side_after_patchify": 20,
|
| 40 |
+
"patch_spatial": 2,
|
| 41 |
+
"sound_base_temporal_compression_factor": null,
|
| 42 |
+
"timestep_range": 1.0,
|
| 43 |
+
"unified_3d_mrope_reset_spatial_ids": true,
|
| 44 |
+
"unified_3d_mrope_temporal_modality_margin": 15000,
|
| 45 |
+
"vision_temporal_position_mode": "latent_index"
|
| 46 |
+
},
|
| 47 |
+
"ema": {
|
| 48 |
+
"_type": "ema_config",
|
| 49 |
+
"enabled": false,
|
| 50 |
+
"iteration_shift": 0,
|
| 51 |
+
"rate": 0.1
|
| 52 |
+
},
|
| 53 |
+
"enable_input_bias": true,
|
| 54 |
+
"exclude_reasoner_weights_from_checkpoint": false,
|
| 55 |
+
"fixed_step_sampler_config": null,
|
| 56 |
+
"input_caption_key": "ai_caption",
|
| 57 |
+
"input_image_key": "images",
|
| 58 |
+
"input_video_key": "video",
|
| 59 |
+
"joint_attn_implementation": "two_way",
|
| 60 |
+
"latent_downsample_factor": 16,
|
| 61 |
+
"lbl": {
|
| 62 |
+
"_type": "lbl_config",
|
| 63 |
+
"coeff_gen": null,
|
| 64 |
+
"coeff_und": null,
|
| 65 |
+
"method": "local"
|
| 66 |
+
},
|
| 67 |
+
"log_enc_time_every_n": 100,
|
| 68 |
+
"lora_alpha": 32,
|
| 69 |
+
"lora_enabled": false,
|
| 70 |
+
"lora_rank": 16,
|
| 71 |
+
"lora_target_modules": "q_proj_moe_gen,k_proj_moe_gen,v_proj_moe_gen,o_proj_moe_gen",
|
| 72 |
+
"max_action_dim": 64,
|
| 73 |
+
"max_num_tokens_after_packing": -1,
|
| 74 |
+
"natten_parameter_list": null,
|
| 75 |
+
"net": null,
|
| 76 |
+
"num_embodiment_domains": 32,
|
| 77 |
+
"parallelism": {
|
| 78 |
+
"_type": "parallelism_config",
|
| 79 |
+
"attention_io_layout": "sequence_sharded",
|
| 80 |
+
"cfg_parallel_shard_degree": 1,
|
| 81 |
+
"context_parallel_shard_degree": 1,
|
| 82 |
+
"data_parallel_replicate_degree": 1,
|
| 83 |
+
"data_parallel_shard_degree": 8,
|
| 84 |
+
"enable_inference_mode": false,
|
| 85 |
+
"fsdp_master_dtype": "float32"
|
| 86 |
+
},
|
| 87 |
+
"precision": "bfloat16",
|
| 88 |
+
"rectified_flow_inference_config": {
|
| 89 |
+
"_type": "rectified_flow_inference_config",
|
| 90 |
+
"num_train_timesteps": 1000,
|
| 91 |
+
"scheduler_type": "unipc",
|
| 92 |
+
"shift": 1,
|
| 93 |
+
"use_dynamic_shifting": false
|
| 94 |
+
},
|
| 95 |
+
"rectified_flow_training_config": {
|
| 96 |
+
"_type": "rectified_flow_training_config",
|
| 97 |
+
"action_loss_weight": 10.0,
|
| 98 |
+
"image_loss_scale": null,
|
| 99 |
+
"independent_action_schedule": false,
|
| 100 |
+
"independent_sound_schedule": false,
|
| 101 |
+
"loss_scale": 10.0,
|
| 102 |
+
"normalize_loss_by_active": false,
|
| 103 |
+
"shift": {
|
| 104 |
+
"256": 3,
|
| 105 |
+
"480": 5
|
| 106 |
+
},
|
| 107 |
+
"shift_action": null,
|
| 108 |
+
"shift_sound": null,
|
| 109 |
+
"sound_loss_scale": null,
|
| 110 |
+
"train_time_action_distribution": "logitnormal",
|
| 111 |
+
"train_time_image_distribution": "logitnormal",
|
| 112 |
+
"train_time_sound_distribution": "logitnormal",
|
| 113 |
+
"train_time_video_distribution": "waver",
|
| 114 |
+
"train_time_weight": "uniform",
|
| 115 |
+
"use_discrete_rf": false,
|
| 116 |
+
"use_dynamic_shift": false
|
| 117 |
+
},
|
| 118 |
+
"resolution": "480",
|
| 119 |
+
"sound_dim": null,
|
| 120 |
+
"sound_gen": false,
|
| 121 |
+
"sound_latent_fps": 25,
|
| 122 |
+
"sound_tokenizer": null,
|
| 123 |
+
"state_ch": 48,
|
| 124 |
+
"state_t": 300,
|
| 125 |
+
"tokenizer": {
|
| 126 |
+
"_target": "wan2pt2_vae_interface",
|
| 127 |
+
"bucket_name": "",
|
| 128 |
+
"causal": true,
|
| 129 |
+
"chunk_duration": 93,
|
| 130 |
+
"encode_chunk_frames": {
|
| 131 |
+
"256": 68,
|
| 132 |
+
"480": 24,
|
| 133 |
+
"720": 12
|
| 134 |
+
},
|
| 135 |
+
"encode_exact_durations": [
|
| 136 |
+
33
|
| 137 |
+
],
|
| 138 |
+
"keep_decoder_cache": false,
|
| 139 |
+
"object_store_credential_path_pretrained": "",
|
| 140 |
+
"spatial_compression_factor": 16,
|
| 141 |
+
"temporal_compression_factor": 4,
|
| 142 |
+
"use_streaming_encode": false,
|
| 143 |
+
"vae_path": "pretrained/tokenizers/video/wan2pt2/Wan2.2_VAE.pth"
|
| 144 |
+
},
|
| 145 |
+
"video_temporal_causal": false,
|
| 146 |
+
"vision_gen": true,
|
| 147 |
+
"vlm_config": {
|
| 148 |
+
"_type": "vlm_config",
|
| 149 |
+
"layer_module": null,
|
| 150 |
+
"model_instance": {
|
| 151 |
+
"_target": "nemotron3_dense_vl_text_for_causal_lm",
|
| 152 |
+
"config": {
|
| 153 |
+
"_target": "create_vlm_config",
|
| 154 |
+
"base_config": {
|
| 155 |
+
"_target": "nemotron3_dense_vl_mot_config_from_json_file",
|
| 156 |
+
"json_file": "cosmos3://vfm/models/vlm/nemotron_3_dense_vl/configs/Nemotron-2B-Dense-VL.json"
|
| 157 |
+
},
|
| 158 |
+
"qk_norm_for_text": false,
|
| 159 |
+
"use_und_k_norm_for_gen": true
|
| 160 |
+
}
|
| 161 |
+
},
|
| 162 |
+
"model_name": "nvidia/Cosmos3-Edge-Policy-DROID",
|
| 163 |
+
"pretrained_weights": {
|
| 164 |
+
"_type": "pretrained_weights_config",
|
| 165 |
+
"backbone_path": "",
|
| 166 |
+
"checkpoint_format": "nemotron_3_dense_vl",
|
| 167 |
+
"credentials_path": "",
|
| 168 |
+
"enable_gcs_patch_in_boto3": false,
|
| 169 |
+
"enabled": false
|
| 170 |
+
},
|
| 171 |
+
"qk_norm": false,
|
| 172 |
+
"safetensors_path": "",
|
| 173 |
+
"tie_word_embeddings": false,
|
| 174 |
+
"tokenizer": {
|
| 175 |
+
"_target": "build_processor_lazy",
|
| 176 |
+
"config_variant": "hf",
|
| 177 |
+
"repository": null,
|
| 178 |
+
"revision": null,
|
| 179 |
+
"subdir": "",
|
| 180 |
+
"tokenizer_type": "nvidia/Cosmos3-Edge-Policy-DROID"
|
| 181 |
+
},
|
| 182 |
+
"use_system_prompt": false
|
| 183 |
+
}
|
| 184 |
+
}
|
| 185 |
+
},
|
| 186 |
+
"model_type": "cosmos3_omni",
|
| 187 |
+
"projector_config": {
|
| 188 |
+
"input_hidden_size": 1152,
|
| 189 |
+
"merger_intermediate_size": 11520,
|
| 190 |
+
"model_type": "cosmos3_edge_projector",
|
| 191 |
+
"out_hidden_size": 2048,
|
| 192 |
+
"spatial_merge_size": 2,
|
| 193 |
+
"use_postshuffle_norm": false
|
| 194 |
+
},
|
| 195 |
+
"projector_hidden_size": 11520,
|
| 196 |
+
"text_config": {
|
| 197 |
+
"attention_bias": false,
|
| 198 |
+
"attention_dropout": 0.0,
|
| 199 |
+
"dtype": "bfloat16",
|
| 200 |
+
"eos_token_id": 11,
|
| 201 |
+
"head_dim": 128,
|
| 202 |
+
"hidden_act": "relu2",
|
| 203 |
+
"hidden_size": 2048,
|
| 204 |
+
"initializer_range": 0.02,
|
| 205 |
+
"intermediate_size": 9216,
|
| 206 |
+
"max_position_embeddings": 131072,
|
| 207 |
+
"mlp_bias": false,
|
| 208 |
+
"model_type": "cosmos3_edge_text",
|
| 209 |
+
"num_attention_heads": 16,
|
| 210 |
+
"num_hidden_layers": 28,
|
| 211 |
+
"num_key_value_heads": 8,
|
| 212 |
+
"rms_norm_eps": 1e-05,
|
| 213 |
+
"rope_parameters": {
|
| 214 |
+
"mrope_section": [
|
| 215 |
+
24,
|
| 216 |
+
20,
|
| 217 |
+
20
|
| 218 |
+
],
|
| 219 |
+
"rope_theta": 100000000,
|
| 220 |
+
"rope_type": "default"
|
| 221 |
+
},
|
| 222 |
+
"use_cache": true,
|
| 223 |
+
"vocab_size": 131072
|
| 224 |
+
},
|
| 225 |
+
"tie_word_embeddings": false,
|
| 226 |
+
"transformers_version": "5.14.0.dev0",
|
| 227 |
+
"video_token_id": 18,
|
| 228 |
+
"vision_config": {
|
| 229 |
+
"attention_dropout": 0.0,
|
| 230 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 231 |
+
"hidden_size": 1152,
|
| 232 |
+
"intermediate_size": 4304,
|
| 233 |
+
"layer_norm_eps": 1e-06,
|
| 234 |
+
"model_type": "cosmos3_edge_vision",
|
| 235 |
+
"num_attention_heads": 16,
|
| 236 |
+
"num_channels": 3,
|
| 237 |
+
"num_hidden_layers": 27,
|
| 238 |
+
"num_patches": 256,
|
| 239 |
+
"patch_size": 16,
|
| 240 |
+
"spatial_merge_size": 2
|
| 241 |
+
},
|
| 242 |
+
"vision_end_token_id": 21,
|
| 243 |
+
"vision_start_token_id": 20
|
| 244 |
+
}
|
convert_cosmos3_to_diffusers.py
ADDED
|
@@ -0,0 +1,1286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
| 3 |
+
# SPDX-License-Identifier: Apache-2.0
|
| 4 |
+
"""
|
| 5 |
+
Convert a Cosmos3 DCP checkpoint to diffusers format.
|
| 6 |
+
|
| 7 |
+
Example:
|
| 8 |
+
CUDA_VISIBLE_DEVICES=0 python scripts/convert_cosmos3_to_diffusers.py \
|
| 9 |
+
--checkpoint-path Cosmos3-Nano \
|
| 10 |
+
--output converted/cosmos3-nano-pipeline \
|
| 11 |
+
--save-pipeline
|
| 12 |
+
|
| 13 |
+
A raw Cosmos3 Edge DCP checkpoint is detected automatically. The Edge path
|
| 14 |
+
loads its EMA denoiser weights directly from DCP, packages the matching
|
| 15 |
+
Wan 2.2 VAE, and writes a shared-weight Omni checkpoint: the Diffusers
|
| 16 |
+
transformer is reused by the reasoner and only the missing vision tower is
|
| 17 |
+
stored separately.
|
| 18 |
+
|
| 19 |
+
Edge checkpoints trained with action generation are also detected
|
| 20 |
+
automatically: the `action2llm`/`llm2action` domain-aware projections and the
|
| 21 |
+
action modality embedding are exported onto the transformer's
|
| 22 |
+
`action_proj_in`/`action_proj_out`/`action_modality_embed` modules, with
|
| 23 |
+
`action_dim` and `num_embodiment_domains` derived from the DCP tensor shapes.
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
import argparse
|
| 27 |
+
import contextlib
|
| 28 |
+
import json
|
| 29 |
+
import pathlib
|
| 30 |
+
import re
|
| 31 |
+
import shutil
|
| 32 |
+
|
| 33 |
+
import torch
|
| 34 |
+
|
| 35 |
+
from diffusers.models.autoencoders.autoencoder_cosmos3_audio import Cosmos3AVAEAudioTokenizer
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
DEFAULT_SOUND_TOKENIZER_CONFIG = {
|
| 39 |
+
"sampling_rate": 48000,
|
| 40 |
+
"vocoder_input_dim": 64,
|
| 41 |
+
"dec_dim": 320,
|
| 42 |
+
"dec_c_mults": [1, 2, 4, 8, 16],
|
| 43 |
+
"dec_strides": [2, 4, 5, 6, 8],
|
| 44 |
+
"dec_out_channels": 2,
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
COSMOS3_EDGE_REASONER = "nvidia/Cosmos3-Edge-Reasoner"
|
| 49 |
+
COSMOS3_EDGE_REASONER_REVISION = "590c1c0f1cd7146162d478a2180556055c1a252b"
|
| 50 |
+
COSMOS3_EDGE_VAE = "Wan-AI/Wan2.2-TI2V-5B-Diffusers"
|
| 51 |
+
|
| 52 |
+
# Keep the Transformers metadata, but avoid copying its two source shards:
|
| 53 |
+
# Edge's language tower is already byte-identical to the base part of the
|
| 54 |
+
# converted Diffusers transformer. Only the visual tower and projector have
|
| 55 |
+
# to be extracted from source weights.
|
| 56 |
+
COSMOS3_EDGE_REASONER_METADATA_FILES = (
|
| 57 |
+
"chat_template.jinja",
|
| 58 |
+
"config.json",
|
| 59 |
+
"generation_config.json",
|
| 60 |
+
"preprocessor_config.json",
|
| 61 |
+
"special_tokens_map.json",
|
| 62 |
+
"tokenizer.json",
|
| 63 |
+
"tokenizer_config.json",
|
| 64 |
+
"video_preprocessor_config.json",
|
| 65 |
+
)
|
| 66 |
+
COSMOS3_EDGE_REASONER_INDEX_FILE = "model.safetensors.index.json"
|
| 67 |
+
COSMOS3_EDGE_REASONER_VISION_SHARD = "00000.safetensors"
|
| 68 |
+
COSMOS3_EDGE_REASONER_FILES = (
|
| 69 |
+
*COSMOS3_EDGE_REASONER_METADATA_FILES,
|
| 70 |
+
COSMOS3_EDGE_REASONER_INDEX_FILE,
|
| 71 |
+
COSMOS3_EDGE_REASONER_VISION_SHARD,
|
| 72 |
+
)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
_EDGE_ATTN_KEY_REMAP = (
|
| 76 |
+
(".q_proj_moe_gen.", ".add_q_proj."),
|
| 77 |
+
(".k_proj_moe_gen.", ".add_k_proj."),
|
| 78 |
+
(".v_proj_moe_gen.", ".add_v_proj."),
|
| 79 |
+
(".o_proj_moe_gen.", ".to_add_out."),
|
| 80 |
+
(".q_norm_moe_gen.", ".norm_added_q."),
|
| 81 |
+
(".k_norm_moe_gen.", ".norm_added_k."),
|
| 82 |
+
(".q_proj.", ".to_q."),
|
| 83 |
+
(".k_proj.", ".to_k."),
|
| 84 |
+
(".v_proj.", ".to_v."),
|
| 85 |
+
(".o_proj.", ".to_out."),
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
_TIME_EMBEDDER_REMAP = {
|
| 89 |
+
"mlp.0.weight": "linear_1.weight",
|
| 90 |
+
"mlp.0.bias": "linear_1.bias",
|
| 91 |
+
"mlp.2.weight": "linear_2.weight",
|
| 92 |
+
"mlp.2.bias": "linear_2.bias",
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
def _get_config_value(*configs, name, default=None):
|
| 97 |
+
for config in configs:
|
| 98 |
+
if config is None:
|
| 99 |
+
continue
|
| 100 |
+
if hasattr(config, name):
|
| 101 |
+
value = getattr(config, name)
|
| 102 |
+
if value is not None:
|
| 103 |
+
return value
|
| 104 |
+
if isinstance(config, dict) and config.get(name) is not None:
|
| 105 |
+
return config[name]
|
| 106 |
+
return default
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
def _find_edge_dcp_model_dir(checkpoint_path: pathlib.Path) -> pathlib.Path | None:
|
| 110 |
+
candidates = [checkpoint_path, checkpoint_path / "model"]
|
| 111 |
+
if checkpoint_path.is_dir():
|
| 112 |
+
candidates.extend(metadata_path.parent for metadata_path in checkpoint_path.glob("iter_*/model/.metadata"))
|
| 113 |
+
candidates.extend(metadata_path.parent for metadata_path in checkpoint_path.glob("*/iter_*/model/.metadata"))
|
| 114 |
+
|
| 115 |
+
for candidate in candidates:
|
| 116 |
+
if not (candidate / ".metadata").is_file():
|
| 117 |
+
continue
|
| 118 |
+
|
| 119 |
+
from torch.distributed.checkpoint.filesystem import FileSystemReader
|
| 120 |
+
|
| 121 |
+
state_dict_metadata = FileSystemReader(str(candidate)).read_metadata().state_dict_metadata
|
| 122 |
+
has_edge_mlp = "net.language_model.model.layers.0.mlp.up_proj.weight" in state_dict_metadata
|
| 123 |
+
has_qwen_mlp = "net.language_model.model.layers.0.mlp.gate_proj.weight" in state_dict_metadata
|
| 124 |
+
if has_edge_mlp and not has_qwen_mlp:
|
| 125 |
+
return candidate
|
| 126 |
+
|
| 127 |
+
return None
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
def _remap_edge_dcp_key(key: str) -> str:
|
| 131 |
+
if key.startswith("language_model."):
|
| 132 |
+
key = key.removeprefix("language_model.").removeprefix("model.")
|
| 133 |
+
for old, new in _EDGE_ATTN_KEY_REMAP:
|
| 134 |
+
if old in key:
|
| 135 |
+
return key.replace(old, new)
|
| 136 |
+
return key
|
| 137 |
+
if key.startswith("vae2llm."):
|
| 138 |
+
return f"proj_in.{key.removeprefix('vae2llm.')}"
|
| 139 |
+
if key.startswith("llm2vae."):
|
| 140 |
+
return f"proj_out.{key.removeprefix('llm2vae.')}"
|
| 141 |
+
if key.startswith("time_embedder."):
|
| 142 |
+
time_embedder_key = key.removeprefix("time_embedder.")
|
| 143 |
+
return f"time_embedder.{_TIME_EMBEDDER_REMAP[time_embedder_key]}"
|
| 144 |
+
if key.startswith("action2llm."):
|
| 145 |
+
return f"action_proj_in.{key.removeprefix('action2llm.')}"
|
| 146 |
+
if key.startswith("llm2action."):
|
| 147 |
+
return f"action_proj_out.{key.removeprefix('llm2action.')}"
|
| 148 |
+
if key == "action_modality_embed":
|
| 149 |
+
return key
|
| 150 |
+
raise ValueError(f"Unsupported Cosmos3 Edge DCP key: {key!r}.")
|
| 151 |
+
|
| 152 |
+
|
| 153 |
+
def _detect_edge_action_config(checkpoint_path: pathlib.Path, use_ema: bool) -> dict | None:
|
| 154 |
+
from torch.distributed.checkpoint.filesystem import FileSystemReader
|
| 155 |
+
|
| 156 |
+
prefix = "net_ema." if use_ema else "net."
|
| 157 |
+
metadata = FileSystemReader(str(checkpoint_path)).read_metadata().state_dict_metadata
|
| 158 |
+
action_suffixes = (
|
| 159 |
+
"action2llm.fc.weight",
|
| 160 |
+
"action2llm.bias.weight",
|
| 161 |
+
"llm2action.fc.weight",
|
| 162 |
+
"llm2action.bias.weight",
|
| 163 |
+
"action_modality_embed",
|
| 164 |
+
)
|
| 165 |
+
action_metadata = {suffix: metadata.get(f"{prefix}{suffix}") for suffix in action_suffixes}
|
| 166 |
+
present_suffixes = [suffix for suffix, value in action_metadata.items() if value is not None]
|
| 167 |
+
if not present_suffixes:
|
| 168 |
+
return None
|
| 169 |
+
|
| 170 |
+
# `action2llm`/`llm2action` are DomainAwareLinear modules: `fc` is an
|
| 171 |
+
# Embedding(num_domains, output_size * input_size) and `bias` an
|
| 172 |
+
# Embedding(num_domains, output_size), so the shapes fix every config value.
|
| 173 |
+
missing_suffixes = [suffix for suffix, value in action_metadata.items() if value is None]
|
| 174 |
+
if missing_suffixes:
|
| 175 |
+
raise ValueError(
|
| 176 |
+
f"Cosmos3 Edge {'EMA' if use_ema else 'regular'} action weights are incomplete: "
|
| 177 |
+
f"present={present_suffixes}, missing={missing_suffixes}."
|
| 178 |
+
)
|
| 179 |
+
|
| 180 |
+
action_shapes = {suffix: tuple(value.size) for suffix, value in action_metadata.items()}
|
| 181 |
+
expected_ranks = {
|
| 182 |
+
"action2llm.fc.weight": 2,
|
| 183 |
+
"action2llm.bias.weight": 2,
|
| 184 |
+
"llm2action.fc.weight": 2,
|
| 185 |
+
"llm2action.bias.weight": 2,
|
| 186 |
+
"action_modality_embed": 1,
|
| 187 |
+
}
|
| 188 |
+
invalid_shapes = {
|
| 189 |
+
suffix: shape for suffix, shape in action_shapes.items() if len(shape) != expected_ranks[suffix]
|
| 190 |
+
}
|
| 191 |
+
if invalid_shapes:
|
| 192 |
+
raise ValueError(f"Cosmos3 Edge action tensors have invalid ranks: {invalid_shapes}.")
|
| 193 |
+
|
| 194 |
+
num_embodiment_domains, proj_in_flat = action_shapes["action2llm.fc.weight"]
|
| 195 |
+
proj_in_domains, hidden_size = action_shapes["action2llm.bias.weight"]
|
| 196 |
+
proj_out_domains, proj_out_flat = action_shapes["llm2action.fc.weight"]
|
| 197 |
+
proj_out_bias_domains, action_dim = action_shapes["llm2action.bias.weight"]
|
| 198 |
+
(action_modality_embed_size,) = action_shapes["action_modality_embed"]
|
| 199 |
+
domain_counts = {
|
| 200 |
+
"action2llm.fc.weight": num_embodiment_domains,
|
| 201 |
+
"action2llm.bias.weight": proj_in_domains,
|
| 202 |
+
"llm2action.fc.weight": proj_out_domains,
|
| 203 |
+
"llm2action.bias.weight": proj_out_bias_domains,
|
| 204 |
+
}
|
| 205 |
+
if len(set(domain_counts.values())) != 1:
|
| 206 |
+
raise ValueError(f"Cosmos3 Edge action tensors disagree on embodiment domains: {domain_counts}.")
|
| 207 |
+
if min(num_embodiment_domains, hidden_size, action_dim) < 1:
|
| 208 |
+
raise ValueError(f"Cosmos3 Edge action tensor dimensions must be positive: {action_shapes}.")
|
| 209 |
+
|
| 210 |
+
expected_projection_size = hidden_size * action_dim
|
| 211 |
+
if proj_in_flat != expected_projection_size or proj_out_flat != expected_projection_size:
|
| 212 |
+
raise ValueError(
|
| 213 |
+
"Cosmos3 Edge action projection shapes are inconsistent: "
|
| 214 |
+
f"action2llm.fc.weight={action_shapes['action2llm.fc.weight']}, "
|
| 215 |
+
f"llm2action.fc.weight={action_shapes['llm2action.fc.weight']}; both must factor into "
|
| 216 |
+
f"hidden_size={hidden_size} x action_dim={action_dim}."
|
| 217 |
+
)
|
| 218 |
+
if action_modality_embed_size != hidden_size:
|
| 219 |
+
raise ValueError(
|
| 220 |
+
"Cosmos3 Edge action modality embedding has the wrong width: "
|
| 221 |
+
f"action_modality_embed={action_shapes['action_modality_embed']}, expected ({hidden_size},)."
|
| 222 |
+
)
|
| 223 |
+
|
| 224 |
+
return {
|
| 225 |
+
"action_gen": True,
|
| 226 |
+
"action_dim": action_dim,
|
| 227 |
+
"num_embodiment_domains": num_embodiment_domains,
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
def _build_edge_transformer(dtype: torch.dtype, action_config: dict | None = None):
|
| 232 |
+
import inspect
|
| 233 |
+
|
| 234 |
+
from accelerate import init_empty_weights
|
| 235 |
+
|
| 236 |
+
from diffusers.models.transformers.transformer_cosmos3 import Cosmos3OmniTransformer
|
| 237 |
+
|
| 238 |
+
action_kwargs = dict(action_config or {})
|
| 239 |
+
init_params = inspect.signature(Cosmos3OmniTransformer.__init__).parameters
|
| 240 |
+
edge_required_params = {
|
| 241 |
+
"hidden_act",
|
| 242 |
+
"qk_norm_for_text",
|
| 243 |
+
"backbone_type",
|
| 244 |
+
"temporal_compression_factor",
|
| 245 |
+
}
|
| 246 |
+
action_required_params = set(action_kwargs)
|
| 247 |
+
missing_edge_params = sorted(edge_required_params - set(init_params))
|
| 248 |
+
missing_action_params = sorted(action_required_params - set(init_params))
|
| 249 |
+
if missing_edge_params or missing_action_params:
|
| 250 |
+
missing_descriptions = []
|
| 251 |
+
if missing_edge_params:
|
| 252 |
+
missing_descriptions.append(f"Edge backbone parameters {missing_edge_params}")
|
| 253 |
+
if missing_action_params:
|
| 254 |
+
missing_descriptions.append(f"action-generation parameters {missing_action_params}")
|
| 255 |
+
raise RuntimeError(
|
| 256 |
+
"The installed diffusers build cannot construct this Cosmos3 Edge checkpoint; it is missing "
|
| 257 |
+
f"{', '.join(missing_descriptions)}. Use a build that combines the Edge Nemotron-dense backbone "
|
| 258 |
+
"with upstream action generation support (commit bcc20e452)."
|
| 259 |
+
)
|
| 260 |
+
|
| 261 |
+
with init_empty_weights():
|
| 262 |
+
transformer = Cosmos3OmniTransformer(
|
| 263 |
+
**action_kwargs,
|
| 264 |
+
attention_bias=False,
|
| 265 |
+
attention_dropout=0.0,
|
| 266 |
+
base_fps=24,
|
| 267 |
+
enable_fps_modulation=True,
|
| 268 |
+
head_dim=128,
|
| 269 |
+
hidden_act="relu2",
|
| 270 |
+
hidden_size=2048,
|
| 271 |
+
intermediate_size=9216,
|
| 272 |
+
latent_channel=48,
|
| 273 |
+
latent_patch_size=2,
|
| 274 |
+
num_attention_heads=16,
|
| 275 |
+
num_hidden_layers=28,
|
| 276 |
+
num_key_value_heads=8,
|
| 277 |
+
patch_latent_dim=192,
|
| 278 |
+
qk_norm_for_text=False,
|
| 279 |
+
rms_norm_eps=1e-5,
|
| 280 |
+
rope_scaling={"mrope_section": [24, 20, 20]},
|
| 281 |
+
rope_theta=100_000_000.0,
|
| 282 |
+
timestep_scale=0.001,
|
| 283 |
+
unified_3d_mrope_reset_spatial_ids=True,
|
| 284 |
+
unified_3d_mrope_temporal_modality_margin=15000,
|
| 285 |
+
vocab_size=131072,
|
| 286 |
+
backbone_type="cosmos3_edge_nemotron_dense",
|
| 287 |
+
temporal_compression_factor=4,
|
| 288 |
+
)
|
| 289 |
+
transformer = transformer.to(dtype=dtype)
|
| 290 |
+
transformer.time_embedder.to(dtype=torch.float32)
|
| 291 |
+
return transformer.to_empty(device="cpu")
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
def _validate_edge_action_pipeline_support() -> None:
|
| 295 |
+
import inspect
|
| 296 |
+
|
| 297 |
+
from diffusers.pipelines.cosmos.pipeline_cosmos3_omni import Cosmos3OmniPipeline
|
| 298 |
+
|
| 299 |
+
pipeline_params = inspect.signature(Cosmos3OmniPipeline.__call__).parameters
|
| 300 |
+
required_params = {"action", "action_latents"}
|
| 301 |
+
missing_params = sorted(required_params - set(pipeline_params))
|
| 302 |
+
if missing_params:
|
| 303 |
+
raise RuntimeError(
|
| 304 |
+
"The checkpoint has action generation weights and --save-pipeline was requested, but this diffusers "
|
| 305 |
+
f"build's Cosmos3OmniPipeline does not accept {missing_params}. Use a build that also includes the "
|
| 306 |
+
"Cosmos3 action pipeline support from commit bcc20e452."
|
| 307 |
+
)
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
def _load_edge_dcp_weights(transformer, checkpoint_path: pathlib.Path, use_ema: bool) -> None:
|
| 311 |
+
import torch.distributed.checkpoint as dcp
|
| 312 |
+
from torch.distributed.checkpoint.filesystem import FileSystemReader
|
| 313 |
+
|
| 314 |
+
prefix = "net_ema." if use_ema else "net."
|
| 315 |
+
state_dict_metadata = FileSystemReader(str(checkpoint_path)).read_metadata().state_dict_metadata
|
| 316 |
+
target_state_dict = transformer.state_dict()
|
| 317 |
+
dcp_state_dict: dict[str, torch.Tensor] = {}
|
| 318 |
+
for key in state_dict_metadata:
|
| 319 |
+
if not key.startswith(prefix):
|
| 320 |
+
continue
|
| 321 |
+
target_key = _remap_edge_dcp_key(key.removeprefix(prefix))
|
| 322 |
+
if target_key not in target_state_dict:
|
| 323 |
+
raise RuntimeError(f"Cosmos3 Edge DCP key {key!r} maps to unknown transformer key {target_key!r}.")
|
| 324 |
+
dcp_state_dict[key] = target_state_dict[target_key]
|
| 325 |
+
|
| 326 |
+
mapped_keys = {_remap_edge_dcp_key(key.removeprefix(prefix)) for key in dcp_state_dict}
|
| 327 |
+
missing_keys = sorted(set(target_state_dict) - mapped_keys)
|
| 328 |
+
if missing_keys:
|
| 329 |
+
raise RuntimeError(f"Cosmos3 Edge DCP is missing transformer weights: {missing_keys}.")
|
| 330 |
+
|
| 331 |
+
print(f"Loading {'EMA' if use_ema else 'regular'} Cosmos3 Edge weights from {checkpoint_path} …")
|
| 332 |
+
dcp.load(state_dict=dcp_state_dict, storage_reader=FileSystemReader(str(checkpoint_path)), no_dist=True)
|
| 333 |
+
del dcp_state_dict, target_state_dict
|
| 334 |
+
|
| 335 |
+
|
| 336 |
+
def _resolve_edge_reasoner_path(args) -> pathlib.Path:
|
| 337 |
+
if args.reasoner_path is not None:
|
| 338 |
+
reasoner_path = pathlib.Path(args.reasoner_path).expanduser().absolute()
|
| 339 |
+
else:
|
| 340 |
+
from huggingface_hub import snapshot_download
|
| 341 |
+
|
| 342 |
+
print(
|
| 343 |
+
"Downloading the pinned Cosmos3 Edge reasoner snapshot "
|
| 344 |
+
f"({args.reasoner_repo_id}@{args.reasoner_revision}) …"
|
| 345 |
+
)
|
| 346 |
+
reasoner_path = pathlib.Path(
|
| 347 |
+
snapshot_download(
|
| 348 |
+
repo_id=args.reasoner_repo_id,
|
| 349 |
+
revision=args.reasoner_revision,
|
| 350 |
+
allow_patterns=list(COSMOS3_EDGE_REASONER_FILES),
|
| 351 |
+
)
|
| 352 |
+
)
|
| 353 |
+
|
| 354 |
+
if not reasoner_path.is_dir():
|
| 355 |
+
raise FileNotFoundError(f"Cosmos3 Edge reasoner directory not found: {reasoner_path}")
|
| 356 |
+
|
| 357 |
+
missing_files = [filename for filename in COSMOS3_EDGE_REASONER_FILES if not (reasoner_path / filename).is_file()]
|
| 358 |
+
if missing_files:
|
| 359 |
+
raise FileNotFoundError(
|
| 360 |
+
f"Cosmos3 Edge reasoner at {reasoner_path} is missing required files: {missing_files}"
|
| 361 |
+
)
|
| 362 |
+
return reasoner_path
|
| 363 |
+
|
| 364 |
+
|
| 365 |
+
def _load_json(path: pathlib.Path) -> dict:
|
| 366 |
+
with open(path, encoding="utf-8") as f:
|
| 367 |
+
return json.load(f)
|
| 368 |
+
|
| 369 |
+
|
| 370 |
+
def _save_json(payload: dict, path: pathlib.Path) -> None:
|
| 371 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 372 |
+
with open(path, "w", encoding="utf-8") as f:
|
| 373 |
+
json.dump(payload, f, indent=2, sort_keys=True)
|
| 374 |
+
f.write("\n")
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
def _edge_reasoner_language_to_generator_key_map() -> dict[str, str]:
|
| 378 |
+
"""Map source Nemotron reasoner keys to their shared Diffusers tensor keys."""
|
| 379 |
+
mapping = {
|
| 380 |
+
"lm_head.weight": "lm_head.weight",
|
| 381 |
+
"model.language_model.embeddings.weight": "embed_tokens.weight",
|
| 382 |
+
"model.language_model.norm_f.weight": "norm.weight",
|
| 383 |
+
}
|
| 384 |
+
attention_key_map = {
|
| 385 |
+
"q_proj": "to_q",
|
| 386 |
+
"k_proj": "to_k",
|
| 387 |
+
"v_proj": "to_v",
|
| 388 |
+
"o_proj": "to_out",
|
| 389 |
+
}
|
| 390 |
+
for layer_idx in range(28):
|
| 391 |
+
attention_layer_idx = 2 * layer_idx
|
| 392 |
+
mlp_layer_idx = attention_layer_idx + 1
|
| 393 |
+
reasoner_attention_prefix = f"model.language_model.layers.{attention_layer_idx}"
|
| 394 |
+
generator_attention_prefix = f"layers.{layer_idx}"
|
| 395 |
+
mapping[f"{reasoner_attention_prefix}.norm.weight"] = f"{generator_attention_prefix}.input_layernorm.weight"
|
| 396 |
+
for source_name, generator_name in attention_key_map.items():
|
| 397 |
+
mapping[f"{reasoner_attention_prefix}.mixer.{source_name}.weight"] = (
|
| 398 |
+
f"{generator_attention_prefix}.self_attn.{generator_name}.weight"
|
| 399 |
+
)
|
| 400 |
+
|
| 401 |
+
reasoner_mlp_prefix = f"model.language_model.layers.{mlp_layer_idx}"
|
| 402 |
+
generator_mlp_prefix = f"layers.{layer_idx}"
|
| 403 |
+
mapping[f"{reasoner_mlp_prefix}.norm.weight"] = f"{generator_mlp_prefix}.post_attention_layernorm.weight"
|
| 404 |
+
for source_name in ("up_proj", "down_proj"):
|
| 405 |
+
mapping[f"{reasoner_mlp_prefix}.mixer.{source_name}.weight"] = (
|
| 406 |
+
f"{generator_mlp_prefix}.mlp.{source_name}.weight"
|
| 407 |
+
)
|
| 408 |
+
return mapping
|
| 409 |
+
|
| 410 |
+
|
| 411 |
+
def _native_edge_text_config(source_config: dict) -> dict:
|
| 412 |
+
"""Strip inactive hybrid fields and express the dense reasoner layout explicitly."""
|
| 413 |
+
layers_block_type = source_config.get("layers_block_type")
|
| 414 |
+
if layers_block_type is None:
|
| 415 |
+
legacy_pattern = source_config.get("hybrid_override_pattern")
|
| 416 |
+
if legacy_pattern is None:
|
| 417 |
+
num_hidden_layers = source_config.get("num_hidden_layers", 56)
|
| 418 |
+
if num_hidden_layers % 2:
|
| 419 |
+
raise ValueError("Cosmos3 Edge requires an even number of alternating attention/MLP layers.")
|
| 420 |
+
layers_block_type = ["full_attention", "mlp"] * (num_hidden_layers // 2)
|
| 421 |
+
else:
|
| 422 |
+
layer_type_map = {"*": "full_attention", "-": "mlp"}
|
| 423 |
+
try:
|
| 424 |
+
layers_block_type = [layer_type_map[layer] for layer in legacy_pattern]
|
| 425 |
+
except KeyError as exc:
|
| 426 |
+
raise ValueError(f"Unsupported Cosmos3 Edge legacy layer type: {exc.args[0]!r}.") from exc
|
| 427 |
+
else:
|
| 428 |
+
layers_block_type = list(layers_block_type)
|
| 429 |
+
|
| 430 |
+
if set(layers_block_type) - {"full_attention", "mlp"}:
|
| 431 |
+
raise ValueError(f"Cosmos3 Edge only supports dense attention/MLP layers, got {layers_block_type!r}.")
|
| 432 |
+
|
| 433 |
+
native_config = {"model_type": "cosmos3_edge_text", "layers_block_type": layers_block_type}
|
| 434 |
+
for key in (
|
| 435 |
+
"attention_bias",
|
| 436 |
+
"attention_dropout",
|
| 437 |
+
"bos_token_id",
|
| 438 |
+
"dtype",
|
| 439 |
+
"eos_token_id",
|
| 440 |
+
"head_dim",
|
| 441 |
+
"hidden_size",
|
| 442 |
+
"initializer_range",
|
| 443 |
+
"intermediate_size",
|
| 444 |
+
"layer_norm_epsilon",
|
| 445 |
+
"max_position_embeddings",
|
| 446 |
+
"mlp_bias",
|
| 447 |
+
"mlp_hidden_act",
|
| 448 |
+
"num_attention_heads",
|
| 449 |
+
"num_key_value_heads",
|
| 450 |
+
"num_logits_to_keep",
|
| 451 |
+
"pad_token_id",
|
| 452 |
+
"rope_theta",
|
| 453 |
+
"use_cache",
|
| 454 |
+
"vocab_size",
|
| 455 |
+
):
|
| 456 |
+
if key in source_config:
|
| 457 |
+
native_config[key] = source_config[key]
|
| 458 |
+
native_config["num_hidden_layers"] = len(layers_block_type)
|
| 459 |
+
native_config["rope_parameters"] = {
|
| 460 |
+
"rope_type": "default",
|
| 461 |
+
"rope_theta": native_config.get("rope_theta", 100_000_000.0),
|
| 462 |
+
"mrope_section": source_config.get("mrope_section", [24, 20, 20]),
|
| 463 |
+
}
|
| 464 |
+
return native_config
|
| 465 |
+
|
| 466 |
+
|
| 467 |
+
def _native_edge_projector_config(source_config: dict) -> dict:
|
| 468 |
+
merger_intermediate_size = source_config.get("merger_intermediate_size")
|
| 469 |
+
if merger_intermediate_size is None:
|
| 470 |
+
merger_intermediate_size = source_config["merger_intermedia"]
|
| 471 |
+
native_config = {
|
| 472 |
+
"model_type": "cosmos3_edge_projector",
|
| 473 |
+
"input_hidden_size": source_config["input_hidden_size"],
|
| 474 |
+
"merger_intermediate_size": merger_intermediate_size,
|
| 475 |
+
"out_hidden_size": source_config["out_hidden_size"],
|
| 476 |
+
"spatial_merge_size": source_config["spatial_merge_size"],
|
| 477 |
+
"use_postshuffle_norm": source_config["use_postshuffle_norm"],
|
| 478 |
+
}
|
| 479 |
+
return native_config
|
| 480 |
+
|
| 481 |
+
|
| 482 |
+
def _native_edge_vision_config(source_config: dict) -> dict:
|
| 483 |
+
native_config = {"model_type": "cosmos3_edge_vision"}
|
| 484 |
+
for key in (
|
| 485 |
+
"attention_dropout",
|
| 486 |
+
"hidden_act",
|
| 487 |
+
"hidden_size",
|
| 488 |
+
"intermediate_size",
|
| 489 |
+
"layer_norm_eps",
|
| 490 |
+
"num_attention_heads",
|
| 491 |
+
"num_channels",
|
| 492 |
+
"num_hidden_layers",
|
| 493 |
+
"num_patches",
|
| 494 |
+
"patch_size",
|
| 495 |
+
"spatial_merge_size",
|
| 496 |
+
):
|
| 497 |
+
if key in source_config:
|
| 498 |
+
native_config[key] = source_config[key]
|
| 499 |
+
return native_config
|
| 500 |
+
|
| 501 |
+
|
| 502 |
+
def _native_edge_config(source_config: dict) -> dict:
|
| 503 |
+
native_config = {
|
| 504 |
+
key: value
|
| 505 |
+
for key, value in source_config.items()
|
| 506 |
+
if key not in {"architectures", "auto_map", "model_type", "projector_config", "text_config", "vision_config"}
|
| 507 |
+
}
|
| 508 |
+
native_config["architectures"] = ["Cosmos3EdgeForConditionalGeneration"]
|
| 509 |
+
native_config["model_type"] = "cosmos3_edge"
|
| 510 |
+
native_config["allow_patterns_overrides"] = ["*/*.safetensors"]
|
| 511 |
+
native_config["text_config"] = _native_edge_text_config(source_config["text_config"])
|
| 512 |
+
native_config["vision_config"] = _native_edge_vision_config(source_config["vision_config"])
|
| 513 |
+
native_config["projector_config"] = _native_edge_projector_config(source_config["projector_config"])
|
| 514 |
+
return native_config
|
| 515 |
+
|
| 516 |
+
|
| 517 |
+
def _native_edge_image_processor_config(source_config: dict) -> dict:
|
| 518 |
+
native_config = dict(source_config)
|
| 519 |
+
native_config.pop("auto_map", None)
|
| 520 |
+
native_config["processor_class"] = "Cosmos3EdgeProcessor"
|
| 521 |
+
native_config["image_processor_type"] = "Cosmos3EdgeImageProcessor"
|
| 522 |
+
return native_config
|
| 523 |
+
|
| 524 |
+
|
| 525 |
+
def _native_edge_video_processor_config(source_config: dict) -> dict:
|
| 526 |
+
native_config = dict(source_config)
|
| 527 |
+
native_config.pop("auto_map", None)
|
| 528 |
+
native_config["processor_class"] = "Cosmos3EdgeProcessor"
|
| 529 |
+
native_config["video_processor_type"] = "Cosmos3EdgeVideoProcessor"
|
| 530 |
+
return native_config
|
| 531 |
+
|
| 532 |
+
|
| 533 |
+
def _validate_edge_reasoner_mapping(source_weight_map: dict[str, str], generator_weight_map: dict[str, str]) -> dict[str, str]:
|
| 534 |
+
language_keys = {
|
| 535 |
+
key for key in source_weight_map if key == "lm_head.weight" or key.startswith("model.language_model.")
|
| 536 |
+
}
|
| 537 |
+
vision_keys = {
|
| 538 |
+
key for key in source_weight_map if key.startswith(("model.visual.", "model.projector."))
|
| 539 |
+
}
|
| 540 |
+
unexpected_keys = set(source_weight_map) - language_keys - vision_keys
|
| 541 |
+
if unexpected_keys:
|
| 542 |
+
raise RuntimeError(f"Unexpected Cosmos3 Edge reasoner keys: {sorted(unexpected_keys)}")
|
| 543 |
+
|
| 544 |
+
mapping = _edge_reasoner_language_to_generator_key_map()
|
| 545 |
+
if set(mapping) != language_keys:
|
| 546 |
+
missing = sorted(language_keys - set(mapping))
|
| 547 |
+
extra = sorted(set(mapping) - language_keys)
|
| 548 |
+
raise RuntimeError(f"Incomplete Edge language mapping: missing={missing}, extra={extra}")
|
| 549 |
+
missing_generator_keys = sorted(set(mapping.values()) - set(generator_weight_map))
|
| 550 |
+
if missing_generator_keys:
|
| 551 |
+
raise RuntimeError(f"Diffusers transformer is missing shared reasoner tensors: {missing_generator_keys}")
|
| 552 |
+
if len(vision_keys) != 443:
|
| 553 |
+
raise RuntimeError(f"Expected 443 Edge vision/projector tensors, found {len(vision_keys)}.")
|
| 554 |
+
return mapping
|
| 555 |
+
|
| 556 |
+
|
| 557 |
+
def _write_edge_vision_encoder(
|
| 558 |
+
reasoner_path: pathlib.Path,
|
| 559 |
+
output_dir: pathlib.Path,
|
| 560 |
+
source_weight_map: dict[str, str],
|
| 561 |
+
) -> set[str]:
|
| 562 |
+
try:
|
| 563 |
+
from safetensors import safe_open
|
| 564 |
+
from safetensors.torch import save_file
|
| 565 |
+
except ImportError as exc:
|
| 566 |
+
raise ImportError("Saving the Cosmos3 Edge vision encoder requires safetensors.") from exc
|
| 567 |
+
|
| 568 |
+
vision_keys = {
|
| 569 |
+
key for key in source_weight_map if key.startswith(("model.visual.", "model.projector."))
|
| 570 |
+
}
|
| 571 |
+
non_vision_shards = {source_weight_map[key] for key in vision_keys} - {COSMOS3_EDGE_REASONER_VISION_SHARD}
|
| 572 |
+
if non_vision_shards:
|
| 573 |
+
raise RuntimeError(f"Edge visual tensors unexpectedly span shards: {sorted(non_vision_shards)}")
|
| 574 |
+
|
| 575 |
+
vision_dir = output_dir / "vision_encoder"
|
| 576 |
+
vision_dir.mkdir(parents=True, exist_ok=True)
|
| 577 |
+
vision_path = vision_dir / "model.safetensors"
|
| 578 |
+
print(f"Extracting {len(vision_keys)} Cosmos3 Edge vision/projector tensors to {vision_path} …")
|
| 579 |
+
with safe_open(reasoner_path / COSMOS3_EDGE_REASONER_VISION_SHARD, framework="pt", device="cpu") as source_file:
|
| 580 |
+
state_dict = {key: source_file.get_tensor(key).contiguous() for key in sorted(vision_keys)}
|
| 581 |
+
save_file(state_dict, str(vision_path), metadata={"format": "pt"})
|
| 582 |
+
del state_dict
|
| 583 |
+
# This is an auxiliary shard consumed through the root reasoner manifest;
|
| 584 |
+
# it is not a standalone Transformers model. Do not leave a stale legacy
|
| 585 |
+
# config beside it when converting into an existing output directory.
|
| 586 |
+
(vision_dir / "config.json").unlink(missing_ok=True)
|
| 587 |
+
return vision_keys
|
| 588 |
+
|
| 589 |
+
|
| 590 |
+
def _write_edge_reasoner_manifest(reasoner_path: pathlib.Path, output_dir: pathlib.Path) -> None:
|
| 591 |
+
source_index = _load_json(reasoner_path / COSMOS3_EDGE_REASONER_INDEX_FILE)
|
| 592 |
+
source_weight_map = source_index["weight_map"]
|
| 593 |
+
source_config = _load_json(reasoner_path / "config.json")
|
| 594 |
+
generator_index = _load_json(output_dir / "transformer" / "diffusion_pytorch_model.safetensors.index.json")
|
| 595 |
+
generator_weight_map = generator_index["weight_map"]
|
| 596 |
+
language_mapping = _validate_edge_reasoner_mapping(source_weight_map, generator_weight_map)
|
| 597 |
+
vision_keys = _write_edge_vision_encoder(reasoner_path, output_dir, source_weight_map)
|
| 598 |
+
|
| 599 |
+
weight_map = {
|
| 600 |
+
generator_key: f"transformer/{generator_weight_map[generator_key]}"
|
| 601 |
+
for generator_key in language_mapping.values()
|
| 602 |
+
}
|
| 603 |
+
weight_map.update({key: "vision_encoder/model.safetensors" for key in vision_keys})
|
| 604 |
+
if len(weight_map) != len(source_weight_map):
|
| 605 |
+
raise RuntimeError(
|
| 606 |
+
f"Edge unified weight index has {len(weight_map)} entries, expected {len(source_weight_map)}."
|
| 607 |
+
)
|
| 608 |
+
_save_json(
|
| 609 |
+
{"metadata": source_index["metadata"], "weight_map": weight_map},
|
| 610 |
+
output_dir / COSMOS3_EDGE_REASONER_INDEX_FILE,
|
| 611 |
+
)
|
| 612 |
+
|
| 613 |
+
_save_json(_native_edge_config(source_config), output_dir / "config.json")
|
| 614 |
+
|
| 615 |
+
|
| 616 |
+
def _copy_edge_reasoner_metadata(reasoner_path: pathlib.Path, output_dir: pathlib.Path) -> None:
|
| 617 |
+
print(f"Writing the shared Cosmos3 Edge reasoner into {output_dir} …")
|
| 618 |
+
for filename in COSMOS3_EDGE_REASONER_METADATA_FILES:
|
| 619 |
+
if filename == "config.json":
|
| 620 |
+
continue
|
| 621 |
+
if filename == "preprocessor_config.json":
|
| 622 |
+
_save_json(
|
| 623 |
+
_native_edge_image_processor_config(_load_json(reasoner_path / filename)),
|
| 624 |
+
output_dir / filename,
|
| 625 |
+
)
|
| 626 |
+
continue
|
| 627 |
+
if filename == "video_preprocessor_config.json":
|
| 628 |
+
_save_json(
|
| 629 |
+
_native_edge_video_processor_config(_load_json(reasoner_path / filename)),
|
| 630 |
+
output_dir / filename,
|
| 631 |
+
)
|
| 632 |
+
continue
|
| 633 |
+
shutil.copy2(reasoner_path / filename, output_dir / filename)
|
| 634 |
+
|
| 635 |
+
for filename in (
|
| 636 |
+
"configuration_nemotron_siglip2_h.py",
|
| 637 |
+
"modeling_cosmos3_edge_omni.py",
|
| 638 |
+
"modeling_nemotron_siglip2_h.py",
|
| 639 |
+
"processing.py",
|
| 640 |
+
):
|
| 641 |
+
(output_dir / filename).unlink(missing_ok=True)
|
| 642 |
+
_write_edge_reasoner_manifest(reasoner_path, output_dir)
|
| 643 |
+
for filename in ("00000.safetensors", "00001.safetensors"):
|
| 644 |
+
(output_dir / filename).unlink(missing_ok=True)
|
| 645 |
+
|
| 646 |
+
|
| 647 |
+
def _copy_edge_conversion_script(output_dir: pathlib.Path) -> None:
|
| 648 |
+
source = pathlib.Path(__file__).resolve()
|
| 649 |
+
destination = output_dir / source.name
|
| 650 |
+
if source != destination:
|
| 651 |
+
shutil.copy2(source, destination)
|
| 652 |
+
|
| 653 |
+
|
| 654 |
+
def _add_edge_reasoner_to_pipeline(args) -> None:
|
| 655 |
+
output_dir = pathlib.Path(args.output).expanduser().absolute()
|
| 656 |
+
expected_paths = ("model_index.json", "scheduler", "text_tokenizer", "transformer", "vae")
|
| 657 |
+
missing_paths = [str(output_dir / path) for path in expected_paths if not (output_dir / path).exists()]
|
| 658 |
+
if missing_paths:
|
| 659 |
+
raise FileNotFoundError(
|
| 660 |
+
"Expected an existing Cosmos3 Edge Diffusers pipeline before adding its reasoner; "
|
| 661 |
+
f"missing paths: {missing_paths}"
|
| 662 |
+
)
|
| 663 |
+
|
| 664 |
+
reasoner_path = _resolve_edge_reasoner_path(args)
|
| 665 |
+
_copy_edge_reasoner_metadata(reasoner_path, output_dir)
|
| 666 |
+
_copy_edge_conversion_script(output_dir)
|
| 667 |
+
print("Done.")
|
| 668 |
+
|
| 669 |
+
|
| 670 |
+
def _convert_edge_dcp(args, checkpoint_path: pathlib.Path, dtype: torch.dtype) -> None:
|
| 671 |
+
from transformers import PreTrainedTokenizerFast
|
| 672 |
+
|
| 673 |
+
from diffusers import AutoencoderKLWan, UniPCMultistepScheduler
|
| 674 |
+
from diffusers.pipelines.cosmos.pipeline_cosmos3_omni import Cosmos3OmniPipeline
|
| 675 |
+
|
| 676 |
+
if args.include_sound_tokenizer or args.sound_tokenizer_path is not None:
|
| 677 |
+
raise ValueError("The supplied Cosmos3 Edge checkpoint is video-only and cannot include a sound tokenizer.")
|
| 678 |
+
if args.include_reasoner and not args.save_pipeline:
|
| 679 |
+
raise ValueError(
|
| 680 |
+
"A Cosmos3 Edge reasoner can only be included with --save-pipeline because its root Transformers "
|
| 681 |
+
"config.json would conflict with a transformer-only Diffusers save. Use --no-include-reasoner instead."
|
| 682 |
+
)
|
| 683 |
+
|
| 684 |
+
action_config = _detect_edge_action_config(checkpoint_path, args.use_ema)
|
| 685 |
+
if action_config is not None:
|
| 686 |
+
print(
|
| 687 |
+
"Detected Cosmos3 Edge action generation weights "
|
| 688 |
+
f"(action_dim={action_config['action_dim']}, "
|
| 689 |
+
f"num_embodiment_domains={action_config['num_embodiment_domains']})."
|
| 690 |
+
)
|
| 691 |
+
transformer = _build_edge_transformer(dtype, action_config)
|
| 692 |
+
if action_config is not None and args.save_pipeline:
|
| 693 |
+
_validate_edge_action_pipeline_support()
|
| 694 |
+
_load_edge_dcp_weights(transformer, checkpoint_path, args.use_ema)
|
| 695 |
+
|
| 696 |
+
reasoner_path = _resolve_edge_reasoner_path(args) if args.include_reasoner else None
|
| 697 |
+
|
| 698 |
+
output_dir = pathlib.Path(args.output).expanduser().absolute()
|
| 699 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 700 |
+
if not args.save_pipeline:
|
| 701 |
+
print(f"Saving Cosmos3 Edge transformer to {output_dir} …")
|
| 702 |
+
transformer.save_pretrained(str(output_dir), safe_serialization=True, max_shard_size="5GB")
|
| 703 |
+
print("Done.")
|
| 704 |
+
return
|
| 705 |
+
|
| 706 |
+
tokenizer_source = str(reasoner_path) if reasoner_path is not None else args.reasoner_repo_id
|
| 707 |
+
tokenizer_kwargs = {}
|
| 708 |
+
if reasoner_path is None:
|
| 709 |
+
tokenizer_kwargs["revision"] = args.reasoner_revision
|
| 710 |
+
text_tokenizer = PreTrainedTokenizerFast.from_pretrained(tokenizer_source, **tokenizer_kwargs)
|
| 711 |
+
for token in ("<|vision_start|>", "<|vision_end|>"):
|
| 712 |
+
token_id = text_tokenizer.convert_tokens_to_ids(token)
|
| 713 |
+
if token_id is None or token_id < 0 or token_id >= transformer.config.vocab_size:
|
| 714 |
+
raise ValueError(
|
| 715 |
+
f"Cosmos3 Edge tokenizer token {token!r} has invalid ID {token_id!r} for "
|
| 716 |
+
f"vocab_size={transformer.config.vocab_size}."
|
| 717 |
+
)
|
| 718 |
+
|
| 719 |
+
diffusers_vae = AutoencoderKLWan.from_pretrained(COSMOS3_EDGE_VAE, subfolder="vae", torch_dtype=torch.bfloat16)
|
| 720 |
+
scheduler = UniPCMultistepScheduler(
|
| 721 |
+
num_train_timesteps=1000,
|
| 722 |
+
solver_order=2,
|
| 723 |
+
predict_x0=True,
|
| 724 |
+
solver_type="bh2",
|
| 725 |
+
lower_order_final=True,
|
| 726 |
+
final_sigmas_type="zero",
|
| 727 |
+
use_flow_sigmas=True,
|
| 728 |
+
prediction_type="flow_prediction",
|
| 729 |
+
flow_shift=5.0,
|
| 730 |
+
)
|
| 731 |
+
pipeline = Cosmos3OmniPipeline(
|
| 732 |
+
transformer=transformer,
|
| 733 |
+
text_tokenizer=text_tokenizer,
|
| 734 |
+
vae=diffusers_vae,
|
| 735 |
+
scheduler=scheduler,
|
| 736 |
+
enable_safety_checker=False,
|
| 737 |
+
default_use_system_prompt=False,
|
| 738 |
+
use_native_flow_schedule=True,
|
| 739 |
+
)
|
| 740 |
+
print(f"Saving Cosmos3 Edge pipeline to {output_dir} …")
|
| 741 |
+
pipeline.save_pretrained(str(output_dir), safe_serialization=True, max_shard_size="5GB")
|
| 742 |
+
if reasoner_path is not None:
|
| 743 |
+
_copy_edge_reasoner_metadata(reasoner_path, output_dir)
|
| 744 |
+
_copy_edge_conversion_script(output_dir)
|
| 745 |
+
print("Done.")
|
| 746 |
+
|
| 747 |
+
|
| 748 |
+
def _load_sound_tokenizer_state_dict(checkpoint_path: pathlib.Path) -> dict[str, torch.Tensor]:
|
| 749 |
+
if checkpoint_path.suffix == ".safetensors":
|
| 750 |
+
try:
|
| 751 |
+
from safetensors.torch import load_file
|
| 752 |
+
except ImportError as exc:
|
| 753 |
+
raise ImportError("Loading AVAE .safetensors checkpoints requires safetensors.") from exc
|
| 754 |
+
checkpoint = load_file(str(checkpoint_path), device="cpu")
|
| 755 |
+
else:
|
| 756 |
+
checkpoint = torch.load(checkpoint_path, map_location="cpu")
|
| 757 |
+
|
| 758 |
+
if not isinstance(checkpoint, dict):
|
| 759 |
+
raise TypeError(f"AVAE checkpoint must be a dict, got {type(checkpoint)!r}.")
|
| 760 |
+
|
| 761 |
+
for key in ("generator", "state_dict", "model"):
|
| 762 |
+
value = checkpoint.get(key)
|
| 763 |
+
if isinstance(value, dict):
|
| 764 |
+
checkpoint = value
|
| 765 |
+
break
|
| 766 |
+
|
| 767 |
+
state_dict = {
|
| 768 |
+
key: value.detach().cpu().contiguous() for key, value in checkpoint.items() if isinstance(value, torch.Tensor)
|
| 769 |
+
}
|
| 770 |
+
if not state_dict:
|
| 771 |
+
raise RuntimeError(f"No tensor state dict found in AVAE checkpoint keys: {list(checkpoint.keys())[:16]}")
|
| 772 |
+
return state_dict
|
| 773 |
+
|
| 774 |
+
|
| 775 |
+
def _load_sound_tokenizer_config(config_path: pathlib.Path | None, fallback_config_path: pathlib.Path) -> dict:
|
| 776 |
+
selected_config_path = config_path
|
| 777 |
+
if selected_config_path is None and fallback_config_path.exists():
|
| 778 |
+
selected_config_path = fallback_config_path
|
| 779 |
+
if selected_config_path is None:
|
| 780 |
+
return dict(DEFAULT_SOUND_TOKENIZER_CONFIG)
|
| 781 |
+
with open(selected_config_path, encoding="utf-8") as f:
|
| 782 |
+
return json.load(f)
|
| 783 |
+
|
| 784 |
+
|
| 785 |
+
_SOUND_TOKENIZER_PER_KEY_PREFIXES = ("module.", "generator.", "model.", "state_dict.")
|
| 786 |
+
_SOUND_TOKENIZER_RES_UNIT_INNER_NAMES = {0: "snake1", 1: "conv1", 2: "snake2", 3: "conv2"}
|
| 787 |
+
|
| 788 |
+
|
| 789 |
+
def _sound_tokenizer_strip_per_key_prefixes(state_dict: dict[str, torch.Tensor]) -> dict[str, torch.Tensor]:
|
| 790 |
+
out = dict(state_dict)
|
| 791 |
+
changed = True
|
| 792 |
+
while changed:
|
| 793 |
+
changed = False
|
| 794 |
+
for prefix in _SOUND_TOKENIZER_PER_KEY_PREFIXES:
|
| 795 |
+
if any(key.startswith(prefix) for key in out):
|
| 796 |
+
out = {(key[len(prefix) :] if key.startswith(prefix) else key): value for key, value in out.items()}
|
| 797 |
+
changed = True
|
| 798 |
+
break
|
| 799 |
+
if any(key.startswith(("decoder.", "encoder.", "bottleneck.")) for key in out):
|
| 800 |
+
break
|
| 801 |
+
return out
|
| 802 |
+
|
| 803 |
+
|
| 804 |
+
def _sound_tokenizer_filter_decoder(state_dict: dict[str, torch.Tensor]) -> dict[str, torch.Tensor]:
|
| 805 |
+
return {key: value for key, value in state_dict.items() if key.startswith("decoder.")}
|
| 806 |
+
|
| 807 |
+
|
| 808 |
+
def _sound_tokenizer_infer_num_blocks(state_dict: dict[str, torch.Tensor]) -> int:
|
| 809 |
+
block_indices: set[int] = set()
|
| 810 |
+
for key in state_dict:
|
| 811 |
+
match = re.match(r"decoder\.layers\.(\d+)\.layers\.\d+\.", key)
|
| 812 |
+
if match:
|
| 813 |
+
block_indices.add(int(match.group(1)))
|
| 814 |
+
return len(block_indices)
|
| 815 |
+
|
| 816 |
+
|
| 817 |
+
def _sound_tokenizer_remap_flat_layout(state_dict: dict[str, torch.Tensor]) -> dict[str, torch.Tensor]:
|
| 818 |
+
"""Convert legacy AVAE `decoder.layers.*` keys to OobleckDecoder attribute keys."""
|
| 819 |
+
if not any(re.match(r"decoder\.layers\.\d+\.", key) for key in state_dict):
|
| 820 |
+
return state_dict
|
| 821 |
+
|
| 822 |
+
num_blocks = _sound_tokenizer_infer_num_blocks(state_dict)
|
| 823 |
+
if num_blocks == 0:
|
| 824 |
+
raise RuntimeError("Detected flat `decoder.layers.*` layout but no decoder blocks were found; cannot remap.")
|
| 825 |
+
snake1_idx = num_blocks + 1
|
| 826 |
+
conv2_idx = num_blocks + 2
|
| 827 |
+
|
| 828 |
+
def _remap(key: str) -> str:
|
| 829 |
+
match = re.fullmatch(r"decoder\.layers\.(\d+)\.layers\.(\d+)\.layers\.(\d+)\.(.+)", key)
|
| 830 |
+
if match:
|
| 831 |
+
block_n, res_n, inner_n, rest = (
|
| 832 |
+
int(match.group(1)),
|
| 833 |
+
int(match.group(2)),
|
| 834 |
+
int(match.group(3)),
|
| 835 |
+
match.group(4),
|
| 836 |
+
)
|
| 837 |
+
if res_n not in (2, 3, 4):
|
| 838 |
+
raise RuntimeError(f"Unexpected residual position {res_n} in {key!r}.")
|
| 839 |
+
inner_name = _SOUND_TOKENIZER_RES_UNIT_INNER_NAMES.get(inner_n)
|
| 840 |
+
if inner_name is None:
|
| 841 |
+
raise RuntimeError(f"Unexpected residual inner index {inner_n} in {key!r}.")
|
| 842 |
+
return f"decoder.block.{block_n - 1}.res_unit{res_n - 1}.{inner_name}.{rest}"
|
| 843 |
+
|
| 844 |
+
match = re.fullmatch(r"decoder\.layers\.(\d+)\.layers\.(\d+)\.(.+)", key)
|
| 845 |
+
if match:
|
| 846 |
+
block_n, sub_n, rest = int(match.group(1)), int(match.group(2)), match.group(3)
|
| 847 |
+
block_idx = block_n - 1
|
| 848 |
+
if sub_n == 0:
|
| 849 |
+
return f"decoder.block.{block_idx}.snake1.{rest}"
|
| 850 |
+
if sub_n == 1:
|
| 851 |
+
return f"decoder.block.{block_idx}.conv_t1.{rest}"
|
| 852 |
+
raise RuntimeError(f"Unexpected decoder block sub-index {sub_n} in {key!r}.")
|
| 853 |
+
|
| 854 |
+
match = re.fullmatch(r"decoder\.layers\.(\d+)\.(.+)", key)
|
| 855 |
+
if match:
|
| 856 |
+
layer_n, rest = int(match.group(1)), match.group(2)
|
| 857 |
+
if layer_n == 0:
|
| 858 |
+
return f"decoder.conv1.{rest}"
|
| 859 |
+
if layer_n == snake1_idx:
|
| 860 |
+
return f"decoder.snake1.{rest}"
|
| 861 |
+
if layer_n == conv2_idx:
|
| 862 |
+
return f"decoder.conv2.{rest}"
|
| 863 |
+
raise RuntimeError(
|
| 864 |
+
f"Unexpected decoder leaf layer index {layer_n} (expected 0, {snake1_idx}, or {conv2_idx}) in {key!r}."
|
| 865 |
+
)
|
| 866 |
+
|
| 867 |
+
return key
|
| 868 |
+
|
| 869 |
+
return {_remap(key): value for key, value in state_dict.items()}
|
| 870 |
+
|
| 871 |
+
|
| 872 |
+
def _sound_tokenizer_reshape_snake_params(state_dict: dict[str, torch.Tensor]) -> dict[str, torch.Tensor]:
|
| 873 |
+
out: dict[str, torch.Tensor] = {}
|
| 874 |
+
for key, value in state_dict.items():
|
| 875 |
+
if (key.endswith(".alpha") or key.endswith(".beta")) and value.ndim == 1:
|
| 876 |
+
value = value.unsqueeze(0).unsqueeze(-1).contiguous()
|
| 877 |
+
out[key] = value
|
| 878 |
+
return out
|
| 879 |
+
|
| 880 |
+
|
| 881 |
+
def _sound_tokenizer_reapply_weight_norm(state_dict: dict[str, torch.Tensor]) -> dict[str, torch.Tensor]:
|
| 882 |
+
"""Reconstruct weight-norm parameters if the source checkpoint has folded conv weights."""
|
| 883 |
+
out = dict(state_dict)
|
| 884 |
+
candidate_keys = [
|
| 885 |
+
key
|
| 886 |
+
for key in state_dict
|
| 887 |
+
if key.endswith(".weight") and any(f".{layer}." in key for layer in ("conv1", "conv2", "conv_t1"))
|
| 888 |
+
]
|
| 889 |
+
for key in candidate_keys:
|
| 890 |
+
stem = key[: -len(".weight")]
|
| 891 |
+
weight_g_key = f"{stem}.weight_g"
|
| 892 |
+
weight_v_key = f"{stem}.weight_v"
|
| 893 |
+
if weight_g_key in state_dict or weight_v_key in state_dict:
|
| 894 |
+
continue
|
| 895 |
+
weight = state_dict[key]
|
| 896 |
+
norm_dims = tuple(range(1, weight.ndim))
|
| 897 |
+
out.pop(key)
|
| 898 |
+
out[weight_g_key] = weight.norm(p=2, dim=norm_dims, keepdim=True).contiguous()
|
| 899 |
+
out[weight_v_key] = weight.contiguous()
|
| 900 |
+
return out
|
| 901 |
+
|
| 902 |
+
|
| 903 |
+
def _remap_avae_state_dict(state_dict: dict[str, torch.Tensor]) -> dict[str, torch.Tensor]:
|
| 904 |
+
"""Convert a legacy AVAE state dict into the Cosmos3AVAEAudioTokenizer state dict."""
|
| 905 |
+
state_dict = _sound_tokenizer_strip_per_key_prefixes(state_dict)
|
| 906 |
+
state_dict = _sound_tokenizer_filter_decoder(state_dict)
|
| 907 |
+
if not state_dict:
|
| 908 |
+
raise RuntimeError("Sound tokenizer state dict has no `decoder.*` keys after prefix stripping.")
|
| 909 |
+
state_dict = _sound_tokenizer_remap_flat_layout(state_dict)
|
| 910 |
+
state_dict = _sound_tokenizer_reshape_snake_params(state_dict)
|
| 911 |
+
state_dict = _sound_tokenizer_reapply_weight_norm(state_dict)
|
| 912 |
+
if any(re.match(r"decoder\.layers\.\d+", key) for key in state_dict):
|
| 913 |
+
raise RuntimeError("Flat `decoder.layers.*` keys remain after remap; conversion is incomplete.")
|
| 914 |
+
return state_dict
|
| 915 |
+
|
| 916 |
+
|
| 917 |
+
def _build_sound_tokenizer(
|
| 918 |
+
checkpoint_path: pathlib.Path,
|
| 919 |
+
config_path: pathlib.Path | None,
|
| 920 |
+
) -> Cosmos3AVAEAudioTokenizer:
|
| 921 |
+
config = _load_sound_tokenizer_config(config_path, fallback_config_path=pathlib.Path())
|
| 922 |
+
print(f"Loading AVAE sound tokenizer weights from {checkpoint_path} …")
|
| 923 |
+
raw_state_dict = _load_sound_tokenizer_state_dict(checkpoint_path)
|
| 924 |
+
state_dict = _remap_avae_state_dict(raw_state_dict)
|
| 925 |
+
print(f" Remapped {len(raw_state_dict)} → {len(state_dict)} decoder keys.")
|
| 926 |
+
|
| 927 |
+
sound_tokenizer = Cosmos3AVAEAudioTokenizer(
|
| 928 |
+
sampling_rate=config.get("sampling_rate", DEFAULT_SOUND_TOKENIZER_CONFIG["sampling_rate"]),
|
| 929 |
+
vocoder_input_dim=config.get("vocoder_input_dim", DEFAULT_SOUND_TOKENIZER_CONFIG["vocoder_input_dim"]),
|
| 930 |
+
dec_dim=config.get("dec_dim", DEFAULT_SOUND_TOKENIZER_CONFIG["dec_dim"]),
|
| 931 |
+
dec_c_mults=tuple(config.get("dec_c_mults", DEFAULT_SOUND_TOKENIZER_CONFIG["dec_c_mults"])),
|
| 932 |
+
dec_strides=tuple(config.get("dec_strides", DEFAULT_SOUND_TOKENIZER_CONFIG["dec_strides"])),
|
| 933 |
+
dec_out_channels=config.get("dec_out_channels", DEFAULT_SOUND_TOKENIZER_CONFIG["dec_out_channels"]),
|
| 934 |
+
)
|
| 935 |
+
load_result = sound_tokenizer.load_state_dict(state_dict, strict=True)
|
| 936 |
+
if load_result.missing_keys or load_result.unexpected_keys:
|
| 937 |
+
raise RuntimeError(
|
| 938 |
+
"Cosmos3 AVAE sound tokenizer load did not match strictly: "
|
| 939 |
+
f"missing={load_result.missing_keys}, unexpected={load_result.unexpected_keys}."
|
| 940 |
+
)
|
| 941 |
+
return sound_tokenizer
|
| 942 |
+
|
| 943 |
+
|
| 944 |
+
@contextlib.contextmanager
|
| 945 |
+
def _skip_source_sound_tokenizer_load(omni_mot_model_cls):
|
| 946 |
+
original_set_up_tokenizers = omni_mot_model_cls.set_up_tokenizers
|
| 947 |
+
|
| 948 |
+
def set_up_tokenizers_without_sound(self):
|
| 949 |
+
if not getattr(self.config, "sound_gen", False):
|
| 950 |
+
return original_set_up_tokenizers(self)
|
| 951 |
+
|
| 952 |
+
sound_gen = self.config.sound_gen
|
| 953 |
+
self.config.sound_gen = False
|
| 954 |
+
try:
|
| 955 |
+
return original_set_up_tokenizers(self)
|
| 956 |
+
finally:
|
| 957 |
+
self.config.sound_gen = sound_gen
|
| 958 |
+
|
| 959 |
+
omni_mot_model_cls.set_up_tokenizers = set_up_tokenizers_without_sound
|
| 960 |
+
try:
|
| 961 |
+
yield
|
| 962 |
+
finally:
|
| 963 |
+
omni_mot_model_cls.set_up_tokenizers = original_set_up_tokenizers
|
| 964 |
+
|
| 965 |
+
|
| 966 |
+
def main():
|
| 967 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 968 |
+
parser.add_argument(
|
| 969 |
+
"--checkpoint-path",
|
| 970 |
+
default="Cosmos3-Nano",
|
| 971 |
+
help="Named checkpoint (e.g. 'Cosmos3-Nano') or path to a DCP checkpoint directory.",
|
| 972 |
+
)
|
| 973 |
+
parser.add_argument("--output", required=True, help="Directory to save the converted diffusers model.")
|
| 974 |
+
parser.add_argument(
|
| 975 |
+
"--save-pipeline",
|
| 976 |
+
action="store_true",
|
| 977 |
+
help="Save the full pipeline (transformer + VAE + tokenizer + scheduler).",
|
| 978 |
+
)
|
| 979 |
+
parser.add_argument(
|
| 980 |
+
"--dtype", default="bf16", choices=["fp32", "fp16", "bf16"], help="Dtype to save the transformer in."
|
| 981 |
+
)
|
| 982 |
+
parser.add_argument(
|
| 983 |
+
"--sound-tokenizer-path", help="Optional AVAE sound tokenizer checkpoint to save under sound_tokenizer/."
|
| 984 |
+
)
|
| 985 |
+
parser.add_argument(
|
| 986 |
+
"--sound-tokenizer-config-path", help="Optional AVAE config JSON to save under sound_tokenizer/config.json."
|
| 987 |
+
)
|
| 988 |
+
parser.add_argument(
|
| 989 |
+
"--include-sound-tokenizer",
|
| 990 |
+
action="store_true",
|
| 991 |
+
help="Require saving sound_tokenizer/ even if the source transformer is video-only.",
|
| 992 |
+
)
|
| 993 |
+
parser.add_argument(
|
| 994 |
+
"--use-ema",
|
| 995 |
+
action=argparse.BooleanOptionalAction,
|
| 996 |
+
default=True,
|
| 997 |
+
help="Use `net_ema` weights when converting a raw Cosmos3 Edge DCP checkpoint.",
|
| 998 |
+
)
|
| 999 |
+
parser.add_argument(
|
| 1000 |
+
"--include-reasoner",
|
| 1001 |
+
action=argparse.BooleanOptionalAction,
|
| 1002 |
+
default=True,
|
| 1003 |
+
help=(
|
| 1004 |
+
"Add the pinned Cosmos3 Edge reasoner in shared-weight form so the pipeline output is usable by "
|
| 1005 |
+
"Transformers as well as Diffusers."
|
| 1006 |
+
),
|
| 1007 |
+
)
|
| 1008 |
+
parser.add_argument(
|
| 1009 |
+
"--reasoner-repo-id",
|
| 1010 |
+
default=COSMOS3_EDGE_REASONER,
|
| 1011 |
+
help="Hugging Face repository containing the Cosmos3 Edge reasoner checkpoint.",
|
| 1012 |
+
)
|
| 1013 |
+
parser.add_argument(
|
| 1014 |
+
"--reasoner-revision",
|
| 1015 |
+
default=COSMOS3_EDGE_REASONER_REVISION,
|
| 1016 |
+
help="Pinned revision of the Cosmos3 Edge reasoner checkpoint.",
|
| 1017 |
+
)
|
| 1018 |
+
parser.add_argument(
|
| 1019 |
+
"--reasoner-path",
|
| 1020 |
+
help="Optional local Cosmos3 Edge reasoner snapshot, used instead of downloading --reasoner-repo-id.",
|
| 1021 |
+
)
|
| 1022 |
+
parser.add_argument(
|
| 1023 |
+
"--copy-edge-reasoner",
|
| 1024 |
+
action="store_true",
|
| 1025 |
+
help=(
|
| 1026 |
+
"Add the pinned shared-weight reasoner and this converter to an existing Cosmos3 Edge Diffusers "
|
| 1027 |
+
"pipeline at --output."
|
| 1028 |
+
),
|
| 1029 |
+
)
|
| 1030 |
+
args = parser.parse_args()
|
| 1031 |
+
|
| 1032 |
+
if args.copy_edge_reasoner:
|
| 1033 |
+
_add_edge_reasoner_to_pipeline(args)
|
| 1034 |
+
return
|
| 1035 |
+
|
| 1036 |
+
dtype = {"fp32": torch.float32, "fp16": torch.float16, "bf16": torch.bfloat16}[args.dtype]
|
| 1037 |
+
raw_checkpoint_path = pathlib.Path(args.checkpoint_path).expanduser()
|
| 1038 |
+
edge_dcp_model_dir = _find_edge_dcp_model_dir(raw_checkpoint_path) if raw_checkpoint_path.exists() else None
|
| 1039 |
+
if edge_dcp_model_dir is not None:
|
| 1040 |
+
_convert_edge_dcp(args, edge_dcp_model_dir, dtype)
|
| 1041 |
+
return
|
| 1042 |
+
|
| 1043 |
+
from cosmos3.common.init import init_script
|
| 1044 |
+
|
| 1045 |
+
init_script()
|
| 1046 |
+
|
| 1047 |
+
from accelerate import init_empty_weights
|
| 1048 |
+
from cosmos3.args import _CHECKPOINTS
|
| 1049 |
+
from cosmos3.model import Cosmos3OmniModel
|
| 1050 |
+
from projects.cosmos3.vfm.models.omni_mot_model import OmniMoTModel
|
| 1051 |
+
from transformers import AutoTokenizer
|
| 1052 |
+
|
| 1053 |
+
from diffusers import AutoencoderKLWan, UniPCMultistepScheduler
|
| 1054 |
+
from diffusers.models.transformers.transformer_cosmos3 import Cosmos3OmniTransformer
|
| 1055 |
+
from diffusers.pipelines.cosmos.pipeline_cosmos3_omni import Cosmos3OmniPipeline
|
| 1056 |
+
|
| 1057 |
+
sound_tokenizer_path = (
|
| 1058 |
+
pathlib.Path(args.sound_tokenizer_path).expanduser().absolute() if args.sound_tokenizer_path else None
|
| 1059 |
+
)
|
| 1060 |
+
sound_tokenizer_config_path = (
|
| 1061 |
+
pathlib.Path(args.sound_tokenizer_config_path).expanduser().absolute()
|
| 1062 |
+
if args.sound_tokenizer_config_path
|
| 1063 |
+
else None
|
| 1064 |
+
)
|
| 1065 |
+
if args.include_sound_tokenizer and sound_tokenizer_path is None:
|
| 1066 |
+
raise ValueError("Sound tokenizer output was requested, but --sound-tokenizer-path was not provided.")
|
| 1067 |
+
if sound_tokenizer_path is not None and not sound_tokenizer_path.exists():
|
| 1068 |
+
raise FileNotFoundError(f"Sound tokenizer checkpoint not found: {sound_tokenizer_path}")
|
| 1069 |
+
if sound_tokenizer_config_path is not None and not sound_tokenizer_config_path.exists():
|
| 1070 |
+
raise FileNotFoundError(f"Sound tokenizer config not found: {sound_tokenizer_config_path}")
|
| 1071 |
+
|
| 1072 |
+
checkpoint_name = args.checkpoint_path
|
| 1073 |
+
if checkpoint_name in _CHECKPOINTS:
|
| 1074 |
+
checkpoint_path = pathlib.Path(_CHECKPOINTS[checkpoint_name].download())
|
| 1075 |
+
else:
|
| 1076 |
+
checkpoint_path = pathlib.Path(checkpoint_name).expanduser().absolute()
|
| 1077 |
+
print(f"Resolved checkpoint path: {checkpoint_path}")
|
| 1078 |
+
|
| 1079 |
+
print("Instantiating model and loading weights from DCP checkpoint …")
|
| 1080 |
+
print("Skipping source AVAE tokenizer instantiation during converter-only model load …")
|
| 1081 |
+
with _skip_source_sound_tokenizer_load(OmniMoTModel):
|
| 1082 |
+
_tmp = Cosmos3OmniModel.from_pretrained_dcp(checkpoint_path).model
|
| 1083 |
+
|
| 1084 |
+
# Extract network components and architecture config from DCP model
|
| 1085 |
+
language_model = _tmp.net.language_model
|
| 1086 |
+
vae2llm = _tmp.net.vae2llm
|
| 1087 |
+
llm2vae = _tmp.net.llm2vae
|
| 1088 |
+
time_embedder = _tmp.net.time_embedder
|
| 1089 |
+
lm_cfg = _tmp.net.language_model.config
|
| 1090 |
+
net_cfg = _tmp.net.config
|
| 1091 |
+
model_cfg = _tmp.config
|
| 1092 |
+
patch_latent_dim = _tmp.net.patch_latent_dim
|
| 1093 |
+
hidden_size = _tmp.net.hidden_size
|
| 1094 |
+
num_attention_heads = _tmp.net.num_heads
|
| 1095 |
+
num_key_value_heads = _tmp.net.num_kv_heads
|
| 1096 |
+
head_dim = _tmp.net.head_dim
|
| 1097 |
+
num_hidden_layers = _tmp.net.num_hidden_layers
|
| 1098 |
+
latent_patch_size = _tmp.net.latent_patch_size
|
| 1099 |
+
latent_channel = _tmp.net.latent_channel
|
| 1100 |
+
timestep_scale = _tmp.net.timestep_scale
|
| 1101 |
+
base_fps = int(net_cfg.base_fps)
|
| 1102 |
+
enable_fps_modulation = net_cfg.enable_fps_modulation
|
| 1103 |
+
unified_3d_mrope_reset_spatial_ids = _tmp.config.diffusion_expert_config.unified_3d_mrope_reset_spatial_ids
|
| 1104 |
+
unified_3d_mrope_temporal_modality_margin = (
|
| 1105 |
+
_tmp.config.diffusion_expert_config.unified_3d_mrope_temporal_modality_margin
|
| 1106 |
+
)
|
| 1107 |
+
sound2llm = getattr(_tmp.net, "sound2llm", None)
|
| 1108 |
+
llm2sound = getattr(_tmp.net, "llm2sound", None)
|
| 1109 |
+
sound_modality_embed = getattr(_tmp.net, "sound_modality_embed", None)
|
| 1110 |
+
has_sound_projection_weights = any(module is not None for module in (sound2llm, llm2sound, sound_modality_embed))
|
| 1111 |
+
sound_gen = bool(
|
| 1112 |
+
_get_config_value(net_cfg, model_cfg, name="sound_gen", default=False) or has_sound_projection_weights
|
| 1113 |
+
)
|
| 1114 |
+
sound_dim = _get_config_value(net_cfg, model_cfg, name="sound_dim", default=None)
|
| 1115 |
+
if sound_dim is None and sound2llm is not None:
|
| 1116 |
+
sound_dim = sound2llm.in_features
|
| 1117 |
+
sound_latent_fps = _get_config_value(net_cfg, model_cfg, name="sound_latent_fps", default=25.0)
|
| 1118 |
+
if sound_gen:
|
| 1119 |
+
missing_sound_modules = [
|
| 1120 |
+
name
|
| 1121 |
+
for name, module in (
|
| 1122 |
+
("sound2llm", sound2llm),
|
| 1123 |
+
("llm2sound", llm2sound),
|
| 1124 |
+
("sound_modality_embed", sound_modality_embed),
|
| 1125 |
+
)
|
| 1126 |
+
if module is None
|
| 1127 |
+
]
|
| 1128 |
+
if missing_sound_modules:
|
| 1129 |
+
raise RuntimeError(
|
| 1130 |
+
"Source checkpoint is configured for sound generation but is missing "
|
| 1131 |
+
f"sound projection weights: {missing_sound_modules}."
|
| 1132 |
+
)
|
| 1133 |
+
if sound_dim is None:
|
| 1134 |
+
raise RuntimeError("Source checkpoint is configured for sound generation but sound_dim is missing.")
|
| 1135 |
+
del _tmp
|
| 1136 |
+
torch.cuda.empty_cache()
|
| 1137 |
+
|
| 1138 |
+
# Init diffusers Cosmos3OmniTransformer with full architecture config from DCP
|
| 1139 |
+
with init_empty_weights():
|
| 1140 |
+
transformer = Cosmos3OmniTransformer(
|
| 1141 |
+
attention_bias=lm_cfg.attention_bias,
|
| 1142 |
+
attention_dropout=lm_cfg.attention_dropout,
|
| 1143 |
+
base_fps=base_fps,
|
| 1144 |
+
enable_fps_modulation=enable_fps_modulation,
|
| 1145 |
+
head_dim=head_dim,
|
| 1146 |
+
hidden_size=hidden_size,
|
| 1147 |
+
intermediate_size=lm_cfg.intermediate_size,
|
| 1148 |
+
latent_channel=latent_channel,
|
| 1149 |
+
latent_patch_size=latent_patch_size,
|
| 1150 |
+
num_attention_heads=num_attention_heads,
|
| 1151 |
+
num_hidden_layers=num_hidden_layers,
|
| 1152 |
+
num_key_value_heads=num_key_value_heads,
|
| 1153 |
+
patch_latent_dim=patch_latent_dim,
|
| 1154 |
+
rms_norm_eps=lm_cfg.rms_norm_eps,
|
| 1155 |
+
rope_scaling=lm_cfg.rope_scaling,
|
| 1156 |
+
rope_theta=lm_cfg.rope_theta,
|
| 1157 |
+
sound_dim=sound_dim,
|
| 1158 |
+
sound_gen=sound_gen,
|
| 1159 |
+
sound_latent_fps=sound_latent_fps,
|
| 1160 |
+
timestep_scale=timestep_scale,
|
| 1161 |
+
unified_3d_mrope_reset_spatial_ids=unified_3d_mrope_reset_spatial_ids,
|
| 1162 |
+
unified_3d_mrope_temporal_modality_margin=unified_3d_mrope_temporal_modality_margin,
|
| 1163 |
+
vocab_size=lm_cfg.vocab_size,
|
| 1164 |
+
backbone_type="cosmos3_edge_nemotron_dense",
|
| 1165 |
+
|
| 1166 |
+
)
|
| 1167 |
+
# The source language_model nests its transformer stack under a `model.` attribute
|
| 1168 |
+
# (HF Qwen-style). Diffusers Cosmos3OmniTransformer holds those layers flat, so
|
| 1169 |
+
# strip the leading `model.` prefix from the language-model state-dict keys.
|
| 1170 |
+
state_dict = {
|
| 1171 |
+
(k[len("model.") :] if k.startswith("model.") else k): v for k, v in language_model.state_dict().items()
|
| 1172 |
+
}
|
| 1173 |
+
# Remap PackedAttentionMoT attribute names from the source (Qwen-style q_proj/k_proj/...
|
| 1174 |
+
# plus cosmos-specific *_moe_gen) to the diffusers AttentionModuleMixin canonical names.
|
| 1175 |
+
# Order matters: the *_moe_gen substrings must be substituted before the plain ones.
|
| 1176 |
+
_ATTN_KEY_REMAP = [
|
| 1177 |
+
(".q_proj_moe_gen.", ".add_q_proj."),
|
| 1178 |
+
(".k_proj_moe_gen.", ".add_k_proj."),
|
| 1179 |
+
(".v_proj_moe_gen.", ".add_v_proj."),
|
| 1180 |
+
(".o_proj_moe_gen.", ".to_add_out."),
|
| 1181 |
+
(".q_norm_moe_gen.", ".norm_added_q."),
|
| 1182 |
+
(".k_norm_moe_gen.", ".norm_added_k."),
|
| 1183 |
+
(".q_proj.", ".to_q."),
|
| 1184 |
+
(".k_proj.", ".to_k."),
|
| 1185 |
+
(".v_proj.", ".to_v."),
|
| 1186 |
+
(".o_proj.", ".to_out."),
|
| 1187 |
+
(".q_norm.", ".norm_q."),
|
| 1188 |
+
(".k_norm.", ".norm_k."),
|
| 1189 |
+
]
|
| 1190 |
+
remapped_state_dict: dict[str, torch.Tensor] = {}
|
| 1191 |
+
for k, v in state_dict.items():
|
| 1192 |
+
for old, new in _ATTN_KEY_REMAP:
|
| 1193 |
+
if old in k:
|
| 1194 |
+
k = k.replace(old, new)
|
| 1195 |
+
break
|
| 1196 |
+
remapped_state_dict[k] = v
|
| 1197 |
+
state_dict = remapped_state_dict
|
| 1198 |
+
for k, v in vae2llm.state_dict().items():
|
| 1199 |
+
state_dict[f"proj_in.{k}"] = v
|
| 1200 |
+
for k, v in llm2vae.state_dict().items():
|
| 1201 |
+
state_dict[f"proj_out.{k}"] = v
|
| 1202 |
+
_TIME_EMBEDDER_REMAP = {
|
| 1203 |
+
"mlp.0.weight": "linear_1.weight",
|
| 1204 |
+
"mlp.0.bias": "linear_1.bias",
|
| 1205 |
+
"mlp.2.weight": "linear_2.weight",
|
| 1206 |
+
"mlp.2.bias": "linear_2.bias",
|
| 1207 |
+
}
|
| 1208 |
+
for k, v in time_embedder.state_dict().items():
|
| 1209 |
+
state_dict[f"time_embedder.{_TIME_EMBEDDER_REMAP[k]}"] = v
|
| 1210 |
+
if sound_gen:
|
| 1211 |
+
for k, v in sound2llm.state_dict().items():
|
| 1212 |
+
state_dict[f"audio_proj_in.{k}"] = v
|
| 1213 |
+
for k, v in llm2sound.state_dict().items():
|
| 1214 |
+
state_dict[f"audio_proj_out.{k}"] = v
|
| 1215 |
+
state_dict["audio_modality_embed"] = sound_modality_embed
|
| 1216 |
+
transformer.load_state_dict(state_dict, strict=True, assign=True)
|
| 1217 |
+
del (
|
| 1218 |
+
language_model,
|
| 1219 |
+
vae2llm,
|
| 1220 |
+
llm2vae,
|
| 1221 |
+
time_embedder,
|
| 1222 |
+
sound2llm,
|
| 1223 |
+
llm2sound,
|
| 1224 |
+
sound_modality_embed,
|
| 1225 |
+
state_dict,
|
| 1226 |
+
)
|
| 1227 |
+
torch.cuda.empty_cache()
|
| 1228 |
+
|
| 1229 |
+
transformer = transformer.to(dtype=dtype)
|
| 1230 |
+
|
| 1231 |
+
output_dir = pathlib.Path(args.output)
|
| 1232 |
+
output_dir.mkdir(parents=True, exist_ok=True)
|
| 1233 |
+
include_sound_tokenizer = (
|
| 1234 |
+
args.include_sound_tokenizer or sound_tokenizer_path is not None or (sound_gen and args.save_pipeline)
|
| 1235 |
+
)
|
| 1236 |
+
if include_sound_tokenizer and sound_tokenizer_path is None:
|
| 1237 |
+
raise ValueError(
|
| 1238 |
+
"The source checkpoint is configured for sound generation, so --sound-tokenizer-path "
|
| 1239 |
+
"is required when saving a full pipeline."
|
| 1240 |
+
)
|
| 1241 |
+
|
| 1242 |
+
if args.save_pipeline:
|
| 1243 |
+
text_tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-VL-8B-Instruct")
|
| 1244 |
+
|
| 1245 |
+
diffusers_vae = AutoencoderKLWan.from_pretrained(
|
| 1246 |
+
"Wan-AI/Wan2.2-TI2V-5B-Diffusers", subfolder="vae", torch_dtype=torch.bfloat16
|
| 1247 |
+
)
|
| 1248 |
+
sound_tokenizer = None
|
| 1249 |
+
if include_sound_tokenizer:
|
| 1250 |
+
assert sound_tokenizer_path is not None
|
| 1251 |
+
sound_tokenizer = _build_sound_tokenizer(sound_tokenizer_path, sound_tokenizer_config_path)
|
| 1252 |
+
|
| 1253 |
+
# Karras schedule approximating FlowUniPCMultistepScheduler with shift=5, 35 steps.
|
| 1254 |
+
# Measured from that schedule: first flow-sigma=0.9998, last flow-sigma=0.1281.
|
| 1255 |
+
# EDM sigma = flow_sigma / (1 - flow_sigma), so:
|
| 1256 |
+
# sigma_max = 0.9998 / 0.0002 = 4999 (but capped at 200 to avoid duplicate
|
| 1257 |
+
# integer timesteps from Karras clustering near the top)
|
| 1258 |
+
# sigma_min = 0.1281 / (1 - 0.1281) = 0.1281 / 0.8719 ≈ 0.147
|
| 1259 |
+
scheduler = UniPCMultistepScheduler(
|
| 1260 |
+
use_karras_sigmas=True,
|
| 1261 |
+
use_flow_sigmas=True,
|
| 1262 |
+
prediction_type="flow_prediction",
|
| 1263 |
+
sigma_max=200.0,
|
| 1264 |
+
sigma_min=0.147,
|
| 1265 |
+
)
|
| 1266 |
+
|
| 1267 |
+
pipeline = Cosmos3OmniPipeline(
|
| 1268 |
+
transformer=transformer,
|
| 1269 |
+
text_tokenizer=text_tokenizer,
|
| 1270 |
+
vae=diffusers_vae,
|
| 1271 |
+
scheduler=scheduler,
|
| 1272 |
+
sound_tokenizer=sound_tokenizer,
|
| 1273 |
+
)
|
| 1274 |
+
print(f"Saving full pipeline to {output_dir} …")
|
| 1275 |
+
pipeline.save_pretrained(str(output_dir), safe_serialization=True, max_shard_size="5GB")
|
| 1276 |
+
else:
|
| 1277 |
+
print(f"Saving transformer to {output_dir} …")
|
| 1278 |
+
transformer.save_pretrained(str(output_dir), safe_serialization=True, max_shard_size="5GB")
|
| 1279 |
+
if include_sound_tokenizer:
|
| 1280 |
+
print("Skipping sound_tokenizer/ save because --save-pipeline was not set.")
|
| 1281 |
+
|
| 1282 |
+
print("Done.")
|
| 1283 |
+
|
| 1284 |
+
|
| 1285 |
+
if __name__ == "__main__":
|
| 1286 |
+
main()
|
generation_config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": 11,
|
| 6 |
+
"pad_token_id": 0,
|
| 7 |
+
"transformers_version": "5.14.0.dev0"
|
| 8 |
+
}
|
images/benchmark-robolab.png
ADDED
|
Git LFS Details
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model_index.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "Cosmos3OmniPipeline",
|
| 3 |
+
"_diffusers_version": "0.40.0.dev0",
|
| 4 |
+
"default_use_system_prompt": false,
|
| 5 |
+
"enable_safety_checker": false,
|
| 6 |
+
"safety_checker": [
|
| 7 |
+
null,
|
| 8 |
+
null
|
| 9 |
+
],
|
| 10 |
+
"scheduler": [
|
| 11 |
+
"diffusers",
|
| 12 |
+
"UniPCMultistepScheduler"
|
| 13 |
+
],
|
| 14 |
+
"sound_tokenizer": [
|
| 15 |
+
null,
|
| 16 |
+
null
|
| 17 |
+
],
|
| 18 |
+
"text_tokenizer": [
|
| 19 |
+
"transformers",
|
| 20 |
+
"PreTrainedTokenizerFast"
|
| 21 |
+
],
|
| 22 |
+
"transformer": [
|
| 23 |
+
"diffusers",
|
| 24 |
+
"Cosmos3OmniTransformer"
|
| 25 |
+
],
|
| 26 |
+
"use_native_flow_schedule": true,
|
| 27 |
+
"vae": [
|
| 28 |
+
"diffusers",
|
| 29 |
+
"AutoencoderKLWan"
|
| 30 |
+
]
|
| 31 |
+
}
|
modular_model_index.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_blocks_class_name": "Cosmos3OmniBlocks",
|
| 3 |
+
"_class_name": "Cosmos3OmniModularPipeline",
|
| 4 |
+
"_diffusers_version": "0.40.0.dev0",
|
| 5 |
+
"is_distilled": false,
|
| 6 |
+
"scheduler": [
|
| 7 |
+
"diffusers",
|
| 8 |
+
"UniPCMultistepScheduler",
|
| 9 |
+
{
|
| 10 |
+
"pretrained_model_name_or_path": "nvidia/Cosmos3-Edge-Policy-DROID",
|
| 11 |
+
"subfolder": "scheduler",
|
| 12 |
+
"type_hint": [
|
| 13 |
+
"diffusers",
|
| 14 |
+
"UniPCMultistepScheduler"
|
| 15 |
+
],
|
| 16 |
+
"variant": null
|
| 17 |
+
}
|
| 18 |
+
],
|
| 19 |
+
"text_tokenizer": [
|
| 20 |
+
"transformers",
|
| 21 |
+
"PreTrainedTokenizerFast",
|
| 22 |
+
{
|
| 23 |
+
"pretrained_model_name_or_path": "nvidia/Cosmos3-Edge-Policy-DROID",
|
| 24 |
+
"subfolder": "text_tokenizer",
|
| 25 |
+
"type_hint": [
|
| 26 |
+
"transformers",
|
| 27 |
+
"PreTrainedTokenizerFast"
|
| 28 |
+
],
|
| 29 |
+
"variant": null
|
| 30 |
+
}
|
| 31 |
+
],
|
| 32 |
+
"transformer": [
|
| 33 |
+
"diffusers",
|
| 34 |
+
"Cosmos3OmniTransformer",
|
| 35 |
+
{
|
| 36 |
+
"pretrained_model_name_or_path": "nvidia/Cosmos3-Edge-Policy-DROID",
|
| 37 |
+
"subfolder": "transformer",
|
| 38 |
+
"type_hint": [
|
| 39 |
+
"diffusers",
|
| 40 |
+
"Cosmos3OmniTransformer"
|
| 41 |
+
],
|
| 42 |
+
"variant": null
|
| 43 |
+
}
|
| 44 |
+
],
|
| 45 |
+
"vae": [
|
| 46 |
+
"diffusers",
|
| 47 |
+
"AutoencoderKLWan",
|
| 48 |
+
{
|
| 49 |
+
"pretrained_model_name_or_path": "nvidia/Cosmos3-Edge-Policy-DROID",
|
| 50 |
+
"subfolder": "vae",
|
| 51 |
+
"type_hint": [
|
| 52 |
+
"diffusers",
|
| 53 |
+
"AutoencoderKLWan"
|
| 54 |
+
],
|
| 55 |
+
"variant": null
|
| 56 |
+
}
|
| 57 |
+
]
|
| 58 |
+
}
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"size": {
|
| 3 |
+
"longest_edge": 16777216,
|
| 4 |
+
"shortest_edge": 65536
|
| 5 |
+
},
|
| 6 |
+
"do_resize": true,
|
| 7 |
+
"patch_size": 16,
|
| 8 |
+
"merge_size": 2,
|
| 9 |
+
"image_mean": [
|
| 10 |
+
0.5,
|
| 11 |
+
0.5,
|
| 12 |
+
0.5
|
| 13 |
+
],
|
| 14 |
+
"image_std": [
|
| 15 |
+
0.5,
|
| 16 |
+
0.5,
|
| 17 |
+
0.5
|
| 18 |
+
],
|
| 19 |
+
"processor_class": "Cosmos3EdgeProcessor",
|
| 20 |
+
"image_processor_type": "Cosmos3EdgeImageProcessor"
|
| 21 |
+
}
|
processor_config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"processor_class": "Cosmos3EdgeProcessor",
|
| 3 |
+
"image_processor": {
|
| 4 |
+
"size": {
|
| 5 |
+
"longest_edge": 16777216,
|
| 6 |
+
"shortest_edge": 65536
|
| 7 |
+
},
|
| 8 |
+
"do_resize": true,
|
| 9 |
+
"patch_size": 16,
|
| 10 |
+
"merge_size": 2,
|
| 11 |
+
"image_mean": [
|
| 12 |
+
0.5,
|
| 13 |
+
0.5,
|
| 14 |
+
0.5
|
| 15 |
+
],
|
| 16 |
+
"image_std": [
|
| 17 |
+
0.5,
|
| 18 |
+
0.5,
|
| 19 |
+
0.5
|
| 20 |
+
],
|
| 21 |
+
"image_processor_type": "Cosmos3EdgeImageProcessor"
|
| 22 |
+
},
|
| 23 |
+
"video_processor": {
|
| 24 |
+
"size": {
|
| 25 |
+
"longest_edge": 25165824,
|
| 26 |
+
"shortest_edge": 4096
|
| 27 |
+
},
|
| 28 |
+
"temporal_patch_size": 1,
|
| 29 |
+
"patch_size": 16,
|
| 30 |
+
"merge_size": 2,
|
| 31 |
+
"image_mean": [
|
| 32 |
+
0.5,
|
| 33 |
+
0.5,
|
| 34 |
+
0.5
|
| 35 |
+
],
|
| 36 |
+
"image_std": [
|
| 37 |
+
0.5,
|
| 38 |
+
0.5,
|
| 39 |
+
0.5
|
| 40 |
+
],
|
| 41 |
+
"video_processor_type": "Cosmos3EdgeVideoProcessor",
|
| 42 |
+
"return_metadata": true
|
| 43 |
+
}
|
| 44 |
+
}
|
scheduler/scheduler_config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "UniPCMultistepScheduler",
|
| 3 |
+
"_diffusers_version": "0.40.0.dev0",
|
| 4 |
+
"beta_end": 0.02,
|
| 5 |
+
"beta_schedule": "linear",
|
| 6 |
+
"beta_start": 0.0001,
|
| 7 |
+
"disable_corrector": [],
|
| 8 |
+
"dynamic_thresholding_ratio": 0.995,
|
| 9 |
+
"final_sigmas_type": "zero",
|
| 10 |
+
"flow_shift": 5.0,
|
| 11 |
+
"lower_order_final": true,
|
| 12 |
+
"num_train_timesteps": 1000,
|
| 13 |
+
"predict_x0": true,
|
| 14 |
+
"prediction_type": "flow_prediction",
|
| 15 |
+
"rescale_betas_zero_snr": false,
|
| 16 |
+
"sample_max_value": 1.0,
|
| 17 |
+
"shift_terminal": null,
|
| 18 |
+
"sigma_max": null,
|
| 19 |
+
"sigma_min": null,
|
| 20 |
+
"solver_order": 2,
|
| 21 |
+
"solver_p": null,
|
| 22 |
+
"solver_type": "bh2",
|
| 23 |
+
"steps_offset": 0,
|
| 24 |
+
"thresholding": false,
|
| 25 |
+
"time_shift_type": "exponential",
|
| 26 |
+
"timestep_spacing": "linspace",
|
| 27 |
+
"trained_betas": null,
|
| 28 |
+
"use_beta_sigmas": false,
|
| 29 |
+
"use_dynamic_shifting": false,
|
| 30 |
+
"use_exponential_sigmas": false,
|
| 31 |
+
"use_flow_sigmas": true,
|
| 32 |
+
"use_karras_sigmas": false
|
| 33 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "<|im_end|>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<|im_end|>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
text_tokenizer/chat_template.jinja
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
{% macro render_extra_keys(json_dict, handled_keys) %}
|
| 3 |
+
{%- if json_dict is mapping %}
|
| 4 |
+
{%- for json_key in json_dict if json_key not in handled_keys %}
|
| 5 |
+
{%- if json_dict[json_key] is mapping or (json_dict[json_key] is sequence and json_dict[json_key] is not string) %}
|
| 6 |
+
{{- '
|
| 7 |
+
<' ~ json_key ~ '>' ~ (json_dict[json_key] | tojson | safe) ~ '</' ~ json_key ~ '>' }}
|
| 8 |
+
{%- else %}
|
| 9 |
+
{{-'
|
| 10 |
+
<' ~ json_key ~ '>' ~ (json_dict[json_key] | string) ~ '</' ~ json_key ~ '>' }}
|
| 11 |
+
{%- endif %}
|
| 12 |
+
{%- endfor %}
|
| 13 |
+
{%- endif %}
|
| 14 |
+
{% endmacro %}
|
| 15 |
+
{%- set enable_thinking = enable_thinking if enable_thinking is defined else True %}
|
| 16 |
+
{%- set truncate_history_thinking = truncate_history_thinking if truncate_history_thinking is defined else True %}
|
| 17 |
+
|
| 18 |
+
{%- set ns = namespace(last_user_idx = -1) %}
|
| 19 |
+
{%- set loop_messages = messages %}
|
| 20 |
+
{%- for m in loop_messages %}
|
| 21 |
+
{%- if m["role"] == "user" %}
|
| 22 |
+
{%- set ns.last_user_idx = loop.index0 %}
|
| 23 |
+
{%- endif %}
|
| 24 |
+
{%- endfor %}
|
| 25 |
+
|
| 26 |
+
{%- if messages[0]["role"] == "system" %}
|
| 27 |
+
{%- if messages[0]["content"] is string %}
|
| 28 |
+
{%- set system_message = messages[0]["content"] %}
|
| 29 |
+
{%- else %}
|
| 30 |
+
{%- set ns = namespace(system_text="") %}
|
| 31 |
+
{%- for part in messages[0]["content"] %}
|
| 32 |
+
{%- if 'text' in part %}
|
| 33 |
+
{%- set ns.system_text = ns.system_text + part.text %}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- endfor %}
|
| 36 |
+
{%- set system_message = ns.system_text %}
|
| 37 |
+
{%- endif %}
|
| 38 |
+
|
| 39 |
+
{%- set loop_messages = messages[1:] %}
|
| 40 |
+
{%- else %}
|
| 41 |
+
{%- set system_message = "" %}
|
| 42 |
+
{%- set loop_messages = messages %}
|
| 43 |
+
{%- endif %}
|
| 44 |
+
{%- if not tools is defined %}
|
| 45 |
+
{%- set tools = [] %}
|
| 46 |
+
{%- endif %}
|
| 47 |
+
{# Recompute last_user_idx relative to loop_messages after handling system #}
|
| 48 |
+
{%- set ns = namespace(last_user_idx = -1) %}
|
| 49 |
+
{%- for m in loop_messages %}
|
| 50 |
+
{%- if m["role"] == "user" %}
|
| 51 |
+
{%- set ns.last_user_idx = loop.index0 %}
|
| 52 |
+
{%- endif %}
|
| 53 |
+
{%- endfor %}
|
| 54 |
+
{%- if system_message is defined %}
|
| 55 |
+
{{- "<|im_start|>system
|
| 56 |
+
" + system_message }}
|
| 57 |
+
{%- else %}
|
| 58 |
+
{%- if tools is iterable and tools | length > 0 %}
|
| 59 |
+
{{- "<|im_start|>system
|
| 60 |
+
" }}
|
| 61 |
+
{%- endif %}
|
| 62 |
+
{%- endif %}
|
| 63 |
+
{%- if tools is iterable and tools | length > 0 %}
|
| 64 |
+
{%- if system_message is defined and system_message | length > 0 %}
|
| 65 |
+
{{- "
|
| 66 |
+
|
| 67 |
+
" }}
|
| 68 |
+
{%- endif %}
|
| 69 |
+
{{- "# Tools
|
| 70 |
+
|
| 71 |
+
You have access to the following functions:
|
| 72 |
+
|
| 73 |
+
" }}
|
| 74 |
+
{{- "<tools>" }}
|
| 75 |
+
{%- for tool in tools %}
|
| 76 |
+
{%- if tool.function is defined %}
|
| 77 |
+
{%- set tool = tool.function %}
|
| 78 |
+
{%- endif %}
|
| 79 |
+
{{- "
|
| 80 |
+
<function>
|
| 81 |
+
<name>" ~ tool.name ~ "</name>" }}
|
| 82 |
+
{%- if tool.description is defined %}
|
| 83 |
+
{{- '
|
| 84 |
+
<description>' ~ (tool.description | trim) ~ '</description>' }}
|
| 85 |
+
{%- endif %}
|
| 86 |
+
{{- '
|
| 87 |
+
<parameters>' }}
|
| 88 |
+
{%- if tool.parameters is defined and tool.parameters is mapping and tool.parameters.properties is defined and tool.parameters.properties is mapping %}
|
| 89 |
+
{%- for param_name, param_fields in tool.parameters.properties|items %}
|
| 90 |
+
{{- '
|
| 91 |
+
<parameter>' }}
|
| 92 |
+
{{- '
|
| 93 |
+
<name>' ~ param_name ~ '</name>' }}
|
| 94 |
+
{%- if param_fields.type is defined %}
|
| 95 |
+
{{- '
|
| 96 |
+
<type>' ~ (param_fields.type | string) ~ '</type>' }}
|
| 97 |
+
{%- endif %}
|
| 98 |
+
{%- if param_fields.description is defined %}
|
| 99 |
+
{{- '
|
| 100 |
+
<description>' ~ (param_fields.description | trim) ~ '</description>' }}
|
| 101 |
+
{%- endif %}
|
| 102 |
+
{%- if param_fields.enum is defined %}
|
| 103 |
+
{{- '
|
| 104 |
+
<enum>' ~ (param_fields.enum | tojson | safe) ~ '</enum>' }}
|
| 105 |
+
{%- endif %}
|
| 106 |
+
{%- set handled_keys = ['name', 'type', 'description', 'enum'] %}
|
| 107 |
+
{{- render_extra_keys(param_fields, handled_keys) }}
|
| 108 |
+
{{- '
|
| 109 |
+
</parameter>' }}
|
| 110 |
+
{%- endfor %}
|
| 111 |
+
{%- endif %}
|
| 112 |
+
{% set handled_keys = ['type', 'properties', 'required'] %}
|
| 113 |
+
{{- render_extra_keys(tool.parameters, handled_keys) }}
|
| 114 |
+
{%- if tool.parameters is defined and tool.parameters.required is defined %}
|
| 115 |
+
{{- '
|
| 116 |
+
<required>' ~ (tool.parameters.required | tojson | safe) ~ '</required>' }}
|
| 117 |
+
{%- endif %}
|
| 118 |
+
{{- '
|
| 119 |
+
</parameters>' }}
|
| 120 |
+
{%- set handled_keys = ['type', 'name', 'description', 'parameters'] %}
|
| 121 |
+
{{- render_extra_keys(tool, handled_keys) }}
|
| 122 |
+
{{- '
|
| 123 |
+
</function>' }}
|
| 124 |
+
{%- endfor %}
|
| 125 |
+
{{- "
|
| 126 |
+
</tools>" }}
|
| 127 |
+
|
| 128 |
+
{{- '
|
| 129 |
+
|
| 130 |
+
If you choose to call a function ONLY reply in the following format with NO suffix:
|
| 131 |
+
|
| 132 |
+
<tool_call>
|
| 133 |
+
<function=example_function_name>
|
| 134 |
+
<parameter=example_parameter_1>
|
| 135 |
+
value_1
|
| 136 |
+
</parameter>
|
| 137 |
+
<parameter=example_parameter_2>
|
| 138 |
+
This is the value for the second parameter
|
| 139 |
+
that can span
|
| 140 |
+
multiple lines
|
| 141 |
+
</parameter>
|
| 142 |
+
</function>
|
| 143 |
+
</tool_call>
|
| 144 |
+
|
| 145 |
+
<IMPORTANT>
|
| 146 |
+
Reminder:
|
| 147 |
+
- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags
|
| 148 |
+
- Required parameters MUST be specified
|
| 149 |
+
- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after
|
| 150 |
+
- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls
|
| 151 |
+
</IMPORTANT>' }}
|
| 152 |
+
{%- endif %}
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
{%- if system_message is defined %}
|
| 156 |
+
{{- '<|im_end|>
|
| 157 |
+
' }}
|
| 158 |
+
{%- else %}
|
| 159 |
+
{%- if tools is iterable and tools | length > 0 %}
|
| 160 |
+
{{- '<|im_end|>
|
| 161 |
+
' }}
|
| 162 |
+
{%- endif %}
|
| 163 |
+
{%- endif %}
|
| 164 |
+
|
| 165 |
+
{%- set image_count = namespace(value=0) %}
|
| 166 |
+
{%- set video_count = namespace(value=0) %}
|
| 167 |
+
{%- for message in loop_messages %}
|
| 168 |
+
{%- if message.role == "assistant" %}
|
| 169 |
+
{# Add reasoning content in to content field for unified processing below. #}
|
| 170 |
+
{%- set text_content = namespace(text_content="") -%}
|
| 171 |
+
{%- if message.content is string %}
|
| 172 |
+
{%- set text_content.text_content = message.content %}
|
| 173 |
+
{%- else %}
|
| 174 |
+
{%- for content in message.content %}
|
| 175 |
+
{%- if 'text' in content %}
|
| 176 |
+
{%- set text_content.text_content = content.text %}
|
| 177 |
+
{%- break %}
|
| 178 |
+
{%- endif %}
|
| 179 |
+
{%- endfor %}
|
| 180 |
+
{%- endif %}
|
| 181 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is string and message.reasoning_content | trim | length > 0 %}
|
| 182 |
+
{%- set content = "<think>
|
| 183 |
+
" ~ message.reasoning_content ~ "
|
| 184 |
+
</think>
|
| 185 |
+
" ~ (text_content.text_content | default('', true)) %}
|
| 186 |
+
{%- else %}
|
| 187 |
+
{%- set content = text_content.text_content | default('', true) %}
|
| 188 |
+
{# Allow downstream logic to to take care of broken thought, only handle coherent reasoning here. #}
|
| 189 |
+
{%- if '<think>' not in content and '</think>' not in content %}
|
| 190 |
+
{%- set content = "<think></think>" ~ content %}
|
| 191 |
+
{%- else %}
|
| 192 |
+
{%- set content = content %}
|
| 193 |
+
{%- endif -%}
|
| 194 |
+
{%- endif %}
|
| 195 |
+
{%- if message.tool_calls is defined and message.tool_calls is iterable and message.tool_calls | length > 0 %}
|
| 196 |
+
{# Assistant message has tool calls. #}
|
| 197 |
+
{{- '<|im_start|>assistant
|
| 198 |
+
' }}
|
| 199 |
+
{%- set include_content = not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}
|
| 200 |
+
{%- if content is string and content | trim | length > 0 %}
|
| 201 |
+
{%- if include_content %}
|
| 202 |
+
{{- (content | trim) ~ '
|
| 203 |
+
' -}}
|
| 204 |
+
{%- else %}
|
| 205 |
+
{%- set c = (content | string) %}
|
| 206 |
+
{%- if '</think>' in c %}
|
| 207 |
+
{# Keep only content after the last closing think. Also generation prompt causes this. #}
|
| 208 |
+
{%- set c = c.split('</think>')[-1] %}
|
| 209 |
+
{%- elif '<think>' in c %}
|
| 210 |
+
{# If <think> was opened but never closed, drop the trailing think segment #}
|
| 211 |
+
{%- set c = c.split('<think>')[0] %}
|
| 212 |
+
{%- endif %}
|
| 213 |
+
{%- set c = "<think></think>" ~ c | trim %}
|
| 214 |
+
{%- if c | length > 0 %}
|
| 215 |
+
{{- c ~ '
|
| 216 |
+
' -}}
|
| 217 |
+
{%- endif %}
|
| 218 |
+
{%- endif %}
|
| 219 |
+
{%- else %}
|
| 220 |
+
{{- "<think></think>" -}}
|
| 221 |
+
{%- endif %}
|
| 222 |
+
{%- for tool_call in message.tool_calls %}
|
| 223 |
+
{%- if tool_call.function is defined %}
|
| 224 |
+
{%- set tool_call = tool_call.function %}
|
| 225 |
+
{%- endif %}
|
| 226 |
+
{{- '<tool_call>
|
| 227 |
+
<function=' ~ tool_call.name ~ '>
|
| 228 |
+
' -}}
|
| 229 |
+
{%- if tool_call.arguments is defined %}
|
| 230 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 231 |
+
{{- '<parameter=' ~ args_name ~ '>
|
| 232 |
+
' -}}
|
| 233 |
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
| 234 |
+
{{- args_value ~ '
|
| 235 |
+
</parameter>
|
| 236 |
+
' -}}
|
| 237 |
+
{%- endfor %}
|
| 238 |
+
{%- endif %}
|
| 239 |
+
{{- '</function>
|
| 240 |
+
</tool_call>
|
| 241 |
+
' -}}
|
| 242 |
+
{%- endfor %}
|
| 243 |
+
{{- '<|im_end|>
|
| 244 |
+
' }}
|
| 245 |
+
{%- else %}
|
| 246 |
+
{# Assistant message doesn't have tool calls. #}
|
| 247 |
+
{%- if not (truncate_history_thinking and loop.index0 < ns.last_user_idx) %}
|
| 248 |
+
{{- '<|im_start|>assistant
|
| 249 |
+
' ~ (content | default('', true) | string | trim) ~ '<|im_end|>
|
| 250 |
+
' }}
|
| 251 |
+
{%- else %}
|
| 252 |
+
{%- set c = (content | default('', true) | string) %}
|
| 253 |
+
{%- if '<think>' in c and '</think>' in c %}
|
| 254 |
+
{%- set c = "<think></think>" ~ c.split('</think>')[-1] %}
|
| 255 |
+
{%- endif %}
|
| 256 |
+
{%- set c = c | trim %}
|
| 257 |
+
{%- if c | length > 0 %}
|
| 258 |
+
{{- '<|im_start|>assistant
|
| 259 |
+
' ~ c ~ '<|im_end|>
|
| 260 |
+
' }}
|
| 261 |
+
{%- else %}
|
| 262 |
+
{{- '<|im_start|>assistant
|
| 263 |
+
<|im_end|>
|
| 264 |
+
' }}
|
| 265 |
+
{%- endif %}
|
| 266 |
+
{%- endif %}
|
| 267 |
+
{%- endif %}
|
| 268 |
+
{%- elif message.role == "user" or message.role == "system" %}
|
| 269 |
+
{{- '<|im_start|>' + message.role + '
|
| 270 |
+
' }}
|
| 271 |
+
{%- if message.content is string %}
|
| 272 |
+
{{- message.content }}
|
| 273 |
+
{%- else %}
|
| 274 |
+
{%- for content in message.content %}
|
| 275 |
+
{%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
|
| 276 |
+
{%- set image_count.value = image_count.value + 1 %}
|
| 277 |
+
{%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
|
| 278 |
+
<|vision_start|><|image_pad|><|vision_end|>
|
| 279 |
+
{%- elif content.type == 'video' or 'video' in content %}
|
| 280 |
+
{%- set video_count.value = video_count.value + 1 %}
|
| 281 |
+
{%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
|
| 282 |
+
<|vision_start|><|video_pad|><|vision_end|>
|
| 283 |
+
{%- elif 'text' in content %}
|
| 284 |
+
{{- content.text }}
|
| 285 |
+
{%- endif %}
|
| 286 |
+
{%- endfor %}
|
| 287 |
+
{%- endif %}
|
| 288 |
+
{{- '<|im_end|>
|
| 289 |
+
' }}
|
| 290 |
+
{%- elif message.role == "tool" %}
|
| 291 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 292 |
+
{{- '<|im_start|>user
|
| 293 |
+
' }}
|
| 294 |
+
{%- endif %}
|
| 295 |
+
{{- '<tool_response>
|
| 296 |
+
' }}
|
| 297 |
+
{{- message.content }}
|
| 298 |
+
{{- '
|
| 299 |
+
</tool_response>
|
| 300 |
+
' }}
|
| 301 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 302 |
+
{{- '<|im_end|>
|
| 303 |
+
' }}
|
| 304 |
+
{%- elif loop.last %}
|
| 305 |
+
{{- '<|im_end|>
|
| 306 |
+
' }}
|
| 307 |
+
{%- endif %}
|
| 308 |
+
{%- else %}
|
| 309 |
+
{{- '<|im_start|>' + message.role + '
|
| 310 |
+
' + message.content + '<|im_end|>
|
| 311 |
+
' }}
|
| 312 |
+
{%- endif %}
|
| 313 |
+
{%- endfor %}
|
| 314 |
+
|
| 315 |
+
{%- if add_generation_prompt %}
|
| 316 |
+
{%- if enable_thinking %}
|
| 317 |
+
{{- '<|im_start|>assistant
|
| 318 |
+
<think>
|
| 319 |
+
' }}
|
| 320 |
+
{%- else %}
|
| 321 |
+
{{- '<|im_start|>assistant
|
| 322 |
+
<think></think>' }}
|
| 323 |
+
{%- endif %}
|
| 324 |
+
{%- endif %}
|
text_tokenizer/special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "<|im_end|>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<|im_end|>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
text_tokenizer/tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4dc692a99dca6d92a44e9529ffb53541eb79bb260eec7281bc51268c05d7311c
|
| 3 |
+
size 17077500
|
text_tokenizer/tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4dc692a99dca6d92a44e9529ffb53541eb79bb260eec7281bc51268c05d7311c
|
| 3 |
+
size 17077500
|
tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
transformer/config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "Cosmos3OmniTransformer",
|
| 3 |
+
"_diffusers_version": "0.40.0.dev0",
|
| 4 |
+
"action_dim": 64,
|
| 5 |
+
"action_gen": true,
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"base_fps": 24,
|
| 9 |
+
"enable_fps_modulation": true,
|
| 10 |
+
"head_dim": 128,
|
| 11 |
+
"hidden_act": "relu2",
|
| 12 |
+
"hidden_size": 2048,
|
| 13 |
+
"intermediate_size": 9216,
|
| 14 |
+
"latent_channel": 48,
|
| 15 |
+
"latent_patch_size": 2,
|
| 16 |
+
"num_attention_heads": 16,
|
| 17 |
+
"num_embodiment_domains": 32,
|
| 18 |
+
"num_hidden_layers": 28,
|
| 19 |
+
"num_key_value_heads": 8,
|
| 20 |
+
"patch_latent_dim": 192,
|
| 21 |
+
"qk_norm_for_text": false,
|
| 22 |
+
"rms_norm_eps": 1e-05,
|
| 23 |
+
"rope_axes_dim": [
|
| 24 |
+
24,
|
| 25 |
+
20,
|
| 26 |
+
20
|
| 27 |
+
],
|
| 28 |
+
"rope_scaling": {
|
| 29 |
+
"mrope_section": [
|
| 30 |
+
24,
|
| 31 |
+
20,
|
| 32 |
+
20
|
| 33 |
+
]
|
| 34 |
+
},
|
| 35 |
+
"rope_theta": 100000000.0,
|
| 36 |
+
"sound_dim": null,
|
| 37 |
+
"sound_gen": false,
|
| 38 |
+
"sound_latent_fps": 25.0,
|
| 39 |
+
"timestep_scale": 0.001,
|
| 40 |
+
"unified_3d_mrope_reset_spatial_ids": true,
|
| 41 |
+
"unified_3d_mrope_temporal_modality_margin": 15000,
|
| 42 |
+
"use_und_k_norm_for_gen": true,
|
| 43 |
+
"vocab_size": 131072
|
| 44 |
+
}
|
transformer/cosmos_framework_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1815af3a075108820c1f3c26d50b999299a8d831526cf561a20249bf1bb6fcd1
|
| 3 |
+
size 11032
|
transformer/diffusion_pytorch_model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:99b0ff1f9dbdcb497fac16cbc0ebe33dee19653b4c182fa0d474433dcc845206
|
| 3 |
+
size 5000041944
|
transformer/diffusion_pytorch_model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1842fefdacd0dcbb8ab543b59848a0b696e0c9634676bc76db9e0c971fe328d5
|
| 3 |
+
size 1748779008
|
transformer/diffusion_pytorch_model.safetensors.index.json
ADDED
|
@@ -0,0 +1,556 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_size": 6748759424
|
| 4 |
+
},
|
| 5 |
+
"weight_map": {
|
| 6 |
+
"action_modality_embed": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 7 |
+
"action_proj_in.bias.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 8 |
+
"action_proj_in.fc.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 9 |
+
"action_proj_out.bias.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 10 |
+
"action_proj_out.fc.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 11 |
+
"embed_tokens.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 12 |
+
"layers.0.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 13 |
+
"layers.0.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 14 |
+
"layers.0.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 15 |
+
"layers.0.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 16 |
+
"layers.0.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 17 |
+
"layers.0.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 18 |
+
"layers.0.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 19 |
+
"layers.0.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 20 |
+
"layers.0.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 21 |
+
"layers.0.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 22 |
+
"layers.0.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 23 |
+
"layers.0.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 24 |
+
"layers.0.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 25 |
+
"layers.0.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 26 |
+
"layers.0.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 27 |
+
"layers.0.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 28 |
+
"layers.0.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 29 |
+
"layers.0.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 30 |
+
"layers.0.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 31 |
+
"layers.1.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 32 |
+
"layers.1.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 33 |
+
"layers.1.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 34 |
+
"layers.1.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 35 |
+
"layers.1.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 36 |
+
"layers.1.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 37 |
+
"layers.1.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 38 |
+
"layers.1.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 39 |
+
"layers.1.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 40 |
+
"layers.1.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 41 |
+
"layers.1.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 42 |
+
"layers.1.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 43 |
+
"layers.1.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 44 |
+
"layers.1.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 45 |
+
"layers.1.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 46 |
+
"layers.1.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 47 |
+
"layers.1.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 48 |
+
"layers.1.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 49 |
+
"layers.1.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 50 |
+
"layers.10.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 51 |
+
"layers.10.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 52 |
+
"layers.10.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 53 |
+
"layers.10.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 54 |
+
"layers.10.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 55 |
+
"layers.10.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 56 |
+
"layers.10.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 57 |
+
"layers.10.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 58 |
+
"layers.10.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 59 |
+
"layers.10.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 60 |
+
"layers.10.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 61 |
+
"layers.10.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 62 |
+
"layers.10.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 63 |
+
"layers.10.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 64 |
+
"layers.10.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 65 |
+
"layers.10.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 66 |
+
"layers.10.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 67 |
+
"layers.10.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 68 |
+
"layers.10.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 69 |
+
"layers.11.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 70 |
+
"layers.11.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 71 |
+
"layers.11.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 72 |
+
"layers.11.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 73 |
+
"layers.11.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 74 |
+
"layers.11.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 75 |
+
"layers.11.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 76 |
+
"layers.11.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 77 |
+
"layers.11.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 78 |
+
"layers.11.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 79 |
+
"layers.11.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 80 |
+
"layers.11.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 81 |
+
"layers.11.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 82 |
+
"layers.11.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 83 |
+
"layers.11.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 84 |
+
"layers.11.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 85 |
+
"layers.11.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 86 |
+
"layers.11.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 87 |
+
"layers.11.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 88 |
+
"layers.12.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 89 |
+
"layers.12.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 90 |
+
"layers.12.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 91 |
+
"layers.12.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 92 |
+
"layers.12.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 93 |
+
"layers.12.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 94 |
+
"layers.12.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 95 |
+
"layers.12.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 96 |
+
"layers.12.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 97 |
+
"layers.12.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 98 |
+
"layers.12.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 99 |
+
"layers.12.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 100 |
+
"layers.12.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 101 |
+
"layers.12.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 102 |
+
"layers.12.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 103 |
+
"layers.12.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 104 |
+
"layers.12.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 105 |
+
"layers.12.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 106 |
+
"layers.12.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 107 |
+
"layers.13.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 108 |
+
"layers.13.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 109 |
+
"layers.13.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 110 |
+
"layers.13.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 111 |
+
"layers.13.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 112 |
+
"layers.13.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 113 |
+
"layers.13.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 114 |
+
"layers.13.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 115 |
+
"layers.13.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 116 |
+
"layers.13.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 117 |
+
"layers.13.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 118 |
+
"layers.13.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 119 |
+
"layers.13.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 120 |
+
"layers.13.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 121 |
+
"layers.13.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 122 |
+
"layers.13.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 123 |
+
"layers.13.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 124 |
+
"layers.13.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 125 |
+
"layers.13.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 126 |
+
"layers.14.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 127 |
+
"layers.14.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 128 |
+
"layers.14.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 129 |
+
"layers.14.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 130 |
+
"layers.14.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 131 |
+
"layers.14.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 132 |
+
"layers.14.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 133 |
+
"layers.14.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 134 |
+
"layers.14.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 135 |
+
"layers.14.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 136 |
+
"layers.14.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 137 |
+
"layers.14.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 138 |
+
"layers.14.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 139 |
+
"layers.14.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 140 |
+
"layers.14.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 141 |
+
"layers.14.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 142 |
+
"layers.14.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 143 |
+
"layers.14.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 144 |
+
"layers.14.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 145 |
+
"layers.15.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 146 |
+
"layers.15.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 147 |
+
"layers.15.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 148 |
+
"layers.15.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 149 |
+
"layers.15.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 150 |
+
"layers.15.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 151 |
+
"layers.15.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 152 |
+
"layers.15.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 153 |
+
"layers.15.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 154 |
+
"layers.15.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 155 |
+
"layers.15.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 156 |
+
"layers.15.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 157 |
+
"layers.15.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 158 |
+
"layers.15.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 159 |
+
"layers.15.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 160 |
+
"layers.15.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 161 |
+
"layers.15.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 162 |
+
"layers.15.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 163 |
+
"layers.15.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 164 |
+
"layers.16.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 165 |
+
"layers.16.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 166 |
+
"layers.16.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 167 |
+
"layers.16.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 168 |
+
"layers.16.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 169 |
+
"layers.16.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 170 |
+
"layers.16.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 171 |
+
"layers.16.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 172 |
+
"layers.16.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 173 |
+
"layers.16.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 174 |
+
"layers.16.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 175 |
+
"layers.16.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 176 |
+
"layers.16.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 177 |
+
"layers.16.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 178 |
+
"layers.16.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 179 |
+
"layers.16.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 180 |
+
"layers.16.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 181 |
+
"layers.16.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 182 |
+
"layers.16.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 183 |
+
"layers.17.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 184 |
+
"layers.17.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 185 |
+
"layers.17.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 186 |
+
"layers.17.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 187 |
+
"layers.17.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 188 |
+
"layers.17.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 189 |
+
"layers.17.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 190 |
+
"layers.17.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 191 |
+
"layers.17.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 192 |
+
"layers.17.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 193 |
+
"layers.17.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 194 |
+
"layers.17.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 195 |
+
"layers.17.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 196 |
+
"layers.17.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 197 |
+
"layers.17.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 198 |
+
"layers.17.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 199 |
+
"layers.17.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 200 |
+
"layers.17.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 201 |
+
"layers.17.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 202 |
+
"layers.18.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 203 |
+
"layers.18.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 204 |
+
"layers.18.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 205 |
+
"layers.18.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 206 |
+
"layers.18.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 207 |
+
"layers.18.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 208 |
+
"layers.18.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 209 |
+
"layers.18.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 210 |
+
"layers.18.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 211 |
+
"layers.18.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 212 |
+
"layers.18.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 213 |
+
"layers.18.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 214 |
+
"layers.18.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 215 |
+
"layers.18.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 216 |
+
"layers.18.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 217 |
+
"layers.18.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 218 |
+
"layers.18.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 219 |
+
"layers.18.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 220 |
+
"layers.18.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 221 |
+
"layers.19.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 222 |
+
"layers.19.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 223 |
+
"layers.19.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 224 |
+
"layers.19.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 225 |
+
"layers.19.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 226 |
+
"layers.19.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 227 |
+
"layers.19.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 228 |
+
"layers.19.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 229 |
+
"layers.19.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 230 |
+
"layers.19.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 231 |
+
"layers.19.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 232 |
+
"layers.19.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 233 |
+
"layers.19.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 234 |
+
"layers.19.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 235 |
+
"layers.19.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 236 |
+
"layers.19.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 237 |
+
"layers.19.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 238 |
+
"layers.19.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 239 |
+
"layers.19.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 240 |
+
"layers.2.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 241 |
+
"layers.2.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 242 |
+
"layers.2.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 243 |
+
"layers.2.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 244 |
+
"layers.2.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 245 |
+
"layers.2.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 246 |
+
"layers.2.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 247 |
+
"layers.2.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 248 |
+
"layers.2.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 249 |
+
"layers.2.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 250 |
+
"layers.2.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 251 |
+
"layers.2.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 252 |
+
"layers.2.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 253 |
+
"layers.2.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 254 |
+
"layers.2.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 255 |
+
"layers.2.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 256 |
+
"layers.2.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 257 |
+
"layers.2.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 258 |
+
"layers.2.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 259 |
+
"layers.20.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 260 |
+
"layers.20.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 261 |
+
"layers.20.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 262 |
+
"layers.20.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 263 |
+
"layers.20.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 264 |
+
"layers.20.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 265 |
+
"layers.20.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 266 |
+
"layers.20.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 267 |
+
"layers.20.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 268 |
+
"layers.20.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 269 |
+
"layers.20.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 270 |
+
"layers.20.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 271 |
+
"layers.20.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 272 |
+
"layers.20.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 273 |
+
"layers.20.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 274 |
+
"layers.20.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 275 |
+
"layers.20.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 276 |
+
"layers.20.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 277 |
+
"layers.20.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 278 |
+
"layers.21.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 279 |
+
"layers.21.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 280 |
+
"layers.21.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 281 |
+
"layers.21.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 282 |
+
"layers.21.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 283 |
+
"layers.21.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 284 |
+
"layers.21.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 285 |
+
"layers.21.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 286 |
+
"layers.21.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 287 |
+
"layers.21.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 288 |
+
"layers.21.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 289 |
+
"layers.21.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 290 |
+
"layers.21.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 291 |
+
"layers.21.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 292 |
+
"layers.21.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 293 |
+
"layers.21.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 294 |
+
"layers.21.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 295 |
+
"layers.21.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 296 |
+
"layers.21.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 297 |
+
"layers.22.input_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 298 |
+
"layers.22.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 299 |
+
"layers.22.mlp.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 300 |
+
"layers.22.mlp.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 301 |
+
"layers.22.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 302 |
+
"layers.22.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 303 |
+
"layers.22.post_attention_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 304 |
+
"layers.22.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 305 |
+
"layers.22.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 306 |
+
"layers.22.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 307 |
+
"layers.22.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 308 |
+
"layers.22.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 309 |
+
"layers.22.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 310 |
+
"layers.22.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 311 |
+
"layers.22.self_attn.to_add_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 312 |
+
"layers.22.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 313 |
+
"layers.22.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 314 |
+
"layers.22.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 315 |
+
"layers.22.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 316 |
+
"layers.23.input_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 317 |
+
"layers.23.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 318 |
+
"layers.23.mlp.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 319 |
+
"layers.23.mlp.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 320 |
+
"layers.23.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 321 |
+
"layers.23.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 322 |
+
"layers.23.post_attention_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 323 |
+
"layers.23.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 324 |
+
"layers.23.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 325 |
+
"layers.23.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 326 |
+
"layers.23.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 327 |
+
"layers.23.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 328 |
+
"layers.23.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 329 |
+
"layers.23.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 330 |
+
"layers.23.self_attn.to_add_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 331 |
+
"layers.23.self_attn.to_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 332 |
+
"layers.23.self_attn.to_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 333 |
+
"layers.23.self_attn.to_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 334 |
+
"layers.23.self_attn.to_v.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 335 |
+
"layers.24.input_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 336 |
+
"layers.24.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 337 |
+
"layers.24.mlp.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 338 |
+
"layers.24.mlp.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 339 |
+
"layers.24.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 340 |
+
"layers.24.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 341 |
+
"layers.24.post_attention_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 342 |
+
"layers.24.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 343 |
+
"layers.24.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 344 |
+
"layers.24.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 345 |
+
"layers.24.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 346 |
+
"layers.24.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 347 |
+
"layers.24.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 348 |
+
"layers.24.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 349 |
+
"layers.24.self_attn.to_add_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 350 |
+
"layers.24.self_attn.to_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 351 |
+
"layers.24.self_attn.to_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 352 |
+
"layers.24.self_attn.to_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 353 |
+
"layers.24.self_attn.to_v.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 354 |
+
"layers.25.input_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 355 |
+
"layers.25.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 356 |
+
"layers.25.mlp.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 357 |
+
"layers.25.mlp.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 358 |
+
"layers.25.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 359 |
+
"layers.25.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 360 |
+
"layers.25.post_attention_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 361 |
+
"layers.25.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 362 |
+
"layers.25.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 363 |
+
"layers.25.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 364 |
+
"layers.25.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 365 |
+
"layers.25.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 366 |
+
"layers.25.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 367 |
+
"layers.25.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 368 |
+
"layers.25.self_attn.to_add_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 369 |
+
"layers.25.self_attn.to_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 370 |
+
"layers.25.self_attn.to_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 371 |
+
"layers.25.self_attn.to_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 372 |
+
"layers.25.self_attn.to_v.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 373 |
+
"layers.26.input_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 374 |
+
"layers.26.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 375 |
+
"layers.26.mlp.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 376 |
+
"layers.26.mlp.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 377 |
+
"layers.26.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 378 |
+
"layers.26.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 379 |
+
"layers.26.post_attention_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 380 |
+
"layers.26.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 381 |
+
"layers.26.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 382 |
+
"layers.26.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 383 |
+
"layers.26.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 384 |
+
"layers.26.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 385 |
+
"layers.26.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 386 |
+
"layers.26.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 387 |
+
"layers.26.self_attn.to_add_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 388 |
+
"layers.26.self_attn.to_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 389 |
+
"layers.26.self_attn.to_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 390 |
+
"layers.26.self_attn.to_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 391 |
+
"layers.26.self_attn.to_v.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 392 |
+
"layers.27.input_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 393 |
+
"layers.27.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 394 |
+
"layers.27.mlp.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 395 |
+
"layers.27.mlp.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 396 |
+
"layers.27.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 397 |
+
"layers.27.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 398 |
+
"layers.27.post_attention_layernorm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 399 |
+
"layers.27.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 400 |
+
"layers.27.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 401 |
+
"layers.27.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 402 |
+
"layers.27.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 403 |
+
"layers.27.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 404 |
+
"layers.27.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 405 |
+
"layers.27.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 406 |
+
"layers.27.self_attn.to_add_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 407 |
+
"layers.27.self_attn.to_k.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 408 |
+
"layers.27.self_attn.to_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 409 |
+
"layers.27.self_attn.to_q.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 410 |
+
"layers.27.self_attn.to_v.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 411 |
+
"layers.3.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 412 |
+
"layers.3.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 413 |
+
"layers.3.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 414 |
+
"layers.3.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 415 |
+
"layers.3.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 416 |
+
"layers.3.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 417 |
+
"layers.3.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 418 |
+
"layers.3.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 419 |
+
"layers.3.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 420 |
+
"layers.3.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 421 |
+
"layers.3.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 422 |
+
"layers.3.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 423 |
+
"layers.3.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 424 |
+
"layers.3.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 425 |
+
"layers.3.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 426 |
+
"layers.3.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 427 |
+
"layers.3.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 428 |
+
"layers.3.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 429 |
+
"layers.3.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 430 |
+
"layers.4.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 431 |
+
"layers.4.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 432 |
+
"layers.4.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 433 |
+
"layers.4.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 434 |
+
"layers.4.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 435 |
+
"layers.4.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 436 |
+
"layers.4.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 437 |
+
"layers.4.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 438 |
+
"layers.4.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 439 |
+
"layers.4.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 440 |
+
"layers.4.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 441 |
+
"layers.4.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 442 |
+
"layers.4.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 443 |
+
"layers.4.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 444 |
+
"layers.4.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 445 |
+
"layers.4.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 446 |
+
"layers.4.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 447 |
+
"layers.4.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 448 |
+
"layers.4.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 449 |
+
"layers.5.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 450 |
+
"layers.5.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 451 |
+
"layers.5.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 452 |
+
"layers.5.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 453 |
+
"layers.5.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 454 |
+
"layers.5.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 455 |
+
"layers.5.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 456 |
+
"layers.5.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 457 |
+
"layers.5.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 458 |
+
"layers.5.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 459 |
+
"layers.5.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 460 |
+
"layers.5.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 461 |
+
"layers.5.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 462 |
+
"layers.5.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 463 |
+
"layers.5.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 464 |
+
"layers.5.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 465 |
+
"layers.5.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 466 |
+
"layers.5.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 467 |
+
"layers.5.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 468 |
+
"layers.6.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 469 |
+
"layers.6.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 470 |
+
"layers.6.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 471 |
+
"layers.6.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 472 |
+
"layers.6.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 473 |
+
"layers.6.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 474 |
+
"layers.6.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 475 |
+
"layers.6.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 476 |
+
"layers.6.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 477 |
+
"layers.6.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 478 |
+
"layers.6.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 479 |
+
"layers.6.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 480 |
+
"layers.6.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 481 |
+
"layers.6.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 482 |
+
"layers.6.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 483 |
+
"layers.6.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 484 |
+
"layers.6.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 485 |
+
"layers.6.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 486 |
+
"layers.6.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 487 |
+
"layers.7.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 488 |
+
"layers.7.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 489 |
+
"layers.7.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 490 |
+
"layers.7.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 491 |
+
"layers.7.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 492 |
+
"layers.7.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 493 |
+
"layers.7.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 494 |
+
"layers.7.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 495 |
+
"layers.7.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 496 |
+
"layers.7.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 497 |
+
"layers.7.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 498 |
+
"layers.7.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 499 |
+
"layers.7.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 500 |
+
"layers.7.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 501 |
+
"layers.7.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 502 |
+
"layers.7.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 503 |
+
"layers.7.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 504 |
+
"layers.7.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 505 |
+
"layers.7.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 506 |
+
"layers.8.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 507 |
+
"layers.8.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 508 |
+
"layers.8.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 509 |
+
"layers.8.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 510 |
+
"layers.8.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 511 |
+
"layers.8.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 512 |
+
"layers.8.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 513 |
+
"layers.8.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 514 |
+
"layers.8.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 515 |
+
"layers.8.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 516 |
+
"layers.8.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 517 |
+
"layers.8.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 518 |
+
"layers.8.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 519 |
+
"layers.8.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 520 |
+
"layers.8.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 521 |
+
"layers.8.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 522 |
+
"layers.8.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 523 |
+
"layers.8.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 524 |
+
"layers.8.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 525 |
+
"layers.9.input_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 526 |
+
"layers.9.input_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 527 |
+
"layers.9.mlp.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 528 |
+
"layers.9.mlp.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 529 |
+
"layers.9.mlp_moe_gen.down_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 530 |
+
"layers.9.mlp_moe_gen.up_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 531 |
+
"layers.9.post_attention_layernorm.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 532 |
+
"layers.9.post_attention_layernorm_moe_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 533 |
+
"layers.9.self_attn.add_k_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 534 |
+
"layers.9.self_attn.add_q_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 535 |
+
"layers.9.self_attn.add_v_proj.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 536 |
+
"layers.9.self_attn.k_norm_und_for_gen.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 537 |
+
"layers.9.self_attn.norm_added_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 538 |
+
"layers.9.self_attn.norm_added_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 539 |
+
"layers.9.self_attn.to_add_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 540 |
+
"layers.9.self_attn.to_k.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 541 |
+
"layers.9.self_attn.to_out.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 542 |
+
"layers.9.self_attn.to_q.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 543 |
+
"layers.9.self_attn.to_v.weight": "diffusion_pytorch_model-00001-of-00002.safetensors",
|
| 544 |
+
"lm_head.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 545 |
+
"norm.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 546 |
+
"norm_moe_gen.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 547 |
+
"proj_in.bias": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 548 |
+
"proj_in.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 549 |
+
"proj_out.bias": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 550 |
+
"proj_out.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 551 |
+
"time_embedder.linear_1.bias": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 552 |
+
"time_embedder.linear_1.weight": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 553 |
+
"time_embedder.linear_2.bias": "diffusion_pytorch_model-00002-of-00002.safetensors",
|
| 554 |
+
"time_embedder.linear_2.weight": "diffusion_pytorch_model-00002-of-00002.safetensors"
|
| 555 |
+
}
|
| 556 |
+
}
|
vae/config.json
ADDED
|
@@ -0,0 +1,129 @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
+
2,
|
| 12 |
+
4,
|
| 13 |
+
4
|
| 14 |
+
],
|
| 15 |
+
"dropout": 0.0,
|
| 16 |
+
"in_channels": 12,
|
| 17 |
+
"is_residual": true,
|
| 18 |
+
"latents_mean": [
|
| 19 |
+
-0.2289,
|
| 20 |
+
-0.0052,
|
| 21 |
+
-0.1323,
|
| 22 |
+
-0.2339,
|
| 23 |
+
-0.2799,
|
| 24 |
+
0.0174,
|
| 25 |
+
0.1838,
|
| 26 |
+
0.1557,
|
| 27 |
+
-0.1382,
|
| 28 |
+
0.0542,
|
| 29 |
+
0.2813,
|
| 30 |
+
0.0891,
|
| 31 |
+
0.157,
|
| 32 |
+
-0.0098,
|
| 33 |
+
0.0375,
|
| 34 |
+
-0.1825,
|
| 35 |
+
-0.2246,
|
| 36 |
+
-0.1207,
|
| 37 |
+
-0.0698,
|
| 38 |
+
0.5109,
|
| 39 |
+
0.2665,
|
| 40 |
+
-0.2108,
|
| 41 |
+
-0.2158,
|
| 42 |
+
0.2502,
|
| 43 |
+
-0.2055,
|
| 44 |
+
-0.0322,
|
| 45 |
+
0.1109,
|
| 46 |
+
0.1567,
|
| 47 |
+
-0.0729,
|
| 48 |
+
0.0899,
|
| 49 |
+
-0.2799,
|
| 50 |
+
-0.123,
|
| 51 |
+
-0.0313,
|
| 52 |
+
-0.1649,
|
| 53 |
+
0.0117,
|
| 54 |
+
0.0723,
|
| 55 |
+
-0.2839,
|
| 56 |
+
-0.2083,
|
| 57 |
+
-0.052,
|
| 58 |
+
0.3748,
|
| 59 |
+
0.0152,
|
| 60 |
+
0.1957,
|
| 61 |
+
0.1433,
|
| 62 |
+
-0.2944,
|
| 63 |
+
0.3573,
|
| 64 |
+
-0.0548,
|
| 65 |
+
-0.1681,
|
| 66 |
+
-0.0667
|
| 67 |
+
],
|
| 68 |
+
"latents_std": [
|
| 69 |
+
0.4765,
|
| 70 |
+
1.0364,
|
| 71 |
+
0.4514,
|
| 72 |
+
1.1677,
|
| 73 |
+
0.5313,
|
| 74 |
+
0.499,
|
| 75 |
+
0.4818,
|
| 76 |
+
0.5013,
|
| 77 |
+
0.8158,
|
| 78 |
+
1.0344,
|
| 79 |
+
0.5894,
|
| 80 |
+
1.0901,
|
| 81 |
+
0.6885,
|
| 82 |
+
0.6165,
|
| 83 |
+
0.8454,
|
| 84 |
+
0.4978,
|
| 85 |
+
0.5759,
|
| 86 |
+
0.3523,
|
| 87 |
+
0.7135,
|
| 88 |
+
0.6804,
|
| 89 |
+
0.5833,
|
| 90 |
+
1.4146,
|
| 91 |
+
0.8986,
|
| 92 |
+
0.5659,
|
| 93 |
+
0.7069,
|
| 94 |
+
0.5338,
|
| 95 |
+
0.4889,
|
| 96 |
+
0.4917,
|
| 97 |
+
0.4069,
|
| 98 |
+
0.4999,
|
| 99 |
+
0.6866,
|
| 100 |
+
0.4093,
|
| 101 |
+
0.5709,
|
| 102 |
+
0.6065,
|
| 103 |
+
0.6415,
|
| 104 |
+
0.4944,
|
| 105 |
+
0.5726,
|
| 106 |
+
1.2042,
|
| 107 |
+
0.5458,
|
| 108 |
+
1.6887,
|
| 109 |
+
0.3971,
|
| 110 |
+
1.06,
|
| 111 |
+
0.3943,
|
| 112 |
+
0.5537,
|
| 113 |
+
0.5444,
|
| 114 |
+
0.4089,
|
| 115 |
+
0.7468,
|
| 116 |
+
0.7744
|
| 117 |
+
],
|
| 118 |
+
"num_res_blocks": 2,
|
| 119 |
+
"out_channels": 12,
|
| 120 |
+
"patch_size": 2,
|
| 121 |
+
"scale_factor_spatial": 16,
|
| 122 |
+
"scale_factor_temporal": 4,
|
| 123 |
+
"temperal_downsample": [
|
| 124 |
+
false,
|
| 125 |
+
true,
|
| 126 |
+
true
|
| 127 |
+
],
|
| 128 |
+
"z_dim": 48
|
| 129 |
+
}
|
vae/diffusion_pytorch_model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:230496cb59ff85bc9c040487737c4062480cb61c71e697b197b4c30142f2a0da
|
| 3 |
+
size 1409400600
|
video_preprocessor_config.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"size": {
|
| 3 |
+
"longest_edge": 25165824,
|
| 4 |
+
"shortest_edge": 4096
|
| 5 |
+
},
|
| 6 |
+
"temporal_patch_size": 1,
|
| 7 |
+
"patch_size": 16,
|
| 8 |
+
"merge_size": 2,
|
| 9 |
+
"image_mean": [
|
| 10 |
+
0.5,
|
| 11 |
+
0.5,
|
| 12 |
+
0.5
|
| 13 |
+
],
|
| 14 |
+
"image_std": [
|
| 15 |
+
0.5,
|
| 16 |
+
0.5,
|
| 17 |
+
0.5
|
| 18 |
+
],
|
| 19 |
+
"processor_class": "Cosmos3EdgeProcessor",
|
| 20 |
+
"video_processor_type": "Cosmos3EdgeVideoProcessor",
|
| 21 |
+
"return_metadata": true
|
| 22 |
+
}
|
vision_encoder/model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2180ad739ecc96b5c1e9386892d3c5c08bfa42b9cdab9aabc53b028671db89b3
|
| 3 |
+
size 978739880
|