From d6e83440c3a681532b3aba6694c2d2ed78120d58 Mon Sep 17 00:00:00 2001 From: Daniel Maddern Date: Thu, 13 Aug 2026 22:53:36 +0700 Subject: [PATCH] Add Qwen text repeatability check --- tools/compare_text_repeatability.py | 40 +++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tools/compare_text_repeatability.py diff --git a/tools/compare_text_repeatability.py b/tools/compare_text_repeatability.py new file mode 100644 index 0000000..7305a31 --- /dev/null +++ b/tools/compare_text_repeatability.py @@ -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}" + )