Text-to-Image
Diffusers
Safetensors
English
remote-sensing
earth-observation
satellite-imagery
flow-matching
diffusion-transformer
geospatial
Instructions to use BiliSakura/GeoCore-9B-diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use BiliSakura/GeoCore-9B-diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("BiliSakura/GeoCore-9B-diffusers", dtype=torch.bfloat16, device_map="cuda") prompt = "A parking lot full of cars is located next to some trees." image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Draw Things
- DiffusionBee
Add files using upload-large-folder tool
Browse filesFiles changed (34)
- .gitattributes+3
- LICENSEAdded+179
- LICENSE-FLUX2-VAE.mdAdded+176
- README.mdAdded+118
- demo/commercial.pngAdded
- demo/parking.pngAdded
- demo/roundabout.pngAdded
- demo/tennis.pngAdded
- model_index.jsonAdded+35
- pipeline.pyAdded+422
- scheduler/scheduler_config.jsonAdded+7
- text_encoder/config.jsonAdded+24
- text_encoder/model.safetensorsAdded+3
- text_encoder_2/config.jsonAdded+31
- text_encoder_2/model-00001-of-00002.safetensorsAdded+3
- text_encoder_2/model-00002-of-00002.safetensorsAdded+3
- text_encoder_2/model.safetensors.index.jsonAdded+226
- tokenizer/merges.txtAdded
- tokenizer/special_tokens_map.jsonAdded+30
- tokenizer/tokenizer_config.jsonAdded+30
- tokenizer/vocab.jsonAdded
- tokenizer_2/special_tokens_map.jsonAdded+125
- tokenizer_2/spiece.modelAdded+3
- tokenizer_2/tokenizer.jsonAdded
- tokenizer_2/tokenizer_config.jsonAdded+940
- transformer/config.jsonAdded+26
- transformer/diffusion_pytorch_model-00001-of-00004.safetensorsAdded+3
- transformer/diffusion_pytorch_model-00002-of-00004.safetensorsAdded+3
- transformer/diffusion_pytorch_model-00003-of-00004.safetensorsAdded+3
- transformer/diffusion_pytorch_model-00004-of-00004.safetensorsAdded+3
- transformer/diffusion_pytorch_model.safetensors.index.jsonAdded+221
- transformer/transformer_geocore.pyAdded+767
- vae/config.jsonAdded+40
- vae/diffusion_pytorch_model.safetensorsAdded+3
32 unmodified lines33343532 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text32 unmodified lines33343536373832 unmodified lines*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -textdemo/parking.png filter=lfs diff=lfs merge=lfs -textdemo/commercial.png filter=lfs diff=lfs merge=lfs -textdemo/tennis.png filter=lfs diff=lfs merge=lfs -text
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2026 Jeonghyeok Do and Munchurl Kim
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118---license: apache-2.0library_name: diffuserspipeline_tag: text-to-imagetags: - diffusers - remote-sensing - earth-observation - satellite-imagery - text-to-image - flow-matching - diffusion-transformer - geospatialdatasets: - lcybuaa/Git-10Minference: truelanguage: - enwidget: - text: A parking lot full of cars is located next to some trees. output: url: demo/parking.png - text: Many buildings are located in a commercial area. output: url: demo/commercial.png - text: A roundabout is surrounded by grass. output: url: demo/roundabout.png - text: Two tennis courts are semi-surrounded by several green trees. output: url: demo/tennis.png---
# BiliSakura/GeoCore-9B-diffusers
Self-contained [Diffusers](https://github.com/huggingface/diffusers) checkpoint for **GeoCore-9B**: 256×256 optical satellite generation from text, with optional GSD, latitude, and longitude.
Converted from [`JeonghyeokDo/GeoCore-9B`](https://huggingface.co/JeonghyeokDo/GeoCore-9B). `DiffusionPipeline.from_pretrained` loads the DiT, Flux.2 VAE, CLIP-L, T5-XXL, and `FlowMatchEulerDiscreteScheduler` from this repo (`trust_remote_code=True`).
[Project](https://kaist-viclab.github.io/GeoCore-9B_site/) ·[Code](https://github.com/KAIST-VICLab/GeoCore-9B) ·[Original weights](https://huggingface.co/JeonghyeokDo/GeoCore-9B)
<Gallery />
## Demo
256×256, 50 Euler steps, `guidance_scale=4.0`, seed `42`, `lon=126.97`, `lat=37.56`, `res=0.0` (Seoul).
| Parking lot | Commercial | Roundabout | Tennis courts || --- | --- | --- | --- ||  |  |  |  |
## Model details
| Field | Value || --- | --- || Pipeline | `GeoCorePipeline` (`pipeline.py`) || Transformer | Flow-matching DiT, 8 double-stream + 24 single-stream blocks, hidden 4096, 32 heads, **9.24B** || Text encoders | CLIP ViT-L/14 + T5-XXL (bundled) || VAE | Flux.2 `AutoencoderKLFlux2` (Apache-2.0, bundled) || Scheduler | `FlowMatchEulerDiscreteScheduler`, `shift=1.0` || Resolution | 256×256 || Training data | [Git-10M](https://huggingface.co/datasets/lcybuaa/Git-10M) || License | Apache-2.0 |
## Load from Hugging Face
```pythonimport torchfrom diffusers import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained( "BiliSakura/GeoCore-9B-diffusers", trust_remote_code=True, torch_dtype=torch.bfloat16,).to("cuda")
image = pipe( prompt="A parking lot full of cars is located next to some trees.", lon=126.97, lat=37.56, res=0.0, height=256, width=256, num_inference_steps=50, guidance_scale=4.0, generator=torch.Generator(device="cuda").manual_seed(42),).images[0]image.save("demo.png")```
The DiT is ~18.5 GB in bf16. A 24 GB GPU is tight; on two GPUs, split only the transformer with Accelerate and keep CLIP, T5, and the VAE on one device.
## Conditioning
Captions follow the Git-10M style (short scene descriptions). Geospatial fields are optional.
| Argument | Meaning || --- | --- || `prompt` | Natural-language description || `res` | Resolution index `17 - z` for Google XYZ zoom `z`. `0` ≈ 1.2 m/px at the equator; each `+1` doubles GSD || `lon`, `lat` | Degrees || `-999.0` | Learned null embedding — any of `res` / `lon` / `lat` may be omitted |
## License
DiT weights © 2026 Jeonghyeok Do and Munchurl Kim, Apache-2.0. VAE is an unmodified Apache-2.0 Flux.2 autoencoder from [`black-forest-labs/FLUX.2-klein-base-4B`](https://huggingface.co/black-forest-labs/FLUX.2-klein-base-4B); see [`LICENSE-FLUX2-VAE.md`](LICENSE-FLUX2-VAE.md). [Git-10M](https://huggingface.co/datasets/lcybuaa/Git-10M) is CC BY-NC-ND 4.0 (non-commercial retraining).
## Citation
```bibtex@article{do2026geocore, title = {GeoCore-9B: Towards Geo-Aware Generative Foundation Models in Earth Observation}, author = {Do, Jeonghyeok and Kim, Munchurl}, year = {2026}}```1234567891011121314151617181920212223242526272829303132333435{ "_class_name": [ "pipeline", "GeoCorePipeline" ], "_diffusers_version": "0.32.0", "scheduler": [ "diffusers", "FlowMatchEulerDiscreteScheduler" ], "transformer": [ "transformer_geocore", "GeoCoreTransformer2DModel" ], "vae": [ "diffusers", "AutoencoderKLFlux2" ], "text_encoder": [ "transformers", "CLIPTextModel" ], "text_encoder_2": [ "transformers", "T5EncoderModel" ], "tokenizer": [ "transformers", "CLIPTokenizer" ], "tokenizer_2": [ "transformers", "T5TokenizerFast" ]}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422# Copyright 2026 Jeonghyeok Do and Munchurl Kim. All rights reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License."""Diffusers custom pipeline for GeoCore text- and geo-conditioned EO image generation.
This file is Hub-copyable: `scripts/convert_checkpoint.py` copies it to the modelrepository as `pipeline.py` so inference needs only Diffusers + the model repo."""
from __future__ import annotations
from dataclasses import dataclassfrom typing import Any
import torchfrom diffusers import AutoencoderKLFlux2from diffusers.image_processor import VaeImageProcessorfrom diffusers.pipelines.pipeline_utils import DiffusionPipelinefrom diffusers.utils import BaseOutput, is_torch_xla_available, logging, replace_example_docstringfrom diffusers.utils.torch_utils import randn_tensorfrom PIL import Imagefrom transformers import CLIPTextModel, CLIPTokenizer, T5EncoderModel, T5TokenizerFast
if is_torch_xla_available(): import torch_xla.core.xla_model as xm
XLA_AVAILABLE = Trueelse: XLA_AVAILABLE = False
logger = logging.get_logger(__name__)
NULL_META = -999.0DEFAULT_CLIP_REPO = "openai/clip-vit-large-patch14"DEFAULT_T5_REPO = "google/t5-v1_1-xxl"TEXT_SEQ_LEN = 256
EXAMPLE_DOC_STRING = """ Examples: ```py >>> from pathlib import Path >>> import torch >>> from diffusers import DiffusionPipeline
>>> model_dir = Path("/path/to/GeoCore-9B") >>> pipe = DiffusionPipeline.from_pretrained( ... str(model_dir), ... custom_pipeline=str(model_dir / "pipeline.py"), ... trust_remote_code=True, ... torch_dtype=torch.bfloat16, ... ).to("cuda")
>>> image = pipe( ... prompt="A satellite view of a highly dense urban city with towering skyscrapers", ... lon=126.97, ... lat=37.56, ... res=0.0, ... num_inference_steps=50, ... guidance_scale=4.0, ... generator=torch.Generator("cuda").manual_seed(0), ... ).images[0] ```"""
@dataclassclass GeoCorePipelineOutput(BaseOutput): """Output class for GeoCore pipelines."""
images: list[Image.Image] | None = None
class GeoCorePipeline(DiffusionPipeline): r"""Text- and geospatial-metadata-conditioned sampling for GeoCore-9B."""
model_cpu_offload_seq = "text_encoder->text_encoder_2->transformer->vae" _optional_components = ["text_encoder", "text_encoder_2", "tokenizer", "tokenizer_2"]
def __init__( self, transformer, vae: AutoencoderKLFlux2, scheduler, text_encoder: CLIPTextModel | None = None, text_encoder_2: T5EncoderModel | None = None, tokenizer: CLIPTokenizer | None = None, tokenizer_2: T5TokenizerFast | None = None, ) -> None: super().__init__()
if text_encoder is None or tokenizer is None: tokenizer = tokenizer or CLIPTokenizer.from_pretrained(DEFAULT_CLIP_REPO) text_encoder = text_encoder or CLIPTextModel.from_pretrained(DEFAULT_CLIP_REPO) if text_encoder_2 is None or tokenizer_2 is None: tokenizer_2 = tokenizer_2 or T5TokenizerFast.from_pretrained(DEFAULT_T5_REPO) text_encoder_2 = text_encoder_2 or T5EncoderModel.from_pretrained(DEFAULT_T5_REPO)
self.register_modules( transformer=transformer, vae=vae, scheduler=scheduler, text_encoder=text_encoder, text_encoder_2=text_encoder_2, tokenizer=tokenizer, tokenizer_2=tokenizer_2, )
self.vae_scale_factor = 2 ** (len(self.vae.config.block_out_channels) - 1) # Flux.2 packs 2×2 latent patches, so the DiT sees resolution / 16. self.vae_scale_factor_packing = self.vae_scale_factor * 2 self.image_processor = VaeImageProcessor(vae_scale_factor=self.vae_scale_factor_packing) self._null_pooled: torch.Tensor | None = None self._null_prompt: torch.Tensor | None = None
@property def guidance_scale(self) -> float: return self._guidance_scale
@property def do_classifier_free_guidance(self) -> bool: return self._guidance_scale > 1.0
def _cache_null_text_embeddings(self) -> None: if self._null_prompt is not None and self._null_pooled is not None: return
device = self._execution_device dtype = self.text_encoder.dtype clip_inputs = self.tokenizer( [""], padding="max_length", max_length=77, truncation=True, return_tensors="pt", ).to(device) self._null_pooled = self.text_encoder(clip_inputs.input_ids).pooler_output.to(dtype=dtype) t5_inputs = self.tokenizer_2( [""], padding="max_length", max_length=TEXT_SEQ_LEN, truncation=True, return_tensors="pt", ).to(device) self._null_prompt = self.text_encoder_2(t5_inputs.input_ids)[0].to(dtype=dtype)
def check_inputs( self, prompt: str | list[str], height: int, width: int, guidance_scale: float, lon: float | list[float] | None, lat: float | list[float] | None, res: float | list[float] | None, ) -> None: if height % 16 != 0 or width % 16 != 0: raise ValueError(f"`height` and `width` must be divisible by 16, got {height}x{width}.") if guidance_scale < 0: raise ValueError(f"`guidance_scale` must be >= 0, got {guidance_scale}.") if isinstance(prompt, list) and len(prompt) == 0: raise ValueError("`prompt` must be a non-empty string or list of strings.")
@staticmethod def _prepare_latent_image_ids(height: int, width: int, device: torch.device, dtype: torch.dtype) -> torch.Tensor: latent_image_ids = torch.zeros(height, width, 3, device=device, dtype=dtype) latent_image_ids[..., 1] = latent_image_ids[..., 1] + torch.arange(height, device=device, dtype=dtype)[:, None] latent_image_ids[..., 2] = latent_image_ids[..., 2] + torch.arange(width, device=device, dtype=dtype)[None, :] return latent_image_ids.reshape(height * width, 3)
def _encode_prompt( self, prompt: str | list[str], device: torch.device, dtype: torch.dtype, num_images_per_prompt: int = 1, ) -> tuple[torch.Tensor, torch.Tensor, torch.Tensor]: if isinstance(prompt, str): prompt = [prompt]
batch_size = len(prompt) prompt_embeds = torch.empty((batch_size, TEXT_SEQ_LEN, 4096), device=device, dtype=dtype) pooled_embeds = torch.empty((batch_size, 768), device=device, dtype=dtype) text_ids = torch.zeros((batch_size, TEXT_SEQ_LEN, 3), device=device, dtype=dtype) text_ids[:, :, 0] = torch.arange(TEXT_SEQ_LEN, device=device, dtype=dtype)
self._cache_null_text_embeddings() assert self._null_prompt is not None and self._null_pooled is not None
empty_indices = [index for index, text in enumerate(prompt) if text == ""] valid_indices = [index for index, text in enumerate(prompt) if text != ""]
if empty_indices: prompt_embeds[empty_indices] = self._null_prompt.expand(len(empty_indices), -1, -1) pooled_embeds[empty_indices] = self._null_pooled.expand(len(empty_indices), -1)
if valid_indices: valid_prompts = [prompt[index] for index in valid_indices] clip_inputs = self.tokenizer( valid_prompts, padding="max_length", max_length=77, truncation=True, return_tensors="pt", ).to(device) pooled_embeds[valid_indices] = self.text_encoder(clip_inputs.input_ids).pooler_output t5_inputs = self.tokenizer_2( valid_prompts, padding="max_length", max_length=TEXT_SEQ_LEN, truncation=True, return_tensors="pt", ).to(device) prompt_embeds[valid_indices] = self.text_encoder_2(t5_inputs.input_ids)[0]
if num_images_per_prompt > 1: prompt_embeds = prompt_embeds.repeat_interleave(num_images_per_prompt, dim=0) pooled_embeds = pooled_embeds.repeat_interleave(num_images_per_prompt, dim=0) text_ids = text_ids.repeat_interleave(num_images_per_prompt, dim=0)
return prompt_embeds, pooled_embeds, text_ids
def _get_null_conditioning(self, batch_size: int, device: torch.device, dtype: torch.dtype) -> dict[str, torch.Tensor]: self._cache_null_text_embeddings() assert self._null_prompt is not None and self._null_pooled is not None return { "ctx": self._null_prompt.expand(batch_size, -1, -1).to(device=device, dtype=dtype), "y": self._null_pooled.expand(batch_size, -1).to(device=device, dtype=dtype), "res": torch.zeros(batch_size, device=device, dtype=dtype), "lon": torch.zeros(batch_size, device=device, dtype=dtype), "lat": torch.zeros(batch_size, device=device, dtype=dtype), }
@staticmethod def _expand_batch( value: float | list[float] | None, batch_size: int, device: torch.device, dtype: torch.dtype, default: float = NULL_META, ) -> torch.Tensor: if value is None: return torch.full((batch_size,), default, device=device, dtype=dtype) if isinstance(value, (int, float)): return torch.full((batch_size,), float(value), device=device, dtype=dtype) if len(value) == 1: return torch.full((batch_size,), float(value[0]), device=device, dtype=dtype) return torch.tensor(value, device=device, dtype=dtype)
def prepare_latents( self, batch_size: int, num_channels: int, height: int, width: int, dtype: torch.dtype, device: torch.device, generator: torch.Generator | list[torch.Generator] | None, latents: torch.Tensor | None = None, ) -> torch.Tensor: if latents is not None: return latents.to(device=device, dtype=dtype) packed_height = height // self.vae_scale_factor_packing packed_width = width // self.vae_scale_factor_packing shape = (batch_size, num_channels, packed_height, packed_width) return randn_tensor(shape, generator=generator, device=device, dtype=dtype)
@staticmethod def _unpatchify_latents(latents: torch.Tensor) -> torch.Tensor: batch_size, num_channels, height, width = latents.shape latents = latents.reshape(batch_size, num_channels // 4, 2, 2, height, width) latents = latents.permute(0, 1, 4, 2, 5, 3) return latents.reshape(batch_size, num_channels // 4, height * 2, width * 2)
def _unpack_latents_for_vae(self, latents: torch.Tensor) -> torch.Tensor: """Undo Flux.2 batch-norm + 2×2 packing so AutoencoderKLFlux2.decode sees 32-channel latents.""" mean = self.vae.bn.running_mean.view(1, -1, 1, 1).to(device=latents.device, dtype=latents.dtype) std = torch.sqrt( self.vae.bn.running_var.view(1, -1, 1, 1) + self.vae.config.batch_norm_eps ).to(device=latents.device, dtype=latents.dtype) return self._unpatchify_latents(latents * std + mean)
def _predict_velocity( self, hidden_states: torch.Tensor, timestep: torch.Tensor, cond_kwargs: dict[str, torch.Tensor], uncond_kwargs: dict[str, torch.Tensor], guidance_scale: float, guidance_low: float, guidance_high: float, ) -> torch.Tensor: t_value = float(timestep[0].item()) if timestep.ndim > 0 else float(timestep.item()) if guidance_scale > 1.0 and guidance_low <= t_value <= guidance_high: model_input = torch.cat([hidden_states] * 2, dim=0) t_input = torch.cat([timestep] * 2, dim=0) combined_kwargs: dict[str, torch.Tensor] = {} for key, value in cond_kwargs.items(): if key in ("ctx", "y", "res", "lon", "lat"): uncond_value = uncond_kwargs.get(key, value) combined_kwargs[key] = torch.cat([value, uncond_value], dim=0) elif key in ("x_ids", "ctx_ids"): if value.dim() == 3 and value.shape[0] == hidden_states.shape[0]: combined_kwargs[key] = torch.cat([value] * 2, dim=0) else: combined_kwargs[key] = value else: combined_kwargs[key] = value x_ids = combined_kwargs.pop("x_ids") velocity = self.transformer(model_input, x_ids, t_input, **combined_kwargs) if isinstance(velocity, tuple): velocity = velocity[0] velocity_cond, velocity_uncond = velocity.chunk(2) return velocity_uncond + guidance_scale * (velocity_cond - velocity_uncond)
x_ids = cond_kwargs["x_ids"] velocity = self.transformer( hidden_states, x_ids, timestep, **{k: v for k, v in cond_kwargs.items() if k != "x_ids"}, ) if isinstance(velocity, tuple): velocity = velocity[0] return velocity
@replace_example_docstring(EXAMPLE_DOC_STRING) @torch.no_grad() def __call__( self, prompt: str | list[str], height: int = 256, width: int = 256, num_inference_steps: int = 50, guidance_scale: float = 4.0, guidance_low: float = 0.0, guidance_high: float = 1.0, num_images_per_prompt: int = 1, generator: torch.Generator | list[torch.Generator] | None = None, latents: torch.Tensor | None = None, output_type: str = "pil", return_dict: bool = True, lon: float | list[float] | None = None, lat: float | list[float] | None = None, res: float | list[float] | None = None, callback_on_step_end: Any | None = None, callback_on_step_end_tensor_inputs: list[str] | None = None, ) -> GeoCorePipelineOutput | tuple: r""" Generate Earth-observation images conditioned on text and geospatial metadata.
Examples: """ if isinstance(prompt, str): prompt = [prompt]
self.check_inputs(prompt, height, width, guidance_scale, lon, lat, res) self._guidance_scale = guidance_scale
device = self._execution_device dtype = self.transformer.dtype
if lon is None or lat is None or (isinstance(lon, float) and lon == NULL_META) or (isinstance(lat, float) and lat == NULL_META): lon = lat = NULL_META elif isinstance(lon, list) or isinstance(lat, list): lon_list = lon if isinstance(lon, list) else [lon] * len(prompt) lat_list = lat if isinstance(lat, list) else [lat] * len(prompt) lon = [NULL_META if l == NULL_META or la == NULL_META else l for l, la in zip(lon_list, lat_list)] lat = [NULL_META if l == NULL_META or la == NULL_META else la for l, la in zip(lon_list, lat_list)]
batch_size = len(prompt) * num_images_per_prompt latent_height = height // self.vae_scale_factor_packing latent_width = width // self.vae_scale_factor_packing latent_channels = getattr(self.transformer.config, "latent_channels", 128)
prompt_embeds, pooled_embeds, text_ids = self._encode_prompt( prompt, device=device, dtype=dtype, num_images_per_prompt=num_images_per_prompt, )
cond_kwargs = { "ctx": prompt_embeds, "ctx_ids": text_ids, "y": pooled_embeds, "res": self._expand_batch(res, batch_size, device, dtype), "lon": self._expand_batch(lon, batch_size, device, dtype), "lat": self._expand_batch(lat, batch_size, device, dtype), "x_ids": self._prepare_latent_image_ids(latent_height, latent_width, device, dtype) .unsqueeze(0) .repeat(batch_size, 1, 1), } uncond_kwargs = self._get_null_conditioning(batch_size, device, dtype) uncond_kwargs["ctx_ids"] = text_ids
self.scheduler.set_timesteps(num_inference_steps, device=device) if hasattr(self.scheduler, "set_begin_index"): self.scheduler.set_begin_index(0) latents = self.prepare_latents( batch_size, latent_channels, height, width, dtype, device, generator, latents, )
num_train_timesteps = self.scheduler.config.num_train_timesteps for step_index, t in enumerate(self.progress_bar(self.scheduler.timesteps)): # FlowMatchEulerDiscreteScheduler.timesteps are in [0, num_train_timesteps]; # the DiT is trained on continuous t in [0, 1], same as Flux. timestep = t.expand(latents.shape[0]).to(device=device, dtype=dtype) / num_train_timesteps velocity = self._predict_velocity( latents, timestep, cond_kwargs, uncond_kwargs, guidance_scale, guidance_low, guidance_high, ) latents = self.scheduler.step(velocity, t, latents, return_dict=False)[0]
if callback_on_step_end is not None: callback_kwargs = {"prompt": prompt, "latents": latents, "step_index": step_index} callback_outputs = callback_on_step_end(self, step_index, timestep, callback_kwargs) latents = callback_outputs.pop("latents", latents)
if XLA_AVAILABLE: xm.mark_step()
if output_type == "latent": if not return_dict: return (latents,) return GeoCorePipelineOutput(images=latents)
latents = self._unpack_latents_for_vae(latents) image = self.vae.decode(latents, return_dict=False)[0] image = self.image_processor.postprocess(image, output_type=output_type)
self.maybe_free_model_hooks()
if not return_dict: return (image,) return GeoCorePipelineOutput(images=image)1234567{ "_class_name": "FlowMatchEulerDiscreteScheduler", "_diffusers_version": "0.32.0", "num_train_timesteps": 1000, "shift": 1.0, "use_dynamic_shifting": false}123456789101112131415161718192021222324{ "architectures": [ "CLIPTextModel" ], "attention_dropout": 0.0, "bos_token_id": 0, "dropout": 0.0, "eos_token_id": 2, "hidden_act": "quick_gelu", "hidden_size": 768, "initializer_factor": 1.0, "initializer_range": 0.02, "intermediate_size": 3072, "layer_norm_eps": 1e-05, "max_position_embeddings": 77, "model_type": "clip_text_model", "num_attention_heads": 12, "num_hidden_layers": 12, "pad_token_id": 1, "projection_dim": 768, "torch_dtype": "float16", "transformers_version": "4.41.2", "vocab_size": 49408}123version https://git-lfs.github.com/spec/v1oid sha256:befd6d103721287c60e07d3513b98e71daafe53d723d964b8e5ffacb1cad34adsize 24614412812345678910111213141516171819202122232425262728293031{ "architectures": [ "T5EncoderModel" ], "classifier_dropout": 0.0, "d_ff": 10240, "d_kv": 64, "d_model": 4096, "decoder_start_token_id": 0, "dense_act_fn": "gelu_new", "dropout_rate": 0.1, "eos_token_id": 1, "feed_forward_proj": "gated-gelu", "initializer_factor": 1.0, "is_encoder_decoder": true, "is_gated_act": true, "layer_norm_epsilon": 1e-06, "model_type": "t5", "num_decoder_layers": 24, "num_heads": 64, "num_layers": 24, "output_past": true, "pad_token_id": 0, "relative_attention_max_distance": 128, "relative_attention_num_buckets": 32, "tie_word_embeddings": false, "torch_dtype": "float16", "transformers_version": "4.41.2", "use_cache": true, "vocab_size": 32128}123version https://git-lfs.github.com/spec/v1oid sha256:4f2751ceeb2a96edd693e539dc5d6bba0b8d3814f49a9b3798403a0cec4b2e3dsize 4994582104123version https://git-lfs.github.com/spec/v1oid sha256:f63154532130422309532ff56f11945fbea8266c958e3133e8e5aef85c6293c7size 4530066248123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226{ "metadata": { "total_size": 9524621312 }, "weight_map": { "encoder.block.0.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.0.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.0.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.0.layer.0.SelfAttention.relative_attention_bias.weight": "model-00001-of-00002.safetensors", "encoder.block.0.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.0.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.0.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.0.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.0.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.0.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.1.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.1.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.1.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.1.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.1.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.1.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.1.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.1.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.1.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.10.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.10.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.10.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.10.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.10.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.10.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.10.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.10.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.10.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.11.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.11.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.11.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.11.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.11.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.11.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.11.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.11.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.11.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.12.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.12.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.12.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.12.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.12.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.12.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.12.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.12.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.12.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.13.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.13.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.13.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.13.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.13.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.13.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.13.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.13.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.13.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.14.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.14.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.14.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.14.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.14.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.14.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.14.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.14.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.14.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.15.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.15.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.15.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.15.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.15.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.15.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.15.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.15.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.15.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.16.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.16.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.16.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.16.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.16.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.16.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.16.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.16.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.16.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.17.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.17.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.17.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.17.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.17.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.17.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.17.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.17.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.17.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.18.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.18.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.18.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.18.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.18.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.18.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.18.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.18.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.18.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.19.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.19.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.19.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.19.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.19.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.19.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.19.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.19.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.19.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.2.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.2.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.2.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.2.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.2.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.2.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.2.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.2.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.2.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.20.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.20.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.20.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.20.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.20.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.20.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.20.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.20.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.20.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.21.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.21.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.21.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.21.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.21.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.21.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.21.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.21.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.21.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.22.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.22.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.22.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.22.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.22.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.22.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.22.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.22.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.22.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.23.layer.0.SelfAttention.k.weight": "model-00002-of-00002.safetensors", "encoder.block.23.layer.0.SelfAttention.o.weight": "model-00002-of-00002.safetensors", "encoder.block.23.layer.0.SelfAttention.q.weight": "model-00002-of-00002.safetensors", "encoder.block.23.layer.0.SelfAttention.v.weight": "model-00002-of-00002.safetensors", "encoder.block.23.layer.0.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.23.layer.1.DenseReluDense.wi_0.weight": "model-00002-of-00002.safetensors", "encoder.block.23.layer.1.DenseReluDense.wi_1.weight": "model-00002-of-00002.safetensors", "encoder.block.23.layer.1.DenseReluDense.wo.weight": "model-00002-of-00002.safetensors", "encoder.block.23.layer.1.layer_norm.weight": "model-00002-of-00002.safetensors", "encoder.block.3.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.3.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.3.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.3.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.3.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.3.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.3.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.3.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.3.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.4.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.4.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.4.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.4.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.4.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.4.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.4.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.4.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.4.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.5.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.5.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.5.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.5.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.5.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.5.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.5.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.5.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.5.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.6.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.6.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.6.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.6.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.6.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.6.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.6.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.6.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.6.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.7.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.7.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.7.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.7.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.7.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.7.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.7.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.7.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.7.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.8.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.8.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.8.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.8.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.8.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.8.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.8.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.8.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.8.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.9.layer.0.SelfAttention.k.weight": "model-00001-of-00002.safetensors", "encoder.block.9.layer.0.SelfAttention.o.weight": "model-00001-of-00002.safetensors", "encoder.block.9.layer.0.SelfAttention.q.weight": "model-00001-of-00002.safetensors", "encoder.block.9.layer.0.SelfAttention.v.weight": "model-00001-of-00002.safetensors", "encoder.block.9.layer.0.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.block.9.layer.1.DenseReluDense.wi_0.weight": "model-00001-of-00002.safetensors", "encoder.block.9.layer.1.DenseReluDense.wi_1.weight": "model-00001-of-00002.safetensors", "encoder.block.9.layer.1.DenseReluDense.wo.weight": "model-00001-of-00002.safetensors", "encoder.block.9.layer.1.layer_norm.weight": "model-00001-of-00002.safetensors", "encoder.final_layer_norm.weight": "model-00002-of-00002.safetensors", "shared.weight": "model-00001-of-00002.safetensors" }}123456789101112131415161718192021222324252627282930{ "bos_token": { "content": "<|startoftext|>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false }, "eos_token": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "pad_token": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "unk_token": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}123456789101112131415161718192021222324252627282930{ "add_prefix_space": false, "added_tokens_decoder": { "49406": { "content": "<|startoftext|>", "lstrip": false, "normalized": true, "rstrip": false, "single_word": false, "special": true }, "49407": { "content": "<|endoftext|>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true } }, "bos_token": "<|startoftext|>", "clean_up_tokenization_spaces": true, "do_lower_case": true, "eos_token": "<|endoftext|>", "errors": "replace", "model_max_length": 77, "pad_token": "<|endoftext|>", "tokenizer_class": "CLIPTokenizer", "unk_token": "<|endoftext|>"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125{ "additional_special_tokens": [ "<extra_id_0>", "<extra_id_1>", "<extra_id_2>", "<extra_id_3>", "<extra_id_4>", "<extra_id_5>", "<extra_id_6>", "<extra_id_7>", "<extra_id_8>", "<extra_id_9>", "<extra_id_10>", "<extra_id_11>", "<extra_id_12>", "<extra_id_13>", "<extra_id_14>", "<extra_id_15>", "<extra_id_16>", "<extra_id_17>", "<extra_id_18>", "<extra_id_19>", "<extra_id_20>", "<extra_id_21>", "<extra_id_22>", "<extra_id_23>", "<extra_id_24>", "<extra_id_25>", "<extra_id_26>", "<extra_id_27>", "<extra_id_28>", "<extra_id_29>", "<extra_id_30>", "<extra_id_31>", "<extra_id_32>", "<extra_id_33>", "<extra_id_34>", "<extra_id_35>", "<extra_id_36>", "<extra_id_37>", "<extra_id_38>", "<extra_id_39>", "<extra_id_40>", "<extra_id_41>", "<extra_id_42>", "<extra_id_43>", "<extra_id_44>", "<extra_id_45>", "<extra_id_46>", "<extra_id_47>", "<extra_id_48>", "<extra_id_49>", "<extra_id_50>", "<extra_id_51>", "<extra_id_52>", "<extra_id_53>", "<extra_id_54>", "<extra_id_55>", "<extra_id_56>", "<extra_id_57>", "<extra_id_58>", "<extra_id_59>", "<extra_id_60>", "<extra_id_61>", "<extra_id_62>", "<extra_id_63>", "<extra_id_64>", "<extra_id_65>", "<extra_id_66>", "<extra_id_67>", "<extra_id_68>", "<extra_id_69>", "<extra_id_70>", "<extra_id_71>", "<extra_id_72>", "<extra_id_73>", "<extra_id_74>", "<extra_id_75>", "<extra_id_76>", "<extra_id_77>", "<extra_id_78>", "<extra_id_79>", "<extra_id_80>", "<extra_id_81>", "<extra_id_82>", "<extra_id_83>", "<extra_id_84>", "<extra_id_85>", "<extra_id_86>", "<extra_id_87>", "<extra_id_88>", "<extra_id_89>", "<extra_id_90>", "<extra_id_91>", "<extra_id_92>", "<extra_id_93>", "<extra_id_94>", "<extra_id_95>", "<extra_id_96>", "<extra_id_97>", "<extra_id_98>", "<extra_id_99>" ], "eos_token": { "content": "</s>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "pad_token": { "content": "<pad>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }, "unk_token": { "content": "<unk>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false }}123version https://git-lfs.github.com/spec/v1oid sha256:d60acb128cf7b7f2536e8f38a5b18a05535c9e14c7a355904270e15b0945ea86size 791656123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940{ "add_prefix_space": true, "added_tokens_decoder": { "0": { "content": "<pad>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "1": { "content": "</s>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "2": { "content": "<unk>", "lstrip": false, "normalized": false, "rstrip": false, "single_word": false, "special": true }, "32000": { "content": "<extra_id_99>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32001": { "content": "<extra_id_98>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32002": { "content": "<extra_id_97>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32003": { "content": "<extra_id_96>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32004": { "content": "<extra_id_95>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32005": { "content": "<extra_id_94>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32006": { "content": "<extra_id_93>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32007": { "content": "<extra_id_92>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32008": { "content": "<extra_id_91>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32009": { "content": "<extra_id_90>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32010": { "content": "<extra_id_89>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32011": { "content": "<extra_id_88>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32012": { "content": "<extra_id_87>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32013": { "content": "<extra_id_86>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32014": { "content": "<extra_id_85>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32015": { "content": "<extra_id_84>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32016": { "content": "<extra_id_83>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32017": { "content": "<extra_id_82>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32018": { "content": "<extra_id_81>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32019": { "content": "<extra_id_80>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32020": { "content": "<extra_id_79>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32021": { "content": "<extra_id_78>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32022": { "content": "<extra_id_77>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32023": { "content": "<extra_id_76>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32024": { "content": "<extra_id_75>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32025": { "content": "<extra_id_74>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32026": { "content": "<extra_id_73>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32027": { "content": "<extra_id_72>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32028": { "content": "<extra_id_71>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32029": { "content": "<extra_id_70>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32030": { "content": "<extra_id_69>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32031": { "content": "<extra_id_68>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32032": { "content": "<extra_id_67>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32033": { "content": "<extra_id_66>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32034": { "content": "<extra_id_65>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32035": { "content": "<extra_id_64>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32036": { "content": "<extra_id_63>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32037": { "content": "<extra_id_62>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32038": { "content": "<extra_id_61>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32039": { "content": "<extra_id_60>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32040": { "content": "<extra_id_59>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32041": { "content": "<extra_id_58>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32042": { "content": "<extra_id_57>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32043": { "content": "<extra_id_56>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32044": { "content": "<extra_id_55>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32045": { "content": "<extra_id_54>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32046": { "content": "<extra_id_53>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32047": { "content": "<extra_id_52>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32048": { "content": "<extra_id_51>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32049": { "content": "<extra_id_50>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32050": { "content": "<extra_id_49>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32051": { "content": "<extra_id_48>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32052": { "content": "<extra_id_47>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32053": { "content": "<extra_id_46>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32054": { "content": "<extra_id_45>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32055": { "content": "<extra_id_44>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32056": { "content": "<extra_id_43>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32057": { "content": "<extra_id_42>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32058": { "content": "<extra_id_41>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32059": { "content": "<extra_id_40>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32060": { "content": "<extra_id_39>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32061": { "content": "<extra_id_38>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32062": { "content": "<extra_id_37>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32063": { "content": "<extra_id_36>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32064": { "content": "<extra_id_35>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32065": { "content": "<extra_id_34>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32066": { "content": "<extra_id_33>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32067": { "content": "<extra_id_32>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32068": { "content": "<extra_id_31>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32069": { "content": "<extra_id_30>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32070": { "content": "<extra_id_29>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32071": { "content": "<extra_id_28>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32072": { "content": "<extra_id_27>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32073": { "content": "<extra_id_26>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32074": { "content": "<extra_id_25>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32075": { "content": "<extra_id_24>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32076": { "content": "<extra_id_23>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32077": { "content": "<extra_id_22>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32078": { "content": "<extra_id_21>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32079": { "content": "<extra_id_20>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32080": { "content": "<extra_id_19>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32081": { "content": "<extra_id_18>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32082": { "content": "<extra_id_17>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32083": { "content": "<extra_id_16>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32084": { "content": "<extra_id_15>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32085": { "content": "<extra_id_14>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32086": { "content": "<extra_id_13>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32087": { "content": "<extra_id_12>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32088": { "content": "<extra_id_11>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32089": { "content": "<extra_id_10>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32090": { "content": "<extra_id_9>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32091": { "content": "<extra_id_8>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32092": { "content": "<extra_id_7>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32093": { "content": "<extra_id_6>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32094": { "content": "<extra_id_5>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32095": { "content": "<extra_id_4>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32096": { "content": "<extra_id_3>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32097": { "content": "<extra_id_2>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32098": { "content": "<extra_id_1>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true }, "32099": { "content": "<extra_id_0>", "lstrip": true, "normalized": false, "rstrip": true, "single_word": false, "special": true } }, "additional_special_tokens": [ "<extra_id_0>", "<extra_id_1>", "<extra_id_2>", "<extra_id_3>", "<extra_id_4>", "<extra_id_5>", "<extra_id_6>", "<extra_id_7>", "<extra_id_8>", "<extra_id_9>", "<extra_id_10>", "<extra_id_11>", "<extra_id_12>", "<extra_id_13>", "<extra_id_14>", "<extra_id_15>", "<extra_id_16>", "<extra_id_17>", "<extra_id_18>", "<extra_id_19>", "<extra_id_20>", "<extra_id_21>", "<extra_id_22>", "<extra_id_23>", "<extra_id_24>", "<extra_id_25>", "<extra_id_26>", "<extra_id_27>", "<extra_id_28>", "<extra_id_29>", "<extra_id_30>", "<extra_id_31>", "<extra_id_32>", "<extra_id_33>", "<extra_id_34>", "<extra_id_35>", "<extra_id_36>", "<extra_id_37>", "<extra_id_38>", "<extra_id_39>", "<extra_id_40>", "<extra_id_41>", "<extra_id_42>", "<extra_id_43>", "<extra_id_44>", "<extra_id_45>", "<extra_id_46>", "<extra_id_47>", "<extra_id_48>", "<extra_id_49>", "<extra_id_50>", "<extra_id_51>", "<extra_id_52>", "<extra_id_53>", "<extra_id_54>", "<extra_id_55>", "<extra_id_56>", "<extra_id_57>", "<extra_id_58>", "<extra_id_59>", "<extra_id_60>", "<extra_id_61>", "<extra_id_62>", "<extra_id_63>", "<extra_id_64>", "<extra_id_65>", "<extra_id_66>", "<extra_id_67>", "<extra_id_68>", "<extra_id_69>", "<extra_id_70>", "<extra_id_71>", "<extra_id_72>", "<extra_id_73>", "<extra_id_74>", "<extra_id_75>", "<extra_id_76>", "<extra_id_77>", "<extra_id_78>", "<extra_id_79>", "<extra_id_80>", "<extra_id_81>", "<extra_id_82>", "<extra_id_83>", "<extra_id_84>", "<extra_id_85>", "<extra_id_86>", "<extra_id_87>", "<extra_id_88>", "<extra_id_89>", "<extra_id_90>", "<extra_id_91>", "<extra_id_92>", "<extra_id_93>", "<extra_id_94>", "<extra_id_95>", "<extra_id_96>", "<extra_id_97>", "<extra_id_98>", "<extra_id_99>" ], "clean_up_tokenization_spaces": true, "eos_token": "</s>", "extra_ids": 100, "legacy": true, "model_max_length": 512, "pad_token": "<pad>", "sp_model_kwargs": {}, "tokenizer_class": "T5Tokenizer", "unk_token": "<unk>"}1234567891011121314151617181920212223242526{ "_class_name": "GeoCoreTransformer2DModel", "_diffusers_version": "0.32.0", "in_channels": 128, "context_in_dim": 4096, "hidden_size": 4096, "num_heads": 32, "depth": 8, "depth_repa": 8, "depth_single_blocks": 24, "axes_dim": [ 32, 48, 48 ], "theta": 2000, "mlp_ratio": 3.0, "y_in_dim": 768, "z_out_dim": 4096, "model_size": "9b", "sample_size": 16, "patch_size": 2, "latent_channels": 128, "weights": "model", "training_steps": 300000}123version https://git-lfs.github.com/spec/v1oid sha256:37867b56a02748c67fe64f60118b6b6cd6966653026ba101abd1bf849e4f4b37size 4948246312123version https://git-lfs.github.com/spec/v1oid sha256:561831477a146da51524beacbd28e4e4db9c3d66318c98388823e641e920a956size 4966067040123version https://git-lfs.github.com/spec/v1oid sha256:60107ab28114906426b4187bbca9fda59af121318cb39543a90697b7a7ecef9asize 4932512840123version https://git-lfs.github.com/spec/v1oid sha256:7cef9bd84c652cb25d0868d0f06d3cc4279d8a066db219f9c5f3fb4c7ac7288asize 3624934504123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221{ "metadata": { "total_size": 18471736832 }, "weight_map": { "double_blocks.0.img_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.img_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.img_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.img_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.img_mlp.0.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.img_mlp.2.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.txt_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.txt_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.txt_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.txt_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.txt_mlp.0.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.0.txt_mlp.2.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.img_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.img_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.img_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.img_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.img_mlp.0.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.img_mlp.2.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.txt_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.txt_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.txt_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.txt_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.txt_mlp.0.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.1.txt_mlp.2.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.img_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.img_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.img_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.img_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.img_mlp.0.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.img_mlp.2.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.txt_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.txt_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.txt_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.txt_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.txt_mlp.0.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.2.txt_mlp.2.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.img_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.img_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.img_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.img_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.img_mlp.0.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.img_mlp.2.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.txt_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.txt_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.txt_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.txt_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.txt_mlp.0.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.3.txt_mlp.2.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.img_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.img_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.img_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.img_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.img_mlp.0.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.img_mlp.2.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.txt_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.txt_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.txt_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.txt_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.txt_mlp.0.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.4.txt_mlp.2.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.5.img_attn.norm.key_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.5.img_attn.norm.query_norm.scale": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.5.img_attn.proj.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.5.img_attn.qkv.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "img_in.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "lat_in.in_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "lat_in.out_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "lon_in.in_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "lon_in.out_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "null_lat_emb": "diffusion_pytorch_model-00001-of-00004.safetensors", "null_lon_emb": "diffusion_pytorch_model-00001-of-00004.safetensors", "null_res_emb": "diffusion_pytorch_model-00001-of-00004.safetensors", "repa_out.in_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "repa_out.middle_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "repa_out.out_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "res_in.in_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "res_in.out_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "time_in.in_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "time_in.out_layer.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "txt_in.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "y_in.weight": "diffusion_pytorch_model-00001-of-00004.safetensors", "double_blocks.5.img_mlp.0.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.5.img_mlp.2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.5.txt_attn.norm.key_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.5.txt_attn.norm.query_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.5.txt_attn.proj.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.5.txt_attn.qkv.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.5.txt_mlp.0.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.5.txt_mlp.2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.img_attn.norm.key_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.img_attn.norm.query_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.img_attn.proj.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.img_attn.qkv.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.img_mlp.0.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.img_mlp.2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.txt_attn.norm.key_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.txt_attn.norm.query_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.txt_attn.proj.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.txt_attn.qkv.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.txt_mlp.0.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.6.txt_mlp.2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.img_attn.norm.key_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.img_attn.norm.query_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.img_attn.proj.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.img_attn.qkv.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.img_mlp.0.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.img_mlp.2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.txt_attn.norm.key_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.txt_attn.norm.query_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.txt_attn.proj.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.txt_attn.qkv.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.txt_mlp.0.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "double_blocks.7.txt_mlp.2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.0.linear1.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.0.linear2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.0.norm.key_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.0.norm.query_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.1.linear1.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.1.linear2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.1.norm.key_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.1.norm.query_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.2.linear1.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.2.linear2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.2.norm.key_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.2.norm.query_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.3.linear1.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.3.linear2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.3.norm.key_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.3.norm.query_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.4.linear1.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.4.linear2.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.4.norm.key_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.4.norm.query_norm.scale": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.5.linear1.weight": "diffusion_pytorch_model-00002-of-00004.safetensors", "single_blocks.10.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.10.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.10.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.10.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.11.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.11.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.11.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.11.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.12.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.12.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.12.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.12.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.13.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.13.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.13.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.13.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.14.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.14.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.14.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.14.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.15.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.15.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.15.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.15.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.16.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.16.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.16.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.16.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.5.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.5.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.5.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.6.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.6.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.6.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.6.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.7.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.7.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.7.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.7.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.8.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.8.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.8.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.8.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.9.linear1.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.9.linear2.weight": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.9.norm.key_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "single_blocks.9.norm.query_norm.scale": "diffusion_pytorch_model-00003-of-00004.safetensors", "double_stream_modulation_img.lin.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "double_stream_modulation_txt.lin.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "final_layer.adaLN_modulation.1.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "final_layer.linear.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.17.linear1.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.17.linear2.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.17.norm.key_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.17.norm.query_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.18.linear1.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.18.linear2.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.18.norm.key_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.18.norm.query_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.19.linear1.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.19.linear2.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.19.norm.key_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.19.norm.query_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.20.linear1.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.20.linear2.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.20.norm.key_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.20.norm.query_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.21.linear1.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.21.linear2.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.21.norm.key_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.21.norm.query_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.22.linear1.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.22.linear2.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.22.norm.key_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.22.norm.query_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.23.linear1.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.23.linear2.weight": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.23.norm.key_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_blocks.23.norm.query_norm.scale": "diffusion_pytorch_model-00004-of-00004.safetensors", "single_stream_modulation.lin.weight": "diffusion_pytorch_model-00004-of-00004.safetensors" }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767# Copyright 2026 Jeonghyeok Do and Munchurl Kim. All rights reserved.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License."""GeoCore Flow Matching DiT transformer (self-contained Diffusers model).
Architecture is adapted from the FLUX.2 reference implementation by Black Forest Labs(https://github.com/black-forest-labs/flux), licensed under Apache-2.0, with GeoCoregeospatial metadata conditioning and the GSA projection head."""
from __future__ import annotations
import mathfrom typing import Any
import torchfrom diffusers.configuration_utils import ConfigMixin, register_to_configfrom diffusers.models.modeling_utils import ModelMixinfrom einops import rearrangefrom torch import Tensor, nnfrom torch.nn import functional as Ffrom torch.utils.checkpoint import checkpoint
class SelfAttention(nn.Module): def __init__( self, dim: int, num_heads: int = 8, ): super().__init__() self.num_heads = num_heads head_dim = dim // num_heads self.qkv = nn.Linear(dim, dim * 3, bias=False)
self.norm = QKNorm(head_dim) self.proj = nn.Linear(dim, dim, bias=False)
class SiLUActivation(nn.Module): def __init__(self): super().__init__() self.gate_fn = nn.SiLU()
def forward(self, x: Tensor) -> Tensor: x1, x2 = x.chunk(2, dim=-1) return self.gate_fn(x1) * x2
class Modulation(nn.Module): def __init__(self, dim: int, double: bool, disable_bias: bool = False): super().__init__() self.is_double = double self.multiplier = 6 if double else 3 self.lin = nn.Linear(dim, self.multiplier * dim, bias=not disable_bias)
def forward(self, vec: torch.Tensor): out = self.lin(nn.functional.silu(vec)) if out.ndim == 2: out = out[:, None, :] out = out.chunk(self.multiplier, dim=-1) return out[:3], out[3:] if self.is_double else None
class LastLayer(nn.Module): def __init__( self, hidden_size: int, out_channels: int, ): super().__init__() self.norm_final = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6) self.linear = nn.Linear(hidden_size, out_channels, bias=False) self.adaLN_modulation = nn.Sequential(nn.SiLU(), nn.Linear(hidden_size, 2 * hidden_size, bias=False))
def forward(self, x: torch.Tensor, vec: torch.Tensor) -> torch.Tensor: mod = self.adaLN_modulation(vec) shift, scale = mod.chunk(2, dim=-1) if shift.ndim == 2: shift = shift[:, None, :] scale = scale[:, None, :] x = (1 + scale) * self.norm_final(x) + shift x = self.linear(x) return x
class SingleStreamBlock(nn.Module): def __init__( self, hidden_size: int, num_heads: int, mlp_ratio: float = 4.0, ): super().__init__()
self.hidden_dim = hidden_size self.num_heads = num_heads head_dim = hidden_size // num_heads self.scale = head_dim**-0.5 self.mlp_hidden_dim = int(hidden_size * mlp_ratio) self.mlp_mult_factor = 2
self.linear1 = nn.Linear( hidden_size, hidden_size * 3 + self.mlp_hidden_dim * self.mlp_mult_factor, bias=False, )
self.linear2 = nn.Linear(hidden_size + self.mlp_hidden_dim, hidden_size, bias=False)
self.norm = QKNorm(head_dim)
self.hidden_size = hidden_size self.pre_norm = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6)
self.mlp_act = SiLUActivation()
def forward( self, x: Tensor, pe: Tensor, mod: tuple[Tensor, Tensor, Tensor], num_txt_tokens: int, num_ref_tokens: int = 0, ) -> tuple[Tensor, dict]: """Entry point used at inference so accelerate device_map hooks can move tensors.""" return self.forward_kv_extract(x, pe, mod, num_txt_tokens, num_ref_tokens)
def _qkv(self, x: Tensor, mod: tuple[Tensor, Tensor, Tensor]): mod_shift, mod_scale, mod_gate = mod x_mod = (1 + mod_scale) * self.pre_norm(x) + mod_shift
qkv, mlp = torch.split( self.linear1(x_mod), [3 * self.hidden_size, self.mlp_hidden_dim * self.mlp_mult_factor], dim=-1, )
q, k, v = rearrange(qkv, "B L (K H D) -> K B H L D", K=3, H=self.num_heads) q, k = self.norm(q, k, v) return q, k, v, mlp, mod_gate
def _out(self, x: Tensor, attn: Tensor, mlp: Tensor, mod_gate: Tensor) -> Tensor: output = self.linear2(torch.cat((attn, self.mlp_act(mlp)), 2)) return x + mod_gate * output
def forward_kv_extract( self, x: Tensor, pe: Tensor, mod: tuple[Tensor, Tensor, Tensor], num_txt_tokens: int, num_ref_tokens: int, ) -> tuple[Tensor, dict]: """Forward with causal attention. Extracts and returns ref KV cache.""" q, k, v, mlp, mod_gate = self._qkv(x, mod) q, k = apply_rope(q, k, pe)
ref_start = num_txt_tokens ref_end = num_txt_tokens + num_ref_tokens cache = { "k_ref": k[:, :, ref_start:ref_end, :].clone(), "v_ref": v[:, :, ref_start:ref_end, :].clone(), }
attn = causal_attn_fn(q, k, v, num_txt_tokens, num_ref_tokens) return self._out(x, attn, mlp, mod_gate), cache
def forward_kv_cached( self, x: Tensor, pe: Tensor, mod: tuple[Tensor, Tensor, Tensor], num_txt_tokens: int, kv_cache: dict, ) -> Tensor: """Forward using cached ref KV. Input x has layout [txt, img] (no ref).""" q, k, v, mlp, mod_gate = self._qkv(x, mod) q, k = apply_rope(q, k, pe) num_ref_tokens = kv_cache["k_ref"].shape[2] attn = causal_attn_fn(q, k, v, num_txt_tokens, num_ref_tokens, kv_cache) return self._out(x, attn, mlp, mod_gate)
class DoubleStreamBlock(nn.Module): def __init__( self, hidden_size: int, num_heads: int, mlp_ratio: float, ): super().__init__() mlp_hidden_dim = int(hidden_size * mlp_ratio) self.num_heads = num_heads assert hidden_size % num_heads == 0, f"{hidden_size=} must be divisible by {num_heads=}"
self.hidden_size = hidden_size self.img_norm1 = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6) self.mlp_mult_factor = 2
self.img_attn = SelfAttention( dim=hidden_size, num_heads=num_heads, )
self.img_norm2 = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6) self.img_mlp = nn.Sequential( nn.Linear(hidden_size, mlp_hidden_dim * self.mlp_mult_factor, bias=False), SiLUActivation(), nn.Linear(mlp_hidden_dim, hidden_size, bias=False), )
self.txt_norm1 = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6) self.txt_attn = SelfAttention( dim=hidden_size, num_heads=num_heads, )
self.txt_norm2 = nn.LayerNorm(hidden_size, elementwise_affine=False, eps=1e-6) self.txt_mlp = nn.Sequential( nn.Linear( hidden_size, mlp_hidden_dim * self.mlp_mult_factor, bias=False, ), SiLUActivation(), nn.Linear(mlp_hidden_dim, hidden_size, bias=False), )
def forward( self, img: Tensor, txt: Tensor, pe: Tensor, pe_ctx: Tensor, mod_img: tuple[Tensor, Tensor], mod_txt: tuple[Tensor, Tensor], num_ref_tokens: int = 0, ) -> tuple[Tensor, Tensor, dict]: """Entry point used at inference so accelerate device_map hooks can move tensors.""" return self.forward_kv_extract(img, txt, pe, pe_ctx, mod_img, mod_txt, num_ref_tokens)
def _prepare_qkv(self, img, txt, pe, pe_ctx, mod_img, mod_txt): img_mod1, img_mod2 = mod_img txt_mod1, txt_mod2 = mod_txt
img_mod1_shift, img_mod1_scale, img_mod1_gate = img_mod1 img_mod2_shift, img_mod2_scale, img_mod2_gate = img_mod2 txt_mod1_shift, txt_mod1_scale, txt_mod1_gate = txt_mod1 txt_mod2_shift, txt_mod2_scale, txt_mod2_gate = txt_mod2
# prepare image for attention img_modulated = self.img_norm1(img) img_modulated = (1 + img_mod1_scale) * img_modulated + img_mod1_shift
img_qkv = self.img_attn.qkv(img_modulated) img_q, img_k, img_v = rearrange(img_qkv, "B L (K H D) -> K B H L D", K=3, H=self.num_heads) img_q, img_k = self.img_attn.norm(img_q, img_k, img_v)
# prepare txt for attention txt_modulated = self.txt_norm1(txt) txt_modulated = (1 + txt_mod1_scale) * txt_modulated + txt_mod1_shift
txt_qkv = self.txt_attn.qkv(txt_modulated) txt_q, txt_k, txt_v = rearrange(txt_qkv, "B L (K H D) -> K B H L D", K=3, H=self.num_heads) txt_q, txt_k = self.txt_attn.norm(txt_q, txt_k, txt_v)
q = torch.cat((txt_q, img_q), dim=2) k = torch.cat((txt_k, img_k), dim=2) v = torch.cat((txt_v, img_v), dim=2)
num_txt_tokens = txt_q.shape[2] pe_full = torch.cat((pe_ctx, pe), dim=2)
mods = ( img_mod1_gate, img_mod2_shift, img_mod2_scale, img_mod2_gate, txt_mod1_gate, txt_mod2_shift, txt_mod2_scale, txt_mod2_gate, )
return q, k, v, pe_full, num_txt_tokens, mods
def _apply_residuals(self, img, txt, img_attn, txt_attn, mods): ( img_mod1_gate, img_mod2_shift, img_mod2_scale, img_mod2_gate, txt_mod1_gate, txt_mod2_shift, txt_mod2_scale, txt_mod2_gate, ) = mods
img = img + img_mod1_gate * self.img_attn.proj(img_attn) img = img + img_mod2_gate * self.img_mlp( (1 + img_mod2_scale) * (self.img_norm2(img)) + img_mod2_shift )
txt = txt + txt_mod1_gate * self.txt_attn.proj(txt_attn) txt = txt + txt_mod2_gate * self.txt_mlp( (1 + txt_mod2_scale) * (self.txt_norm2(txt)) + txt_mod2_shift ) return img, txt
def forward_kv_extract( self, img: Tensor, txt: Tensor, pe: Tensor, pe_ctx: Tensor, mod_img: tuple[Tensor, Tensor], mod_txt: tuple[Tensor, Tensor], num_ref_tokens: int, ) -> tuple[Tensor, Tensor, dict]: """Forward with causal attention. img has layout [ref, img]. Extracts ref KV cache.""" q, k, v, pe_full, num_txt_tokens, mods = self._prepare_qkv(img, txt, pe, pe_ctx, mod_img, mod_txt) q, k = apply_rope(q, k, pe_full)
ref_start = num_txt_tokens ref_end = num_txt_tokens + num_ref_tokens cache = { "k_ref": k[:, :, ref_start:ref_end, :].clone(), "v_ref": v[:, :, ref_start:ref_end, :].clone(), }
attn = causal_attn_fn(q, k, v, num_txt_tokens, num_ref_tokens) txt_attn, img_attn = attn[:, :num_txt_tokens], attn[:, num_txt_tokens:] img, txt = self._apply_residuals(img, txt, img_attn, txt_attn, mods) return img, txt, cache
def forward_kv_cached( self, img: Tensor, txt: Tensor, pe: Tensor, pe_ctx: Tensor, mod_img: tuple[Tensor, Tensor], mod_txt: tuple[Tensor, Tensor], kv_cache: dict, ) -> tuple[Tensor, Tensor]: """Forward using cached ref KV. img has layout [img] only (no ref).""" q, k, v, pe_full, num_txt_tokens, mods = self._prepare_qkv(img, txt, pe, pe_ctx, mod_img, mod_txt) q, k = apply_rope(q, k, pe_full)
num_ref_tokens = kv_cache["k_ref"].shape[2] attn = causal_attn_fn(q, k, v, num_txt_tokens, num_ref_tokens, kv_cache) txt_attn, img_attn = attn[:, :num_txt_tokens], attn[:, num_txt_tokens:] return self._apply_residuals(img, txt, img_attn, txt_attn, mods)
class MLPEmbedder(nn.Module): def __init__(self, in_dim: int, hidden_dim: int, disable_bias: bool = False): super().__init__() self.in_layer = nn.Linear(in_dim, hidden_dim, bias=not disable_bias) self.out_layer = nn.Linear(hidden_dim, hidden_dim, bias=not disable_bias) self.silu = nn.SiLU()
def forward(self, x: Tensor) -> Tensor: return self.out_layer(self.silu(self.in_layer(x)))
class REPAEmbedder(nn.Module): def __init__(self, in_dim: int, hidden_dim: int, out_dim: int, disable_bias: bool = False): super().__init__() self.in_layer = nn.Linear(in_dim, hidden_dim, bias=not disable_bias) self.middle_layer = nn.Linear(hidden_dim, hidden_dim, bias=not disable_bias) self.out_layer = nn.Linear(hidden_dim, out_dim, bias=not disable_bias) self.silu = nn.SiLU()
def forward(self, x: Tensor) -> Tensor: return self.out_layer(self.silu(self.middle_layer(self.silu(self.in_layer(x)))))
class EmbedND(nn.Module): def __init__(self, dim: int, theta: int, axes_dim: list[int]): super().__init__() self.dim = dim self.theta = theta self.axes_dim = axes_dim
def forward(self, ids: Tensor) -> Tensor: emb = torch.cat( [rope(ids[..., i], self.axes_dim[i], self.theta) for i in range(len(self.axes_dim))], dim=-3, )
return emb.unsqueeze(1)
def timestep_embedding(t: Tensor, dim, max_period=10000, time_factor: float = 1000.0): """ Create sinusoidal timestep embeddings. :param t: a 1-D Tensor of N indices, one per batch element. These may be fractional. :param dim: the dimension of the output. :param max_period: controls the minimum frequency of the embeddings. :return: an (N, D) Tensor of positional embeddings. """ t = time_factor * t half = dim // 2 freqs = torch.exp( -math.log(max_period) * torch.arange(start=0, end=half, device=t.device, dtype=torch.float32) / half )
args = t[:, None].float() * freqs[None] embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1) if dim % 2: embedding = torch.cat([embedding, torch.zeros_like(embedding[:, :1])], dim=-1) if torch.is_floating_point(t): embedding = embedding.to(t) return embedding
class RMSNorm(torch.nn.Module): def __init__(self, dim: int): super().__init__() self.scale = nn.Parameter(torch.ones(dim))
def forward(self, x: Tensor): x_dtype = x.dtype x = x.float() rrms = torch.rsqrt(torch.mean(x**2, dim=-1, keepdim=True) + 1e-6) return (x * rrms).to(dtype=x_dtype) * self.scale
class QKNorm(torch.nn.Module): def __init__(self, dim: int): super().__init__() self.query_norm = RMSNorm(dim) self.key_norm = RMSNorm(dim)
def forward(self, q: Tensor, k: Tensor, v: Tensor) -> tuple[Tensor, Tensor]: q = self.query_norm(q) k = self.key_norm(k) return q.to(v), k.to(v)
def causal_attn_fn( q: Tensor, k: Tensor, v: Tensor, num_txt_tokens: int, num_ref_tokens: int, kv_cache: dict | None = None,) -> Tensor: """ Causal attention where reference tokens only attend to themselves.
Without cache: layout is [txt, ref, img]. txt+img attend to all, ref self-attends. With cache: layout is [txt, img]. Cached ref K/V injected into attention. """ if kv_cache is not None: k_ref = kv_cache["k_ref"] v_ref = kv_cache["v_ref"]
q_txt = q[:, :, :num_txt_tokens, :] q_img = q[:, :, num_txt_tokens:, :] k_txt = k[:, :, :num_txt_tokens, :] v_txt = v[:, :, :num_txt_tokens, :] k_img = k[:, :, num_txt_tokens:, :] v_img = v[:, :, num_txt_tokens:, :]
q_txt_img = torch.cat([q_txt, q_img], dim=2) k_all = torch.cat([k_txt, k_ref, k_img], dim=2) v_all = torch.cat([v_txt, v_ref, v_img], dim=2) out = F.scaled_dot_product_attention(q_txt_img, k_all, v_all, is_causal=False)
else: ref_start = num_txt_tokens ref_end = num_txt_tokens + num_ref_tokens
q_txt = q[:, :, :ref_start, :] q_ref = q[:, :, ref_start:ref_end, :] q_img = q[:, :, ref_end:, :] k_txt = k[:, :, :ref_start, :] v_txt = v[:, :, :ref_start, :] k_ref = k[:, :, ref_start:ref_end, :] v_ref = v[:, :, ref_start:ref_end, :] k_img = k[:, :, ref_end:, :] v_img = v[:, :, ref_end:, :]
# txt+img attend to all keys q_txt_img = torch.cat([q_txt, q_img], dim=2) k_all = torch.cat([k_txt, k_ref, k_img], dim=2) v_all = torch.cat([v_txt, v_ref, v_img], dim=2) attn_txt_img = F.scaled_dot_product_attention(q_txt_img, k_all, v_all, is_causal=False) attn_txt = attn_txt_img[:, :, :ref_start, :] attn_img = attn_txt_img[:, :, ref_start:, :]
# ref only attends to itself attn_ref = F.scaled_dot_product_attention(q_ref, k_ref, v_ref, is_causal=False)
out = torch.cat([attn_txt, attn_ref, attn_img], dim=2)
return rearrange(out, "b h n d -> b n (h d)")
def rope(pos: Tensor, dim: int, theta: int) -> Tensor: assert dim % 2 == 0 scale = torch.arange(0, dim, 2, dtype=pos.dtype, device=pos.device) / dim omega = 1.0 / (theta**scale) out = torch.einsum("...n,d->...nd", pos, omega) out = torch.stack([torch.cos(out), -torch.sin(out), torch.sin(out), torch.cos(out)], dim=-1) out = rearrange(out, "b n d (i j) -> b n d i j", i=2, j=2) return out.float()
def apply_rope(xq: Tensor, xk: Tensor, freqs_cis: Tensor) -> tuple[Tensor, Tensor]: xq_ = xq.float().reshape(*xq.shape[:-1], -1, 1, 2) xk_ = xk.float().reshape(*xk.shape[:-1], -1, 1, 2) xq_out = freqs_cis[..., 0] * xq_[..., 0] + freqs_cis[..., 1] * xq_[..., 1] xk_out = freqs_cis[..., 0] * xk_[..., 0] + freqs_cis[..., 1] * xk_[..., 1] return xq_out.reshape(*xq.shape).type_as(xq), xk_out.reshape(*xk.shape).type_as(xk)
class GeoCoreTransformer2DModel(ModelMixin, ConfigMixin): r"""GeoCore text- and geo-conditioned Flow Matching DiT.
Self-contained FLUX.2-style double/single-stream transformer with geospatial metadata conditioning (`res`, `lon`, `lat`) and an optional GSA projection head. """
config_name = "config.json" _supports_gradient_checkpointing = True _no_split_modules = ["DoubleStreamBlock", "SingleStreamBlock"] _repeated_blocks = ["DoubleStreamBlock", "SingleStreamBlock"]
@register_to_config def __init__( self, in_channels: int = 128, context_in_dim: int = 4096, hidden_size: int = 4096, num_heads: int = 32, depth: int = 8, depth_repa: int = 8, depth_single_blocks: int = 24, axes_dim: list[int] | None = None, theta: int = 2000, mlp_ratio: float = 3.0, y_in_dim: int = 768, z_out_dim: int = 4096, model_size: str = "9b", sample_size: int = 16, patch_size: int = 2, latent_channels: int = 128, weights: str = "model", training_steps: int | None = None, **_unused: Any, ) -> None: super().__init__() axes_dim = list(axes_dim) if axes_dim is not None else [32, 48, 48]
self.gradient_checkpointing = False self.in_channels = in_channels self.out_channels = in_channels self.depth_repa = depth_repa if hidden_size % num_heads != 0: raise ValueError( f"Hidden size {hidden_size} must be divisible by num_heads {num_heads}" ) pe_dim = hidden_size // num_heads if sum(axes_dim) != pe_dim: raise ValueError(f"Got {axes_dim} but expected positional dim {pe_dim}") self.hidden_size = hidden_size self.num_heads = num_heads self.pe_embedder = EmbedND(dim=pe_dim, theta=theta, axes_dim=axes_dim) self.img_in = nn.Linear(self.in_channels, self.hidden_size, bias=False) self.txt_in = nn.Linear(context_in_dim, self.hidden_size, bias=False) self.y_in = nn.Linear(y_in_dim, self.hidden_size, bias=False) self.time_in = MLPEmbedder(in_dim=256, hidden_dim=self.hidden_size, disable_bias=True) self.res_in = MLPEmbedder(in_dim=256, hidden_dim=self.hidden_size, disable_bias=True) self.lon_in = MLPEmbedder(in_dim=256, hidden_dim=self.hidden_size, disable_bias=True) self.lat_in = MLPEmbedder(in_dim=256, hidden_dim=self.hidden_size, disable_bias=True) self.repa_out = REPAEmbedder( in_dim=self.hidden_size, hidden_dim=2 * self.hidden_size, out_dim=z_out_dim, disable_bias=True, )
self.null_res_emb = nn.Parameter(torch.zeros(1, 256)) self.null_lon_emb = nn.Parameter(torch.zeros(1, 256)) self.null_lat_emb = nn.Parameter(torch.zeros(1, 256))
self.double_blocks = nn.ModuleList( [ DoubleStreamBlock(self.hidden_size, self.num_heads, mlp_ratio=mlp_ratio) for _ in range(depth) ] ) self.single_blocks = nn.ModuleList( [ SingleStreamBlock(self.hidden_size, self.num_heads, mlp_ratio=mlp_ratio) for _ in range(depth_single_blocks) ] )
self.double_stream_modulation_img = Modulation(self.hidden_size, double=True, disable_bias=True) self.double_stream_modulation_txt = Modulation(self.hidden_size, double=True, disable_bias=True) self.single_stream_modulation = Modulation(self.hidden_size, double=False, disable_bias=True) self.final_layer = LastLayer(self.hidden_size, self.out_channels) # Skip init under accelerate.init_empty_weights() (meta tensors) used by device_map. first = next(self.parameters(), None) if first is not None and first.device.type != "meta": self.initialize_weights()
def _set_gradient_checkpointing(self, module, value: bool = False) -> None: if hasattr(module, "gradient_checkpointing"): module.gradient_checkpointing = value self.gradient_checkpointing = value
def initialize_weights(self):
def _basic_init(module): if isinstance(module, nn.Linear): torch.nn.init.xavier_uniform_(module.weight) if module.bias is not None: nn.init.constant_(module.bias, 0)
self.apply(_basic_init)
nn.init.normal_(self.img_in.weight, std=0.02) nn.init.normal_(self.txt_in.weight, std=0.02) nn.init.normal_(self.y_in.weight, std=0.02)
for embedder in [self.time_in, self.res_in, self.lon_in, self.lat_in]: nn.init.normal_(embedder.in_layer.weight, std=0.02) nn.init.constant_(embedder.out_layer.weight, 0) if embedder.out_layer.bias is not None: nn.init.constant_(embedder.out_layer.bias, 0)
nn.init.constant_(self.double_stream_modulation_img.lin.weight, 0) nn.init.constant_(self.double_stream_modulation_txt.lin.weight, 0) nn.init.constant_(self.single_stream_modulation.lin.weight, 0)
if self.single_stream_modulation.lin.bias is not None: nn.init.constant_(self.single_stream_modulation.lin.bias, 0)
nn.init.constant_(self.final_layer.adaLN_modulation[1].weight, 0) if self.final_layer.adaLN_modulation[1].bias is not None: nn.init.constant_(self.final_layer.adaLN_modulation[1].bias, 0)
nn.init.constant_(self.final_layer.linear.weight, 0) if self.final_layer.linear.bias is not None: nn.init.constant_(self.final_layer.linear.bias, 0)
nn.init.constant_(self.repa_out.out_layer.weight, 0) if self.repa_out.out_layer.bias is not None: nn.init.constant_(self.repa_out.out_layer.bias, 0)
nn.init.normal_(self.null_res_emb, std=0.02) nn.init.normal_(self.null_lon_emb, std=0.02) nn.init.normal_(self.null_lat_emb, std=0.02)
def make_vec(self, timesteps, res, lon, lat, y): drop_res_mask = (res == -999.0).view(-1, 1) drop_loc_mask = (lon == -999.0).view(-1, 1)
res_norm = (res - (-1.0)) / 8.0 lon_norm = (lon - (-180.0)) / 360.0 lat_norm = (lat - (-90.0)) / 180.0
t_emb = timestep_embedding(timesteps, 256) res_emb_raw = timestep_embedding(res_norm, 256) lon_emb_raw = timestep_embedding(lon_norm, 256) lat_emb_raw = timestep_embedding(lat_norm, 256)
res_emb = torch.where(drop_res_mask, self.null_res_emb.to(res_emb_raw.dtype), res_emb_raw) lon_emb = torch.where(drop_loc_mask, self.null_lon_emb.to(lon_emb_raw.dtype), lon_emb_raw) lat_emb = torch.where(drop_loc_mask, self.null_lat_emb.to(lat_emb_raw.dtype), lat_emb_raw)
return self.time_in(t_emb) + self.res_in(res_emb) + self.lon_in(lon_emb) + self.lat_in(lat_emb) + self.y_in(y)
def forward( self, x: Tensor, x_ids: Tensor, timesteps: Tensor, ctx: Tensor, ctx_ids: Tensor, y: Tensor, res: Tensor, lon: Tensor, lat: Tensor, detach: bool = False, ): B, C, H_lat, W_lat = x.shape x = x.flatten(2).transpose(1, 2)
num_txt_tokens = ctx.shape[1]
vec = self.make_vec(timesteps, res, lon, lat, y)
double_block_mod_img = self.double_stream_modulation_img(vec) double_block_mod_txt = self.double_stream_modulation_txt(vec) single_block_mod, _ = self.single_stream_modulation(vec)
img = self.img_in(x) txt = self.txt_in(ctx)
pe_x = self.pe_embedder(x_ids) pe_ctx = self.pe_embedder(ctx_ids)
z_repa = None for i, block in enumerate(self.double_blocks): if self.gradient_checkpointing and self.training: img, txt, _ = checkpoint( block.forward_kv_extract, img, txt, pe_x, pe_ctx, double_block_mod_img, double_block_mod_txt, 0, # num_ref_tokens use_reentrant=False ) else: img, txt, _ = block( img, txt, pe_x, pe_ctx, double_block_mod_img, double_block_mod_txt, 0, )
if (i + 1) == self.depth_repa: curr_x = img.detach() if detach else img z_repa = self.repa_out(curr_x)
img = torch.cat((txt, img), dim=1) pe = torch.cat((pe_ctx, pe_x), dim=2)
for block in self.single_blocks: if self.gradient_checkpointing and self.training: img, _ = checkpoint( block.forward_kv_extract, img, pe, single_block_mod, num_txt_tokens, 0, # num_ref_tokens use_reentrant=False ) else: img, _ = block( img, pe, single_block_mod, num_txt_tokens, 0, )
img = img[:, num_txt_tokens:, ...]
img = self.final_layer(img, vec) img = img.transpose(1, 2).reshape(B, -1, H_lat, W_lat) return img, z_repa
12345678910111213141516171819202122232425262728293031323334353637383940{ "_class_name": "AutoencoderKLFlux2", "_diffusers_version": "0.37.0.dev0", "_name_or_path": "black-forest-labs/FLUX.2-dev", "act_fn": "silu", "batch_norm_eps": 0.0001, "batch_norm_momentum": 0.1, "block_out_channels": [ 128, 256, 512, 512 ], "down_block_types": [ "DownEncoderBlock2D", "DownEncoderBlock2D", "DownEncoderBlock2D", "DownEncoderBlock2D" ], "force_upcast": true, "in_channels": 3, "latent_channels": 32, "layers_per_block": 2, "mid_block_add_attention": true, "norm_num_groups": 32, "out_channels": 3, "patch_size": [ 2, 2 ], "sample_size": 1024, "up_block_types": [ "UpDecoderBlock2D", "UpDecoderBlock2D", "UpDecoderBlock2D", "UpDecoderBlock2D" ], "use_post_quant_conv": true, "use_quant_conv": true}123version https://git-lfs.github.com/spec/v1oid sha256:ca70d2202afe6415bdbcb8793ba8cd99fd159cfe6192381504d6c4d3036e0f04size 168120878.gitattributes+3
LICENSEAdded+179
LICENSE-FLUX2-VAE.mdAdded+176
README.mdAdded+118
demo/commercial.pngAdded

Large File Pointer Details
- SHA256: eb682c5f82ed7caebc4c2f4e817d7dfb24edbdf821089d544643a569b92ed70c
- Pointer size: 131 Bytes
- Size of remote file: 125 kB
demo/parking.pngAdded

Large File Pointer Details
- SHA256: 551fffadeb1e3120042b058f77c3226e1d29cdc841ed4dd766e8fab6f001024c
- Pointer size: 131 Bytes
- Size of remote file: 145 kB
demo/roundabout.pngAdded

demo/tennis.pngAdded

Large File Pointer Details
- SHA256: 1b17ce7e51ff6000659ac14f7128eff2d4e5f58ef472694c685e6b2cf2f077f3
- Pointer size: 131 Bytes
- Size of remote file: 107 kB
model_index.jsonAdded+35
pipeline.pyAdded+422
scheduler/scheduler_config.jsonAdded+7
text_encoder/config.jsonAdded+24
text_encoder/model.safetensorsAdded+3
text_encoder_2/config.jsonAdded+31
text_encoder_2/model-00001-of-00002.safetensorsAdded+3
text_encoder_2/model-00002-of-00002.safetensorsAdded+3
text_encoder_2/model.safetensors.index.jsonAdded+226
tokenizer/merges.txtAdded
tokenizer/special_tokens_map.jsonAdded+30
tokenizer/tokenizer_config.jsonAdded+30
tokenizer/vocab.jsonAdded
tokenizer_2/special_tokens_map.jsonAdded+125
tokenizer_2/spiece.modelAdded+3
tokenizer_2/tokenizer.jsonAdded
tokenizer_2/tokenizer_config.jsonAdded+940
transformer/config.jsonAdded+26
transformer/diffusion_pytorch_model-00001-of-00004.safetensorsAdded+3
transformer/diffusion_pytorch_model-00002-of-00004.safetensorsAdded+3
transformer/diffusion_pytorch_model-00003-of-00004.safetensorsAdded+3
transformer/diffusion_pytorch_model-00004-of-00004.safetensorsAdded+3
transformer/diffusion_pytorch_model.safetensors.index.jsonAdded+221
transformer/transformer_geocore.pyAdded+767
vae/config.jsonAdded+40
vae/diffusion_pytorch_model.safetensorsAdded+3