Use packaged Qwen tokenizer assets
This commit is contained in:
parent
f90801ea8a
commit
68606e1a30
2 changed files with 3 additions and 2 deletions
|
|
@ -155,9 +155,10 @@ class Qwen3VL32BTextEncoder(nn.Module):
|
||||||
|
|
||||||
class Qwen3VLPromptConditioner:
|
class Qwen3VLPromptConditioner:
|
||||||
"""Tokenize raw H3 prompt text and produce Qwen layer-50 conditioning."""
|
"""Tokenize raw H3 prompt text and produce Qwen layer-50 conditioning."""
|
||||||
def __init__(self, checkpoint_path: str | Path, tokenizer_dir: str | Path, *, device: str | torch.device = "cuda", dtype: torch.dtype = torch.bfloat16):
|
def __init__(self, checkpoint_path: str | Path, tokenizer_dir: str | Path | None = None, *, device: str | torch.device = "cuda", dtype: torch.dtype = torch.bfloat16):
|
||||||
from .conditioning import H3PromptTokenizer
|
from .conditioning import H3PromptTokenizer
|
||||||
|
|
||||||
|
tokenizer_dir = tokenizer_dir or Path(__file__).with_name("qwen25_tokenizer")
|
||||||
self.tokenizer = H3PromptTokenizer(tokenizer_dir)
|
self.tokenizer = H3PromptTokenizer(tokenizer_dir)
|
||||||
self.encoder = Qwen3VL32BTextEncoder(checkpoint_path, device=device, dtype=dtype)
|
self.encoder = Qwen3VL32BTextEncoder(checkpoint_path, device=device, dtype=dtype)
|
||||||
self.device = device
|
self.device = device
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ initial = torch.load(f"{root}/initial.pt", map_location="cuda", weights_only=Fal
|
||||||
steps = [torch.load(path, map_location="cuda", weights_only=False) for path in sorted(glob.glob(f"{root}/step_*.pt"))]
|
steps = [torch.load(path, map_location="cuda", weights_only=False) for path in sorted(glob.glob(f"{root}/step_*.pt"))]
|
||||||
sigmas = initial["sigmas"].to("cuda")
|
sigmas = initial["sigmas"].to("cuda")
|
||||||
checkpoint = H3Checkpoint("/models/minimax_h3_fl2va_pruned_nvfp4.safetensors")
|
checkpoint = H3Checkpoint("/models/minimax_h3_fl2va_pruned_nvfp4.safetensors")
|
||||||
text = H3TokenRefiner(checkpoint)(Qwen3VLPromptConditioner("/text-encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors", "/opt/h3-blackwell-runtime/qwen25_tokenizer")("A brass-and-paper dragon flies above a rain-washed old city at blue hour."))
|
text = H3TokenRefiner(checkpoint)(Qwen3VLPromptConditioner("/text-encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors")("A brass-and-paper dragon flies above a rain-washed old city at blue hour."))
|
||||||
model = H3PackedDenoiser.from_checkpoint(checkpoint, attention_backend="sage2").eval()
|
model = H3PackedDenoiser.from_checkpoint(checkpoint, attention_backend="sage2").eval()
|
||||||
packer = H3PromptPacker(checkpoint)
|
packer = H3PromptPacker(checkpoint)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue