Add Qwen text repeatability check
This commit is contained in:
parent
2ef5d00270
commit
d6e83440c3
1 changed files with 40 additions and 0 deletions
40
tools/compare_text_repeatability.py
Normal file
40
tools/compare_text_repeatability.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
"""Check direct Qwen prompt-to-layer-50 repeatability across multiple prompts."""
|
||||
|
||||
import argparse
|
||||
|
||||
import torch
|
||||
|
||||
from h3_blackwell_runtime.qwen3vl_text import Qwen3VLPromptConditioner
|
||||
|
||||
|
||||
PROMPTS = [
|
||||
"A brass-and-paper dragon flies above a rain-washed old city at blue hour.",
|
||||
"A tiny clockwork fox curls up beside a glowing campfire in fresh snow.",
|
||||
"An old library aquarium floats through a thunderstorm, shelves full of blue fish.",
|
||||
"A painterly red balloon drifts over a quiet desert train station at sunrise.",
|
||||
"A ceramic astronaut waters moss on the moon while Earth rises behind them.",
|
||||
"A silver moth made of folded maps circles a lighthouse in green fog.",
|
||||
"A friendly robot chef flips pancakes in a kitchen made of clouds.",
|
||||
"A crystal whale swims through a canyon of stars and ringing glass bells.",
|
||||
"A paper boat sails down a neon alley after summer rain.",
|
||||
"A lantern-lit turtle carries a miniature village across a black lake.",
|
||||
]
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--qwen", default="/text-encoders/qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors")
|
||||
parser.add_argument("--tokenizer", default="/opt/h3-blackwell-runtime/src/h3_blackwell_runtime/qwen25_tokenizer")
|
||||
args = parser.parse_args()
|
||||
|
||||
conditioner = Qwen3VLPromptConditioner(args.qwen, args.tokenizer)
|
||||
|
||||
for index, prompt in enumerate(PROMPTS):
|
||||
with torch.inference_mode():
|
||||
qwen_a = conditioner(prompt)
|
||||
qwen_b = conditioner(prompt)
|
||||
qwen_delta = (qwen_a.float() - qwen_b.float()).abs()
|
||||
print(
|
||||
f"prompt={index:02d} "
|
||||
f"tokens={qwen_a.shape[1]} "
|
||||
f"qwen_max={qwen_delta.max().item():.6g} qwen_mean={qwen_delta.mean().item():.6g}"
|
||||
)
|
||||
Loading…
Add table
Reference in a new issue