Spaces:
Paused
Paused
Revert "Point the conditioner at the truncated 51 layer text encoder (#1)"
Browse filesThis reverts commit 9b4f7dd67718a81d9b4343207287bf97cc273ebd.
- app.py +5 -6
- h3_split_blocks.py +3 -3
app.py
CHANGED
|
@@ -19,12 +19,11 @@ import traceback
|
|
| 19 |
|
| 20 |
# First, and at module level. On ZeroGPU `import spaces` patches `torch.cuda` so that `is_available()` is True and
|
| 21 |
# `get_device_capability()` answers the pool's own (12, 0) before any GPU is attached — which is what lets the whole
|
| 22 |
-
#
|
| 23 |
import spaces
|
| 24 |
import gradio as gr
|
| 25 |
|
| 26 |
-
|
| 27 |
-
MODEL_REPO = os.environ.get("MODEL_REPO", "multimodalart/MiniMax-H3-Pruned") # overridable as a Space variable
|
| 28 |
# A rewrite and an encode are booked separately, and both bookings are small. An `xlarge` booking costs twice the
|
| 29 |
# seconds it reserves, and a caller ZeroGPU cannot attribute may book at most 120 credits at a time — 60 s of
|
| 30 |
# `xlarge` — so a single booking covering both would be refused before any work happened. One forward through 50
|
|
@@ -110,7 +109,7 @@ def status() -> str:
|
|
| 110 |
if LOAD_ERROR:
|
| 111 |
return LOAD_ERROR
|
| 112 |
if PIPE is None:
|
| 113 |
-
return f"Loading `{MODEL_REPO}:text_encoder/` (
|
| 114 |
return (
|
| 115 |
f"Ready · Qwen3-VL conditioner, **bfloat16, unquantized**, {NUM_LAYERS} decoder layers, read at layer 50 · "
|
| 116 |
f"loaded in {LOADED_IN:.0f}s · repo `{MODEL_REPO}`"
|
|
@@ -123,7 +122,7 @@ def load_models() -> str | None:
|
|
| 123 |
Only `text_encoder`, `tokenizer` and `processor` are fetched: those are the pretrained components
|
| 124 |
`MiniMaxH3ConditionerBlocks` declares — its `image_processor` is built from config and downloads nothing — and
|
| 125 |
`load_components` resolves each against `modular_model_index.json`, so neither transformer partition nor either
|
| 126 |
-
VAE is ever downloaded here. That is what keeps this Space at
|
| 127 |
|
| 128 |
The weights are moved onto the card here as well. These are plain bfloat16 tensors, so ZeroGPU's startup packing
|
| 129 |
(`aten.empty_like(..., pin_memory=True)`) handles them — it is a torchao `Float8Tensor` that does not implement it,
|
|
@@ -149,7 +148,7 @@ def load_models() -> str | None:
|
|
| 149 |
|
| 150 |
# The `ref2va` conditioner half declares the same three components, so it is handed the ones that are
|
| 151 |
# already resident: `update_components` fills them in, `load_components` would then find nothing left to
|
| 152 |
-
# fetch, and there is never a second
|
| 153 |
ref2va_pipe = MiniMaxH3Ref2VAConditionerBlocks().init_pipeline(MODEL_REPO)
|
| 154 |
ref2va_pipe.update_components(
|
| 155 |
text_encoder=pipe.text_encoder, tokenizer=pipe.tokenizer, processor=pipe.processor
|
|
|
|
| 19 |
|
| 20 |
# First, and at module level. On ZeroGPU `import spaces` patches `torch.cuda` so that `is_available()` is True and
|
| 21 |
# `get_device_capability()` answers the pool's own (12, 0) before any GPU is attached — which is what lets the whole
|
| 22 |
+
# 62.14 GiB load happen at **startup**, off GPU time. It also has to precede anything that initializes CUDA.
|
| 23 |
import spaces
|
| 24 |
import gradio as gr
|
| 25 |
|
| 26 |
+
MODEL_REPO = os.environ.get("MODEL_REPO", "MiniMaxAI/MiniMax-H3") # public; overridable as a Space variable
|
|
|
|
| 27 |
# A rewrite and an encode are booked separately, and both bookings are small. An `xlarge` booking costs twice the
|
| 28 |
# seconds it reserves, and a caller ZeroGPU cannot attribute may book at most 120 credits at a time — 60 s of
|
| 29 |
# `xlarge` — so a single booking covering both would be refused before any work happened. One forward through 50
|
|
|
|
| 109 |
if LOAD_ERROR:
|
| 110 |
return LOAD_ERROR
|
| 111 |
if PIPE is None:
|
| 112 |
+
return f"Loading `{MODEL_REPO}:text_encoder/` (62.14 GiB). Watch the Space logs."
|
| 113 |
return (
|
| 114 |
f"Ready · Qwen3-VL conditioner, **bfloat16, unquantized**, {NUM_LAYERS} decoder layers, read at layer 50 · "
|
| 115 |
f"loaded in {LOADED_IN:.0f}s · repo `{MODEL_REPO}`"
|
|
|
|
| 122 |
Only `text_encoder`, `tokenizer` and `processor` are fetched: those are the pretrained components
|
| 123 |
`MiniMaxH3ConditionerBlocks` declares — its `image_processor` is built from config and downloads nothing — and
|
| 124 |
`load_components` resolves each against `modular_model_index.json`, so neither transformer partition nor either
|
| 125 |
+
VAE is ever downloaded here. That is what keeps this Space at 66.7 GB of the 150 GB quota.
|
| 126 |
|
| 127 |
The weights are moved onto the card here as well. These are plain bfloat16 tensors, so ZeroGPU's startup packing
|
| 128 |
(`aten.empty_like(..., pin_memory=True)`) handles them — it is a torchao `Float8Tensor` that does not implement it,
|
|
|
|
| 148 |
|
| 149 |
# The `ref2va` conditioner half declares the same three components, so it is handed the ones that are
|
| 150 |
# already resident: `update_components` fills them in, `load_components` would then find nothing left to
|
| 151 |
+
# fetch, and there is never a second 62.14 GiB copy of the Qwen3-VL on the card.
|
| 152 |
ref2va_pipe = MiniMaxH3Ref2VAConditionerBlocks().init_pipeline(MODEL_REPO)
|
| 153 |
ref2va_pipe.update_components(
|
| 154 |
text_encoder=pipe.text_encoder, tokenizer=pipe.tokenizer, processor=pipe.processor
|
h3_split_blocks.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
"""The halves of a **split** MiniMax-H3 deployment, for both of its checkpoint partitions.
|
| 2 |
|
| 3 |
MiniMax-H3 is 195.9 GiB in bfloat16 and a ZeroGPU Space is evicted at 150 GB of storage, so `MiniMaxH3Blocks` is cut
|
| 4 |
-
at its `text_encoder` step: the
|
| 5 |
Space, and `prompt_embeds` + `text_token_tags` is the whole wire format between them.
|
| 6 |
|
| 7 |
`resize` / `setup` run on **both** sides: they own no pretrained component, and each half needs the canvas and the
|
|
@@ -84,7 +84,7 @@ class MiniMaxH3GeneratorBlocks(SequentialPipelineBlocks):
|
|
| 84 |
return (
|
| 85 |
"The denoising half of a split MiniMax-H3 deployment: the `t2va` / `fl2va` branch of `MiniMaxH3Blocks` "
|
| 86 |
"without its text-encoder step, so `prompt_embeds` and `text_token_tags` come in as inputs and the "
|
| 87 |
-
"
|
| 88 |
)
|
| 89 |
|
| 90 |
@property
|
|
@@ -139,7 +139,7 @@ class MiniMaxH3Ref2VAGeneratorBlocks(SequentialPipelineBlocks):
|
|
| 139 |
return (
|
| 140 |
"The denoising half of a split MiniMax-H3 `ref2va` deployment: the `ref2va` branch of `MiniMaxH3Blocks` "
|
| 141 |
"without its text-encoder step, so `prompt_embeds` and `text_token_tags` come in as inputs and the "
|
| 142 |
-
"
|
| 143 |
)
|
| 144 |
|
| 145 |
@property
|
|
|
|
| 1 |
"""The halves of a **split** MiniMax-H3 deployment, for both of its checkpoint partitions.
|
| 2 |
|
| 3 |
MiniMax-H3 is 195.9 GiB in bfloat16 and a ZeroGPU Space is evicted at 150 GB of storage, so `MiniMaxH3Blocks` is cut
|
| 4 |
+
at its `text_encoder` step: the 62.14 GiB Qwen3-VL runs in the conditioner Space, everything else in a generator
|
| 5 |
Space, and `prompt_embeds` + `text_token_tags` is the whole wire format between them.
|
| 6 |
|
| 7 |
`resize` / `setup` run on **both** sides: they own no pretrained component, and each half needs the canvas and the
|
|
|
|
| 84 |
return (
|
| 85 |
"The denoising half of a split MiniMax-H3 deployment: the `t2va` / `fl2va` branch of `MiniMaxH3Blocks` "
|
| 86 |
"without its text-encoder step, so `prompt_embeds` and `text_token_tags` come in as inputs and the "
|
| 87 |
+
"62.14 GiB Qwen3-VL conditioner is never loaded here."
|
| 88 |
)
|
| 89 |
|
| 90 |
@property
|
|
|
|
| 139 |
return (
|
| 140 |
"The denoising half of a split MiniMax-H3 `ref2va` deployment: the `ref2va` branch of `MiniMaxH3Blocks` "
|
| 141 |
"without its text-encoder step, so `prompt_embeds` and `text_token_tags` come in as inputs and the "
|
| 142 |
+
"62.14 GiB Qwen3-VL conditioner is never loaded here. The transformer is the `transformer_ref` partition."
|
| 143 |
)
|
| 144 |
|
| 145 |
@property
|