Datasets:
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +3 -0
- model_cache_code_step8000/cache/RESTORE.txt +2 -0
- model_cache_code_step8000/checkpoints/checkpoint-8000/transformer/config.json +23 -0
- model_cache_code_step8000/logs/gpu_monitor.log +0 -0
- model_cache_code_step8000/logs/tracker/wandb/debug-internal.log +11 -0
- model_cache_code_step8000/logs/tracker/wandb/debug.log +19 -0
- model_cache_code_step8000/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/files/requirements.txt +116 -0
- model_cache_code_step8000/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug-core.log +6 -0
- model_cache_code_step8000/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug-internal.log +11 -0
- model_cache_code_step8000/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug.log +19 -0
- model_cache_code_step8000/logs/train.log +0 -0
- model_cache_code_step8000/metadata/FastVideo.git_status.txt +7 -0
- model_cache_code_step8000/metadata/FastVideo.uncommitted.diff +182 -0
- model_cache_code_step8000/metadata/FastVideo.untracked_files.txt +1 -0
- model_cache_code_step8000/metadata/TwoFrame.git_status.txt +197 -0
- model_cache_code_step8000/metadata/TwoFrame.uncommitted.diff +1627 -0
- model_cache_code_step8000/metadata/TwoFrame.untracked_files.txt +40 -0
- model_cache_code_step8000/metadata/asset_manifest.json +31 -0
- model_cache_code_step8000/metadata/base_model_symlinks.txt +9 -0
- model_cache_code_step8000/metadata/cache_summary.json +38 -0
- model_cache_code_step8000/metadata/package_du.txt +1 -0
- model_cache_code_step8000/metadata/package_filelist.tsv +44 -0
- model_cache_code_step8000/metadata/package_tree_depth3.txt +30 -0
- model_cache_code_step8000/metadata/train_args.json +38 -0
- model_cache_code_step8000/metadata/train_health.json +22 -0
- raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_8h200/resolution_records.csv +0 -0
- raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_8h200/resolution_report.md +66 -0
- raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_8h200/resolution_summary.json +2014 -0
- raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/bucket_spec_v2_proposal.json +187 -0
- raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/bucket_spec_v2_proposal.md +16 -0
- raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/resolution_records_canonical_axes.csv +0 -0
- raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/resolution_report_canonical_axes.md +60 -0
- raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/resolution_summary_canonical_axes.json +1548 -0
- raw_pants_train_test/metadata/pants-captions-ldm/canonical/canonical_facts.jsonl +3 -0
- raw_pants_train_test/metadata/pants-captions-ldm/captions/captions_final.jsonl +3 -0
- raw_pants_train_test/metadata/pants-captions-ldm/captions/captions_v2_after_fusion.jsonl +3 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/cache/__pycache__/pants_wan22_cache.cpython-311.pyc +0 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/cache/pants_wan22_cache.py +761 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/cache/pants_wan22_decode_check.py +145 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/cache/pants_wan22_text_cache.py +185 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/cache/run_pants_wan22_cache_8gpu.sh +42 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/cache/run_pants_wan22_finetune_fullrep_8gpu.sh +96 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/cache/run_pants_wan22_finetune_fullrep_8gpu_node.sh +99 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/cache/run_pants_wan22_finetune_smoke_8gpu.sh +65 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/cache/run_pants_wan22_text_cache_8gpu.sh +34 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/caption_generation/canonical_facts.py +376 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/caption_generation/f5_audit.py +333 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/caption_generation/f5b_v7.py +232 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/caption_generation/f5d_regen.py +177 -0
- raw_pants_train_test/metadata/pants-captions-ldm/code/caption_generation/f6_audit_final.py +152 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
raw_pants_train_test/metadata/pants-captions-ldm/canonical/canonical_facts.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 62 |
+
raw_pants_train_test/metadata/pants-captions-ldm/captions/captions_final.jsonl filter=lfs diff=lfs merge=lfs -text
|
| 63 |
+
raw_pants_train_test/metadata/pants-captions-ldm/captions/captions_v2_after_fusion.jsonl filter=lfs diff=lfs merge=lfs -text
|
model_cache_code_step8000/cache/RESTORE.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
cat cache/wan22_pants_v2_softwin.tar.zst.part-* > wan22_pants_v2_softwin.tar.zst
|
| 2 |
+
tar --use-compress-program zstd -xf wan22_pants_v2_softwin.tar.zst
|
model_cache_code_step8000/checkpoints/checkpoint-8000/transformer/config.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_class_name": "WanTransformer3DModel",
|
| 3 |
+
"added_kv_proj_dim": null,
|
| 4 |
+
"attention_head_dim": 128,
|
| 5 |
+
"cross_attn_norm": true,
|
| 6 |
+
"eps": 1e-06,
|
| 7 |
+
"ffn_dim": 14336,
|
| 8 |
+
"freq_dim": 256,
|
| 9 |
+
"image_dim": null,
|
| 10 |
+
"in_channels": 48,
|
| 11 |
+
"num_attention_heads": 24,
|
| 12 |
+
"num_layers": 30,
|
| 13 |
+
"out_channels": 48,
|
| 14 |
+
"patch_size": [
|
| 15 |
+
1,
|
| 16 |
+
2,
|
| 17 |
+
2
|
| 18 |
+
],
|
| 19 |
+
"pos_embed_seq_len": null,
|
| 20 |
+
"qk_norm": "rms_norm_across_heads",
|
| 21 |
+
"rope_max_seq_len": 1024,
|
| 22 |
+
"text_dim": 4096
|
| 23 |
+
}
|
model_cache_code_step8000/logs/gpu_monitor.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model_cache_code_step8000/logs/tracker/wandb/debug-internal.log
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"time":"2026-05-19T21:56:09.813911346-07:00","level":"INFO","msg":"wandb-core"}
|
| 2 |
+
{"time":"2026-05-19T21:56:09.813920152-07:00","level":"INFO","msg":"stream: starting","core version":"0.26.1"}
|
| 3 |
+
{"time":"2026-05-19T21:56:10.036673086-07:00","level":"WARN","msg":"featurechecker: GraphQL client is nil, skipping feature loading"}
|
| 4 |
+
{"time":"2026-05-19T21:56:10.036683051-07:00","level":"WARN","msg":"featurechecker: GraphQL client is nil, skipping feature loading"}
|
| 5 |
+
{"time":"2026-05-19T21:56:10.036698092-07:00","level":"INFO","msg":"stream: created new stream","id":"2dcsowl9"}
|
| 6 |
+
{"time":"2026-05-19T21:56:10.036728928-07:00","level":"INFO","msg":"handler: started"}
|
| 7 |
+
{"time":"2026-05-19T21:56:10.038848018-07:00","level":"INFO","msg":"stream: started"}
|
| 8 |
+
{"time":"2026-05-19T21:56:10.03886515-07:00","level":"INFO","msg":"writer: started","stream_id":"2dcsowl9"}
|
| 9 |
+
{"time":"2026-05-19T21:56:10.038881658-07:00","level":"INFO","msg":"sender: started"}
|
| 10 |
+
{"time":"2026-05-19T21:56:10.048249399-07:00","level":"WARN","msg":"featurechecker: GraphQL client is nil, skipping feature loading"}
|
| 11 |
+
{"time":"2026-05-19T21:56:10.04826791-07:00","level":"WARN","msg":"runupserter: server does not expand metric globs but the x_server_side_expand_glob_metrics setting is set; ignoring"}
|
model_cache_code_step8000/logs/tracker/wandb/debug.log
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_setup.py:_flush():81] Current SDK version is 0.26.1
|
| 2 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_setup.py:_flush():81] Configure stats pid to 107930
|
| 3 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_setup.py:_flush():81] Loading settings from environment variables
|
| 4 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_init.py:setup_run_log_directory():723] Logging user logs to /scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug.log
|
| 5 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_init.py:setup_run_log_directory():724] Logging internal logs to /scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug-internal.log
|
| 6 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_init.py:init():850] calling init triggers
|
| 7 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_init.py:init():855] wandb.init called with sweep_config: {}
|
| 8 |
+
config: {'model_path': '/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged', 'mode': <ExecutionMode.INFERENCE: 'inference'>, 'workload_type': <WorkloadType.T2V: 't2v'>, 'distributed_executor_backend': 'mp', 'ray_placement_group': None, 'ray_runtime_env': None, 'inference_mode': False, 'trust_remote_code': False, 'revision': None, 'num_gpus': 8, 'tp_size': 1, 'sp_size': 1, 'hsdp_replicate_dim': 8, 'hsdp_shard_dim': 1, 'dist_timeout': None, 'pipeline_config': {'model_path': '/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged', 'pipeline_config_path': None, 'embedded_cfg_scale': 6.0, 'flow_shift': 3.0, 'flow_shift_sr': None, 'disable_autocast': False, 'is_causal': False, 'dit_config': {'arch_config': {'stacked_params_mapping': [], '_fsdp_shard_conditions': ['is_blocks'], '_compile_conditions': ['is_blocks'], 'param_names_mapping': {'^patch_embedding\\.(.*)$': 'patch_embedding.proj.\\1', '^condition_embedder\\.text_embedder\\.linear_1\\.(.*)$': 'condition_embedder.text_embedder.fc_in.\\1', '^condition_embedder\\.text_embedder\\.linear_2\\.(.*)$': 'condition_embedder.text_embedder.fc_out.\\1', '^condition_embedder\\.time_embedder\\.linear_1\\.(.*)$': 'condition_embedder.time_embedder.mlp.fc_in.\\1', '^condition_embedder\\.time_embedder\\.linear_2\\.(.*)$': 'condition_embedder.time_embedder.mlp.fc_out.\\1', '^condition_embedder\\.time_proj\\.(.*)$': 'condition_embedder.time_modulation.linear.\\1', '^condition_embedder\\.image_embedder\\.ff\\.net\\.0\\.proj\\.(.*)$': 'condition_embedder.image_embedder.ff.fc_in.\\1', '^condition_embedder\\.image_embedder\\.ff\\.net\\.2\\.(.*)$': 'condition_embedder.image_embedder.ff.fc_out.\\1', '^blocks\\.(\\d+)\\.attn1\\.to_q\\.(.*)$': 'blocks.\\1.to_q.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_k\\.(.*)$': 'blocks.\\1.to_k.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_v\\.(.*)$': 'blocks.\\1.to_v.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_out\\.0\\.(.*)$': 'blocks.\\1.to_out.\\2', '^blocks\\.(\\d+)\\.attn1\\.norm_q\\.(.*)$': 'blocks.\\1.norm_q.\\2', '^blocks\\.(\\d+)\\.attn1\\.norm_k\\.(.*)$': 'blocks.\\1.norm_k.\\2', '^blocks\\.(\\d+)\\.attn2\\.to_out\\.0\\.(.*)$': 'blocks.\\1.attn2.to_out.\\2', '^blocks\\.(\\d+)\\.ffn\\.net\\.0\\.proj\\.(.*)$': 'blocks.\\1.ffn.fc_in.\\2', '^blocks\\.(\\d+)\\.ffn\\.net\\.2\\.(.*)$': 'blocks.\\1.ffn.fc_out.\\2', '^blocks\\.(\\d+)\\.norm2\\.(.*)$': 'blocks.\\1.self_attn_residual_norm.norm.\\2'}, 'reverse_param_names_mapping': {}, 'lora_param_names_mapping': {'^blocks\\.(\\d+)\\.self_attn\\.q\\.(.*)$': 'blocks.\\1.attn1.to_q.\\2', '^blocks\\.(\\d+)\\.self_attn\\.k\\.(.*)$': 'blocks.\\1.attn1.to_k.\\2', '^blocks\\.(\\d+)\\.self_attn\\.v\\.(.*)$': 'blocks.\\1.attn1.to_v.\\2', '^blocks\\.(\\d+)\\.self_attn\\.o\\.(.*)$': 'blocks.\\1.attn1.to_out.0.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.q\\.(.*)$': 'blocks.\\1.attn2.to_q.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.k\\.(.*)$': 'blocks.\\1.attn2.to_k.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.v\\.(.*)$': 'blocks.\\1.attn2.to_v.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.o\\.(.*)$': 'blocks.\\1.attn2.to_out.0.\\2', '^blocks\\.(\\d+)\\.ffn\\.0\\.(.*)$': 'blocks.\\1.ffn.fc_in.\\2', '^blocks\\.(\\d+)\\.ffn\\.2\\.(.*)$': 'blocks.\\1.ffn.fc_out.\\2'}, '_supported_attention_backends': [3, 1, 2, 5, 7, 4, 8, 9], 'hidden_size': 5120, 'num_attention_heads': 40, 'num_channels_latents': 16, 'in_channels': 16, 'out_channels': 16, 'exclude_lora_layers': ['embedder'], 'boundary_ratio': None, 'patch_size': [1, 2, 2], 'attention_head_dim': 128, 'text_dim': 4096, 'freq_dim': 256, 'ffn_dim': 13824, 'num_layers': 40, 'cross_attn_norm': True, 'qk_norm': 'rms_norm_across_heads', 'eps': 1e-06, 'image_dim': None, 'added_kv_proj_dim': None, 'rope_max_seq_len': 1024, 'pos_embed_seq_len': None, 'local_attn_size': -1, 'sink_size': 0, 'num_frames_per_block': 3, 'sliding_window_num_frames': 21}, 'prefix': 'Wan', 'quant_config': None}, 'dit_precision': 'fp32', 'upsampler_config': {'arch_config': {'stacked_params_mapping': []}}, 'upsampler_precision': 'fp32', 'vae_config': {'arch_config': {'stacked_params_mapping': [], 'scaling_factor': [[[[[2.0986359119415283]]], [[[0.9648784399032593]]], [[[2.215330123901367]]], [[[0.85638427734375]]], [[[1.8821758031845093]]], [[[2.0040080547332764]]], [[[2.075550079345703]]], [[[1.9948135614395142]]], [[[1.2257906198501587]]], [[[0.9667440056800842]]], [[[1.6966407299041748]]], [[[0.9173470139503479]]], [[[1.4524328708648682]]], [[[1.622059941291809]]], [[[1.1828720569610596]]], [[[2.0088388919830322]]], [[[1.736412525177002]]], [[[2.8384900093078613]]], [[[1.4015417098999023]]], [[[1.4697237014770508]]], [[[1.7143837213516235]]], [[[0.7069135904312134]]], [[[1.1128422021865845]]], [[[1.7670965194702148]]], [[[1.414627194404602]]], [[[1.8733607530593872]]], [[[2.045408010482788]]], [[[2.0337605476379395]]], [[[2.457606315612793]]], [[[2.0004000663757324]]], [[[1.4564520120620728]]], [[[2.4431958198547363]]], [[[1.7516201734542847]]], [[[1.6488045454025269]]], [[[1.5588464736938477]]], [[[2.022653818130493]]], [[[1.7464197874069214]]], [[[0.830426812171936]]], [[[1.8321731090545654]]], [[[0.5921714901924133]]], [[[2.5182573795318604]]], [[[0.943396270275116]]], [[[2.536139965057373]]], [[[1.8060322999954224]]], [[[1.8368847370147705]]], [[[2.4455857276916504]]], [[[1.339046597480774]]], [[[1.2913223505020142]]]]], 'temporal_compression_ratio': 4, 'spatial_compression_ratio': 16, 'base_dim': 160, 'decoder_base_dim': 256, 'z_dim': 48, 'dim_mult': [1, 2, 4, 4], 'num_res_blocks': 2, 'attn_scales': [], 'temperal_downsample': [False, True, True], 'dropout': 0.0, 'latents_mean': [-0.2289, -0.0052, -0.1323, -0.2339, -0.2799, 0.0174, 0.1838, 0.1557, -0.1382, 0.0542, 0.2813, 0.0891, 0.157, -0.0098, 0.0375, -0.1825, -0.2246, -0.1207, -0.0698, 0.5109, 0.2665, -0.2108, -0.2158, 0.2502, -0.2055, -0.0322, 0.1109, 0.1567, -0.0729, 0.0899, -0.2799, -0.123, -0.0313, -0.1649, 0.0117, 0.0723, -0.2839, -0.2083, -0.052, 0.3748, 0.0152, 0.1957, 0.1433, -0.2944, 0.3573, -0.0548, -0.1681, -0.0667], 'latents_std': [0.4765, 1.0364, 0.4514, 1.1677, 0.5313, 0.499, 0.4818, 0.5013, 0.8158, 1.0344, 0.5894, 1.0901, 0.6885, 0.6165, 0.8454, 0.4978, 0.5759, 0.3523, 0.7135, 0.6804, 0.5833, 1.4146, 0.8986, 0.5659, 0.7069, 0.5338, 0.4889, 0.4917, 0.4069, 0.4999, 0.6866, 0.4093, 0.5709, 0.6065, 0.6415, 0.4944, 0.5726, 1.2042, 0.5458, 1.6887, 0.3971, 1.06, 0.3943, 0.5537, 0.5444, 0.4089, 0.7468, 0.7744], 'is_residual': True, 'in_channels': 12, 'out_channels': 12, 'patch_size': 2, 'scale_factor_temporal': 4, 'scale_factor_spatial': 16, 'clip_output': False}, 'load_encoder': False, 'load_decoder': True, 'tile_sample_min_height': 256, 'tile_sample_min_width': 256, 'tile_sample_min_num_frames': 16, 'tile_sample_stride_height': 192, 'tile_sample_stride_width': 192, 'tile_sample_stride_num_frames': 12, 'blend_num_frames': 8, 'use_tiling': False, 'use_temporal_tiling': False, 'use_parallel_tiling': False, 'use_temporal_scaling_frames': True, 'use_feature_cache': True}, 'vae_precision': 'fp32', 'vae_tiling': False, 'vae_sp': False, 'image_encoder_config': {'arch_config': {'stacked_params_mapping': [], 'architectures': [], '_supported_attention_backends': [1, 2], 'output_hidden_states': False, 'use_return_dict': True}, 'prefix': '', 'quant_config': None, 'lora_config': None}, 'image_encoder_precision': 'fp32', 'text_encoder_configs': [{'arch_config': {'stacked_params_mapping': [['.qkv_proj', '.q', 'q'], ['.qkv_proj', '.k', 'k'], ['.qkv_proj', '.v', 'v']], 'architectures': [], '_supported_attention_backends': [1, 2], 'output_hidden_states': False, 'use_return_dict': True, 'vocab_size': 32128, 'hidden_size': 512, 'num_hidden_layers': 0, 'num_attention_heads': 0, 'pad_token_id': 0, 'eos_token_id': 1, 'text_len': 512, 'hidden_state_skip_layer': 0, 'decoder_start_token_id': 0, 'output_past': True, 'scalable_attention': True, 'tie_word_embeddings': False, 'tokenizer_kwargs': {'truncation': True, 'max_length': 512, 'add_special_tokens': True, 'return_attention_mask': True, 'return_tensors': 'pt'}, '_fsdp_shard_conditions': ['_is_transformer_layer', '_is_embeddings', '_is_final_layernorm'], 'd_model': 512, 'd_kv': 64, 'd_ff': 2048, 'num_layers': 6, 'num_decoder_layers': None, 'num_heads': 8, 'relative_attention_num_buckets': 32, 'relative_attention_max_distance': 128, 'dropout_rate': 0.1, 'layer_norm_epsilon': 1e-06, 'initializer_factor': 1.0, 'feed_forward_proj': 'relu', 'dense_act_fn': 'relu', 'is_gated_act': False, 'is_encoder_decoder': True, 'use_cache': True, 'classifier_dropout': 0.0, 'dtype': None, 'gradient_checkpointing': False, 'n_positions': 512, 'task_specific_params': None}, 'prefix': 't5', 'quant_config': None, 'lora_config': None, 'is_chat_model': False, 'treat_empty_as_dot': False}], 'text_encoder_precisions': ['fp32'], 'preprocess_text_funcs': ['preprocess_text'], 'postprocess_text_funcs': ['t5_postprocess_text'], 'dmd_denoising_steps': None, 'ti2v_task': False, 'boundary_ratio': None, 'precision': 'bf16', 'warp_denoising_step': True}, 'preprocess_config': None, 'lora_path': None, 'lora_nickname': 'default', 'lora_target_modules': None, 'output_type': 'pil', 'dit_cpu_offload': False, 'use_fsdp_inference': False, 'dit_layerwise_offload': False, 'text_encoder_cpu_offload': False, 'image_encoder_cpu_offload': False, 'vae_cpu_offload': False, 'pin_cpu_memory': False, 'enable_torch_compile': False, 'enable_torch_compile_text_encoder': False, 'enable_torch_compile_vae': False, 'enable_torch_compile_audio_vae': False, 'torch_compile_kwargs': None, 'torch_compile_kwargs_dit': {}, 'torch_compile_kwargs_text_encoder': {}, 'torch_compile_kwargs_vae': {}, 'torch_compile_kwargs_audio_vae': {}, 'disable_autocast': False, 'VSA_sparsity': 0.0, 'moba_config_path': None, 'moba_config': {}, 'master_port': None, 'enable_stage_verification': True, 'prompt_txt': None, 'ltx2_vae_tiling': None, 'ltx2_vae_spatial_tile_size_in_pixels': None, 'ltx2_vae_spatial_tile_overlap_in_pixels': None, 'ltx2_vae_temporal_tile_size_in_frames': None, 'ltx2_vae_temporal_tile_overlap_in_frames': None, 'ltx2_initial_latent_path': None, 'ltx2_audio_latent_path': None, 'refine_enabled': None, 'refine_upsampler_path': None, 'refine_transformer_path': None, 'refine_lora_path': None, 'refine_num_inference_steps': None, 'refine_guidance_scale': None, 'refine_add_noise': None, 'refine_noise_path': None, 'refine_audio_noise_path': None, 'ltx2_refine_enabled': False, 'ltx2_refine_upsampler_path': None, 'ltx2_refine_transformer_path': None, 'ltx2_refine_lora_path': None, 'ltx2_refine_num_inference_steps': 3, 'ltx2_refine_guidance_scale': 1.0, 'ltx2_refine_add_noise': True, 'ltx2_refine_noise_path': None, 'ltx2_refine_audio_noise_path': None, 'ltx2_legacy_native_noise_order': False, 'ltx2_use_distilled_sigmas': True, 'model_paths': {'transformer': '/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged/transformer', 'vae': '/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged/vae'}, 'model_loaded': {'transformer': True, 'vae': True, 'upsampler': True}, 'override_text_encoder_safetensors': None, 'override_text_encoder_quant': None, 'transformer_quant': None, 'override_transformer_cls_name': None, 'init_weights_from_safetensors': None, 'init_weights_from_safetensors_2': None, 'override_pipeline_cls_name': None, 'boundary_ratio': 0.875, 'data_path': '/scratch/user/yuhwang/dataset/pants-captions-ldm/cache/wan22_pants_v2_softwin', 'dataloader_num_workers': 2, 'num_height': 320, 'num_width': 288, 'num_frames': 153, 'train_batch_size': 16, 'num_latent_t': 39, 'group_frame': False, 'group_resolution': False, 'pretrained_model_name_or_path': '/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged', 'real_score_model_path': None, 'fake_score_model_path': None, 'ema_decay': 0.999, 'ema_start_step': 1, 'training_cfg_rate': 0.05, 'precondition_outputs': False, 'validation_dataset_file': None, 'validation_preprocessed_path': None, 'validation_sampling_steps': None, 'validation_guidance_scale': None, 'validation_steps': None, 'log_validation': False, 'trackers': [], 'tracker_project_name': 'pants_wan22_fullrep', 'wandb_run_name': 'pants_b16_9k_20260519_215532', 'seed': 42, 'output_dir': '/scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532', 'checkpoints_total_limit': 2, 'resume_from_checkpoint': None, 'num_train_epochs': None, 'max_train_steps': 9000, 'gradient_accumulation_steps': 1, 'learning_rate': 1e-06, 'scale_lr': False, 'lr_scheduler': 'constant', 'lr_warmup_steps': 0, 'max_grad_norm': 1.0, 'enable_gradient_checkpointing_type': 'full', 'selective_checkpointing': None, 'mixed_precision': 'bf16', 'train_sp_batch_size': 1, 'fsdp_sharding_startegy': '', 'weighting_scheme': 'uniform', 'logit_mean': 0.0, 'logit_std': 1.0, 'mode_scale': 1.29, 'num_euler_timesteps': 50, 'lr_num_cycles': None, 'lr_power': None, 'min_lr_ratio': 0.5, 'not_apply_cfg_solver': False, 'distill_cfg': None, 'scheduler_type': None, 'linear_quadratic_threshold': None, 'linear_range': None, 'weight_decay': 0.01, 'betas': '0.9,0.999', 'use_ema': True, 'multi_phased_distill_schedule': None, 'pred_decay_weight': None, 'pred_decay_type': None, 'hunyuan_teacher_disable_cfg': False, 'master_weight_type': None, 'VSA_decay_rate': 0.01, 'VSA_decay_interval_steps': 1, 'lora_rank': None, 'lora_alpha': None, 'lora_training': False, 'ltx2_first_frame_conditioning_p': 0.1, 'generator_update_interval': 5, 'dfake_gen_update_ratio': 5, 'min_timestep_ratio': 0.2, 'max_timestep_ratio': 0.98, 'real_score_guidance_scale': 3.5, 'fake_score_learning_rate': 0.0, 'fake_score_lr_scheduler': 'constant', 'fake_score_betas': '0.9,0.999', 'training_state_checkpointing_steps': 4000, 'weight_only_checkpointing_steps': None, 'log_visualization': False, 'visualization_steps': None, 'simulate_generator_forward': False, 'warp_denoising_step': False, 'num_frame_per_block': 3, 'independent_first_frame': False, 'enable_gradient_masking': False, 'gradient_mask_last_n_frames': 21, 'same_step_across_blocks': False, 'last_step_only': False, 'context_noise': 0, '_wandb': {}}
|
| 9 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_init.py:init():898] starting backend
|
| 10 |
+
2026-05-19 21:56:09,805 INFO MainThread:107930 [wandb_init.py:init():913] sending inform_init request
|
| 11 |
+
2026-05-19 21:56:10,039 INFO MainThread:107930 [wandb_init.py:init():918] backend started and connected
|
| 12 |
+
2026-05-19 21:56:10,041 INFO MainThread:107930 [wandb_init.py:init():988] updated telemetry
|
| 13 |
+
2026-05-19 21:56:10,044 INFO MainThread:107930 [wandb_init.py:init():1011] communicating run to backend with 90.0 second timeout
|
| 14 |
+
2026-05-19 21:56:10,051 INFO MainThread:107930 [wandb_init.py:init():1056] starting run threads in backend
|
| 15 |
+
2026-05-19 21:56:10,141 INFO MainThread:107930 [wandb_run.py:_console_start():2554] atexit reg
|
| 16 |
+
2026-05-19 21:56:10,141 INFO MainThread:107930 [wandb_run.py:_redirect():2403] redirect: wrap_raw
|
| 17 |
+
2026-05-19 21:56:10,141 INFO MainThread:107930 [wandb_run.py:_redirect():2472] Wrapping output streams.
|
| 18 |
+
2026-05-19 21:56:10,141 INFO MainThread:107930 [wandb_run.py:_redirect():2495] Redirects installed.
|
| 19 |
+
2026-05-19 21:56:10,144 INFO MainThread:107930 [wandb_init.py:init():1094] run started, returning control to user process
|
model_cache_code_step8000/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/files/requirements.txt
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
accelerate==1.13.0
|
| 2 |
+
aiohappyeyeballs==2.6.1
|
| 3 |
+
aiohttp==3.13.5
|
| 4 |
+
aiosignal==1.4.0
|
| 5 |
+
annotated-doc==0.0.4
|
| 6 |
+
annotated-types==0.7.0
|
| 7 |
+
anyio==4.13.0
|
| 8 |
+
attrs==26.1.0
|
| 9 |
+
certifi==2026.4.22
|
| 10 |
+
charset-normalizer==3.4.7
|
| 11 |
+
click==8.3.3
|
| 12 |
+
clip==1.0
|
| 13 |
+
cloudpickle==3.1.2
|
| 14 |
+
cuda-bindings==12.9.4
|
| 15 |
+
cuda-pathfinder==1.2.2
|
| 16 |
+
cuda-toolkit==12.6.3
|
| 17 |
+
datasets==4.8.5
|
| 18 |
+
deepspeed==0.18.9
|
| 19 |
+
diffusers==0.37.1
|
| 20 |
+
dill==0.4.1
|
| 21 |
+
einops==0.8.2
|
| 22 |
+
filelock==3.25.2
|
| 23 |
+
frozenlist==1.8.0
|
| 24 |
+
fsspec==2026.2.0
|
| 25 |
+
ftfy==6.3.1
|
| 26 |
+
gitdb==4.0.12
|
| 27 |
+
GitPython==3.1.49
|
| 28 |
+
h11==0.16.0
|
| 29 |
+
hf-xet==1.4.3
|
| 30 |
+
hjson==3.1.0
|
| 31 |
+
httpcore==1.0.9
|
| 32 |
+
httpx==0.28.1
|
| 33 |
+
huggingface_hub==1.12.2
|
| 34 |
+
idna==3.13
|
| 35 |
+
ImageIO==2.37.3
|
| 36 |
+
importlib_metadata==9.0.0
|
| 37 |
+
importlib_resources==7.1.0
|
| 38 |
+
Jinja2==3.1.6
|
| 39 |
+
lazy-loader==0.5
|
| 40 |
+
markdown-it-py==4.0.0
|
| 41 |
+
MarkupSafe==3.0.3
|
| 42 |
+
mdurl==0.1.2
|
| 43 |
+
mpmath==1.3.0
|
| 44 |
+
msgpack==1.1.2
|
| 45 |
+
multidict==6.7.1
|
| 46 |
+
multiprocess==0.70.19
|
| 47 |
+
networkx==3.6.1
|
| 48 |
+
nibabel==5.4.2
|
| 49 |
+
ninja==1.13.0
|
| 50 |
+
numpy==2.4.4
|
| 51 |
+
nvidia-cublas-cu12==12.6.4.1
|
| 52 |
+
nvidia-cuda-cupti-cu12==12.6.80
|
| 53 |
+
nvidia-cuda-nvrtc-cu12==12.6.85
|
| 54 |
+
nvidia-cuda-runtime-cu12==12.6.77
|
| 55 |
+
nvidia-cudnn-cu12==9.10.2.21
|
| 56 |
+
nvidia-cufft-cu12==11.3.0.4
|
| 57 |
+
nvidia-cufile-cu12==1.11.1.6
|
| 58 |
+
nvidia-curand-cu12==10.3.7.77
|
| 59 |
+
nvidia-cusolver-cu12==11.7.1.2
|
| 60 |
+
nvidia-cusparse-cu12==12.5.4.2
|
| 61 |
+
nvidia-cusparselt-cu12==0.7.1
|
| 62 |
+
nvidia-nccl-cu12==2.28.9
|
| 63 |
+
nvidia-nvjitlink-cu12==12.6.85
|
| 64 |
+
nvidia-nvshmem-cu12==3.4.5
|
| 65 |
+
nvidia-nvtx-cu12==12.6.77
|
| 66 |
+
packaging==26.2
|
| 67 |
+
pandas==3.0.3
|
| 68 |
+
peft==0.19.1
|
| 69 |
+
pillow==12.2.0
|
| 70 |
+
pip==26.1
|
| 71 |
+
platformdirs==4.9.6
|
| 72 |
+
prodigy-plus-schedule-free==2.0.1
|
| 73 |
+
prodigyopt==1.1.2
|
| 74 |
+
propcache==0.5.2
|
| 75 |
+
protobuf==7.34.1
|
| 76 |
+
psutil==7.2.2
|
| 77 |
+
py-cpuinfo==9.0.0
|
| 78 |
+
pyarrow==24.0.0
|
| 79 |
+
pydantic==2.13.3
|
| 80 |
+
pydantic_core==2.46.3
|
| 81 |
+
Pygments==2.20.0
|
| 82 |
+
python-dateutil==2.9.0.post0
|
| 83 |
+
PyYAML==6.0.3
|
| 84 |
+
regex==2026.4.4
|
| 85 |
+
remote-pdb==2.1.0
|
| 86 |
+
requests==2.33.1
|
| 87 |
+
rich==15.0.0
|
| 88 |
+
safetensors==0.7.0
|
| 89 |
+
scikit-image==0.26.0
|
| 90 |
+
scipy==1.17.1
|
| 91 |
+
sentencepiece==0.2.1
|
| 92 |
+
sentry-sdk==2.58.0
|
| 93 |
+
setuptools==70.2.0
|
| 94 |
+
shellingham==1.5.4
|
| 95 |
+
six==1.17.0
|
| 96 |
+
smmap==5.0.3
|
| 97 |
+
sympy==1.14.0
|
| 98 |
+
tifffile==2026.3.3
|
| 99 |
+
tokenizers==0.22.2
|
| 100 |
+
torch==2.11.0+cu126
|
| 101 |
+
torchaudio==2.11.0+cu126
|
| 102 |
+
torchdata==0.11.0
|
| 103 |
+
torchvision==0.26.0+cu126
|
| 104 |
+
tqdm==4.67.3
|
| 105 |
+
transformers==5.7.0
|
| 106 |
+
triton==3.6.0
|
| 107 |
+
typer==0.25.0
|
| 108 |
+
typing_extensions==4.15.0
|
| 109 |
+
typing-inspection==0.4.2
|
| 110 |
+
urllib3==2.6.3
|
| 111 |
+
wandb==0.26.1
|
| 112 |
+
wcwidth==0.7.0
|
| 113 |
+
wheel==0.47.0
|
| 114 |
+
xxhash==3.7.0
|
| 115 |
+
yarl==1.24.2
|
| 116 |
+
zipp==3.23.1
|
model_cache_code_step8000/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug-core.log
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"time":"2026-05-19T21:56:09.621954004-07:00","level":"INFO","msg":"main: starting server","port-filename":"/scratch/user/yuhwang/artifacts/twoframe/tmp/tmpcfxztyxi/port-107930.txt","pid":107930,"detached":false,"idle-timeout":600000000000,"log-level":0,"disable-analytics":false,"shutdown-on-parent-exit":false,"enable-dcgm-profiling":false}
|
| 2 |
+
{"time":"2026-05-19T21:56:09.628989105-07:00","level":"INFO","msg":"server: will exit if parent process dies","ppid":107930}
|
| 3 |
+
{"time":"2026-05-19T21:56:09.628971091-07:00","level":"INFO","msg":"server: accepting connections","addr":{"Name":"/scratch/user/yuhwang/artifacts/twoframe/tmp/wandb-107930-108495-2861732827/socket","Net":"unix"}}
|
| 4 |
+
{"time":"2026-05-19T21:56:09.804909188-07:00","level":"INFO","msg":"connection: ManageConnectionData: new connection created","id":"1(@)"}
|
| 5 |
+
{"time":"2026-05-19T21:56:09.812088416-07:00","level":"INFO","msg":"handleInformInit: received","streamId":"2dcsowl9","id":"1(@)"}
|
| 6 |
+
{"time":"2026-05-19T21:56:10.038853675-07:00","level":"INFO","msg":"handleInformInit: stream started","streamId":"2dcsowl9","id":"1(@)"}
|
model_cache_code_step8000/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug-internal.log
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{"time":"2026-05-19T21:56:09.813911346-07:00","level":"INFO","msg":"wandb-core"}
|
| 2 |
+
{"time":"2026-05-19T21:56:09.813920152-07:00","level":"INFO","msg":"stream: starting","core version":"0.26.1"}
|
| 3 |
+
{"time":"2026-05-19T21:56:10.036673086-07:00","level":"WARN","msg":"featurechecker: GraphQL client is nil, skipping feature loading"}
|
| 4 |
+
{"time":"2026-05-19T21:56:10.036683051-07:00","level":"WARN","msg":"featurechecker: GraphQL client is nil, skipping feature loading"}
|
| 5 |
+
{"time":"2026-05-19T21:56:10.036698092-07:00","level":"INFO","msg":"stream: created new stream","id":"2dcsowl9"}
|
| 6 |
+
{"time":"2026-05-19T21:56:10.036728928-07:00","level":"INFO","msg":"handler: started"}
|
| 7 |
+
{"time":"2026-05-19T21:56:10.038848018-07:00","level":"INFO","msg":"stream: started"}
|
| 8 |
+
{"time":"2026-05-19T21:56:10.03886515-07:00","level":"INFO","msg":"writer: started","stream_id":"2dcsowl9"}
|
| 9 |
+
{"time":"2026-05-19T21:56:10.038881658-07:00","level":"INFO","msg":"sender: started"}
|
| 10 |
+
{"time":"2026-05-19T21:56:10.048249399-07:00","level":"WARN","msg":"featurechecker: GraphQL client is nil, skipping feature loading"}
|
| 11 |
+
{"time":"2026-05-19T21:56:10.04826791-07:00","level":"WARN","msg":"runupserter: server does not expand metric globs but the x_server_side_expand_glob_metrics setting is set; ignoring"}
|
model_cache_code_step8000/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug.log
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_setup.py:_flush():81] Current SDK version is 0.26.1
|
| 2 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_setup.py:_flush():81] Configure stats pid to 107930
|
| 3 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_setup.py:_flush():81] Loading settings from environment variables
|
| 4 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_init.py:setup_run_log_directory():723] Logging user logs to /scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug.log
|
| 5 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_init.py:setup_run_log_directory():724] Logging internal logs to /scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug-internal.log
|
| 6 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_init.py:init():850] calling init triggers
|
| 7 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_init.py:init():855] wandb.init called with sweep_config: {}
|
| 8 |
+
config: {'model_path': '/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged', 'mode': <ExecutionMode.INFERENCE: 'inference'>, 'workload_type': <WorkloadType.T2V: 't2v'>, 'distributed_executor_backend': 'mp', 'ray_placement_group': None, 'ray_runtime_env': None, 'inference_mode': False, 'trust_remote_code': False, 'revision': None, 'num_gpus': 8, 'tp_size': 1, 'sp_size': 1, 'hsdp_replicate_dim': 8, 'hsdp_shard_dim': 1, 'dist_timeout': None, 'pipeline_config': {'model_path': '/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged', 'pipeline_config_path': None, 'embedded_cfg_scale': 6.0, 'flow_shift': 3.0, 'flow_shift_sr': None, 'disable_autocast': False, 'is_causal': False, 'dit_config': {'arch_config': {'stacked_params_mapping': [], '_fsdp_shard_conditions': ['is_blocks'], '_compile_conditions': ['is_blocks'], 'param_names_mapping': {'^patch_embedding\\.(.*)$': 'patch_embedding.proj.\\1', '^condition_embedder\\.text_embedder\\.linear_1\\.(.*)$': 'condition_embedder.text_embedder.fc_in.\\1', '^condition_embedder\\.text_embedder\\.linear_2\\.(.*)$': 'condition_embedder.text_embedder.fc_out.\\1', '^condition_embedder\\.time_embedder\\.linear_1\\.(.*)$': 'condition_embedder.time_embedder.mlp.fc_in.\\1', '^condition_embedder\\.time_embedder\\.linear_2\\.(.*)$': 'condition_embedder.time_embedder.mlp.fc_out.\\1', '^condition_embedder\\.time_proj\\.(.*)$': 'condition_embedder.time_modulation.linear.\\1', '^condition_embedder\\.image_embedder\\.ff\\.net\\.0\\.proj\\.(.*)$': 'condition_embedder.image_embedder.ff.fc_in.\\1', '^condition_embedder\\.image_embedder\\.ff\\.net\\.2\\.(.*)$': 'condition_embedder.image_embedder.ff.fc_out.\\1', '^blocks\\.(\\d+)\\.attn1\\.to_q\\.(.*)$': 'blocks.\\1.to_q.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_k\\.(.*)$': 'blocks.\\1.to_k.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_v\\.(.*)$': 'blocks.\\1.to_v.\\2', '^blocks\\.(\\d+)\\.attn1\\.to_out\\.0\\.(.*)$': 'blocks.\\1.to_out.\\2', '^blocks\\.(\\d+)\\.attn1\\.norm_q\\.(.*)$': 'blocks.\\1.norm_q.\\2', '^blocks\\.(\\d+)\\.attn1\\.norm_k\\.(.*)$': 'blocks.\\1.norm_k.\\2', '^blocks\\.(\\d+)\\.attn2\\.to_out\\.0\\.(.*)$': 'blocks.\\1.attn2.to_out.\\2', '^blocks\\.(\\d+)\\.ffn\\.net\\.0\\.proj\\.(.*)$': 'blocks.\\1.ffn.fc_in.\\2', '^blocks\\.(\\d+)\\.ffn\\.net\\.2\\.(.*)$': 'blocks.\\1.ffn.fc_out.\\2', '^blocks\\.(\\d+)\\.norm2\\.(.*)$': 'blocks.\\1.self_attn_residual_norm.norm.\\2'}, 'reverse_param_names_mapping': {}, 'lora_param_names_mapping': {'^blocks\\.(\\d+)\\.self_attn\\.q\\.(.*)$': 'blocks.\\1.attn1.to_q.\\2', '^blocks\\.(\\d+)\\.self_attn\\.k\\.(.*)$': 'blocks.\\1.attn1.to_k.\\2', '^blocks\\.(\\d+)\\.self_attn\\.v\\.(.*)$': 'blocks.\\1.attn1.to_v.\\2', '^blocks\\.(\\d+)\\.self_attn\\.o\\.(.*)$': 'blocks.\\1.attn1.to_out.0.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.q\\.(.*)$': 'blocks.\\1.attn2.to_q.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.k\\.(.*)$': 'blocks.\\1.attn2.to_k.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.v\\.(.*)$': 'blocks.\\1.attn2.to_v.\\2', '^blocks\\.(\\d+)\\.cross_attn\\.o\\.(.*)$': 'blocks.\\1.attn2.to_out.0.\\2', '^blocks\\.(\\d+)\\.ffn\\.0\\.(.*)$': 'blocks.\\1.ffn.fc_in.\\2', '^blocks\\.(\\d+)\\.ffn\\.2\\.(.*)$': 'blocks.\\1.ffn.fc_out.\\2'}, '_supported_attention_backends': [3, 1, 2, 5, 7, 4, 8, 9], 'hidden_size': 5120, 'num_attention_heads': 40, 'num_channels_latents': 16, 'in_channels': 16, 'out_channels': 16, 'exclude_lora_layers': ['embedder'], 'boundary_ratio': None, 'patch_size': [1, 2, 2], 'attention_head_dim': 128, 'text_dim': 4096, 'freq_dim': 256, 'ffn_dim': 13824, 'num_layers': 40, 'cross_attn_norm': True, 'qk_norm': 'rms_norm_across_heads', 'eps': 1e-06, 'image_dim': None, 'added_kv_proj_dim': None, 'rope_max_seq_len': 1024, 'pos_embed_seq_len': None, 'local_attn_size': -1, 'sink_size': 0, 'num_frames_per_block': 3, 'sliding_window_num_frames': 21}, 'prefix': 'Wan', 'quant_config': None}, 'dit_precision': 'fp32', 'upsampler_config': {'arch_config': {'stacked_params_mapping': []}}, 'upsampler_precision': 'fp32', 'vae_config': {'arch_config': {'stacked_params_mapping': [], 'scaling_factor': [[[[[2.0986359119415283]]], [[[0.9648784399032593]]], [[[2.215330123901367]]], [[[0.85638427734375]]], [[[1.8821758031845093]]], [[[2.0040080547332764]]], [[[2.075550079345703]]], [[[1.9948135614395142]]], [[[1.2257906198501587]]], [[[0.9667440056800842]]], [[[1.6966407299041748]]], [[[0.9173470139503479]]], [[[1.4524328708648682]]], [[[1.622059941291809]]], [[[1.1828720569610596]]], [[[2.0088388919830322]]], [[[1.736412525177002]]], [[[2.8384900093078613]]], [[[1.4015417098999023]]], [[[1.4697237014770508]]], [[[1.7143837213516235]]], [[[0.7069135904312134]]], [[[1.1128422021865845]]], [[[1.7670965194702148]]], [[[1.414627194404602]]], [[[1.8733607530593872]]], [[[2.045408010482788]]], [[[2.0337605476379395]]], [[[2.457606315612793]]], [[[2.0004000663757324]]], [[[1.4564520120620728]]], [[[2.4431958198547363]]], [[[1.7516201734542847]]], [[[1.6488045454025269]]], [[[1.5588464736938477]]], [[[2.022653818130493]]], [[[1.7464197874069214]]], [[[0.830426812171936]]], [[[1.8321731090545654]]], [[[0.5921714901924133]]], [[[2.5182573795318604]]], [[[0.943396270275116]]], [[[2.536139965057373]]], [[[1.8060322999954224]]], [[[1.8368847370147705]]], [[[2.4455857276916504]]], [[[1.339046597480774]]], [[[1.2913223505020142]]]]], 'temporal_compression_ratio': 4, 'spatial_compression_ratio': 16, 'base_dim': 160, 'decoder_base_dim': 256, 'z_dim': 48, 'dim_mult': [1, 2, 4, 4], 'num_res_blocks': 2, 'attn_scales': [], 'temperal_downsample': [False, True, True], 'dropout': 0.0, 'latents_mean': [-0.2289, -0.0052, -0.1323, -0.2339, -0.2799, 0.0174, 0.1838, 0.1557, -0.1382, 0.0542, 0.2813, 0.0891, 0.157, -0.0098, 0.0375, -0.1825, -0.2246, -0.1207, -0.0698, 0.5109, 0.2665, -0.2108, -0.2158, 0.2502, -0.2055, -0.0322, 0.1109, 0.1567, -0.0729, 0.0899, -0.2799, -0.123, -0.0313, -0.1649, 0.0117, 0.0723, -0.2839, -0.2083, -0.052, 0.3748, 0.0152, 0.1957, 0.1433, -0.2944, 0.3573, -0.0548, -0.1681, -0.0667], 'latents_std': [0.4765, 1.0364, 0.4514, 1.1677, 0.5313, 0.499, 0.4818, 0.5013, 0.8158, 1.0344, 0.5894, 1.0901, 0.6885, 0.6165, 0.8454, 0.4978, 0.5759, 0.3523, 0.7135, 0.6804, 0.5833, 1.4146, 0.8986, 0.5659, 0.7069, 0.5338, 0.4889, 0.4917, 0.4069, 0.4999, 0.6866, 0.4093, 0.5709, 0.6065, 0.6415, 0.4944, 0.5726, 1.2042, 0.5458, 1.6887, 0.3971, 1.06, 0.3943, 0.5537, 0.5444, 0.4089, 0.7468, 0.7744], 'is_residual': True, 'in_channels': 12, 'out_channels': 12, 'patch_size': 2, 'scale_factor_temporal': 4, 'scale_factor_spatial': 16, 'clip_output': False}, 'load_encoder': False, 'load_decoder': True, 'tile_sample_min_height': 256, 'tile_sample_min_width': 256, 'tile_sample_min_num_frames': 16, 'tile_sample_stride_height': 192, 'tile_sample_stride_width': 192, 'tile_sample_stride_num_frames': 12, 'blend_num_frames': 8, 'use_tiling': False, 'use_temporal_tiling': False, 'use_parallel_tiling': False, 'use_temporal_scaling_frames': True, 'use_feature_cache': True}, 'vae_precision': 'fp32', 'vae_tiling': False, 'vae_sp': False, 'image_encoder_config': {'arch_config': {'stacked_params_mapping': [], 'architectures': [], '_supported_attention_backends': [1, 2], 'output_hidden_states': False, 'use_return_dict': True}, 'prefix': '', 'quant_config': None, 'lora_config': None}, 'image_encoder_precision': 'fp32', 'text_encoder_configs': [{'arch_config': {'stacked_params_mapping': [['.qkv_proj', '.q', 'q'], ['.qkv_proj', '.k', 'k'], ['.qkv_proj', '.v', 'v']], 'architectures': [], '_supported_attention_backends': [1, 2], 'output_hidden_states': False, 'use_return_dict': True, 'vocab_size': 32128, 'hidden_size': 512, 'num_hidden_layers': 0, 'num_attention_heads': 0, 'pad_token_id': 0, 'eos_token_id': 1, 'text_len': 512, 'hidden_state_skip_layer': 0, 'decoder_start_token_id': 0, 'output_past': True, 'scalable_attention': True, 'tie_word_embeddings': False, 'tokenizer_kwargs': {'truncation': True, 'max_length': 512, 'add_special_tokens': True, 'return_attention_mask': True, 'return_tensors': 'pt'}, '_fsdp_shard_conditions': ['_is_transformer_layer', '_is_embeddings', '_is_final_layernorm'], 'd_model': 512, 'd_kv': 64, 'd_ff': 2048, 'num_layers': 6, 'num_decoder_layers': None, 'num_heads': 8, 'relative_attention_num_buckets': 32, 'relative_attention_max_distance': 128, 'dropout_rate': 0.1, 'layer_norm_epsilon': 1e-06, 'initializer_factor': 1.0, 'feed_forward_proj': 'relu', 'dense_act_fn': 'relu', 'is_gated_act': False, 'is_encoder_decoder': True, 'use_cache': True, 'classifier_dropout': 0.0, 'dtype': None, 'gradient_checkpointing': False, 'n_positions': 512, 'task_specific_params': None}, 'prefix': 't5', 'quant_config': None, 'lora_config': None, 'is_chat_model': False, 'treat_empty_as_dot': False}], 'text_encoder_precisions': ['fp32'], 'preprocess_text_funcs': ['preprocess_text'], 'postprocess_text_funcs': ['t5_postprocess_text'], 'dmd_denoising_steps': None, 'ti2v_task': False, 'boundary_ratio': None, 'precision': 'bf16', 'warp_denoising_step': True}, 'preprocess_config': None, 'lora_path': None, 'lora_nickname': 'default', 'lora_target_modules': None, 'output_type': 'pil', 'dit_cpu_offload': False, 'use_fsdp_inference': False, 'dit_layerwise_offload': False, 'text_encoder_cpu_offload': False, 'image_encoder_cpu_offload': False, 'vae_cpu_offload': False, 'pin_cpu_memory': False, 'enable_torch_compile': False, 'enable_torch_compile_text_encoder': False, 'enable_torch_compile_vae': False, 'enable_torch_compile_audio_vae': False, 'torch_compile_kwargs': None, 'torch_compile_kwargs_dit': {}, 'torch_compile_kwargs_text_encoder': {}, 'torch_compile_kwargs_vae': {}, 'torch_compile_kwargs_audio_vae': {}, 'disable_autocast': False, 'VSA_sparsity': 0.0, 'moba_config_path': None, 'moba_config': {}, 'master_port': None, 'enable_stage_verification': True, 'prompt_txt': None, 'ltx2_vae_tiling': None, 'ltx2_vae_spatial_tile_size_in_pixels': None, 'ltx2_vae_spatial_tile_overlap_in_pixels': None, 'ltx2_vae_temporal_tile_size_in_frames': None, 'ltx2_vae_temporal_tile_overlap_in_frames': None, 'ltx2_initial_latent_path': None, 'ltx2_audio_latent_path': None, 'refine_enabled': None, 'refine_upsampler_path': None, 'refine_transformer_path': None, 'refine_lora_path': None, 'refine_num_inference_steps': None, 'refine_guidance_scale': None, 'refine_add_noise': None, 'refine_noise_path': None, 'refine_audio_noise_path': None, 'ltx2_refine_enabled': False, 'ltx2_refine_upsampler_path': None, 'ltx2_refine_transformer_path': None, 'ltx2_refine_lora_path': None, 'ltx2_refine_num_inference_steps': 3, 'ltx2_refine_guidance_scale': 1.0, 'ltx2_refine_add_noise': True, 'ltx2_refine_noise_path': None, 'ltx2_refine_audio_noise_path': None, 'ltx2_legacy_native_noise_order': False, 'ltx2_use_distilled_sigmas': True, 'model_paths': {'transformer': '/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged/transformer', 'vae': '/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged/vae'}, 'model_loaded': {'transformer': True, 'vae': True, 'upsampler': True}, 'override_text_encoder_safetensors': None, 'override_text_encoder_quant': None, 'transformer_quant': None, 'override_transformer_cls_name': None, 'init_weights_from_safetensors': None, 'init_weights_from_safetensors_2': None, 'override_pipeline_cls_name': None, 'boundary_ratio': 0.875, 'data_path': '/scratch/user/yuhwang/dataset/pants-captions-ldm/cache/wan22_pants_v2_softwin', 'dataloader_num_workers': 2, 'num_height': 320, 'num_width': 288, 'num_frames': 153, 'train_batch_size': 16, 'num_latent_t': 39, 'group_frame': False, 'group_resolution': False, 'pretrained_model_name_or_path': '/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged', 'real_score_model_path': None, 'fake_score_model_path': None, 'ema_decay': 0.999, 'ema_start_step': 1, 'training_cfg_rate': 0.05, 'precondition_outputs': False, 'validation_dataset_file': None, 'validation_preprocessed_path': None, 'validation_sampling_steps': None, 'validation_guidance_scale': None, 'validation_steps': None, 'log_validation': False, 'trackers': [], 'tracker_project_name': 'pants_wan22_fullrep', 'wandb_run_name': 'pants_b16_9k_20260519_215532', 'seed': 42, 'output_dir': '/scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532', 'checkpoints_total_limit': 2, 'resume_from_checkpoint': None, 'num_train_epochs': None, 'max_train_steps': 9000, 'gradient_accumulation_steps': 1, 'learning_rate': 1e-06, 'scale_lr': False, 'lr_scheduler': 'constant', 'lr_warmup_steps': 0, 'max_grad_norm': 1.0, 'enable_gradient_checkpointing_type': 'full', 'selective_checkpointing': None, 'mixed_precision': 'bf16', 'train_sp_batch_size': 1, 'fsdp_sharding_startegy': '', 'weighting_scheme': 'uniform', 'logit_mean': 0.0, 'logit_std': 1.0, 'mode_scale': 1.29, 'num_euler_timesteps': 50, 'lr_num_cycles': None, 'lr_power': None, 'min_lr_ratio': 0.5, 'not_apply_cfg_solver': False, 'distill_cfg': None, 'scheduler_type': None, 'linear_quadratic_threshold': None, 'linear_range': None, 'weight_decay': 0.01, 'betas': '0.9,0.999', 'use_ema': True, 'multi_phased_distill_schedule': None, 'pred_decay_weight': None, 'pred_decay_type': None, 'hunyuan_teacher_disable_cfg': False, 'master_weight_type': None, 'VSA_decay_rate': 0.01, 'VSA_decay_interval_steps': 1, 'lora_rank': None, 'lora_alpha': None, 'lora_training': False, 'ltx2_first_frame_conditioning_p': 0.1, 'generator_update_interval': 5, 'dfake_gen_update_ratio': 5, 'min_timestep_ratio': 0.2, 'max_timestep_ratio': 0.98, 'real_score_guidance_scale': 3.5, 'fake_score_learning_rate': 0.0, 'fake_score_lr_scheduler': 'constant', 'fake_score_betas': '0.9,0.999', 'training_state_checkpointing_steps': 4000, 'weight_only_checkpointing_steps': None, 'log_visualization': False, 'visualization_steps': None, 'simulate_generator_forward': False, 'warp_denoising_step': False, 'num_frame_per_block': 3, 'independent_first_frame': False, 'enable_gradient_masking': False, 'gradient_mask_last_n_frames': 21, 'same_step_across_blocks': False, 'last_step_only': False, 'context_noise': 0, '_wandb': {}}
|
| 9 |
+
2026-05-19 21:56:09,558 INFO MainThread:107930 [wandb_init.py:init():898] starting backend
|
| 10 |
+
2026-05-19 21:56:09,805 INFO MainThread:107930 [wandb_init.py:init():913] sending inform_init request
|
| 11 |
+
2026-05-19 21:56:10,039 INFO MainThread:107930 [wandb_init.py:init():918] backend started and connected
|
| 12 |
+
2026-05-19 21:56:10,041 INFO MainThread:107930 [wandb_init.py:init():988] updated telemetry
|
| 13 |
+
2026-05-19 21:56:10,044 INFO MainThread:107930 [wandb_init.py:init():1011] communicating run to backend with 90.0 second timeout
|
| 14 |
+
2026-05-19 21:56:10,051 INFO MainThread:107930 [wandb_init.py:init():1056] starting run threads in backend
|
| 15 |
+
2026-05-19 21:56:10,141 INFO MainThread:107930 [wandb_run.py:_console_start():2554] atexit reg
|
| 16 |
+
2026-05-19 21:56:10,141 INFO MainThread:107930 [wandb_run.py:_redirect():2403] redirect: wrap_raw
|
| 17 |
+
2026-05-19 21:56:10,141 INFO MainThread:107930 [wandb_run.py:_redirect():2472] Wrapping output streams.
|
| 18 |
+
2026-05-19 21:56:10,141 INFO MainThread:107930 [wandb_run.py:_redirect():2495] Redirects installed.
|
| 19 |
+
2026-05-19 21:56:10,144 INFO MainThread:107930 [wandb_init.py:init():1094] run started, returning control to user process
|
model_cache_code_step8000/logs/train.log
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model_cache_code_step8000/metadata/FastVideo.git_status.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
repo=FastVideo
|
| 2 |
+
/usr/bin/git
|
| 3 |
+
main
|
| 4 |
+
72cb427cd97ab727cfbfa0db558029765d7fe1a5
|
| 5 |
+
M fastvideo/dataset/__init__.py
|
| 6 |
+
M fastvideo/training/training_pipeline.py
|
| 7 |
+
?? fastvideo/dataset/pants_latent_dataset.py
|
model_cache_code_step8000/metadata/FastVideo.uncommitted.diff
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/fastvideo/dataset/__init__.py b/fastvideo/dataset/__init__.py
|
| 2 |
+
index b82c653..f76077b 100644
|
| 3 |
+
--- a/fastvideo/dataset/__init__.py
|
| 4 |
+
+++ b/fastvideo/dataset/__init__.py
|
| 5 |
+
@@ -4,6 +4,8 @@ from torchvision.transforms import Lambda
|
| 6 |
+
|
| 7 |
+
from fastvideo.dataset.parquet_dataset_map_style import (
|
| 8 |
+
build_parquet_map_style_dataloader)
|
| 9 |
+
+from fastvideo.dataset.pants_latent_dataset import (
|
| 10 |
+
+ build_pants_latent_dataloader, is_pants_latent_path)
|
| 11 |
+
from fastvideo.dataset.ltx2_precomputed_dataset import (
|
| 12 |
+
build_ltx2_precomputed_dataloader, LTX2PrecomputedDataset)
|
| 13 |
+
from fastvideo.dataset.preprocessing_datasets import VideoCaptionMergedDataset, TextDataset
|
| 14 |
+
@@ -46,6 +48,8 @@ def gettextdataset(args) -> TextDataset:
|
| 15 |
+
|
| 16 |
+
__all__ = [
|
| 17 |
+
"build_parquet_map_style_dataloader",
|
| 18 |
+
+ "build_pants_latent_dataloader",
|
| 19 |
+
+ "is_pants_latent_path",
|
| 20 |
+
"build_ltx2_precomputed_dataloader",
|
| 21 |
+
"LTX2PrecomputedDataset",
|
| 22 |
+
"ValidationDataset",
|
| 23 |
+
diff --git a/fastvideo/training/training_pipeline.py b/fastvideo/training/training_pipeline.py
|
| 24 |
+
index 575d6dc..140bb31 100644
|
| 25 |
+
--- a/fastvideo/training/training_pipeline.py
|
| 26 |
+
+++ b/fastvideo/training/training_pipeline.py
|
| 27 |
+
@@ -28,7 +28,11 @@ try:
|
| 28 |
+
except Exception:
|
| 29 |
+
pass
|
| 30 |
+
from fastvideo.api.sampling_param import SamplingParam
|
| 31 |
+
-from fastvideo.dataset import build_parquet_map_style_dataloader
|
| 32 |
+
+from fastvideo.dataset import (
|
| 33 |
+
+ build_pants_latent_dataloader,
|
| 34 |
+
+ build_parquet_map_style_dataloader,
|
| 35 |
+
+ is_pants_latent_path,
|
| 36 |
+
+)
|
| 37 |
+
from fastvideo.dataset.dataloader.schema import pyarrow_schema_t2v
|
| 38 |
+
from fastvideo.dataset.validation_dataset import ValidationDataset
|
| 39 |
+
from fastvideo.distributed import (cleanup_dist_env_and_memory, get_local_torch_device, get_sp_group, get_world_group)
|
| 40 |
+
@@ -42,7 +46,8 @@ from fastvideo.training.activation_checkpoint import (apply_activation_checkpoin
|
| 41 |
+
from fastvideo.training.trackers import (DummyTracker, TrackerType, initialize_trackers, Trackers)
|
| 42 |
+
from fastvideo.training.training_utils import (clip_grad_norm_while_handling_failing_dtensor_cases,
|
| 43 |
+
compute_density_for_timestep_sampling, count_trainable, get_scheduler,
|
| 44 |
+
- get_sigmas, load_checkpoint, normalize_dit_input, save_checkpoint)
|
| 45 |
+
+ get_sigmas, load_checkpoint, normalize_dit_input, save_checkpoint,
|
| 46 |
+
+ EMA_FSDP, gather_state_dict_on_cpu_rank0, custom_to_hf_state_dict)
|
| 47 |
+
from fastvideo.utils import (is_vmoba_available, is_vsa_available, set_random_seed, shallow_asdict)
|
| 48 |
+
|
| 49 |
+
try:
|
| 50 |
+
@@ -82,6 +87,7 @@ class TrainingPipeline(LoRAPipeline, ABC):
|
| 51 |
+
super().__init__(model_path, fastvideo_args, required_config_modules, loaded_modules) # type: ignore
|
| 52 |
+
self.tracker = DummyTracker()
|
| 53 |
+
self.validation_ref_videos_logged = False
|
| 54 |
+
+ self.generator_ema: EMA_FSDP | None = None
|
| 55 |
+
|
| 56 |
+
def create_pipeline_stages(self, fastvideo_args: FastVideoArgs):
|
| 57 |
+
raise RuntimeError("create_pipeline_stages should not be called for training pipeline")
|
| 58 |
+
@@ -167,16 +173,27 @@ class TrainingPipeline(LoRAPipeline, ABC):
|
| 59 |
+
last_epoch=self.init_steps - 1,
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
- self.train_dataset, self.train_dataloader = build_parquet_map_style_dataloader(
|
| 63 |
+
- training_args.data_path,
|
| 64 |
+
- training_args.train_batch_size,
|
| 65 |
+
- parquet_schema=self.train_dataset_schema,
|
| 66 |
+
- num_data_workers=training_args.dataloader_num_workers,
|
| 67 |
+
- cfg_rate=training_args.training_cfg_rate,
|
| 68 |
+
- drop_last=True,
|
| 69 |
+
- text_padding_length=training_args.pipeline_config.text_encoder_configs[0].arch_config.
|
| 70 |
+
- text_len, # type: ignore[attr-defined]
|
| 71 |
+
- seed=self.seed)
|
| 72 |
+
+ text_padding_length = training_args.pipeline_config.text_encoder_configs[0].arch_config.text_len # type: ignore[attr-defined]
|
| 73 |
+
+ if is_pants_latent_path(training_args.data_path):
|
| 74 |
+
+ self.train_dataset, self.train_dataloader = build_pants_latent_dataloader(
|
| 75 |
+
+ training_args.data_path,
|
| 76 |
+
+ training_args.train_batch_size,
|
| 77 |
+
+ num_data_workers=training_args.dataloader_num_workers,
|
| 78 |
+
+ cfg_rate=training_args.training_cfg_rate,
|
| 79 |
+
+ drop_last=True,
|
| 80 |
+
+ text_padding_length=text_padding_length,
|
| 81 |
+
+ seed=self.seed,
|
| 82 |
+
+ )
|
| 83 |
+
+ else:
|
| 84 |
+
+ self.train_dataset, self.train_dataloader = build_parquet_map_style_dataloader(
|
| 85 |
+
+ training_args.data_path,
|
| 86 |
+
+ training_args.train_batch_size,
|
| 87 |
+
+ parquet_schema=self.train_dataset_schema,
|
| 88 |
+
+ num_data_workers=training_args.dataloader_num_workers,
|
| 89 |
+
+ cfg_rate=training_args.training_cfg_rate,
|
| 90 |
+
+ drop_last=True,
|
| 91 |
+
+ text_padding_length=text_padding_length,
|
| 92 |
+
+ seed=self.seed)
|
| 93 |
+
|
| 94 |
+
self.noise_scheduler = noise_scheduler
|
| 95 |
+
if self.training_args.boundary_ratio is not None:
|
| 96 |
+
@@ -460,6 +477,43 @@ class TrainingPipeline(LoRAPipeline, ABC):
|
| 97 |
+
training_batch.grad_norm = grad_norm
|
| 98 |
+
return training_batch
|
| 99 |
+
|
| 100 |
+
+ def _maybe_init_ema(self, step: int) -> None:
|
| 101 |
+
+ if not self.training_args.use_ema:
|
| 102 |
+
+ return
|
| 103 |
+
+ if self.generator_ema is not None:
|
| 104 |
+
+ return
|
| 105 |
+
+ if step < self.training_args.ema_start_step:
|
| 106 |
+
+ return
|
| 107 |
+
+ if self.training_args.ema_decay <= 0:
|
| 108 |
+
+ return
|
| 109 |
+
+ self.generator_ema = EMA_FSDP(self.transformer, decay=self.training_args.ema_decay)
|
| 110 |
+
+ logger.info("Created generator EMA at step %s with decay=%s", step, self.training_args.ema_decay)
|
| 111 |
+
+
|
| 112 |
+
+ def _maybe_update_ema(self, step: int) -> None:
|
| 113 |
+
+ self._maybe_init_ema(step)
|
| 114 |
+
+ if self.generator_ema is not None:
|
| 115 |
+
+ self.generator_ema.update(self.transformer)
|
| 116 |
+
+
|
| 117 |
+
+ def _save_ema_weights(self, step: int) -> None:
|
| 118 |
+
+ if not self.training_args.use_ema or self.generator_ema is None:
|
| 119 |
+
+ return
|
| 120 |
+
+ ema_dir = os.path.join(self.training_args.output_dir, f"ema_checkpoint-{step}")
|
| 121 |
+
+ os.makedirs(ema_dir, exist_ok=True)
|
| 122 |
+
+ with self.generator_ema.apply_to_model(self.transformer):
|
| 123 |
+
+ cpu_state = gather_state_dict_on_cpu_rank0(self.transformer, device=None)
|
| 124 |
+
+ if self.global_rank == 0:
|
| 125 |
+
+ from safetensors.torch import save_file
|
| 126 |
+
+
|
| 127 |
+
+ diffusers_state_dict = custom_to_hf_state_dict(
|
| 128 |
+
+ cpu_state,
|
| 129 |
+
+ self.transformer.reverse_param_names_mapping,
|
| 130 |
+
+ )
|
| 131 |
+
+ save_file(
|
| 132 |
+
+ diffusers_state_dict,
|
| 133 |
+
+ os.path.join(ema_dir, "diffusion_pytorch_model.safetensors"),
|
| 134 |
+
+ )
|
| 135 |
+
+ logger.info("Saved EMA transformer weights to %s", ema_dir)
|
| 136 |
+
+
|
| 137 |
+
@profile_region("profiler_region_training_train_one_step")
|
| 138 |
+
def train_one_step(self, training_batch: TrainingBatch) -> TrainingBatch:
|
| 139 |
+
training_batch = self._prepare_training(training_batch)
|
| 140 |
+
@@ -571,6 +625,7 @@ class TrainingPipeline(LoRAPipeline, ABC):
|
| 141 |
+
training_batch.current_timestep = step
|
| 142 |
+
training_batch.current_vsa_sparsity = current_vsa_sparsity
|
| 143 |
+
training_batch = self.train_one_step(training_batch)
|
| 144 |
+
+ self._maybe_update_ema(step)
|
| 145 |
+
|
| 146 |
+
loss = float(training_batch.total_loss)
|
| 147 |
+
grad_norm = training_batch.grad_norm
|
| 148 |
+
@@ -594,6 +649,9 @@ class TrainingPipeline(LoRAPipeline, ABC):
|
| 149 |
+
"grad_norm": grad_norm,
|
| 150 |
+
"vsa_sparsity": current_vsa_sparsity,
|
| 151 |
+
}
|
| 152 |
+
+ if self.training_args.use_ema:
|
| 153 |
+
+ metrics["ema_enabled"] = self.generator_ema is not None
|
| 154 |
+
+ metrics["ema_decay"] = self.training_args.ema_decay
|
| 155 |
+
try:
|
| 156 |
+
metrics["batch_size"] = int(training_batch.raw_latent_shape[0])
|
| 157 |
+
|
| 158 |
+
@@ -622,6 +680,7 @@ class TrainingPipeline(LoRAPipeline, ABC):
|
| 159 |
+
save_checkpoint(self.transformer, self.global_rank, self.training_args.output_dir, step,
|
| 160 |
+
self.optimizer, self.train_dataloader, self.lr_scheduler,
|
| 161 |
+
self.noise_random_generator)
|
| 162 |
+
+ self._save_ema_weights(step)
|
| 163 |
+
self.transformer.train()
|
| 164 |
+
self.sp_group.barrier()
|
| 165 |
+
|
| 166 |
+
@@ -637,9 +696,13 @@ class TrainingPipeline(LoRAPipeline, ABC):
|
| 167 |
+
trainable_params)
|
| 168 |
+
|
| 169 |
+
self.tracker.finish()
|
| 170 |
+
- save_checkpoint(self.transformer, self.global_rank, self.training_args.output_dir,
|
| 171 |
+
- self.training_args.max_train_steps, self.optimizer, self.train_dataloader, self.lr_scheduler,
|
| 172 |
+
- self.noise_random_generator)
|
| 173 |
+
+ if os.environ.get("FASTVIDEO_SKIP_FINAL_CHECKPOINT", "0") == "1":
|
| 174 |
+
+ logger.info("Skipping final checkpoint because FASTVIDEO_SKIP_FINAL_CHECKPOINT=1")
|
| 175 |
+
+ else:
|
| 176 |
+
+ save_checkpoint(self.transformer, self.global_rank, self.training_args.output_dir,
|
| 177 |
+
+ self.training_args.max_train_steps, self.optimizer, self.train_dataloader,
|
| 178 |
+
+ self.lr_scheduler, self.noise_random_generator)
|
| 179 |
+
+ self._save_ema_weights(self.training_args.max_train_steps)
|
| 180 |
+
|
| 181 |
+
if envs.FASTVIDEO_TORCH_PROFILER_DIR:
|
| 182 |
+
logger.info("Stopping profiler...")
|
model_cache_code_step8000/metadata/FastVideo.untracked_files.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
fastvideo/dataset/pants_latent_dataset.py
|
model_cache_code_step8000/metadata/TwoFrame.git_status.txt
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
repo=TwoFrame
|
| 2 |
+
/usr/bin/git
|
| 3 |
+
main
|
| 4 |
+
d923e4d7647196b00bf74d043f29988a9fe8ca51
|
| 5 |
+
M requirements.txt
|
| 6 |
+
M scripts/aggregate_phase_b_report.py
|
| 7 |
+
M scripts/build_rich_caption_probe.py
|
| 8 |
+
M scripts/convert_pico_jsonl_to_twoframe_manifest.py
|
| 9 |
+
M scripts/eval_pair_metrics.py
|
| 10 |
+
M scripts/eval_source_reconstruction.py
|
| 11 |
+
M scripts/infer_9b_lora_twoframe_8gpu.sh
|
| 12 |
+
M scripts/infer_batch_condition.py
|
| 13 |
+
M scripts/infer_batch_multiframe.py
|
| 14 |
+
M scripts/infer_batch_twoframe.py
|
| 15 |
+
M scripts/infer_d10_mid_refresh.py
|
| 16 |
+
M scripts/infer_d5_self_conditioning.py
|
| 17 |
+
M scripts/infer_d8_oracle_clean_source.py
|
| 18 |
+
M scripts/infer_d9_block_cfg.py
|
| 19 |
+
M scripts/infer_flux_klein_twoframe.py
|
| 20 |
+
M scripts/infer_twostep_baseline.py
|
| 21 |
+
M scripts/make_multiframe_gallery.py
|
| 22 |
+
M scripts/make_multiframe_probe_combo_html.py
|
| 23 |
+
M scripts/make_multiframe_test100_html.py
|
| 24 |
+
M scripts/make_phase2_complex_highscore_html.py
|
| 25 |
+
M scripts/make_reasoning_holdout500_html.py
|
| 26 |
+
M scripts/make_reasoning_holdout_sampled_html.py
|
| 27 |
+
M scripts/make_reasoning_sample_html.py
|
| 28 |
+
M scripts/measure_pair_consistency.py
|
| 29 |
+
M scripts/phase_b_master_loop.sh
|
| 30 |
+
M scripts/phase_b_status_emit.sh
|
| 31 |
+
M scripts/phase_b_watchdog.sh
|
| 32 |
+
M scripts/phase_c_status.sh
|
| 33 |
+
M scripts/precompute_flux2_vae_cache.py
|
| 34 |
+
M scripts/precompute_flux2_vae_cache_8gpu.sh
|
| 35 |
+
M scripts/prepare_benchmark_manifests.py
|
| 36 |
+
M scripts/prepare_ccb_c8_manifest.py
|
| 37 |
+
M scripts/prepare_eval_manifests.py
|
| 38 |
+
M scripts/prepare_phase_a_manifests.py
|
| 39 |
+
M scripts/prepare_reasoning_holdout_infer_manifest.py
|
| 40 |
+
M scripts/prepare_reasoning_holdout_test_manifest.py
|
| 41 |
+
M scripts/prepare_reasoning_manifest.py
|
| 42 |
+
M scripts/prepare_short_instruction_manifests.py
|
| 43 |
+
M scripts/run0_sonnet_select.py
|
| 44 |
+
M scripts/run_all_eval.sh
|
| 45 |
+
M scripts/run_all_inference_machine_a.sh
|
| 46 |
+
M scripts/run_d11_real_source_eval.sh
|
| 47 |
+
M scripts/run_d1_d2_d3.sh
|
| 48 |
+
M scripts/run_d4_failure_taxonomy.sh
|
| 49 |
+
M scripts/run_d5_self_conditioning.sh
|
| 50 |
+
M scripts/run_d6_structured_joint.sh
|
| 51 |
+
M scripts/run_d7_text_factorization.sh
|
| 52 |
+
M scripts/run_d8_oracle.sh
|
| 53 |
+
M scripts/run_eval_data_quality_6jobs.sh
|
| 54 |
+
M scripts/run_eval_imgedit_gedit_mode.sh
|
| 55 |
+
M scripts/run_eval_machine_a_m3source_wait_m2.sh
|
| 56 |
+
M scripts/run_eval_machine_a_scoring.sh
|
| 57 |
+
M scripts/run_eval_machine_a_stage1.sh
|
| 58 |
+
M scripts/run_eval_machine_c_imgedit.sh
|
| 59 |
+
M scripts/run_eval_machine_d_gedit.sh
|
| 60 |
+
M scripts/run_exp_k_machine_b_eval.sh
|
| 61 |
+
M scripts/run_exp_k_machine_b_infer.sh
|
| 62 |
+
M scripts/run_generate_twoframe_complex_22k_cfg7_ckpt35k.sh
|
| 63 |
+
M scripts/run_infer_c2_8gpu.sh
|
| 64 |
+
M scripts/run_infer_c3_8gpu.sh
|
| 65 |
+
M scripts/run_infer_c4_8gpu.sh
|
| 66 |
+
M scripts/run_infer_node_consolidated_until_done.sh
|
| 67 |
+
M scripts/run_m2new_infer_eval.sh
|
| 68 |
+
M scripts/run_m3_cfg7_only.sh
|
| 69 |
+
M scripts/run_m3_s50_eval.sh
|
| 70 |
+
M scripts/run_m3ft_35000_8gpu.sh
|
| 71 |
+
M scripts/run_m3ft_inference.sh
|
| 72 |
+
M scripts/run_m3ft_missing_resume.sh
|
| 73 |
+
M scripts/run_m3ft_resume60k.sh
|
| 74 |
+
M scripts/run_m3ft_sweep_eval.sh
|
| 75 |
+
M scripts/run_m3source_round_end2end.sh
|
| 76 |
+
M scripts/run_machine_a_eval.sh
|
| 77 |
+
M scripts/run_machine_a_infer.sh
|
| 78 |
+
M scripts/run_machine_b_distilled_train.sh
|
| 79 |
+
M scripts/run_machine_b_distilled_train_local.sh
|
| 80 |
+
M scripts/run_missing_inference_resume.sh
|
| 81 |
+
M scripts/run_missing_machine_a.sh
|
| 82 |
+
M scripts/run_missing_machine_a_m1_rewrite.sh
|
| 83 |
+
M scripts/run_missing_machine_b.sh
|
| 84 |
+
M scripts/run_multiframe_4img_probe10.sh
|
| 85 |
+
M scripts/run_multiframe_resample100.sh
|
| 86 |
+
M scripts/run_multiframe_smoke_1gpu.sh
|
| 87 |
+
M scripts/run_multiframe_smoke_8gpu.sh
|
| 88 |
+
M scripts/run_multiframe_smoke_8gpu_debug.sh
|
| 89 |
+
M scripts/run_multiframe_test100.sh
|
| 90 |
+
M scripts/run_multiframe_test100_latest_when_free.sh
|
| 91 |
+
M scripts/run_multiframe_train.sh
|
| 92 |
+
M scripts/run_phase2_refilter_4jobs.sh
|
| 93 |
+
M scripts/run_phase_a.sh
|
| 94 |
+
M scripts/run_phase_a_eval.sh
|
| 95 |
+
M scripts/run_phase_a_eval_parallel.sh
|
| 96 |
+
M scripts/run_phase_a_mllm_eval_sonnet46.sh
|
| 97 |
+
M scripts/run_phase_b_eval_all.sh
|
| 98 |
+
M scripts/run_phase_c.sh
|
| 99 |
+
M scripts/run_reasoning_holdout500_infer.sh
|
| 100 |
+
M scripts/run_reasoning_probe.sh
|
| 101 |
+
M scripts/run_reasoning_train.sh
|
| 102 |
+
M scripts/run_rewrite_structured.sh
|
| 103 |
+
M scripts/run_rich_caption_probe.sh
|
| 104 |
+
M scripts/run_unified_cfg4_test.sh
|
| 105 |
+
M scripts/run_v2_instr_filter_2jobs.sh
|
| 106 |
+
M scripts/run_watchdog_1h.sh
|
| 107 |
+
M scripts/sample_multiframe_4img_probe10.py
|
| 108 |
+
M scripts/sample_multiframe_resample100.py
|
| 109 |
+
M scripts/switch_current_to_machine_b.sh
|
| 110 |
+
M scripts/train_4b_base_editlong_pico400k_train20k_bs2_lr1e5_vae_cache_zero2.sh
|
| 111 |
+
M scripts/train_4b_full.sh
|
| 112 |
+
M scripts/train_4b_full_pico400k_opusstage2_long_train20k_bs2_lr1e5_jointtext_t0_zero2.sh
|
| 113 |
+
M scripts/train_4b_full_pico400k_short_train20k_bs2_lr1e5_cfgdrop0.sh
|
| 114 |
+
M scripts/train_4b_full_pico400k_short_train20k_bs2_lr1e5_cfgdrop0_zero2.sh
|
| 115 |
+
M scripts/train_4b_full_pico400k_short_train20k_bs2_lr1e5_jointtext_t0_zero2.sh
|
| 116 |
+
M scripts/train_4b_full_pico400k_short_zero2_smoke.sh
|
| 117 |
+
M scripts/train_4b_lora.sh
|
| 118 |
+
M scripts/train_4b_lora_moe_prodigy_pico400k_short_jointtext_t0_bs2_zero2.sh
|
| 119 |
+
M scripts/train_9b_base_editlong_pico400k_train20k_bs2_lr1e6_vae_cache_zero2.sh
|
| 120 |
+
M scripts/train_9b_full.sh
|
| 121 |
+
M scripts/train_9b_full_direct_edit_baseline_zero2.sh
|
| 122 |
+
M scripts/train_9b_full_direct_edit_baseline_zero3.sh
|
| 123 |
+
M scripts/train_9b_full_pico400k_opusstage2_long_train20k_bs2_lr1e6_jointtext_t0_zero2.sh
|
| 124 |
+
M scripts/train_9b_full_pico57k_corner10k_long_jointtext_zero2.sh
|
| 125 |
+
M scripts/train_9b_full_pico57k_corner10k_long_jointtext_zero3.sh
|
| 126 |
+
M scripts/train_9b_full_twoframe_lr5e6_zero2.sh
|
| 127 |
+
M scripts/train_9b_lora.sh
|
| 128 |
+
M scripts/train_9b_lora_downstream_edit_combined_zero2.sh
|
| 129 |
+
M scripts/train_9b_lora_downstream_edit_phase2_zero2.sh
|
| 130 |
+
M scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_fluxfill_icedittargets_zero2.sh
|
| 131 |
+
M scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_simpletuner_flux2targets_zero2.sh
|
| 132 |
+
M scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_zero2.sh
|
| 133 |
+
M scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_zero3.sh
|
| 134 |
+
M scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_zero2.sh
|
| 135 |
+
M scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_nogc_zero2.sh
|
| 136 |
+
M scripts/train_9b_lora_moe_prodigy_finalmix80k_short_no_latent_nogc_zero2.sh
|
| 137 |
+
M scripts/train_9b_lora_moe_prodigy_pico400k_long_jointtext_t0_bs2_zero2.sh
|
| 138 |
+
M scripts/train_9b_lora_pico57k_corner10k_long_jointtext_zero2.sh
|
| 139 |
+
M scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_smoke_zero2.sh
|
| 140 |
+
M scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_full40k_zero2.sh
|
| 141 |
+
M scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_textimgemb_full25k_zero2.sh
|
| 142 |
+
M scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_zero2.sh
|
| 143 |
+
M scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_v1_zero2.sh
|
| 144 |
+
M scripts/train_9b_lora_standard_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_icedit6targets_zero2.sh
|
| 145 |
+
M scripts/train_9b_lora_standard_prodigy_finalmix80k_short_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_full40k_node2_zero2.sh
|
| 146 |
+
M scripts/train_9b_lora_standard_prodigy_finalmix80k_short_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_full40k_zero2.sh
|
| 147 |
+
M scripts/train_9b_lora_standard_prodigy_pico400k_long_jointtext_t0_bs1ga2_icedit6targets_vae_cache_zero2.sh
|
| 148 |
+
M scripts/train_exp_e_phase2_only.sh
|
| 149 |
+
M scripts/train_exp_f_phase2_pico.sh
|
| 150 |
+
M scripts/train_exp_g_phase2_all.sh
|
| 151 |
+
M scripts/wait_then_resume_m3ft60k.sh
|
| 152 |
+
M scripts/wait_then_run_multiframe_4img_probe10.sh
|
| 153 |
+
M scripts/watch_and_run_m3ft_sweep.sh
|
| 154 |
+
M scripts/watch_m3ft_35000_launch.sh
|
| 155 |
+
M train.py
|
| 156 |
+
M twoframe/modeling.py
|
| 157 |
+
M twoframe/native_inference.py
|
| 158 |
+
?? configs/accelerate_8gpu_zero2_ga2.yaml
|
| 159 |
+
?? configs/flux_klein9b_mixed_bucketed_editor_only_ma034235_ma79931_ucsf.yaml
|
| 160 |
+
?? configs/flux_klein9b_mixed_bucketed_joint_ema_resume_ucsf.yaml
|
| 161 |
+
?? configs/flux_klein9b_mixed_bucketed_ma034235_ma79931_ucsf.yaml
|
| 162 |
+
?? docs/TWOFRAME_DATA_ENGINE.md
|
| 163 |
+
?? docs/UCSF_EVAL_EXPERIMENT_TRACKER.md
|
| 164 |
+
?? scripts/analyze_ma034235_manifest_filter.py
|
| 165 |
+
?? scripts/analyze_ma034235_manifest_filter_ucsf.sbatch
|
| 166 |
+
?? scripts/build_bucket_cache.py
|
| 167 |
+
?? scripts/build_mixed_bucket_caches_h200_ucsf.sbatch
|
| 168 |
+
?? scripts/build_mixed_bucket_caches_ucsf.sbatch
|
| 169 |
+
?? scripts/build_multiref_condition_manifest_from_outputs.py
|
| 170 |
+
?? scripts/check_bucketed_dataloader.py
|
| 171 |
+
?? scripts/eval_generate_single_gpu_ucsf.sbatch
|
| 172 |
+
?? scripts/hold_h200_allocation_ucsf.sbatch
|
| 173 |
+
?? scripts/infer_multiref_condition_editor.py
|
| 174 |
+
?? scripts/infer_twoframe_data_engine.py
|
| 175 |
+
?? scripts/launch_twoframe_data_engine_ctmux_ucsf.sh
|
| 176 |
+
?? scripts/prepare_ucsf_eval_manifests.py
|
| 177 |
+
?? scripts/run_multiref_backfill_queue_ucsf.sh
|
| 178 |
+
?? scripts/run_multiref_condition_editor_inalloc_8g_ucsf.sh
|
| 179 |
+
?? scripts/run_singleref_condition_baselines_inalloc_8g_ucsf.sh
|
| 180 |
+
?? scripts/run_singleref_pair_metrics_8gpu_ucsf.sbatch
|
| 181 |
+
?? scripts/run_singleref_pair_metrics_ucsf.sbatch
|
| 182 |
+
?? scripts/run_twoframe_data_engine_inalloc_ucsf.sh
|
| 183 |
+
?? scripts/run_wandb_login_tail_both_loop_ucsf.sh
|
| 184 |
+
?? scripts/run_wandb_login_tail_both_persistent_ucsf.sh
|
| 185 |
+
?? scripts/run_wandb_login_tail_loop_ucsf.sh
|
| 186 |
+
?? scripts/run_wandb_login_tail_ucsf.sh
|
| 187 |
+
?? scripts/srun_in_h200_allocation_ucsf.sh
|
| 188 |
+
?? scripts/tail_train_log_to_wandb.py
|
| 189 |
+
?? scripts/tail_train_log_to_wandb_ucsf.sbatch
|
| 190 |
+
?? scripts/train_mixed_bucketed_editor_only_ucsf.sbatch
|
| 191 |
+
?? scripts/train_mixed_bucketed_joint_ema_resume_ucsf.sbatch
|
| 192 |
+
?? scripts/train_mixed_bucketed_joint_ucsf.sbatch
|
| 193 |
+
?? scripts/train_mixed_bucketed_ucsf.sbatch
|
| 194 |
+
?? scripts/verify_mixed_bucket_caches_ucsf.sbatch
|
| 195 |
+
?? scripts/verify_mixed_bucket_caches_ucsf.sh
|
| 196 |
+
?? scripts/wait_then_run_multiref_condition_baselines_ucsf.sh
|
| 197 |
+
?? twoframe/data_bucketed.py
|
model_cache_code_step8000/metadata/TwoFrame.uncommitted.diff
ADDED
|
@@ -0,0 +1,1627 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
diff --git a/requirements.txt b/requirements.txt
|
| 2 |
+
index a93eefd..c0825fe 100644
|
| 3 |
+
--- a/requirements.txt
|
| 4 |
+
+++ b/requirements.txt
|
| 5 |
+
@@ -10,5 +10,7 @@ einops
|
| 6 |
+
PyYAML
|
| 7 |
+
Pillow
|
| 8 |
+
numpy
|
| 9 |
+
+scikit-image
|
| 10 |
+
huggingface_hub
|
| 11 |
+
safetensors
|
| 12 |
+
+git+https://github.com/openai/CLIP.git
|
| 13 |
+
diff --git a/scripts/aggregate_phase_b_report.py b/scripts/aggregate_phase_b_report.py
|
| 14 |
+
old mode 100644
|
| 15 |
+
new mode 100755
|
| 16 |
+
diff --git a/scripts/build_rich_caption_probe.py b/scripts/build_rich_caption_probe.py
|
| 17 |
+
old mode 100644
|
| 18 |
+
new mode 100755
|
| 19 |
+
diff --git a/scripts/convert_pico_jsonl_to_twoframe_manifest.py b/scripts/convert_pico_jsonl_to_twoframe_manifest.py
|
| 20 |
+
old mode 100644
|
| 21 |
+
new mode 100755
|
| 22 |
+
diff --git a/scripts/eval_pair_metrics.py b/scripts/eval_pair_metrics.py
|
| 23 |
+
index a7832f7..eb93cea 100644
|
| 24 |
+
--- a/scripts/eval_pair_metrics.py
|
| 25 |
+
+++ b/scripts/eval_pair_metrics.py
|
| 26 |
+
@@ -25,8 +25,10 @@ Usage:
|
| 27 |
+
from __future__ import annotations
|
| 28 |
+
|
| 29 |
+
import argparse
|
| 30 |
+
+import hashlib
|
| 31 |
+
import json
|
| 32 |
+
import logging
|
| 33 |
+
+import os
|
| 34 |
+
from pathlib import Path
|
| 35 |
+
|
| 36 |
+
import clip
|
| 37 |
+
@@ -46,6 +48,34 @@ logging.basicConfig(
|
| 38 |
+
logger = logging.getLogger(__name__)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
+def clip_download_root() -> str | None:
|
| 42 |
+
+ root = os.environ.get("CLIP_CACHE_DIR")
|
| 43 |
+
+ if not root and os.environ.get("XDG_CACHE_HOME"):
|
| 44 |
+
+ root = str(Path(os.environ["XDG_CACHE_HOME"]) / "clip")
|
| 45 |
+
+ if root:
|
| 46 |
+
+ Path(root).mkdir(parents=True, exist_ok=True)
|
| 47 |
+
+ return root
|
| 48 |
+
+
|
| 49 |
+
+
|
| 50 |
+
+def load_dinov2_vitl14(device: str) -> torch.nn.Module:
|
| 51 |
+
+ repo = os.environ.get("DINOV2_REPO")
|
| 52 |
+
+ if not repo:
|
| 53 |
+
+ repo = str(Path(torch.hub.get_dir()) / "facebookresearch_dinov2_main")
|
| 54 |
+
+ repo_path = Path(repo)
|
| 55 |
+
+ if repo_path.exists():
|
| 56 |
+
+ logger.info(f"Loading DINOv2 ViT-L/14 from local torch hub repo: {repo_path}")
|
| 57 |
+
+ model = torch.hub.load(str(repo_path), "dinov2_vitl14", source="local", pretrained=True)
|
| 58 |
+
+ else:
|
| 59 |
+
+ logger.info("Loading DINOv2 ViT-L/14 from torch hub remote repo")
|
| 60 |
+
+ model = torch.hub.load(
|
| 61 |
+
+ "facebookresearch/dinov2",
|
| 62 |
+
+ "dinov2_vitl14",
|
| 63 |
+
+ pretrained=True,
|
| 64 |
+
+ skip_validation=True,
|
| 65 |
+
+ )
|
| 66 |
+
+ return model.to(device).eval().requires_grad_(False)
|
| 67 |
+
+
|
| 68 |
+
+
|
| 69 |
+
class PairMetrics(nn.Module):
|
| 70 |
+
"""Compute CLIP, DINOv2, SSIM metrics for source-target pairs."""
|
| 71 |
+
|
| 72 |
+
@@ -55,14 +85,15 @@ class PairMetrics(nn.Module):
|
| 73 |
+
|
| 74 |
+
# CLIP ViT-L/14
|
| 75 |
+
logger.info("Loading CLIP ViT-L/14...")
|
| 76 |
+
- self.clip_model, self.clip_preprocess = clip.load("ViT-L/14", device=device)
|
| 77 |
+
+ self.clip_model, self.clip_preprocess = clip.load(
|
| 78 |
+
+ "ViT-L/14", device=device, download_root=clip_download_root()
|
| 79 |
+
+ )
|
| 80 |
+
self.clip_model.eval().requires_grad_(False)
|
| 81 |
+
self.clip_size = 224
|
| 82 |
+
|
| 83 |
+
# DINOv2 ViT-L/14
|
| 84 |
+
logger.info("Loading DINOv2 ViT-L/14...")
|
| 85 |
+
- self.dinov2 = torch.hub.load("facebookresearch/dinov2", "dinov2_vitl14", pretrained=True)
|
| 86 |
+
- self.dinov2 = self.dinov2.to(device).eval().requires_grad_(False)
|
| 87 |
+
+ self.dinov2 = load_dinov2_vitl14(device)
|
| 88 |
+
|
| 89 |
+
self.register_buffer("clip_mean", torch.tensor((0.48145466, 0.4578275, 0.40821073)))
|
| 90 |
+
self.register_buffer("clip_std", torch.tensor((0.26862954, 0.26130258, 0.27577711)))
|
| 91 |
+
@@ -164,6 +195,11 @@ def parse_args():
|
| 92 |
+
ap.add_argument("--output-dir", required=True)
|
| 93 |
+
ap.add_argument("--device", default="cuda:0")
|
| 94 |
+
ap.add_argument("--id-field", default="item_id")
|
| 95 |
+
+ ap.add_argument("--source-fallback-field", default="source_image_abs",
|
| 96 |
+
+ help="Manifest field to use when a method directory has no {id}_source image. "
|
| 97 |
+
+ "Set empty to disable fallback.")
|
| 98 |
+
+ ap.add_argument("--shard-id", type=int, default=0)
|
| 99 |
+
+ ap.add_argument("--num-shards", type=int, default=1)
|
| 100 |
+
return ap.parse_args()
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
@@ -184,6 +220,13 @@ def main():
|
| 104 |
+
for line in f:
|
| 105 |
+
if line.strip():
|
| 106 |
+
eval_items.append(json.loads(line))
|
| 107 |
+
+ if args.num_shards > 1:
|
| 108 |
+
+ before = len(eval_items)
|
| 109 |
+
+ eval_items = [
|
| 110 |
+
+ item for item in eval_items
|
| 111 |
+
+ if int(hashlib.md5(str(item[args.id_field]).encode()).hexdigest(), 16) % args.num_shards == args.shard_id
|
| 112 |
+
+ ]
|
| 113 |
+
+ logger.info(f"Shard {args.shard_id}/{args.num_shards}: {len(eval_items)}/{before} items")
|
| 114 |
+
logger.info(f"Eval manifest: {len(eval_items)} items")
|
| 115 |
+
|
| 116 |
+
# Initialize metrics
|
| 117 |
+
@@ -203,6 +246,13 @@ def main():
|
| 118 |
+
src = find_image(method_dir, item_id, "source")
|
| 119 |
+
tgt = find_image(method_dir, item_id, "target")
|
| 120 |
+
|
| 121 |
+
+ if not src and args.source_fallback_field:
|
| 122 |
+
+ fallback = item.get(args.source_fallback_field, "")
|
| 123 |
+
+ if fallback:
|
| 124 |
+
+ fallback_path = Path(fallback)
|
| 125 |
+
+ if fallback_path.exists():
|
| 126 |
+
+ src = fallback_path
|
| 127 |
+
+
|
| 128 |
+
if not src or not tgt:
|
| 129 |
+
continue
|
| 130 |
+
|
| 131 |
+
diff --git a/scripts/eval_source_reconstruction.py b/scripts/eval_source_reconstruction.py
|
| 132 |
+
index 3f867ec..fb2e658 100644
|
| 133 |
+
--- a/scripts/eval_source_reconstruction.py
|
| 134 |
+
+++ b/scripts/eval_source_reconstruction.py
|
| 135 |
+
@@ -26,6 +26,7 @@ from __future__ import annotations
|
| 136 |
+
import argparse
|
| 137 |
+
import json
|
| 138 |
+
import logging
|
| 139 |
+
+import os
|
| 140 |
+
from pathlib import Path
|
| 141 |
+
|
| 142 |
+
import clip
|
| 143 |
+
@@ -44,18 +45,47 @@ logging.basicConfig(
|
| 144 |
+
logger = logging.getLogger(__name__)
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
+def clip_download_root() -> str | None:
|
| 148 |
+
+ root = os.environ.get("CLIP_CACHE_DIR")
|
| 149 |
+
+ if not root and os.environ.get("XDG_CACHE_HOME"):
|
| 150 |
+
+ root = str(Path(os.environ["XDG_CACHE_HOME"]) / "clip")
|
| 151 |
+
+ if root:
|
| 152 |
+
+ Path(root).mkdir(parents=True, exist_ok=True)
|
| 153 |
+
+ return root
|
| 154 |
+
+
|
| 155 |
+
+
|
| 156 |
+
+def load_dinov2_vitl14(device: str) -> torch.nn.Module:
|
| 157 |
+
+ repo = os.environ.get("DINOV2_REPO")
|
| 158 |
+
+ if not repo:
|
| 159 |
+
+ repo = str(Path(torch.hub.get_dir()) / "facebookresearch_dinov2_main")
|
| 160 |
+
+ repo_path = Path(repo)
|
| 161 |
+
+ if repo_path.exists():
|
| 162 |
+
+ logger.info(f"Loading DINOv2 ViT-L/14 from local torch hub repo: {repo_path}")
|
| 163 |
+
+ model = torch.hub.load(str(repo_path), "dinov2_vitl14", source="local", pretrained=True)
|
| 164 |
+
+ else:
|
| 165 |
+
+ logger.info("Loading DINOv2 ViT-L/14 from torch hub remote repo")
|
| 166 |
+
+ model = torch.hub.load(
|
| 167 |
+
+ "facebookresearch/dinov2",
|
| 168 |
+
+ "dinov2_vitl14",
|
| 169 |
+
+ pretrained=True,
|
| 170 |
+
+ skip_validation=True,
|
| 171 |
+
+ )
|
| 172 |
+
+ return model.to(device).eval().requires_grad_(False)
|
| 173 |
+
+
|
| 174 |
+
+
|
| 175 |
+
class ImageEncoders(nn.Module):
|
| 176 |
+
def __init__(self, device: str = "cuda:0"):
|
| 177 |
+
super().__init__()
|
| 178 |
+
self.device = device
|
| 179 |
+
|
| 180 |
+
logger.info("Loading CLIP ViT-L/14...")
|
| 181 |
+
- self.clip_model, _ = clip.load("ViT-L/14", device=device)
|
| 182 |
+
+ self.clip_model, _ = clip.load(
|
| 183 |
+
+ "ViT-L/14", device=device, download_root=clip_download_root()
|
| 184 |
+
+ )
|
| 185 |
+
self.clip_model.eval().requires_grad_(False)
|
| 186 |
+
|
| 187 |
+
logger.info("Loading DINOv2 ViT-L/14...")
|
| 188 |
+
- self.dinov2 = torch.hub.load("facebookresearch/dinov2", "dinov2_vitl14", pretrained=True)
|
| 189 |
+
- self.dinov2 = self.dinov2.to(device).eval().requires_grad_(False)
|
| 190 |
+
+ self.dinov2 = load_dinov2_vitl14(device)
|
| 191 |
+
|
| 192 |
+
self.register_buffer("clip_mean", torch.tensor((0.48145466, 0.4578275, 0.40821073)))
|
| 193 |
+
self.register_buffer("clip_std", torch.tensor((0.26862954, 0.26130258, 0.27577711)))
|
| 194 |
+
diff --git a/scripts/infer_9b_lora_twoframe_8gpu.sh b/scripts/infer_9b_lora_twoframe_8gpu.sh
|
| 195 |
+
old mode 100644
|
| 196 |
+
new mode 100755
|
| 197 |
+
diff --git a/scripts/infer_batch_condition.py b/scripts/infer_batch_condition.py
|
| 198 |
+
index 3aae26b..bd0564d 100644
|
| 199 |
+
--- a/scripts/infer_batch_condition.py
|
| 200 |
+
+++ b/scripts/infer_batch_condition.py
|
| 201 |
+
@@ -58,6 +58,10 @@ def parse_args() -> argparse.Namespace:
|
| 202 |
+
ap.add_argument("--output-dir", required=True, help="Output directory.")
|
| 203 |
+
# Model loading
|
| 204 |
+
ap.add_argument("--model-id", default="black-forest-labs/FLUX.2-klein-base-9B")
|
| 205 |
+
+ ap.add_argument("--base-model-root", default=None,
|
| 206 |
+
+ help="Local FLUX.2 klein base root. Sets KLEIN_9B_BASE_MODEL_ROOT.")
|
| 207 |
+
+ ap.add_argument("--require-local-base", action="store_true",
|
| 208 |
+
+ help="Fail if the requested local base root is missing.")
|
| 209 |
+
ap.add_argument("--lora", default=None, help="LoRA adapter path.")
|
| 210 |
+
ap.add_argument("--transformer-checkpoint", default=None,
|
| 211 |
+
help="Full transformer checkpoint dir (for full FT models).")
|
| 212 |
+
@@ -136,6 +140,17 @@ def main() -> None:
|
| 213 |
+
logger.info("Nothing to do.")
|
| 214 |
+
return
|
| 215 |
+
|
| 216 |
+
+ if args.base_model_root:
|
| 217 |
+
+ base_root = Path(args.base_model_root).expanduser()
|
| 218 |
+
+ if args.require_local_base and not base_root.exists():
|
| 219 |
+
+ raise FileNotFoundError(f"Local base model root not found: {base_root}")
|
| 220 |
+
+ os.environ["KLEIN_9B_BASE_MODEL_ROOT"] = str(base_root)
|
| 221 |
+
+ os.environ.setdefault(
|
| 222 |
+
+ "KLEIN_9B_BASE_MODEL_PATH",
|
| 223 |
+
+ str(base_root / "flux-2-klein-base-9b.safetensors"),
|
| 224 |
+
+ )
|
| 225 |
+
+ logger.info(f"Using local base model root: {base_root}")
|
| 226 |
+
+
|
| 227 |
+
# Setup device
|
| 228 |
+
device = torch.device(
|
| 229 |
+
f"cuda:{args.shard_id % torch.cuda.device_count()}"
|
| 230 |
+
diff --git a/scripts/infer_batch_multiframe.py b/scripts/infer_batch_multiframe.py
|
| 231 |
+
old mode 100644
|
| 232 |
+
new mode 100755
|
| 233 |
+
diff --git a/scripts/infer_batch_twoframe.py b/scripts/infer_batch_twoframe.py
|
| 234 |
+
old mode 100644
|
| 235 |
+
new mode 100755
|
| 236 |
+
index be33e67..605c77e
|
| 237 |
+
--- a/scripts/infer_batch_twoframe.py
|
| 238 |
+
+++ b/scripts/infer_batch_twoframe.py
|
| 239 |
+
@@ -38,6 +38,8 @@ def parse_args() -> argparse.Namespace:
|
| 240 |
+
ap.add_argument("--lora", default=None, help="LoRA adapter path (directory with adapter files).")
|
| 241 |
+
ap.add_argument("--transformer-checkpoint", default=None,
|
| 242 |
+
help="Full transformer checkpoint dir (for full FT models).")
|
| 243 |
+
+ ap.add_argument("--aux-path", default=None,
|
| 244 |
+
+ help="Optional twoframe_aux.{safetensors,pt}; defaults to searching the checkpoint/LoRA dir.")
|
| 245 |
+
ap.add_argument("--model-id", default="black-forest-labs/FLUX.2-klein-base-9B")
|
| 246 |
+
ap.add_argument("--steps", type=int, default=28)
|
| 247 |
+
ap.add_argument("--cfg", type=float, default=6.0)
|
| 248 |
+
@@ -65,6 +67,29 @@ def parse_args() -> argparse.Namespace:
|
| 249 |
+
return ap.parse_args()
|
| 250 |
+
|
| 251 |
+
|
| 252 |
+
+def find_aux_path(*roots: str | None) -> str | None:
|
| 253 |
+
+ """Find saved TwoFrame auxiliary embeddings next to a checkpoint/adapter."""
|
| 254 |
+
+ for root in roots:
|
| 255 |
+
+ if not root:
|
| 256 |
+
+ continue
|
| 257 |
+
+ path = Path(root).expanduser()
|
| 258 |
+
+ search_dir = path if path.is_dir() else path.parent
|
| 259 |
+
+ for name in ("twoframe_aux.safetensors", "twoframe_aux.pt"):
|
| 260 |
+
+ candidate = search_dir / name
|
| 261 |
+
+ if candidate.exists():
|
| 262 |
+
+ return str(candidate)
|
| 263 |
+
+ return None
|
| 264 |
+
+
|
| 265 |
+
+
|
| 266 |
+
+def format_twoframe_prompt(template: str, source_caption: str, instruction: str) -> str:
|
| 267 |
+
+ source_blocks = f"[Source Image 1]\n{source_caption or 'reference image 1'}"
|
| 268 |
+
+ return template.format(
|
| 269 |
+
+ source_caption=source_caption,
|
| 270 |
+
+ instruction=instruction,
|
| 271 |
+
+ source_blocks=source_blocks,
|
| 272 |
+
+ )
|
| 273 |
+
+
|
| 274 |
+
+
|
| 275 |
+
def shard_items(items: list[dict], shard_id: int, num_shards: int) -> list[dict]:
|
| 276 |
+
"""Hash-based sharding for deterministic distribution."""
|
| 277 |
+
if num_shards <= 1:
|
| 278 |
+
@@ -131,6 +156,10 @@ def main() -> None:
|
| 279 |
+
engine.load_lora(args.lora)
|
| 280 |
+
else:
|
| 281 |
+
logger.info("No adapter loaded — using base model.")
|
| 282 |
+
+ aux_candidate = args.aux_path or find_aux_path(args.transformer_checkpoint, args.lora)
|
| 283 |
+
+ if aux_candidate:
|
| 284 |
+
+ engine.load_twoframe_aux(aux_candidate)
|
| 285 |
+
+ logger.info(f"Loaded twoframe aux embeddings: {aux_candidate}")
|
| 286 |
+
logger.info("Model ready.")
|
| 287 |
+
|
| 288 |
+
need_negative = args.cfg > 1.0
|
| 289 |
+
@@ -145,12 +174,14 @@ def main() -> None:
|
| 290 |
+
|
| 291 |
+
try:
|
| 292 |
+
# Encode text (joint mode)
|
| 293 |
+
- merged_prompt = args.text_template.format(
|
| 294 |
+
- source_caption=source_caption,
|
| 295 |
+
- instruction=instruction,
|
| 296 |
+
- )
|
| 297 |
+
+ merged_prompt = format_twoframe_prompt(args.text_template, source_caption, instruction)
|
| 298 |
+
pos_embeds, text_ids = engine.encode_text_joint(
|
| 299 |
+
- [merged_prompt], text_t=args.text_t,
|
| 300 |
+
+ [merged_prompt],
|
| 301 |
+
+ text_t=args.text_t,
|
| 302 |
+
+ source_captions=[source_caption],
|
| 303 |
+
+ instructions=[instruction],
|
| 304 |
+
+ text_template=args.text_template,
|
| 305 |
+
+ strict_template=engine.extra_embed_strict_template,
|
| 306 |
+
)
|
| 307 |
+
neg_embeds = neg_text_ids = None
|
| 308 |
+
if need_negative:
|
| 309 |
+
diff --git a/scripts/infer_d10_mid_refresh.py b/scripts/infer_d10_mid_refresh.py
|
| 310 |
+
old mode 100644
|
| 311 |
+
new mode 100755
|
| 312 |
+
diff --git a/scripts/infer_d5_self_conditioning.py b/scripts/infer_d5_self_conditioning.py
|
| 313 |
+
old mode 100644
|
| 314 |
+
new mode 100755
|
| 315 |
+
diff --git a/scripts/infer_d8_oracle_clean_source.py b/scripts/infer_d8_oracle_clean_source.py
|
| 316 |
+
old mode 100644
|
| 317 |
+
new mode 100755
|
| 318 |
+
diff --git a/scripts/infer_d9_block_cfg.py b/scripts/infer_d9_block_cfg.py
|
| 319 |
+
old mode 100644
|
| 320 |
+
new mode 100755
|
| 321 |
+
diff --git a/scripts/infer_flux_klein_twoframe.py b/scripts/infer_flux_klein_twoframe.py
|
| 322 |
+
old mode 100644
|
| 323 |
+
new mode 100755
|
| 324 |
+
diff --git a/scripts/infer_twostep_baseline.py b/scripts/infer_twostep_baseline.py
|
| 325 |
+
old mode 100644
|
| 326 |
+
new mode 100755
|
| 327 |
+
index eb8f476..715410c
|
| 328 |
+
--- a/scripts/infer_twostep_baseline.py
|
| 329 |
+
+++ b/scripts/infer_twostep_baseline.py
|
| 330 |
+
@@ -66,6 +66,8 @@ def parse_args() -> argparse.Namespace:
|
| 331 |
+
ap.add_argument("--model-id", default="black-forest-labs/FLUX.2-klein-base-9B")
|
| 332 |
+
ap.add_argument("--edit-checkpoint", default=None,
|
| 333 |
+
help="Checkpoint for the edit step. None = use base model (M1→M1).")
|
| 334 |
+
+ ap.add_argument("--edit-aux-path", default=None,
|
| 335 |
+
+ help="Optional twoframe_aux.{safetensors,pt} for the edit checkpoint.")
|
| 336 |
+
# T2I step params
|
| 337 |
+
ap.add_argument("--steps-t2i", type=int, default=28)
|
| 338 |
+
ap.add_argument("--cfg-t2i", type=float, default=4.0)
|
| 339 |
+
@@ -95,6 +97,20 @@ def parse_args() -> argparse.Namespace:
|
| 340 |
+
return ap.parse_args()
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
+def find_aux_path(*roots: str | None) -> str | None:
|
| 344 |
+
+ """Find saved TwoFrame auxiliary embeddings next to a checkpoint/adapter."""
|
| 345 |
+
+ for root in roots:
|
| 346 |
+
+ if not root:
|
| 347 |
+
+ continue
|
| 348 |
+
+ path = Path(root).expanduser()
|
| 349 |
+
+ search_dir = path if path.is_dir() else path.parent
|
| 350 |
+
+ for name in ("twoframe_aux.safetensors", "twoframe_aux.pt"):
|
| 351 |
+
+ candidate = search_dir / name
|
| 352 |
+
+ if candidate.exists():
|
| 353 |
+
+ return str(candidate)
|
| 354 |
+
+ return None
|
| 355 |
+
+
|
| 356 |
+
+
|
| 357 |
+
def shard_items(items: list[dict], shard_id: int, num_shards: int) -> list[dict]:
|
| 358 |
+
if num_shards <= 1:
|
| 359 |
+
return items
|
| 360 |
+
@@ -244,6 +260,10 @@ def main() -> None:
|
| 361 |
+
logger.info(f"Loading edit checkpoint: {args.edit_checkpoint}")
|
| 362 |
+
n_miss, n_unexp = engine.load_flow_checkpoint(args.edit_checkpoint)
|
| 363 |
+
logger.info(f" missing={n_miss}, unexpected={n_unexp}")
|
| 364 |
+
+ aux_candidate = args.edit_aux_path or find_aux_path(args.edit_checkpoint)
|
| 365 |
+
+ if aux_candidate:
|
| 366 |
+
+ engine.load_twoframe_aux(aux_candidate)
|
| 367 |
+
+ logger.info(f"Loaded edit twoframe aux embeddings: {aux_candidate}")
|
| 368 |
+
|
| 369 |
+
# Re-encode negative for edit step
|
| 370 |
+
if need_negative:
|
| 371 |
+
@@ -282,7 +302,12 @@ def main() -> None:
|
| 372 |
+
source_caption=source_caption,
|
| 373 |
+
)
|
| 374 |
+
pos_embeds, text_ids = engine.encode_text_joint(
|
| 375 |
+
- [prompt], text_t=args.text_t,
|
| 376 |
+
+ [prompt],
|
| 377 |
+
+ text_t=args.text_t,
|
| 378 |
+
+ source_captions=[source_caption],
|
| 379 |
+
+ instructions=[instruction],
|
| 380 |
+
+ text_template=args.edit_text_template,
|
| 381 |
+
+ strict_template=engine.extra_embed_strict_template,
|
| 382 |
+
)
|
| 383 |
+
|
| 384 |
+
# Encode source as condition
|
| 385 |
+
diff --git a/scripts/make_multiframe_gallery.py b/scripts/make_multiframe_gallery.py
|
| 386 |
+
old mode 100644
|
| 387 |
+
new mode 100755
|
| 388 |
+
diff --git a/scripts/make_multiframe_probe_combo_html.py b/scripts/make_multiframe_probe_combo_html.py
|
| 389 |
+
old mode 100644
|
| 390 |
+
new mode 100755
|
| 391 |
+
diff --git a/scripts/make_multiframe_test100_html.py b/scripts/make_multiframe_test100_html.py
|
| 392 |
+
old mode 100644
|
| 393 |
+
new mode 100755
|
| 394 |
+
diff --git a/scripts/make_phase2_complex_highscore_html.py b/scripts/make_phase2_complex_highscore_html.py
|
| 395 |
+
old mode 100644
|
| 396 |
+
new mode 100755
|
| 397 |
+
diff --git a/scripts/make_reasoning_holdout500_html.py b/scripts/make_reasoning_holdout500_html.py
|
| 398 |
+
old mode 100644
|
| 399 |
+
new mode 100755
|
| 400 |
+
diff --git a/scripts/make_reasoning_holdout_sampled_html.py b/scripts/make_reasoning_holdout_sampled_html.py
|
| 401 |
+
old mode 100644
|
| 402 |
+
new mode 100755
|
| 403 |
+
diff --git a/scripts/make_reasoning_sample_html.py b/scripts/make_reasoning_sample_html.py
|
| 404 |
+
old mode 100644
|
| 405 |
+
new mode 100755
|
| 406 |
+
diff --git a/scripts/measure_pair_consistency.py b/scripts/measure_pair_consistency.py
|
| 407 |
+
old mode 100644
|
| 408 |
+
new mode 100755
|
| 409 |
+
diff --git a/scripts/phase_b_master_loop.sh b/scripts/phase_b_master_loop.sh
|
| 410 |
+
old mode 100644
|
| 411 |
+
new mode 100755
|
| 412 |
+
diff --git a/scripts/phase_b_status_emit.sh b/scripts/phase_b_status_emit.sh
|
| 413 |
+
old mode 100644
|
| 414 |
+
new mode 100755
|
| 415 |
+
diff --git a/scripts/phase_b_watchdog.sh b/scripts/phase_b_watchdog.sh
|
| 416 |
+
old mode 100644
|
| 417 |
+
new mode 100755
|
| 418 |
+
diff --git a/scripts/phase_c_status.sh b/scripts/phase_c_status.sh
|
| 419 |
+
old mode 100644
|
| 420 |
+
new mode 100755
|
| 421 |
+
diff --git a/scripts/precompute_flux2_vae_cache.py b/scripts/precompute_flux2_vae_cache.py
|
| 422 |
+
old mode 100644
|
| 423 |
+
new mode 100755
|
| 424 |
+
diff --git a/scripts/precompute_flux2_vae_cache_8gpu.sh b/scripts/precompute_flux2_vae_cache_8gpu.sh
|
| 425 |
+
old mode 100644
|
| 426 |
+
new mode 100755
|
| 427 |
+
diff --git a/scripts/prepare_benchmark_manifests.py b/scripts/prepare_benchmark_manifests.py
|
| 428 |
+
old mode 100644
|
| 429 |
+
new mode 100755
|
| 430 |
+
diff --git a/scripts/prepare_ccb_c8_manifest.py b/scripts/prepare_ccb_c8_manifest.py
|
| 431 |
+
old mode 100644
|
| 432 |
+
new mode 100755
|
| 433 |
+
diff --git a/scripts/prepare_eval_manifests.py b/scripts/prepare_eval_manifests.py
|
| 434 |
+
old mode 100644
|
| 435 |
+
new mode 100755
|
| 436 |
+
diff --git a/scripts/prepare_phase_a_manifests.py b/scripts/prepare_phase_a_manifests.py
|
| 437 |
+
old mode 100644
|
| 438 |
+
new mode 100755
|
| 439 |
+
diff --git a/scripts/prepare_reasoning_holdout_infer_manifest.py b/scripts/prepare_reasoning_holdout_infer_manifest.py
|
| 440 |
+
old mode 100644
|
| 441 |
+
new mode 100755
|
| 442 |
+
diff --git a/scripts/prepare_reasoning_holdout_test_manifest.py b/scripts/prepare_reasoning_holdout_test_manifest.py
|
| 443 |
+
old mode 100644
|
| 444 |
+
new mode 100755
|
| 445 |
+
diff --git a/scripts/prepare_reasoning_manifest.py b/scripts/prepare_reasoning_manifest.py
|
| 446 |
+
old mode 100644
|
| 447 |
+
new mode 100755
|
| 448 |
+
diff --git a/scripts/prepare_short_instruction_manifests.py b/scripts/prepare_short_instruction_manifests.py
|
| 449 |
+
old mode 100644
|
| 450 |
+
new mode 100755
|
| 451 |
+
diff --git a/scripts/run0_sonnet_select.py b/scripts/run0_sonnet_select.py
|
| 452 |
+
old mode 100644
|
| 453 |
+
new mode 100755
|
| 454 |
+
diff --git a/scripts/run_all_eval.sh b/scripts/run_all_eval.sh
|
| 455 |
+
old mode 100644
|
| 456 |
+
new mode 100755
|
| 457 |
+
diff --git a/scripts/run_all_inference_machine_a.sh b/scripts/run_all_inference_machine_a.sh
|
| 458 |
+
old mode 100644
|
| 459 |
+
new mode 100755
|
| 460 |
+
diff --git a/scripts/run_d11_real_source_eval.sh b/scripts/run_d11_real_source_eval.sh
|
| 461 |
+
old mode 100644
|
| 462 |
+
new mode 100755
|
| 463 |
+
diff --git a/scripts/run_d1_d2_d3.sh b/scripts/run_d1_d2_d3.sh
|
| 464 |
+
old mode 100644
|
| 465 |
+
new mode 100755
|
| 466 |
+
diff --git a/scripts/run_d4_failure_taxonomy.sh b/scripts/run_d4_failure_taxonomy.sh
|
| 467 |
+
old mode 100644
|
| 468 |
+
new mode 100755
|
| 469 |
+
diff --git a/scripts/run_d5_self_conditioning.sh b/scripts/run_d5_self_conditioning.sh
|
| 470 |
+
old mode 100644
|
| 471 |
+
new mode 100755
|
| 472 |
+
diff --git a/scripts/run_d6_structured_joint.sh b/scripts/run_d6_structured_joint.sh
|
| 473 |
+
old mode 100644
|
| 474 |
+
new mode 100755
|
| 475 |
+
diff --git a/scripts/run_d7_text_factorization.sh b/scripts/run_d7_text_factorization.sh
|
| 476 |
+
old mode 100644
|
| 477 |
+
new mode 100755
|
| 478 |
+
diff --git a/scripts/run_d8_oracle.sh b/scripts/run_d8_oracle.sh
|
| 479 |
+
old mode 100644
|
| 480 |
+
new mode 100755
|
| 481 |
+
diff --git a/scripts/run_eval_data_quality_6jobs.sh b/scripts/run_eval_data_quality_6jobs.sh
|
| 482 |
+
old mode 100644
|
| 483 |
+
new mode 100755
|
| 484 |
+
diff --git a/scripts/run_eval_imgedit_gedit_mode.sh b/scripts/run_eval_imgedit_gedit_mode.sh
|
| 485 |
+
old mode 100644
|
| 486 |
+
new mode 100755
|
| 487 |
+
diff --git a/scripts/run_eval_machine_a_m3source_wait_m2.sh b/scripts/run_eval_machine_a_m3source_wait_m2.sh
|
| 488 |
+
old mode 100644
|
| 489 |
+
new mode 100755
|
| 490 |
+
diff --git a/scripts/run_eval_machine_a_scoring.sh b/scripts/run_eval_machine_a_scoring.sh
|
| 491 |
+
old mode 100644
|
| 492 |
+
new mode 100755
|
| 493 |
+
diff --git a/scripts/run_eval_machine_a_stage1.sh b/scripts/run_eval_machine_a_stage1.sh
|
| 494 |
+
old mode 100644
|
| 495 |
+
new mode 100755
|
| 496 |
+
diff --git a/scripts/run_eval_machine_c_imgedit.sh b/scripts/run_eval_machine_c_imgedit.sh
|
| 497 |
+
old mode 100644
|
| 498 |
+
new mode 100755
|
| 499 |
+
diff --git a/scripts/run_eval_machine_d_gedit.sh b/scripts/run_eval_machine_d_gedit.sh
|
| 500 |
+
old mode 100644
|
| 501 |
+
new mode 100755
|
| 502 |
+
diff --git a/scripts/run_exp_k_machine_b_eval.sh b/scripts/run_exp_k_machine_b_eval.sh
|
| 503 |
+
old mode 100644
|
| 504 |
+
new mode 100755
|
| 505 |
+
diff --git a/scripts/run_exp_k_machine_b_infer.sh b/scripts/run_exp_k_machine_b_infer.sh
|
| 506 |
+
old mode 100644
|
| 507 |
+
new mode 100755
|
| 508 |
+
diff --git a/scripts/run_generate_twoframe_complex_22k_cfg7_ckpt35k.sh b/scripts/run_generate_twoframe_complex_22k_cfg7_ckpt35k.sh
|
| 509 |
+
old mode 100644
|
| 510 |
+
new mode 100755
|
| 511 |
+
diff --git a/scripts/run_infer_c2_8gpu.sh b/scripts/run_infer_c2_8gpu.sh
|
| 512 |
+
old mode 100644
|
| 513 |
+
new mode 100755
|
| 514 |
+
diff --git a/scripts/run_infer_c3_8gpu.sh b/scripts/run_infer_c3_8gpu.sh
|
| 515 |
+
old mode 100644
|
| 516 |
+
new mode 100755
|
| 517 |
+
diff --git a/scripts/run_infer_c4_8gpu.sh b/scripts/run_infer_c4_8gpu.sh
|
| 518 |
+
old mode 100644
|
| 519 |
+
new mode 100755
|
| 520 |
+
diff --git a/scripts/run_infer_node_consolidated_until_done.sh b/scripts/run_infer_node_consolidated_until_done.sh
|
| 521 |
+
old mode 100644
|
| 522 |
+
new mode 100755
|
| 523 |
+
diff --git a/scripts/run_m2new_infer_eval.sh b/scripts/run_m2new_infer_eval.sh
|
| 524 |
+
old mode 100644
|
| 525 |
+
new mode 100755
|
| 526 |
+
diff --git a/scripts/run_m3_cfg7_only.sh b/scripts/run_m3_cfg7_only.sh
|
| 527 |
+
old mode 100644
|
| 528 |
+
new mode 100755
|
| 529 |
+
diff --git a/scripts/run_m3_s50_eval.sh b/scripts/run_m3_s50_eval.sh
|
| 530 |
+
old mode 100644
|
| 531 |
+
new mode 100755
|
| 532 |
+
diff --git a/scripts/run_m3ft_35000_8gpu.sh b/scripts/run_m3ft_35000_8gpu.sh
|
| 533 |
+
old mode 100644
|
| 534 |
+
new mode 100755
|
| 535 |
+
diff --git a/scripts/run_m3ft_inference.sh b/scripts/run_m3ft_inference.sh
|
| 536 |
+
old mode 100644
|
| 537 |
+
new mode 100755
|
| 538 |
+
diff --git a/scripts/run_m3ft_missing_resume.sh b/scripts/run_m3ft_missing_resume.sh
|
| 539 |
+
old mode 100644
|
| 540 |
+
new mode 100755
|
| 541 |
+
diff --git a/scripts/run_m3ft_resume60k.sh b/scripts/run_m3ft_resume60k.sh
|
| 542 |
+
old mode 100644
|
| 543 |
+
new mode 100755
|
| 544 |
+
diff --git a/scripts/run_m3ft_sweep_eval.sh b/scripts/run_m3ft_sweep_eval.sh
|
| 545 |
+
old mode 100644
|
| 546 |
+
new mode 100755
|
| 547 |
+
diff --git a/scripts/run_m3source_round_end2end.sh b/scripts/run_m3source_round_end2end.sh
|
| 548 |
+
old mode 100644
|
| 549 |
+
new mode 100755
|
| 550 |
+
diff --git a/scripts/run_machine_a_eval.sh b/scripts/run_machine_a_eval.sh
|
| 551 |
+
old mode 100644
|
| 552 |
+
new mode 100755
|
| 553 |
+
diff --git a/scripts/run_machine_a_infer.sh b/scripts/run_machine_a_infer.sh
|
| 554 |
+
old mode 100644
|
| 555 |
+
new mode 100755
|
| 556 |
+
diff --git a/scripts/run_machine_b_distilled_train.sh b/scripts/run_machine_b_distilled_train.sh
|
| 557 |
+
old mode 100644
|
| 558 |
+
new mode 100755
|
| 559 |
+
diff --git a/scripts/run_machine_b_distilled_train_local.sh b/scripts/run_machine_b_distilled_train_local.sh
|
| 560 |
+
old mode 100644
|
| 561 |
+
new mode 100755
|
| 562 |
+
diff --git a/scripts/run_missing_inference_resume.sh b/scripts/run_missing_inference_resume.sh
|
| 563 |
+
old mode 100644
|
| 564 |
+
new mode 100755
|
| 565 |
+
diff --git a/scripts/run_missing_machine_a.sh b/scripts/run_missing_machine_a.sh
|
| 566 |
+
old mode 100644
|
| 567 |
+
new mode 100755
|
| 568 |
+
diff --git a/scripts/run_missing_machine_a_m1_rewrite.sh b/scripts/run_missing_machine_a_m1_rewrite.sh
|
| 569 |
+
old mode 100644
|
| 570 |
+
new mode 100755
|
| 571 |
+
diff --git a/scripts/run_missing_machine_b.sh b/scripts/run_missing_machine_b.sh
|
| 572 |
+
old mode 100644
|
| 573 |
+
new mode 100755
|
| 574 |
+
diff --git a/scripts/run_multiframe_4img_probe10.sh b/scripts/run_multiframe_4img_probe10.sh
|
| 575 |
+
old mode 100644
|
| 576 |
+
new mode 100755
|
| 577 |
+
diff --git a/scripts/run_multiframe_resample100.sh b/scripts/run_multiframe_resample100.sh
|
| 578 |
+
old mode 100644
|
| 579 |
+
new mode 100755
|
| 580 |
+
diff --git a/scripts/run_multiframe_smoke_1gpu.sh b/scripts/run_multiframe_smoke_1gpu.sh
|
| 581 |
+
old mode 100644
|
| 582 |
+
new mode 100755
|
| 583 |
+
diff --git a/scripts/run_multiframe_smoke_8gpu.sh b/scripts/run_multiframe_smoke_8gpu.sh
|
| 584 |
+
old mode 100644
|
| 585 |
+
new mode 100755
|
| 586 |
+
diff --git a/scripts/run_multiframe_smoke_8gpu_debug.sh b/scripts/run_multiframe_smoke_8gpu_debug.sh
|
| 587 |
+
old mode 100644
|
| 588 |
+
new mode 100755
|
| 589 |
+
diff --git a/scripts/run_multiframe_test100.sh b/scripts/run_multiframe_test100.sh
|
| 590 |
+
old mode 100644
|
| 591 |
+
new mode 100755
|
| 592 |
+
diff --git a/scripts/run_multiframe_test100_latest_when_free.sh b/scripts/run_multiframe_test100_latest_when_free.sh
|
| 593 |
+
old mode 100644
|
| 594 |
+
new mode 100755
|
| 595 |
+
diff --git a/scripts/run_multiframe_train.sh b/scripts/run_multiframe_train.sh
|
| 596 |
+
old mode 100644
|
| 597 |
+
new mode 100755
|
| 598 |
+
diff --git a/scripts/run_phase2_refilter_4jobs.sh b/scripts/run_phase2_refilter_4jobs.sh
|
| 599 |
+
old mode 100644
|
| 600 |
+
new mode 100755
|
| 601 |
+
diff --git a/scripts/run_phase_a.sh b/scripts/run_phase_a.sh
|
| 602 |
+
old mode 100644
|
| 603 |
+
new mode 100755
|
| 604 |
+
diff --git a/scripts/run_phase_a_eval.sh b/scripts/run_phase_a_eval.sh
|
| 605 |
+
old mode 100644
|
| 606 |
+
new mode 100755
|
| 607 |
+
diff --git a/scripts/run_phase_a_eval_parallel.sh b/scripts/run_phase_a_eval_parallel.sh
|
| 608 |
+
old mode 100644
|
| 609 |
+
new mode 100755
|
| 610 |
+
diff --git a/scripts/run_phase_a_mllm_eval_sonnet46.sh b/scripts/run_phase_a_mllm_eval_sonnet46.sh
|
| 611 |
+
old mode 100644
|
| 612 |
+
new mode 100755
|
| 613 |
+
diff --git a/scripts/run_phase_b_eval_all.sh b/scripts/run_phase_b_eval_all.sh
|
| 614 |
+
old mode 100644
|
| 615 |
+
new mode 100755
|
| 616 |
+
diff --git a/scripts/run_phase_c.sh b/scripts/run_phase_c.sh
|
| 617 |
+
old mode 100644
|
| 618 |
+
new mode 100755
|
| 619 |
+
diff --git a/scripts/run_reasoning_holdout500_infer.sh b/scripts/run_reasoning_holdout500_infer.sh
|
| 620 |
+
old mode 100644
|
| 621 |
+
new mode 100755
|
| 622 |
+
diff --git a/scripts/run_reasoning_probe.sh b/scripts/run_reasoning_probe.sh
|
| 623 |
+
old mode 100644
|
| 624 |
+
new mode 100755
|
| 625 |
+
diff --git a/scripts/run_reasoning_train.sh b/scripts/run_reasoning_train.sh
|
| 626 |
+
old mode 100644
|
| 627 |
+
new mode 100755
|
| 628 |
+
diff --git a/scripts/run_rewrite_structured.sh b/scripts/run_rewrite_structured.sh
|
| 629 |
+
old mode 100644
|
| 630 |
+
new mode 100755
|
| 631 |
+
diff --git a/scripts/run_rich_caption_probe.sh b/scripts/run_rich_caption_probe.sh
|
| 632 |
+
old mode 100644
|
| 633 |
+
new mode 100755
|
| 634 |
+
diff --git a/scripts/run_unified_cfg4_test.sh b/scripts/run_unified_cfg4_test.sh
|
| 635 |
+
old mode 100644
|
| 636 |
+
new mode 100755
|
| 637 |
+
diff --git a/scripts/run_v2_instr_filter_2jobs.sh b/scripts/run_v2_instr_filter_2jobs.sh
|
| 638 |
+
old mode 100644
|
| 639 |
+
new mode 100755
|
| 640 |
+
diff --git a/scripts/run_watchdog_1h.sh b/scripts/run_watchdog_1h.sh
|
| 641 |
+
old mode 100644
|
| 642 |
+
new mode 100755
|
| 643 |
+
diff --git a/scripts/sample_multiframe_4img_probe10.py b/scripts/sample_multiframe_4img_probe10.py
|
| 644 |
+
old mode 100644
|
| 645 |
+
new mode 100755
|
| 646 |
+
diff --git a/scripts/sample_multiframe_resample100.py b/scripts/sample_multiframe_resample100.py
|
| 647 |
+
old mode 100644
|
| 648 |
+
new mode 100755
|
| 649 |
+
diff --git a/scripts/switch_current_to_machine_b.sh b/scripts/switch_current_to_machine_b.sh
|
| 650 |
+
old mode 100644
|
| 651 |
+
new mode 100755
|
| 652 |
+
diff --git a/scripts/train_4b_base_editlong_pico400k_train20k_bs2_lr1e5_vae_cache_zero2.sh b/scripts/train_4b_base_editlong_pico400k_train20k_bs2_lr1e5_vae_cache_zero2.sh
|
| 653 |
+
old mode 100644
|
| 654 |
+
new mode 100755
|
| 655 |
+
diff --git a/scripts/train_4b_full.sh b/scripts/train_4b_full.sh
|
| 656 |
+
old mode 100644
|
| 657 |
+
new mode 100755
|
| 658 |
+
diff --git a/scripts/train_4b_full_pico400k_opusstage2_long_train20k_bs2_lr1e5_jointtext_t0_zero2.sh b/scripts/train_4b_full_pico400k_opusstage2_long_train20k_bs2_lr1e5_jointtext_t0_zero2.sh
|
| 659 |
+
old mode 100644
|
| 660 |
+
new mode 100755
|
| 661 |
+
diff --git a/scripts/train_4b_full_pico400k_short_train20k_bs2_lr1e5_cfgdrop0.sh b/scripts/train_4b_full_pico400k_short_train20k_bs2_lr1e5_cfgdrop0.sh
|
| 662 |
+
old mode 100644
|
| 663 |
+
new mode 100755
|
| 664 |
+
diff --git a/scripts/train_4b_full_pico400k_short_train20k_bs2_lr1e5_cfgdrop0_zero2.sh b/scripts/train_4b_full_pico400k_short_train20k_bs2_lr1e5_cfgdrop0_zero2.sh
|
| 665 |
+
old mode 100644
|
| 666 |
+
new mode 100755
|
| 667 |
+
diff --git a/scripts/train_4b_full_pico400k_short_train20k_bs2_lr1e5_jointtext_t0_zero2.sh b/scripts/train_4b_full_pico400k_short_train20k_bs2_lr1e5_jointtext_t0_zero2.sh
|
| 668 |
+
old mode 100644
|
| 669 |
+
new mode 100755
|
| 670 |
+
diff --git a/scripts/train_4b_full_pico400k_short_zero2_smoke.sh b/scripts/train_4b_full_pico400k_short_zero2_smoke.sh
|
| 671 |
+
old mode 100644
|
| 672 |
+
new mode 100755
|
| 673 |
+
diff --git a/scripts/train_4b_lora.sh b/scripts/train_4b_lora.sh
|
| 674 |
+
old mode 100644
|
| 675 |
+
new mode 100755
|
| 676 |
+
diff --git a/scripts/train_4b_lora_moe_prodigy_pico400k_short_jointtext_t0_bs2_zero2.sh b/scripts/train_4b_lora_moe_prodigy_pico400k_short_jointtext_t0_bs2_zero2.sh
|
| 677 |
+
old mode 100644
|
| 678 |
+
new mode 100755
|
| 679 |
+
diff --git a/scripts/train_9b_base_editlong_pico400k_train20k_bs2_lr1e6_vae_cache_zero2.sh b/scripts/train_9b_base_editlong_pico400k_train20k_bs2_lr1e6_vae_cache_zero2.sh
|
| 680 |
+
old mode 100644
|
| 681 |
+
new mode 100755
|
| 682 |
+
diff --git a/scripts/train_9b_full.sh b/scripts/train_9b_full.sh
|
| 683 |
+
old mode 100644
|
| 684 |
+
new mode 100755
|
| 685 |
+
diff --git a/scripts/train_9b_full_direct_edit_baseline_zero2.sh b/scripts/train_9b_full_direct_edit_baseline_zero2.sh
|
| 686 |
+
old mode 100644
|
| 687 |
+
new mode 100755
|
| 688 |
+
diff --git a/scripts/train_9b_full_direct_edit_baseline_zero3.sh b/scripts/train_9b_full_direct_edit_baseline_zero3.sh
|
| 689 |
+
old mode 100644
|
| 690 |
+
new mode 100755
|
| 691 |
+
diff --git a/scripts/train_9b_full_pico400k_opusstage2_long_train20k_bs2_lr1e6_jointtext_t0_zero2.sh b/scripts/train_9b_full_pico400k_opusstage2_long_train20k_bs2_lr1e6_jointtext_t0_zero2.sh
|
| 692 |
+
old mode 100644
|
| 693 |
+
new mode 100755
|
| 694 |
+
diff --git a/scripts/train_9b_full_pico57k_corner10k_long_jointtext_zero2.sh b/scripts/train_9b_full_pico57k_corner10k_long_jointtext_zero2.sh
|
| 695 |
+
old mode 100644
|
| 696 |
+
new mode 100755
|
| 697 |
+
diff --git a/scripts/train_9b_full_pico57k_corner10k_long_jointtext_zero3.sh b/scripts/train_9b_full_pico57k_corner10k_long_jointtext_zero3.sh
|
| 698 |
+
old mode 100644
|
| 699 |
+
new mode 100755
|
| 700 |
+
diff --git a/scripts/train_9b_full_twoframe_lr5e6_zero2.sh b/scripts/train_9b_full_twoframe_lr5e6_zero2.sh
|
| 701 |
+
old mode 100644
|
| 702 |
+
new mode 100755
|
| 703 |
+
diff --git a/scripts/train_9b_lora.sh b/scripts/train_9b_lora.sh
|
| 704 |
+
old mode 100644
|
| 705 |
+
new mode 100755
|
| 706 |
+
diff --git a/scripts/train_9b_lora_downstream_edit_combined_zero2.sh b/scripts/train_9b_lora_downstream_edit_combined_zero2.sh
|
| 707 |
+
old mode 100644
|
| 708 |
+
new mode 100755
|
| 709 |
+
diff --git a/scripts/train_9b_lora_downstream_edit_phase2_zero2.sh b/scripts/train_9b_lora_downstream_edit_phase2_zero2.sh
|
| 710 |
+
old mode 100644
|
| 711 |
+
new mode 100755
|
| 712 |
+
diff --git a/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_fluxfill_icedittargets_zero2.sh b/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_fluxfill_icedittargets_zero2.sh
|
| 713 |
+
old mode 100644
|
| 714 |
+
new mode 100755
|
| 715 |
+
diff --git a/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_simpletuner_flux2targets_zero2.sh b/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_simpletuner_flux2targets_zero2.sh
|
| 716 |
+
old mode 100644
|
| 717 |
+
new mode 100755
|
| 718 |
+
diff --git a/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_zero2.sh b/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_zero2.sh
|
| 719 |
+
old mode 100644
|
| 720 |
+
new mode 100755
|
| 721 |
+
diff --git a/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_zero3.sh b/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_zero3.sh
|
| 722 |
+
old mode 100644
|
| 723 |
+
new mode 100755
|
| 724 |
+
diff --git a/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_zero2.sh b/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_gc40k_zero2.sh
|
| 725 |
+
old mode 100644
|
| 726 |
+
new mode 100755
|
| 727 |
+
diff --git a/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_nogc_zero2.sh b/scripts/train_9b_lora_moe_prodigy_finalmix80k_long_no_latent_nogc_zero2.sh
|
| 728 |
+
old mode 100644
|
| 729 |
+
new mode 100755
|
| 730 |
+
diff --git a/scripts/train_9b_lora_moe_prodigy_finalmix80k_short_no_latent_nogc_zero2.sh b/scripts/train_9b_lora_moe_prodigy_finalmix80k_short_no_latent_nogc_zero2.sh
|
| 731 |
+
old mode 100644
|
| 732 |
+
new mode 100755
|
| 733 |
+
diff --git a/scripts/train_9b_lora_moe_prodigy_pico400k_long_jointtext_t0_bs2_zero2.sh b/scripts/train_9b_lora_moe_prodigy_pico400k_long_jointtext_t0_bs2_zero2.sh
|
| 734 |
+
old mode 100644
|
| 735 |
+
new mode 100755
|
| 736 |
+
diff --git a/scripts/train_9b_lora_pico57k_corner10k_long_jointtext_zero2.sh b/scripts/train_9b_lora_pico57k_corner10k_long_jointtext_zero2.sh
|
| 737 |
+
old mode 100644
|
| 738 |
+
new mode 100755
|
| 739 |
+
diff --git a/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_smoke_zero2.sh b/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_smoke_zero2.sh
|
| 740 |
+
old mode 100644
|
| 741 |
+
new mode 100755
|
| 742 |
+
diff --git a/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_full40k_zero2.sh b/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_full40k_zero2.sh
|
| 743 |
+
old mode 100644
|
| 744 |
+
new mode 100755
|
| 745 |
+
diff --git a/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_textimgemb_full25k_zero2.sh b/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_textimgemb_full25k_zero2.sh
|
| 746 |
+
old mode 100644
|
| 747 |
+
new mode 100755
|
| 748 |
+
diff --git a/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_zero2.sh b/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_zero2.sh
|
| 749 |
+
old mode 100644
|
| 750 |
+
new mode 100755
|
| 751 |
+
diff --git a/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_v1_zero2.sh b/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_jointtext_t0_cache40k_bs1ga2_routing_v1_zero2.sh
|
| 752 |
+
old mode 100644
|
| 753 |
+
new mode 100755
|
| 754 |
+
diff --git a/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_icedit6targets_zero2.sh b/scripts/train_9b_lora_standard_prodigy_finalmix80k_long_no_latent_gc40k_bs1ga2_icedit6targets_zero2.sh
|
| 755 |
+
old mode 100644
|
| 756 |
+
new mode 100755
|
| 757 |
+
diff --git a/scripts/train_9b_lora_standard_prodigy_finalmix80k_short_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_full40k_node2_zero2.sh b/scripts/train_9b_lora_standard_prodigy_finalmix80k_short_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_full40k_node2_zero2.sh
|
| 758 |
+
old mode 100644
|
| 759 |
+
new mode 100755
|
| 760 |
+
diff --git a/scripts/train_9b_lora_standard_prodigy_finalmix80k_short_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_full40k_zero2.sh b/scripts/train_9b_lora_standard_prodigy_finalmix80k_short_jointtext_t0_cache40k_bs1ga2_routing_render_mod_v2_gcfix_strictoff_full40k_zero2.sh
|
| 761 |
+
old mode 100644
|
| 762 |
+
new mode 100755
|
| 763 |
+
diff --git a/scripts/train_9b_lora_standard_prodigy_pico400k_long_jointtext_t0_bs1ga2_icedit6targets_vae_cache_zero2.sh b/scripts/train_9b_lora_standard_prodigy_pico400k_long_jointtext_t0_bs1ga2_icedit6targets_vae_cache_zero2.sh
|
| 764 |
+
old mode 100644
|
| 765 |
+
new mode 100755
|
| 766 |
+
diff --git a/scripts/train_exp_e_phase2_only.sh b/scripts/train_exp_e_phase2_only.sh
|
| 767 |
+
old mode 100644
|
| 768 |
+
new mode 100755
|
| 769 |
+
diff --git a/scripts/train_exp_f_phase2_pico.sh b/scripts/train_exp_f_phase2_pico.sh
|
| 770 |
+
old mode 100644
|
| 771 |
+
new mode 100755
|
| 772 |
+
diff --git a/scripts/train_exp_g_phase2_all.sh b/scripts/train_exp_g_phase2_all.sh
|
| 773 |
+
old mode 100644
|
| 774 |
+
new mode 100755
|
| 775 |
+
diff --git a/scripts/wait_then_resume_m3ft60k.sh b/scripts/wait_then_resume_m3ft60k.sh
|
| 776 |
+
old mode 100644
|
| 777 |
+
new mode 100755
|
| 778 |
+
diff --git a/scripts/wait_then_run_multiframe_4img_probe10.sh b/scripts/wait_then_run_multiframe_4img_probe10.sh
|
| 779 |
+
old mode 100644
|
| 780 |
+
new mode 100755
|
| 781 |
+
diff --git a/scripts/watch_and_run_m3ft_sweep.sh b/scripts/watch_and_run_m3ft_sweep.sh
|
| 782 |
+
old mode 100644
|
| 783 |
+
new mode 100755
|
| 784 |
+
diff --git a/scripts/watch_m3ft_35000_launch.sh b/scripts/watch_m3ft_35000_launch.sh
|
| 785 |
+
old mode 100644
|
| 786 |
+
new mode 100755
|
| 787 |
+
diff --git a/train.py b/train.py
|
| 788 |
+
index f7f193e..ab21282 100644
|
| 789 |
+
--- a/train.py
|
| 790 |
+
+++ b/train.py
|
| 791 |
+
@@ -5,6 +5,7 @@ import argparse
|
| 792 |
+
import inspect
|
| 793 |
+
import json
|
| 794 |
+
import os
|
| 795 |
+
+import random
|
| 796 |
+
import time
|
| 797 |
+
from pathlib import Path
|
| 798 |
+
|
| 799 |
+
@@ -16,6 +17,11 @@ from torch.utils.data import DataLoader
|
| 800 |
+
from tqdm.auto import tqdm
|
| 801 |
+
|
| 802 |
+
from twoframe.data import TwoFrameEditingDataset, collate_fn
|
| 803 |
+
+from twoframe.data_bucketed import (
|
| 804 |
+
+ BucketedFrameDataset,
|
| 805 |
+
+ DistributedBucketBatchSampler,
|
| 806 |
+
+ bucketed_frame_collate_fn,
|
| 807 |
+
+)
|
| 808 |
+
from twoframe.data_multiframe import MultiFrameEditingDataset, multiframe_collate_fn
|
| 809 |
+
from twoframe.modeling import FluxKleinTwoFrame, count_parameters
|
| 810 |
+
|
| 811 |
+
@@ -31,12 +37,24 @@ def apply_env_overrides(cfg: dict) -> dict:
|
| 812 |
+
cfg["training"]["mixed_precision"] = os.environ["MIXED_PRECISION"]
|
| 813 |
+
if os.getenv("GRADIENT_ACCUMULATION"):
|
| 814 |
+
cfg["training"]["gradient_accumulation_steps"] = int(os.environ["GRADIENT_ACCUMULATION"])
|
| 815 |
+
+ if os.getenv("PER_GPU_BATCH_SIZE"):
|
| 816 |
+
+ cfg["training"]["per_gpu_batch_size"] = int(os.environ["PER_GPU_BATCH_SIZE"])
|
| 817 |
+
if os.getenv("GRAD_CLIP"):
|
| 818 |
+
cfg["training"]["max_grad_norm"] = float(os.environ["GRAD_CLIP"])
|
| 819 |
+
if os.getenv("SAVE_EVERY"):
|
| 820 |
+
cfg["training"]["save_every"] = int(os.environ["SAVE_EVERY"])
|
| 821 |
+
+ if os.getenv("LOG_EVERY"):
|
| 822 |
+
+ cfg["training"]["log_every"] = int(os.environ["LOG_EVERY"])
|
| 823 |
+
if os.getenv("MAX_STEPS"):
|
| 824 |
+
cfg["training"]["max_steps"] = int(os.environ["MAX_STEPS"])
|
| 825 |
+
+ if os.getenv("LOAD_TRAINABLE_CHECKPOINT"):
|
| 826 |
+
+ cfg["training"]["load_trainable_checkpoint"] = os.environ["LOAD_TRAINABLE_CHECKPOINT"]
|
| 827 |
+
+ if os.getenv("RESUME_FROM"):
|
| 828 |
+
+ cfg["training"]["resume_from"] = os.environ["RESUME_FROM"]
|
| 829 |
+
+ if os.getenv("OUT"):
|
| 830 |
+
+ cfg["training"]["output_dir"] = os.environ["OUT"]
|
| 831 |
+
+ if os.getenv("OUTPUT_DIR"):
|
| 832 |
+
+ cfg["training"]["output_dir"] = os.environ["OUTPUT_DIR"]
|
| 833 |
+
return cfg
|
| 834 |
+
|
| 835 |
+
|
| 836 |
+
@@ -140,6 +158,236 @@ def latest_checkpoint_path(ckpt_root: Path) -> Path | None:
|
| 837 |
+
return candidates[-1]
|
| 838 |
+
|
| 839 |
+
|
| 840 |
+
+def _dtype_from_name(name: str | None, default: torch.dtype = torch.bfloat16) -> torch.dtype:
|
| 841 |
+
+ key = str(name or "").strip().lower()
|
| 842 |
+
+ if key in {"fp16", "float16", "half"}:
|
| 843 |
+
+ return torch.float16
|
| 844 |
+
+ if key in {"fp32", "float32", "full"}:
|
| 845 |
+
+ return torch.float32
|
| 846 |
+
+ if key in {"bf16", "bfloat16"}:
|
| 847 |
+
+ return torch.bfloat16
|
| 848 |
+
+ return default
|
| 849 |
+
+
|
| 850 |
+
+
|
| 851 |
+
+def _is_ema_enabled(training_cfg: dict) -> bool:
|
| 852 |
+
+ ema_cfg = training_cfg.get("ema", None)
|
| 853 |
+
+ if isinstance(ema_cfg, dict):
|
| 854 |
+
+ return bool(ema_cfg.get("enabled", False))
|
| 855 |
+
+ if ema_cfg is not None:
|
| 856 |
+
+ return bool(ema_cfg)
|
| 857 |
+
+ return bool(training_cfg.get("use_ema", False))
|
| 858 |
+
+
|
| 859 |
+
+
|
| 860 |
+
+def _ema_cfg(training_cfg: dict) -> dict:
|
| 861 |
+
+ ema_cfg = training_cfg.get("ema", {})
|
| 862 |
+
+ if not isinstance(ema_cfg, dict):
|
| 863 |
+
+ ema_cfg = {"enabled": bool(ema_cfg)}
|
| 864 |
+
+ out = dict(ema_cfg)
|
| 865 |
+
+ if "enabled" not in out:
|
| 866 |
+
+ out["enabled"] = _is_ema_enabled(training_cfg)
|
| 867 |
+
+ if "decay" not in out and "ema_decay" in training_cfg:
|
| 868 |
+
+ out["decay"] = training_cfg["ema_decay"]
|
| 869 |
+
+ if "device" not in out and "ema_device" in training_cfg:
|
| 870 |
+
+ out["device"] = training_cfg["ema_device"]
|
| 871 |
+
+ if "dtype" not in out and "ema_dtype" in training_cfg:
|
| 872 |
+
+ out["dtype"] = training_cfg["ema_dtype"]
|
| 873 |
+
+ return out
|
| 874 |
+
+
|
| 875 |
+
+
|
| 876 |
+
+class TrainableEMA:
|
| 877 |
+
+ """EMA for components saved by FluxKleinTwoFrame.save_trainable().
|
| 878 |
+
+
|
| 879 |
+
+ EMA checkpoints are written as a parallel trainable directory containing
|
| 880 |
+
+ flow_model.safetensors and optional twoframe_aux.pt, so existing loading
|
| 881 |
+
+ code can use the EMA weights by pointing load_trainable_checkpoint at the
|
| 882 |
+
+ EMA directory.
|
| 883 |
+
+ """
|
| 884 |
+
+
|
| 885 |
+
+ def __init__(self, decay: float, device: torch.device, dtype: torch.dtype):
|
| 886 |
+
+ self.decay = float(decay)
|
| 887 |
+
+ self.device = device
|
| 888 |
+
+ self.dtype = dtype
|
| 889 |
+
+ self.num_updates = 0
|
| 890 |
+
+ self.transformer: dict[str, torch.Tensor] = {}
|
| 891 |
+
+ self.aux_tensors: dict[str, torch.Tensor] = {}
|
| 892 |
+
+
|
| 893 |
+
+ @staticmethod
|
| 894 |
+
+ def _tensor_for_ema(tensor: torch.Tensor, device: torch.device, dtype: torch.dtype) -> torch.Tensor:
|
| 895 |
+
+ target_dtype = dtype if tensor.is_floating_point() else tensor.dtype
|
| 896 |
+
+ return tensor.detach().to(device=device, dtype=target_dtype).clone()
|
| 897 |
+
+
|
| 898 |
+
+ @classmethod
|
| 899 |
+
+ def from_model(cls, model: FluxKleinTwoFrame, decay: float, device: torch.device, dtype: torch.dtype):
|
| 900 |
+
+ ema = cls(decay=decay, device=device, dtype=dtype)
|
| 901 |
+
+ ema.copy_from_model(model)
|
| 902 |
+
+ return ema
|
| 903 |
+
+
|
| 904 |
+
+ def copy_from_model(self, model: FluxKleinTwoFrame) -> None:
|
| 905 |
+
+ module = model.trainable_module
|
| 906 |
+
+ if hasattr(module, "module"):
|
| 907 |
+
+ module = module.module
|
| 908 |
+
+ self.transformer = {
|
| 909 |
+
+ key: self._tensor_for_ema(value, self.device, self.dtype)
|
| 910 |
+
+ for key, value in module.state_dict().items()
|
| 911 |
+
+ }
|
| 912 |
+
+ aux = model._extra_aux_state()
|
| 913 |
+
+ self.aux_tensors = {
|
| 914 |
+
+ key: self._tensor_for_ema(value, self.device, self.dtype)
|
| 915 |
+
+ for key, value in aux.items()
|
| 916 |
+
+ if isinstance(value, torch.Tensor)
|
| 917 |
+
+ }
|
| 918 |
+
+ self.num_updates = 0
|
| 919 |
+
+
|
| 920 |
+
+ def update(self, model: FluxKleinTwoFrame) -> None:
|
| 921 |
+
+ module = model.trainable_module
|
| 922 |
+
+ if hasattr(module, "module"):
|
| 923 |
+
+ module = module.module
|
| 924 |
+
+ one_minus_decay = 1.0 - self.decay
|
| 925 |
+
+ with torch.no_grad():
|
| 926 |
+
+ for key, value in module.state_dict().items():
|
| 927 |
+
+ if key not in self.transformer:
|
| 928 |
+
+ self.transformer[key] = self._tensor_for_ema(value, self.device, self.dtype)
|
| 929 |
+
+ continue
|
| 930 |
+
+ ema_value = self.transformer[key]
|
| 931 |
+
+ current = value.detach().to(device=ema_value.device, dtype=ema_value.dtype)
|
| 932 |
+
+ if ema_value.is_floating_point():
|
| 933 |
+
+ ema_value.mul_(self.decay).add_(current, alpha=one_minus_decay)
|
| 934 |
+
+ else:
|
| 935 |
+
+ ema_value.copy_(current)
|
| 936 |
+
+
|
| 937 |
+
+ aux = model._extra_aux_state()
|
| 938 |
+
+ for key, value in aux.items():
|
| 939 |
+
+ if not isinstance(value, torch.Tensor):
|
| 940 |
+
+ continue
|
| 941 |
+
+ if key not in self.aux_tensors:
|
| 942 |
+
+ self.aux_tensors[key] = self._tensor_for_ema(value, self.device, self.dtype)
|
| 943 |
+
+ continue
|
| 944 |
+
+ ema_value = self.aux_tensors[key]
|
| 945 |
+
+ current = value.detach().to(device=ema_value.device, dtype=ema_value.dtype)
|
| 946 |
+
+ if ema_value.is_floating_point():
|
| 947 |
+
+ ema_value.mul_(self.decay).add_(current, alpha=one_minus_decay)
|
| 948 |
+
+ else:
|
| 949 |
+
+ ema_value.copy_(current)
|
| 950 |
+
+ self.num_updates += 1
|
| 951 |
+
+
|
| 952 |
+
+ def save(self, model: FluxKleinTwoFrame, output_dir: Path, metadata: dict | None = None) -> None:
|
| 953 |
+
+ from safetensors.torch import save_file as save_safetensors
|
| 954 |
+
+
|
| 955 |
+
+ output_dir.mkdir(parents=True, exist_ok=True)
|
| 956 |
+
+ transformer_cpu = {key: value.detach().cpu().contiguous() for key, value in self.transformer.items()}
|
| 957 |
+
+ torch.save(transformer_cpu, output_dir / "flow_model.pt")
|
| 958 |
+
+ save_safetensors(transformer_cpu, output_dir / "flow_model.safetensors")
|
| 959 |
+
+
|
| 960 |
+
+ aux = model._extra_aux_state()
|
| 961 |
+
+ aux_enabled = False
|
| 962 |
+
+ for key, value in self.aux_tensors.items():
|
| 963 |
+
+ aux[key] = value.detach().cpu().contiguous()
|
| 964 |
+
+ aux_enabled = True
|
| 965 |
+
+ if aux_enabled:
|
| 966 |
+
+ torch.save(aux, output_dir / "twoframe_aux.pt")
|
| 967 |
+
+ safe_aux = {key: value for key, value in aux.items() if isinstance(value, torch.Tensor)}
|
| 968 |
+
+ if safe_aux:
|
| 969 |
+
+ save_safetensors(safe_aux, output_dir / "twoframe_aux.safetensors")
|
| 970 |
+
+
|
| 971 |
+
+ meta = {
|
| 972 |
+
+ "checkpoint_type": "ema_full_transformer",
|
| 973 |
+
+ "ema_decay": self.decay,
|
| 974 |
+
+ "ema_num_updates": self.num_updates,
|
| 975 |
+
+ "raw_trainable_loader_compatible": True,
|
| 976 |
+
+ "aux_file": "twoframe_aux.pt" if aux_enabled else None,
|
| 977 |
+
+ }
|
| 978 |
+
+ if metadata:
|
| 979 |
+
+ meta.update(metadata)
|
| 980 |
+
+ with (output_dir / "twoframe_checkpoint_meta.json").open("w", encoding="utf-8") as f:
|
| 981 |
+
+ json.dump(meta, f, ensure_ascii=False, indent=2)
|
| 982 |
+
+
|
| 983 |
+
+
|
| 984 |
+
+def _move_to_device(value, device: torch.device):
|
| 985 |
+
+ if torch.is_tensor(value):
|
| 986 |
+
+ return value.to(device, non_blocking=True)
|
| 987 |
+
+ if isinstance(value, list):
|
| 988 |
+
+ return [_move_to_device(item, device) for item in value]
|
| 989 |
+
+ if isinstance(value, tuple):
|
| 990 |
+
+ return tuple(_move_to_device(item, device) for item in value)
|
| 991 |
+
+ if isinstance(value, dict):
|
| 992 |
+
+ return {key: _move_to_device(item, device) for key, item in value.items()}
|
| 993 |
+
+ return value
|
| 994 |
+
+
|
| 995 |
+
+
|
| 996 |
+
+def _build_bucketed_dataset(name: str, data_cfg: dict, common_cfg: dict) -> BucketedFrameDataset:
|
| 997 |
+
+ cfg = {**common_cfg, **dict(data_cfg)}
|
| 998 |
+
+ return BucketedFrameDataset(
|
| 999 |
+
+ manifest_path=cfg["manifest_path"],
|
| 1000 |
+
+ num_sources=int(cfg["num_sources"]),
|
| 1001 |
+
+ source_max_side=int(cfg["source_max_side"]),
|
| 1002 |
+
+ target_max_side=int(cfg["target_max_side"]),
|
| 1003 |
+
+ source_bucket_kind=str(cfg.get("source_bucket_kind", "source5")),
|
| 1004 |
+
+ target_bucket_kind=str(cfg.get("target_bucket_kind", "target9")),
|
| 1005 |
+
+ round_multiple=int(cfg.get("round_multiple", 32)),
|
| 1006 |
+
+ bucket_cache_path=cfg.get("bucket_cache_path", None),
|
| 1007 |
+
+ build_bucket_index=bool(cfg.get("build_bucket_index", False)),
|
| 1008 |
+
+ skip_missing=bool(cfg.get("skip_missing", True)),
|
| 1009 |
+
+ max_records=cfg.get("max_records", None),
|
| 1010 |
+
+ source_image_field=str(cfg.get("source_image_field", "source_image")),
|
| 1011 |
+
+ target_image_field=str(cfg.get("target_image_field", "target_image")),
|
| 1012 |
+
+ source_caption_field=str(cfg.get("source_caption_field", "source_caption")),
|
| 1013 |
+
+ source_caption_fallback_fields=_as_str_list(
|
| 1014 |
+
+ cfg.get("source_caption_fallback_fields", ["source_caption"]),
|
| 1015 |
+
+ default=["source_caption"],
|
| 1016 |
+
+ ),
|
| 1017 |
+
+ instruction_field=str(cfg.get("instruction_field", "instruction")),
|
| 1018 |
+
+ instruction_fallback_fields=_as_str_list(
|
| 1019 |
+
+ cfg.get("instruction_fallback_fields", ["edit_instruction_short", "edit_prompt_short", "text"]),
|
| 1020 |
+
+ default=["edit_instruction_short", "edit_prompt_short", "text"],
|
| 1021 |
+
+ ),
|
| 1022 |
+
+ )
|
| 1023 |
+
+
|
| 1024 |
+
+
|
| 1025 |
+
+def _stage_for_step(stages: list[dict], step: int) -> dict:
|
| 1026 |
+
+ cursor = 0
|
| 1027 |
+
+ for stage in stages:
|
| 1028 |
+
+ cursor += int(stage["steps"])
|
| 1029 |
+
+ if step < cursor:
|
| 1030 |
+
+ return stage
|
| 1031 |
+
+ return stages[-1]
|
| 1032 |
+
+
|
| 1033 |
+
+
|
| 1034 |
+
+def _sample_weighted_key(weights: dict, rng: random.Random) -> str:
|
| 1035 |
+
+ items = [(str(key), float(value)) for key, value in weights.items() if float(value) > 0]
|
| 1036 |
+
+ if not items:
|
| 1037 |
+
+ raise ValueError("No positive sampling weights configured.")
|
| 1038 |
+
+ total = sum(weight for _, weight in items)
|
| 1039 |
+
+ draw = rng.random() * total
|
| 1040 |
+
+ running = 0.0
|
| 1041 |
+
+ for key, weight in items:
|
| 1042 |
+
+ running += weight
|
| 1043 |
+
+ if draw <= running:
|
| 1044 |
+
+ return key
|
| 1045 |
+
+ return items[-1][0]
|
| 1046 |
+
+
|
| 1047 |
+
+
|
| 1048 |
+
+def _dataset_key_for_stage(stage: dict, sampled_k: str) -> str:
|
| 1049 |
+
+ dataset_map = stage.get("dataset_map", {})
|
| 1050 |
+
+ if sampled_k in dataset_map:
|
| 1051 |
+
+ return str(dataset_map[sampled_k])
|
| 1052 |
+
+ return sampled_k
|
| 1053 |
+
+
|
| 1054 |
+
+
|
| 1055 |
+
+def _sampled_k_from_dataset_key(dataset_key: str) -> str:
|
| 1056 |
+
+ key = str(dataset_key)
|
| 1057 |
+
+ if key.startswith("K1"):
|
| 1058 |
+
+ return "K1"
|
| 1059 |
+
+ if key.startswith("K2"):
|
| 1060 |
+
+ return "K2"
|
| 1061 |
+
+ if key.startswith("K3"):
|
| 1062 |
+
+ return "K3"
|
| 1063 |
+
+ return key
|
| 1064 |
+
+
|
| 1065 |
+
+
|
| 1066 |
+
+def _stable_name_offset(name: str) -> int:
|
| 1067 |
+
+ return sum((idx + 1) * ord(ch) for idx, ch in enumerate(str(name))) % 100000
|
| 1068 |
+
+
|
| 1069 |
+
+
|
| 1070 |
+
def main():
|
| 1071 |
+
parser = argparse.ArgumentParser()
|
| 1072 |
+
parser.add_argument("--config", type=str, required=True)
|
| 1073 |
+
@@ -184,7 +432,59 @@ def main():
|
| 1074 |
+
print("=" * 80)
|
| 1075 |
+
|
| 1076 |
+
dataset_type = str(cfg["data"].get("dataset_type", "twoframe")).strip().lower()
|
| 1077 |
+
- if dataset_type == "multiframe":
|
| 1078 |
+
+ mixed_loaders: dict[str, DataLoader] = {}
|
| 1079 |
+
+ mixed_iters: dict[str, object] = {}
|
| 1080 |
+
+ mixed_stages: list[dict] = []
|
| 1081 |
+
+ if dataset_type == "mixed_bucketed":
|
| 1082 |
+
+ data_common = dict(cfg["data"].get("common", {}))
|
| 1083 |
+
+ data_common.setdefault("round_multiple", cfg["data"].get("round_multiple", 32))
|
| 1084 |
+
+ data_common.setdefault("skip_missing", cfg["data"].get("skip_missing", True))
|
| 1085 |
+
+ data_common.setdefault("build_bucket_index", cfg["data"].get("build_bucket_index", False))
|
| 1086 |
+
+ dataset_cfgs = cfg["data"].get("datasets", {})
|
| 1087 |
+
+ if not isinstance(dataset_cfgs, dict) or not dataset_cfgs:
|
| 1088 |
+
+ raise ValueError("data.datasets must define bucketed datasets for dataset_type=mixed_bucketed.")
|
| 1089 |
+
+
|
| 1090 |
+
+ per_gpu_batch = int(cfg["training"].get("per_gpu_batch_size", 1))
|
| 1091 |
+
+ for name, dataset_cfg in dataset_cfgs.items():
|
| 1092 |
+
+ dataset = _build_bucketed_dataset(str(name), dataset_cfg, data_common)
|
| 1093 |
+
+ sampler = DistributedBucketBatchSampler(
|
| 1094 |
+
+ bucket_to_indices=dataset.bucket_to_indices,
|
| 1095 |
+
+ batch_size=per_gpu_batch,
|
| 1096 |
+
+ rank=accelerator.process_index,
|
| 1097 |
+
+ world_size=accelerator.num_processes,
|
| 1098 |
+
+ seed=int(cfg["training"].get("seed", 42)) + _stable_name_offset(str(name)),
|
| 1099 |
+
+ )
|
| 1100 |
+
+ loader = DataLoader(
|
| 1101 |
+
+ dataset,
|
| 1102 |
+
+ batch_sampler=sampler,
|
| 1103 |
+
+ num_workers=int(cfg["data"].get("num_workers", 8)),
|
| 1104 |
+
+ pin_memory=True,
|
| 1105 |
+
+ collate_fn=bucketed_frame_collate_fn,
|
| 1106 |
+
+ persistent_workers=bool(cfg["data"].get("persistent_workers", False))
|
| 1107 |
+
+ and int(cfg["data"].get("num_workers", 8)) > 0,
|
| 1108 |
+
+ )
|
| 1109 |
+
+ mixed_loaders[str(name)] = loader
|
| 1110 |
+
+ if accelerator.is_main_process:
|
| 1111 |
+
+ print(
|
| 1112 |
+
+ f"bucketed dataset {name}: records={len(dataset):,} buckets={len(dataset.bucket_to_indices):,}"
|
| 1113 |
+
+ )
|
| 1114 |
+
+
|
| 1115 |
+
+ mixed_stages = list(cfg.get("mixed_training", {}).get("stages", []))
|
| 1116 |
+
+ if not mixed_stages:
|
| 1117 |
+
+ raise ValueError("mixed_training.stages is required for dataset_type=mixed_bucketed.")
|
| 1118 |
+
+ force_dataset_key = os.environ.get("FORCE_DATASET_KEY")
|
| 1119 |
+
+ if force_dataset_key:
|
| 1120 |
+
+ if force_dataset_key not in mixed_loaders:
|
| 1121 |
+
+ raise ValueError(
|
| 1122 |
+
+ f"FORCE_DATASET_KEY={force_dataset_key!r} is not one of "
|
| 1123 |
+
+ f"{sorted(mixed_loaders.keys())!r}."
|
| 1124 |
+
+ )
|
| 1125 |
+
+ if accelerator.is_main_process:
|
| 1126 |
+
+ print(f"forcing mixed dataset key for debug: {force_dataset_key}")
|
| 1127 |
+
+ used_collate_fn = bucketed_frame_collate_fn
|
| 1128 |
+
+ dataset = None
|
| 1129 |
+
+ loader = None
|
| 1130 |
+
+ elif dataset_type == "multiframe":
|
| 1131 |
+
dataset = MultiFrameEditingDataset(
|
| 1132 |
+
manifest_path=cfg["data"]["manifest_path"],
|
| 1133 |
+
target_resolution=int(cfg["data"].get("target_resolution", 1024)),
|
| 1134 |
+
@@ -231,15 +531,16 @@ def main():
|
| 1135 |
+
print("data mode: online VAE encoding from images")
|
| 1136 |
+
|
| 1137 |
+
per_gpu_batch = int(cfg["training"].get("per_gpu_batch_size", 1))
|
| 1138 |
+
- loader = DataLoader(
|
| 1139 |
+
- dataset,
|
| 1140 |
+
- batch_size=per_gpu_batch,
|
| 1141 |
+
- shuffle=True,
|
| 1142 |
+
- num_workers=int(cfg["data"].get("num_workers", 8)),
|
| 1143 |
+
- pin_memory=True,
|
| 1144 |
+
- drop_last=True,
|
| 1145 |
+
- collate_fn=used_collate_fn,
|
| 1146 |
+
- )
|
| 1147 |
+
+ if dataset_type != "mixed_bucketed":
|
| 1148 |
+
+ loader = DataLoader(
|
| 1149 |
+
+ dataset,
|
| 1150 |
+
+ batch_size=per_gpu_batch,
|
| 1151 |
+
+ shuffle=True,
|
| 1152 |
+
+ num_workers=int(cfg["data"].get("num_workers", 8)),
|
| 1153 |
+
+ pin_memory=True,
|
| 1154 |
+
+ drop_last=True,
|
| 1155 |
+
+ collate_fn=used_collate_fn,
|
| 1156 |
+
+ )
|
| 1157 |
+
|
| 1158 |
+
dtype_name = cfg["training"].get("weight_dtype", "bf16").lower()
|
| 1159 |
+
if dtype_name == "fp16":
|
| 1160 |
+
@@ -294,8 +595,22 @@ def main():
|
| 1161 |
+
extra_embed_joint_policy=str(cfg["model"].get("extra_embed_joint_policy", "binary_full")),
|
| 1162 |
+
extra_embed_zero_init=bool(cfg["model"].get("extra_embed_zero_init", True)),
|
| 1163 |
+
extra_embed_strict_template=bool(cfg["model"].get("extra_embed_strict_template", True)),
|
| 1164 |
+
+ image_frame_embed_slots=int(cfg["model"].get("image_frame_embed_slots", 2)),
|
| 1165 |
+
+ multiframe_loss_mode=str(cfg["training"].get("multiframe_loss_mode", "frame_average")),
|
| 1166 |
+
)
|
| 1167 |
+
|
| 1168 |
+
+ trainable_checkpoint = cfg["training"].get("load_trainable_checkpoint", None)
|
| 1169 |
+
+ if trainable_checkpoint:
|
| 1170 |
+
+ missing, unexpected = model.load_trainable_checkpoint(
|
| 1171 |
+
+ trainable_checkpoint,
|
| 1172 |
+
+ strict=bool(cfg["training"].get("load_trainable_strict", True)),
|
| 1173 |
+
+ )
|
| 1174 |
+
+ if accelerator.is_main_process:
|
| 1175 |
+
+ print(
|
| 1176 |
+
+ f"loaded trainable checkpoint: {trainable_checkpoint} "
|
| 1177 |
+
+ f"missing={missing} unexpected={unexpected}"
|
| 1178 |
+
+ )
|
| 1179 |
+
+
|
| 1180 |
+
total_params, trainable_params = count_parameters(model.trainable_module)
|
| 1181 |
+
if accelerator.is_main_process:
|
| 1182 |
+
print(f"model trainable module total params: {total_params:,}")
|
| 1183 |
+
@@ -319,10 +634,23 @@ def main():
|
| 1184 |
+
lr_lambda=lambda step: min((step + 1) / max(1, warmup_steps), 1.0),
|
| 1185 |
+
)
|
| 1186 |
+
|
| 1187 |
+
- if scheduler is None:
|
| 1188 |
+
- model, optimizer, loader = accelerator.prepare(model, optimizer, loader)
|
| 1189 |
+
+ if dataset_type == "mixed_bucketed":
|
| 1190 |
+
+ if use_deepspeed and getattr(accelerator.state, "deepspeed_plugin", None) is not None:
|
| 1191 |
+
+ ds_cfg = accelerator.state.deepspeed_plugin.deepspeed_config
|
| 1192 |
+
+ ds_cfg["train_micro_batch_size_per_gpu"] = per_gpu_batch
|
| 1193 |
+
+ ds_cfg["gradient_accumulation_steps"] = int(
|
| 1194 |
+
+ cfg["training"].get("gradient_accumulation_steps", 1)
|
| 1195 |
+
+ )
|
| 1196 |
+
+ if scheduler is None:
|
| 1197 |
+
+ model, optimizer = accelerator.prepare(model, optimizer)
|
| 1198 |
+
+ else:
|
| 1199 |
+
+ model, optimizer, scheduler = accelerator.prepare(model, optimizer, scheduler)
|
| 1200 |
+
+ mixed_iters = {}
|
| 1201 |
+
else:
|
| 1202 |
+
- model, optimizer, loader, scheduler = accelerator.prepare(model, optimizer, loader, scheduler)
|
| 1203 |
+
+ if scheduler is None:
|
| 1204 |
+
+ model, optimizer, loader = accelerator.prepare(model, optimizer, loader)
|
| 1205 |
+
+ else:
|
| 1206 |
+
+ model, optimizer, loader, scheduler = accelerator.prepare(model, optimizer, loader, scheduler)
|
| 1207 |
+
|
| 1208 |
+
if accelerator.is_main_process:
|
| 1209 |
+
print(f"optimizer: {optimizer_name}")
|
| 1210 |
+
@@ -343,9 +671,27 @@ def main():
|
| 1211 |
+
except Exception:
|
| 1212 |
+
start_step = 0
|
| 1213 |
+
|
| 1214 |
+
+ ema = None
|
| 1215 |
+
+ ema_options = _ema_cfg(cfg["training"])
|
| 1216 |
+
+ if bool(ema_options.get("enabled", False)):
|
| 1217 |
+
+ ema_decay = float(ema_options.get("decay", 0.999))
|
| 1218 |
+
+ ema_device_name = str(ema_options.get("device", "cuda")).strip().lower()
|
| 1219 |
+
+ ema_device = accelerator.device if ema_device_name in {"cuda", "gpu", "accelerator"} else torch.device("cpu")
|
| 1220 |
+
+ ema_dtype = _dtype_from_name(str(ema_options.get("dtype", cfg["training"].get("weight_dtype", "bf16"))))
|
| 1221 |
+
+ if accelerator.is_main_process:
|
| 1222 |
+
+ unwrapped = accelerator.unwrap_model(model)
|
| 1223 |
+
+ ema = TrainableEMA.from_model(unwrapped, decay=ema_decay, device=ema_device, dtype=ema_dtype)
|
| 1224 |
+
+ print(
|
| 1225 |
+
+ f"EMA enabled: decay={ema_decay} device={ema_device} dtype={ema_dtype} "
|
| 1226 |
+
+ "init=current_model",
|
| 1227 |
+
+ flush=True,
|
| 1228 |
+
+ )
|
| 1229 |
+
+ accelerator.wait_for_everyone()
|
| 1230 |
+
+
|
| 1231 |
+
save_every = int(cfg["training"].get("save_every", 5000))
|
| 1232 |
+
log_every = int(cfg["training"].get("log_every", 10))
|
| 1233 |
+
grad_clip = float(cfg["training"].get("max_grad_norm", 1.0))
|
| 1234 |
+
+ ema_dir_name = str(ema_options.get("save_dir_name", "trainable_ema"))
|
| 1235 |
+
|
| 1236 |
+
if accelerator.is_main_process and cfg["training"].get("log_with", None):
|
| 1237 |
+
init_kwargs = {}
|
| 1238 |
+
@@ -359,7 +705,7 @@ def main():
|
| 1239 |
+
)
|
| 1240 |
+
|
| 1241 |
+
step = start_step
|
| 1242 |
+
- data_iter = iter(loader)
|
| 1243 |
+
+ data_iter = None if dataset_type == "mixed_bucketed" else iter(loader)
|
| 1244 |
+
progress = tqdm(total=max_steps, disable=not accelerator.is_main_process, initial=start_step)
|
| 1245 |
+
|
| 1246 |
+
running_loss = 0.0
|
| 1247 |
+
@@ -367,16 +713,42 @@ def main():
|
| 1248 |
+
running_src = 0.0
|
| 1249 |
+
running_count = 0
|
| 1250 |
+
t_last = time.time()
|
| 1251 |
+
+ micro_step = 0
|
| 1252 |
+
+ last_batch_info: dict[str, str] = {}
|
| 1253 |
+
|
| 1254 |
+
while step < max_steps:
|
| 1255 |
+
- try:
|
| 1256 |
+
- batch = next(data_iter)
|
| 1257 |
+
- except StopIteration:
|
| 1258 |
+
- data_iter = iter(loader)
|
| 1259 |
+
- batch = next(data_iter)
|
| 1260 |
+
+ if dataset_type == "mixed_bucketed":
|
| 1261 |
+
+ stage = _stage_for_step(mixed_stages, step)
|
| 1262 |
+
+ rng = random.Random(int(cfg["training"].get("seed", 42)) + micro_step)
|
| 1263 |
+
+ if force_dataset_key:
|
| 1264 |
+
+ dataset_key = force_dataset_key
|
| 1265 |
+
+ sampled_k = _sampled_k_from_dataset_key(dataset_key)
|
| 1266 |
+
+ else:
|
| 1267 |
+
+ sampled_k = _sample_weighted_key(stage["k_weights"], rng)
|
| 1268 |
+
+ dataset_key = _dataset_key_for_stage(stage, sampled_k)
|
| 1269 |
+
+ if dataset_key not in mixed_iters:
|
| 1270 |
+
+ mixed_iters[dataset_key] = iter(mixed_loaders[dataset_key])
|
| 1271 |
+
+ try:
|
| 1272 |
+
+ batch = next(mixed_iters[dataset_key])
|
| 1273 |
+
+ except StopIteration:
|
| 1274 |
+
+ mixed_iters[dataset_key] = iter(mixed_loaders[dataset_key])
|
| 1275 |
+
+ batch = next(mixed_iters[dataset_key])
|
| 1276 |
+
+ batch = _move_to_device(batch, accelerator.device)
|
| 1277 |
+
+ last_batch_info = {
|
| 1278 |
+
+ "stage": str(stage.get("name", "")),
|
| 1279 |
+
+ "sampled_k": sampled_k,
|
| 1280 |
+
+ "dataset_key": dataset_key,
|
| 1281 |
+
+ "bucket_key": str(batch.get("bucket_key", "")),
|
| 1282 |
+
+ }
|
| 1283 |
+
+ else:
|
| 1284 |
+
+ try:
|
| 1285 |
+
+ batch = next(data_iter)
|
| 1286 |
+
+ except StopIteration:
|
| 1287 |
+
+ data_iter = iter(loader)
|
| 1288 |
+
+ batch = next(data_iter)
|
| 1289 |
+
|
| 1290 |
+
with accelerator.accumulate(model):
|
| 1291 |
+
- if dataset_type == "multiframe":
|
| 1292 |
+
+ if dataset_type in {"multiframe", "mixed_bucketed"}:
|
| 1293 |
+
out = model.forward_multiframe(
|
| 1294 |
+
pixel_values_sources=batch["pixel_values_sources"],
|
| 1295 |
+
pixel_values_target=batch["pixel_values_target"],
|
| 1296 |
+
@@ -407,10 +779,13 @@ def main():
|
| 1297 |
+
if scheduler is not None:
|
| 1298 |
+
scheduler.step()
|
| 1299 |
+
optimizer.zero_grad(set_to_none=True)
|
| 1300 |
+
+ micro_step += 1
|
| 1301 |
+
|
| 1302 |
+
if accelerator.sync_gradients:
|
| 1303 |
+
step += 1
|
| 1304 |
+
progress.update(1)
|
| 1305 |
+
+ if ema is not None:
|
| 1306 |
+
+ ema.update(accelerator.unwrap_model(model))
|
| 1307 |
+
|
| 1308 |
+
loss_item = float(loss.detach().item())
|
| 1309 |
+
tgt_item = float(out.loss_target.detach().item())
|
| 1310 |
+
@@ -443,6 +818,11 @@ def main():
|
| 1311 |
+
"grad_norm": grad_norm_val,
|
| 1312 |
+
"step_time_sec": dt / log_every,
|
| 1313 |
+
}
|
| 1314 |
+
+ if ema is not None:
|
| 1315 |
+
+ payload["ema_decay"] = ema.decay
|
| 1316 |
+
+ payload["ema_updates"] = ema.num_updates
|
| 1317 |
+
+ if last_batch_info:
|
| 1318 |
+
+ payload.update(last_batch_info)
|
| 1319 |
+
accelerator.print(json.dumps(payload, ensure_ascii=False))
|
| 1320 |
+
|
| 1321 |
+
if cfg["training"].get("log_with", None):
|
| 1322 |
+
@@ -458,9 +838,18 @@ def main():
|
| 1323 |
+
if accelerator.is_main_process:
|
| 1324 |
+
unwrapped = accelerator.unwrap_model(model)
|
| 1325 |
+
unwrapped.save_trainable(str(ckpt_dir / "trainable"))
|
| 1326 |
+
+ if ema is not None:
|
| 1327 |
+
+ ema.save(
|
| 1328 |
+
+ unwrapped,
|
| 1329 |
+
+ ckpt_dir / ema_dir_name,
|
| 1330 |
+
+ metadata={"step": step, "source": "train.py"},
|
| 1331 |
+
+ )
|
| 1332 |
+
with open(output_dir / "latest_step.txt", "w", encoding="utf-8") as f:
|
| 1333 |
+
f.write(str(step))
|
| 1334 |
+
print(f"Saved checkpoint at step={step}: {ckpt_dir}")
|
| 1335 |
+
+ if ema is not None:
|
| 1336 |
+
+ print(f"Saved EMA checkpoint at step={step}: {ckpt_dir / ema_dir_name}")
|
| 1337 |
+
+ accelerator.wait_for_everyone()
|
| 1338 |
+
|
| 1339 |
+
accelerator.wait_for_everyone()
|
| 1340 |
+
if accelerator.is_main_process:
|
| 1341 |
+
diff --git a/twoframe/modeling.py b/twoframe/modeling.py
|
| 1342 |
+
index 8f00154..90308fe 100644
|
| 1343 |
+
--- a/twoframe/modeling.py
|
| 1344 |
+
+++ b/twoframe/modeling.py
|
| 1345 |
+
@@ -10,6 +10,7 @@ from typing import Iterable, Sequence
|
| 1346 |
+
import torch
|
| 1347 |
+
import torch.nn as nn
|
| 1348 |
+
from einops import rearrange
|
| 1349 |
+
+from safetensors.torch import load_file as load_safetensors
|
| 1350 |
+
from transformers import Qwen2TokenizerFast, Qwen3ForCausalLM
|
| 1351 |
+
|
| 1352 |
+
from .backbone import load_autoencoder, load_flow_model, normalize_model_size, repo_id_for, spec_for
|
| 1353 |
+
@@ -81,6 +82,8 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1354 |
+
extra_embed_joint_policy: str = "binary_full",
|
| 1355 |
+
extra_embed_zero_init: bool = True,
|
| 1356 |
+
extra_embed_strict_template: bool = True,
|
| 1357 |
+
+ image_frame_embed_slots: int = 2,
|
| 1358 |
+
+ multiframe_loss_mode: str = "frame_average",
|
| 1359 |
+
):
|
| 1360 |
+
super().__init__()
|
| 1361 |
+
|
| 1362 |
+
@@ -122,6 +125,15 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1363 |
+
)
|
| 1364 |
+
self.extra_embed_zero_init = bool(extra_embed_zero_init)
|
| 1365 |
+
self.extra_embed_strict_template = bool(extra_embed_strict_template)
|
| 1366 |
+
+ self.image_frame_embed_slots = int(image_frame_embed_slots)
|
| 1367 |
+
+ if self.image_frame_embed_slots < 2:
|
| 1368 |
+
+ raise ValueError("image_frame_embed_slots must be >= 2.")
|
| 1369 |
+
+ self.multiframe_loss_mode = str(multiframe_loss_mode).strip().lower()
|
| 1370 |
+
+ if self.multiframe_loss_mode not in {"frame_average", "block_balanced"}:
|
| 1371 |
+
+ raise ValueError(
|
| 1372 |
+
+ f"Unsupported multiframe_loss_mode={multiframe_loss_mode}. "
|
| 1373 |
+
+ "Choose from ['frame_average', 'block_balanced']."
|
| 1374 |
+
+ )
|
| 1375 |
+
self._warned_non_joint_extra = False
|
| 1376 |
+
self.source_loss_weight = float(source_loss_weight)
|
| 1377 |
+
self.target_loss_weight = float(target_loss_weight)
|
| 1378 |
+
@@ -231,7 +243,7 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1379 |
+
if use_image:
|
| 1380 |
+
if in_channels <= 0:
|
| 1381 |
+
raise ValueError("Failed to detect transformer in_channels for image frame embedding.")
|
| 1382 |
+
- self.image_frame_embed = nn.Embedding(2, in_channels)
|
| 1383 |
+
+ self.image_frame_embed = nn.Embedding(self.image_frame_embed_slots, in_channels)
|
| 1384 |
+
if self.extra_embed_zero_init:
|
| 1385 |
+
nn.init.zeros_(self.image_frame_embed.weight)
|
| 1386 |
+
|
| 1387 |
+
@@ -518,7 +530,12 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1388 |
+
) -> list[str]:
|
| 1389 |
+
prompts: list[str] = []
|
| 1390 |
+
for captions, instruction in zip(source_captions, instructions):
|
| 1391 |
+
+ source_blocks = "\n\n".join(
|
| 1392 |
+
+ f"[Source Image {idx}]\n{caption or f'reference image {idx}'}"
|
| 1393 |
+
+ for idx, caption in enumerate(captions, start=1)
|
| 1394 |
+
+ )
|
| 1395 |
+
prompt = self.text_template
|
| 1396 |
+
+ prompt = prompt.replace("{source_blocks}", source_blocks)
|
| 1397 |
+
for idx, caption in enumerate(captions, start=1):
|
| 1398 |
+
prompt = prompt.replace(
|
| 1399 |
+
f"{{source{idx}_caption}}",
|
| 1400 |
+
@@ -678,18 +695,24 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1401 |
+
|
| 1402 |
+
def forward_multiframe(
|
| 1403 |
+
self,
|
| 1404 |
+
- pixel_values_sources: torch.Tensor,
|
| 1405 |
+
+ pixel_values_sources: torch.Tensor | list[torch.Tensor],
|
| 1406 |
+
pixel_values_target: torch.Tensor,
|
| 1407 |
+
source_captions_long: list[list[str]],
|
| 1408 |
+
instructions: list[str],
|
| 1409 |
+
) -> TwoFrameLoss:
|
| 1410 |
+
if self.text_mode != "joint":
|
| 1411 |
+
raise ValueError("forward_multiframe currently supports only text_mode='joint'.")
|
| 1412 |
+
- if pixel_values_sources.ndim != 5:
|
| 1413 |
+
+ if isinstance(pixel_values_sources, torch.Tensor) and pixel_values_sources.ndim != 5:
|
| 1414 |
+
raise ValueError(
|
| 1415 |
+
"pixel_values_sources must have shape (B,N,3,H,W), "
|
| 1416 |
+
f"got {tuple(pixel_values_sources.shape)}."
|
| 1417 |
+
)
|
| 1418 |
+
+ if isinstance(pixel_values_sources, list):
|
| 1419 |
+
+ if not pixel_values_sources:
|
| 1420 |
+
+ raise ValueError("pixel_values_sources list must not be empty.")
|
| 1421 |
+
+ if any(tensor.ndim != 4 for tensor in pixel_values_sources):
|
| 1422 |
+
+ shapes = [tuple(tensor.shape) for tensor in pixel_values_sources]
|
| 1423 |
+
+ raise ValueError(f"source slot tensors must have shape (B,3,H,W), got {shapes}.")
|
| 1424 |
+
if pixel_values_target.ndim != 4:
|
| 1425 |
+
raise ValueError(
|
| 1426 |
+
"pixel_values_target must have shape (B,3,H,W), "
|
| 1427 |
+
@@ -708,7 +731,15 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1428 |
+
f"expected C={expected_channels} (or C={expected_channels // 4} before patchify)."
|
| 1429 |
+
)
|
| 1430 |
+
|
| 1431 |
+
- bsz, num_sources = pixel_values_sources.shape[:2]
|
| 1432 |
+
+ if isinstance(pixel_values_sources, list):
|
| 1433 |
+
+ bsz = pixel_values_target.shape[0]
|
| 1434 |
+
+ num_sources = len(pixel_values_sources)
|
| 1435 |
+
+ source_pixel_slots = pixel_values_sources
|
| 1436 |
+
+ if any(tensor.shape[0] != bsz for tensor in source_pixel_slots):
|
| 1437 |
+
+ raise ValueError("All source slot tensors must have the same batch size as target.")
|
| 1438 |
+
+ else:
|
| 1439 |
+
+ bsz, num_sources = pixel_values_sources.shape[:2]
|
| 1440 |
+
+ source_pixel_slots = [pixel_values_sources[:, idx] for idx in range(num_sources)]
|
| 1441 |
+
device = pixel_values_target.device
|
| 1442 |
+
dtype = next(self.transformer.parameters()).dtype
|
| 1443 |
+
|
| 1444 |
+
@@ -716,8 +747,8 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1445 |
+
target_latents = _ensure_transformer_latent_channels(target_latents.to(device=device), "target")
|
| 1446 |
+
|
| 1447 |
+
source_latents: list[torch.Tensor] = []
|
| 1448 |
+
- for idx in range(num_sources):
|
| 1449 |
+
- source_latent = self.encode_image_latents(pixel_values_sources[:, idx])
|
| 1450 |
+
+ for idx, source_pixels in enumerate(source_pixel_slots):
|
| 1451 |
+
+ source_latent = self.encode_image_latents(source_pixels)
|
| 1452 |
+
source_latent = _ensure_transformer_latent_channels(
|
| 1453 |
+
source_latent.to(device=device),
|
| 1454 |
+
f"source[{idx}]",
|
| 1455 |
+
@@ -736,12 +767,16 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1456 |
+
packed_parts = [packed_target]
|
| 1457 |
+
img_id_parts = [target_ids]
|
| 1458 |
+
seq_lengths = [packed_target.shape[1]]
|
| 1459 |
+
- source_noise_list: list[torch.Tensor] = []
|
| 1460 |
+
+ source_noise_list: list[torch.Tensor | None] = []
|
| 1461 |
+
|
| 1462 |
+
for idx, source_latent in enumerate(source_latents):
|
| 1463 |
+
- source_noise = torch.randn_like(source_latent)
|
| 1464 |
+
+ if self.source_input_mode == "condition":
|
| 1465 |
+
+ source_noise = None
|
| 1466 |
+
+ source_noisy = source_latent
|
| 1467 |
+
+ else:
|
| 1468 |
+
+ source_noise = torch.randn_like(source_latent)
|
| 1469 |
+
+ source_noisy = (1 - sigma_b) * source_latent + sigma_b * source_noise
|
| 1470 |
+
source_noise_list.append(source_noise)
|
| 1471 |
+
- source_noisy = (1 - sigma_b) * source_latent + sigma_b * source_noise
|
| 1472 |
+
source_t_value = self.source_t + idx * self.source_t_step
|
| 1473 |
+
packed_source, source_ids = pack_latents(source_noisy, t_value=source_t_value)
|
| 1474 |
+
packed_parts.append(packed_source)
|
| 1475 |
+
@@ -788,13 +823,16 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1476 |
+
loss_target = torch.mean((pred_target_unpacked - target_vel) ** 2)
|
| 1477 |
+
|
| 1478 |
+
source_losses: list[torch.Tensor] = []
|
| 1479 |
+
- for idx, (pred_source, source_ids, source_latent, source_noise) in enumerate(
|
| 1480 |
+
- zip(pred_parts[1:], img_id_parts[1:], source_latents, source_noise_list)
|
| 1481 |
+
- ):
|
| 1482 |
+
- _ = idx
|
| 1483 |
+
- pred_source_unpacked = unpack_latents(pred_source, source_ids)
|
| 1484 |
+
- source_vel = source_noise - source_latent
|
| 1485 |
+
- source_losses.append(torch.mean((pred_source_unpacked - source_vel) ** 2))
|
| 1486 |
+
+ if self.source_input_mode != "condition":
|
| 1487 |
+
+ for idx, (pred_source, source_ids, source_latent, source_noise) in enumerate(
|
| 1488 |
+
+ zip(pred_parts[1:], img_id_parts[1:], source_latents, source_noise_list)
|
| 1489 |
+
+ ):
|
| 1490 |
+
+ _ = idx
|
| 1491 |
+
+ if source_noise is None:
|
| 1492 |
+
+ raise RuntimeError("source_noise unexpectedly missing in denoise mode.")
|
| 1493 |
+
+ pred_source_unpacked = unpack_latents(pred_source, source_ids)
|
| 1494 |
+
+ source_vel = source_noise - source_latent
|
| 1495 |
+
+ source_losses.append(torch.mean((pred_source_unpacked - source_vel) ** 2))
|
| 1496 |
+
|
| 1497 |
+
if source_losses:
|
| 1498 |
+
source_losses_tensor = torch.stack(source_losses)
|
| 1499 |
+
@@ -803,16 +841,68 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1500 |
+
source_losses_tensor = None
|
| 1501 |
+
loss_source = torch.zeros((), device=loss_target.device, dtype=loss_target.dtype)
|
| 1502 |
+
|
| 1503 |
+
- weighted_target = self.target_loss_weight * loss_target
|
| 1504 |
+
- weighted_source = (
|
| 1505 |
+
- self.source_loss_weight * source_losses_tensor.sum()
|
| 1506 |
+
- if source_losses_tensor is not None
|
| 1507 |
+
- else torch.zeros((), device=loss_target.device, dtype=loss_target.dtype)
|
| 1508 |
+
- )
|
| 1509 |
+
- normalizer = self.target_loss_weight + self.source_loss_weight * len(source_latents)
|
| 1510 |
+
- loss = (weighted_target + weighted_source) / max(normalizer, 1e-8)
|
| 1511 |
+
+ if self.multiframe_loss_mode == "block_balanced":
|
| 1512 |
+
+ loss = self.target_loss_weight * loss_target + self.source_loss_weight * loss_source
|
| 1513 |
+
+ else:
|
| 1514 |
+
+ weighted_target = self.target_loss_weight * loss_target
|
| 1515 |
+
+ weighted_source = (
|
| 1516 |
+
+ self.source_loss_weight * source_losses_tensor.sum()
|
| 1517 |
+
+ if source_losses_tensor is not None
|
| 1518 |
+
+ else torch.zeros((), device=loss_target.device, dtype=loss_target.dtype)
|
| 1519 |
+
+ )
|
| 1520 |
+
+ normalizer = self.target_loss_weight + self.source_loss_weight * len(source_latents)
|
| 1521 |
+
+ loss = (weighted_target + weighted_source) / max(normalizer, 1e-8)
|
| 1522 |
+
return TwoFrameLoss(loss=loss, loss_target=loss_target, loss_source=loss_source)
|
| 1523 |
+
|
| 1524 |
+
+ def load_trainable_checkpoint(self, checkpoint: str | Path, strict: bool = True) -> tuple[int, int]:
|
| 1525 |
+
+ path = Path(checkpoint).expanduser().resolve()
|
| 1526 |
+
+ if not path.exists():
|
| 1527 |
+
+ raise FileNotFoundError(f"Trainable checkpoint not found: {path}")
|
| 1528 |
+
+ if path.is_dir():
|
| 1529 |
+
+ candidates = [
|
| 1530 |
+
+ path / "flow_model.safetensors",
|
| 1531 |
+
+ path / "flow_model.pt",
|
| 1532 |
+
+ path / "pytorch_model.bin",
|
| 1533 |
+
+ ]
|
| 1534 |
+
+ file_path = next((candidate for candidate in candidates if candidate.exists()), None)
|
| 1535 |
+
+ if file_path is None:
|
| 1536 |
+
+ raise FileNotFoundError(
|
| 1537 |
+
+ f"No trainable checkpoint found in {path}; expected flow_model.safetensors or flow_model.pt."
|
| 1538 |
+
+ )
|
| 1539 |
+
+ base_dir = path
|
| 1540 |
+
+ else:
|
| 1541 |
+
+ file_path = path
|
| 1542 |
+
+ base_dir = path.parent
|
| 1543 |
+
+
|
| 1544 |
+
+ if file_path.suffix == ".safetensors":
|
| 1545 |
+
+ state_dict = load_safetensors(str(file_path), device="cpu")
|
| 1546 |
+
+ else:
|
| 1547 |
+
+ raw = torch.load(file_path, map_location="cpu")
|
| 1548 |
+
+ state_dict = raw.get("state_dict", raw) if isinstance(raw, dict) else raw
|
| 1549 |
+
+ missing, unexpected = self.transformer.load_state_dict(state_dict, strict=strict)
|
| 1550 |
+
+
|
| 1551 |
+
+ aux_path = base_dir / "twoframe_aux.pt"
|
| 1552 |
+
+ if aux_path.exists():
|
| 1553 |
+
+ aux = torch.load(aux_path, map_location="cpu")
|
| 1554 |
+
+ if self.text_segment_embed is not None and "text_segment_embed.weight" in aux:
|
| 1555 |
+
+ self._copy_embedding_weight(self.text_segment_embed, aux["text_segment_embed.weight"])
|
| 1556 |
+
+ if self.image_frame_embed is not None and "image_frame_embed.weight" in aux:
|
| 1557 |
+
+ self._copy_embedding_weight(self.image_frame_embed, aux["image_frame_embed.weight"])
|
| 1558 |
+
+ return len(missing), len(unexpected)
|
| 1559 |
+
+
|
| 1560 |
+
+ @staticmethod
|
| 1561 |
+
+ def _copy_embedding_weight(module: nn.Embedding, weight: torch.Tensor) -> None:
|
| 1562 |
+
+ rows = min(module.weight.shape[0], weight.shape[0])
|
| 1563 |
+
+ cols = min(module.weight.shape[1], weight.shape[1])
|
| 1564 |
+
+ with torch.no_grad():
|
| 1565 |
+
+ module.weight[:rows, :cols].copy_(weight[:rows, :cols].to(module.weight.device, module.weight.dtype))
|
| 1566 |
+
+ if module.weight.shape[0] > rows and rows > 0:
|
| 1567 |
+
+ for row in range(rows, module.weight.shape[0]):
|
| 1568 |
+
+ source_row = min(row, rows - 1)
|
| 1569 |
+
+ module.weight[row, :cols].copy_(
|
| 1570 |
+
+ weight[source_row, :cols].to(module.weight.device, module.weight.dtype)
|
| 1571 |
+
+ )
|
| 1572 |
+
+
|
| 1573 |
+
def _extra_aux_state(self) -> dict[str, torch.Tensor | str | bool]:
|
| 1574 |
+
state: dict[str, torch.Tensor | str | bool] = {
|
| 1575 |
+
"format_version": "v1",
|
| 1576 |
+
@@ -909,11 +999,13 @@ class FluxKleinTwoFrame(nn.Module):
|
| 1577 |
+
"extra_embeddings": {
|
| 1578 |
+
"mode": self.extra_embed_mode,
|
| 1579 |
+
"policy": self.extra_embed_joint_policy,
|
| 1580 |
+
+ "image_frame_embed_slots": self.image_frame_embed_slots,
|
| 1581 |
+
"enabled_text": self.text_segment_embed is not None,
|
| 1582 |
+
"enabled_image": self.image_frame_embed is not None,
|
| 1583 |
+
"strict_template": self.extra_embed_strict_template,
|
| 1584 |
+
"aux_file": "twoframe_aux.pt" if aux_enabled else None,
|
| 1585 |
+
},
|
| 1586 |
+
+ "multiframe_loss_mode": self.multiframe_loss_mode,
|
| 1587 |
+
}
|
| 1588 |
+
with Path(output_dir, "twoframe_checkpoint_meta.json").open("w", encoding="utf-8") as f:
|
| 1589 |
+
json.dump(meta, f, ensure_ascii=False, indent=2)
|
| 1590 |
+
diff --git a/twoframe/native_inference.py b/twoframe/native_inference.py
|
| 1591 |
+
index 8551951..e17122e 100644
|
| 1592 |
+
--- a/twoframe/native_inference.py
|
| 1593 |
+
+++ b/twoframe/native_inference.py
|
| 1594 |
+
@@ -122,6 +122,7 @@ class Flux2NativeEngine:
|
| 1595 |
+
policy: str = "binary_full",
|
| 1596 |
+
strict_template: bool = True,
|
| 1597 |
+
zero_init: bool = True,
|
| 1598 |
+
+ image_slots: int = 2,
|
| 1599 |
+
) -> None:
|
| 1600 |
+
norm_mode = self._normalize_extra_embed_mode(mode)
|
| 1601 |
+
policy = str(policy).strip().lower()
|
| 1602 |
+
@@ -154,7 +155,7 @@ class Flux2NativeEngine:
|
| 1603 |
+
image_dim = int(getattr(self.flow, "in_channels", 0))
|
| 1604 |
+
if image_dim <= 0:
|
| 1605 |
+
raise ValueError("Failed to infer in_channels for image frame embedding.")
|
| 1606 |
+
- self.image_frame_embed = torch.nn.Embedding(2, image_dim).to(
|
| 1607 |
+
+ self.image_frame_embed = torch.nn.Embedding(int(image_slots), image_dim).to(
|
| 1608 |
+
device=self.device,
|
| 1609 |
+
dtype=self.dtype,
|
| 1610 |
+
)
|
| 1611 |
+
@@ -338,12 +339,16 @@ class Flux2NativeEngine:
|
| 1612 |
+
elif "image_frame_embed.weight" in aux_state:
|
| 1613 |
+
if mode == "none":
|
| 1614 |
+
mode = "image_only"
|
| 1615 |
+
+ image_slots = 2
|
| 1616 |
+
+ if "image_frame_embed.weight" in aux_state:
|
| 1617 |
+
+ image_slots = int(aux_state["image_frame_embed.weight"].shape[0])
|
| 1618 |
+
|
| 1619 |
+
self.configure_extra_embeddings(
|
| 1620 |
+
mode=mode,
|
| 1621 |
+
policy=policy,
|
| 1622 |
+
strict_template=strict_template,
|
| 1623 |
+
zero_init=False,
|
| 1624 |
+
+ image_slots=image_slots,
|
| 1625 |
+
)
|
| 1626 |
+
|
| 1627 |
+
if self.text_segment_embed is not None and "text_segment_embed.weight" in aux_state:
|
model_cache_code_step8000/metadata/TwoFrame.untracked_files.txt
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
configs/accelerate_8gpu_zero2_ga2.yaml
|
| 2 |
+
configs/flux_klein9b_mixed_bucketed_editor_only_ma034235_ma79931_ucsf.yaml
|
| 3 |
+
configs/flux_klein9b_mixed_bucketed_joint_ema_resume_ucsf.yaml
|
| 4 |
+
configs/flux_klein9b_mixed_bucketed_ma034235_ma79931_ucsf.yaml
|
| 5 |
+
docs/TWOFRAME_DATA_ENGINE.md
|
| 6 |
+
docs/UCSF_EVAL_EXPERIMENT_TRACKER.md
|
| 7 |
+
scripts/analyze_ma034235_manifest_filter.py
|
| 8 |
+
scripts/analyze_ma034235_manifest_filter_ucsf.sbatch
|
| 9 |
+
scripts/build_bucket_cache.py
|
| 10 |
+
scripts/build_mixed_bucket_caches_h200_ucsf.sbatch
|
| 11 |
+
scripts/build_mixed_bucket_caches_ucsf.sbatch
|
| 12 |
+
scripts/build_multiref_condition_manifest_from_outputs.py
|
| 13 |
+
scripts/check_bucketed_dataloader.py
|
| 14 |
+
scripts/eval_generate_single_gpu_ucsf.sbatch
|
| 15 |
+
scripts/hold_h200_allocation_ucsf.sbatch
|
| 16 |
+
scripts/infer_multiref_condition_editor.py
|
| 17 |
+
scripts/infer_twoframe_data_engine.py
|
| 18 |
+
scripts/launch_twoframe_data_engine_ctmux_ucsf.sh
|
| 19 |
+
scripts/prepare_ucsf_eval_manifests.py
|
| 20 |
+
scripts/run_multiref_backfill_queue_ucsf.sh
|
| 21 |
+
scripts/run_multiref_condition_editor_inalloc_8g_ucsf.sh
|
| 22 |
+
scripts/run_singleref_condition_baselines_inalloc_8g_ucsf.sh
|
| 23 |
+
scripts/run_singleref_pair_metrics_8gpu_ucsf.sbatch
|
| 24 |
+
scripts/run_singleref_pair_metrics_ucsf.sbatch
|
| 25 |
+
scripts/run_twoframe_data_engine_inalloc_ucsf.sh
|
| 26 |
+
scripts/run_wandb_login_tail_both_loop_ucsf.sh
|
| 27 |
+
scripts/run_wandb_login_tail_both_persistent_ucsf.sh
|
| 28 |
+
scripts/run_wandb_login_tail_loop_ucsf.sh
|
| 29 |
+
scripts/run_wandb_login_tail_ucsf.sh
|
| 30 |
+
scripts/srun_in_h200_allocation_ucsf.sh
|
| 31 |
+
scripts/tail_train_log_to_wandb.py
|
| 32 |
+
scripts/tail_train_log_to_wandb_ucsf.sbatch
|
| 33 |
+
scripts/train_mixed_bucketed_editor_only_ucsf.sbatch
|
| 34 |
+
scripts/train_mixed_bucketed_joint_ema_resume_ucsf.sbatch
|
| 35 |
+
scripts/train_mixed_bucketed_joint_ucsf.sbatch
|
| 36 |
+
scripts/train_mixed_bucketed_ucsf.sbatch
|
| 37 |
+
scripts/verify_mixed_bucket_caches_ucsf.sbatch
|
| 38 |
+
scripts/verify_mixed_bucket_caches_ucsf.sh
|
| 39 |
+
scripts/wait_then_run_multiref_condition_baselines_ucsf.sh
|
| 40 |
+
twoframe/data_bucketed.py
|
model_cache_code_step8000/metadata/asset_manifest.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"package": "/scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252",
|
| 3 |
+
"package_type": "model_reproducibility_bundle",
|
| 4 |
+
"created_or_updated": "2026-05-23 10:25:38 PDT",
|
| 5 |
+
"training_run": "/scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532",
|
| 6 |
+
"last_complete_step": 8000,
|
| 7 |
+
"target_steps": 9000,
|
| 8 |
+
"status_note": "2-day Slurm allocation ended after step 8016; last complete checkpoint pair is step 8000.",
|
| 9 |
+
"checkpoints": {
|
| 10 |
+
"non_ema_consolidated": "checkpoints/checkpoint-8000/transformer/diffusion_pytorch_model.safetensors",
|
| 11 |
+
"ema": "checkpoints/ema_checkpoint-8000/diffusion_pytorch_model.safetensors",
|
| 12 |
+
"distributed_resume_state": "checkpoints/checkpoint-8000/distributed_checkpoint/"
|
| 13 |
+
},
|
| 14 |
+
"derived_cache": {
|
| 15 |
+
"source_path": "/scratch/user/yuhwang/dataset/pants-captions-ldm/cache/wan22_pants_v2_softwin",
|
| 16 |
+
"archive_parts": "cache/wan22_pants_v2_softwin.tar.zst.part-*",
|
| 17 |
+
"source_train_rows": 53784,
|
| 18 |
+
"contains": [
|
| 19 |
+
"vae_latents",
|
| 20 |
+
"text_embeddings",
|
| 21 |
+
"captions",
|
| 22 |
+
"embedded_caption_manifests",
|
| 23 |
+
"manifests"
|
| 24 |
+
]
|
| 25 |
+
},
|
| 26 |
+
"raw_data_package": "/scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_raw_train_test_20260523_102411",
|
| 27 |
+
"raw_data_source_path": "/scratch/user/yuhwang/dataset/PanTS",
|
| 28 |
+
"code_snapshot": "code/twoframe_fastvideo_code_snapshot.tar.zst",
|
| 29 |
+
"base_model_path": "/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged",
|
| 30 |
+
"base_model_note": "Base model binaries are not duplicated here; symlink map is in metadata/base_model_symlinks.txt."
|
| 31 |
+
}
|
model_cache_code_step8000/metadata/base_model_symlinks.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
BASE=/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged
|
| 2 |
+
BASE_READLINK=/mnt/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged
|
| 3 |
+
d 4096 /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged ->
|
| 4 |
+
l 132 /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged/vae -> /scratch/user/yuhwang/model/hf-cache/models--Wan-AI--Wan2.2-TI2V-5B-Diffusers/snapshots/b8fff7315c768468a5333511427288870b2e9635/vae
|
| 5 |
+
l 145 /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged/model_index.json -> /scratch/user/yuhwang/model/hf-cache/models--Wan-AI--Wan2.2-TI2V-5B-Diffusers/snapshots/b8fff7315c768468a5333511427288870b2e9635/model_index.json
|
| 6 |
+
l 67 /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged/scheduler -> /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-text/scheduler
|
| 7 |
+
l 67 /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged/tokenizer -> /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-text/tokenizer
|
| 8 |
+
l 70 /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged/text_encoder -> /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-text/text_encoder
|
| 9 |
+
l 76 /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged/transformer -> /scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-transformer/transformer
|
model_cache_code_step8000/metadata/cache_summary.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cache_root": "/scratch/user/yuhwang/dataset/pants-captions-ldm/cache/wan22_pants_v2_softwin",
|
| 3 |
+
"source_train_jsonl": "/scratch/user/yuhwang/dataset/pants-captions-ldm/cache/wan22_pants_v2_softwin/captions_embedded/source_train.jsonl",
|
| 4 |
+
"exists": true,
|
| 5 |
+
"rows": 53784,
|
| 6 |
+
"keys": {
|
| 7 |
+
"bucket_id": 53784,
|
| 8 |
+
"caption": 53784,
|
| 9 |
+
"caption_key": 53784,
|
| 10 |
+
"caption_template": 53784,
|
| 11 |
+
"case_id": 53784,
|
| 12 |
+
"dit_tokens": 53784,
|
| 13 |
+
"fov": 53784,
|
| 14 |
+
"id": 53784,
|
| 15 |
+
"latent_path": 53784,
|
| 16 |
+
"latent_shape": 53784,
|
| 17 |
+
"lesion_present": 53784,
|
| 18 |
+
"phase": 53784,
|
| 19 |
+
"pixel_shape_zyx": 53784,
|
| 20 |
+
"source_split": 53784,
|
| 21 |
+
"target_spacing_zyx": 53784,
|
| 22 |
+
"text_embedding_dtype": 53784,
|
| 23 |
+
"text_embedding_path": 53784,
|
| 24 |
+
"text_embedding_shape": 53784,
|
| 25 |
+
"text_token_count": 53784,
|
| 26 |
+
"view": 53784,
|
| 27 |
+
"window_hu": 53784,
|
| 28 |
+
"window_mode": 53784
|
| 29 |
+
},
|
| 30 |
+
"bucket_id_counts": {
|
| 31 |
+
"B-whole": 21690,
|
| 32 |
+
"B-CA": 11365,
|
| 33 |
+
"B-CAP": 10980,
|
| 34 |
+
"P-pan": 8784,
|
| 35 |
+
"B-abd-pelvis": 490,
|
| 36 |
+
"B-abd": 475
|
| 37 |
+
}
|
| 38 |
+
}
|
model_cache_code_step8000/metadata/package_du.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
161G /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252
|
model_cache_code_step8000/metadata/package_filelist.tsv
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
21474836480 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/cache/wan22_pants_v2_softwin.tar.zst.part-002
|
| 2 |
+
21474836480 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/cache/wan22_pants_v2_softwin.tar.zst.part-001
|
| 3 |
+
21474836480 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/cache/wan22_pants_v2_softwin.tar.zst.part-000
|
| 4 |
+
19999235584 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/ema_checkpoint-8000/diffusion_pytorch_model.safetensors
|
| 5 |
+
19999235584 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/transformer/diffusion_pytorch_model.safetensors
|
| 6 |
+
7936917186 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/cache/wan22_pants_v2_softwin.tar.zst.part-003
|
| 7 |
+
7579283472 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/distributed_checkpoint/__6_0.distcp
|
| 8 |
+
7579281895 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/distributed_checkpoint/__7_0.distcp
|
| 9 |
+
7579280381 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/distributed_checkpoint/__0_0.distcp
|
| 10 |
+
7579267765 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/distributed_checkpoint/__4_0.distcp
|
| 11 |
+
7427175972 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/distributed_checkpoint/__2_0.distcp
|
| 12 |
+
7426960230 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/distributed_checkpoint/__5_0.distcp
|
| 13 |
+
7422377654 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/distributed_checkpoint/__3_0.distcp
|
| 14 |
+
7421581100 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/distributed_checkpoint/__1_0.distcp
|
| 15 |
+
160328081 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/code/twoframe_fastvideo_code_snapshot.tar.zst
|
| 16 |
+
85917696 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/run-2dcsowl9.wandb
|
| 17 |
+
4289477 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/distributed_checkpoint/.metadata
|
| 18 |
+
2011580 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/logs/train.log
|
| 19 |
+
427900 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/logs/gpu_monitor.log
|
| 20 |
+
74115 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/TwoFrame.uncommitted.diff
|
| 21 |
+
16303 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug.log
|
| 22 |
+
9667 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/TwoFrame.git_status.txt
|
| 23 |
+
9446 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/FastVideo.uncommitted.diff
|
| 24 |
+
3933 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/package_tree_depth3.txt
|
| 25 |
+
2674 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/README.md
|
| 26 |
+
2195 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/files/requirements.txt
|
| 27 |
+
2169 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/CODE_USAGE.md
|
| 28 |
+
1960 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/train_health.json
|
| 29 |
+
1863 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/TwoFrame.untracked_files.txt
|
| 30 |
+
1806 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/DATA_ASSETS.md
|
| 31 |
+
1608 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/asset_manifest.json
|
| 32 |
+
1538 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/HF_UPLOAD.md
|
| 33 |
+
1276 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/train_args.json
|
| 34 |
+
1259 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/logs/tracker/wandb/offline-run-20260519_215609-2dcsowl9/logs/debug-internal.log
|
| 35 |
+
1253 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/base_model_symlinks.txt
|
| 36 |
+
1024 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/cache_summary.json
|
| 37 |
+
503 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/checkpoint-8000/transformer/config.json
|
| 38 |
+
317 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/UPLOAD_NOTES.md
|
| 39 |
+
195 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/FastVideo.git_status.txt
|
| 40 |
+
148 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/cache/RESTORE.txt
|
| 41 |
+
100 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/package_du.txt
|
| 42 |
+
42 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/FastVideo.untracked_files.txt
|
| 43 |
+
0 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/package_filelist.tsv
|
| 44 |
+
0 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/PACKAGE_COMPLETE
|
model_cache_code_step8000/metadata/package_tree_depth3.txt
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2026-05-21 15:45 19999235584 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/checkpoints/ema_checkpoint-8000/diffusion_pytorch_model.safetensors
|
| 2 |
+
2026-05-21 15:53 427900 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/logs/gpu_monitor.log
|
| 3 |
+
2026-05-21 15:53 2011580 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/logs/train.log
|
| 4 |
+
2026-05-23 10:03 42 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/FastVideo.untracked_files.txt
|
| 5 |
+
2026-05-23 10:03 195 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/FastVideo.git_status.txt
|
| 6 |
+
2026-05-23 10:03 1024 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/cache_summary.json
|
| 7 |
+
2026-05-23 10:03 1253 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/base_model_symlinks.txt
|
| 8 |
+
2026-05-23 10:03 1276 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/train_args.json
|
| 9 |
+
2026-05-23 10:03 1863 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/TwoFrame.untracked_files.txt
|
| 10 |
+
2026-05-23 10:03 1960 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/train_health.json
|
| 11 |
+
2026-05-23 10:03 9446 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/FastVideo.uncommitted.diff
|
| 12 |
+
2026-05-23 10:03 9667 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/TwoFrame.git_status.txt
|
| 13 |
+
2026-05-23 10:03 74115 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/TwoFrame.uncommitted.diff
|
| 14 |
+
2026-05-23 10:03 160328081 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/code/twoframe_fastvideo_code_snapshot.tar.zst
|
| 15 |
+
2026-05-23 10:05 21474836480 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/cache/wan22_pants_v2_softwin.tar.zst.part-000
|
| 16 |
+
2026-05-23 10:06 21474836480 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/cache/wan22_pants_v2_softwin.tar.zst.part-001
|
| 17 |
+
2026-05-23 10:07 21474836480 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/cache/wan22_pants_v2_softwin.tar.zst.part-002
|
| 18 |
+
2026-05-23 10:08 148 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/cache/RESTORE.txt
|
| 19 |
+
2026-05-23 10:08 317 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/UPLOAD_NOTES.md
|
| 20 |
+
2026-05-23 10:08 7936917186 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/cache/wan22_pants_v2_softwin.tar.zst.part-003
|
| 21 |
+
2026-05-23 10:11 0 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/PACKAGE_COMPLETE
|
| 22 |
+
2026-05-23 10:25 1538 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/HF_UPLOAD.md
|
| 23 |
+
2026-05-23 10:25 1608 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/asset_manifest.json
|
| 24 |
+
2026-05-23 10:25 1806 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/DATA_ASSETS.md
|
| 25 |
+
2026-05-23 10:25 2169 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/CODE_USAGE.md
|
| 26 |
+
2026-05-23 10:25 2674 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/README.md
|
| 27 |
+
2026-05-23 10:26 6382 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/package_filelist.tsv
|
| 28 |
+
2026-05-23 10:28 0 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/package_tree_depth3.txt
|
| 29 |
+
2026-05-23 10:28 100 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/metadata/package_du.txt
|
| 30 |
+
2026-05-23 10:28 8971 /scratch/user/yuhwang/artifacts/twoframe/hf_upload/pants_wan22_b16_9k_step8000_20260523_100252/SHA256SUMS.txt
|
model_cache_code_step8000/metadata/train_args.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"data_path": "/scratch/user/yuhwang/dataset/pants-captions-ldm/cache/wan22_pants_v2_softwin",
|
| 3 |
+
"dataloader_num_workers": 2,
|
| 4 |
+
"num_height": 320,
|
| 5 |
+
"num_width": 288,
|
| 6 |
+
"num_frames": 153,
|
| 7 |
+
"train_batch_size": 16,
|
| 8 |
+
"num_latent_t": 39,
|
| 9 |
+
"pretrained_model_name_or_path": "/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged",
|
| 10 |
+
"ema_decay": 0.999,
|
| 11 |
+
"ema_start_step": 1,
|
| 12 |
+
"training_cfg_rate": 0.05,
|
| 13 |
+
"tracker_project_name": "pants_wan22_fullrep",
|
| 14 |
+
"wandb_run_name": "pants_b16_9k_20260519_215532",
|
| 15 |
+
"output_dir": "/scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532",
|
| 16 |
+
"checkpoints_total_limit": 2,
|
| 17 |
+
"training_state_checkpointing_steps": 4000,
|
| 18 |
+
"max_train_steps": 9000,
|
| 19 |
+
"gradient_accumulation_steps": 1,
|
| 20 |
+
"learning_rate": 1e-06,
|
| 21 |
+
"lr_scheduler": "constant",
|
| 22 |
+
"lr_warmup_steps": 0,
|
| 23 |
+
"max_grad_norm": 1.0,
|
| 24 |
+
"enable_gradient_checkpointing_type": "full",
|
| 25 |
+
"mixed_precision": "bf16",
|
| 26 |
+
"train_sp_batch_size": 1,
|
| 27 |
+
"num_euler_timesteps": 50,
|
| 28 |
+
"weight_decay": 0.01,
|
| 29 |
+
"use_ema": true,
|
| 30 |
+
"model_path": "/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged",
|
| 31 |
+
"inference_mode": false,
|
| 32 |
+
"num_gpus": 8,
|
| 33 |
+
"tp_size": 1,
|
| 34 |
+
"sp_size": 1,
|
| 35 |
+
"hsdp_replicate_dim": 8,
|
| 36 |
+
"hsdp_shard_dim": 1,
|
| 37 |
+
"dit_precision": "fp32"
|
| 38 |
+
}
|
model_cache_code_step8000/metadata/train_health.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"max_step_seen": 8016,
|
| 3 |
+
"target_steps_seen": 9000,
|
| 4 |
+
"traceback_count": 0,
|
| 5 |
+
"oom_count": 0,
|
| 6 |
+
"runtime_error_count": 0,
|
| 7 |
+
"nan_count": 0,
|
| 8 |
+
"last_checkpoint_lines": [
|
| 9 |
+
"INFO 05-20 15:26:04.480 [training_pipeline.py:515] Saved EMA transformer weights to /scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532/ema_checkpoint-4000",
|
| 10 |
+
"INFO 05-21 15:44:03.254 [training_utils.py:144] rank: 0, distributed checkpoint saved in 16.53 seconds",
|
| 11 |
+
"INFO 05-21 15:44:03.256 [training_utils.py:144] rank: 5, distributed checkpoint saved in 25.37 seconds",
|
| 12 |
+
"INFO 05-21 15:44:03.258 [training_utils.py:144] rank: 4, distributed checkpoint saved in 25.46 seconds",
|
| 13 |
+
"INFO 05-21 15:44:03.259 [training_utils.py:144] rank: 1, distributed checkpoint saved in 15.65 seconds",
|
| 14 |
+
"INFO 05-21 15:44:03.264 [training_utils.py:144] rank: 3, distributed checkpoint saved in 15.38 seconds",
|
| 15 |
+
"INFO 05-21 15:44:03.265 [training_utils.py:144] rank: 6, distributed checkpoint saved in 25.33 seconds",
|
| 16 |
+
"INFO 05-21 15:44:04.142 [training_utils.py:144] rank: 7, distributed checkpoint saved in 16.38 seconds",
|
| 17 |
+
"INFO 05-21 15:44:04.184 [training_utils.py:144] rank: 2, distributed checkpoint saved in 26.32 seconds",
|
| 18 |
+
"INFO 05-21 15:44:51.122 [training_utils.py:161] rank: 0, consolidated checkpoint saved to /scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532/checkpoint-8000/transformer/diffusion_pytorch_model.safetensors",
|
| 19 |
+
"INFO 05-21 15:44:51.127 [training_utils.py:171] --> checkpoint saved at step 8000 to /scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532/checkpoint-8000/transformer/diffusion_pytorch_model.safetensors",
|
| 20 |
+
"INFO 05-21 15:45:42.653 [training_pipeline.py:515] Saved EMA transformer weights to /scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune/pants_b16_9k_20260519_215532/ema_checkpoint-8000"
|
| 21 |
+
]
|
| 22 |
+
}
|
raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_8h200/resolution_records.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_8h200/resolution_report.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PanTS Raw Resolution Analysis
|
| 2 |
+
|
| 3 |
+
Generated on `2026-05-19 16:18:46 PDT` inside allocation `524904` on `ggpu3-13`.
|
| 4 |
+
|
| 5 |
+
## Integrity
|
| 6 |
+
- Cases parsed from metadata: **9901**
|
| 7 |
+
- Split counts: `{'val': 819, 'train': 8181, 'test': 901}`
|
| 8 |
+
- FOV counts: `{'chest_abdomen': 2454, 'chest_abdomen_pelvis': 2624, 'whole_body': 4618, 'abdomen_pelvis': 100, 'abdomen_only': 105}`
|
| 9 |
+
- CT header mismatches vs metadata: **0**
|
| 10 |
+
- Label header mismatches vs CT headers: **0**
|
| 11 |
+
- Header read errors: **0**
|
| 12 |
+
|
| 13 |
+
## Overall Distributions
|
| 14 |
+
| metric | n | min | p5 | p25 | p50 | p75 | p95 | p99 | max |
|
| 15 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 16 |
+
| shape_x_vox | 9901 | 29 | 151 | 443 | 497 | 512 | 512 | 589 | 1.06e+03 |
|
| 17 |
+
| shape_y_vox | 9901 | 48 | 164 | 308 | 361 | 403 | 457 | 493 | 547 |
|
| 18 |
+
| shape_z_slices | 9901 | 8 | 61 | 128 | 190 | 222 | 343 | 391 | 1.06e+03 |
|
| 19 |
+
| spacing_x_mm | 9901 | 0.423 | 0.637 | 0.742 | 0.809 | 0.977 | 1.5 | 5 | 5 |
|
| 20 |
+
| spacing_y_mm | 9901 | 0.393 | 0.641 | 0.738 | 0.797 | 0.949 | 1.5 | 1.5 | 5 |
|
| 21 |
+
| spacing_z_mm | 9901 | 0.363 | 0.781 | 0.8 | 1.25 | 2.5 | 5 | 5 | 10 |
|
| 22 |
+
| phys_x_mm | 9901 | 70.5 | 294 | 349 | 380 | 416 | 499 | 512 | 1.42e+03 |
|
| 23 |
+
| phys_y_mm | 9901 | 72 | 217 | 255 | 285 | 320 | 377 | 412 | 500 |
|
| 24 |
+
| phys_z_mm | 9901 | 6.4 | 138 | 172 | 212 | 332 | 505 | 690 | 860 |
|
| 25 |
+
| voxel_count_M | 9901 | 0.379 | 4.69 | 14.4 | 29.3 | 43.2 | 57.6 | 90.5 | 240 |
|
| 26 |
+
|
| 27 |
+
## FOV Groups
|
| 28 |
+
| fov | n | z slices p50/p95 | z spacing p50/p95 mm | physical Z p50/p95 mm | physical XY p50 mm | voxel count p50/p95 M |
|
| 29 |
+
|---|---:|---:|---:|---:|---:|---:|
|
| 30 |
+
| abdomen_only | 105 | 125/221 | 1.50/1.50 | 153.0/199.2 | 325.5 x 243.9 | 5.1/44.5 |
|
| 31 |
+
| abdomen_pelvis | 100 | 150/228 | 1.50/5.00 | 221.0/329.1 | 357.8 x 247.5 | 5.8/36.4 |
|
| 32 |
+
| chest_abdomen | 2454 | 200/251 | 0.80/5.00 | 180.0/304.5 | 364.5 x 278.7 | 36.0/53.1 |
|
| 33 |
+
| chest_abdomen_pelvis | 2624 | 154/358 | 1.50/5.00 | 250.5/390.0 | 391.0 x 294.4 | 21.4/79.7 |
|
| 34 |
+
| whole_body | 4618 | 204/353 | 1.00/5.00 | 226.1/627.0 | 385.2 x 286.5 | 31.6/57.2 |
|
| 35 |
+
|
| 36 |
+
## Existing Bucket Coverage If Full-Volume Buckets Are Used
|
| 37 |
+
| bucket | n | crop any % | crop z/y/x % | physical Z p50/p95/max mm | physical Y p95/max mm | physical X p95/max mm | resampled shape p95 z/y/x vox |
|
| 38 |
+
|---|---:|---:|---:|---:|---:|---:|---:|
|
| 39 |
+
| B-CA | 2454 | 6.7 | 6.7/0.0/0.0 | 180.0/304.5/820.0 | 359.9/461.1 | 447.1/512.0 | 87/180/224 |
|
| 40 |
+
| B-CAP | 2624 | 12.2 | 12.2/0.0/0.0 | 250.5/390.0/720.0 | 390.2/499.5 | 472.0/512.0 | 98/195/236 |
|
| 41 |
+
| B-abd | 105 | 8.6 | 8.6/0.0/0.0 | 153.0/199.2/358.5 | 337.5/370.5 | 399.8/480.0 | 66/169/200 |
|
| 42 |
+
| B-abd-pelvis | 100 | 58.0 | 58.0/0.0/0.0 | 221.0/329.1/510.0 | 356.8/394.5 | 459.5/496.1 | 110/178/230 |
|
| 43 |
+
| B-whole | 4618 | 6.0 | 4.4/0.0/1.8 | 226.1/627.0/860.0 | 371.6/498.0 | 512.0/1416.0 | 125/186/256 |
|
| 44 |
+
|
| 45 |
+
## Pancreas BBox For B-pan
|
| 46 |
+
- Cases with pancreas bbox: **9442**
|
| 47 |
+
- 40 mm padded bbox fit rate into B-pan coverage `(Z,Y,X)=(128,192,256) mm`: **8.2%**
|
| 48 |
+
- Over target by axis X/Y/Z: **8.5% / 2.6% / 87.8%**
|
| 49 |
+
|
| 50 |
+
| metric | n | min | p5 | p25 | p50 | p75 | p95 | p99 | max |
|
| 51 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 52 |
+
| bbox_x_mm | 9442 | 0 | 81 | 118 | 136 | 152 | 193 | 468 | 875 |
|
| 53 |
+
| bbox_y_mm | 9442 | 0 | 41.7 | 59.6 | 71.4 | 83.4 | 104 | 123 | 190 |
|
| 54 |
+
| bbox_z_mm | 9442 | 0 | 19.5 | 66 | 80 | 90 | 109 | 146 | 452 |
|
| 55 |
+
| padded_x_mm | 9442 | 80 | 161 | 198 | 216 | 232 | 273 | 548 | 955 |
|
| 56 |
+
| padded_y_mm | 9442 | 80 | 122 | 140 | 151 | 163 | 184 | 203 | 270 |
|
| 57 |
+
| padded_z_mm | 9442 | 80 | 99.5 | 146 | 160 | 170 | 189 | 226 | 532 |
|
| 58 |
+
|
| 59 |
+
## Initial Read
|
| 60 |
+
- The native in-plane spacing is comparatively tight and less variable than z spacing; z spacing and z slice count carry most of the diversity.
|
| 61 |
+
- A single full-volume grid would either waste memory on thin-slice studies or crop thick-FOV studies. Bucket by physical FOV first, then by z-spacing/coverage within FOV.
|
| 62 |
+
- `B-pan` is a much more stable target than whole-volume buckets, but the current 40 mm pad plus 128 mm Z coverage should be treated as a policy choice, not assumed universal.
|
| 63 |
+
|
| 64 |
+
## Artifacts
|
| 65 |
+
- CSV: `/scratch/user/yuhwang/dataset/pants-captions-ldm/audit/resolution_analysis_20260519_8h200/resolution_records.csv`
|
| 66 |
+
- JSON: `/scratch/user/yuhwang/dataset/pants-captions-ldm/audit/resolution_analysis_20260519_8h200/resolution_summary.json`
|
raw_pants_train_test/metadata/pants-captions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[],
|
| 7 |
+
"label_header_mismatch_count": 0,
|
| 8 |
+
"label_header_mismatch_examples": [],
|
| 9 |
+
"header_error_count": 0,
|
| 10 |
+
"header_error_examples": [],
|
| 11 |
+
"split_counts": {
|
| 12 |
+
"val": 819,
|
| 13 |
+
"train": 8181,
|
| 14 |
+
"test": 901
|
| 15 |
+
},
|
| 16 |
+
"fov_counts": {
|
| 17 |
+
"chest_abdomen": 2454,
|
| 18 |
+
"chest_abdomen_pelvis": 2624,
|
| 19 |
+
"whole_body": 4618,
|
| 20 |
+
"abdomen_pelvis": 100,
|
| 21 |
+
"abdomen_only": 105
|
| 22 |
+
},
|
| 23 |
+
"phase_counts": {
|
| 24 |
+
"Non-contrast": 4485,
|
| 25 |
+
"Venous": 2897,
|
| 26 |
+
"Arterial": 2450,
|
| 27 |
+
"unknown": 1,
|
| 28 |
+
"Delay": 68
|
| 29 |
+
},
|
| 30 |
+
"lesion_counts": {
|
| 31 |
+
"False": 8943,
|
| 32 |
+
"True": 958
|
| 33 |
+
},
|
| 34 |
+
"overall": {
|
| 35 |
+
"n": 9901,
|
| 36 |
+
"shape_x": {
|
| 37 |
+
"n": 9901,
|
| 38 |
+
"p0": 29.0,
|
| 39 |
+
"p1": 66.0,
|
| 40 |
+
"p5": 151.0,
|
| 41 |
+
"p10": 230.0,
|
| 42 |
+
"p25": 443.0,
|
| 43 |
+
"p50": 497.0,
|
| 44 |
+
"p75": 512.0,
|
| 45 |
+
"p90": 512.0,
|
| 46 |
+
"p95": 512.0,
|
| 47 |
+
"p99": 589.0,
|
| 48 |
+
"p100": 1059.0,
|
| 49 |
+
"mean": 442.3113826886173
|
| 50 |
+
},
|
| 51 |
+
"shape_y": {
|
| 52 |
+
"n": 9901,
|
| 53 |
+
"p0": 48.0,
|
| 54 |
+
"p1": 120.0,
|
| 55 |
+
"p5": 164.0,
|
| 56 |
+
"p10": 200.0,
|
| 57 |
+
"p25": 308.0,
|
| 58 |
+
"p50": 361.0,
|
| 59 |
+
"p75": 403.0,
|
| 60 |
+
"p90": 437.0,
|
| 61 |
+
"p95": 457.0,
|
| 62 |
+
"p99": 493.0,
|
| 63 |
+
"p100": 547.0,
|
| 64 |
+
"mean": 345.04029895970103
|
| 65 |
+
},
|
| 66 |
+
"shape_z": {
|
| 67 |
+
"n": 9901,
|
| 68 |
+
"p0": 8.0,
|
| 69 |
+
"p1": 38.0,
|
| 70 |
+
"p5": 61.0,
|
| 71 |
+
"p10": 89.0,
|
| 72 |
+
"p25": 128.0,
|
| 73 |
+
"p50": 190.0,
|
| 74 |
+
"p75": 222.0,
|
| 75 |
+
"p90": 268.0,
|
| 76 |
+
"p95": 343.0,
|
| 77 |
+
"p99": 391.0,
|
| 78 |
+
"p100": 1060.0,
|
| 79 |
+
"mean": 184.45157054842946
|
| 80 |
+
},
|
| 81 |
+
"spacing_x_mm": {
|
| 82 |
+
"n": 9901,
|
| 83 |
+
"p0": 0.423177,
|
| 84 |
+
"p1": 0.546875,
|
| 85 |
+
"p5": 0.63671875,
|
| 86 |
+
"p10": 0.673828,
|
| 87 |
+
"p25": 0.7421875,
|
| 88 |
+
"p50": 0.80859375,
|
| 89 |
+
"p75": 0.9765625,
|
| 90 |
+
"p90": 1.5,
|
| 91 |
+
"p95": 1.5,
|
| 92 |
+
"p99": 5.0,
|
| 93 |
+
"p100": 5.0,
|
| 94 |
+
"mean": 1.0141072157539641
|
| 95 |
+
},
|
| 96 |
+
"spacing_y_mm": {
|
| 97 |
+
"n": 9901,
|
| 98 |
+
"p0": 0.39257812,
|
| 99 |
+
"p1": 0.583984,
|
| 100 |
+
"p5": 0.640625,
|
| 101 |
+
"p10": 0.673828,
|
| 102 |
+
"p25": 0.738281,
|
| 103 |
+
"p50": 0.796875,
|
| 104 |
+
"p75": 0.94921875,
|
| 105 |
+
"p90": 1.5,
|
| 106 |
+
"p95": 1.5,
|
| 107 |
+
"p99": 1.5,
|
| 108 |
+
"p100": 5.0,
|
| 109 |
+
"mean": 0.8918515932542169
|
| 110 |
+
},
|
| 111 |
+
"spacing_z_mm": {
|
| 112 |
+
"n": 9901,
|
| 113 |
+
"p0": 0.36330372,
|
| 114 |
+
"p1": 0.625,
|
| 115 |
+
"p5": 0.78125,
|
| 116 |
+
"p10": 0.8,
|
| 117 |
+
"p25": 0.8,
|
| 118 |
+
"p50": 1.25,
|
| 119 |
+
"p75": 2.5,
|
| 120 |
+
"p90": 5.0,
|
| 121 |
+
"p95": 5.0,
|
| 122 |
+
"p99": 5.0,
|
| 123 |
+
"p100": 10.0,
|
| 124 |
+
"mean": 1.770136743993536
|
| 125 |
+
},
|
| 126 |
+
"phys_x_mm": {
|
| 127 |
+
"n": 9901,
|
| 128 |
+
"p0": 70.5,
|
| 129 |
+
"p1": 175.0,
|
| 130 |
+
"p5": 293.51540400000005,
|
| 131 |
+
"p10": 318.000128,
|
| 132 |
+
"p25": 349.184,
|
| 133 |
+
"p50": 380.000256,
|
| 134 |
+
"p75": 416.38293200000004,
|
| 135 |
+
"p90": 470.0,
|
| 136 |
+
"p95": 499.0,
|
| 137 |
+
"p99": 512.0,
|
| 138 |
+
"p100": 1416.0,
|
| 139 |
+
"mean": 383.5881392455348
|
| 140 |
+
},
|
| 141 |
+
"phys_y_mm": {
|
| 142 |
+
"n": 9901,
|
| 143 |
+
"p0": 72.0000048,
|
| 144 |
+
"p1": 180.11731999999998,
|
| 145 |
+
"p5": 216.5625,
|
| 146 |
+
"p10": 229.789096,
|
| 147 |
+
"p25": 255.38276399999998,
|
| 148 |
+
"p50": 285.46875,
|
| 149 |
+
"p75": 319.55272510000003,
|
| 150 |
+
"p90": 357.6406344,
|
| 151 |
+
"p95": 377.25,
|
| 152 |
+
"p99": 411.796875,
|
| 153 |
+
"p100": 499.5,
|
| 154 |
+
"mean": 289.1432168380719
|
| 155 |
+
},
|
| 156 |
+
"phys_z_mm": {
|
| 157 |
+
"n": 9901,
|
| 158 |
+
"p0": 6.4,
|
| 159 |
+
"p1": 100.0,
|
| 160 |
+
"p5": 137.5,
|
| 161 |
+
"p10": 152.0,
|
| 162 |
+
"p25": 171.875,
|
| 163 |
+
"p50": 212.5,
|
| 164 |
+
"p75": 332.5,
|
| 165 |
+
"p90": 440.0,
|
| 166 |
+
"p95": 505.0,
|
| 167 |
+
"p99": 690.0,
|
| 168 |
+
"p100": 860.0,
|
| 169 |
+
"mean": 259.71209611028786
|
| 170 |
+
},
|
| 171 |
+
"voxel_count_m": {
|
| 172 |
+
"n": 9901,
|
| 173 |
+
"p0": 0.3792,
|
| 174 |
+
"p1": 1.658684,
|
| 175 |
+
"p5": 4.686672,
|
| 176 |
+
"p10": 6.509118,
|
| 177 |
+
"p25": 14.44216,
|
| 178 |
+
"p50": 29.3433,
|
| 179 |
+
"p75": 43.225875,
|
| 180 |
+
"p90": 51.67104,
|
| 181 |
+
"p95": 57.575808,
|
| 182 |
+
"p99": 90.486784,
|
| 183 |
+
"p100": 240.28928,
|
| 184 |
+
"mean": 30.052378630340375
|
| 185 |
+
}
|
| 186 |
+
},
|
| 187 |
+
"by_fov": {
|
| 188 |
+
"abdomen_only": {
|
| 189 |
+
"n": 105,
|
| 190 |
+
"shape_x": {
|
| 191 |
+
"n": 105,
|
| 192 |
+
"p0": 29.0,
|
| 193 |
+
"p1": 36.68,
|
| 194 |
+
"p5": 86.4,
|
| 195 |
+
"p10": 106.6,
|
| 196 |
+
"p25": 127.0,
|
| 197 |
+
"p50": 245.0,
|
| 198 |
+
"p75": 512.0,
|
| 199 |
+
"p90": 512.0,
|
| 200 |
+
"p95": 512.0,
|
| 201 |
+
"p99": 512.0,
|
| 202 |
+
"p100": 512.0,
|
| 203 |
+
"mean": 307.95238095238096
|
| 204 |
+
},
|
| 205 |
+
"shape_y": {
|
| 206 |
+
"n": 105,
|
| 207 |
+
"p0": 89.0,
|
| 208 |
+
"p1": 94.44,
|
| 209 |
+
"p5": 111.2,
|
| 210 |
+
"p10": 124.4,
|
| 211 |
+
"p25": 143.0,
|
| 212 |
+
"p50": 271.0,
|
| 213 |
+
"p75": 372.0,
|
| 214 |
+
"p90": 392.6,
|
| 215 |
+
"p95": 428.79999999999995,
|
| 216 |
+
"p99": 448.88,
|
| 217 |
+
"p100": 456.0,
|
| 218 |
+
"mean": 261.74285714285713
|
| 219 |
+
},
|
| 220 |
+
"shape_z": {
|
| 221 |
+
"n": 105,
|
| 222 |
+
"p0": 33.0,
|
| 223 |
+
"p1": 40.12,
|
| 224 |
+
"p5": 51.4,
|
| 225 |
+
"p10": 60.0,
|
| 226 |
+
"p25": 100.0,
|
| 227 |
+
"p50": 125.0,
|
| 228 |
+
"p75": 204.0,
|
| 229 |
+
"p90": 214.0,
|
| 230 |
+
"p95": 221.39999999999998,
|
| 231 |
+
"p99": 239.95999999999998,
|
| 232 |
+
"p100": 258.0,
|
| 233 |
+
"mean": 141.85714285714286
|
| 234 |
+
},
|
| 235 |
+
"spacing_x_mm": {
|
| 236 |
+
"n": 105,
|
| 237 |
+
"p0": 0.5859375,
|
| 238 |
+
"p1": 0.603749976,
|
| 239 |
+
"p5": 0.62617188,
|
| 240 |
+
"p10": 0.6605466600000001,
|
| 241 |
+
"p25": 0.703125,
|
| 242 |
+
"p50": 1.5,
|
| 243 |
+
"p75": 1.5,
|
| 244 |
+
"p90": 1.5,
|
| 245 |
+
"p95": 2.300000019999997,
|
| 246 |
+
"p99": 4.9199999999999875,
|
| 247 |
+
"p100": 5.0,
|
| 248 |
+
"mean": 1.2633782738095238
|
| 249 |
+
},
|
| 250 |
+
"spacing_y_mm": {
|
| 251 |
+
"n": 105,
|
| 252 |
+
"p0": 0.546875,
|
| 253 |
+
"p1": 0.586640624,
|
| 254 |
+
"p5": 0.6218752000000001,
|
| 255 |
+
"p10": 0.6558594400000001,
|
| 256 |
+
"p25": 0.703125,
|
| 257 |
+
"p50": 0.9765625,
|
| 258 |
+
"p75": 1.5,
|
| 259 |
+
"p90": 1.5,
|
| 260 |
+
"p95": 1.5,
|
| 261 |
+
"p99": 1.500000096,
|
| 262 |
+
"p100": 1.5000001,
|
| 263 |
+
"mean": 1.1105694852380954
|
| 264 |
+
},
|
| 265 |
+
"spacing_z_mm": {
|
| 266 |
+
"n": 105,
|
| 267 |
+
"p0": 0.546875,
|
| 268 |
+
"p1": 0.7016874999999999,
|
| 269 |
+
"p5": 0.79999995,
|
| 270 |
+
"p10": 0.8,
|
| 271 |
+
"p25": 0.8,
|
| 272 |
+
"p50": 1.5,
|
| 273 |
+
"p75": 1.5,
|
| 274 |
+
"p90": 1.5,
|
| 275 |
+
"p95": 1.5,
|
| 276 |
+
"p99": 1.5000001,
|
| 277 |
+
"p100": 2.5,
|
| 278 |
+
"mean": 1.186990442857143
|
| 279 |
+
},
|
| 280 |
+
"phys_x_mm": {
|
| 281 |
+
"n": 105,
|
| 282 |
+
"p0": 127.5,
|
| 283 |
+
"p1": 138.28,
|
| 284 |
+
"p5": 155.1,
|
| 285 |
+
"p10": 171.0,
|
| 286 |
+
"p25": 190.5,
|
| 287 |
+
"p50": 325.5,
|
| 288 |
+
"p75": 360.0,
|
| 289 |
+
"p90": 386.21016096,
|
| 290 |
+
"p95": 399.84375,
|
| 291 |
+
"p99": 431.82,
|
| 292 |
+
"p100": 480.0,
|
| 293 |
+
"mean": 293.3386327304762
|
| 294 |
+
},
|
| 295 |
+
"phys_y_mm": {
|
| 296 |
+
"n": 105,
|
| 297 |
+
"p0": 133.5,
|
| 298 |
+
"p1": 141.659990976,
|
| 299 |
+
"p5": 166.8,
|
| 300 |
+
"p10": 186.6,
|
| 301 |
+
"p25": 214.5,
|
| 302 |
+
"p50": 243.90625,
|
| 303 |
+
"p75": 273.515625,
|
| 304 |
+
"p90": 319.5851605600001,
|
| 305 |
+
"p95": 337.5,
|
| 306 |
+
"p99": 369.07481856,
|
| 307 |
+
"p100": 370.5,
|
| 308 |
+
"mean": 247.89313983761906
|
| 309 |
+
},
|
| 310 |
+
"phys_z_mm": {
|
| 311 |
+
"n": 105,
|
| 312 |
+
"p0": 49.5,
|
| 313 |
+
"p1": 54.0,
|
| 314 |
+
"p5": 80.4,
|
| 315 |
+
"p10": 91.8,
|
| 316 |
+
"p25": 128.0,
|
| 317 |
+
"p50": 153.0,
|
| 318 |
+
"p75": 169.60000000000002,
|
| 319 |
+
"p90": 186.90000496000002,
|
| 320 |
+
"p95": 199.2187296,
|
| 321 |
+
"p99": 301.97999999999985,
|
| 322 |
+
"p100": 358.5,
|
| 323 |
+
"mean": 150.38443630095242
|
| 324 |
+
},
|
| 325 |
+
"voxel_count_m": {
|
| 326 |
+
"n": 105,
|
| 327 |
+
"p0": 0.6358,
|
| 328 |
+
"p1": 0.88568352,
|
| 329 |
+
"p5": 1.1560308,
|
| 330 |
+
"p10": 1.353142,
|
| 331 |
+
"p25": 1.851564,
|
| 332 |
+
"p50": 5.113125,
|
| 333 |
+
"p75": 36.203328,
|
| 334 |
+
"p90": 41.514393600000005,
|
| 335 |
+
"p95": 44.4630016,
|
| 336 |
+
"p99": 47.63025407999999,
|
| 337 |
+
"p100": 48.106496,
|
| 338 |
+
"mean": 16.827736723809526
|
| 339 |
+
}
|
| 340 |
+
},
|
| 341 |
+
"abdomen_pelvis": {
|
| 342 |
+
"n": 100,
|
| 343 |
+
"shape_x": {
|
| 344 |
+
"n": 100,
|
| 345 |
+
"p0": 50.0,
|
| 346 |
+
"p1": 92.57,
|
| 347 |
+
"p5": 114.0,
|
| 348 |
+
"p10": 128.8,
|
| 349 |
+
"p25": 217.75,
|
| 350 |
+
"p50": 250.0,
|
| 351 |
+
"p75": 390.75,
|
| 352 |
+
"p90": 506.0,
|
| 353 |
+
"p95": 510.05,
|
| 354 |
+
"p99": 514.3100000000012,
|
| 355 |
+
"p100": 743.0,
|
| 356 |
+
"mean": 289.02
|
| 357 |
+
},
|
| 358 |
+
"shape_y": {
|
| 359 |
+
"n": 100,
|
| 360 |
+
"p0": 91.0,
|
| 361 |
+
"p1": 109.81,
|
| 362 |
+
"p5": 122.9,
|
| 363 |
+
"p10": 131.9,
|
| 364 |
+
"p25": 142.75,
|
| 365 |
+
"p50": 171.5,
|
| 366 |
+
"p75": 280.25,
|
| 367 |
+
"p90": 351.0000000000001,
|
| 368 |
+
"p95": 374.0,
|
| 369 |
+
"p99": 427.27000000000015,
|
| 370 |
+
"p100": 454.0,
|
| 371 |
+
"mean": 206.57
|
| 372 |
+
},
|
| 373 |
+
"shape_z": {
|
| 374 |
+
"n": 100,
|
| 375 |
+
"p0": 29.0,
|
| 376 |
+
"p1": 36.92,
|
| 377 |
+
"p5": 41.95,
|
| 378 |
+
"p10": 54.0,
|
| 379 |
+
"p25": 97.0,
|
| 380 |
+
"p50": 150.5,
|
| 381 |
+
"p75": 180.5,
|
| 382 |
+
"p90": 206.2000000000001,
|
| 383 |
+
"p95": 228.14999999999998,
|
| 384 |
+
"p99": 240.07000000000005,
|
| 385 |
+
"p100": 247.0,
|
| 386 |
+
"mean": 138.65
|
| 387 |
+
},
|
| 388 |
+
"spacing_x_mm": {
|
| 389 |
+
"n": 100,
|
| 390 |
+
"p0": 0.5,
|
| 391 |
+
"p1": 0.598613306,
|
| 392 |
+
"p5": 0.70306875,
|
| 393 |
+
"p10": 0.78125,
|
| 394 |
+
"p25": 0.976562,
|
| 395 |
+
"p50": 1.5,
|
| 396 |
+
"p75": 1.5,
|
| 397 |
+
"p90": 1.5,
|
| 398 |
+
"p95": 1.5,
|
| 399 |
+
"p99": 1.500000001,
|
| 400 |
+
"p100": 1.5000001,
|
| 401 |
+
"mean": 1.3225246470000003
|
| 402 |
+
},
|
| 403 |
+
"spacing_y_mm": {
|
| 404 |
+
"n": 100,
|
| 405 |
+
"p0": 0.5996094,
|
| 406 |
+
"p1": 0.655436094,
|
| 407 |
+
"p5": 0.703125,
|
| 408 |
+
"p10": 0.7882250000000001,
|
| 409 |
+
"p25": 0.976562,
|
| 410 |
+
"p50": 1.5,
|
| 411 |
+
"p75": 1.5,
|
| 412 |
+
"p90": 1.5,
|
| 413 |
+
"p95": 1.5,
|
| 414 |
+
"p99": 1.5000001,
|
| 415 |
+
"p100": 1.5000001,
|
| 416 |
+
"mean": 1.3257668365000002
|
| 417 |
+
},
|
| 418 |
+
"spacing_z_mm": {
|
| 419 |
+
"n": 100,
|
| 420 |
+
"p0": 0.8,
|
| 421 |
+
"p1": 0.8,
|
| 422 |
+
"p5": 0.8,
|
| 423 |
+
"p10": 1.47499991,
|
| 424 |
+
"p25": 1.5,
|
| 425 |
+
"p50": 1.5,
|
| 426 |
+
"p75": 1.5,
|
| 427 |
+
"p90": 5.0,
|
| 428 |
+
"p95": 5.0,
|
| 429 |
+
"p99": 5.0,
|
| 430 |
+
"p100": 5.0,
|
| 431 |
+
"mean": 1.9262421885
|
| 432 |
+
},
|
| 433 |
+
"phys_x_mm": {
|
| 434 |
+
"n": 100,
|
| 435 |
+
"p0": 75.0,
|
| 436 |
+
"p1": 138.855,
|
| 437 |
+
"p5": 171.0,
|
| 438 |
+
"p10": 193.2,
|
| 439 |
+
"p25": 325.124983725,
|
| 440 |
+
"p50": 357.7500119,
|
| 441 |
+
"p75": 395.3612775,
|
| 442 |
+
"p90": 430.4665443,
|
| 443 |
+
"p95": 459.525,
|
| 444 |
+
"p99": 493.19310686,
|
| 445 |
+
"p100": 496.093496,
|
| 446 |
+
"mean": 345.712107274
|
| 447 |
+
},
|
| 448 |
+
"phys_y_mm": {
|
| 449 |
+
"n": 100,
|
| 450 |
+
"p0": 136.5,
|
| 451 |
+
"p1": 164.715,
|
| 452 |
+
"p5": 184.350000605,
|
| 453 |
+
"p10": 196.34998821,
|
| 454 |
+
"p25": 212.25,
|
| 455 |
+
"p50": 247.5,
|
| 456 |
+
"p75": 282.0078125,
|
| 457 |
+
"p90": 308.79358080000003,
|
| 458 |
+
"p95": 356.8478735,
|
| 459 |
+
"p99": 369.39403164000015,
|
| 460 |
+
"p100": 394.5,
|
| 461 |
+
"mean": 250.30366472699998
|
| 462 |
+
},
|
| 463 |
+
"phys_z_mm": {
|
| 464 |
+
"n": 100,
|
| 465 |
+
"p0": 87.0,
|
| 466 |
+
"p1": 104.82,
|
| 467 |
+
"p5": 120.0,
|
| 468 |
+
"p10": 139.8,
|
| 469 |
+
"p25": 164.625,
|
| 470 |
+
"p50": 221.0,
|
| 471 |
+
"p75": 268.5,
|
| 472 |
+
"p90": 301.65001809000006,
|
| 473 |
+
"p95": 329.09999999999997,
|
| 474 |
+
"p99": 371.8950000000007,
|
| 475 |
+
"p100": 510.0,
|
| 476 |
+
"mean": 220.05740637399998
|
| 477 |
+
},
|
| 478 |
+
"voxel_count_m": {
|
| 479 |
+
"n": 100,
|
| 480 |
+
"p0": 0.702429,
|
| 481 |
+
"p1": 0.81288429,
|
| 482 |
+
"p5": 1.778685,
|
| 483 |
+
"p10": 2.0183675,
|
| 484 |
+
"p25": 4.391208,
|
| 485 |
+
"p50": 5.8342515,
|
| 486 |
+
"p75": 8.87931225,
|
| 487 |
+
"p90": 18.4301856,
|
| 488 |
+
"p95": 36.44542439999998,
|
| 489 |
+
"p99": 50.84427834000002,
|
| 490 |
+
"p100": 54.56592,
|
| 491 |
+
"mean": 9.1297059
|
| 492 |
+
}
|
| 493 |
+
},
|
| 494 |
+
"chest_abdomen": {
|
| 495 |
+
"n": 2454,
|
| 496 |
+
"shape_x": {
|
| 497 |
+
"n": 2454,
|
| 498 |
+
"p0": 47.0,
|
| 499 |
+
"p1": 94.06,
|
| 500 |
+
"p5": 161.95000000000002,
|
| 501 |
+
"p10": 220.0,
|
| 502 |
+
"p25": 434.0,
|
| 503 |
+
"p50": 502.0,
|
| 504 |
+
"p75": 512.0,
|
| 505 |
+
"p90": 512.0,
|
| 506 |
+
"p95": 512.0,
|
| 507 |
+
"p99": 512.0,
|
| 508 |
+
"p100": 756.0,
|
| 509 |
+
"mean": 436.69804400977995
|
| 510 |
+
},
|
| 511 |
+
"shape_y": {
|
| 512 |
+
"n": 2454,
|
| 513 |
+
"p0": 48.0,
|
| 514 |
+
"p1": 112.53,
|
| 515 |
+
"p5": 146.0,
|
| 516 |
+
"p10": 170.0,
|
| 517 |
+
"p25": 306.25,
|
| 518 |
+
"p50": 366.0,
|
| 519 |
+
"p75": 408.0,
|
| 520 |
+
"p90": 438.0,
|
| 521 |
+
"p95": 456.3499999999999,
|
| 522 |
+
"p99": 496.4699999999998,
|
| 523 |
+
"p100": 512.0,
|
| 524 |
+
"mean": 339.9413202933985
|
| 525 |
+
},
|
| 526 |
+
"shape_z": {
|
| 527 |
+
"n": 2454,
|
| 528 |
+
"p0": 24.0,
|
| 529 |
+
"p1": 33.0,
|
| 530 |
+
"p5": 46.0,
|
| 531 |
+
"p10": 82.0,
|
| 532 |
+
"p25": 137.0,
|
| 533 |
+
"p50": 200.0,
|
| 534 |
+
"p75": 222.0,
|
| 535 |
+
"p90": 241.0,
|
| 536 |
+
"p95": 251.0,
|
| 537 |
+
"p99": 287.9399999999996,
|
| 538 |
+
"p100": 485.0,
|
| 539 |
+
"mean": 179.15484922575388
|
| 540 |
+
},
|
| 541 |
+
"spacing_x_mm": {
|
| 542 |
+
"n": 2454,
|
| 543 |
+
"p0": 0.45117188,
|
| 544 |
+
"p1": 0.580312525,
|
| 545 |
+
"p5": 0.62236345,
|
| 546 |
+
"p10": 0.652343825,
|
| 547 |
+
"p25": 0.703125,
|
| 548 |
+
"p50": 0.78125,
|
| 549 |
+
"p75": 0.9375,
|
| 550 |
+
"p90": 1.5,
|
| 551 |
+
"p95": 1.5,
|
| 552 |
+
"p99": 1.5000001,
|
| 553 |
+
"p100": 5.0,
|
| 554 |
+
"mean": 0.9198095958109209
|
| 555 |
+
},
|
| 556 |
+
"spacing_y_mm": {
|
| 557 |
+
"n": 2454,
|
| 558 |
+
"p0": 0.4375,
|
| 559 |
+
"p1": 0.5859375,
|
| 560 |
+
"p5": 0.625,
|
| 561 |
+
"p10": 0.652344,
|
| 562 |
+
"p25": 0.703125,
|
| 563 |
+
"p50": 0.78125,
|
| 564 |
+
"p75": 0.9169921875,
|
| 565 |
+
"p90": 1.5,
|
| 566 |
+
"p95": 1.5,
|
| 567 |
+
"p99": 1.5,
|
| 568 |
+
"p100": 3.0,
|
| 569 |
+
"mean": 0.899728540819071
|
| 570 |
+
},
|
| 571 |
+
"spacing_z_mm": {
|
| 572 |
+
"n": 2454,
|
| 573 |
+
"p0": 0.41847825,
|
| 574 |
+
"p1": 0.5,
|
| 575 |
+
"p5": 0.79999995,
|
| 576 |
+
"p10": 0.8,
|
| 577 |
+
"p25": 0.8,
|
| 578 |
+
"p50": 0.8,
|
| 579 |
+
"p75": 1.5,
|
| 580 |
+
"p90": 2.5,
|
| 581 |
+
"p95": 5.0,
|
| 582 |
+
"p99": 5.0,
|
| 583 |
+
"p100": 7.5,
|
| 584 |
+
"mean": 1.387247926271394
|
| 585 |
+
},
|
| 586 |
+
"phys_x_mm": {
|
| 587 |
+
"n": 2454,
|
| 588 |
+
"p0": 70.5,
|
| 589 |
+
"p1": 162.0,
|
| 590 |
+
"p5": 247.5,
|
| 591 |
+
"p10": 300.0,
|
| 592 |
+
"p25": 334.63687500000003,
|
| 593 |
+
"p50": 364.5,
|
| 594 |
+
"p75": 396.875,
|
| 595 |
+
"p90": 420.75004789000013,
|
| 596 |
+
"p95": 447.13250902499993,
|
| 597 |
+
"p99": 492.67007812499907,
|
| 598 |
+
"p100": 512.0,
|
| 599 |
+
"mean": 360.62140536214747
|
| 600 |
+
},
|
| 601 |
+
"phys_y_mm": {
|
| 602 |
+
"n": 2454,
|
| 603 |
+
"p0": 72.0000048,
|
| 604 |
+
"p1": 170.29500000000002,
|
| 605 |
+
"p5": 210.3299751,
|
| 606 |
+
"p10": 225.08422019999998,
|
| 607 |
+
"p25": 249.0,
|
| 608 |
+
"p50": 278.6621138,
|
| 609 |
+
"p75": 310.5,
|
| 610 |
+
"p90": 337.8390625000001,
|
| 611 |
+
"p95": 359.876849245,
|
| 612 |
+
"p99": 396.58191373999983,
|
| 613 |
+
"p100": 461.09765625,
|
| 614 |
+
"mean": 279.88780395224126
|
| 615 |
+
},
|
| 616 |
+
"phys_z_mm": {
|
| 617 |
+
"n": 2454,
|
| 618 |
+
"p0": 46.5,
|
| 619 |
+
"p1": 89.64750000000001,
|
| 620 |
+
"p5": 125.58000000000001,
|
| 621 |
+
"p10": 147.20000000000002,
|
| 622 |
+
"p25": 161.60010100000002,
|
| 623 |
+
"p50": 180.0,
|
| 624 |
+
"p75": 205.0,
|
| 625 |
+
"p90": 258.00001204,
|
| 626 |
+
"p95": 304.5,
|
| 627 |
+
"p99": 354.7049999999997,
|
| 628 |
+
"p100": 820.0,
|
| 629 |
+
"mean": 191.14249572569275
|
| 630 |
+
},
|
| 631 |
+
"voxel_count_m": {
|
| 632 |
+
"n": 2454,
|
| 633 |
+
"p0": 0.3792,
|
| 634 |
+
"p1": 1.29924567,
|
| 635 |
+
"p5": 3.15202185,
|
| 636 |
+
"p10": 5.0608155,
|
| 637 |
+
"p25": 9.625077,
|
| 638 |
+
"p50": 35.96288,
|
| 639 |
+
"p75": 43.9296,
|
| 640 |
+
"p90": 49.86544,
|
| 641 |
+
"p95": 53.1331584,
|
| 642 |
+
"p99": 59.72250186,
|
| 643 |
+
"p100": 98.694656,
|
| 644 |
+
"mean": 29.869590855745727
|
| 645 |
+
}
|
| 646 |
+
},
|
| 647 |
+
"chest_abdomen_pelvis": {
|
| 648 |
+
"n": 2624,
|
| 649 |
+
"shape_x": {
|
| 650 |
+
"n": 2624,
|
| 651 |
+
"p0": 51.0,
|
| 652 |
+
"p1": 109.46000000000001,
|
| 653 |
+
"p5": 219.15,
|
| 654 |
+
"p10": 236.0,
|
| 655 |
+
"p25": 420.75,
|
| 656 |
+
"p50": 488.0,
|
| 657 |
+
"p75": 512.0,
|
| 658 |
+
"p90": 512.0,
|
| 659 |
+
"p95": 512.0,
|
| 660 |
+
"p99": 512.0,
|
| 661 |
+
"p100": 703.0,
|
| 662 |
+
"mean": 434.2248475609756
|
| 663 |
+
},
|
| 664 |
+
"shape_y": {
|
| 665 |
+
"n": 2624,
|
| 666 |
+
"p0": 74.0,
|
| 667 |
+
"p1": 122.23,
|
| 668 |
+
"p5": 162.0,
|
| 669 |
+
"p10": 182.0,
|
| 670 |
+
"p25": 294.0,
|
| 671 |
+
"p50": 354.0,
|
| 672 |
+
"p75": 407.0,
|
| 673 |
+
"p90": 448.0,
|
| 674 |
+
"p95": 465.0,
|
| 675 |
+
"p99": 492.0,
|
| 676 |
+
"p100": 510.0,
|
| 677 |
+
"mean": 337.5510670731707
|
| 678 |
+
},
|
| 679 |
+
"shape_z": {
|
| 680 |
+
"n": 2624,
|
| 681 |
+
"p0": 24.0,
|
| 682 |
+
"p1": 37.0,
|
| 683 |
+
"p5": 49.0,
|
| 684 |
+
"p10": 76.0,
|
| 685 |
+
"p25": 115.0,
|
| 686 |
+
"p50": 154.0,
|
| 687 |
+
"p75": 205.0,
|
| 688 |
+
"p90": 288.0,
|
| 689 |
+
"p95": 358.0,
|
| 690 |
+
"p99": 557.0,
|
| 691 |
+
"p100": 765.0,
|
| 692 |
+
"mean": 170.44588414634146
|
| 693 |
+
},
|
| 694 |
+
"spacing_x_mm": {
|
| 695 |
+
"n": 2624,
|
| 696 |
+
"p0": 0.5,
|
| 697 |
+
"p1": 0.6202004919999999,
|
| 698 |
+
"p5": 0.685547,
|
| 699 |
+
"p10": 0.716797,
|
| 700 |
+
"p25": 0.78125,
|
| 701 |
+
"p50": 0.85546875,
|
| 702 |
+
"p75": 0.976562,
|
| 703 |
+
"p90": 1.5,
|
| 704 |
+
"p95": 1.5,
|
| 705 |
+
"p99": 1.5,
|
| 706 |
+
"p100": 5.0,
|
| 707 |
+
"mean": 0.9684165514824696
|
| 708 |
+
},
|
| 709 |
+
"spacing_y_mm": {
|
| 710 |
+
"n": 2624,
|
| 711 |
+
"p0": 0.39257812,
|
| 712 |
+
"p1": 0.621094,
|
| 713 |
+
"p5": 0.685546915,
|
| 714 |
+
"p10": 0.71679693,
|
| 715 |
+
"p25": 0.78125,
|
| 716 |
+
"p50": 0.854,
|
| 717 |
+
"p75": 0.976562,
|
| 718 |
+
"p90": 1.5,
|
| 719 |
+
"p95": 1.5,
|
| 720 |
+
"p99": 1.5,
|
| 721 |
+
"p100": 1.5000001,
|
| 722 |
+
"mean": 0.9584938727172256
|
| 723 |
+
},
|
| 724 |
+
"spacing_z_mm": {
|
| 725 |
+
"n": 2624,
|
| 726 |
+
"p0": 0.36330372,
|
| 727 |
+
"p1": 0.7,
|
| 728 |
+
"p5": 0.8,
|
| 729 |
+
"p10": 0.8,
|
| 730 |
+
"p25": 1.0,
|
| 731 |
+
"p50": 1.5,
|
| 732 |
+
"p75": 2.5,
|
| 733 |
+
"p90": 2.5,
|
| 734 |
+
"p95": 5.0,
|
| 735 |
+
"p99": 5.0,
|
| 736 |
+
"p100": 8.0,
|
| 737 |
+
"mean": 1.9893083805678355
|
| 738 |
+
},
|
| 739 |
+
"phys_x_mm": {
|
| 740 |
+
"n": 2624,
|
| 741 |
+
"p0": 76.5,
|
| 742 |
+
"p1": 181.5,
|
| 743 |
+
"p5": 312.0603687,
|
| 744 |
+
"p10": 331.5,
|
| 745 |
+
"p25": 359.2245655,
|
| 746 |
+
"p50": 391.0000128,
|
| 747 |
+
"p75": 422.34085890000006,
|
| 748 |
+
"p90": 452.63277455,
|
| 749 |
+
"p95": 472.0,
|
| 750 |
+
"p99": 500.0,
|
| 751 |
+
"p100": 512.0,
|
| 752 |
+
"mean": 388.83191901838796
|
| 753 |
+
},
|
| 754 |
+
"phys_y_mm": {
|
| 755 |
+
"n": 2624,
|
| 756 |
+
"p0": 111.0,
|
| 757 |
+
"p1": 183.000002806,
|
| 758 |
+
"p5": 225.0,
|
| 759 |
+
"p10": 239.6992672,
|
| 760 |
+
"p25": 264.287173125,
|
| 761 |
+
"p50": 294.4413788,
|
| 762 |
+
"p75": 341.24279250000006,
|
| 763 |
+
"p90": 375.16445008000005,
|
| 764 |
+
"p95": 390.21953284,
|
| 765 |
+
"p99": 413.987653513,
|
| 766 |
+
"p100": 499.5,
|
| 767 |
+
"mean": 301.59654564005336
|
| 768 |
+
},
|
| 769 |
+
"phys_z_mm": {
|
| 770 |
+
"n": 2624,
|
| 771 |
+
"p0": 55.5,
|
| 772 |
+
"p1": 113.0,
|
| 773 |
+
"p5": 143.25112425,
|
| 774 |
+
"p10": 170.0,
|
| 775 |
+
"p25": 207.0,
|
| 776 |
+
"p50": 250.5,
|
| 777 |
+
"p75": 337.5,
|
| 778 |
+
"p90": 390.0,
|
| 779 |
+
"p95": 390.0,
|
| 780 |
+
"p99": 440.0,
|
| 781 |
+
"p100": 720.0,
|
| 782 |
+
"mean": 264.6249014222942
|
| 783 |
+
},
|
| 784 |
+
"voxel_count_m": {
|
| 785 |
+
"n": 2624,
|
| 786 |
+
"p0": 0.581196,
|
| 787 |
+
"p1": 1.72530744,
|
| 788 |
+
"p5": 5.00293935,
|
| 789 |
+
"p10": 6.1949088,
|
| 790 |
+
"p25": 9.942108750000001,
|
| 791 |
+
"p50": 21.448124999999997,
|
| 792 |
+
"p75": 36.266239999999996,
|
| 793 |
+
"p90": 54.83162880000004,
|
| 794 |
+
"p95": 79.70905599999999,
|
| 795 |
+
"p99": 120.08488007999999,
|
| 796 |
+
"p100": 150.74304,
|
| 797 |
+
"mean": 27.927489581935976
|
| 798 |
+
}
|
| 799 |
+
},
|
| 800 |
+
"whole_body": {
|
| 801 |
+
"n": 4618,
|
| 802 |
+
"shape_x": {
|
| 803 |
+
"n": 4618,
|
| 804 |
+
"p0": 30.0,
|
| 805 |
+
"p1": 52.0,
|
| 806 |
+
"p5": 109.0,
|
| 807 |
+
"p10": 272.0,
|
| 808 |
+
"p25": 460.0,
|
| 809 |
+
"p50": 500.0,
|
| 810 |
+
"p75": 512.0,
|
| 811 |
+
"p90": 512.0,
|
| 812 |
+
"p95": 512.0,
|
| 813 |
+
"p99": 654.8299999999999,
|
| 814 |
+
"p100": 1059.0,
|
| 815 |
+
"mean": 456.26353399740145
|
| 816 |
+
},
|
| 817 |
+
"shape_y": {
|
| 818 |
+
"n": 4618,
|
| 819 |
+
"p0": 49.0,
|
| 820 |
+
"p1": 158.17000000000002,
|
| 821 |
+
"p5": 244.85000000000002,
|
| 822 |
+
"p10": 279.0,
|
| 823 |
+
"p25": 319.0,
|
| 824 |
+
"p50": 364.0,
|
| 825 |
+
"p75": 400.0,
|
| 826 |
+
"p90": 432.0,
|
| 827 |
+
"p95": 453.0,
|
| 828 |
+
"p99": 493.8299999999999,
|
| 829 |
+
"p100": 547.0,
|
| 830 |
+
"mean": 356.8977912516241
|
| 831 |
+
},
|
| 832 |
+
"shape_z": {
|
| 833 |
+
"n": 4618,
|
| 834 |
+
"p0": 8.0,
|
| 835 |
+
"p1": 57.0,
|
| 836 |
+
"p5": 86.0,
|
| 837 |
+
"p10": 95.0,
|
| 838 |
+
"p25": 137.0,
|
| 839 |
+
"p50": 204.0,
|
| 840 |
+
"p75": 228.0,
|
| 841 |
+
"p90": 327.0,
|
| 842 |
+
"p95": 353.0,
|
| 843 |
+
"p99": 379.8299999999999,
|
| 844 |
+
"p100": 1060.0,
|
| 845 |
+
"mean": 197.1847119965353
|
| 846 |
+
},
|
| 847 |
+
"spacing_x_mm": {
|
| 848 |
+
"n": 4618,
|
| 849 |
+
"p0": 0.423177,
|
| 850 |
+
"p1": 0.5,
|
| 851 |
+
"p5": 0.625,
|
| 852 |
+
"p10": 0.6640625,
|
| 853 |
+
"p25": 0.7324219,
|
| 854 |
+
"p50": 0.791016,
|
| 855 |
+
"p75": 0.9765625,
|
| 856 |
+
"p90": 1.5,
|
| 857 |
+
"p95": 3.0,
|
| 858 |
+
"p99": 5.0,
|
| 859 |
+
"p100": 5.0,
|
| 860 |
+
"mean": 1.077832520684279
|
| 861 |
+
},
|
| 862 |
+
"spacing_y_mm": {
|
| 863 |
+
"n": 4618,
|
| 864 |
+
"p0": 0.423177,
|
| 865 |
+
"p1": 0.5549088502,
|
| 866 |
+
"p5": 0.6308594,
|
| 867 |
+
"p10": 0.6640625,
|
| 868 |
+
"p25": 0.72265625,
|
| 869 |
+
"p50": 0.78125,
|
| 870 |
+
"p75": 0.9199219,
|
| 871 |
+
"p90": 1.0,
|
| 872 |
+
"p95": 1.0,
|
| 873 |
+
"p99": 1.5,
|
| 874 |
+
"p100": 5.0,
|
| 875 |
+
"mean": 0.8354297063728886
|
| 876 |
+
},
|
| 877 |
+
"spacing_z_mm": {
|
| 878 |
+
"n": 4618,
|
| 879 |
+
"p0": 0.3995785,
|
| 880 |
+
"p1": 0.625,
|
| 881 |
+
"p5": 0.757519535,
|
| 882 |
+
"p10": 0.8,
|
| 883 |
+
"p25": 0.8,
|
| 884 |
+
"p50": 1.0,
|
| 885 |
+
"p75": 2.5,
|
| 886 |
+
"p90": 5.0,
|
| 887 |
+
"p95": 5.0,
|
| 888 |
+
"p99": 5.0,
|
| 889 |
+
"p100": 10.0,
|
| 890 |
+
"mean": 1.8589463155586832
|
| 891 |
+
},
|
| 892 |
+
"phys_x_mm": {
|
| 893 |
+
"n": 4618,
|
| 894 |
+
"p0": 76.5,
|
| 895 |
+
"p1": 225.0,
|
| 896 |
+
"p5": 303.47166780000003,
|
| 897 |
+
"p10": 323.3789559,
|
| 898 |
+
"p25": 351.118,
|
| 899 |
+
"p50": 385.15625,
|
| 900 |
+
"p75": 436.1875,
|
| 901 |
+
"p90": 497.76,
|
| 902 |
+
"p95": 512.0,
|
| 903 |
+
"p99": 586.4043329999995,
|
| 904 |
+
"p100": 1416.0,
|
| 905 |
+
"mean": 395.6852566572066
|
| 906 |
+
},
|
| 907 |
+
"phys_y_mm": {
|
| 908 |
+
"n": 4618,
|
| 909 |
+
"p0": 132.8125,
|
| 910 |
+
"p1": 194.40127227,
|
| 911 |
+
"p5": 219.1037,
|
| 912 |
+
"p10": 231.5455401,
|
| 913 |
+
"p25": 257.05811775,
|
| 914 |
+
"p50": 286.5234375,
|
| 915 |
+
"p75": 317.0,
|
| 916 |
+
"p90": 348.63268755,
|
| 917 |
+
"p95": 371.577930285,
|
| 918 |
+
"p99": 412.5199325875,
|
| 919 |
+
"p100": 498.04662,
|
| 920 |
+
"mean": 288.764364898181
|
| 921 |
+
},
|
| 922 |
+
"phys_z_mm": {
|
| 923 |
+
"n": 4618,
|
| 924 |
+
"p0": 6.4,
|
| 925 |
+
"p1": 109.50816,
|
| 926 |
+
"p5": 143.03906759999998,
|
| 927 |
+
"p10": 153.60000000000002,
|
| 928 |
+
"p25": 172.0,
|
| 929 |
+
"p50": 226.125,
|
| 930 |
+
"p75": 410.0,
|
| 931 |
+
"p90": 510.0,
|
| 932 |
+
"p95": 627.0,
|
| 933 |
+
"p99": 732.49661904,
|
| 934 |
+
"p100": 860.0,
|
| 935 |
+
"mean": 296.70288681160895
|
| 936 |
+
},
|
| 937 |
+
"voxel_count_m": {
|
| 938 |
+
"n": 4618,
|
| 939 |
+
"p0": 0.509878,
|
| 940 |
+
"p1": 3.49021356,
|
| 941 |
+
"p5": 7.2778326,
|
| 942 |
+
"p10": 10.878708,
|
| 943 |
+
"p25": 18.20935,
|
| 944 |
+
"p50": 31.630336,
|
| 945 |
+
"p75": 45.031296,
|
| 946 |
+
"p90": 52.526846400000004,
|
| 947 |
+
"p95": 57.1898992,
|
| 948 |
+
"p99": 68.25358278999997,
|
| 949 |
+
"p100": 240.28928,
|
| 950 |
+
"mean": 32.11065596578606
|
| 951 |
+
}
|
| 952 |
+
}
|
| 953 |
+
},
|
| 954 |
+
"by_split": {
|
| 955 |
+
"test": {
|
| 956 |
+
"n": 901,
|
| 957 |
+
"shape_x": {
|
| 958 |
+
"n": 901,
|
| 959 |
+
"p0": 29.0,
|
| 960 |
+
"p1": 63.0,
|
| 961 |
+
"p5": 167.0,
|
| 962 |
+
"p10": 240.0,
|
| 963 |
+
"p25": 434.0,
|
| 964 |
+
"p50": 495.0,
|
| 965 |
+
"p75": 512.0,
|
| 966 |
+
"p90": 512.0,
|
| 967 |
+
"p95": 512.0,
|
| 968 |
+
"p99": 621.0,
|
| 969 |
+
"p100": 975.0,
|
| 970 |
+
"mean": 443.18534961154273
|
| 971 |
+
},
|
| 972 |
+
"shape_y": {
|
| 973 |
+
"n": 901,
|
| 974 |
+
"p0": 79.0,
|
| 975 |
+
"p1": 150.0,
|
| 976 |
+
"p5": 192.0,
|
| 977 |
+
"p10": 232.0,
|
| 978 |
+
"p25": 315.0,
|
| 979 |
+
"p50": 364.0,
|
| 980 |
+
"p75": 406.0,
|
| 981 |
+
"p90": 443.0,
|
| 982 |
+
"p95": 468.0,
|
| 983 |
+
"p99": 496.0,
|
| 984 |
+
"p100": 512.0,
|
| 985 |
+
"mean": 352.8834628190899
|
| 986 |
+
},
|
| 987 |
+
"shape_z": {
|
| 988 |
+
"n": 901,
|
| 989 |
+
"p0": 30.0,
|
| 990 |
+
"p1": 36.0,
|
| 991 |
+
"p5": 46.0,
|
| 992 |
+
"p10": 78.0,
|
| 993 |
+
"p25": 105.0,
|
| 994 |
+
"p50": 155.0,
|
| 995 |
+
"p75": 204.0,
|
| 996 |
+
"p90": 259.0,
|
| 997 |
+
"p95": 298.0,
|
| 998 |
+
"p99": 557.0,
|
| 999 |
+
"p100": 988.0,
|
| 1000 |
+
"mean": 165.94783573806882
|
| 1001 |
+
},
|
| 1002 |
+
"spacing_x_mm": {
|
| 1003 |
+
"n": 901,
|
| 1004 |
+
"p0": 0.5,
|
| 1005 |
+
"p1": 0.5,
|
| 1006 |
+
"p5": 0.6328125,
|
| 1007 |
+
"p10": 0.677734,
|
| 1008 |
+
"p25": 0.7441406,
|
| 1009 |
+
"p50": 0.830078,
|
| 1010 |
+
"p75": 0.9628906,
|
| 1011 |
+
"p90": 1.5,
|
| 1012 |
+
"p95": 2.5,
|
| 1013 |
+
"p99": 5.0,
|
| 1014 |
+
"p100": 5.0,
|
| 1015 |
+
"mean": 1.0578355869589344
|
| 1016 |
+
},
|
| 1017 |
+
"spacing_y_mm": {
|
| 1018 |
+
"n": 901,
|
| 1019 |
+
"p0": 0.39257812,
|
| 1020 |
+
"p1": 0.5703125,
|
| 1021 |
+
"p5": 0.644531,
|
| 1022 |
+
"p10": 0.679688,
|
| 1023 |
+
"p25": 0.7421875,
|
| 1024 |
+
"p50": 0.816406,
|
| 1025 |
+
"p75": 0.9238281,
|
| 1026 |
+
"p90": 1.022,
|
| 1027 |
+
"p95": 1.5,
|
| 1028 |
+
"p99": 1.5,
|
| 1029 |
+
"p100": 3.0,
|
| 1030 |
+
"mean": 0.8758961606215315
|
| 1031 |
+
},
|
| 1032 |
+
"spacing_z_mm": {
|
| 1033 |
+
"n": 901,
|
| 1034 |
+
"p0": 0.36330372,
|
| 1035 |
+
"p1": 0.5,
|
| 1036 |
+
"p5": 0.7050781,
|
| 1037 |
+
"p10": 0.8,
|
| 1038 |
+
"p25": 1.0,
|
| 1039 |
+
"p50": 2.5,
|
| 1040 |
+
"p75": 2.5,
|
| 1041 |
+
"p90": 5.0,
|
| 1042 |
+
"p95": 5.0,
|
| 1043 |
+
"p99": 5.0,
|
| 1044 |
+
"p100": 7.5,
|
| 1045 |
+
"mean": 2.292832484395116
|
| 1046 |
+
},
|
| 1047 |
+
"phys_x_mm": {
|
| 1048 |
+
"n": 901,
|
| 1049 |
+
"p0": 145.0,
|
| 1050 |
+
"p1": 220.0,
|
| 1051 |
+
"p5": 310.784,
|
| 1052 |
+
"p10": 328.085824,
|
| 1053 |
+
"p25": 358.000128,
|
| 1054 |
+
"p50": 386.0,
|
| 1055 |
+
"p75": 422.0,
|
| 1056 |
+
"p90": 460.0,
|
| 1057 |
+
"p95": 485.0,
|
| 1058 |
+
"p99": 525.0,
|
| 1059 |
+
"p100": 730.0,
|
| 1060 |
+
"mean": 389.952602400677
|
| 1061 |
+
},
|
| 1062 |
+
"phys_y_mm": {
|
| 1063 |
+
"n": 901,
|
| 1064 |
+
"p0": 145.64648251999998,
|
| 1065 |
+
"p1": 204.175748,
|
| 1066 |
+
"p5": 220.0,
|
| 1067 |
+
"p10": 233.527422,
|
| 1068 |
+
"p25": 259.1015724,
|
| 1069 |
+
"p50": 287.05078125,
|
| 1070 |
+
"p75": 330.2109375,
|
| 1071 |
+
"p90": 369.140436,
|
| 1072 |
+
"p95": 388.671875,
|
| 1073 |
+
"p99": 411.796875,
|
| 1074 |
+
"p100": 466.0546752,
|
| 1075 |
+
"mean": 295.80795439814653
|
| 1076 |
+
},
|
| 1077 |
+
"phys_z_mm": {
|
| 1078 |
+
"n": 901,
|
| 1079 |
+
"p0": 80.08593648,
|
| 1080 |
+
"p1": 113.60000000000001,
|
| 1081 |
+
"p5": 142.4,
|
| 1082 |
+
"p10": 159.375,
|
| 1083 |
+
"p25": 188.8,
|
| 1084 |
+
"p50": 250.0,
|
| 1085 |
+
"p75": 389.9,
|
| 1086 |
+
"p90": 500.0,
|
| 1087 |
+
"p95": 620.0,
|
| 1088 |
+
"p99": 732.480112,
|
| 1089 |
+
"p100": 777.5,
|
| 1090 |
+
"mean": 297.108364433829
|
| 1091 |
+
},
|
| 1092 |
+
"voxel_count_m": {
|
| 1093 |
+
"n": 901,
|
| 1094 |
+
"p0": 2.236248,
|
| 1095 |
+
"p1": 3.76584,
|
| 1096 |
+
"p5": 5.54944,
|
| 1097 |
+
"p10": 6.858696,
|
| 1098 |
+
"p25": 12.33486,
|
| 1099 |
+
"p50": 21.891376,
|
| 1100 |
+
"p75": 36.13896,
|
| 1101 |
+
"p90": 51.37944,
|
| 1102 |
+
"p95": 64.299008,
|
| 1103 |
+
"p99": 123.199488,
|
| 1104 |
+
"p100": 232.7728,
|
| 1105 |
+
"mean": 27.39046759045505
|
| 1106 |
+
}
|
| 1107 |
+
},
|
| 1108 |
+
"train": {
|
| 1109 |
+
"n": 8181,
|
| 1110 |
+
"shape_x": {
|
| 1111 |
+
"n": 8181,
|
| 1112 |
+
"p0": 30.0,
|
| 1113 |
+
"p1": 69.8,
|
| 1114 |
+
"p5": 151.0,
|
| 1115 |
+
"p10": 228.0,
|
| 1116 |
+
"p25": 444.0,
|
| 1117 |
+
"p50": 497.0,
|
| 1118 |
+
"p75": 512.0,
|
| 1119 |
+
"p90": 512.0,
|
| 1120 |
+
"p95": 512.0,
|
| 1121 |
+
"p99": 540.1999999999998,
|
| 1122 |
+
"p100": 1059.0,
|
| 1123 |
+
"mean": 442.1431365358758
|
| 1124 |
+
},
|
| 1125 |
+
"shape_y": {
|
| 1126 |
+
"n": 8181,
|
| 1127 |
+
"p0": 48.0,
|
| 1128 |
+
"p1": 117.8,
|
| 1129 |
+
"p5": 161.0,
|
| 1130 |
+
"p10": 197.0,
|
| 1131 |
+
"p25": 307.0,
|
| 1132 |
+
"p50": 360.0,
|
| 1133 |
+
"p75": 402.0,
|
| 1134 |
+
"p90": 436.0,
|
| 1135 |
+
"p95": 456.0,
|
| 1136 |
+
"p99": 493.0,
|
| 1137 |
+
"p100": 547.0,
|
| 1138 |
+
"mean": 343.92152548588194
|
| 1139 |
+
},
|
| 1140 |
+
"shape_z": {
|
| 1141 |
+
"n": 8181,
|
| 1142 |
+
"p0": 8.0,
|
| 1143 |
+
"p1": 38.0,
|
| 1144 |
+
"p5": 65.0,
|
| 1145 |
+
"p10": 90.0,
|
| 1146 |
+
"p25": 131.0,
|
| 1147 |
+
"p50": 193.0,
|
| 1148 |
+
"p75": 224.0,
|
| 1149 |
+
"p90": 269.0,
|
| 1150 |
+
"p95": 345.0,
|
| 1151 |
+
"p99": 391.0,
|
| 1152 |
+
"p100": 1060.0,
|
| 1153 |
+
"mean": 186.53355335533553
|
| 1154 |
+
},
|
| 1155 |
+
"spacing_x_mm": {
|
| 1156 |
+
"n": 8181,
|
| 1157 |
+
"p0": 0.423177,
|
| 1158 |
+
"p1": 0.55820312,
|
| 1159 |
+
"p5": 0.6386913,
|
| 1160 |
+
"p10": 0.673828,
|
| 1161 |
+
"p25": 0.7421875,
|
| 1162 |
+
"p50": 0.8027344,
|
| 1163 |
+
"p75": 0.9765625,
|
| 1164 |
+
"p90": 1.5,
|
| 1165 |
+
"p95": 1.5,
|
| 1166 |
+
"p99": 5.0,
|
| 1167 |
+
"p100": 5.0,
|
| 1168 |
+
"mean": 1.0087229440080674
|
| 1169 |
+
},
|
| 1170 |
+
"spacing_y_mm": {
|
| 1171 |
+
"n": 8181,
|
| 1172 |
+
"p0": 0.423177,
|
| 1173 |
+
"p1": 0.582025,
|
| 1174 |
+
"p5": 0.640625,
|
| 1175 |
+
"p10": 0.673828,
|
| 1176 |
+
"p25": 0.7363281,
|
| 1177 |
+
"p50": 0.79296875,
|
| 1178 |
+
"p75": 0.953125,
|
| 1179 |
+
"p90": 1.5,
|
| 1180 |
+
"p95": 1.5,
|
| 1181 |
+
"p99": 1.5,
|
| 1182 |
+
"p100": 5.0,
|
| 1183 |
+
"mean": 0.8939099839555067
|
| 1184 |
+
},
|
| 1185 |
+
"spacing_z_mm": {
|
| 1186 |
+
"n": 8181,
|
| 1187 |
+
"p0": 0.3995785,
|
| 1188 |
+
"p1": 0.625,
|
| 1189 |
+
"p5": 0.7988281,
|
| 1190 |
+
"p10": 0.8,
|
| 1191 |
+
"p25": 0.8,
|
| 1192 |
+
"p50": 1.25,
|
| 1193 |
+
"p75": 2.5,
|
| 1194 |
+
"p90": 4.0,
|
| 1195 |
+
"p95": 5.0,
|
| 1196 |
+
"p99": 5.0,
|
| 1197 |
+
"p100": 10.0,
|
| 1198 |
+
"mean": 1.7170758615474881
|
| 1199 |
+
},
|
| 1200 |
+
"phys_x_mm": {
|
| 1201 |
+
"n": 8181,
|
| 1202 |
+
"p0": 70.5,
|
| 1203 |
+
"p1": 172.5,
|
| 1204 |
+
"p5": 291.0,
|
| 1205 |
+
"p10": 316.82422979999996,
|
| 1206 |
+
"p25": 348.0,
|
| 1207 |
+
"p50": 380.0,
|
| 1208 |
+
"p75": 415.0000128,
|
| 1209 |
+
"p90": 470.0,
|
| 1210 |
+
"p95": 499.5,
|
| 1211 |
+
"p99": 512.0,
|
| 1212 |
+
"p100": 1416.0,
|
| 1213 |
+
"mean": 382.826850908906
|
| 1214 |
+
},
|
| 1215 |
+
"phys_y_mm": {
|
| 1216 |
+
"n": 8181,
|
| 1217 |
+
"p0": 72.0000048,
|
| 1218 |
+
"p1": 178.5,
|
| 1219 |
+
"p5": 216.0,
|
| 1220 |
+
"p10": 229.5,
|
| 1221 |
+
"p25": 255.0,
|
| 1222 |
+
"p50": 285.15625,
|
| 1223 |
+
"p75": 318.0,
|
| 1224 |
+
"p90": 354.375,
|
| 1225 |
+
"p95": 375.08203125,
|
| 1226 |
+
"p99": 408.66874999999993,
|
| 1227 |
+
"p100": 499.5,
|
| 1228 |
+
"mean": 288.1627758155898
|
| 1229 |
+
},
|
| 1230 |
+
"phys_z_mm": {
|
| 1231 |
+
"n": 8181,
|
| 1232 |
+
"p0": 6.4,
|
| 1233 |
+
"p1": 100.0,
|
| 1234 |
+
"p5": 137.00181,
|
| 1235 |
+
"p10": 152.0,
|
| 1236 |
+
"p25": 171.20000000000002,
|
| 1237 |
+
"p50": 207.5,
|
| 1238 |
+
"p75": 325.5,
|
| 1239 |
+
"p90": 435.0,
|
| 1240 |
+
"p95": 498.75,
|
| 1241 |
+
"p99": 685.0,
|
| 1242 |
+
"p100": 820.0,
|
| 1243 |
+
"mean": 256.0016739992409
|
| 1244 |
+
},
|
| 1245 |
+
"voxel_count_m": {
|
| 1246 |
+
"n": 8181,
|
| 1247 |
+
"p0": 0.3792,
|
| 1248 |
+
"p1": 1.5893439999999999,
|
| 1249 |
+
"p5": 4.576055,
|
| 1250 |
+
"p10": 6.423903,
|
| 1251 |
+
"p25": 14.683032,
|
| 1252 |
+
"p50": 30.478264,
|
| 1253 |
+
"p75": 43.556864,
|
| 1254 |
+
"p90": 51.678396,
|
| 1255 |
+
"p95": 57.538404,
|
| 1256 |
+
"p99": 88.92528639999996,
|
| 1257 |
+
"p100": 240.28928,
|
| 1258 |
+
"mean": 30.337295745874584
|
| 1259 |
+
}
|
| 1260 |
+
},
|
| 1261 |
+
"val": {
|
| 1262 |
+
"n": 819,
|
| 1263 |
+
"shape_x": {
|
| 1264 |
+
"n": 819,
|
| 1265 |
+
"p0": 43.0,
|
| 1266 |
+
"p1": 61.36,
|
| 1267 |
+
"p5": 139.30000000000004,
|
| 1268 |
+
"p10": 233.0,
|
| 1269 |
+
"p25": 448.0,
|
| 1270 |
+
"p50": 498.0,
|
| 1271 |
+
"p75": 512.0,
|
| 1272 |
+
"p90": 512.0,
|
| 1273 |
+
"p95": 512.0,
|
| 1274 |
+
"p99": 583.9799999999975,
|
| 1275 |
+
"p100": 756.0,
|
| 1276 |
+
"mean": 443.03052503052504
|
| 1277 |
+
},
|
| 1278 |
+
"shape_y": {
|
| 1279 |
+
"n": 819,
|
| 1280 |
+
"p0": 89.0,
|
| 1281 |
+
"p1": 122.18,
|
| 1282 |
+
"p5": 166.0,
|
| 1283 |
+
"p10": 198.0,
|
| 1284 |
+
"p25": 313.0,
|
| 1285 |
+
"p50": 364.0,
|
| 1286 |
+
"p75": 404.5,
|
| 1287 |
+
"p90": 440.20000000000005,
|
| 1288 |
+
"p95": 458.0999999999999,
|
| 1289 |
+
"p99": 494.9199999999996,
|
| 1290 |
+
"p100": 512.0,
|
| 1291 |
+
"mean": 347.58730158730157
|
| 1292 |
+
},
|
| 1293 |
+
"shape_z": {
|
| 1294 |
+
"n": 819,
|
| 1295 |
+
"p0": 24.0,
|
| 1296 |
+
"p1": 39.36,
|
| 1297 |
+
"p5": 74.80000000000001,
|
| 1298 |
+
"p10": 91.0,
|
| 1299 |
+
"p25": 129.0,
|
| 1300 |
+
"p50": 191.0,
|
| 1301 |
+
"p75": 220.0,
|
| 1302 |
+
"p90": 261.4000000000001,
|
| 1303 |
+
"p95": 340.0,
|
| 1304 |
+
"p99": 380.19999999999936,
|
| 1305 |
+
"p100": 629.0,
|
| 1306 |
+
"mean": 184.01098901098902
|
| 1307 |
+
},
|
| 1308 |
+
"spacing_x_mm": {
|
| 1309 |
+
"n": 819,
|
| 1310 |
+
"p0": 0.45117188,
|
| 1311 |
+
"p1": 0.510546875,
|
| 1312 |
+
"p5": 0.625,
|
| 1313 |
+
"p10": 0.6640625,
|
| 1314 |
+
"p25": 0.7373045,
|
| 1315 |
+
"p50": 0.8105469,
|
| 1316 |
+
"p75": 0.9822815,
|
| 1317 |
+
"p90": 1.5,
|
| 1318 |
+
"p95": 1.5,
|
| 1319 |
+
"p99": 5.0,
|
| 1320 |
+
"p100": 5.0,
|
| 1321 |
+
"mean": 1.0197842178266179
|
| 1322 |
+
},
|
| 1323 |
+
"spacing_y_mm": {
|
| 1324 |
+
"n": 819,
|
| 1325 |
+
"p0": 0.45117188,
|
| 1326 |
+
"p1": 0.5859375,
|
| 1327 |
+
"p5": 0.628515625,
|
| 1328 |
+
"p10": 0.66796875,
|
| 1329 |
+
"p25": 0.7353514999999999,
|
| 1330 |
+
"p50": 0.800781,
|
| 1331 |
+
"p75": 0.9755857,
|
| 1332 |
+
"p90": 1.5,
|
| 1333 |
+
"p95": 1.5,
|
| 1334 |
+
"p99": 1.5,
|
| 1335 |
+
"p100": 1.5,
|
| 1336 |
+
"mean": 0.88884322997558
|
| 1337 |
+
},
|
| 1338 |
+
"spacing_z_mm": {
|
| 1339 |
+
"n": 819,
|
| 1340 |
+
"p0": 0.45,
|
| 1341 |
+
"p1": 0.7,
|
| 1342 |
+
"p5": 0.77910161,
|
| 1343 |
+
"p10": 0.8,
|
| 1344 |
+
"p25": 0.8,
|
| 1345 |
+
"p50": 1.25,
|
| 1346 |
+
"p75": 2.5,
|
| 1347 |
+
"p90": 4.0,
|
| 1348 |
+
"p95": 5.0,
|
| 1349 |
+
"p99": 5.0,
|
| 1350 |
+
"p100": 7.5,
|
| 1351 |
+
"mean": 1.7251333461782663
|
| 1352 |
+
},
|
| 1353 |
+
"phys_x_mm": {
|
| 1354 |
+
"n": 819,
|
| 1355 |
+
"p0": 97.5,
|
| 1356 |
+
"p1": 171.27,
|
| 1357 |
+
"p5": 290.725,
|
| 1358 |
+
"p10": 314.818752576,
|
| 1359 |
+
"p25": 348.635086,
|
| 1360 |
+
"p50": 380.0,
|
| 1361 |
+
"p75": 419.960702,
|
| 1362 |
+
"p90": 475.26876015999994,
|
| 1363 |
+
"p95": 504.0999999999999,
|
| 1364 |
+
"p99": 512.0,
|
| 1365 |
+
"p100": 734.0,
|
| 1366 |
+
"mean": 384.19097023354095
|
| 1367 |
+
},
|
| 1368 |
+
"phys_y_mm": {
|
| 1369 |
+
"n": 819,
|
| 1370 |
+
"p0": 133.4999911,
|
| 1371 |
+
"p1": 183.27,
|
| 1372 |
+
"p5": 215.933203125,
|
| 1373 |
+
"p10": 231.2359248,
|
| 1374 |
+
"p25": 256.77352399999995,
|
| 1375 |
+
"p50": 286.507728,
|
| 1376 |
+
"p75": 324.1660104,
|
| 1377 |
+
"p90": 360.1187176,
|
| 1378 |
+
"p95": 377.27344739999995,
|
| 1379 |
+
"p99": 427.3799539199994,
|
| 1380 |
+
"p100": 498.04662,
|
| 1381 |
+
"mean": 291.6048279043712
|
| 1382 |
+
},
|
| 1383 |
+
"phys_z_mm": {
|
| 1384 |
+
"n": 819,
|
| 1385 |
+
"p0": 80.0,
|
| 1386 |
+
"p1": 105.18,
|
| 1387 |
+
"p5": 142.25,
|
| 1388 |
+
"p10": 152.96,
|
| 1389 |
+
"p25": 171.20000000000002,
|
| 1390 |
+
"p50": 206.4,
|
| 1391 |
+
"p75": 330.0,
|
| 1392 |
+
"p90": 435.0,
|
| 1393 |
+
"p95": 485.0,
|
| 1394 |
+
"p99": 688.3799999999994,
|
| 1395 |
+
"p100": 860.0,
|
| 1396 |
+
"mean": 255.63508210658117
|
| 1397 |
+
},
|
| 1398 |
+
"voxel_count_m": {
|
| 1399 |
+
"n": 819,
|
| 1400 |
+
"p0": 0.704969,
|
| 1401 |
+
"p1": 1.63027998,
|
| 1402 |
+
"p5": 4.5293346,
|
| 1403 |
+
"p10": 6.5034896,
|
| 1404 |
+
"p25": 16.113194999999997,
|
| 1405 |
+
"p50": 30.93504,
|
| 1406 |
+
"p75": 43.4048,
|
| 1407 |
+
"p90": 51.4711712,
|
| 1408 |
+
"p95": 55.81690879999999,
|
| 1409 |
+
"p99": 80.10009679999989,
|
| 1410 |
+
"p100": 126.564864,
|
| 1411 |
+
"mean": 30.134765595848595
|
| 1412 |
+
}
|
| 1413 |
+
}
|
| 1414 |
+
},
|
| 1415 |
+
"bucket_summary": {
|
| 1416 |
+
"B-CA": {
|
| 1417 |
+
"n": 2454,
|
| 1418 |
+
"fov_counts": {
|
| 1419 |
+
"chest_abdomen": 2454
|
| 1420 |
+
},
|
| 1421 |
+
"crop_any_pct": 6.723716381418093,
|
| 1422 |
+
"crop_x_pct": 0.0,
|
| 1423 |
+
"crop_y_pct": 0.0,
|
| 1424 |
+
"crop_z_pct": 6.723716381418093,
|
| 1425 |
+
"phys_z_mm": {
|
| 1426 |
+
"n": 2454,
|
| 1427 |
+
"p0": 46.5,
|
| 1428 |
+
"p1": 89.64750000000001,
|
| 1429 |
+
"p5": 125.58000000000001,
|
| 1430 |
+
"p10": 147.20000000000002,
|
| 1431 |
+
"p25": 161.60010100000002,
|
| 1432 |
+
"p50": 180.0,
|
| 1433 |
+
"p75": 205.0,
|
| 1434 |
+
"p90": 258.00001204,
|
| 1435 |
+
"p95": 304.5,
|
| 1436 |
+
"p99": 354.7049999999997,
|
| 1437 |
+
"p100": 820.0,
|
| 1438 |
+
"mean": 191.14249572569275
|
| 1439 |
+
},
|
| 1440 |
+
"phys_y_mm": {
|
| 1441 |
+
"n": 2454,
|
| 1442 |
+
"p0": 72.0000048,
|
| 1443 |
+
"p1": 170.29500000000002,
|
| 1444 |
+
"p5": 210.3299751,
|
| 1445 |
+
"p10": 225.08422019999998,
|
| 1446 |
+
"p25": 249.0,
|
| 1447 |
+
"p50": 278.6621138,
|
| 1448 |
+
"p75": 310.5,
|
| 1449 |
+
"p90": 337.8390625000001,
|
| 1450 |
+
"p95": 359.876849245,
|
| 1451 |
+
"p99": 396.58191373999983,
|
| 1452 |
+
"p100": 461.09765625,
|
| 1453 |
+
"mean": 279.88780395224126
|
| 1454 |
+
},
|
| 1455 |
+
"phys_x_mm": {
|
| 1456 |
+
"n": 2454,
|
| 1457 |
+
"p0": 70.5,
|
| 1458 |
+
"p1": 162.0,
|
| 1459 |
+
"p5": 247.5,
|
| 1460 |
+
"p10": 300.0,
|
| 1461 |
+
"p25": 334.63687500000003,
|
| 1462 |
+
"p50": 364.5,
|
| 1463 |
+
"p75": 396.875,
|
| 1464 |
+
"p90": 420.75004789000013,
|
| 1465 |
+
"p95": 447.13250902499993,
|
| 1466 |
+
"p99": 492.67007812499907,
|
| 1467 |
+
"p100": 512.0,
|
| 1468 |
+
"mean": 360.62140536214747
|
| 1469 |
+
},
|
| 1470 |
+
"resampled_z_vox_at_bucket_sp": {
|
| 1471 |
+
"n": 2454,
|
| 1472 |
+
"p0": 13.285714285714286,
|
| 1473 |
+
"p1": 25.61357142857143,
|
| 1474 |
+
"p5": 35.88,
|
| 1475 |
+
"p10": 42.057142857142864,
|
| 1476 |
+
"p25": 46.17145742857143,
|
| 1477 |
+
"p50": 51.42857142857143,
|
| 1478 |
+
"p75": 58.57142857142857,
|
| 1479 |
+
"p90": 73.71428915428572,
|
| 1480 |
+
"p95": 87.0,
|
| 1481 |
+
"p99": 101.34428571428562,
|
| 1482 |
+
"p100": 234.28571428571428,
|
| 1483 |
+
"mean": 54.612141635912224
|
| 1484 |
+
},
|
| 1485 |
+
"resampled_y_vox_at_bucket_sp": {
|
| 1486 |
+
"n": 2454,
|
| 1487 |
+
"p0": 36.0000024,
|
| 1488 |
+
"p1": 85.14750000000001,
|
| 1489 |
+
"p5": 105.16498755,
|
| 1490 |
+
"p10": 112.54211009999999,
|
| 1491 |
+
"p25": 124.5,
|
| 1492 |
+
"p50": 139.3310569,
|
| 1493 |
+
"p75": 155.25,
|
| 1494 |
+
"p90": 168.91953125000006,
|
| 1495 |
+
"p95": 179.9384246225,
|
| 1496 |
+
"p99": 198.29095686999992,
|
| 1497 |
+
"p100": 230.548828125,
|
| 1498 |
+
"mean": 139.94390197612063
|
| 1499 |
+
},
|
| 1500 |
+
"resampled_x_vox_at_bucket_sp": {
|
| 1501 |
+
"n": 2454,
|
| 1502 |
+
"p0": 35.25,
|
| 1503 |
+
"p1": 81.0,
|
| 1504 |
+
"p5": 123.75,
|
| 1505 |
+
"p10": 150.0,
|
| 1506 |
+
"p25": 167.31843750000002,
|
| 1507 |
+
"p50": 182.25,
|
| 1508 |
+
"p75": 198.4375,
|
| 1509 |
+
"p90": 210.37502394500007,
|
| 1510 |
+
"p95": 223.56625451249997,
|
| 1511 |
+
"p99": 246.33503906249953,
|
| 1512 |
+
"p100": 256.0,
|
| 1513 |
+
"mean": 180.31070268107374
|
| 1514 |
+
}
|
| 1515 |
+
},
|
| 1516 |
+
"B-CAP": {
|
| 1517 |
+
"n": 2624,
|
| 1518 |
+
"fov_counts": {
|
| 1519 |
+
"chest_abdomen_pelvis": 2624
|
| 1520 |
+
},
|
| 1521 |
+
"crop_any_pct": 12.195121951219512,
|
| 1522 |
+
"crop_x_pct": 0.0,
|
| 1523 |
+
"crop_y_pct": 0.0,
|
| 1524 |
+
"crop_z_pct": 12.195121951219512,
|
| 1525 |
+
"phys_z_mm": {
|
| 1526 |
+
"n": 2624,
|
| 1527 |
+
"p0": 55.5,
|
| 1528 |
+
"p1": 113.0,
|
| 1529 |
+
"p5": 143.25112425,
|
| 1530 |
+
"p10": 170.0,
|
| 1531 |
+
"p25": 207.0,
|
| 1532 |
+
"p50": 250.5,
|
| 1533 |
+
"p75": 337.5,
|
| 1534 |
+
"p90": 390.0,
|
| 1535 |
+
"p95": 390.0,
|
| 1536 |
+
"p99": 440.0,
|
| 1537 |
+
"p100": 720.0,
|
| 1538 |
+
"mean": 264.6249014222942
|
| 1539 |
+
},
|
| 1540 |
+
"phys_y_mm": {
|
| 1541 |
+
"n": 2624,
|
| 1542 |
+
"p0": 111.0,
|
| 1543 |
+
"p1": 183.000002806,
|
| 1544 |
+
"p5": 225.0,
|
| 1545 |
+
"p10": 239.6992672,
|
| 1546 |
+
"p25": 264.287173125,
|
| 1547 |
+
"p50": 294.4413788,
|
| 1548 |
+
"p75": 341.24279250000006,
|
| 1549 |
+
"p90": 375.16445008000005,
|
| 1550 |
+
"p95": 390.21953284,
|
| 1551 |
+
"p99": 413.987653513,
|
| 1552 |
+
"p100": 499.5,
|
| 1553 |
+
"mean": 301.59654564005336
|
| 1554 |
+
},
|
| 1555 |
+
"phys_x_mm": {
|
| 1556 |
+
"n": 2624,
|
| 1557 |
+
"p0": 76.5,
|
| 1558 |
+
"p1": 181.5,
|
| 1559 |
+
"p5": 312.0603687,
|
| 1560 |
+
"p10": 331.5,
|
| 1561 |
+
"p25": 359.2245655,
|
| 1562 |
+
"p50": 391.0000128,
|
| 1563 |
+
"p75": 422.34085890000006,
|
| 1564 |
+
"p90": 452.63277455,
|
| 1565 |
+
"p95": 472.0,
|
| 1566 |
+
"p99": 500.0,
|
| 1567 |
+
"p100": 512.0,
|
| 1568 |
+
"mean": 388.83191901838796
|
| 1569 |
+
},
|
| 1570 |
+
"resampled_z_vox_at_bucket_sp": {
|
| 1571 |
+
"n": 2624,
|
| 1572 |
+
"p0": 13.875,
|
| 1573 |
+
"p1": 28.25,
|
| 1574 |
+
"p5": 35.8127810625,
|
| 1575 |
+
"p10": 42.5,
|
| 1576 |
+
"p25": 51.75,
|
| 1577 |
+
"p50": 62.625,
|
| 1578 |
+
"p75": 84.375,
|
| 1579 |
+
"p90": 97.5,
|
| 1580 |
+
"p95": 97.5,
|
| 1581 |
+
"p99": 110.0,
|
| 1582 |
+
"p100": 180.0,
|
| 1583 |
+
"mean": 66.15622535557355
|
| 1584 |
+
},
|
| 1585 |
+
"resampled_y_vox_at_bucket_sp": {
|
| 1586 |
+
"n": 2624,
|
| 1587 |
+
"p0": 55.5,
|
| 1588 |
+
"p1": 91.500001403,
|
| 1589 |
+
"p5": 112.5,
|
| 1590 |
+
"p10": 119.8496336,
|
| 1591 |
+
"p25": 132.1435865625,
|
| 1592 |
+
"p50": 147.2206894,
|
| 1593 |
+
"p75": 170.62139625000003,
|
| 1594 |
+
"p90": 187.58222504000003,
|
| 1595 |
+
"p95": 195.10976642,
|
| 1596 |
+
"p99": 206.9938267565,
|
| 1597 |
+
"p100": 249.75,
|
| 1598 |
+
"mean": 150.79827282002668
|
| 1599 |
+
},
|
| 1600 |
+
"resampled_x_vox_at_bucket_sp": {
|
| 1601 |
+
"n": 2624,
|
| 1602 |
+
"p0": 38.25,
|
| 1603 |
+
"p1": 90.75,
|
| 1604 |
+
"p5": 156.03018435,
|
| 1605 |
+
"p10": 165.75,
|
| 1606 |
+
"p25": 179.61228275,
|
| 1607 |
+
"p50": 195.5000064,
|
| 1608 |
+
"p75": 211.17042945000003,
|
| 1609 |
+
"p90": 226.316387275,
|
| 1610 |
+
"p95": 236.0,
|
| 1611 |
+
"p99": 250.0,
|
| 1612 |
+
"p100": 256.0,
|
| 1613 |
+
"mean": 194.41595950919398
|
| 1614 |
+
}
|
| 1615 |
+
},
|
| 1616 |
+
"B-abd": {
|
| 1617 |
+
"n": 105,
|
| 1618 |
+
"fov_counts": {
|
| 1619 |
+
"abdomen_only": 105
|
| 1620 |
+
},
|
| 1621 |
+
"crop_any_pct": 8.571428571428571,
|
| 1622 |
+
"crop_x_pct": 0.0,
|
| 1623 |
+
"crop_y_pct": 0.0,
|
| 1624 |
+
"crop_z_pct": 8.571428571428571,
|
| 1625 |
+
"phys_z_mm": {
|
| 1626 |
+
"n": 105,
|
| 1627 |
+
"p0": 49.5,
|
| 1628 |
+
"p1": 54.0,
|
| 1629 |
+
"p5": 80.4,
|
| 1630 |
+
"p10": 91.8,
|
| 1631 |
+
"p25": 128.0,
|
| 1632 |
+
"p50": 153.0,
|
| 1633 |
+
"p75": 169.60000000000002,
|
| 1634 |
+
"p90": 186.90000496000002,
|
| 1635 |
+
"p95": 199.2187296,
|
| 1636 |
+
"p99": 301.97999999999985,
|
| 1637 |
+
"p100": 358.5,
|
| 1638 |
+
"mean": 150.38443630095242
|
| 1639 |
+
},
|
| 1640 |
+
"phys_y_mm": {
|
| 1641 |
+
"n": 105,
|
| 1642 |
+
"p0": 133.5,
|
| 1643 |
+
"p1": 141.659990976,
|
| 1644 |
+
"p5": 166.8,
|
| 1645 |
+
"p10": 186.6,
|
| 1646 |
+
"p25": 214.5,
|
| 1647 |
+
"p50": 243.90625,
|
| 1648 |
+
"p75": 273.515625,
|
| 1649 |
+
"p90": 319.5851605600001,
|
| 1650 |
+
"p95": 337.5,
|
| 1651 |
+
"p99": 369.07481856,
|
| 1652 |
+
"p100": 370.5,
|
| 1653 |
+
"mean": 247.89313983761906
|
| 1654 |
+
},
|
| 1655 |
+
"phys_x_mm": {
|
| 1656 |
+
"n": 105,
|
| 1657 |
+
"p0": 127.5,
|
| 1658 |
+
"p1": 138.28,
|
| 1659 |
+
"p5": 155.1,
|
| 1660 |
+
"p10": 171.0,
|
| 1661 |
+
"p25": 190.5,
|
| 1662 |
+
"p50": 325.5,
|
| 1663 |
+
"p75": 360.0,
|
| 1664 |
+
"p90": 386.21016096,
|
| 1665 |
+
"p95": 399.84375,
|
| 1666 |
+
"p99": 431.82,
|
| 1667 |
+
"p100": 480.0,
|
| 1668 |
+
"mean": 293.3386327304762
|
| 1669 |
+
},
|
| 1670 |
+
"resampled_z_vox_at_bucket_sp": {
|
| 1671 |
+
"n": 105,
|
| 1672 |
+
"p0": 16.5,
|
| 1673 |
+
"p1": 18.0,
|
| 1674 |
+
"p5": 26.8,
|
| 1675 |
+
"p10": 30.6,
|
| 1676 |
+
"p25": 42.666666666666664,
|
| 1677 |
+
"p50": 51.0,
|
| 1678 |
+
"p75": 56.53333333333334,
|
| 1679 |
+
"p90": 62.30000165333334,
|
| 1680 |
+
"p95": 66.4062432,
|
| 1681 |
+
"p99": 100.65999999999994,
|
| 1682 |
+
"p100": 119.5,
|
| 1683 |
+
"mean": 50.128145433650786
|
| 1684 |
+
},
|
| 1685 |
+
"resampled_y_vox_at_bucket_sp": {
|
| 1686 |
+
"n": 105,
|
| 1687 |
+
"p0": 66.75,
|
| 1688 |
+
"p1": 70.829995488,
|
| 1689 |
+
"p5": 83.4,
|
| 1690 |
+
"p10": 93.3,
|
| 1691 |
+
"p25": 107.25,
|
| 1692 |
+
"p50": 121.953125,
|
| 1693 |
+
"p75": 136.7578125,
|
| 1694 |
+
"p90": 159.79258028000004,
|
| 1695 |
+
"p95": 168.75,
|
| 1696 |
+
"p99": 184.53740928,
|
| 1697 |
+
"p100": 185.25,
|
| 1698 |
+
"mean": 123.94656991880953
|
| 1699 |
+
},
|
| 1700 |
+
"resampled_x_vox_at_bucket_sp": {
|
| 1701 |
+
"n": 105,
|
| 1702 |
+
"p0": 63.75,
|
| 1703 |
+
"p1": 69.14,
|
| 1704 |
+
"p5": 77.55,
|
| 1705 |
+
"p10": 85.5,
|
| 1706 |
+
"p25": 95.25,
|
| 1707 |
+
"p50": 162.75,
|
| 1708 |
+
"p75": 180.0,
|
| 1709 |
+
"p90": 193.10508048,
|
| 1710 |
+
"p95": 199.921875,
|
| 1711 |
+
"p99": 215.91,
|
| 1712 |
+
"p100": 240.0,
|
| 1713 |
+
"mean": 146.6693163652381
|
| 1714 |
+
}
|
| 1715 |
+
},
|
| 1716 |
+
"B-abd-pelvis": {
|
| 1717 |
+
"n": 100,
|
| 1718 |
+
"fov_counts": {
|
| 1719 |
+
"abdomen_pelvis": 100
|
| 1720 |
+
},
|
| 1721 |
+
"crop_any_pct": 58.0,
|
| 1722 |
+
"crop_x_pct": 0.0,
|
| 1723 |
+
"crop_y_pct": 0.0,
|
| 1724 |
+
"crop_z_pct": 58.0,
|
| 1725 |
+
"phys_z_mm": {
|
| 1726 |
+
"n": 100,
|
| 1727 |
+
"p0": 87.0,
|
| 1728 |
+
"p1": 104.82,
|
| 1729 |
+
"p5": 120.0,
|
| 1730 |
+
"p10": 139.8,
|
| 1731 |
+
"p25": 164.625,
|
| 1732 |
+
"p50": 221.0,
|
| 1733 |
+
"p75": 268.5,
|
| 1734 |
+
"p90": 301.65001809000006,
|
| 1735 |
+
"p95": 329.09999999999997,
|
| 1736 |
+
"p99": 371.8950000000007,
|
| 1737 |
+
"p100": 510.0,
|
| 1738 |
+
"mean": 220.05740637399998
|
| 1739 |
+
},
|
| 1740 |
+
"phys_y_mm": {
|
| 1741 |
+
"n": 100,
|
| 1742 |
+
"p0": 136.5,
|
| 1743 |
+
"p1": 164.715,
|
| 1744 |
+
"p5": 184.350000605,
|
| 1745 |
+
"p10": 196.34998821,
|
| 1746 |
+
"p25": 212.25,
|
| 1747 |
+
"p50": 247.5,
|
| 1748 |
+
"p75": 282.0078125,
|
| 1749 |
+
"p90": 308.79358080000003,
|
| 1750 |
+
"p95": 356.8478735,
|
| 1751 |
+
"p99": 369.39403164000015,
|
| 1752 |
+
"p100": 394.5,
|
| 1753 |
+
"mean": 250.30366472699998
|
| 1754 |
+
},
|
| 1755 |
+
"phys_x_mm": {
|
| 1756 |
+
"n": 100,
|
| 1757 |
+
"p0": 75.0,
|
| 1758 |
+
"p1": 138.855,
|
| 1759 |
+
"p5": 171.0,
|
| 1760 |
+
"p10": 193.2,
|
| 1761 |
+
"p25": 325.124983725,
|
| 1762 |
+
"p50": 357.7500119,
|
| 1763 |
+
"p75": 395.3612775,
|
| 1764 |
+
"p90": 430.4665443,
|
| 1765 |
+
"p95": 459.525,
|
| 1766 |
+
"p99": 493.19310686,
|
| 1767 |
+
"p100": 496.093496,
|
| 1768 |
+
"mean": 345.712107274
|
| 1769 |
+
},
|
| 1770 |
+
"resampled_z_vox_at_bucket_sp": {
|
| 1771 |
+
"n": 100,
|
| 1772 |
+
"p0": 29.0,
|
| 1773 |
+
"p1": 34.94,
|
| 1774 |
+
"p5": 40.0,
|
| 1775 |
+
"p10": 46.6,
|
| 1776 |
+
"p25": 54.875,
|
| 1777 |
+
"p50": 73.66666666666666,
|
| 1778 |
+
"p75": 89.5,
|
| 1779 |
+
"p90": 100.55000603000002,
|
| 1780 |
+
"p95": 109.69999999999999,
|
| 1781 |
+
"p99": 123.96500000000023,
|
| 1782 |
+
"p100": 170.0,
|
| 1783 |
+
"mean": 73.35246879133334
|
| 1784 |
+
},
|
| 1785 |
+
"resampled_y_vox_at_bucket_sp": {
|
| 1786 |
+
"n": 100,
|
| 1787 |
+
"p0": 68.25,
|
| 1788 |
+
"p1": 82.3575,
|
| 1789 |
+
"p5": 92.1750003025,
|
| 1790 |
+
"p10": 98.174994105,
|
| 1791 |
+
"p25": 106.125,
|
| 1792 |
+
"p50": 123.75,
|
| 1793 |
+
"p75": 141.00390625,
|
| 1794 |
+
"p90": 154.39679040000001,
|
| 1795 |
+
"p95": 178.42393675,
|
| 1796 |
+
"p99": 184.69701582000008,
|
| 1797 |
+
"p100": 197.25,
|
| 1798 |
+
"mean": 125.15183236349999
|
| 1799 |
+
},
|
| 1800 |
+
"resampled_x_vox_at_bucket_sp": {
|
| 1801 |
+
"n": 100,
|
| 1802 |
+
"p0": 37.5,
|
| 1803 |
+
"p1": 69.4275,
|
| 1804 |
+
"p5": 85.5,
|
| 1805 |
+
"p10": 96.6,
|
| 1806 |
+
"p25": 162.5624918625,
|
| 1807 |
+
"p50": 178.87500595,
|
| 1808 |
+
"p75": 197.68063875,
|
| 1809 |
+
"p90": 215.23327215,
|
| 1810 |
+
"p95": 229.7625,
|
| 1811 |
+
"p99": 246.59655343,
|
| 1812 |
+
"p100": 248.046748,
|
| 1813 |
+
"mean": 172.856053637
|
| 1814 |
+
}
|
| 1815 |
+
},
|
| 1816 |
+
"B-whole": {
|
| 1817 |
+
"n": 4618,
|
| 1818 |
+
"fov_counts": {
|
| 1819 |
+
"whole_body": 4618
|
| 1820 |
+
},
|
| 1821 |
+
"crop_any_pct": 6.041576440017323,
|
| 1822 |
+
"crop_x_pct": 1.7540060632308359,
|
| 1823 |
+
"crop_y_pct": 0.0,
|
| 1824 |
+
"crop_z_pct": 4.4391511476829795,
|
| 1825 |
+
"phys_z_mm": {
|
| 1826 |
+
"n": 4618,
|
| 1827 |
+
"p0": 6.4,
|
| 1828 |
+
"p1": 109.50816,
|
| 1829 |
+
"p5": 143.03906759999998,
|
| 1830 |
+
"p10": 153.60000000000002,
|
| 1831 |
+
"p25": 172.0,
|
| 1832 |
+
"p50": 226.125,
|
| 1833 |
+
"p75": 410.0,
|
| 1834 |
+
"p90": 510.0,
|
| 1835 |
+
"p95": 627.0,
|
| 1836 |
+
"p99": 732.49661904,
|
| 1837 |
+
"p100": 860.0,
|
| 1838 |
+
"mean": 296.70288681160895
|
| 1839 |
+
},
|
| 1840 |
+
"phys_y_mm": {
|
| 1841 |
+
"n": 4618,
|
| 1842 |
+
"p0": 132.8125,
|
| 1843 |
+
"p1": 194.40127227,
|
| 1844 |
+
"p5": 219.1037,
|
| 1845 |
+
"p10": 231.5455401,
|
| 1846 |
+
"p25": 257.05811775,
|
| 1847 |
+
"p50": 286.5234375,
|
| 1848 |
+
"p75": 317.0,
|
| 1849 |
+
"p90": 348.63268755,
|
| 1850 |
+
"p95": 371.577930285,
|
| 1851 |
+
"p99": 412.5199325875,
|
| 1852 |
+
"p100": 498.04662,
|
| 1853 |
+
"mean": 288.764364898181
|
| 1854 |
+
},
|
| 1855 |
+
"phys_x_mm": {
|
| 1856 |
+
"n": 4618,
|
| 1857 |
+
"p0": 76.5,
|
| 1858 |
+
"p1": 225.0,
|
| 1859 |
+
"p5": 303.47166780000003,
|
| 1860 |
+
"p10": 323.3789559,
|
| 1861 |
+
"p25": 351.118,
|
| 1862 |
+
"p50": 385.15625,
|
| 1863 |
+
"p75": 436.1875,
|
| 1864 |
+
"p90": 497.76,
|
| 1865 |
+
"p95": 512.0,
|
| 1866 |
+
"p99": 586.4043329999995,
|
| 1867 |
+
"p100": 1416.0,
|
| 1868 |
+
"mean": 395.6852566572066
|
| 1869 |
+
},
|
| 1870 |
+
"resampled_z_vox_at_bucket_sp": {
|
| 1871 |
+
"n": 4618,
|
| 1872 |
+
"p0": 1.28,
|
| 1873 |
+
"p1": 21.901632,
|
| 1874 |
+
"p5": 28.607813519999997,
|
| 1875 |
+
"p10": 30.720000000000006,
|
| 1876 |
+
"p25": 34.4,
|
| 1877 |
+
"p50": 45.225,
|
| 1878 |
+
"p75": 82.0,
|
| 1879 |
+
"p90": 102.0,
|
| 1880 |
+
"p95": 125.4,
|
| 1881 |
+
"p99": 146.49932380799999,
|
| 1882 |
+
"p100": 172.0,
|
| 1883 |
+
"mean": 59.34057736232178
|
| 1884 |
+
},
|
| 1885 |
+
"resampled_y_vox_at_bucket_sp": {
|
| 1886 |
+
"n": 4618,
|
| 1887 |
+
"p0": 66.40625,
|
| 1888 |
+
"p1": 97.200636135,
|
| 1889 |
+
"p5": 109.55185,
|
| 1890 |
+
"p10": 115.77277005,
|
| 1891 |
+
"p25": 128.529058875,
|
| 1892 |
+
"p50": 143.26171875,
|
| 1893 |
+
"p75": 158.5,
|
| 1894 |
+
"p90": 174.316343775,
|
| 1895 |
+
"p95": 185.7889651425,
|
| 1896 |
+
"p99": 206.25996629375,
|
| 1897 |
+
"p100": 249.02331,
|
| 1898 |
+
"mean": 144.3821824490905
|
| 1899 |
+
},
|
| 1900 |
+
"resampled_x_vox_at_bucket_sp": {
|
| 1901 |
+
"n": 4618,
|
| 1902 |
+
"p0": 38.25,
|
| 1903 |
+
"p1": 112.5,
|
| 1904 |
+
"p5": 151.73583390000002,
|
| 1905 |
+
"p10": 161.68947795,
|
| 1906 |
+
"p25": 175.559,
|
| 1907 |
+
"p50": 192.578125,
|
| 1908 |
+
"p75": 218.09375,
|
| 1909 |
+
"p90": 248.88,
|
| 1910 |
+
"p95": 256.0,
|
| 1911 |
+
"p99": 293.20216649999975,
|
| 1912 |
+
"p100": 708.0,
|
| 1913 |
+
"mean": 197.8426283286033
|
| 1914 |
+
}
|
| 1915 |
+
}
|
| 1916 |
+
},
|
| 1917 |
+
"pancreas_bbox_summary": {
|
| 1918 |
+
"n_with_bbox": 9442,
|
| 1919 |
+
"bbox_x_mm": {
|
| 1920 |
+
"n": 9442,
|
| 1921 |
+
"p0": 0.0,
|
| 1922 |
+
"p1": 31.542968702,
|
| 1923 |
+
"p5": 81.0,
|
| 1924 |
+
"p10": 99.25775420000001,
|
| 1925 |
+
"p25": 118.09273200000001,
|
| 1926 |
+
"p50": 135.6139965,
|
| 1927 |
+
"p75": 152.148440575,
|
| 1928 |
+
"p90": 172.0,
|
| 1929 |
+
"p95": 193.3413121999996,
|
| 1930 |
+
"p99": 467.9500000000007,
|
| 1931 |
+
"p100": 875.0,
|
| 1932 |
+
"mean": 141.87029645111627
|
| 1933 |
+
},
|
| 1934 |
+
"bbox_y_mm": {
|
| 1935 |
+
"n": 9442,
|
| 1936 |
+
"p0": 0.0,
|
| 1937 |
+
"p1": 25.78125,
|
| 1938 |
+
"p5": 41.69921875,
|
| 1939 |
+
"p10": 48.86250014,
|
| 1940 |
+
"p25": 59.5722885,
|
| 1941 |
+
"p50": 71.386729375,
|
| 1942 |
+
"p75": 83.375,
|
| 1943 |
+
"p90": 95.0,
|
| 1944 |
+
"p95": 103.500006555,
|
| 1945 |
+
"p99": 123.30349479200001,
|
| 1946 |
+
"p100": 190.5,
|
| 1947 |
+
"mean": 71.87623691468438
|
| 1948 |
+
},
|
| 1949 |
+
"bbox_z_mm": {
|
| 1950 |
+
"n": 9442,
|
| 1951 |
+
"p0": 0.0,
|
| 1952 |
+
"p1": 7.5,
|
| 1953 |
+
"p5": 19.5,
|
| 1954 |
+
"p10": 41.0,
|
| 1955 |
+
"p25": 66.0,
|
| 1956 |
+
"p50": 80.0,
|
| 1957 |
+
"p75": 90.0,
|
| 1958 |
+
"p90": 100.5,
|
| 1959 |
+
"p95": 109.18999999999977,
|
| 1960 |
+
"p99": 145.89750000000004,
|
| 1961 |
+
"p100": 452.0,
|
| 1962 |
+
"mean": 76.58949473566723
|
| 1963 |
+
},
|
| 1964 |
+
"padded_x_mm": {
|
| 1965 |
+
"n": 9442,
|
| 1966 |
+
"p0": 80.0,
|
| 1967 |
+
"p1": 111.542968702,
|
| 1968 |
+
"p5": 161.0,
|
| 1969 |
+
"p10": 179.25775420000002,
|
| 1970 |
+
"p25": 198.092732,
|
| 1971 |
+
"p50": 215.6139965,
|
| 1972 |
+
"p75": 232.148440575,
|
| 1973 |
+
"p90": 252.0,
|
| 1974 |
+
"p95": 273.3413121999996,
|
| 1975 |
+
"p99": 547.9500000000007,
|
| 1976 |
+
"p100": 955.0,
|
| 1977 |
+
"mean": 221.87029645111627
|
| 1978 |
+
},
|
| 1979 |
+
"padded_y_mm": {
|
| 1980 |
+
"n": 9442,
|
| 1981 |
+
"p0": 80.0,
|
| 1982 |
+
"p1": 105.78125,
|
| 1983 |
+
"p5": 121.69921875,
|
| 1984 |
+
"p10": 128.86250014,
|
| 1985 |
+
"p25": 139.57228849999998,
|
| 1986 |
+
"p50": 151.38672937500002,
|
| 1987 |
+
"p75": 163.375,
|
| 1988 |
+
"p90": 175.0,
|
| 1989 |
+
"p95": 183.50000655500003,
|
| 1990 |
+
"p99": 203.303494792,
|
| 1991 |
+
"p100": 270.5,
|
| 1992 |
+
"mean": 151.8762369146844
|
| 1993 |
+
},
|
| 1994 |
+
"padded_z_mm": {
|
| 1995 |
+
"n": 9442,
|
| 1996 |
+
"p0": 80.0,
|
| 1997 |
+
"p1": 87.5,
|
| 1998 |
+
"p5": 99.5,
|
| 1999 |
+
"p10": 121.0,
|
| 2000 |
+
"p25": 146.0,
|
| 2001 |
+
"p50": 160.0,
|
| 2002 |
+
"p75": 170.0,
|
| 2003 |
+
"p90": 180.5,
|
| 2004 |
+
"p95": 189.18999999999977,
|
| 2005 |
+
"p99": 225.89750000000004,
|
| 2006 |
+
"p100": 532.0,
|
| 2007 |
+
"mean": 156.58949473566722
|
| 2008 |
+
},
|
| 2009 |
+
"fits_Bpan_pct": 8.19741580173692,
|
| 2010 |
+
"over_x_pct": 8.462190213937726,
|
| 2011 |
+
"over_y_pct": 2.5524253336157594,
|
| 2012 |
+
"over_z_pct": 87.75683117983478
|
| 2013 |
+
}
|
| 2014 |
+
}
|
raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/bucket_spec_v2_proposal.json
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"buckets": [
|
| 3 |
+
{
|
| 4 |
+
"name": "B-whole-v2",
|
| 5 |
+
"fov": "whole_body",
|
| 6 |
+
"shape_dhw": [
|
| 7 |
+
160,
|
| 8 |
+
256,
|
| 9 |
+
256
|
| 10 |
+
],
|
| 11 |
+
"voxel_spacing_mm": [
|
| 12 |
+
5.0,
|
| 13 |
+
2.0,
|
| 14 |
+
2.0
|
| 15 |
+
],
|
| 16 |
+
"coverage_mm": [
|
| 17 |
+
800,
|
| 18 |
+
512,
|
| 19 |
+
512
|
| 20 |
+
],
|
| 21 |
+
"tokens_after_patch": 2624,
|
| 22 |
+
"fit": "crop_any=0.3%, crop_z=0.1%"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"name": "B-CAP-v2",
|
| 26 |
+
"fov": "chest_abdomen_pelvis",
|
| 27 |
+
"shape_dhw": [
|
| 28 |
+
112,
|
| 29 |
+
320,
|
| 30 |
+
256
|
| 31 |
+
],
|
| 32 |
+
"voxel_spacing_mm": [
|
| 33 |
+
4.0,
|
| 34 |
+
2.0,
|
| 35 |
+
2.0
|
| 36 |
+
],
|
| 37 |
+
"coverage_mm": [
|
| 38 |
+
448,
|
| 39 |
+
640,
|
| 40 |
+
512
|
| 41 |
+
],
|
| 42 |
+
"tokens_after_patch": 2320,
|
| 43 |
+
"fit": "crop_any=0.6%, crop_z=0.6%"
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"name": "B-CA-v2",
|
| 47 |
+
"fov": "chest_abdomen",
|
| 48 |
+
"shape_dhw": [
|
| 49 |
+
104,
|
| 50 |
+
320,
|
| 51 |
+
256
|
| 52 |
+
],
|
| 53 |
+
"voxel_spacing_mm": [
|
| 54 |
+
3.5,
|
| 55 |
+
2.0,
|
| 56 |
+
2.0
|
| 57 |
+
],
|
| 58 |
+
"coverage_mm": [
|
| 59 |
+
364,
|
| 60 |
+
640,
|
| 61 |
+
512
|
| 62 |
+
],
|
| 63 |
+
"tokens_after_patch": 2160,
|
| 64 |
+
"fit": "crop_any=0.7%, crop_z=0.7%"
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"name": "B-abd-v2",
|
| 68 |
+
"fov": "abdomen_only",
|
| 69 |
+
"shape_dhw": [
|
| 70 |
+
104,
|
| 71 |
+
256,
|
| 72 |
+
256
|
| 73 |
+
],
|
| 74 |
+
"voxel_spacing_mm": [
|
| 75 |
+
3.0,
|
| 76 |
+
2.0,
|
| 77 |
+
2.0
|
| 78 |
+
],
|
| 79 |
+
"coverage_mm": [
|
| 80 |
+
312,
|
| 81 |
+
512,
|
| 82 |
+
512
|
| 83 |
+
],
|
| 84 |
+
"tokens_after_patch": 1728,
|
| 85 |
+
"fit": "crop_any=1.0%, crop_z=1.0%"
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
"name": "B-abd-pelvis-v2",
|
| 89 |
+
"fov": "abdomen_pelvis",
|
| 90 |
+
"shape_dhw": [
|
| 91 |
+
112,
|
| 92 |
+
256,
|
| 93 |
+
256
|
| 94 |
+
],
|
| 95 |
+
"voxel_spacing_mm": [
|
| 96 |
+
3.5,
|
| 97 |
+
2.0,
|
| 98 |
+
2.0
|
| 99 |
+
],
|
| 100 |
+
"coverage_mm": [
|
| 101 |
+
392,
|
| 102 |
+
512,
|
| 103 |
+
512
|
| 104 |
+
],
|
| 105 |
+
"tokens_after_patch": 1856,
|
| 106 |
+
"fit": "crop_any=1.0%, crop_z=1.0%"
|
| 107 |
+
},
|
| 108 |
+
{
|
| 109 |
+
"name": "B-pan-p95",
|
| 110 |
+
"fov": "pan_crop",
|
| 111 |
+
"shape_dhw": [
|
| 112 |
+
96,
|
| 113 |
+
192,
|
| 114 |
+
256
|
| 115 |
+
],
|
| 116 |
+
"voxel_spacing_mm": [
|
| 117 |
+
2.0,
|
| 118 |
+
1.0,
|
| 119 |
+
1.0
|
| 120 |
+
],
|
| 121 |
+
"coverage_mm": [
|
| 122 |
+
192,
|
| 123 |
+
192,
|
| 124 |
+
256
|
| 125 |
+
],
|
| 126 |
+
"tokens_after_patch": 1200,
|
| 127 |
+
"fit": "40mm padded pancreas bbox fit=90.7%"
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"name": "B-pan-p99",
|
| 131 |
+
"fov": "pan_crop",
|
| 132 |
+
"shape_dhw": [
|
| 133 |
+
112,
|
| 134 |
+
224,
|
| 135 |
+
288
|
| 136 |
+
],
|
| 137 |
+
"voxel_spacing_mm": [
|
| 138 |
+
2.0,
|
| 139 |
+
1.0,
|
| 140 |
+
1.0
|
| 141 |
+
],
|
| 142 |
+
"coverage_mm": [
|
| 143 |
+
224,
|
| 144 |
+
224,
|
| 145 |
+
288
|
| 146 |
+
],
|
| 147 |
+
"tokens_after_patch": 1827,
|
| 148 |
+
"fit": "40mm padded pancreas bbox fit=98.4%"
|
| 149 |
+
},
|
| 150 |
+
{
|
| 151 |
+
"name": "B-pan-hires-p95",
|
| 152 |
+
"fov": "pan_crop",
|
| 153 |
+
"shape_dhw": [
|
| 154 |
+
128,
|
| 155 |
+
224,
|
| 156 |
+
288
|
| 157 |
+
],
|
| 158 |
+
"voxel_spacing_mm": [
|
| 159 |
+
1.5,
|
| 160 |
+
1.0,
|
| 161 |
+
1.0
|
| 162 |
+
],
|
| 163 |
+
"coverage_mm": [
|
| 164 |
+
192,
|
| 165 |
+
224,
|
| 166 |
+
288
|
| 167 |
+
],
|
| 168 |
+
"tokens_after_patch": 2079,
|
| 169 |
+
"fit": "40mm padded pancreas bbox fit=95.7%"
|
| 170 |
+
}
|
| 171 |
+
],
|
| 172 |
+
"token_cap": 8192,
|
| 173 |
+
"vae": {
|
| 174 |
+
"compression": [
|
| 175 |
+
4,
|
| 176 |
+
16,
|
| 177 |
+
16
|
| 178 |
+
],
|
| 179 |
+
"channels": 48,
|
| 180 |
+
"family": "wan22"
|
| 181 |
+
},
|
| 182 |
+
"dit_patch": [
|
| 183 |
+
1,
|
| 184 |
+
2,
|
| 185 |
+
2
|
| 186 |
+
]
|
| 187 |
+
}
|
raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/bucket_spec_v2_proposal.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Bucket Spec v2 Proposal
|
| 2 |
+
|
| 3 |
+
Derived from canonical-axis PanTS resolution analysis. All token counts are under 8192.
|
| 4 |
+
|
| 5 |
+
| bucket | fov | shape DHW | spacing ZYX mm | coverage ZYX mm | tokens | empirical fit |
|
| 6 |
+
|---|---|---:|---:|---:|---:|---|
|
| 7 |
+
| B-whole-v2 | whole_body | 160x256x256 | 5.0x2.0x2.0 | 800x512x512 | 2624 | crop_any=0.3%, crop_z=0.1% |
|
| 8 |
+
| B-CAP-v2 | chest_abdomen_pelvis | 112x320x256 | 4.0x2.0x2.0 | 448x640x512 | 2320 | crop_any=0.6%, crop_z=0.6% |
|
| 9 |
+
| B-CA-v2 | chest_abdomen | 104x320x256 | 3.5x2.0x2.0 | 364x640x512 | 2160 | crop_any=0.7%, crop_z=0.7% |
|
| 10 |
+
| B-abd-v2 | abdomen_only | 104x256x256 | 3.0x2.0x2.0 | 312x512x512 | 1728 | crop_any=1.0%, crop_z=1.0% |
|
| 11 |
+
| B-abd-pelvis-v2 | abdomen_pelvis | 112x256x256 | 3.5x2.0x2.0 | 392x512x512 | 1856 | crop_any=1.0%, crop_z=1.0% |
|
| 12 |
+
| B-pan-p95 | pan_crop | 96x192x256 | 2.0x1.0x1.0 | 192x192x256 | 1200 | 40mm padded pancreas bbox fit=90.7% |
|
| 13 |
+
| B-pan-p99 | pan_crop | 112x224x288 | 2.0x1.0x1.0 | 224x224x288 | 1827 | 40mm padded pancreas bbox fit=98.4% |
|
| 14 |
+
| B-pan-hires-p95 | pan_crop | 128x224x288 | 1.5x1.0x1.0 | 192x224x288 | 2079 | 40mm padded pancreas bbox fit=95.7% |
|
| 15 |
+
|
| 16 |
+
Recommendation: use the full-volume v2 buckets for global captions, and use either `B-pan-p99` as the single pancreas crop bucket or split `B-pan-hires-p95` plus `B-pan-p99` fallback if preserving z detail is more important than a single cache shape.
|
raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/resolution_records_canonical_axes.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/resolution_report_canonical_axes.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PanTS Resolution Analysis - Canonical Axes
|
| 2 |
+
|
| 3 |
+
Generated on `2026-05-19 16:22:27 PDT` inside allocation `524904` using `--cpus-per-task=208`.
|
| 4 |
+
|
| 5 |
+
This report uses `canonical/canonical_facts.jsonl` mask shape/spacing after `nib.as_closest_canonical`, not raw NIfTI header axes.
|
| 6 |
+
|
| 7 |
+
## Integrity
|
| 8 |
+
- Cases: **9901**
|
| 9 |
+
- Split counts: `{'train': 8181, 'val': 819, 'test': 901}`
|
| 10 |
+
- FOV counts: `{'chest_abdomen_pelvis': 2624, 'chest_abdomen': 2454, 'whole_body': 4618, 'abdomen_pelvis': 100, 'abdomen_only': 105}`
|
| 11 |
+
|
| 12 |
+
## Overall
|
| 13 |
+
| metric | n | min | p5 | p25 | p50 | p75 | p95 | p99 | max |
|
| 14 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 15 |
+
| shape_x_vox | 9901 | 47 | 204 | 439 | 496 | 512 | 512 | 512 | 768 |
|
| 16 |
+
| shape_y_vox | 9901 | 48 | 164 | 308 | 361 | 403 | 458 | 493 | 547 |
|
| 17 |
+
| shape_z_slices | 9901 | 8 | 56 | 121 | 180 | 224 | 348 | 516 | 1.06e+03 |
|
| 18 |
+
| spacing_x_mm | 9901 | 0.393 | 0.641 | 0.738 | 0.797 | 0.947 | 1.5 | 1.5 | 2.5 |
|
| 19 |
+
| spacing_y_mm | 9901 | 0.393 | 0.641 | 0.738 | 0.797 | 0.949 | 1.5 | 1.5 | 5 |
|
| 20 |
+
| spacing_z_mm | 9901 | 0.363 | 0.8 | 0.8 | 1.25 | 2.5 | 5 | 5 | 10 |
|
| 21 |
+
| phys_x_mm | 9901 | 70.5 | 182 | 344 | 377 | 410 | 492 | 512 | 641 |
|
| 22 |
+
| phys_y_mm | 9901 | 72 | 217 | 255 | 285 | 320 | 377 | 412 | 500 |
|
| 23 |
+
| phys_z_mm | 9901 | 6.4 | 141 | 176 | 225 | 340 | 519 | 700 | 1.42e+03 |
|
| 24 |
+
| voxel_count_M | 9901 | 0.379 | 4.69 | 14.4 | 29.3 | 43.2 | 57.6 | 90.5 | 240 |
|
| 25 |
+
|
| 26 |
+
## FOV Groups
|
| 27 |
+
| fov | n | z slices p50/p95 | z spacing p50/p95 mm | physical Z p50/p95/max mm | physical XY p50 mm | voxel count p50/p95 M |
|
| 28 |
+
|---|---:|---:|---:|---:|---:|---:|
|
| 29 |
+
| abdomen_only | 105 | 113/221 | 1.50/2.50 | 153.6/203.5/358.5 | 325.5 x 243.9 | 5.1/44.5 |
|
| 30 |
+
| abdomen_pelvis | 100 | 150/231 | 1.50/5.00 | 223.5/340.6/510.0 | 357.0 x 247.5 | 5.8/36.4 |
|
| 31 |
+
| chest_abdomen | 2454 | 200/252 | 0.80/5.00 | 180.0/305.0/820.0 | 364.5 x 278.7 | 36.0/53.1 |
|
| 32 |
+
| chest_abdomen_pelvis | 2624 | 153/363 | 1.50/5.00 | 252.0/390.0/720.0 | 391.0 x 294.4 | 21.4/79.7 |
|
| 33 |
+
| whole_body | 4618 | 193/362 | 1.25/5.00 | 272.5/642.1/1416.0 | 377.3 x 286.5 | 31.6/57.2 |
|
| 34 |
+
|
| 35 |
+
## Existing Bucket Coverage
|
| 36 |
+
| bucket | n | crop any % | crop z/y/x % | physical Z p50/p95/max mm | physical Y p95/max mm | physical X p95/max mm | resampled shape p95 z/y/x vox |
|
| 37 |
+
|---|---:|---:|---:|---:|---:|---:|---:|
|
| 38 |
+
| B-CA | 2454 | 7.0 | 7.0/0.0/0.0 | 180.0/305.0/820.0 | 359.9/461.1 | 446.9/512.0 | 87/180/223 |
|
| 39 |
+
| B-CAP | 2624 | 12.2 | 12.2/0.0/0.0 | 252.0/390.0/720.0 | 390.2/499.5 | 472.0/512.0 | 98/195/236 |
|
| 40 |
+
| B-abd | 105 | 6.7 | 6.7/0.0/0.0 | 153.6/203.5/358.5 | 337.5/370.5 | 399.8/480.0 | 68/169/200 |
|
| 41 |
+
| B-abd-pelvis | 100 | 60.0 | 60.0/0.0/0.0 | 223.5/340.6/510.0 | 356.8/394.5 | 459.5/496.1 | 114/178/230 |
|
| 42 |
+
| B-whole | 4618 | 5.1 | 5.1/0.0/0.2 | 272.5/642.1/1416.0 | 371.6/498.0 | 510.0/641.2 | 128/186/255 |
|
| 43 |
+
|
| 44 |
+
## Pancreas BBox For Current B-pan
|
| 45 |
+
- Cases with bbox: **9442**
|
| 46 |
+
- Current B-pan `(Z,Y,X)=(128,192,256) mm` fit rate after 40mm pad: **7.9%**
|
| 47 |
+
- Over target X/Y/Z: **4.7% / 2.6% / 91.8%**
|
| 48 |
+
|
| 49 |
+
| metric | n | min | p5 | p25 | p50 | p75 | p95 | p99 | max |
|
| 50 |
+
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
|
| 51 |
+
| bbox_x_mm | 9442 | 0 | 66.7 | 115 | 133 | 149 | 176 | 199 | 311 |
|
| 52 |
+
| bbox_y_mm | 9442 | 0 | 41.7 | 59.6 | 71.4 | 83.4 | 104 | 123 | 190 |
|
| 53 |
+
| bbox_z_mm | 9442 | 0 | 36 | 69.6 | 80 | 90.3 | 108 | 139 | 452 |
|
| 54 |
+
| padded_x_mm | 9442 | 80 | 147 | 195 | 213 | 229 | 256 | 279 | 391 |
|
| 55 |
+
| padded_y_mm | 9442 | 80 | 122 | 140 | 151 | 163 | 184 | 203 | 270 |
|
| 56 |
+
| padded_z_mm | 9442 | 80 | 116 | 150 | 160 | 170 | 188 | 219 | 532 |
|
| 57 |
+
|
| 58 |
+
## Artifacts
|
| 59 |
+
- CSV: `/scratch/user/yuhwang/dataset/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/resolution_records_canonical_axes.csv`
|
| 60 |
+
- JSON: `/scratch/user/yuhwang/dataset/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/resolution_summary_canonical_axes.json`
|
raw_pants_train_test/metadata/pants-captions-ldm/audit/resolution_analysis_20260519_canonical_axes/resolution_summary_canonical_axes.json
ADDED
|
@@ -0,0 +1,1548 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"generated_at": "2026-05-19 16:22:27 PDT",
|
| 3 |
+
"axis_note": "Uses canonical_facts mask.shape/spacing after nib.as_closest_canonical; this is the axis frame used by the existing caption/canonical pipeline.",
|
| 4 |
+
"n_records": 9901,
|
| 5 |
+
"missing": [],
|
| 6 |
+
"split_counts": {
|
| 7 |
+
"train": 8181,
|
| 8 |
+
"val": 819,
|
| 9 |
+
"test": 901
|
| 10 |
+
},
|
| 11 |
+
"fov_counts": {
|
| 12 |
+
"chest_abdomen_pelvis": 2624,
|
| 13 |
+
"chest_abdomen": 2454,
|
| 14 |
+
"whole_body": 4618,
|
| 15 |
+
"abdomen_pelvis": 100,
|
| 16 |
+
"abdomen_only": 105
|
| 17 |
+
},
|
| 18 |
+
"phase_counts": {
|
| 19 |
+
"Non-contrast": 4485,
|
| 20 |
+
"Venous": 2897,
|
| 21 |
+
"Arterial": 2450,
|
| 22 |
+
"unknown": 1,
|
| 23 |
+
"Delay": 68
|
| 24 |
+
},
|
| 25 |
+
"lesion_counts": {
|
| 26 |
+
"False": 8943,
|
| 27 |
+
"True": 958
|
| 28 |
+
},
|
| 29 |
+
"overall": {
|
| 30 |
+
"n": 9901,
|
| 31 |
+
"shape_x": {
|
| 32 |
+
"n": 9901,
|
| 33 |
+
"p0": 47.0,
|
| 34 |
+
"p1": 119.0,
|
| 35 |
+
"p5": 204.0,
|
| 36 |
+
"p10": 221.0,
|
| 37 |
+
"p25": 439.0,
|
| 38 |
+
"p50": 496.0,
|
| 39 |
+
"p75": 512.0,
|
| 40 |
+
"p90": 512.0,
|
| 41 |
+
"p95": 512.0,
|
| 42 |
+
"p99": 512.0,
|
| 43 |
+
"p100": 768.0,
|
| 44 |
+
"mean": 442.78103221896777
|
| 45 |
+
},
|
| 46 |
+
"shape_y": {
|
| 47 |
+
"n": 9901,
|
| 48 |
+
"p0": 48.0,
|
| 49 |
+
"p1": 120.0,
|
| 50 |
+
"p5": 164.0,
|
| 51 |
+
"p10": 200.0,
|
| 52 |
+
"p25": 308.0,
|
| 53 |
+
"p50": 361.0,
|
| 54 |
+
"p75": 403.0,
|
| 55 |
+
"p90": 437.0,
|
| 56 |
+
"p95": 458.0,
|
| 57 |
+
"p99": 493.0,
|
| 58 |
+
"p100": 547.0,
|
| 59 |
+
"mean": 345.05161094838905
|
| 60 |
+
},
|
| 61 |
+
"shape_z": {
|
| 62 |
+
"n": 9901,
|
| 63 |
+
"p0": 8.0,
|
| 64 |
+
"p1": 37.0,
|
| 65 |
+
"p5": 56.0,
|
| 66 |
+
"p10": 86.0,
|
| 67 |
+
"p25": 121.0,
|
| 68 |
+
"p50": 180.0,
|
| 69 |
+
"p75": 224.0,
|
| 70 |
+
"p90": 278.0,
|
| 71 |
+
"p95": 348.0,
|
| 72 |
+
"p99": 516.0,
|
| 73 |
+
"p100": 1060.0,
|
| 74 |
+
"mean": 183.97060902939097
|
| 75 |
+
},
|
| 76 |
+
"spacing_x_mm": {
|
| 77 |
+
"n": 9901,
|
| 78 |
+
"p0": 0.392578125,
|
| 79 |
+
"p1": 0.58203125,
|
| 80 |
+
"p5": 0.640625,
|
| 81 |
+
"p10": 0.6738280057907104,
|
| 82 |
+
"p25": 0.7379999756813049,
|
| 83 |
+
"p50": 0.796875,
|
| 84 |
+
"p75": 0.947265625,
|
| 85 |
+
"p90": 1.5,
|
| 86 |
+
"p95": 1.5,
|
| 87 |
+
"p99": 1.5,
|
| 88 |
+
"p100": 2.5000038146972656,
|
| 89 |
+
"mean": 0.887715601205296
|
| 90 |
+
},
|
| 91 |
+
"spacing_y_mm": {
|
| 92 |
+
"n": 9901,
|
| 93 |
+
"p0": 0.392578125,
|
| 94 |
+
"p1": 0.5839840173721313,
|
| 95 |
+
"p5": 0.640625,
|
| 96 |
+
"p10": 0.6738280057907104,
|
| 97 |
+
"p25": 0.7382810115814209,
|
| 98 |
+
"p50": 0.796875,
|
| 99 |
+
"p75": 0.94921875,
|
| 100 |
+
"p90": 1.5,
|
| 101 |
+
"p95": 1.5,
|
| 102 |
+
"p99": 1.5,
|
| 103 |
+
"p100": 5.0,
|
| 104 |
+
"mean": 0.8918515933714615
|
| 105 |
+
},
|
| 106 |
+
"spacing_z_mm": {
|
| 107 |
+
"n": 9901,
|
| 108 |
+
"p0": 0.3633037209510803,
|
| 109 |
+
"p1": 0.5,
|
| 110 |
+
"p5": 0.800000011920929,
|
| 111 |
+
"p10": 0.800000011920929,
|
| 112 |
+
"p25": 0.800000011920929,
|
| 113 |
+
"p50": 1.25,
|
| 114 |
+
"p75": 2.5,
|
| 115 |
+
"p90": 5.0,
|
| 116 |
+
"p95": 5.0,
|
| 117 |
+
"p99": 5.0,
|
| 118 |
+
"p100": 10.0,
|
| 119 |
+
"mean": 1.8965283615181463
|
| 120 |
+
},
|
| 121 |
+
"phys_x_mm": {
|
| 122 |
+
"n": 9901,
|
| 123 |
+
"p0": 70.5,
|
| 124 |
+
"p1": 141.4453125,
|
| 125 |
+
"p5": 181.6875,
|
| 126 |
+
"p10": 304.5,
|
| 127 |
+
"p25": 343.78398990631104,
|
| 128 |
+
"p50": 377.34375,
|
| 129 |
+
"p75": 409.693359375,
|
| 130 |
+
"p90": 460.5,
|
| 131 |
+
"p95": 492.0,
|
| 132 |
+
"p99": 512.0,
|
| 133 |
+
"p100": 641.2111611366272,
|
| 134 |
+
"mean": 372.02568867086234
|
| 135 |
+
},
|
| 136 |
+
"phys_y_mm": {
|
| 137 |
+
"n": 9901,
|
| 138 |
+
"p0": 72.0,
|
| 139 |
+
"p1": 180.11731386184692,
|
| 140 |
+
"p5": 216.5625,
|
| 141 |
+
"p10": 229.7890944480896,
|
| 142 |
+
"p25": 255.38276624679565,
|
| 143 |
+
"p50": 285.46875,
|
| 144 |
+
"p75": 319.552734375,
|
| 145 |
+
"p90": 357.640625,
|
| 146 |
+
"p95": 377.25,
|
| 147 |
+
"p99": 411.857421875,
|
| 148 |
+
"p100": 499.5,
|
| 149 |
+
"mean": 289.15381416160704
|
| 150 |
+
},
|
| 151 |
+
"phys_z_mm": {
|
| 152 |
+
"n": 9901,
|
| 153 |
+
"p0": 6.400000095367432,
|
| 154 |
+
"p1": 102.0,
|
| 155 |
+
"p5": 140.8000020980835,
|
| 156 |
+
"p10": 156.00000232458115,
|
| 157 |
+
"p25": 175.69600248336792,
|
| 158 |
+
"p50": 225.0,
|
| 159 |
+
"p75": 340.0,
|
| 160 |
+
"p90": 460.0,
|
| 161 |
+
"p95": 519.0,
|
| 162 |
+
"p99": 700.0,
|
| 163 |
+
"p100": 1416.0,
|
| 164 |
+
"mean": 271.2639500448384
|
| 165 |
+
},
|
| 166 |
+
"voxel_count_m": {
|
| 167 |
+
"n": 9901,
|
| 168 |
+
"p0": 0.3792,
|
| 169 |
+
"p1": 1.658684,
|
| 170 |
+
"p5": 4.686672,
|
| 171 |
+
"p10": 6.509118,
|
| 172 |
+
"p25": 14.44216,
|
| 173 |
+
"p50": 29.3433,
|
| 174 |
+
"p75": 43.225875,
|
| 175 |
+
"p90": 51.67104,
|
| 176 |
+
"p95": 57.575808,
|
| 177 |
+
"p99": 90.486784,
|
| 178 |
+
"p100": 240.28928,
|
| 179 |
+
"mean": 30.052378630340367
|
| 180 |
+
}
|
| 181 |
+
},
|
| 182 |
+
"by_fov": {
|
| 183 |
+
"abdomen_only": {
|
| 184 |
+
"n": 105,
|
| 185 |
+
"shape_x": {
|
| 186 |
+
"n": 105,
|
| 187 |
+
"p0": 85.0,
|
| 188 |
+
"p1": 92.4,
|
| 189 |
+
"p5": 110.2,
|
| 190 |
+
"p10": 118.4,
|
| 191 |
+
"p25": 143.0,
|
| 192 |
+
"p50": 245.0,
|
| 193 |
+
"p75": 512.0,
|
| 194 |
+
"p90": 512.0,
|
| 195 |
+
"p95": 512.0,
|
| 196 |
+
"p99": 512.0,
|
| 197 |
+
"p100": 512.0,
|
| 198 |
+
"mean": 317.06666666666666
|
| 199 |
+
},
|
| 200 |
+
"shape_y": {
|
| 201 |
+
"n": 105,
|
| 202 |
+
"p0": 89.0,
|
| 203 |
+
"p1": 94.44,
|
| 204 |
+
"p5": 111.2,
|
| 205 |
+
"p10": 124.4,
|
| 206 |
+
"p25": 143.0,
|
| 207 |
+
"p50": 271.0,
|
| 208 |
+
"p75": 372.0,
|
| 209 |
+
"p90": 394.8,
|
| 210 |
+
"p95": 428.79999999999995,
|
| 211 |
+
"p99": 448.88,
|
| 212 |
+
"p100": 456.0,
|
| 213 |
+
"mean": 261.7809523809524
|
| 214 |
+
},
|
| 215 |
+
"shape_z": {
|
| 216 |
+
"n": 105,
|
| 217 |
+
"p0": 29.0,
|
| 218 |
+
"p1": 33.12,
|
| 219 |
+
"p5": 44.6,
|
| 220 |
+
"p10": 56.4,
|
| 221 |
+
"p25": 84.0,
|
| 222 |
+
"p50": 113.0,
|
| 223 |
+
"p75": 196.0,
|
| 224 |
+
"p90": 214.0,
|
| 225 |
+
"p95": 221.39999999999998,
|
| 226 |
+
"p99": 239.95999999999998,
|
| 227 |
+
"p100": 258.0,
|
| 228 |
+
"mean": 132.7047619047619
|
| 229 |
+
},
|
| 230 |
+
"spacing_x_mm": {
|
| 231 |
+
"n": 105,
|
| 232 |
+
"p0": 0.546875,
|
| 233 |
+
"p1": 0.586640625,
|
| 234 |
+
"p5": 0.6218751907348633,
|
| 235 |
+
"p10": 0.6558594465255737,
|
| 236 |
+
"p25": 0.703125,
|
| 237 |
+
"p50": 0.9765625,
|
| 238 |
+
"p75": 1.5,
|
| 239 |
+
"p90": 1.5,
|
| 240 |
+
"p95": 1.5,
|
| 241 |
+
"p99": 1.5000001192092896,
|
| 242 |
+
"p100": 1.5000001192092896,
|
| 243 |
+
"mean": 1.1105694884345645
|
| 244 |
+
},
|
| 245 |
+
"spacing_y_mm": {
|
| 246 |
+
"n": 105,
|
| 247 |
+
"p0": 0.546875,
|
| 248 |
+
"p1": 0.586640625,
|
| 249 |
+
"p5": 0.6218751907348633,
|
| 250 |
+
"p10": 0.6558594465255737,
|
| 251 |
+
"p25": 0.703125,
|
| 252 |
+
"p50": 0.9765625,
|
| 253 |
+
"p75": 1.5,
|
| 254 |
+
"p90": 1.5,
|
| 255 |
+
"p95": 1.5,
|
| 256 |
+
"p99": 1.500000114440918,
|
| 257 |
+
"p100": 1.5000001192092896,
|
| 258 |
+
"mean": 1.1105694861639113
|
| 259 |
+
},
|
| 260 |
+
"spacing_z_mm": {
|
| 261 |
+
"n": 105,
|
| 262 |
+
"p0": 0.699999988079071,
|
| 263 |
+
"p1": 0.7999999523162842,
|
| 264 |
+
"p5": 0.800000011920929,
|
| 265 |
+
"p10": 0.800000011920929,
|
| 266 |
+
"p25": 0.800000011920929,
|
| 267 |
+
"p50": 1.5,
|
| 268 |
+
"p75": 1.5,
|
| 269 |
+
"p90": 1.5,
|
| 270 |
+
"p95": 2.5,
|
| 271 |
+
"p99": 4.9199999999999875,
|
| 272 |
+
"p100": 5.0,
|
| 273 |
+
"mean": 1.3397992327099755
|
| 274 |
+
},
|
| 275 |
+
"phys_x_mm": {
|
| 276 |
+
"n": 105,
|
| 277 |
+
"p0": 111.5625,
|
| 278 |
+
"p1": 127.92,
|
| 279 |
+
"p5": 155.1,
|
| 280 |
+
"p10": 173.11404790878296,
|
| 281 |
+
"p25": 196.5,
|
| 282 |
+
"p50": 325.5,
|
| 283 |
+
"p75": 360.0,
|
| 284 |
+
"p90": 386.21015625,
|
| 285 |
+
"p95": 399.84375,
|
| 286 |
+
"p99": 431.82,
|
| 287 |
+
"p100": 480.0,
|
| 288 |
+
"mean": 292.9369931096122
|
| 289 |
+
},
|
| 290 |
+
"phys_y_mm": {
|
| 291 |
+
"n": 105,
|
| 292 |
+
"p0": 133.50001060962677,
|
| 293 |
+
"p1": 141.6599892425537,
|
| 294 |
+
"p5": 166.8,
|
| 295 |
+
"p10": 186.6,
|
| 296 |
+
"p25": 214.5,
|
| 297 |
+
"p50": 243.90625,
|
| 298 |
+
"p75": 273.515625,
|
| 299 |
+
"p90": 319.5851562500001,
|
| 300 |
+
"p95": 337.5,
|
| 301 |
+
"p99": 369.074826965332,
|
| 302 |
+
"p100": 370.5,
|
| 303 |
+
"mean": 247.92654960155488
|
| 304 |
+
},
|
| 305 |
+
"phys_z_mm": {
|
| 306 |
+
"n": 105,
|
| 307 |
+
"p0": 49.5,
|
| 308 |
+
"p1": 54.0,
|
| 309 |
+
"p5": 80.4,
|
| 310 |
+
"p10": 91.79999935626984,
|
| 311 |
+
"p25": 129.0,
|
| 312 |
+
"p50": 153.60000228881836,
|
| 313 |
+
"p75": 169.60000252723694,
|
| 314 |
+
"p90": 181.22000107765197,
|
| 315 |
+
"p95": 203.52000589370724,
|
| 316 |
+
"p99": 301.97999999999985,
|
| 317 |
+
"p100": 358.5,
|
| 318 |
+
"mean": 150.75266745260782
|
| 319 |
+
},
|
| 320 |
+
"voxel_count_m": {
|
| 321 |
+
"n": 105,
|
| 322 |
+
"p0": 0.6358,
|
| 323 |
+
"p1": 0.88568352,
|
| 324 |
+
"p5": 1.1560308,
|
| 325 |
+
"p10": 1.353142,
|
| 326 |
+
"p25": 1.851564,
|
| 327 |
+
"p50": 5.113125,
|
| 328 |
+
"p75": 36.203328,
|
| 329 |
+
"p90": 41.514393600000005,
|
| 330 |
+
"p95": 44.4630016,
|
| 331 |
+
"p99": 47.63025407999999,
|
| 332 |
+
"p100": 48.106496,
|
| 333 |
+
"mean": 16.827736723809526
|
| 334 |
+
}
|
| 335 |
+
},
|
| 336 |
+
"abdomen_pelvis": {
|
| 337 |
+
"n": 100,
|
| 338 |
+
"shape_x": {
|
| 339 |
+
"n": 100,
|
| 340 |
+
"p0": 50.0,
|
| 341 |
+
"p1": 92.57,
|
| 342 |
+
"p5": 114.0,
|
| 343 |
+
"p10": 128.8,
|
| 344 |
+
"p25": 216.75,
|
| 345 |
+
"p50": 247.5,
|
| 346 |
+
"p75": 339.5,
|
| 347 |
+
"p90": 505.1,
|
| 348 |
+
"p95": 510.0,
|
| 349 |
+
"p99": 512.0,
|
| 350 |
+
"p100": 512.0,
|
| 351 |
+
"mean": 283.63
|
| 352 |
+
},
|
| 353 |
+
"shape_y": {
|
| 354 |
+
"n": 100,
|
| 355 |
+
"p0": 91.0,
|
| 356 |
+
"p1": 109.81,
|
| 357 |
+
"p5": 122.9,
|
| 358 |
+
"p10": 131.9,
|
| 359 |
+
"p25": 142.75,
|
| 360 |
+
"p50": 171.5,
|
| 361 |
+
"p75": 280.25,
|
| 362 |
+
"p90": 351.0000000000001,
|
| 363 |
+
"p95": 374.0,
|
| 364 |
+
"p99": 427.27000000000015,
|
| 365 |
+
"p100": 454.0,
|
| 366 |
+
"mean": 206.57
|
| 367 |
+
},
|
| 368 |
+
"shape_z": {
|
| 369 |
+
"n": 100,
|
| 370 |
+
"p0": 29.0,
|
| 371 |
+
"p1": 36.92,
|
| 372 |
+
"p5": 41.95,
|
| 373 |
+
"p10": 54.0,
|
| 374 |
+
"p25": 97.0,
|
| 375 |
+
"p50": 150.5,
|
| 376 |
+
"p75": 180.5,
|
| 377 |
+
"p90": 217.20000000000002,
|
| 378 |
+
"p95": 231.2,
|
| 379 |
+
"p99": 251.96000000000254,
|
| 380 |
+
"p100": 743.0,
|
| 381 |
+
"mean": 144.04
|
| 382 |
+
},
|
| 383 |
+
"spacing_x_mm": {
|
| 384 |
+
"n": 100,
|
| 385 |
+
"p0": 0.599609375,
|
| 386 |
+
"p1": 0.6554361116886139,
|
| 387 |
+
"p5": 0.703125,
|
| 388 |
+
"p10": 0.7882249772548675,
|
| 389 |
+
"p25": 0.9765620231628418,
|
| 390 |
+
"p50": 1.5,
|
| 391 |
+
"p75": 1.5,
|
| 392 |
+
"p90": 1.5,
|
| 393 |
+
"p95": 1.5,
|
| 394 |
+
"p99": 1.5000001192092896,
|
| 395 |
+
"p100": 1.5000001192092896,
|
| 396 |
+
"mean": 1.325766835808754
|
| 397 |
+
},
|
| 398 |
+
"spacing_y_mm": {
|
| 399 |
+
"n": 100,
|
| 400 |
+
"p0": 0.599609375,
|
| 401 |
+
"p1": 0.6554361116886139,
|
| 402 |
+
"p5": 0.703125,
|
| 403 |
+
"p10": 0.7882249772548675,
|
| 404 |
+
"p25": 0.9765620231628418,
|
| 405 |
+
"p50": 1.5,
|
| 406 |
+
"p75": 1.5,
|
| 407 |
+
"p90": 1.5,
|
| 408 |
+
"p95": 1.5,
|
| 409 |
+
"p99": 1.5000001192092896,
|
| 410 |
+
"p100": 1.5000001192092896,
|
| 411 |
+
"mean": 1.3257668393850326
|
| 412 |
+
},
|
| 413 |
+
"spacing_z_mm": {
|
| 414 |
+
"n": 100,
|
| 415 |
+
"p0": 0.5,
|
| 416 |
+
"p1": 0.7970000118017196,
|
| 417 |
+
"p5": 0.800000011920929,
|
| 418 |
+
"p10": 1.4749998927116394,
|
| 419 |
+
"p25": 1.5,
|
| 420 |
+
"p50": 1.5,
|
| 421 |
+
"p75": 1.5,
|
| 422 |
+
"p90": 5.0,
|
| 423 |
+
"p95": 5.0,
|
| 424 |
+
"p99": 5.0,
|
| 425 |
+
"p100": 5.0,
|
| 426 |
+
"mean": 1.9230000019073485
|
| 427 |
+
},
|
| 428 |
+
"phys_x_mm": {
|
| 429 |
+
"n": 100,
|
| 430 |
+
"p0": 75.0,
|
| 431 |
+
"p1": 138.855,
|
| 432 |
+
"p5": 170.925,
|
| 433 |
+
"p10": 190.35,
|
| 434 |
+
"p25": 324.0,
|
| 435 |
+
"p50": 357.00001418590546,
|
| 436 |
+
"p75": 395.36127984523773,
|
| 437 |
+
"p90": 430.46654695272446,
|
| 438 |
+
"p95": 459.525,
|
| 439 |
+
"p99": 493.19311855793,
|
| 440 |
+
"p100": 496.09350776672363,
|
| 441 |
+
"mean": 343.67851422190665
|
| 442 |
+
},
|
| 443 |
+
"phys_y_mm": {
|
| 444 |
+
"n": 100,
|
| 445 |
+
"p0": 136.5,
|
| 446 |
+
"p1": 164.715,
|
| 447 |
+
"p5": 184.3500146508217,
|
| 448 |
+
"p10": 196.34998594522477,
|
| 449 |
+
"p25": 212.25,
|
| 450 |
+
"p50": 247.5,
|
| 451 |
+
"p75": 282.0078125,
|
| 452 |
+
"p90": 308.7935886383057,
|
| 453 |
+
"p95": 356.84788153171536,
|
| 454 |
+
"p99": 369.3940403079988,
|
| 455 |
+
"p100": 394.5,
|
| 456 |
+
"mean": 250.3036654114723
|
| 457 |
+
},
|
| 458 |
+
"phys_z_mm": {
|
| 459 |
+
"n": 100,
|
| 460 |
+
"p0": 87.0,
|
| 461 |
+
"p1": 104.82,
|
| 462 |
+
"p5": 120.0,
|
| 463 |
+
"p10": 139.80000187754632,
|
| 464 |
+
"p25": 164.625,
|
| 465 |
+
"p50": 223.5,
|
| 466 |
+
"p75": 268.5,
|
| 467 |
+
"p90": 303.0,
|
| 468 |
+
"p95": 340.575,
|
| 469 |
+
"p99": 372.88500000000073,
|
| 470 |
+
"p100": 510.0,
|
| 471 |
+
"mean": 222.0910002976656
|
| 472 |
+
},
|
| 473 |
+
"voxel_count_m": {
|
| 474 |
+
"n": 100,
|
| 475 |
+
"p0": 0.702429,
|
| 476 |
+
"p1": 0.81288429,
|
| 477 |
+
"p5": 1.778685,
|
| 478 |
+
"p10": 2.0183675,
|
| 479 |
+
"p25": 4.391208,
|
| 480 |
+
"p50": 5.8342515,
|
| 481 |
+
"p75": 8.87931225,
|
| 482 |
+
"p90": 18.4301856,
|
| 483 |
+
"p95": 36.44542439999998,
|
| 484 |
+
"p99": 50.84427834000002,
|
| 485 |
+
"p100": 54.56592,
|
| 486 |
+
"mean": 9.1297059
|
| 487 |
+
}
|
| 488 |
+
},
|
| 489 |
+
"chest_abdomen": {
|
| 490 |
+
"n": 2454,
|
| 491 |
+
"shape_x": {
|
| 492 |
+
"n": 2454,
|
| 493 |
+
"p0": 47.0,
|
| 494 |
+
"p1": 108.0,
|
| 495 |
+
"p5": 177.0,
|
| 496 |
+
"p10": 218.0,
|
| 497 |
+
"p25": 433.0,
|
| 498 |
+
"p50": 502.0,
|
| 499 |
+
"p75": 512.0,
|
| 500 |
+
"p90": 512.0,
|
| 501 |
+
"p95": 512.0,
|
| 502 |
+
"p99": 512.0,
|
| 503 |
+
"p100": 756.0,
|
| 504 |
+
"mean": 437.27832110839444
|
| 505 |
+
},
|
| 506 |
+
"shape_y": {
|
| 507 |
+
"n": 2454,
|
| 508 |
+
"p0": 48.0,
|
| 509 |
+
"p1": 112.53,
|
| 510 |
+
"p5": 146.0,
|
| 511 |
+
"p10": 170.0,
|
| 512 |
+
"p25": 306.25,
|
| 513 |
+
"p50": 366.0,
|
| 514 |
+
"p75": 408.0,
|
| 515 |
+
"p90": 438.0,
|
| 516 |
+
"p95": 457.0,
|
| 517 |
+
"p99": 497.9399999999996,
|
| 518 |
+
"p100": 512.0,
|
| 519 |
+
"mean": 339.98533007334964
|
| 520 |
+
},
|
| 521 |
+
"shape_z": {
|
| 522 |
+
"n": 2454,
|
| 523 |
+
"p0": 24.0,
|
| 524 |
+
"p1": 33.0,
|
| 525 |
+
"p5": 46.0,
|
| 526 |
+
"p10": 76.0,
|
| 527 |
+
"p25": 136.0,
|
| 528 |
+
"p50": 200.0,
|
| 529 |
+
"p75": 223.0,
|
| 530 |
+
"p90": 241.0,
|
| 531 |
+
"p95": 252.3499999999999,
|
| 532 |
+
"p99": 293.0,
|
| 533 |
+
"p100": 615.0,
|
| 534 |
+
"mean": 178.53056234718827
|
| 535 |
+
},
|
| 536 |
+
"spacing_x_mm": {
|
| 537 |
+
"n": 2454,
|
| 538 |
+
"p0": 0.4375,
|
| 539 |
+
"p1": 0.5859375,
|
| 540 |
+
"p5": 0.6243164479732514,
|
| 541 |
+
"p10": 0.6523439884185791,
|
| 542 |
+
"p25": 0.703125,
|
| 543 |
+
"p50": 0.78125,
|
| 544 |
+
"p75": 0.91015625,
|
| 545 |
+
"p90": 1.5,
|
| 546 |
+
"p95": 1.5,
|
| 547 |
+
"p99": 1.5,
|
| 548 |
+
"p100": 1.5000001192092896,
|
| 549 |
+
"mean": 0.8978438329045716
|
| 550 |
+
},
|
| 551 |
+
"spacing_y_mm": {
|
| 552 |
+
"n": 2454,
|
| 553 |
+
"p0": 0.4375,
|
| 554 |
+
"p1": 0.5859375,
|
| 555 |
+
"p5": 0.625,
|
| 556 |
+
"p10": 0.6523439884185791,
|
| 557 |
+
"p25": 0.703125,
|
| 558 |
+
"p50": 0.78125,
|
| 559 |
+
"p75": 0.9169921875,
|
| 560 |
+
"p90": 1.5,
|
| 561 |
+
"p95": 1.5,
|
| 562 |
+
"p99": 1.5,
|
| 563 |
+
"p100": 3.0,
|
| 564 |
+
"mean": 0.8997285417307657
|
| 565 |
+
},
|
| 566 |
+
"spacing_z_mm": {
|
| 567 |
+
"n": 2454,
|
| 568 |
+
"p0": 0.41847825050354004,
|
| 569 |
+
"p1": 0.5,
|
| 570 |
+
"p5": 0.7999999523162842,
|
| 571 |
+
"p10": 0.800000011920929,
|
| 572 |
+
"p25": 0.800000011920929,
|
| 573 |
+
"p50": 0.800000011920929,
|
| 574 |
+
"p75": 1.5,
|
| 575 |
+
"p90": 2.5,
|
| 576 |
+
"p95": 5.0,
|
| 577 |
+
"p99": 5.0,
|
| 578 |
+
"p100": 7.5,
|
| 579 |
+
"mean": 1.4092136955445824
|
| 580 |
+
},
|
| 581 |
+
"phys_x_mm": {
|
| 582 |
+
"n": 2454,
|
| 583 |
+
"p0": 70.5,
|
| 584 |
+
"p1": 146.29500000000002,
|
| 585 |
+
"p5": 226.5,
|
| 586 |
+
"p10": 300.0,
|
| 587 |
+
"p25": 334.61999237537384,
|
| 588 |
+
"p50": 364.5,
|
| 589 |
+
"p75": 396.875,
|
| 590 |
+
"p90": 420.0,
|
| 591 |
+
"p95": 446.9486328125,
|
| 592 |
+
"p99": 492.67007812499907,
|
| 593 |
+
"p100": 512.0,
|
| 594 |
+
"mean": 359.5424210512259
|
| 595 |
+
},
|
| 596 |
+
"phys_y_mm": {
|
| 597 |
+
"n": 2454,
|
| 598 |
+
"p0": 72.0,
|
| 599 |
+
"p1": 170.29500000000002,
|
| 600 |
+
"p5": 210.32998571395873,
|
| 601 |
+
"p10": 225.08422737121583,
|
| 602 |
+
"p25": 249.0,
|
| 603 |
+
"p50": 278.662109375,
|
| 604 |
+
"p75": 310.5,
|
| 605 |
+
"p90": 337.8390625000001,
|
| 606 |
+
"p95": 359.87685546874997,
|
| 607 |
+
"p99": 397.5,
|
| 608 |
+
"p100": 461.09765625,
|
| 609 |
+
"mean": 279.929130877167
|
| 610 |
+
},
|
| 611 |
+
"phys_z_mm": {
|
| 612 |
+
"n": 2454,
|
| 613 |
+
"p0": 46.5,
|
| 614 |
+
"p1": 90.0,
|
| 615 |
+
"p5": 126.4125,
|
| 616 |
+
"p10": 147.29000153541566,
|
| 617 |
+
"p25": 163.2000024318695,
|
| 618 |
+
"p50": 180.00000268220901,
|
| 619 |
+
"p75": 206.40000307559967,
|
| 620 |
+
"p90": 260.0,
|
| 621 |
+
"p95": 305.0,
|
| 622 |
+
"p99": 354.7049999999997,
|
| 623 |
+
"p100": 820.0,
|
| 624 |
+
"mean": 192.1801549274939
|
| 625 |
+
},
|
| 626 |
+
"voxel_count_m": {
|
| 627 |
+
"n": 2454,
|
| 628 |
+
"p0": 0.3792,
|
| 629 |
+
"p1": 1.29924567,
|
| 630 |
+
"p5": 3.15202185,
|
| 631 |
+
"p10": 5.0608155,
|
| 632 |
+
"p25": 9.625077,
|
| 633 |
+
"p50": 35.96288,
|
| 634 |
+
"p75": 43.9296,
|
| 635 |
+
"p90": 49.86544,
|
| 636 |
+
"p95": 53.1331584,
|
| 637 |
+
"p99": 59.72250186,
|
| 638 |
+
"p100": 98.694656,
|
| 639 |
+
"mean": 29.869590855745727
|
| 640 |
+
}
|
| 641 |
+
},
|
| 642 |
+
"chest_abdomen_pelvis": {
|
| 643 |
+
"n": 2624,
|
| 644 |
+
"shape_x": {
|
| 645 |
+
"n": 2624,
|
| 646 |
+
"p0": 51.0,
|
| 647 |
+
"p1": 121.0,
|
| 648 |
+
"p5": 218.0,
|
| 649 |
+
"p10": 235.0,
|
| 650 |
+
"p25": 420.0,
|
| 651 |
+
"p50": 488.0,
|
| 652 |
+
"p75": 512.0,
|
| 653 |
+
"p90": 512.0,
|
| 654 |
+
"p95": 512.0,
|
| 655 |
+
"p99": 512.0,
|
| 656 |
+
"p100": 703.0,
|
| 657 |
+
"mean": 434.0655487804878
|
| 658 |
+
},
|
| 659 |
+
"shape_y": {
|
| 660 |
+
"n": 2624,
|
| 661 |
+
"p0": 74.0,
|
| 662 |
+
"p1": 122.23,
|
| 663 |
+
"p5": 162.0,
|
| 664 |
+
"p10": 182.0,
|
| 665 |
+
"p25": 294.0,
|
| 666 |
+
"p50": 354.0,
|
| 667 |
+
"p75": 407.0,
|
| 668 |
+
"p90": 448.0,
|
| 669 |
+
"p95": 465.0,
|
| 670 |
+
"p99": 492.0,
|
| 671 |
+
"p100": 510.0,
|
| 672 |
+
"mean": 337.5510670731707
|
| 673 |
+
},
|
| 674 |
+
"shape_z": {
|
| 675 |
+
"n": 2624,
|
| 676 |
+
"p0": 24.0,
|
| 677 |
+
"p1": 37.0,
|
| 678 |
+
"p5": 49.0,
|
| 679 |
+
"p10": 75.0,
|
| 680 |
+
"p25": 114.0,
|
| 681 |
+
"p50": 153.0,
|
| 682 |
+
"p75": 206.0,
|
| 683 |
+
"p90": 293.0,
|
| 684 |
+
"p95": 363.0,
|
| 685 |
+
"p99": 557.0,
|
| 686 |
+
"p100": 765.0,
|
| 687 |
+
"mean": 170.60518292682926
|
| 688 |
+
},
|
| 689 |
+
"spacing_x_mm": {
|
| 690 |
+
"n": 2624,
|
| 691 |
+
"p0": 0.392578125,
|
| 692 |
+
"p1": 0.6219923710823059,
|
| 693 |
+
"p5": 0.6855469942092896,
|
| 694 |
+
"p10": 0.7167969942092896,
|
| 695 |
+
"p25": 0.78125,
|
| 696 |
+
"p50": 0.8547343611717224,
|
| 697 |
+
"p75": 0.9765620231628418,
|
| 698 |
+
"p90": 1.5,
|
| 699 |
+
"p95": 1.5,
|
| 700 |
+
"p99": 1.5,
|
| 701 |
+
"p100": 1.9999998807907104,
|
| 702 |
+
"mean": 0.9590327689969321
|
| 703 |
+
},
|
| 704 |
+
"spacing_y_mm": {
|
| 705 |
+
"n": 2624,
|
| 706 |
+
"p0": 0.392578125,
|
| 707 |
+
"p1": 0.6210939884185791,
|
| 708 |
+
"p5": 0.6855468928813935,
|
| 709 |
+
"p10": 0.7167969107627868,
|
| 710 |
+
"p25": 0.78125,
|
| 711 |
+
"p50": 0.8539999723434448,
|
| 712 |
+
"p75": 0.9765620231628418,
|
| 713 |
+
"p90": 1.5,
|
| 714 |
+
"p95": 1.5,
|
| 715 |
+
"p99": 1.5,
|
| 716 |
+
"p100": 1.500000238418579,
|
| 717 |
+
"mean": 0.9584938733634062
|
| 718 |
+
},
|
| 719 |
+
"spacing_z_mm": {
|
| 720 |
+
"n": 2624,
|
| 721 |
+
"p0": 0.3633037209510803,
|
| 722 |
+
"p1": 0.699999988079071,
|
| 723 |
+
"p5": 0.800000011920929,
|
| 724 |
+
"p10": 0.800000011920929,
|
| 725 |
+
"p25": 1.0,
|
| 726 |
+
"p50": 1.5,
|
| 727 |
+
"p75": 2.5,
|
| 728 |
+
"p90": 3.0,
|
| 729 |
+
"p95": 5.0,
|
| 730 |
+
"p99": 5.0,
|
| 731 |
+
"p100": 8.0,
|
| 732 |
+
"mean": 1.9986921644928615
|
| 733 |
+
},
|
| 734 |
+
"phys_x_mm": {
|
| 735 |
+
"n": 2624,
|
| 736 |
+
"p0": 76.5,
|
| 737 |
+
"p1": 164.19001000523568,
|
| 738 |
+
"p5": 311.96005816459655,
|
| 739 |
+
"p10": 331.5,
|
| 740 |
+
"p25": 359.21478724479675,
|
| 741 |
+
"p50": 390.9658203125,
|
| 742 |
+
"p75": 422.16944682598114,
|
| 743 |
+
"p90": 452.510889530182,
|
| 744 |
+
"p95": 471.97248722314833,
|
| 745 |
+
"p99": 500.0,
|
| 746 |
+
"p100": 512.0,
|
| 747 |
+
"mean": 388.0579667357137
|
| 748 |
+
},
|
| 749 |
+
"phys_y_mm": {
|
| 750 |
+
"n": 2624,
|
| 751 |
+
"p0": 110.99999117851257,
|
| 752 |
+
"p1": 183.00000334501266,
|
| 753 |
+
"p5": 225.0,
|
| 754 |
+
"p10": 239.69926495552062,
|
| 755 |
+
"p25": 264.28717017173767,
|
| 756 |
+
"p50": 294.44138383865356,
|
| 757 |
+
"p75": 341.2427870929241,
|
| 758 |
+
"p90": 375.164453125,
|
| 759 |
+
"p95": 390.21953125,
|
| 760 |
+
"p99": 413.98765625,
|
| 761 |
+
"p100": 499.5,
|
| 762 |
+
"mean": 301.5965458503584
|
| 763 |
+
},
|
| 764 |
+
"phys_z_mm": {
|
| 765 |
+
"n": 2624,
|
| 766 |
+
"p0": 55.5,
|
| 767 |
+
"p1": 113.13800038933753,
|
| 768 |
+
"p5": 144.0,
|
| 769 |
+
"p10": 171.2000025510788,
|
| 770 |
+
"p25": 207.875,
|
| 771 |
+
"p50": 252.0,
|
| 772 |
+
"p75": 337.5,
|
| 773 |
+
"p90": 390.0,
|
| 774 |
+
"p95": 390.0,
|
| 775 |
+
"p99": 440.0,
|
| 776 |
+
"p100": 720.0,
|
| 777 |
+
"mean": 265.3988541140925
|
| 778 |
+
},
|
| 779 |
+
"voxel_count_m": {
|
| 780 |
+
"n": 2624,
|
| 781 |
+
"p0": 0.581196,
|
| 782 |
+
"p1": 1.72530744,
|
| 783 |
+
"p5": 5.00293935,
|
| 784 |
+
"p10": 6.1949088,
|
| 785 |
+
"p25": 9.942108750000001,
|
| 786 |
+
"p50": 21.448124999999997,
|
| 787 |
+
"p75": 36.266239999999996,
|
| 788 |
+
"p90": 54.83162880000004,
|
| 789 |
+
"p95": 79.70905599999999,
|
| 790 |
+
"p99": 120.08488007999999,
|
| 791 |
+
"p100": 150.74304,
|
| 792 |
+
"mean": 27.927489581935976
|
| 793 |
+
}
|
| 794 |
+
},
|
| 795 |
+
"whole_body": {
|
| 796 |
+
"n": 4618,
|
| 797 |
+
"shape_x": {
|
| 798 |
+
"n": 4618,
|
| 799 |
+
"p0": 51.0,
|
| 800 |
+
"p1": 204.0,
|
| 801 |
+
"p5": 204.0,
|
| 802 |
+
"p10": 214.0,
|
| 803 |
+
"p25": 457.0,
|
| 804 |
+
"p50": 499.0,
|
| 805 |
+
"p75": 512.0,
|
| 806 |
+
"p90": 512.0,
|
| 807 |
+
"p95": 512.0,
|
| 808 |
+
"p99": 609.3199999999997,
|
| 809 |
+
"p100": 768.0,
|
| 810 |
+
"mean": 456.96210480727586
|
| 811 |
+
},
|
| 812 |
+
"shape_y": {
|
| 813 |
+
"n": 4618,
|
| 814 |
+
"p0": 49.0,
|
| 815 |
+
"p1": 158.17000000000002,
|
| 816 |
+
"p5": 244.85000000000002,
|
| 817 |
+
"p10": 279.0,
|
| 818 |
+
"p25": 319.0,
|
| 819 |
+
"p50": 364.0,
|
| 820 |
+
"p75": 400.0,
|
| 821 |
+
"p90": 432.0,
|
| 822 |
+
"p95": 453.0,
|
| 823 |
+
"p99": 493.8299999999999,
|
| 824 |
+
"p100": 547.0,
|
| 825 |
+
"mean": 356.8977912516241
|
| 826 |
+
},
|
| 827 |
+
"shape_z": {
|
| 828 |
+
"n": 4618,
|
| 829 |
+
"p0": 8.0,
|
| 830 |
+
"p1": 44.0,
|
| 831 |
+
"p5": 80.0,
|
| 832 |
+
"p10": 90.0,
|
| 833 |
+
"p25": 120.25,
|
| 834 |
+
"p50": 193.0,
|
| 835 |
+
"p75": 231.0,
|
| 836 |
+
"p90": 338.0,
|
| 837 |
+
"p95": 362.0,
|
| 838 |
+
"p99": 589.2999999999993,
|
| 839 |
+
"p100": 1060.0,
|
| 840 |
+
"mean": 196.4861411866609
|
| 841 |
+
},
|
| 842 |
+
"spacing_x_mm": {
|
| 843 |
+
"n": 4618,
|
| 844 |
+
"p0": 0.42317700386047363,
|
| 845 |
+
"p1": 0.5536067873239517,
|
| 846 |
+
"p5": 0.630859375,
|
| 847 |
+
"p10": 0.6640625,
|
| 848 |
+
"p25": 0.72265625,
|
| 849 |
+
"p50": 0.78125,
|
| 850 |
+
"p75": 0.91796875,
|
| 851 |
+
"p90": 1.0,
|
| 852 |
+
"p95": 1.0,
|
| 853 |
+
"p99": 1.5,
|
| 854 |
+
"p100": 2.5000038146972656,
|
| 855 |
+
"mean": 0.8272574568798966
|
| 856 |
+
},
|
| 857 |
+
"spacing_y_mm": {
|
| 858 |
+
"n": 4618,
|
| 859 |
+
"p0": 0.42317700386047363,
|
| 860 |
+
"p1": 0.5549088507890702,
|
| 861 |
+
"p5": 0.630859375,
|
| 862 |
+
"p10": 0.6640625,
|
| 863 |
+
"p25": 0.72265625,
|
| 864 |
+
"p50": 0.78125,
|
| 865 |
+
"p75": 0.919921875,
|
| 866 |
+
"p90": 1.0,
|
| 867 |
+
"p95": 1.0,
|
| 868 |
+
"p99": 1.5,
|
| 869 |
+
"p100": 5.0,
|
| 870 |
+
"mean": 0.8354297056890969
|
| 871 |
+
},
|
| 872 |
+
"spacing_z_mm": {
|
| 873 |
+
"n": 4618,
|
| 874 |
+
"p0": 0.3995785117149353,
|
| 875 |
+
"p1": 0.57296875,
|
| 876 |
+
"p5": 0.800000011920929,
|
| 877 |
+
"p10": 0.800000011920929,
|
| 878 |
+
"p25": 0.800000011920929,
|
| 879 |
+
"p50": 1.25,
|
| 880 |
+
"p75": 3.0,
|
| 881 |
+
"p90": 5.0,
|
| 882 |
+
"p95": 5.0,
|
| 883 |
+
"p99": 5.0,
|
| 884 |
+
"p100": 10.0,
|
| 885 |
+
"mean": 2.1095213813924234
|
| 886 |
+
},
|
| 887 |
+
"phys_x_mm": {
|
| 888 |
+
"n": 4618,
|
| 889 |
+
"p0": 76.5,
|
| 890 |
+
"p1": 138.65625,
|
| 891 |
+
"p5": 160.0752939105034,
|
| 892 |
+
"p10": 279.38640136718755,
|
| 893 |
+
"p25": 342.0,
|
| 894 |
+
"p50": 377.27053755521774,
|
| 895 |
+
"p75": 418.0322718024254,
|
| 896 |
+
"p90": 485.0,
|
| 897 |
+
"p95": 510.0,
|
| 898 |
+
"p99": 512.0,
|
| 899 |
+
"p100": 641.2111611366272,
|
| 900 |
+
"mean": 371.9616504671474
|
| 901 |
+
},
|
| 902 |
+
"phys_y_mm": {
|
| 903 |
+
"n": 4618,
|
| 904 |
+
"p0": 132.8125,
|
| 905 |
+
"p1": 194.401271238327,
|
| 906 |
+
"p5": 219.10370013415815,
|
| 907 |
+
"p10": 231.5455386042595,
|
| 908 |
+
"p25": 257.0581171810627,
|
| 909 |
+
"p50": 286.5234375,
|
| 910 |
+
"p75": 317.0,
|
| 911 |
+
"p90": 348.6326933383942,
|
| 912 |
+
"p95": 371.57793331146235,
|
| 913 |
+
"p99": 412.51994140625,
|
| 914 |
+
"p100": 498.0466318130493,
|
| 915 |
+
"mean": 288.76436472084293
|
| 916 |
+
},
|
| 917 |
+
"phys_z_mm": {
|
| 918 |
+
"n": 4618,
|
| 919 |
+
"p0": 6.400000095367432,
|
| 920 |
+
"p1": 111.89624967575074,
|
| 921 |
+
"p5": 149.60000222921371,
|
| 922 |
+
"p10": 160.0000023841858,
|
| 923 |
+
"p25": 180.80000269412994,
|
| 924 |
+
"p50": 272.5,
|
| 925 |
+
"p75": 442.5,
|
| 926 |
+
"p90": 529.6500000000001,
|
| 927 |
+
"p95": 642.0749999999998,
|
| 928 |
+
"p99": 737.4899999999998,
|
| 929 |
+
"p100": 1416.0,
|
| 930 |
+
"mean": 320.42649326422816
|
| 931 |
+
},
|
| 932 |
+
"voxel_count_m": {
|
| 933 |
+
"n": 4618,
|
| 934 |
+
"p0": 0.509878,
|
| 935 |
+
"p1": 3.49021356,
|
| 936 |
+
"p5": 7.2778326,
|
| 937 |
+
"p10": 10.878708,
|
| 938 |
+
"p25": 18.20935,
|
| 939 |
+
"p50": 31.630336,
|
| 940 |
+
"p75": 45.031296,
|
| 941 |
+
"p90": 52.526846400000004,
|
| 942 |
+
"p95": 57.1898992,
|
| 943 |
+
"p99": 68.25358278999997,
|
| 944 |
+
"p100": 240.28928,
|
| 945 |
+
"mean": 32.11065596578606
|
| 946 |
+
}
|
| 947 |
+
}
|
| 948 |
+
},
|
| 949 |
+
"bucket_summary": {
|
| 950 |
+
"B-CA": {
|
| 951 |
+
"n": 2454,
|
| 952 |
+
"fov_counts": {
|
| 953 |
+
"chest_abdomen": 2454
|
| 954 |
+
},
|
| 955 |
+
"crop_any_pct": 7.008964955175224,
|
| 956 |
+
"crop_x_pct": 0.0,
|
| 957 |
+
"crop_y_pct": 0.0,
|
| 958 |
+
"crop_z_pct": 7.008964955175224,
|
| 959 |
+
"phys_z_mm": {
|
| 960 |
+
"n": 2454,
|
| 961 |
+
"p0": 46.5,
|
| 962 |
+
"p1": 90.0,
|
| 963 |
+
"p5": 126.4125,
|
| 964 |
+
"p10": 147.29000153541566,
|
| 965 |
+
"p25": 163.2000024318695,
|
| 966 |
+
"p50": 180.00000268220901,
|
| 967 |
+
"p75": 206.40000307559967,
|
| 968 |
+
"p90": 260.0,
|
| 969 |
+
"p95": 305.0,
|
| 970 |
+
"p99": 354.7049999999997,
|
| 971 |
+
"p100": 820.0,
|
| 972 |
+
"mean": 192.1801549274939
|
| 973 |
+
},
|
| 974 |
+
"phys_y_mm": {
|
| 975 |
+
"n": 2454,
|
| 976 |
+
"p0": 72.0,
|
| 977 |
+
"p1": 170.29500000000002,
|
| 978 |
+
"p5": 210.32998571395873,
|
| 979 |
+
"p10": 225.08422737121583,
|
| 980 |
+
"p25": 249.0,
|
| 981 |
+
"p50": 278.662109375,
|
| 982 |
+
"p75": 310.5,
|
| 983 |
+
"p90": 337.8390625000001,
|
| 984 |
+
"p95": 359.87685546874997,
|
| 985 |
+
"p99": 397.5,
|
| 986 |
+
"p100": 461.09765625,
|
| 987 |
+
"mean": 279.929130877167
|
| 988 |
+
},
|
| 989 |
+
"phys_x_mm": {
|
| 990 |
+
"n": 2454,
|
| 991 |
+
"p0": 70.5,
|
| 992 |
+
"p1": 146.29500000000002,
|
| 993 |
+
"p5": 226.5,
|
| 994 |
+
"p10": 300.0,
|
| 995 |
+
"p25": 334.61999237537384,
|
| 996 |
+
"p50": 364.5,
|
| 997 |
+
"p75": 396.875,
|
| 998 |
+
"p90": 420.0,
|
| 999 |
+
"p95": 446.9486328125,
|
| 1000 |
+
"p99": 492.67007812499907,
|
| 1001 |
+
"p100": 512.0,
|
| 1002 |
+
"mean": 359.5424210512259
|
| 1003 |
+
},
|
| 1004 |
+
"resampled_z_vox_at_bucket_sp": {
|
| 1005 |
+
"n": 2454,
|
| 1006 |
+
"p0": 13.285714285714286,
|
| 1007 |
+
"p1": 25.714285714285715,
|
| 1008 |
+
"p5": 36.11785714285715,
|
| 1009 |
+
"p10": 42.08285758154733,
|
| 1010 |
+
"p25": 46.62857212339129,
|
| 1011 |
+
"p50": 51.42857219491686,
|
| 1012 |
+
"p75": 58.971429450171335,
|
| 1013 |
+
"p90": 74.28571428571429,
|
| 1014 |
+
"p95": 87.14285714285714,
|
| 1015 |
+
"p99": 101.34428571428562,
|
| 1016 |
+
"p100": 234.28571428571428,
|
| 1017 |
+
"mean": 54.908615693569686
|
| 1018 |
+
},
|
| 1019 |
+
"resampled_y_vox_at_bucket_sp": {
|
| 1020 |
+
"n": 2454,
|
| 1021 |
+
"p0": 36.0,
|
| 1022 |
+
"p1": 85.14750000000001,
|
| 1023 |
+
"p5": 105.16499285697937,
|
| 1024 |
+
"p10": 112.54211368560792,
|
| 1025 |
+
"p25": 124.5,
|
| 1026 |
+
"p50": 139.3310546875,
|
| 1027 |
+
"p75": 155.25,
|
| 1028 |
+
"p90": 168.91953125000006,
|
| 1029 |
+
"p95": 179.93842773437498,
|
| 1030 |
+
"p99": 198.75,
|
| 1031 |
+
"p100": 230.548828125,
|
| 1032 |
+
"mean": 139.9645654385835
|
| 1033 |
+
},
|
| 1034 |
+
"resampled_x_vox_at_bucket_sp": {
|
| 1035 |
+
"n": 2454,
|
| 1036 |
+
"p0": 35.25,
|
| 1037 |
+
"p1": 73.14750000000001,
|
| 1038 |
+
"p5": 113.25,
|
| 1039 |
+
"p10": 150.0,
|
| 1040 |
+
"p25": 167.30999618768692,
|
| 1041 |
+
"p50": 182.25,
|
| 1042 |
+
"p75": 198.4375,
|
| 1043 |
+
"p90": 210.0,
|
| 1044 |
+
"p95": 223.47431640625,
|
| 1045 |
+
"p99": 246.33503906249953,
|
| 1046 |
+
"p100": 256.0,
|
| 1047 |
+
"mean": 179.77121052561296
|
| 1048 |
+
}
|
| 1049 |
+
},
|
| 1050 |
+
"B-CAP": {
|
| 1051 |
+
"n": 2624,
|
| 1052 |
+
"fov_counts": {
|
| 1053 |
+
"chest_abdomen_pelvis": 2624
|
| 1054 |
+
},
|
| 1055 |
+
"crop_any_pct": 12.233231707317072,
|
| 1056 |
+
"crop_x_pct": 0.0,
|
| 1057 |
+
"crop_y_pct": 0.0,
|
| 1058 |
+
"crop_z_pct": 12.233231707317072,
|
| 1059 |
+
"phys_z_mm": {
|
| 1060 |
+
"n": 2624,
|
| 1061 |
+
"p0": 55.5,
|
| 1062 |
+
"p1": 113.13800038933753,
|
| 1063 |
+
"p5": 144.0,
|
| 1064 |
+
"p10": 171.2000025510788,
|
| 1065 |
+
"p25": 207.875,
|
| 1066 |
+
"p50": 252.0,
|
| 1067 |
+
"p75": 337.5,
|
| 1068 |
+
"p90": 390.0,
|
| 1069 |
+
"p95": 390.0,
|
| 1070 |
+
"p99": 440.0,
|
| 1071 |
+
"p100": 720.0,
|
| 1072 |
+
"mean": 265.3988541140925
|
| 1073 |
+
},
|
| 1074 |
+
"phys_y_mm": {
|
| 1075 |
+
"n": 2624,
|
| 1076 |
+
"p0": 110.99999117851257,
|
| 1077 |
+
"p1": 183.00000334501266,
|
| 1078 |
+
"p5": 225.0,
|
| 1079 |
+
"p10": 239.69926495552062,
|
| 1080 |
+
"p25": 264.28717017173767,
|
| 1081 |
+
"p50": 294.44138383865356,
|
| 1082 |
+
"p75": 341.2427870929241,
|
| 1083 |
+
"p90": 375.164453125,
|
| 1084 |
+
"p95": 390.21953125,
|
| 1085 |
+
"p99": 413.98765625,
|
| 1086 |
+
"p100": 499.5,
|
| 1087 |
+
"mean": 301.5965458503584
|
| 1088 |
+
},
|
| 1089 |
+
"phys_x_mm": {
|
| 1090 |
+
"n": 2624,
|
| 1091 |
+
"p0": 76.5,
|
| 1092 |
+
"p1": 164.19001000523568,
|
| 1093 |
+
"p5": 311.96005816459655,
|
| 1094 |
+
"p10": 331.5,
|
| 1095 |
+
"p25": 359.21478724479675,
|
| 1096 |
+
"p50": 390.9658203125,
|
| 1097 |
+
"p75": 422.16944682598114,
|
| 1098 |
+
"p90": 452.510889530182,
|
| 1099 |
+
"p95": 471.97248722314833,
|
| 1100 |
+
"p99": 500.0,
|
| 1101 |
+
"p100": 512.0,
|
| 1102 |
+
"mean": 388.0579667357137
|
| 1103 |
+
},
|
| 1104 |
+
"resampled_z_vox_at_bucket_sp": {
|
| 1105 |
+
"n": 2624,
|
| 1106 |
+
"p0": 13.875,
|
| 1107 |
+
"p1": 28.284500097334384,
|
| 1108 |
+
"p5": 36.0,
|
| 1109 |
+
"p10": 42.8000006377697,
|
| 1110 |
+
"p25": 51.96875,
|
| 1111 |
+
"p50": 63.0,
|
| 1112 |
+
"p75": 84.375,
|
| 1113 |
+
"p90": 97.5,
|
| 1114 |
+
"p95": 97.5,
|
| 1115 |
+
"p99": 110.0,
|
| 1116 |
+
"p100": 180.0,
|
| 1117 |
+
"mean": 66.34971352852313
|
| 1118 |
+
},
|
| 1119 |
+
"resampled_y_vox_at_bucket_sp": {
|
| 1120 |
+
"n": 2624,
|
| 1121 |
+
"p0": 55.49999558925629,
|
| 1122 |
+
"p1": 91.50000167250633,
|
| 1123 |
+
"p5": 112.5,
|
| 1124 |
+
"p10": 119.84963247776031,
|
| 1125 |
+
"p25": 132.14358508586884,
|
| 1126 |
+
"p50": 147.22069191932678,
|
| 1127 |
+
"p75": 170.62139354646206,
|
| 1128 |
+
"p90": 187.5822265625,
|
| 1129 |
+
"p95": 195.109765625,
|
| 1130 |
+
"p99": 206.993828125,
|
| 1131 |
+
"p100": 249.75,
|
| 1132 |
+
"mean": 150.7982729251792
|
| 1133 |
+
},
|
| 1134 |
+
"resampled_x_vox_at_bucket_sp": {
|
| 1135 |
+
"n": 2624,
|
| 1136 |
+
"p0": 38.25,
|
| 1137 |
+
"p1": 82.09500500261784,
|
| 1138 |
+
"p5": 155.98002908229827,
|
| 1139 |
+
"p10": 165.75,
|
| 1140 |
+
"p25": 179.60739362239838,
|
| 1141 |
+
"p50": 195.48291015625,
|
| 1142 |
+
"p75": 211.08472341299057,
|
| 1143 |
+
"p90": 226.255444765091,
|
| 1144 |
+
"p95": 235.98624361157417,
|
| 1145 |
+
"p99": 250.0,
|
| 1146 |
+
"p100": 256.0,
|
| 1147 |
+
"mean": 194.02898336785685
|
| 1148 |
+
}
|
| 1149 |
+
},
|
| 1150 |
+
"B-abd": {
|
| 1151 |
+
"n": 105,
|
| 1152 |
+
"fov_counts": {
|
| 1153 |
+
"abdomen_only": 105
|
| 1154 |
+
},
|
| 1155 |
+
"crop_any_pct": 6.666666666666667,
|
| 1156 |
+
"crop_x_pct": 0.0,
|
| 1157 |
+
"crop_y_pct": 0.0,
|
| 1158 |
+
"crop_z_pct": 6.666666666666667,
|
| 1159 |
+
"phys_z_mm": {
|
| 1160 |
+
"n": 105,
|
| 1161 |
+
"p0": 49.5,
|
| 1162 |
+
"p1": 54.0,
|
| 1163 |
+
"p5": 80.4,
|
| 1164 |
+
"p10": 91.79999935626984,
|
| 1165 |
+
"p25": 129.0,
|
| 1166 |
+
"p50": 153.60000228881836,
|
| 1167 |
+
"p75": 169.60000252723694,
|
| 1168 |
+
"p90": 181.22000107765197,
|
| 1169 |
+
"p95": 203.52000589370724,
|
| 1170 |
+
"p99": 301.97999999999985,
|
| 1171 |
+
"p100": 358.5,
|
| 1172 |
+
"mean": 150.75266745260782
|
| 1173 |
+
},
|
| 1174 |
+
"phys_y_mm": {
|
| 1175 |
+
"n": 105,
|
| 1176 |
+
"p0": 133.50001060962677,
|
| 1177 |
+
"p1": 141.6599892425537,
|
| 1178 |
+
"p5": 166.8,
|
| 1179 |
+
"p10": 186.6,
|
| 1180 |
+
"p25": 214.5,
|
| 1181 |
+
"p50": 243.90625,
|
| 1182 |
+
"p75": 273.515625,
|
| 1183 |
+
"p90": 319.5851562500001,
|
| 1184 |
+
"p95": 337.5,
|
| 1185 |
+
"p99": 369.074826965332,
|
| 1186 |
+
"p100": 370.5,
|
| 1187 |
+
"mean": 247.92654960155488
|
| 1188 |
+
},
|
| 1189 |
+
"phys_x_mm": {
|
| 1190 |
+
"n": 105,
|
| 1191 |
+
"p0": 111.5625,
|
| 1192 |
+
"p1": 127.92,
|
| 1193 |
+
"p5": 155.1,
|
| 1194 |
+
"p10": 173.11404790878296,
|
| 1195 |
+
"p25": 196.5,
|
| 1196 |
+
"p50": 325.5,
|
| 1197 |
+
"p75": 360.0,
|
| 1198 |
+
"p90": 386.21015625,
|
| 1199 |
+
"p95": 399.84375,
|
| 1200 |
+
"p99": 431.82,
|
| 1201 |
+
"p100": 480.0,
|
| 1202 |
+
"mean": 292.9369931096122
|
| 1203 |
+
},
|
| 1204 |
+
"resampled_z_vox_at_bucket_sp": {
|
| 1205 |
+
"n": 105,
|
| 1206 |
+
"p0": 16.5,
|
| 1207 |
+
"p1": 18.0,
|
| 1208 |
+
"p5": 26.8,
|
| 1209 |
+
"p10": 30.59999978542328,
|
| 1210 |
+
"p25": 43.0,
|
| 1211 |
+
"p50": 51.20000076293945,
|
| 1212 |
+
"p75": 56.533334175745644,
|
| 1213 |
+
"p90": 60.406667025884,
|
| 1214 |
+
"p95": 67.84000196456908,
|
| 1215 |
+
"p99": 100.65999999999994,
|
| 1216 |
+
"p100": 119.5,
|
| 1217 |
+
"mean": 50.25088915086928
|
| 1218 |
+
},
|
| 1219 |
+
"resampled_y_vox_at_bucket_sp": {
|
| 1220 |
+
"n": 105,
|
| 1221 |
+
"p0": 66.75000530481339,
|
| 1222 |
+
"p1": 70.82999462127685,
|
| 1223 |
+
"p5": 83.4,
|
| 1224 |
+
"p10": 93.3,
|
| 1225 |
+
"p25": 107.25,
|
| 1226 |
+
"p50": 121.953125,
|
| 1227 |
+
"p75": 136.7578125,
|
| 1228 |
+
"p90": 159.79257812500006,
|
| 1229 |
+
"p95": 168.75,
|
| 1230 |
+
"p99": 184.537413482666,
|
| 1231 |
+
"p100": 185.25,
|
| 1232 |
+
"mean": 123.96327480077744
|
| 1233 |
+
},
|
| 1234 |
+
"resampled_x_vox_at_bucket_sp": {
|
| 1235 |
+
"n": 105,
|
| 1236 |
+
"p0": 55.78125,
|
| 1237 |
+
"p1": 63.96,
|
| 1238 |
+
"p5": 77.55,
|
| 1239 |
+
"p10": 86.55702395439148,
|
| 1240 |
+
"p25": 98.25,
|
| 1241 |
+
"p50": 162.75,
|
| 1242 |
+
"p75": 180.0,
|
| 1243 |
+
"p90": 193.105078125,
|
| 1244 |
+
"p95": 199.921875,
|
| 1245 |
+
"p99": 215.91,
|
| 1246 |
+
"p100": 240.0,
|
| 1247 |
+
"mean": 146.4684965548061
|
| 1248 |
+
}
|
| 1249 |
+
},
|
| 1250 |
+
"B-abd-pelvis": {
|
| 1251 |
+
"n": 100,
|
| 1252 |
+
"fov_counts": {
|
| 1253 |
+
"abdomen_pelvis": 100
|
| 1254 |
+
},
|
| 1255 |
+
"crop_any_pct": 60.0,
|
| 1256 |
+
"crop_x_pct": 0.0,
|
| 1257 |
+
"crop_y_pct": 0.0,
|
| 1258 |
+
"crop_z_pct": 60.0,
|
| 1259 |
+
"phys_z_mm": {
|
| 1260 |
+
"n": 100,
|
| 1261 |
+
"p0": 87.0,
|
| 1262 |
+
"p1": 104.82,
|
| 1263 |
+
"p5": 120.0,
|
| 1264 |
+
"p10": 139.80000187754632,
|
| 1265 |
+
"p25": 164.625,
|
| 1266 |
+
"p50": 223.5,
|
| 1267 |
+
"p75": 268.5,
|
| 1268 |
+
"p90": 303.0,
|
| 1269 |
+
"p95": 340.575,
|
| 1270 |
+
"p99": 372.88500000000073,
|
| 1271 |
+
"p100": 510.0,
|
| 1272 |
+
"mean": 222.0910002976656
|
| 1273 |
+
},
|
| 1274 |
+
"phys_y_mm": {
|
| 1275 |
+
"n": 100,
|
| 1276 |
+
"p0": 136.5,
|
| 1277 |
+
"p1": 164.715,
|
| 1278 |
+
"p5": 184.3500146508217,
|
| 1279 |
+
"p10": 196.34998594522477,
|
| 1280 |
+
"p25": 212.25,
|
| 1281 |
+
"p50": 247.5,
|
| 1282 |
+
"p75": 282.0078125,
|
| 1283 |
+
"p90": 308.7935886383057,
|
| 1284 |
+
"p95": 356.84788153171536,
|
| 1285 |
+
"p99": 369.3940403079988,
|
| 1286 |
+
"p100": 394.5,
|
| 1287 |
+
"mean": 250.3036654114723
|
| 1288 |
+
},
|
| 1289 |
+
"phys_x_mm": {
|
| 1290 |
+
"n": 100,
|
| 1291 |
+
"p0": 75.0,
|
| 1292 |
+
"p1": 138.855,
|
| 1293 |
+
"p5": 170.925,
|
| 1294 |
+
"p10": 190.35,
|
| 1295 |
+
"p25": 324.0,
|
| 1296 |
+
"p50": 357.00001418590546,
|
| 1297 |
+
"p75": 395.36127984523773,
|
| 1298 |
+
"p90": 430.46654695272446,
|
| 1299 |
+
"p95": 459.525,
|
| 1300 |
+
"p99": 493.19311855793,
|
| 1301 |
+
"p100": 496.09350776672363,
|
| 1302 |
+
"mean": 343.67851422190665
|
| 1303 |
+
},
|
| 1304 |
+
"resampled_z_vox_at_bucket_sp": {
|
| 1305 |
+
"n": 100,
|
| 1306 |
+
"p0": 29.0,
|
| 1307 |
+
"p1": 34.94,
|
| 1308 |
+
"p5": 40.0,
|
| 1309 |
+
"p10": 46.60000062584877,
|
| 1310 |
+
"p25": 54.875,
|
| 1311 |
+
"p50": 74.5,
|
| 1312 |
+
"p75": 89.5,
|
| 1313 |
+
"p90": 101.0,
|
| 1314 |
+
"p95": 113.525,
|
| 1315 |
+
"p99": 124.29500000000023,
|
| 1316 |
+
"p100": 170.0,
|
| 1317 |
+
"mean": 74.0303334325552
|
| 1318 |
+
},
|
| 1319 |
+
"resampled_y_vox_at_bucket_sp": {
|
| 1320 |
+
"n": 100,
|
| 1321 |
+
"p0": 68.25,
|
| 1322 |
+
"p1": 82.3575,
|
| 1323 |
+
"p5": 92.17500732541085,
|
| 1324 |
+
"p10": 98.17499297261239,
|
| 1325 |
+
"p25": 106.125,
|
| 1326 |
+
"p50": 123.75,
|
| 1327 |
+
"p75": 141.00390625,
|
| 1328 |
+
"p90": 154.39679431915286,
|
| 1329 |
+
"p95": 178.42394076585768,
|
| 1330 |
+
"p99": 184.6970201539994,
|
| 1331 |
+
"p100": 197.25,
|
| 1332 |
+
"mean": 125.15183270573615
|
| 1333 |
+
},
|
| 1334 |
+
"resampled_x_vox_at_bucket_sp": {
|
| 1335 |
+
"n": 100,
|
| 1336 |
+
"p0": 37.5,
|
| 1337 |
+
"p1": 69.4275,
|
| 1338 |
+
"p5": 85.4625,
|
| 1339 |
+
"p10": 95.175,
|
| 1340 |
+
"p25": 162.0,
|
| 1341 |
+
"p50": 178.50000709295273,
|
| 1342 |
+
"p75": 197.68063992261887,
|
| 1343 |
+
"p90": 215.23327347636223,
|
| 1344 |
+
"p95": 229.7625,
|
| 1345 |
+
"p99": 246.596559278965,
|
| 1346 |
+
"p100": 248.04675388336182,
|
| 1347 |
+
"mean": 171.83925711095333
|
| 1348 |
+
}
|
| 1349 |
+
},
|
| 1350 |
+
"B-whole": {
|
| 1351 |
+
"n": 4618,
|
| 1352 |
+
"fov_counts": {
|
| 1353 |
+
"whole_body": 4618
|
| 1354 |
+
},
|
| 1355 |
+
"crop_any_pct": 5.110437418796016,
|
| 1356 |
+
"crop_x_pct": 0.17323516673884798,
|
| 1357 |
+
"crop_y_pct": 0.0,
|
| 1358 |
+
"crop_z_pct": 5.08878302295366,
|
| 1359 |
+
"phys_z_mm": {
|
| 1360 |
+
"n": 4618,
|
| 1361 |
+
"p0": 6.400000095367432,
|
| 1362 |
+
"p1": 111.89624967575074,
|
| 1363 |
+
"p5": 149.60000222921371,
|
| 1364 |
+
"p10": 160.0000023841858,
|
| 1365 |
+
"p25": 180.80000269412994,
|
| 1366 |
+
"p50": 272.5,
|
| 1367 |
+
"p75": 442.5,
|
| 1368 |
+
"p90": 529.6500000000001,
|
| 1369 |
+
"p95": 642.0749999999998,
|
| 1370 |
+
"p99": 737.4899999999998,
|
| 1371 |
+
"p100": 1416.0,
|
| 1372 |
+
"mean": 320.42649326422816
|
| 1373 |
+
},
|
| 1374 |
+
"phys_y_mm": {
|
| 1375 |
+
"n": 4618,
|
| 1376 |
+
"p0": 132.8125,
|
| 1377 |
+
"p1": 194.401271238327,
|
| 1378 |
+
"p5": 219.10370013415815,
|
| 1379 |
+
"p10": 231.5455386042595,
|
| 1380 |
+
"p25": 257.0581171810627,
|
| 1381 |
+
"p50": 286.5234375,
|
| 1382 |
+
"p75": 317.0,
|
| 1383 |
+
"p90": 348.6326933383942,
|
| 1384 |
+
"p95": 371.57793331146235,
|
| 1385 |
+
"p99": 412.51994140625,
|
| 1386 |
+
"p100": 498.0466318130493,
|
| 1387 |
+
"mean": 288.76436472084293
|
| 1388 |
+
},
|
| 1389 |
+
"phys_x_mm": {
|
| 1390 |
+
"n": 4618,
|
| 1391 |
+
"p0": 76.5,
|
| 1392 |
+
"p1": 138.65625,
|
| 1393 |
+
"p5": 160.0752939105034,
|
| 1394 |
+
"p10": 279.38640136718755,
|
| 1395 |
+
"p25": 342.0,
|
| 1396 |
+
"p50": 377.27053755521774,
|
| 1397 |
+
"p75": 418.0322718024254,
|
| 1398 |
+
"p90": 485.0,
|
| 1399 |
+
"p95": 510.0,
|
| 1400 |
+
"p99": 512.0,
|
| 1401 |
+
"p100": 641.2111611366272,
|
| 1402 |
+
"mean": 371.9616504671474
|
| 1403 |
+
},
|
| 1404 |
+
"resampled_z_vox_at_bucket_sp": {
|
| 1405 |
+
"n": 4618,
|
| 1406 |
+
"p0": 1.2800000190734864,
|
| 1407 |
+
"p1": 22.379249935150145,
|
| 1408 |
+
"p5": 29.920000445842742,
|
| 1409 |
+
"p10": 32.00000047683716,
|
| 1410 |
+
"p25": 36.16000053882599,
|
| 1411 |
+
"p50": 54.5,
|
| 1412 |
+
"p75": 88.5,
|
| 1413 |
+
"p90": 105.93000000000002,
|
| 1414 |
+
"p95": 128.41499999999996,
|
| 1415 |
+
"p99": 147.49799999999996,
|
| 1416 |
+
"p100": 283.2,
|
| 1417 |
+
"mean": 64.08529865284561
|
| 1418 |
+
},
|
| 1419 |
+
"resampled_y_vox_at_bucket_sp": {
|
| 1420 |
+
"n": 4618,
|
| 1421 |
+
"p0": 66.40625,
|
| 1422 |
+
"p1": 97.2006356191635,
|
| 1423 |
+
"p5": 109.55185006707907,
|
| 1424 |
+
"p10": 115.77276930212975,
|
| 1425 |
+
"p25": 128.52905859053135,
|
| 1426 |
+
"p50": 143.26171875,
|
| 1427 |
+
"p75": 158.5,
|
| 1428 |
+
"p90": 174.3163466691971,
|
| 1429 |
+
"p95": 185.78896665573117,
|
| 1430 |
+
"p99": 206.259970703125,
|
| 1431 |
+
"p100": 249.02331590652466,
|
| 1432 |
+
"mean": 144.38218236042147
|
| 1433 |
+
},
|
| 1434 |
+
"resampled_x_vox_at_bucket_sp": {
|
| 1435 |
+
"n": 4618,
|
| 1436 |
+
"p0": 38.25,
|
| 1437 |
+
"p1": 69.328125,
|
| 1438 |
+
"p5": 80.0376469552517,
|
| 1439 |
+
"p10": 139.69320068359377,
|
| 1440 |
+
"p25": 171.0,
|
| 1441 |
+
"p50": 188.63526877760887,
|
| 1442 |
+
"p75": 209.0161359012127,
|
| 1443 |
+
"p90": 242.5,
|
| 1444 |
+
"p95": 255.0,
|
| 1445 |
+
"p99": 256.0,
|
| 1446 |
+
"p100": 320.6055805683136,
|
| 1447 |
+
"mean": 185.9808252335737
|
| 1448 |
+
}
|
| 1449 |
+
}
|
| 1450 |
+
},
|
| 1451 |
+
"pancreas_bbox_summary": {
|
| 1452 |
+
"n_with_bbox": 9442,
|
| 1453 |
+
"bbox_x_mm": {
|
| 1454 |
+
"n": 9442,
|
| 1455 |
+
"p0": 0.0,
|
| 1456 |
+
"p1": 31.5,
|
| 1457 |
+
"p5": 66.6565435230732,
|
| 1458 |
+
"p10": 89.3041875064373,
|
| 1459 |
+
"p25": 114.75,
|
| 1460 |
+
"p50": 133.0458984375,
|
| 1461 |
+
"p75": 149.0625,
|
| 1462 |
+
"p90": 164.93515624999998,
|
| 1463 |
+
"p95": 175.78124570846558,
|
| 1464 |
+
"p99": 199.0,
|
| 1465 |
+
"p100": 310.5467233657837,
|
| 1466 |
+
"mean": 129.76284700164322
|
| 1467 |
+
},
|
| 1468 |
+
"bbox_y_mm": {
|
| 1469 |
+
"n": 9442,
|
| 1470 |
+
"p0": 0.0,
|
| 1471 |
+
"p1": 25.78125,
|
| 1472 |
+
"p5": 41.69921875,
|
| 1473 |
+
"p10": 48.8625,
|
| 1474 |
+
"p25": 59.57228744029999,
|
| 1475 |
+
"p50": 71.38672888278961,
|
| 1476 |
+
"p75": 83.375,
|
| 1477 |
+
"p90": 95.0,
|
| 1478 |
+
"p95": 103.5,
|
| 1479 |
+
"p99": 123.30349609375,
|
| 1480 |
+
"p100": 190.5,
|
| 1481 |
+
"mean": 71.87623691185125
|
| 1482 |
+
},
|
| 1483 |
+
"bbox_z_mm": {
|
| 1484 |
+
"n": 9442,
|
| 1485 |
+
"p0": 0.0,
|
| 1486 |
+
"p1": 9.0,
|
| 1487 |
+
"p5": 36.0,
|
| 1488 |
+
"p10": 53.0,
|
| 1489 |
+
"p25": 69.63494163751602,
|
| 1490 |
+
"p50": 80.0000011920929,
|
| 1491 |
+
"p75": 90.28357948362827,
|
| 1492 |
+
"p90": 100.0,
|
| 1493 |
+
"p95": 108.0,
|
| 1494 |
+
"p99": 138.88500000000022,
|
| 1495 |
+
"p100": 452.0,
|
| 1496 |
+
"mean": 78.97999364715263
|
| 1497 |
+
},
|
| 1498 |
+
"padded_x_mm": {
|
| 1499 |
+
"n": 9442,
|
| 1500 |
+
"p0": 80.0,
|
| 1501 |
+
"p1": 111.5,
|
| 1502 |
+
"p5": 146.6565435230732,
|
| 1503 |
+
"p10": 169.3041875064373,
|
| 1504 |
+
"p25": 194.75,
|
| 1505 |
+
"p50": 213.0458984375,
|
| 1506 |
+
"p75": 229.0625,
|
| 1507 |
+
"p90": 244.93515624999998,
|
| 1508 |
+
"p95": 255.78124570846558,
|
| 1509 |
+
"p99": 279.0,
|
| 1510 |
+
"p100": 390.5467233657837,
|
| 1511 |
+
"mean": 209.76284700164322
|
| 1512 |
+
},
|
| 1513 |
+
"padded_y_mm": {
|
| 1514 |
+
"n": 9442,
|
| 1515 |
+
"p0": 80.0,
|
| 1516 |
+
"p1": 105.78125,
|
| 1517 |
+
"p5": 121.69921875,
|
| 1518 |
+
"p10": 128.8625,
|
| 1519 |
+
"p25": 139.5722874403,
|
| 1520 |
+
"p50": 151.3867288827896,
|
| 1521 |
+
"p75": 163.375,
|
| 1522 |
+
"p90": 175.0,
|
| 1523 |
+
"p95": 183.5,
|
| 1524 |
+
"p99": 203.30349609375,
|
| 1525 |
+
"p100": 270.5,
|
| 1526 |
+
"mean": 151.87623691185127
|
| 1527 |
+
},
|
| 1528 |
+
"padded_z_mm": {
|
| 1529 |
+
"n": 9442,
|
| 1530 |
+
"p0": 80.0,
|
| 1531 |
+
"p1": 89.0,
|
| 1532 |
+
"p5": 116.0,
|
| 1533 |
+
"p10": 133.0,
|
| 1534 |
+
"p25": 149.63494163751602,
|
| 1535 |
+
"p50": 160.0000011920929,
|
| 1536 |
+
"p75": 170.28357948362827,
|
| 1537 |
+
"p90": 180.0,
|
| 1538 |
+
"p95": 188.0,
|
| 1539 |
+
"p99": 218.88500000000022,
|
| 1540 |
+
"p100": 532.0,
|
| 1541 |
+
"mean": 158.97999364715264
|
| 1542 |
+
},
|
| 1543 |
+
"fits_Bpan_pct": 7.8585045541198895,
|
| 1544 |
+
"over_x_pct": 4.744757466638424,
|
| 1545 |
+
"over_y_pct": 2.5524253336157594,
|
| 1546 |
+
"over_z_pct": 91.81317517475111
|
| 1547 |
+
}
|
| 1548 |
+
}
|
raw_pants_train_test/metadata/pants-captions-ldm/canonical/canonical_facts.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8c0a095e3cfea0e492e27e30538445ff11da5d36b6ba67bee14be057791cdeff
|
| 3 |
+
size 27351511
|
raw_pants_train_test/metadata/pants-captions-ldm/captions/captions_final.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:172fad40f3997eeec3307096db069f54e6797839a0b52c923ddcb2f356a4bad0
|
| 3 |
+
size 40606805
|
raw_pants_train_test/metadata/pants-captions-ldm/captions/captions_v2_after_fusion.jsonl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1f540f20d20a92523425b34d139fe860d6fdbca456bc8c0a4d124c3a0b1a1ecf
|
| 3 |
+
size 47443603
|
raw_pants_train_test/metadata/pants-captions-ldm/code/cache/__pycache__/pants_wan22_cache.cpython-311.pyc
ADDED
|
Binary file (35.1 kB). View file
|
|
|
raw_pants_train_test/metadata/pants-captions-ldm/code/cache/pants_wan22_cache.py
ADDED
|
@@ -0,0 +1,761 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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cache PanTS CT volumes as Wan2.2 VAE latents.
|
| 3 |
+
|
| 4 |
+
The cache is intentionally split into latent tensors and JSONL manifests. Text
|
| 5 |
+
embeddings can be added later without duplicating large VAE latents for every
|
| 6 |
+
caption variant.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
import argparse
|
| 12 |
+
import hashlib
|
| 13 |
+
import json
|
| 14 |
+
import math
|
| 15 |
+
import os
|
| 16 |
+
import sys
|
| 17 |
+
import time
|
| 18 |
+
from dataclasses import dataclass
|
| 19 |
+
from pathlib import Path
|
| 20 |
+
from typing import Any
|
| 21 |
+
|
| 22 |
+
import nibabel as nib
|
| 23 |
+
import numpy as np
|
| 24 |
+
import torch
|
| 25 |
+
from scipy import ndimage
|
| 26 |
+
from safetensors.torch import save_file
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
@dataclass(frozen=True)
|
| 30 |
+
class Bucket:
|
| 31 |
+
bucket_id: str
|
| 32 |
+
view: str
|
| 33 |
+
fov: str
|
| 34 |
+
shape_zyx: tuple[int, int, int]
|
| 35 |
+
spacing_zyx: tuple[float, float, float]
|
| 36 |
+
|
| 37 |
+
@property
|
| 38 |
+
def latent_shape_cthw(self) -> tuple[int, int, int, int]:
|
| 39 |
+
d, h, w = self.shape_zyx
|
| 40 |
+
return (48, 1 + (d - 1) // 4, h // 16, w // 16)
|
| 41 |
+
|
| 42 |
+
@property
|
| 43 |
+
def dit_tokens(self) -> int:
|
| 44 |
+
_, t, h, w = self.latent_shape_cthw
|
| 45 |
+
return t * (h // 2) * (w // 2)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
BUCKETS: dict[str, Bucket] = {
|
| 49 |
+
"B-whole": Bucket("B-whole", "global", "whole_body", (153, 256, 256), (5.0, 2.0, 2.0)),
|
| 50 |
+
"B-CAP": Bucket("B-CAP", "global", "chest_abdomen_pelvis", (113, 320, 256), (4.0, 2.0, 2.0)),
|
| 51 |
+
"B-CA": Bucket("B-CA", "global", "chest_abdomen", (105, 320, 256), (3.5, 2.0, 2.0)),
|
| 52 |
+
"B-abd": Bucket("B-abd", "global", "abdomen_only", (105, 256, 256), (3.0, 2.0, 2.0)),
|
| 53 |
+
"B-abd-pelvis": Bucket("B-abd-pelvis", "global", "abdomen_pelvis", (113, 256, 256), (3.5, 2.0, 2.0)),
|
| 54 |
+
"P-pan": Bucket("P-pan", "pancreas", "pancreas_crop", (145, 224, 288), (1.5, 1.0, 1.0)),
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
WINDOWS_HU = {
|
| 58 |
+
# Keeps the broad CT density range, but compresses soft-tissue contrast.
|
| 59 |
+
"single_full": (-1000.0, 1000.0),
|
| 60 |
+
# Conventional abdomen / pancreatic soft-tissue display, about WW/WL 400/40.
|
| 61 |
+
"abdomen_soft": (-160.0, 240.0),
|
| 62 |
+
# Common pancreas segmentation preprocessing window for parenchyma contrast.
|
| 63 |
+
"pancreas_soft": (-100.0, 240.0),
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
FOV_TO_BUCKET = {
|
| 67 |
+
"whole_body": "B-whole",
|
| 68 |
+
"chest_abdomen_pelvis": "B-CAP",
|
| 69 |
+
"chest_abdomen": "B-CA",
|
| 70 |
+
"abdomen_only": "B-abd",
|
| 71 |
+
"abdomen_pelvis": "B-abd-pelvis",
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
GLOBAL_CAPTION_KEYS = (
|
| 75 |
+
"V1_long_narrative",
|
| 76 |
+
"V2_terse_impression",
|
| 77 |
+
"V3_organ_bullet",
|
| 78 |
+
"V4_tag_string",
|
| 79 |
+
"V5_layered_findings",
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
PANCREAS_CAPTION_KEYS = (
|
| 83 |
+
"V7_pancreas_only",
|
| 84 |
+
"V6_qa_pair",
|
| 85 |
+
)
|
| 86 |
+
|
| 87 |
+
VIEW_TEXT = {
|
| 88 |
+
"whole_body": "Whole-body CT volume.",
|
| 89 |
+
"chest_abdomen_pelvis": "Chest-abdomen-pelvis CT volume.",
|
| 90 |
+
"chest_abdomen": "Chest-abdomen CT volume.",
|
| 91 |
+
"abdomen_only": "Abdomen-only CT volume.",
|
| 92 |
+
"abdomen_pelvis": "Abdomen-pelvis CT volume.",
|
| 93 |
+
"pancreas_crop": "Pancreas-focused CT crop.",
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
WINDOW_TEXT = {
|
| 97 |
+
"single_full": "Broad CT HU window.",
|
| 98 |
+
"abdomen_soft": "Soft-tissue abdomen CT HU window.",
|
| 99 |
+
"pancreas_soft": "Soft-tissue pancreas CT HU window.",
|
| 100 |
+
"tri_window": "Multi-window CT input.",
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
FINAL_CAPTION_TEMPLATES = {
|
| 104 |
+
"whole_body": (
|
| 105 |
+
"A 3D CT volume with whole-body coverage.",
|
| 106 |
+
"Whole-body CT volume.",
|
| 107 |
+
"CT volume covering the whole body.",
|
| 108 |
+
"Wide-field whole-body CT scan.",
|
| 109 |
+
),
|
| 110 |
+
"chest_abdomen_pelvis": (
|
| 111 |
+
"A 3D CT volume covering the chest, abdomen, and pelvis.",
|
| 112 |
+
"Chest-abdomen-pelvis CT volume.",
|
| 113 |
+
"CT scan with chest-to-pelvis coverage.",
|
| 114 |
+
"3D CT volume spanning chest, abdomen, and pelvis.",
|
| 115 |
+
),
|
| 116 |
+
"chest_abdomen": (
|
| 117 |
+
"A 3D CT volume covering the chest and abdomen.",
|
| 118 |
+
"Chest-abdomen CT volume.",
|
| 119 |
+
"CT scan with chest-to-abdomen coverage.",
|
| 120 |
+
"3D CT volume spanning chest and abdomen.",
|
| 121 |
+
),
|
| 122 |
+
"abdomen_only": (
|
| 123 |
+
"A 3D abdomen CT volume.",
|
| 124 |
+
"Abdomen-only CT volume.",
|
| 125 |
+
"CT scan focused on the abdomen.",
|
| 126 |
+
"3D CT volume with abdominal coverage.",
|
| 127 |
+
),
|
| 128 |
+
"abdomen_pelvis": (
|
| 129 |
+
"A 3D CT volume covering the abdomen and pelvis.",
|
| 130 |
+
"Abdomen-pelvis CT volume.",
|
| 131 |
+
"CT scan with abdomen-to-pelvis coverage.",
|
| 132 |
+
"3D CT volume spanning abdomen and pelvis.",
|
| 133 |
+
),
|
| 134 |
+
"pancreas_crop": (
|
| 135 |
+
"Pancreas-focused CT crop.",
|
| 136 |
+
"Cropped 3D CT volume centered on the pancreas.",
|
| 137 |
+
"Focused pancreatic-region CT view.",
|
| 138 |
+
"CT crop showing the pancreas region.",
|
| 139 |
+
),
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def load_jsonl(path: Path) -> dict[str, dict[str, Any]]:
|
| 144 |
+
out: dict[str, dict[str, Any]] = {}
|
| 145 |
+
with path.open() as f:
|
| 146 |
+
for line in f:
|
| 147 |
+
if not line.strip():
|
| 148 |
+
continue
|
| 149 |
+
item = json.loads(line)
|
| 150 |
+
out[item["id"]] = item
|
| 151 |
+
return out
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def load_splits(path: Path) -> dict[str, list[str]]:
|
| 155 |
+
with path.open() as f:
|
| 156 |
+
splits = json.load(f)
|
| 157 |
+
return {k: list(v) for k, v in splits.items()}
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
def find_ct_path(pants_root: Path, case_id: str) -> Path | None:
|
| 161 |
+
for image_dir in ("ImageTr", "ImageTe"):
|
| 162 |
+
p = pants_root / image_dir / case_id / "ct.nii.gz"
|
| 163 |
+
if p.exists():
|
| 164 |
+
return p
|
| 165 |
+
return None
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
def canonical_ct_zyx(path: Path) -> tuple[np.ndarray, tuple[float, float, float]]:
|
| 169 |
+
img = nib.as_closest_canonical(nib.load(str(path)))
|
| 170 |
+
data = np.asarray(img.get_fdata(dtype=np.float32), dtype=np.float32)
|
| 171 |
+
spacing_xyz = tuple(float(x) for x in img.header.get_zooms()[:3])
|
| 172 |
+
vol_zyx = np.transpose(data, (2, 1, 0))
|
| 173 |
+
spacing_zyx = (spacing_xyz[2], spacing_xyz[1], spacing_xyz[0])
|
| 174 |
+
return vol_zyx, spacing_zyx
|
| 175 |
+
|
| 176 |
+
|
| 177 |
+
def bbox_center_zyx(fact: dict[str, Any], src_spacing_zyx: tuple[float, float, float],
|
| 178 |
+
target_spacing_zyx: tuple[float, float, float]) -> tuple[float, float, float] | None:
|
| 179 |
+
bbox = fact.get("mask", {}).get("pancreas_bbox")
|
| 180 |
+
if not bbox:
|
| 181 |
+
return None
|
| 182 |
+
try:
|
| 183 |
+
center_xyz = (
|
| 184 |
+
0.5 * (float(bbox["x"][0]) + float(bbox["x"][1])),
|
| 185 |
+
0.5 * (float(bbox["y"][0]) + float(bbox["y"][1])),
|
| 186 |
+
0.5 * (float(bbox["z"][0]) + float(bbox["z"][1])),
|
| 187 |
+
)
|
| 188 |
+
except (KeyError, TypeError, ValueError):
|
| 189 |
+
return None
|
| 190 |
+
center_zyx_src = (center_xyz[2], center_xyz[1], center_xyz[0])
|
| 191 |
+
return tuple(
|
| 192 |
+
center_zyx_src[i] * src_spacing_zyx[i] / target_spacing_zyx[i]
|
| 193 |
+
for i in range(3)
|
| 194 |
+
)
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
def resample_to_spacing(
|
| 198 |
+
vol_zyx: np.ndarray,
|
| 199 |
+
src_spacing_zyx: tuple[float, float, float],
|
| 200 |
+
dst_spacing_zyx: tuple[float, float, float],
|
| 201 |
+
) -> np.ndarray:
|
| 202 |
+
zoom = tuple(src_spacing_zyx[i] / dst_spacing_zyx[i] for i in range(3))
|
| 203 |
+
return ndimage.zoom(vol_zyx, zoom=zoom, order=1, mode="nearest", prefilter=False).astype(np.float32, copy=False)
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
def crop_or_pad(
|
| 207 |
+
vol: np.ndarray,
|
| 208 |
+
out_shape: tuple[int, int, int],
|
| 209 |
+
center: tuple[float, float, float] | None,
|
| 210 |
+
fill_value: float = -1000.0,
|
| 211 |
+
) -> tuple[np.ndarray, tuple[int, int, int]]:
|
| 212 |
+
if center is None:
|
| 213 |
+
center = tuple((s - 1) / 2.0 for s in vol.shape)
|
| 214 |
+
|
| 215 |
+
starts = tuple(int(round(center[i] - (out_shape[i] - 1) / 2.0)) for i in range(3))
|
| 216 |
+
out = np.full(out_shape, fill_value, dtype=np.float32)
|
| 217 |
+
|
| 218 |
+
src_slices = []
|
| 219 |
+
dst_slices = []
|
| 220 |
+
for axis, start in enumerate(starts):
|
| 221 |
+
end = start + out_shape[axis]
|
| 222 |
+
src0 = max(start, 0)
|
| 223 |
+
src1 = min(end, vol.shape[axis])
|
| 224 |
+
dst0 = max(-start, 0)
|
| 225 |
+
dst1 = dst0 + max(src1 - src0, 0)
|
| 226 |
+
src_slices.append(slice(src0, src1))
|
| 227 |
+
dst_slices.append(slice(dst0, dst1))
|
| 228 |
+
|
| 229 |
+
if all(s.stop > s.start for s in src_slices):
|
| 230 |
+
out[tuple(dst_slices)] = vol[tuple(src_slices)]
|
| 231 |
+
return out, starts
|
| 232 |
+
|
| 233 |
+
|
| 234 |
+
def window_to_model_input(vol_hu: np.ndarray, mode: str) -> np.ndarray:
|
| 235 |
+
if mode in WINDOWS_HU:
|
| 236 |
+
lo, hi = WINDOWS_HU[mode]
|
| 237 |
+
x = np.clip(vol_hu, lo, hi)
|
| 238 |
+
x = (x - lo) / (hi - lo) * 2.0 - 1.0
|
| 239 |
+
return np.repeat(x[None, ...], 3, axis=0).astype(np.float32, copy=False)
|
| 240 |
+
|
| 241 |
+
if mode == "tri_window":
|
| 242 |
+
windows = [(-1000.0, 400.0), (-160.0, 240.0), (-500.0, 1000.0)]
|
| 243 |
+
channels = []
|
| 244 |
+
for lo, hi in windows:
|
| 245 |
+
y = np.clip(vol_hu, lo, hi)
|
| 246 |
+
y = (y - lo) / (hi - lo) * 2.0 - 1.0
|
| 247 |
+
channels.append(y.astype(np.float32, copy=False))
|
| 248 |
+
return np.stack(channels, axis=0)
|
| 249 |
+
|
| 250 |
+
raise ValueError(f"unknown window mode: {mode}")
|
| 251 |
+
|
| 252 |
+
|
| 253 |
+
def window_mode_for_bucket(bucket: Bucket, global_window_mode: str, pancreas_window_mode: str) -> str:
|
| 254 |
+
return pancreas_window_mode if bucket.view == "pancreas" else global_window_mode
|
| 255 |
+
|
| 256 |
+
|
| 257 |
+
def available_captions(caption_row: dict[str, Any], keys: tuple[str, ...]) -> dict[str, str]:
|
| 258 |
+
captions = caption_row.get("captions", {})
|
| 259 |
+
return {k: captions[k] for k in keys if k in captions and captions[k]}
|
| 260 |
+
|
| 261 |
+
|
| 262 |
+
def fallback_pancreas_caption(caption_row: dict[str, Any], fact: dict[str, Any]) -> str:
|
| 263 |
+
cond = caption_row.get("cond", {})
|
| 264 |
+
canonical = fact.get("canonical", {})
|
| 265 |
+
phase = cond.get("phase") or canonical.get("phase") or "CT"
|
| 266 |
+
volume = cond.get("pancreas_volume_cc") or canonical.get("pancreas_volume_cc")
|
| 267 |
+
lesion_present = bool(cond.get("lesion_present") or canonical.get("lesion_present"))
|
| 268 |
+
if lesion_present:
|
| 269 |
+
return f"{phase} pancreas-focused CT crop with a reported pancreatic lesion."
|
| 270 |
+
if volume is not None:
|
| 271 |
+
return f"{phase} pancreas-focused CT crop without a reported focal pancreatic lesion; pancreas volume is about {volume:.1f} cc."
|
| 272 |
+
return f"{phase} pancreas-focused CT crop without a reported focal pancreatic lesion."
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
def text_conditioning_for_row(row: dict[str, Any], bucket: Bucket) -> dict[str, str]:
|
| 276 |
+
view_text = VIEW_TEXT.get(bucket.fov, f"{bucket.fov.replace('_', '-')} CT volume.")
|
| 277 |
+
window_mode = str(row.get("window_mode") or "")
|
| 278 |
+
window_text = WINDOW_TEXT.get(window_mode, "")
|
| 279 |
+
return {
|
| 280 |
+
"view_text": view_text,
|
| 281 |
+
"window_text": window_text,
|
| 282 |
+
"default_prefix": view_text,
|
| 283 |
+
"with_window_prefix": " ".join(x for x in (view_text, window_text) if x),
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
def stable_index(parts: tuple[str, ...], n: int) -> int:
|
| 288 |
+
key = "||".join(parts).encode("utf-8")
|
| 289 |
+
digest = hashlib.blake2b(key, digest_size=4).digest()
|
| 290 |
+
return int.from_bytes(digest, "little") % n
|
| 291 |
+
|
| 292 |
+
|
| 293 |
+
def normalize_caption_text(text: str) -> str:
|
| 294 |
+
text = " ".join(str(text).split())
|
| 295 |
+
if text and text[-1] not in ".!?":
|
| 296 |
+
text += "."
|
| 297 |
+
return text
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
def render_final_caption(row: dict[str, Any], bucket: Bucket, caption_key: str, caption: str) -> tuple[str, str]:
|
| 301 |
+
templates = FINAL_CAPTION_TEMPLATES.get(bucket.fov, (VIEW_TEXT.get(bucket.fov, "3D CT volume."),))
|
| 302 |
+
template = templates[stable_index((row["case_id"], row["bucket_id"], caption_key), len(templates))]
|
| 303 |
+
body = normalize_caption_text(caption)
|
| 304 |
+
lower_body = body.lower()
|
| 305 |
+
if body.startswith(template):
|
| 306 |
+
return body, template
|
| 307 |
+
if bucket.view == "pancreas" and "pancreas-focused ct crop" in lower_body[:120]:
|
| 308 |
+
return body, template
|
| 309 |
+
return f"{template} {body}".strip(), template
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
def build_caption_rows(rows: list[dict[str, Any]], source_split: str) -> list[dict[str, Any]]:
|
| 313 |
+
caption_rows: list[dict[str, Any]] = []
|
| 314 |
+
for row in rows:
|
| 315 |
+
if row.get("status") not in ("ok", "exists"):
|
| 316 |
+
continue
|
| 317 |
+
bucket = BUCKETS.get(row.get("bucket_id", ""))
|
| 318 |
+
if bucket is None:
|
| 319 |
+
continue
|
| 320 |
+
captions = row.get("captions") or {}
|
| 321 |
+
for caption_key, caption in captions.items():
|
| 322 |
+
final_caption, template = render_final_caption(row, bucket, caption_key, caption)
|
| 323 |
+
caption_rows.append({
|
| 324 |
+
"id": f"{row['case_id']}__{row['bucket_id']}__{caption_key}",
|
| 325 |
+
"source_split": source_split,
|
| 326 |
+
"case_id": row["case_id"],
|
| 327 |
+
"bucket_id": row["bucket_id"],
|
| 328 |
+
"view": row.get("view"),
|
| 329 |
+
"fov": row.get("fov"),
|
| 330 |
+
"phase": row.get("phase"),
|
| 331 |
+
"lesion_present": row.get("lesion_present"),
|
| 332 |
+
"latent_path": row.get("latent_path"),
|
| 333 |
+
"latent_shape": row.get("latent_shape"),
|
| 334 |
+
"pixel_shape_zyx": row.get("pixel_shape_zyx"),
|
| 335 |
+
"target_spacing_zyx": row.get("target_spacing_zyx"),
|
| 336 |
+
"window_mode": row.get("window_mode"),
|
| 337 |
+
"window_hu": row.get("window_hu"),
|
| 338 |
+
"dit_tokens": row.get("dit_tokens"),
|
| 339 |
+
"caption_key": caption_key,
|
| 340 |
+
"caption_template": template,
|
| 341 |
+
"caption": final_caption,
|
| 342 |
+
})
|
| 343 |
+
caption_rows.sort(key=lambda r: (r["case_id"], r["bucket_id"], r["caption_key"]))
|
| 344 |
+
return caption_rows
|
| 345 |
+
|
| 346 |
+
|
| 347 |
+
def write_jsonl(path: Path, rows: list[dict[str, Any]]) -> None:
|
| 348 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 349 |
+
with path.open("w") as f:
|
| 350 |
+
for row in rows:
|
| 351 |
+
f.write(json.dumps(row, sort_keys=True) + "\n")
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
def iter_tasks(
|
| 355 |
+
split_names: list[str],
|
| 356 |
+
splits: dict[str, list[str]],
|
| 357 |
+
facts: dict[str, dict[str, Any]],
|
| 358 |
+
captions: dict[str, dict[str, Any]],
|
| 359 |
+
pants_root: Path,
|
| 360 |
+
include_global: bool,
|
| 361 |
+
include_pancreas: bool,
|
| 362 |
+
) -> list[dict[str, Any]]:
|
| 363 |
+
tasks: list[dict[str, Any]] = []
|
| 364 |
+
for split in split_names:
|
| 365 |
+
for case_id in splits[split]:
|
| 366 |
+
fact = facts.get(case_id)
|
| 367 |
+
cap = captions.get(case_id)
|
| 368 |
+
if fact is None or cap is None:
|
| 369 |
+
continue
|
| 370 |
+
ct_path = find_ct_path(pants_root, case_id)
|
| 371 |
+
if ct_path is None:
|
| 372 |
+
continue
|
| 373 |
+
|
| 374 |
+
canonical = fact.get("canonical", {})
|
| 375 |
+
mask = fact.get("mask", {})
|
| 376 |
+
fov = canonical.get("fov") or mask.get("fov")
|
| 377 |
+
if include_global and fov in FOV_TO_BUCKET:
|
| 378 |
+
bucket = BUCKETS[FOV_TO_BUCKET[fov]]
|
| 379 |
+
tasks.append({"split": split, "case_id": case_id, "bucket": bucket, "ct_path": ct_path})
|
| 380 |
+
|
| 381 |
+
if include_pancreas and mask.get("pancreas_bbox"):
|
| 382 |
+
tasks.append({"split": split, "case_id": case_id, "bucket": BUCKETS["P-pan"], "ct_path": ct_path})
|
| 383 |
+
return tasks
|
| 384 |
+
|
| 385 |
+
|
| 386 |
+
def load_vae(model_path: str, dtype: torch.dtype, device: torch.device):
|
| 387 |
+
from diffusers import AutoencoderKLWan
|
| 388 |
+
|
| 389 |
+
vae = AutoencoderKLWan.from_pretrained(
|
| 390 |
+
model_path,
|
| 391 |
+
subfolder="vae",
|
| 392 |
+
torch_dtype=dtype,
|
| 393 |
+
local_files_only=True,
|
| 394 |
+
)
|
| 395 |
+
vae.eval().to(device)
|
| 396 |
+
vae.requires_grad_(False)
|
| 397 |
+
return vae
|
| 398 |
+
|
| 399 |
+
|
| 400 |
+
def dtype_from_name(name: str) -> torch.dtype:
|
| 401 |
+
if name == "bf16":
|
| 402 |
+
return torch.bfloat16
|
| 403 |
+
if name == "fp16":
|
| 404 |
+
return torch.float16
|
| 405 |
+
if name == "fp32":
|
| 406 |
+
return torch.float32
|
| 407 |
+
raise ValueError(name)
|
| 408 |
+
|
| 409 |
+
|
| 410 |
+
def relpath(path: Path, root: Path) -> str:
|
| 411 |
+
return str(path.relative_to(root))
|
| 412 |
+
|
| 413 |
+
|
| 414 |
+
def encode_one(
|
| 415 |
+
task: dict[str, Any],
|
| 416 |
+
fact: dict[str, Any],
|
| 417 |
+
caption_row: dict[str, Any],
|
| 418 |
+
vae,
|
| 419 |
+
device: torch.device,
|
| 420 |
+
vae_dtype: torch.dtype,
|
| 421 |
+
store_dtype: torch.dtype,
|
| 422 |
+
output_root: Path,
|
| 423 |
+
global_window_mode: str,
|
| 424 |
+
pancreas_window_mode: str,
|
| 425 |
+
overwrite: bool,
|
| 426 |
+
) -> dict[str, Any]:
|
| 427 |
+
bucket: Bucket = task["bucket"]
|
| 428 |
+
split = task["split"]
|
| 429 |
+
case_id = task["case_id"]
|
| 430 |
+
out_dir = output_root / "latents" / split / bucket.bucket_id
|
| 431 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 432 |
+
out_path = out_dir / f"{case_id}__{bucket.bucket_id}.safetensors"
|
| 433 |
+
if out_path.exists() and not overwrite:
|
| 434 |
+
return {
|
| 435 |
+
"split": split,
|
| 436 |
+
"case_id": case_id,
|
| 437 |
+
"bucket_id": bucket.bucket_id,
|
| 438 |
+
"view": bucket.view,
|
| 439 |
+
"latent_path": relpath(out_path, output_root),
|
| 440 |
+
"status": "exists",
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
vol, src_spacing = canonical_ct_zyx(task["ct_path"])
|
| 444 |
+
resampled = resample_to_spacing(vol, src_spacing, bucket.spacing_zyx)
|
| 445 |
+
center = bbox_center_zyx(fact, src_spacing, bucket.spacing_zyx)
|
| 446 |
+
crop, crop_origin = crop_or_pad(resampled, bucket.shape_zyx, center=center)
|
| 447 |
+
window_mode = window_mode_for_bucket(bucket, global_window_mode, pancreas_window_mode)
|
| 448 |
+
channels = window_to_model_input(crop, window_mode)
|
| 449 |
+
|
| 450 |
+
x = torch.from_numpy(channels).unsqueeze(0).to(device=device, dtype=vae_dtype)
|
| 451 |
+
with torch.inference_mode():
|
| 452 |
+
if vae_dtype == torch.float32:
|
| 453 |
+
posterior = vae.encode(x).latent_dist
|
| 454 |
+
else:
|
| 455 |
+
with torch.autocast(device_type="cuda", dtype=vae_dtype):
|
| 456 |
+
posterior = vae.encode(x).latent_dist
|
| 457 |
+
latent = posterior.mean.squeeze(0).detach().to(dtype=store_dtype, device="cpu")
|
| 458 |
+
|
| 459 |
+
tmp_path = out_path.with_suffix(".tmp.safetensors")
|
| 460 |
+
save_file(
|
| 461 |
+
{"latent": latent.contiguous()},
|
| 462 |
+
str(tmp_path),
|
| 463 |
+
metadata={
|
| 464 |
+
"case_id": case_id,
|
| 465 |
+
"bucket_id": bucket.bucket_id,
|
| 466 |
+
"split": split,
|
| 467 |
+
"latent_kind": "wan22_vae_raw_mean_unscaled",
|
| 468 |
+
"window_mode": window_mode,
|
| 469 |
+
},
|
| 470 |
+
)
|
| 471 |
+
os.replace(tmp_path, out_path)
|
| 472 |
+
|
| 473 |
+
if bucket.view == "pancreas":
|
| 474 |
+
caps = available_captions(caption_row, PANCREAS_CAPTION_KEYS)
|
| 475 |
+
if not caps:
|
| 476 |
+
caps = {"V7_pancreas_only_fallback": fallback_pancreas_caption(caption_row, fact)}
|
| 477 |
+
else:
|
| 478 |
+
caps = available_captions(caption_row, GLOBAL_CAPTION_KEYS)
|
| 479 |
+
|
| 480 |
+
canonical = fact.get("canonical", {})
|
| 481 |
+
mask = fact.get("mask", {})
|
| 482 |
+
row = {
|
| 483 |
+
"split": split,
|
| 484 |
+
"case_id": case_id,
|
| 485 |
+
"bucket_id": bucket.bucket_id,
|
| 486 |
+
"view": bucket.view,
|
| 487 |
+
"fov": canonical.get("fov") or mask.get("fov"),
|
| 488 |
+
"phase": canonical.get("phase"),
|
| 489 |
+
"lesion_present": bool(canonical.get("lesion_present")),
|
| 490 |
+
"ct_path": str(task["ct_path"]),
|
| 491 |
+
"latent_path": relpath(out_path, output_root),
|
| 492 |
+
"latent_shape": list(latent.shape),
|
| 493 |
+
"latent_dtype": str(latent.dtype).replace("torch.", ""),
|
| 494 |
+
"pixel_shape_zyx": list(bucket.shape_zyx),
|
| 495 |
+
"target_spacing_zyx": list(bucket.spacing_zyx),
|
| 496 |
+
"source_spacing_zyx": list(src_spacing),
|
| 497 |
+
"resampled_shape_zyx": list(resampled.shape),
|
| 498 |
+
"crop_origin_zyx": list(crop_origin),
|
| 499 |
+
"window_mode": window_mode,
|
| 500 |
+
"window_hu": list(WINDOWS_HU.get(window_mode, (math.nan, math.nan))),
|
| 501 |
+
"dit_tokens": bucket.dit_tokens,
|
| 502 |
+
"caption_keys": list(caps.keys()),
|
| 503 |
+
"captions": caps,
|
| 504 |
+
"status": "ok",
|
| 505 |
+
}
|
| 506 |
+
row["text_conditioning"] = text_conditioning_for_row(row, bucket)
|
| 507 |
+
return row
|
| 508 |
+
|
| 509 |
+
|
| 510 |
+
def refresh_caption_fields(
|
| 511 |
+
row: dict[str, Any],
|
| 512 |
+
facts: dict[str, dict[str, Any]] | None,
|
| 513 |
+
captions: dict[str, dict[str, Any]] | None,
|
| 514 |
+
) -> dict[str, Any]:
|
| 515 |
+
if row.get("status") not in ("ok", "exists"):
|
| 516 |
+
return row
|
| 517 |
+
if facts is None or captions is None:
|
| 518 |
+
return row
|
| 519 |
+
case_id = row.get("case_id")
|
| 520 |
+
bucket_id = row.get("bucket_id")
|
| 521 |
+
if not case_id or not bucket_id or case_id not in facts or case_id not in captions:
|
| 522 |
+
return row
|
| 523 |
+
bucket = BUCKETS.get(bucket_id)
|
| 524 |
+
if bucket is None:
|
| 525 |
+
return row
|
| 526 |
+
if bucket.view == "pancreas":
|
| 527 |
+
caps = available_captions(captions[case_id], PANCREAS_CAPTION_KEYS)
|
| 528 |
+
if not caps:
|
| 529 |
+
caps = {"V7_pancreas_only_fallback": fallback_pancreas_caption(captions[case_id], facts[case_id])}
|
| 530 |
+
else:
|
| 531 |
+
caps = available_captions(captions[case_id], GLOBAL_CAPTION_KEYS)
|
| 532 |
+
row["caption_keys"] = list(caps.keys())
|
| 533 |
+
row["captions"] = caps
|
| 534 |
+
row["text_conditioning"] = text_conditioning_for_row(row, bucket)
|
| 535 |
+
return row
|
| 536 |
+
|
| 537 |
+
|
| 538 |
+
def merge_manifests(output_root: Path) -> None:
|
| 539 |
+
parts_dir = output_root / "manifests" / "parts"
|
| 540 |
+
merged_dir = output_root / "manifests"
|
| 541 |
+
merged_dir.mkdir(parents=True, exist_ok=True)
|
| 542 |
+
project_root = output_root.parent.parent
|
| 543 |
+
facts = captions = None
|
| 544 |
+
try:
|
| 545 |
+
facts = load_jsonl(project_root / "canonical" / "canonical_facts.jsonl")
|
| 546 |
+
captions = load_jsonl(project_root / "captions" / "captions_final.jsonl")
|
| 547 |
+
except FileNotFoundError:
|
| 548 |
+
pass
|
| 549 |
+
merged_by_split: dict[str, list[dict[str, Any]]] = {}
|
| 550 |
+
for split in ("train", "val", "test"):
|
| 551 |
+
part_files = sorted(parts_dir.glob(f"{split}.rank*.jsonl"))
|
| 552 |
+
if not part_files:
|
| 553 |
+
continue
|
| 554 |
+
rows: list[dict[str, Any]] = []
|
| 555 |
+
for p in part_files:
|
| 556 |
+
with p.open() as f:
|
| 557 |
+
for line in f:
|
| 558 |
+
if line.strip():
|
| 559 |
+
rows.append(refresh_caption_fields(json.loads(line), facts, captions))
|
| 560 |
+
rows.sort(key=lambda r: (r.get("case_id", ""), r.get("bucket_id", "")))
|
| 561 |
+
merged_by_split[split] = rows
|
| 562 |
+
out = merged_dir / f"{split}.jsonl"
|
| 563 |
+
write_jsonl(out, rows)
|
| 564 |
+
print(f"merged {len(rows)} rows -> {out}", flush=True)
|
| 565 |
+
|
| 566 |
+
source_splits = {
|
| 567 |
+
"source_train": merged_by_split.get("train", []) + merged_by_split.get("val", []),
|
| 568 |
+
"source_test": merged_by_split.get("test", []),
|
| 569 |
+
}
|
| 570 |
+
caption_dir = output_root / "captions"
|
| 571 |
+
for source_split, rows in source_splits.items():
|
| 572 |
+
if not rows:
|
| 573 |
+
continue
|
| 574 |
+
rows = sorted(rows, key=lambda r: (r.get("case_id", ""), r.get("bucket_id", "")))
|
| 575 |
+
manifest_out = merged_dir / f"{source_split}.jsonl"
|
| 576 |
+
write_jsonl(manifest_out, rows)
|
| 577 |
+
print(f"merged {len(rows)} rows -> {manifest_out}", flush=True)
|
| 578 |
+
|
| 579 |
+
caption_rows = build_caption_rows(rows, source_split)
|
| 580 |
+
caption_out = caption_dir / f"{source_split}.jsonl"
|
| 581 |
+
write_jsonl(caption_out, caption_rows)
|
| 582 |
+
print(f"wrote {len(caption_rows)} caption rows -> {caption_out}", flush=True)
|
| 583 |
+
|
| 584 |
+
|
| 585 |
+
def write_cache_config(output_root: Path, args: argparse.Namespace) -> None:
|
| 586 |
+
cfg = {
|
| 587 |
+
"created_unix": time.time(),
|
| 588 |
+
"model_path": args.model_path,
|
| 589 |
+
"window_mode": args.window_mode,
|
| 590 |
+
"global_window_mode": args.global_window_mode,
|
| 591 |
+
"pancreas_window_mode": args.pancreas_window_mode,
|
| 592 |
+
"store_dtype": args.store_dtype,
|
| 593 |
+
"vae_dtype": args.vae_dtype,
|
| 594 |
+
"buckets": {
|
| 595 |
+
k: {
|
| 596 |
+
"shape_zyx": list(v.shape_zyx),
|
| 597 |
+
"spacing_zyx": list(v.spacing_zyx),
|
| 598 |
+
"latent_shape_cthw": list(v.latent_shape_cthw),
|
| 599 |
+
"dit_tokens": v.dit_tokens,
|
| 600 |
+
"view": v.view,
|
| 601 |
+
"fov": v.fov,
|
| 602 |
+
}
|
| 603 |
+
for k, v in BUCKETS.items()
|
| 604 |
+
},
|
| 605 |
+
}
|
| 606 |
+
with (output_root / "cache_config.json").open("w") as f:
|
| 607 |
+
json.dump(cfg, f, indent=2, sort_keys=True)
|
| 608 |
+
|
| 609 |
+
|
| 610 |
+
def parse_args() -> argparse.Namespace:
|
| 611 |
+
parser = argparse.ArgumentParser()
|
| 612 |
+
parser.add_argument("--pants-root", type=Path, required=True)
|
| 613 |
+
parser.add_argument("--project-root", type=Path, required=True)
|
| 614 |
+
parser.add_argument("--model-path", type=str, required=True)
|
| 615 |
+
parser.add_argument("--output-root", type=Path, required=True)
|
| 616 |
+
parser.add_argument("--splits", default="train,val,test")
|
| 617 |
+
parser.add_argument("--include-global", action=argparse.BooleanOptionalAction, default=True)
|
| 618 |
+
parser.add_argument("--include-pancreas", action=argparse.BooleanOptionalAction, default=True)
|
| 619 |
+
parser.add_argument(
|
| 620 |
+
"--window-mode",
|
| 621 |
+
choices=["single_full", "abdomen_soft", "pancreas_soft", "tri_window"],
|
| 622 |
+
default=None,
|
| 623 |
+
help="Legacy override: use the same window for all buckets.",
|
| 624 |
+
)
|
| 625 |
+
parser.add_argument(
|
| 626 |
+
"--global-window-mode",
|
| 627 |
+
choices=["single_full", "abdomen_soft", "pancreas_soft", "tri_window"],
|
| 628 |
+
default="abdomen_soft",
|
| 629 |
+
)
|
| 630 |
+
parser.add_argument(
|
| 631 |
+
"--pancreas-window-mode",
|
| 632 |
+
choices=["single_full", "abdomen_soft", "pancreas_soft", "tri_window"],
|
| 633 |
+
default="pancreas_soft",
|
| 634 |
+
)
|
| 635 |
+
parser.add_argument("--vae-dtype", choices=["bf16", "fp16", "fp32"], default="bf16")
|
| 636 |
+
parser.add_argument("--store-dtype", choices=["bf16", "fp16", "fp32"], default="bf16")
|
| 637 |
+
parser.add_argument("--rank", type=int, default=None)
|
| 638 |
+
parser.add_argument("--world-size", type=int, default=None)
|
| 639 |
+
parser.add_argument("--limit", type=int, default=0)
|
| 640 |
+
parser.add_argument("--overwrite", action="store_true")
|
| 641 |
+
parser.add_argument("--merge-only", action="store_true")
|
| 642 |
+
parser.add_argument("--num-threads", type=int, default=8)
|
| 643 |
+
return parser.parse_args()
|
| 644 |
+
|
| 645 |
+
|
| 646 |
+
def main() -> int:
|
| 647 |
+
args = parse_args()
|
| 648 |
+
if args.window_mode is not None:
|
| 649 |
+
args.global_window_mode = args.window_mode
|
| 650 |
+
args.pancreas_window_mode = args.window_mode
|
| 651 |
+
args.output_root.mkdir(parents=True, exist_ok=True)
|
| 652 |
+
if args.merge_only:
|
| 653 |
+
merge_manifests(args.output_root)
|
| 654 |
+
return 0
|
| 655 |
+
|
| 656 |
+
rank = args.rank
|
| 657 |
+
if rank is None:
|
| 658 |
+
rank = int(os.environ.get("SLURM_PROCID", os.environ.get("RANK", "0")))
|
| 659 |
+
world_size = args.world_size
|
| 660 |
+
if world_size is None:
|
| 661 |
+
world_size = int(os.environ.get("SLURM_NTASKS", os.environ.get("WORLD_SIZE", "1")))
|
| 662 |
+
|
| 663 |
+
torch.set_num_threads(max(1, args.num_threads))
|
| 664 |
+
if torch.cuda.is_available():
|
| 665 |
+
device = torch.device("cuda")
|
| 666 |
+
torch.cuda.set_device(0)
|
| 667 |
+
else:
|
| 668 |
+
device = torch.device("cpu")
|
| 669 |
+
|
| 670 |
+
facts = load_jsonl(args.project_root / "canonical" / "canonical_facts.jsonl")
|
| 671 |
+
captions = load_jsonl(args.project_root / "captions" / "captions_final.jsonl")
|
| 672 |
+
splits = load_splits(args.project_root / "splits" / "splits.json")
|
| 673 |
+
split_names = [x for x in args.splits.split(",") if x]
|
| 674 |
+
|
| 675 |
+
tasks = iter_tasks(
|
| 676 |
+
split_names=split_names,
|
| 677 |
+
splits=splits,
|
| 678 |
+
facts=facts,
|
| 679 |
+
captions=captions,
|
| 680 |
+
pants_root=args.pants_root,
|
| 681 |
+
include_global=args.include_global,
|
| 682 |
+
include_pancreas=args.include_pancreas,
|
| 683 |
+
)
|
| 684 |
+
tasks = [task for i, task in enumerate(tasks) if i % world_size == rank]
|
| 685 |
+
if args.limit > 0:
|
| 686 |
+
tasks = tasks[: args.limit]
|
| 687 |
+
|
| 688 |
+
if rank == 0:
|
| 689 |
+
write_cache_config(args.output_root, args)
|
| 690 |
+
|
| 691 |
+
parts_dir = args.output_root / "manifests" / "parts"
|
| 692 |
+
parts_dir.mkdir(parents=True, exist_ok=True)
|
| 693 |
+
part_paths = {split: parts_dir / f"{split}.rank{rank:04d}.jsonl" for split in split_names}
|
| 694 |
+
part_handles = {split: part_paths[split].open("w") for split in split_names}
|
| 695 |
+
|
| 696 |
+
vae = load_vae(args.model_path, dtype_from_name(args.vae_dtype), device)
|
| 697 |
+
store_dtype = dtype_from_name(args.store_dtype)
|
| 698 |
+
vae_dtype = dtype_from_name(args.vae_dtype)
|
| 699 |
+
|
| 700 |
+
print(
|
| 701 |
+
f"rank {rank}/{world_size}: {len(tasks)} tasks, device={device}, "
|
| 702 |
+
f"vae_dtype={args.vae_dtype}, store_dtype={args.store_dtype}",
|
| 703 |
+
flush=True,
|
| 704 |
+
)
|
| 705 |
+
|
| 706 |
+
started = time.time()
|
| 707 |
+
ok = 0
|
| 708 |
+
failed = 0
|
| 709 |
+
try:
|
| 710 |
+
for idx, task in enumerate(tasks, start=1):
|
| 711 |
+
case_id = task["case_id"]
|
| 712 |
+
split = task["split"]
|
| 713 |
+
bucket: Bucket = task["bucket"]
|
| 714 |
+
try:
|
| 715 |
+
row = encode_one(
|
| 716 |
+
task=task,
|
| 717 |
+
fact=facts[case_id],
|
| 718 |
+
caption_row=captions[case_id],
|
| 719 |
+
vae=vae,
|
| 720 |
+
device=device,
|
| 721 |
+
vae_dtype=vae_dtype,
|
| 722 |
+
store_dtype=store_dtype,
|
| 723 |
+
output_root=args.output_root,
|
| 724 |
+
global_window_mode=args.global_window_mode,
|
| 725 |
+
pancreas_window_mode=args.pancreas_window_mode,
|
| 726 |
+
overwrite=args.overwrite,
|
| 727 |
+
)
|
| 728 |
+
ok += 1
|
| 729 |
+
except Exception as exc: # keep the long cache job moving
|
| 730 |
+
failed += 1
|
| 731 |
+
row = {
|
| 732 |
+
"split": split,
|
| 733 |
+
"case_id": case_id,
|
| 734 |
+
"bucket_id": bucket.bucket_id,
|
| 735 |
+
"status": "error",
|
| 736 |
+
"error": repr(exc),
|
| 737 |
+
}
|
| 738 |
+
print(f"rank {rank}: ERROR {case_id} {bucket.bucket_id}: {exc!r}", file=sys.stderr, flush=True)
|
| 739 |
+
|
| 740 |
+
part_handles[split].write(json.dumps(row, sort_keys=True) + "\n")
|
| 741 |
+
part_handles[split].flush()
|
| 742 |
+
|
| 743 |
+
if idx == 1 or idx % 25 == 0:
|
| 744 |
+
elapsed = max(time.time() - started, 1e-6)
|
| 745 |
+
rate = idx / elapsed
|
| 746 |
+
remaining = (len(tasks) - idx) / max(rate, 1e-6)
|
| 747 |
+
print(
|
| 748 |
+
f"rank {rank}: {idx}/{len(tasks)} done "
|
| 749 |
+
f"ok={ok} failed={failed} rate={rate:.3f}/s eta={remaining/60:.1f}m",
|
| 750 |
+
flush=True,
|
| 751 |
+
)
|
| 752 |
+
finally:
|
| 753 |
+
for handle in part_handles.values():
|
| 754 |
+
handle.close()
|
| 755 |
+
|
| 756 |
+
print(f"rank {rank}: finished ok={ok} failed={failed}", flush=True)
|
| 757 |
+
return 0 if failed == 0 else 2
|
| 758 |
+
|
| 759 |
+
|
| 760 |
+
if __name__ == "__main__":
|
| 761 |
+
raise SystemExit(main())
|
raw_pants_train_test/metadata/pants-captions-ldm/code/cache/pants_wan22_decode_check.py
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Decode-check one PanTS Wan2.2 latent against its preprocessed CT crop."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import importlib.util
|
| 8 |
+
import json
|
| 9 |
+
import sys
|
| 10 |
+
from pathlib import Path
|
| 11 |
+
|
| 12 |
+
import numpy as np
|
| 13 |
+
import torch
|
| 14 |
+
from PIL import Image, ImageDraw
|
| 15 |
+
from safetensors.torch import load_file
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def load_cache_module(path: Path):
|
| 19 |
+
spec = importlib.util.spec_from_file_location("pants_wan22_cache", path)
|
| 20 |
+
if spec is None or spec.loader is None:
|
| 21 |
+
raise RuntimeError(f"cannot import {path}")
|
| 22 |
+
module = importlib.util.module_from_spec(spec)
|
| 23 |
+
sys.modules[spec.name] = module
|
| 24 |
+
spec.loader.exec_module(module)
|
| 25 |
+
return module
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def parse_args():
|
| 29 |
+
parser = argparse.ArgumentParser()
|
| 30 |
+
parser.add_argument("--cache-script", type=Path, required=True)
|
| 31 |
+
parser.add_argument("--manifest", type=Path, required=True)
|
| 32 |
+
parser.add_argument("--output-root", type=Path, required=True)
|
| 33 |
+
parser.add_argument("--model-path", type=str, required=True)
|
| 34 |
+
parser.add_argument("--case-id", default="")
|
| 35 |
+
parser.add_argument("--bucket-id", default="")
|
| 36 |
+
parser.add_argument("--out-png", type=Path, required=True)
|
| 37 |
+
parser.add_argument("--vae-dtype", choices=["bf16", "fp16", "fp32"], default="bf16")
|
| 38 |
+
return parser.parse_args()
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
def read_row(path: Path, case_id: str, bucket_id: str):
|
| 42 |
+
with path.open() as f:
|
| 43 |
+
for line in f:
|
| 44 |
+
if not line.strip():
|
| 45 |
+
continue
|
| 46 |
+
row = json.loads(line)
|
| 47 |
+
if case_id and row.get("case_id") != case_id:
|
| 48 |
+
continue
|
| 49 |
+
if bucket_id and row.get("bucket_id") != bucket_id:
|
| 50 |
+
continue
|
| 51 |
+
if row.get("status") in ("ok", "exists"):
|
| 52 |
+
return row
|
| 53 |
+
raise RuntimeError(f"no matching row in {path}")
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def to_u8(x: np.ndarray) -> np.ndarray:
|
| 57 |
+
x = np.asarray(x, dtype=np.float32)
|
| 58 |
+
x = np.clip((x + 1.0) * 0.5, 0.0, 1.0)
|
| 59 |
+
return (x * 255.0 + 0.5).astype(np.uint8)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def diff_u8(x: np.ndarray, scale: float = 4.0) -> np.ndarray:
|
| 63 |
+
x = np.clip(np.abs(x) * scale, 0.0, 1.0)
|
| 64 |
+
return (x * 255.0 + 0.5).astype(np.uint8)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def save_panel(input_vol: np.ndarray, decoded_vol: np.ndarray, out_png: Path, title: str):
|
| 68 |
+
z = input_vol.shape[0] // 2
|
| 69 |
+
panels = [
|
| 70 |
+
("input", to_u8(input_vol[z])),
|
| 71 |
+
("decode_avg", to_u8(decoded_vol[z])),
|
| 72 |
+
("abs_diff_x4", diff_u8(decoded_vol[z] - input_vol[z])),
|
| 73 |
+
]
|
| 74 |
+
h, w = panels[0][1].shape
|
| 75 |
+
label_h = 28
|
| 76 |
+
canvas = Image.new("RGB", (w * len(panels), h + label_h), "white")
|
| 77 |
+
draw = ImageDraw.Draw(canvas)
|
| 78 |
+
for i, (label, arr) in enumerate(panels):
|
| 79 |
+
img = Image.fromarray(arr, mode="L").convert("RGB")
|
| 80 |
+
canvas.paste(img, (i * w, label_h))
|
| 81 |
+
draw.text((i * w + 8, 8), label, fill=(0, 0, 0))
|
| 82 |
+
draw.text((8, h + label_h - 18), title, fill=(255, 255, 255))
|
| 83 |
+
out_png.parent.mkdir(parents=True, exist_ok=True)
|
| 84 |
+
canvas.save(out_png)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
def main() -> int:
|
| 88 |
+
args = parse_args()
|
| 89 |
+
cache = load_cache_module(args.cache_script)
|
| 90 |
+
row = read_row(args.manifest, args.case_id, args.bucket_id)
|
| 91 |
+
|
| 92 |
+
bucket = cache.BUCKETS[row["bucket_id"]]
|
| 93 |
+
vol, src_spacing = cache.canonical_ct_zyx(Path(row["ct_path"]))
|
| 94 |
+
facts = cache.load_jsonl(args.cache_script.parents[2] / "canonical" / "canonical_facts.jsonl")
|
| 95 |
+
center = cache.bbox_center_zyx(facts[row["case_id"]], src_spacing, bucket.spacing_zyx)
|
| 96 |
+
resampled = cache.resample_to_spacing(vol, src_spacing, bucket.spacing_zyx)
|
| 97 |
+
crop, _ = cache.crop_or_pad(resampled, bucket.shape_zyx, center=center)
|
| 98 |
+
window_mode = row.get("window_mode", "single_full")
|
| 99 |
+
input_chw = cache.window_to_model_input(crop, window_mode)
|
| 100 |
+
input_vol = input_chw[0]
|
| 101 |
+
|
| 102 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 103 |
+
vae_dtype = cache.dtype_from_name(args.vae_dtype)
|
| 104 |
+
vae = cache.load_vae(args.model_path, vae_dtype, device)
|
| 105 |
+
latent = load_file(str(args.output_root / row["latent_path"]))["latent"].unsqueeze(0).to(device=device, dtype=vae_dtype)
|
| 106 |
+
with torch.inference_mode():
|
| 107 |
+
with torch.autocast(device_type="cuda", dtype=vae_dtype, enabled=(device.type == "cuda" and vae_dtype != torch.float32)):
|
| 108 |
+
decoded = vae.decode(latent).sample
|
| 109 |
+
decoded = decoded.squeeze(0).float().cpu().numpy()
|
| 110 |
+
decoded_avg = decoded.mean(axis=0)
|
| 111 |
+
|
| 112 |
+
if decoded_avg.shape != input_vol.shape:
|
| 113 |
+
raise RuntimeError(f"decoded shape {decoded_avg.shape} != input shape {input_vol.shape}")
|
| 114 |
+
|
| 115 |
+
err = decoded_avg - input_vol
|
| 116 |
+
ch_std = decoded.std(axis=0)
|
| 117 |
+
corr = float(np.corrcoef(input_vol.reshape(-1), decoded_avg.reshape(-1))[0, 1])
|
| 118 |
+
stats = {
|
| 119 |
+
"case_id": row["case_id"],
|
| 120 |
+
"bucket_id": row["bucket_id"],
|
| 121 |
+
"latent_shape": row["latent_shape"],
|
| 122 |
+
"window_mode": window_mode,
|
| 123 |
+
"window_hu": row.get("window_hu"),
|
| 124 |
+
"input_shape": list(input_vol.shape),
|
| 125 |
+
"decoded_shape_3ch": list(decoded.shape),
|
| 126 |
+
"decoded_avg_shape": list(decoded_avg.shape),
|
| 127 |
+
"mae": float(np.mean(np.abs(err))),
|
| 128 |
+
"rmse": float(np.sqrt(np.mean(err * err))),
|
| 129 |
+
"corr": corr,
|
| 130 |
+
"decoded_channel_std_mean": float(ch_std.mean()),
|
| 131 |
+
"decoded_channel_std_p99": float(np.quantile(ch_std, 0.99)),
|
| 132 |
+
"png": str(args.out_png),
|
| 133 |
+
}
|
| 134 |
+
save_panel(
|
| 135 |
+
input_vol=input_vol,
|
| 136 |
+
decoded_vol=decoded_avg,
|
| 137 |
+
out_png=args.out_png,
|
| 138 |
+
title=f"{row['case_id']} {row['bucket_id']} z={input_vol.shape[0] // 2}",
|
| 139 |
+
)
|
| 140 |
+
print(json.dumps(stats, indent=2, sort_keys=True))
|
| 141 |
+
return 0
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
if __name__ == "__main__":
|
| 145 |
+
raise SystemExit(main())
|
raw_pants_train_test/metadata/pants-captions-ldm/code/cache/pants_wan22_text_cache.py
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Cache Wan2.2 text embeddings for PanTS caption rows."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import argparse
|
| 7 |
+
import json
|
| 8 |
+
import os
|
| 9 |
+
from pathlib import Path
|
| 10 |
+
from typing import Any
|
| 11 |
+
|
| 12 |
+
import torch
|
| 13 |
+
from safetensors.torch import save_file
|
| 14 |
+
from tqdm import tqdm
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def load_jsonl(path: Path) -> list[dict[str, Any]]:
|
| 18 |
+
rows: list[dict[str, Any]] = []
|
| 19 |
+
with path.open() as f:
|
| 20 |
+
for line in f:
|
| 21 |
+
if line.strip():
|
| 22 |
+
rows.append(json.loads(line))
|
| 23 |
+
return rows
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def write_jsonl(path: Path, rows: list[dict[str, Any]]) -> None:
|
| 27 |
+
path.parent.mkdir(parents=True, exist_ok=True)
|
| 28 |
+
with path.open("w") as f:
|
| 29 |
+
for row in rows:
|
| 30 |
+
f.write(json.dumps(row, sort_keys=True) + "\n")
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
def dtype_from_name(name: str) -> torch.dtype:
|
| 34 |
+
if name == "bf16":
|
| 35 |
+
return torch.bfloat16
|
| 36 |
+
if name == "fp16":
|
| 37 |
+
return torch.float16
|
| 38 |
+
if name == "fp32":
|
| 39 |
+
return torch.float32
|
| 40 |
+
raise ValueError(name)
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
def relpath(path: Path, root: Path) -> str:
|
| 44 |
+
return str(path.relative_to(root))
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def encode_caption(
|
| 48 |
+
caption: str,
|
| 49 |
+
tokenizer,
|
| 50 |
+
text_encoder,
|
| 51 |
+
device: torch.device,
|
| 52 |
+
max_length: int,
|
| 53 |
+
store_dtype: torch.dtype,
|
| 54 |
+
) -> tuple[torch.Tensor, int]:
|
| 55 |
+
inputs = tokenizer(
|
| 56 |
+
caption,
|
| 57 |
+
padding="max_length",
|
| 58 |
+
max_length=max_length,
|
| 59 |
+
truncation=True,
|
| 60 |
+
add_special_tokens=True,
|
| 61 |
+
return_attention_mask=True,
|
| 62 |
+
return_tensors="pt",
|
| 63 |
+
)
|
| 64 |
+
attention_mask = inputs["attention_mask"][0]
|
| 65 |
+
seq_len = int(attention_mask.gt(0).sum().item())
|
| 66 |
+
inputs = {k: v.to(device) for k, v in inputs.items()}
|
| 67 |
+
with torch.inference_mode():
|
| 68 |
+
hidden = text_encoder(**inputs).last_hidden_state[0, :seq_len]
|
| 69 |
+
return hidden.detach().to(dtype=store_dtype, device="cpu").contiguous(), seq_len
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
def process_split(args: argparse.Namespace, split: str, tokenizer, text_encoder, device: torch.device) -> None:
|
| 73 |
+
src_path = args.cache_root / "captions" / f"{split}.jsonl"
|
| 74 |
+
rows = load_jsonl(src_path)
|
| 75 |
+
if args.limit:
|
| 76 |
+
rows = rows[: args.limit]
|
| 77 |
+
|
| 78 |
+
part_path = args.cache_root / "captions_embedded" / "parts" / f"{split}.rank{args.rank:03d}.jsonl"
|
| 79 |
+
part_path.parent.mkdir(parents=True, exist_ok=True)
|
| 80 |
+
|
| 81 |
+
store_dtype = dtype_from_name(args.store_dtype)
|
| 82 |
+
my_rows = [row for i, row in enumerate(rows) if i % args.world_size == args.rank]
|
| 83 |
+
out_rows: list[dict[str, Any]] = []
|
| 84 |
+
|
| 85 |
+
iterator = tqdm(my_rows, disable=args.rank != 0, desc=f"{split} rank {args.rank}")
|
| 86 |
+
for row in iterator:
|
| 87 |
+
out_dir = args.cache_root / "text_embeddings" / split / row["bucket_id"]
|
| 88 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 89 |
+
out_path = out_dir / f"{row['id']}.safetensors"
|
| 90 |
+
|
| 91 |
+
if out_path.exists() and not args.overwrite:
|
| 92 |
+
emb_shape = row.get("text_embedding_shape")
|
| 93 |
+
token_count = row.get("text_token_count")
|
| 94 |
+
else:
|
| 95 |
+
emb, token_count = encode_caption(
|
| 96 |
+
row["caption"],
|
| 97 |
+
tokenizer,
|
| 98 |
+
text_encoder,
|
| 99 |
+
device,
|
| 100 |
+
args.max_length,
|
| 101 |
+
store_dtype,
|
| 102 |
+
)
|
| 103 |
+
emb_shape = list(emb.shape)
|
| 104 |
+
tmp_path = out_path.with_suffix(".tmp.safetensors")
|
| 105 |
+
save_file(
|
| 106 |
+
{"text_embedding": emb},
|
| 107 |
+
str(tmp_path),
|
| 108 |
+
metadata={
|
| 109 |
+
"id": row["id"],
|
| 110 |
+
"case_id": row["case_id"],
|
| 111 |
+
"bucket_id": row["bucket_id"],
|
| 112 |
+
"caption_key": row["caption_key"],
|
| 113 |
+
"embedding_kind": "wan22_umt5_last_hidden_state_unpadded",
|
| 114 |
+
"store_dtype": args.store_dtype,
|
| 115 |
+
"max_length": str(args.max_length),
|
| 116 |
+
},
|
| 117 |
+
)
|
| 118 |
+
os.replace(tmp_path, out_path)
|
| 119 |
+
|
| 120 |
+
new_row = dict(row)
|
| 121 |
+
new_row["text_embedding_path"] = relpath(out_path, args.cache_root)
|
| 122 |
+
new_row["text_embedding_shape"] = emb_shape
|
| 123 |
+
new_row["text_embedding_dtype"] = args.store_dtype
|
| 124 |
+
new_row["text_token_count"] = token_count
|
| 125 |
+
out_rows.append(new_row)
|
| 126 |
+
|
| 127 |
+
write_jsonl(part_path, out_rows)
|
| 128 |
+
print(f"rank {args.rank}: wrote {len(out_rows)} rows -> {part_path}", flush=True)
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def merge_splits(cache_root: Path, splits: list[str]) -> None:
|
| 132 |
+
parts_dir = cache_root / "captions_embedded" / "parts"
|
| 133 |
+
out_dir = cache_root / "captions_embedded"
|
| 134 |
+
out_dir.mkdir(parents=True, exist_ok=True)
|
| 135 |
+
for split in splits:
|
| 136 |
+
rows: list[dict[str, Any]] = []
|
| 137 |
+
for part_path in sorted(parts_dir.glob(f"{split}.rank*.jsonl")):
|
| 138 |
+
rows.extend(load_jsonl(part_path))
|
| 139 |
+
rows.sort(key=lambda r: (r["case_id"], r["bucket_id"], r["caption_key"]))
|
| 140 |
+
out_path = out_dir / f"{split}.jsonl"
|
| 141 |
+
write_jsonl(out_path, rows)
|
| 142 |
+
print(f"merged {len(rows)} rows -> {out_path}", flush=True)
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
def parse_args() -> argparse.Namespace:
|
| 146 |
+
parser = argparse.ArgumentParser()
|
| 147 |
+
parser.add_argument("--cache-root", type=Path, required=True)
|
| 148 |
+
parser.add_argument("--text-model-root", type=Path, required=True)
|
| 149 |
+
parser.add_argument("--splits", nargs="+", default=["source_train", "source_test"])
|
| 150 |
+
parser.add_argument("--rank", type=int, default=0)
|
| 151 |
+
parser.add_argument("--world-size", type=int, default=1)
|
| 152 |
+
parser.add_argument("--max-length", type=int, default=512)
|
| 153 |
+
parser.add_argument("--text-dtype", choices=["bf16", "fp16", "fp32"], default="bf16")
|
| 154 |
+
parser.add_argument("--store-dtype", choices=["bf16", "fp16", "fp32"], default="bf16")
|
| 155 |
+
parser.add_argument("--limit", type=int, default=0)
|
| 156 |
+
parser.add_argument("--overwrite", action="store_true")
|
| 157 |
+
parser.add_argument("--merge-only", action="store_true")
|
| 158 |
+
return parser.parse_args()
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
def main() -> None:
|
| 162 |
+
args = parse_args()
|
| 163 |
+
if args.merge_only:
|
| 164 |
+
merge_splits(args.cache_root, args.splits)
|
| 165 |
+
return
|
| 166 |
+
|
| 167 |
+
from transformers import T5TokenizerFast, UMT5EncoderModel
|
| 168 |
+
|
| 169 |
+
torch.set_num_threads(max(1, int(os.environ.get("OMP_NUM_THREADS", "1"))))
|
| 170 |
+
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
| 171 |
+
text_dtype = dtype_from_name(args.text_dtype)
|
| 172 |
+
tokenizer = T5TokenizerFast.from_pretrained(args.text_model_root / "tokenizer", local_files_only=True)
|
| 173 |
+
text_encoder = UMT5EncoderModel.from_pretrained(
|
| 174 |
+
args.text_model_root / "text_encoder",
|
| 175 |
+
torch_dtype=text_dtype,
|
| 176 |
+
local_files_only=True,
|
| 177 |
+
).eval().to(device)
|
| 178 |
+
text_encoder.requires_grad_(False)
|
| 179 |
+
|
| 180 |
+
for split in args.splits:
|
| 181 |
+
process_split(args, split, tokenizer, text_encoder, device)
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
if __name__ == "__main__":
|
| 185 |
+
main()
|
raw_pants_train_test/metadata/pants-captions-ldm/code/cache/run_pants_wan22_cache_8gpu.sh
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
PROJECT_ROOT=/scratch/user/yuhwang/dataset/pants-captions-ldm
|
| 5 |
+
PANTS_ROOT=/scratch/user/yuhwang/dataset/PanTS/data
|
| 6 |
+
MODEL_PATH=/scratch/user/yuhwang/model/hf-cache/models--Wan-AI--Wan2.2-TI2V-5B-Diffusers/snapshots/b8fff7315c768468a5333511427288870b2e9635
|
| 7 |
+
OUTPUT_ROOT=${PROJECT_ROOT}/cache/wan22_pants_v2_softwin
|
| 8 |
+
SCRIPT=${PROJECT_ROOT}/code/cache/pants_wan22_cache.py
|
| 9 |
+
LOG_DIR=${PROJECT_ROOT}/cache/logs
|
| 10 |
+
LOG=${LOG_DIR}/wan22_pants_v2_softwin_$(date +%Y%m%d_%H%M%S).log
|
| 11 |
+
|
| 12 |
+
mkdir -p "${LOG_DIR}"
|
| 13 |
+
cd "${PROJECT_ROOT}"
|
| 14 |
+
|
| 15 |
+
set +e
|
| 16 |
+
srun --jobid=524904 --overlap \
|
| 17 |
+
--nodes=1 --ntasks=8 --cpus-per-task=20 \
|
| 18 |
+
bash -lc '
|
| 19 |
+
source ~/.twoframe_env.sh >/dev/null 2>&1 || true
|
| 20 |
+
conda activate /scratch/user/yuhwang/envs/twoframe >/dev/null 2>&1 || true
|
| 21 |
+
export CUDA_VISIBLE_DEVICES=${SLURM_LOCALID}
|
| 22 |
+
export OMP_NUM_THREADS=8
|
| 23 |
+
export HF_HOME=/scratch/user/yuhwang/model/hf-cache
|
| 24 |
+
python '"${SCRIPT}"' \
|
| 25 |
+
--pants-root '"${PANTS_ROOT}"' \
|
| 26 |
+
--project-root '"${PROJECT_ROOT}"' \
|
| 27 |
+
--model-path '"${MODEL_PATH}"' \
|
| 28 |
+
--output-root '"${OUTPUT_ROOT}"' \
|
| 29 |
+
--splits train,val,test \
|
| 30 |
+
--rank ${SLURM_PROCID} \
|
| 31 |
+
--world-size ${SLURM_NTASKS} \
|
| 32 |
+
--num-threads 8
|
| 33 |
+
' 2>&1 | tee -a "${LOG}"
|
| 34 |
+
status=${PIPESTATUS[0]}
|
| 35 |
+
set -e
|
| 36 |
+
|
| 37 |
+
source ~/.twoframe_env.sh >/dev/null 2>&1 || true
|
| 38 |
+
conda activate /scratch/user/yuhwang/envs/twoframe >/dev/null 2>&1 || true
|
| 39 |
+
python "${SCRIPT}" --output-root "${OUTPUT_ROOT}" --merge-only 2>&1 | tee -a "${LOG}"
|
| 40 |
+
|
| 41 |
+
echo "cache run finished with status ${status}; log=${LOG}" | tee -a "${LOG}"
|
| 42 |
+
exit "${status}"
|
raw_pants_train_test/metadata/pants-captions-ldm/code/cache/run_pants_wan22_finetune_fullrep_8gpu.sh
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
JOB_ID=${JOB_ID:-524904}
|
| 5 |
+
NUM_GPUS=${NUM_GPUS:-8}
|
| 6 |
+
CODE_DIR=${CODE_DIR:-/scratch/user/yuhwang/code/FastVideo}
|
| 7 |
+
MODEL_PATH=${MODEL_PATH:-/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged}
|
| 8 |
+
DATA_DIR=${DATA_DIR:-/scratch/user/yuhwang/dataset/pants-captions-ldm/cache/wan22_pants_v2_softwin}
|
| 9 |
+
OUT_ROOT=${OUT_ROOT:-/scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune}
|
| 10 |
+
RUN_NAME=${RUN_NAME:-pants_wan22_fullrep_b16_$(date +%Y%m%d_%H%M%S)}
|
| 11 |
+
OUTPUT_DIR=${OUTPUT_DIR:-${OUT_ROOT}/${RUN_NAME}}
|
| 12 |
+
|
| 13 |
+
TRAIN_BATCH_SIZE=${TRAIN_BATCH_SIZE:-16}
|
| 14 |
+
MAX_TRAIN_STEPS=${MAX_TRAIN_STEPS:-3300}
|
| 15 |
+
CHECKPOINT_STEPS=${CHECKPOINT_STEPS:-1650}
|
| 16 |
+
LEARNING_RATE=${LEARNING_RATE:-1e-6}
|
| 17 |
+
DATALOADER_NUM_WORKERS=${DATALOADER_NUM_WORKERS:-2}
|
| 18 |
+
GRADIENT_ACCUMULATION_STEPS=${GRADIENT_ACCUMULATION_STEPS:-1}
|
| 19 |
+
EMA_DECAY=${EMA_DECAY:-0.999}
|
| 20 |
+
TRAINING_CFG_RATE=${TRAINING_CFG_RATE:-0.05}
|
| 21 |
+
MAX_GRAD_NORM=${MAX_GRAD_NORM:-1.0}
|
| 22 |
+
|
| 23 |
+
mkdir -p "${OUTPUT_DIR}"
|
| 24 |
+
|
| 25 |
+
srun --jobid="${JOB_ID}" --overlap \
|
| 26 |
+
--nodes=1 --ntasks=1 --cpus-per-task=96 \
|
| 27 |
+
--gres=gpu:nvidia_h200:${NUM_GPUS} \
|
| 28 |
+
bash -lc '
|
| 29 |
+
set -euo pipefail
|
| 30 |
+
source ~/.twoframe_env.sh >/dev/null 2>&1 || true
|
| 31 |
+
ENV_DIR=${ENV_DIR:-/scratch/user/yuhwang/envs/twoframe}
|
| 32 |
+
export PATH="${ENV_DIR}/bin:${PATH}"
|
| 33 |
+
TORCHRUN_BIN=${TORCHRUN_BIN:-${ENV_DIR}/bin/torchrun}
|
| 34 |
+
cd '"${CODE_DIR}"'
|
| 35 |
+
|
| 36 |
+
export PYTHONPATH='"${CODE_DIR}"':${PYTHONPATH:-}
|
| 37 |
+
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
|
| 38 |
+
export TOKENIZERS_PARALLELISM=false
|
| 39 |
+
export WANDB_MODE=offline
|
| 40 |
+
export FASTVIDEO_ATTENTION_BACKEND=TORCH_SDPA
|
| 41 |
+
unset FASTVIDEO_SKIP_FINAL_CHECKPOINT
|
| 42 |
+
|
| 43 |
+
export TMPDIR=${TMPDIR:-/tmp/fv_'"${JOB_ID}"'}
|
| 44 |
+
mkdir -p "${TMPDIR}" '"${OUTPUT_DIR}"'
|
| 45 |
+
|
| 46 |
+
(
|
| 47 |
+
while true; do
|
| 48 |
+
date "+MEM_TS %Y-%m-%d %H:%M:%S"
|
| 49 |
+
nvidia-smi --query-gpu=index,memory.used,utilization.gpu --format=csv,noheader,nounits | sed "s/^/GPU /"
|
| 50 |
+
sleep 60
|
| 51 |
+
done
|
| 52 |
+
) > '"${OUTPUT_DIR}"'/gpu_monitor.log 2>&1 &
|
| 53 |
+
MONITOR_PID=$!
|
| 54 |
+
trap "kill ${MONITOR_PID} >/dev/null 2>&1 || true" EXIT
|
| 55 |
+
|
| 56 |
+
"${TORCHRUN_BIN}" --standalone --nnodes 1 --nproc_per_node '"${NUM_GPUS}"' \
|
| 57 |
+
fastvideo/training/wan_training_pipeline.py \
|
| 58 |
+
--model_path '"${MODEL_PATH}"' \
|
| 59 |
+
--pretrained_model_name_or_path '"${MODEL_PATH}"' \
|
| 60 |
+
--inference_mode False \
|
| 61 |
+
--data_path '"${DATA_DIR}"' \
|
| 62 |
+
--train_batch_size '"${TRAIN_BATCH_SIZE}"' \
|
| 63 |
+
--num_latent_t 39 \
|
| 64 |
+
--sp_size 1 \
|
| 65 |
+
--tp_size 1 \
|
| 66 |
+
--hsdp_replicate_dim 8 \
|
| 67 |
+
--hsdp_shard_dim 1 \
|
| 68 |
+
--num_gpus '"${NUM_GPUS}"' \
|
| 69 |
+
--train_sp_batch_size 1 \
|
| 70 |
+
--dataloader_num_workers '"${DATALOADER_NUM_WORKERS}"' \
|
| 71 |
+
--gradient_accumulation_steps '"${GRADIENT_ACCUMULATION_STEPS}"' \
|
| 72 |
+
--max_train_steps '"${MAX_TRAIN_STEPS}"' \
|
| 73 |
+
--learning_rate '"${LEARNING_RATE}"' \
|
| 74 |
+
--lr_scheduler constant \
|
| 75 |
+
--lr_warmup_steps 0 \
|
| 76 |
+
--mixed_precision bf16 \
|
| 77 |
+
--training_state_checkpointing_steps '"${CHECKPOINT_STEPS}"' \
|
| 78 |
+
--checkpoints_total_limit 2 \
|
| 79 |
+
--ema_decay '"${EMA_DECAY}"' \
|
| 80 |
+
--ema_start_step 1 \
|
| 81 |
+
--use_ema True \
|
| 82 |
+
--training_cfg_rate '"${TRAINING_CFG_RATE}"' \
|
| 83 |
+
--output_dir '"${OUTPUT_DIR}"' \
|
| 84 |
+
--tracker_project_name pants_wan22_fullrep \
|
| 85 |
+
--wandb_run_name '"${RUN_NAME}"' \
|
| 86 |
+
--num_height 320 \
|
| 87 |
+
--num_width 288 \
|
| 88 |
+
--num_frames 153 \
|
| 89 |
+
--num_euler_timesteps 50 \
|
| 90 |
+
--weight_decay 0.01 \
|
| 91 |
+
--dit_precision fp32 \
|
| 92 |
+
--max_grad_norm '"${MAX_GRAD_NORM}"' \
|
| 93 |
+
--enable_gradient_checkpointing_type full
|
| 94 |
+
'
|
| 95 |
+
|
| 96 |
+
echo "${OUTPUT_DIR}"
|
raw_pants_train_test/metadata/pants-captions-ldm/code/cache/run_pants_wan22_finetune_fullrep_8gpu_node.sh
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
JOB_ID=${JOB_ID:-524904}
|
| 5 |
+
NUM_GPUS=${NUM_GPUS:-8}
|
| 6 |
+
CODE_DIR=${CODE_DIR:-/scratch/user/yuhwang/code/FastVideo}
|
| 7 |
+
MODEL_PATH=${MODEL_PATH:-/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged}
|
| 8 |
+
DATA_DIR=${DATA_DIR:-/scratch/user/yuhwang/dataset/pants-captions-ldm/cache/wan22_pants_v2_softwin}
|
| 9 |
+
OUT_ROOT=${OUT_ROOT:-/scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune}
|
| 10 |
+
RUN_NAME=${RUN_NAME:-pants_wan22_fullrep_b16_node_$(date +%Y%m%d_%H%M%S)}
|
| 11 |
+
OUTPUT_DIR=${OUTPUT_DIR:-${OUT_ROOT}/${RUN_NAME}}
|
| 12 |
+
|
| 13 |
+
TRAIN_BATCH_SIZE=${TRAIN_BATCH_SIZE:-16}
|
| 14 |
+
MAX_TRAIN_STEPS=${MAX_TRAIN_STEPS:-3300}
|
| 15 |
+
CHECKPOINT_STEPS=${CHECKPOINT_STEPS:-1650}
|
| 16 |
+
LEARNING_RATE=${LEARNING_RATE:-1e-6}
|
| 17 |
+
DATALOADER_NUM_WORKERS=${DATALOADER_NUM_WORKERS:-2}
|
| 18 |
+
GRADIENT_ACCUMULATION_STEPS=${GRADIENT_ACCUMULATION_STEPS:-1}
|
| 19 |
+
EMA_DECAY=${EMA_DECAY:-0.999}
|
| 20 |
+
TRAINING_CFG_RATE=${TRAINING_CFG_RATE:-0.05}
|
| 21 |
+
MAX_GRAD_NORM=${MAX_GRAD_NORM:-1.0}
|
| 22 |
+
|
| 23 |
+
source ~/.twoframe_env.sh >/dev/null 2>&1 || true
|
| 24 |
+
ENV_DIR=${ENV_DIR:-/scratch/user/yuhwang/envs/twoframe}
|
| 25 |
+
export PATH="${ENV_DIR}/bin:${PATH}"
|
| 26 |
+
TORCHRUN_BIN=${TORCHRUN_BIN:-${ENV_DIR}/bin/torchrun}
|
| 27 |
+
|
| 28 |
+
cd "${CODE_DIR}"
|
| 29 |
+
mkdir -p "${OUTPUT_DIR}"
|
| 30 |
+
|
| 31 |
+
export PYTHONPATH="${CODE_DIR}:${PYTHONPATH:-}"
|
| 32 |
+
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
|
| 33 |
+
export TOKENIZERS_PARALLELISM=false
|
| 34 |
+
export WANDB_MODE=offline
|
| 35 |
+
export FASTVIDEO_ATTENTION_BACKEND=TORCH_SDPA
|
| 36 |
+
unset FASTVIDEO_SKIP_FINAL_CHECKPOINT
|
| 37 |
+
|
| 38 |
+
export TMPDIR=${TMPDIR:-/tmp/fv_${JOB_ID}}
|
| 39 |
+
mkdir -p "${TMPDIR}"
|
| 40 |
+
|
| 41 |
+
echo "HOSTNAME=$(hostname)"
|
| 42 |
+
echo "RUN_NAME=${RUN_NAME}"
|
| 43 |
+
echo "OUTPUT_DIR=${OUTPUT_DIR}"
|
| 44 |
+
echo "TRAIN_BATCH_SIZE=${TRAIN_BATCH_SIZE}"
|
| 45 |
+
echo "MAX_TRAIN_STEPS=${MAX_TRAIN_STEPS}"
|
| 46 |
+
echo "CHECKPOINT_STEPS=${CHECKPOINT_STEPS}"
|
| 47 |
+
echo "LEARNING_RATE=${LEARNING_RATE}"
|
| 48 |
+
nvidia-smi
|
| 49 |
+
|
| 50 |
+
(
|
| 51 |
+
while true; do
|
| 52 |
+
date "+MEM_TS %Y-%m-%d %H:%M:%S"
|
| 53 |
+
nvidia-smi --query-gpu=index,memory.used,utilization.gpu --format=csv,noheader,nounits | sed "s/^/GPU /"
|
| 54 |
+
sleep 60
|
| 55 |
+
done
|
| 56 |
+
) > "${OUTPUT_DIR}/gpu_monitor.log" 2>&1 &
|
| 57 |
+
MONITOR_PID=$!
|
| 58 |
+
trap 'kill "${MONITOR_PID}" >/dev/null 2>&1 || true' EXIT
|
| 59 |
+
|
| 60 |
+
"${TORCHRUN_BIN}" --standalone --nnodes 1 --nproc_per_node "${NUM_GPUS}" \
|
| 61 |
+
fastvideo/training/wan_training_pipeline.py \
|
| 62 |
+
--model_path "${MODEL_PATH}" \
|
| 63 |
+
--pretrained_model_name_or_path "${MODEL_PATH}" \
|
| 64 |
+
--inference_mode False \
|
| 65 |
+
--data_path "${DATA_DIR}" \
|
| 66 |
+
--train_batch_size "${TRAIN_BATCH_SIZE}" \
|
| 67 |
+
--num_latent_t 39 \
|
| 68 |
+
--sp_size 1 \
|
| 69 |
+
--tp_size 1 \
|
| 70 |
+
--hsdp_replicate_dim 8 \
|
| 71 |
+
--hsdp_shard_dim 1 \
|
| 72 |
+
--num_gpus "${NUM_GPUS}" \
|
| 73 |
+
--train_sp_batch_size 1 \
|
| 74 |
+
--dataloader_num_workers "${DATALOADER_NUM_WORKERS}" \
|
| 75 |
+
--gradient_accumulation_steps "${GRADIENT_ACCUMULATION_STEPS}" \
|
| 76 |
+
--max_train_steps "${MAX_TRAIN_STEPS}" \
|
| 77 |
+
--learning_rate "${LEARNING_RATE}" \
|
| 78 |
+
--lr_scheduler constant \
|
| 79 |
+
--lr_warmup_steps 0 \
|
| 80 |
+
--mixed_precision bf16 \
|
| 81 |
+
--training_state_checkpointing_steps "${CHECKPOINT_STEPS}" \
|
| 82 |
+
--checkpoints_total_limit 2 \
|
| 83 |
+
--ema_decay "${EMA_DECAY}" \
|
| 84 |
+
--ema_start_step 1 \
|
| 85 |
+
--use_ema True \
|
| 86 |
+
--training_cfg_rate "${TRAINING_CFG_RATE}" \
|
| 87 |
+
--output_dir "${OUTPUT_DIR}" \
|
| 88 |
+
--tracker_project_name pants_wan22_fullrep \
|
| 89 |
+
--wandb_run_name "${RUN_NAME}" \
|
| 90 |
+
--num_height 320 \
|
| 91 |
+
--num_width 288 \
|
| 92 |
+
--num_frames 153 \
|
| 93 |
+
--num_euler_timesteps 50 \
|
| 94 |
+
--weight_decay 0.01 \
|
| 95 |
+
--dit_precision fp32 \
|
| 96 |
+
--max_grad_norm "${MAX_GRAD_NORM}" \
|
| 97 |
+
--enable_gradient_checkpointing_type full
|
| 98 |
+
|
| 99 |
+
echo "${OUTPUT_DIR}"
|
raw_pants_train_test/metadata/pants-captions-ldm/code/cache/run_pants_wan22_finetune_smoke_8gpu.sh
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
JOB_ID=${JOB_ID:-524904}
|
| 5 |
+
NUM_GPUS=${NUM_GPUS:-8}
|
| 6 |
+
CODE_DIR=${CODE_DIR:-/scratch/user/yuhwang/code/FastVideo}
|
| 7 |
+
MODEL_PATH=${MODEL_PATH:-/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-merged}
|
| 8 |
+
DATA_DIR=${DATA_DIR:-/scratch/user/yuhwang/dataset/pants-captions-ldm/cache/wan22_pants_v2_softwin}
|
| 9 |
+
OUT_ROOT=${OUT_ROOT:-/scratch/user/yuhwang/artifacts/twoframe/pants_wan22_finetune}
|
| 10 |
+
RUN_NAME=${RUN_NAME:-smoke_$(date +%Y%m%d_%H%M%S)}
|
| 11 |
+
OUTPUT_DIR=${OUTPUT_DIR:-${OUT_ROOT}/${RUN_NAME}}
|
| 12 |
+
|
| 13 |
+
srun --jobid="${JOB_ID}" --overlap \
|
| 14 |
+
--nodes=1 --ntasks=1 --cpus-per-task=64 \
|
| 15 |
+
--gres=gpu:nvidia_h200:${NUM_GPUS} \
|
| 16 |
+
bash -lc '
|
| 17 |
+
set -euo pipefail
|
| 18 |
+
source ~/.twoframe_env.sh >/dev/null 2>&1 || true
|
| 19 |
+
conda activate /scratch/user/yuhwang/envs/twoframe
|
| 20 |
+
cd '"${CODE_DIR}"'
|
| 21 |
+
export PYTHONPATH='"${CODE_DIR}"':${PYTHONPATH:-}
|
| 22 |
+
export CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7
|
| 23 |
+
export TOKENIZERS_PARALLELISM=false
|
| 24 |
+
export WANDB_MODE=offline
|
| 25 |
+
export FASTVIDEO_ATTENTION_BACKEND=TORCH_SDPA
|
| 26 |
+
mkdir -p '"${OUTPUT_DIR}"'
|
| 27 |
+
|
| 28 |
+
torchrun --standalone --nnodes 1 --nproc_per_node '"${NUM_GPUS}"' \
|
| 29 |
+
fastvideo/training/wan_training_pipeline.py \
|
| 30 |
+
--model_path '"${MODEL_PATH}"' \
|
| 31 |
+
--pretrained_model_name_or_path '"${MODEL_PATH}"' \
|
| 32 |
+
--inference_mode False \
|
| 33 |
+
--data_path '"${DATA_DIR}"' \
|
| 34 |
+
--train_batch_size 1 \
|
| 35 |
+
--num_latent_t 39 \
|
| 36 |
+
--sp_size 8 \
|
| 37 |
+
--tp_size 1 \
|
| 38 |
+
--hsdp_replicate_dim 1 \
|
| 39 |
+
--hsdp_shard_dim 8 \
|
| 40 |
+
--num_gpus '"${NUM_GPUS}"' \
|
| 41 |
+
--train_sp_batch_size 1 \
|
| 42 |
+
--dataloader_num_workers 2 \
|
| 43 |
+
--gradient_accumulation_steps 1 \
|
| 44 |
+
--max_train_steps 1 \
|
| 45 |
+
--learning_rate 1e-6 \
|
| 46 |
+
--mixed_precision bf16 \
|
| 47 |
+
--training_state_checkpointing_steps 1000000 \
|
| 48 |
+
--checkpoints_total_limit 2 \
|
| 49 |
+
--ema_decay 0.999 \
|
| 50 |
+
--ema_start_step 1 \
|
| 51 |
+
--use_ema True \
|
| 52 |
+
--training_cfg_rate 0.05 \
|
| 53 |
+
--output_dir '"${OUTPUT_DIR}"' \
|
| 54 |
+
--tracker_project_name pants_wan22_smoke \
|
| 55 |
+
--num_height 320 \
|
| 56 |
+
--num_width 288 \
|
| 57 |
+
--num_frames 153 \
|
| 58 |
+
--num_euler_timesteps 50 \
|
| 59 |
+
--weight_decay 0.01 \
|
| 60 |
+
--dit_precision fp32 \
|
| 61 |
+
--max_grad_norm 1.0 \
|
| 62 |
+
--enable_gradient_checkpointing_type full
|
| 63 |
+
'
|
| 64 |
+
|
| 65 |
+
echo "${OUTPUT_DIR}"
|
raw_pants_train_test/metadata/pants-captions-ldm/code/cache/run_pants_wan22_text_cache_8gpu.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
set -euo pipefail
|
| 3 |
+
|
| 4 |
+
CACHE_ROOT=${CACHE_ROOT:-/scratch/user/yuhwang/dataset/pants-captions-ldm/cache/wan22_pants_v2_softwin}
|
| 5 |
+
TEXT_MODEL_ROOT=${TEXT_MODEL_ROOT:-/scratch/user/yuhwang/model/Wan2.2-TI2V-5B-Diffusers-text}
|
| 6 |
+
SCRIPT=${SCRIPT:-/scratch/user/yuhwang/dataset/pants-captions-ldm/code/cache/pants_wan22_text_cache.py}
|
| 7 |
+
PYTHON_BIN=${PYTHON_BIN:-/scratch/user/yuhwang/envs/twoframe/bin/python}
|
| 8 |
+
JOB_ID=${JOB_ID:-524904}
|
| 9 |
+
NTASKS=${NTASKS:-8}
|
| 10 |
+
CPUS_PER_TASK=${CPUS_PER_TASK:-12}
|
| 11 |
+
|
| 12 |
+
srun --jobid="${JOB_ID}" --overlap \
|
| 13 |
+
--nodes=1 --ntasks="${NTASKS}" --cpus-per-task="${CPUS_PER_TASK}" \
|
| 14 |
+
--gres=gpu:nvidia_h200:${NTASKS} \
|
| 15 |
+
bash -lc '
|
| 16 |
+
source ~/.twoframe_env.sh >/dev/null 2>&1 || true
|
| 17 |
+
conda activate /scratch/user/yuhwang/envs/twoframe
|
| 18 |
+
export CUDA_VISIBLE_DEVICES=${SLURM_LOCALID}
|
| 19 |
+
export OMP_NUM_THREADS='"${CPUS_PER_TASK}"'
|
| 20 |
+
'"${PYTHON_BIN}"' '"${SCRIPT}"' \
|
| 21 |
+
--cache-root '"${CACHE_ROOT}"' \
|
| 22 |
+
--text-model-root '"${TEXT_MODEL_ROOT}"' \
|
| 23 |
+
--splits source_train source_test \
|
| 24 |
+
--rank ${SLURM_PROCID} \
|
| 25 |
+
--world-size ${SLURM_NTASKS} \
|
| 26 |
+
--text-dtype bf16 \
|
| 27 |
+
--store-dtype bf16
|
| 28 |
+
'
|
| 29 |
+
|
| 30 |
+
"${PYTHON_BIN}" "${SCRIPT}" \
|
| 31 |
+
--cache-root "${CACHE_ROOT}" \
|
| 32 |
+
--text-model-root "${TEXT_MODEL_ROOT}" \
|
| 33 |
+
--splits source_train source_test \
|
| 34 |
+
--merge-only
|
raw_pants_train_test/metadata/pants-captions-ldm/code/caption_generation/canonical_facts.py
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Canonical facts extractor for PanTS.
|
| 3 |
+
|
| 4 |
+
For each case we produce a deterministic structured-fact dict from:
|
| 5 |
+
(1) metadata.xlsx — structured report + phase + demographics (ground truth, already curated by PanTS authors)
|
| 6 |
+
(2) 28-class mask geometry — lesion count / subregion / vessel contact / FOV / physical extents
|
| 7 |
+
things that the report text does not state explicitly.
|
| 8 |
+
|
| 9 |
+
Output: canonical_facts/{pid}.json (or one big jsonl)
|
| 10 |
+
|
| 11 |
+
This is the "ground truth" layer of the fusion pipeline:
|
| 12 |
+
canonical_facts + VLM visual phrases -> text LLM -> 5 caption variants
|
| 13 |
+
|
| 14 |
+
Run with:
|
| 15 |
+
python3 canonical_facts.py --ids all_ids.json --out canonical_facts.jsonl --workers 24
|
| 16 |
+
"""
|
| 17 |
+
import os, io, json, re, time, argparse, traceback
|
| 18 |
+
import numpy as np, nibabel as nib, pandas as pd
|
| 19 |
+
from concurrent.futures import ProcessPoolExecutor, as_completed
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
METADATA_XLSX = os.environ.get("PANTS_METADATA_XLSX", "./PanTS_data/metadata.xlsx")
|
| 23 |
+
DATA_ROOT = os.environ.get("PANTS_DATA_ROOT", "./PanTS_data")
|
| 24 |
+
|
| 25 |
+
# PanTS 28 class map
|
| 26 |
+
CLASS_MAP = {
|
| 27 |
+
1: 'adrenal_gland_left', 2: 'adrenal_gland_right', 3: 'aorta',
|
| 28 |
+
4: 'bladder', 5: 'celiac_artery', 6: 'colon', 7: 'common_bile_duct',
|
| 29 |
+
8: 'duodenum', 9: 'femur_left', 10: 'femur_right', 11: 'gall_bladder',
|
| 30 |
+
12: 'kidney_left', 13: 'kidney_right', 14: 'liver',
|
| 31 |
+
15: 'lung_left', 16: 'lung_right',
|
| 32 |
+
17: 'pancreas', 18: 'pancreas_body', 19: 'pancreas_head', 20: 'pancreas_tail',
|
| 33 |
+
21: 'pancreatic_duct', 22: 'postcava', 23: 'prostate', 24: 'spleen',
|
| 34 |
+
25: 'stomach', 26: 'superior_mesenteric_artery', 27: 'veins',
|
| 35 |
+
28: 'pancreatic_lesion',
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
# ---------- report parsing ----------
|
| 40 |
+
|
| 41 |
+
def _clean(txt):
|
| 42 |
+
if txt is None:
|
| 43 |
+
return ""
|
| 44 |
+
return str(txt).replace('_x000D_', '').replace('\r', '').strip()
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
_FLOAT = r"(-?\d+(?:\.\d+)?)"
|
| 48 |
+
|
| 49 |
+
_LESION_BLOCK = re.compile(
|
| 50 |
+
r"Pancreas lesion\s*\d+:\s*\n"
|
| 51 |
+
r"Location:\s*([^\n\.]+)\.\s*\n"
|
| 52 |
+
r"Size:\s*" + _FLOAT + r"\s*x\s*" + _FLOAT + r"\s*cm\s*\(image\s*(\d+)\)\.\s*Volume:\s*" + _FLOAT + r"\s*cc\.\s*\n"
|
| 53 |
+
r"Enhancement relative to pancreas:\s*([^\s\(]+)\s*\(HU value is\s*" + _FLOAT + r"\+/-\s*" + _FLOAT + r"\)\.",
|
| 54 |
+
re.IGNORECASE,
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
_ORGAN_NORMALCY = re.compile(
|
| 58 |
+
r"^([A-Z][a-z]+):\s*\n(Normal size|[A-Z][a-z]+ is\s+[a-z ]+)\s*\(volume:\s*" + _FLOAT + r"\s*cc\)",
|
| 59 |
+
re.MULTILINE,
|
| 60 |
+
)
|
| 61 |
+
|
| 62 |
+
_HU = re.compile(r"Mean HU value:\s*" + _FLOAT + r"\s*\+/-\s*" + _FLOAT)
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def parse_structured_report(raw):
|
| 66 |
+
"""Parse the PanTS structured report text into a dict of canonical facts.
|
| 67 |
+
Returns None if not parseable."""
|
| 68 |
+
txt = _clean(raw)
|
| 69 |
+
if not txt:
|
| 70 |
+
return None
|
| 71 |
+
|
| 72 |
+
out = {"raw_report": txt}
|
| 73 |
+
# organ sizes
|
| 74 |
+
for m in re.finditer(
|
| 75 |
+
r"^(Spleen|Liver|Pancreas|Kidney):\s*\n([^\n]+)\s*\n", txt, re.MULTILINE):
|
| 76 |
+
organ = m.group(1).lower()
|
| 77 |
+
line = m.group(2).strip()
|
| 78 |
+
size_word = None
|
| 79 |
+
if line.startswith("Normal size"):
|
| 80 |
+
size_word = "normal"
|
| 81 |
+
elif "massively enlarged" in line.lower():
|
| 82 |
+
size_word = "massively_enlarged"
|
| 83 |
+
elif "enlarged" in line.lower():
|
| 84 |
+
size_word = "enlarged"
|
| 85 |
+
elif "atrophic" in line.lower():
|
| 86 |
+
size_word = "atrophic"
|
| 87 |
+
elif "small" in line.lower():
|
| 88 |
+
size_word = "small"
|
| 89 |
+
vol_m = re.search(r"volume:\s*" + _FLOAT + r"\s*cc", line)
|
| 90 |
+
out.setdefault("organ_status", {})[organ] = {
|
| 91 |
+
"size": size_word,
|
| 92 |
+
"volume_cc": float(vol_m.group(1)) if vol_m else None,
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
# HU per organ (look for Mean HU value after each organ heading)
|
| 96 |
+
out.setdefault("organ_status", {})
|
| 97 |
+
for organ_key in ("Spleen", "Liver", "Pancreas", "Kidney"):
|
| 98 |
+
sec = re.search(
|
| 99 |
+
rf"{organ_key}:\s*\n[\s\S]+?Mean HU value:\s*" + _FLOAT + r"\s*\+/-\s*" + _FLOAT,
|
| 100 |
+
txt,
|
| 101 |
+
)
|
| 102 |
+
if sec:
|
| 103 |
+
st = out["organ_status"].setdefault(organ_key.lower(), {})
|
| 104 |
+
st["hu_mean"] = float(sec.group(1))
|
| 105 |
+
st["hu_sd"] = float(sec.group(2))
|
| 106 |
+
|
| 107 |
+
# lesions
|
| 108 |
+
lesions = []
|
| 109 |
+
for m in _LESION_BLOCK.finditer(txt):
|
| 110 |
+
loc, sx, sy, img_no, vol, enh, hu_m, hu_sd = m.groups()
|
| 111 |
+
lesions.append({
|
| 112 |
+
"location": loc.strip().lower(), # "pancreas head", "pancreas body/tail", etc
|
| 113 |
+
"size_cm": [float(sx), float(sy)],
|
| 114 |
+
"image_no": int(img_no),
|
| 115 |
+
"volume_cc": float(vol),
|
| 116 |
+
"enhancement": enh.strip().lower(), # hypo/iso/hyper-attenuating
|
| 117 |
+
"hu_mean": float(hu_m),
|
| 118 |
+
"hu_sd": float(hu_sd),
|
| 119 |
+
})
|
| 120 |
+
out["lesions"] = lesions
|
| 121 |
+
out["lesion_present"] = len(lesions) > 0
|
| 122 |
+
|
| 123 |
+
# impression
|
| 124 |
+
imp = re.search(r"IMPRESSION:\s*\n([\s\S]+?)$", txt)
|
| 125 |
+
if imp:
|
| 126 |
+
out["impression"] = imp.group(1).strip()
|
| 127 |
+
return out
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
# ---------- mask geometry ----------
|
| 131 |
+
|
| 132 |
+
def _canon(path):
|
| 133 |
+
img = nib.as_closest_canonical(nib.load(path))
|
| 134 |
+
return img.get_fdata(), img.header.get_zooms()[:3], img.affine
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
def _bbox(mask):
|
| 138 |
+
if not mask.any():
|
| 139 |
+
return None
|
| 140 |
+
xs, ys, zs = np.where(mask)
|
| 141 |
+
return {
|
| 142 |
+
"x": [int(xs.min()), int(xs.max())],
|
| 143 |
+
"y": [int(ys.min()), int(ys.max())],
|
| 144 |
+
"z": [int(zs.min()), int(zs.max())],
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
def _dilate_one(mask):
|
| 149 |
+
"""Dilate by 1 voxel in all 6 axial neighbors."""
|
| 150 |
+
out = mask.copy()
|
| 151 |
+
for ax in range(3):
|
| 152 |
+
out |= np.roll(mask, 1, ax)
|
| 153 |
+
out |= np.roll(mask, -1, ax)
|
| 154 |
+
return out
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
def connected_components_3d(mask):
|
| 158 |
+
"""Return N, labeled array (simple 6-connected)."""
|
| 159 |
+
from scipy.ndimage import label
|
| 160 |
+
lab, n = label(mask, structure=np.ones((3, 3, 3), dtype=np.uint8))
|
| 161 |
+
return n, lab
|
| 162 |
+
|
| 163 |
+
|
| 164 |
+
def _fov_class(lbl, sp):
|
| 165 |
+
"""Classify scan FOV: chest / abdomen / abdomen-pelvis / whole-body.
|
| 166 |
+
Use presence of lung (15,16) and femur (9,10)."""
|
| 167 |
+
has_lung = ((lbl == 15) | (lbl == 16)).any()
|
| 168 |
+
has_femur = ((lbl == 9) | (lbl == 10)).any()
|
| 169 |
+
has_pelvis = ((lbl == 4) | (lbl == 23)).any()
|
| 170 |
+
z_mm = lbl.shape[2] * sp[2]
|
| 171 |
+
if has_lung and has_femur:
|
| 172 |
+
return "whole_body"
|
| 173 |
+
if has_lung and has_pelvis:
|
| 174 |
+
return "chest_abdomen_pelvis"
|
| 175 |
+
if has_lung:
|
| 176 |
+
return "chest_abdomen"
|
| 177 |
+
if has_pelvis:
|
| 178 |
+
return "abdomen_pelvis"
|
| 179 |
+
return "abdomen_only"
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
def mask_facts(pid):
|
| 183 |
+
"""Load combined_labels, produce mask-derived facts (things the report doesn't list)."""
|
| 184 |
+
for split in ("LabelTr", "LabelTe"):
|
| 185 |
+
p = f"{DATA_ROOT}/{split}/{pid}/combined_labels.nii.gz"
|
| 186 |
+
if os.path.exists(p):
|
| 187 |
+
lbl, sp, _ = _canon(p)
|
| 188 |
+
break
|
| 189 |
+
else:
|
| 190 |
+
return {"error": f"labels not found for {pid}"}
|
| 191 |
+
|
| 192 |
+
lbl = lbl.astype(np.int16)
|
| 193 |
+
sp = tuple(float(x) for x in sp)
|
| 194 |
+
vox_cc = float(sp[0] * sp[1] * sp[2]) / 1000.0 # mm^3 -> cc
|
| 195 |
+
|
| 196 |
+
out = {"spacing": list(sp), "shape": list(lbl.shape), "voxel_cc": round(vox_cc, 4)}
|
| 197 |
+
|
| 198 |
+
# Organ presence / volume
|
| 199 |
+
organ_vol = {}
|
| 200 |
+
for cid, name in CLASS_MAP.items():
|
| 201 |
+
if cid == 28:
|
| 202 |
+
continue # lesion handled separately
|
| 203 |
+
m = (lbl == cid)
|
| 204 |
+
if m.any():
|
| 205 |
+
organ_vol[name] = round(float(m.sum()) * vox_cc, 1)
|
| 206 |
+
out["organ_volume_cc"] = organ_vol
|
| 207 |
+
|
| 208 |
+
# FOV
|
| 209 |
+
out["fov"] = _fov_class(lbl, sp)
|
| 210 |
+
out["z_physical_mm"] = round(lbl.shape[2] * sp[2], 1)
|
| 211 |
+
|
| 212 |
+
# Pancreas + lesion geometry (union of class 17 and 18/19/20 subregions)
|
| 213 |
+
pan = (lbl == 17) | (lbl == 18) | (lbl == 19) | (lbl == 20)
|
| 214 |
+
out["pancreas_present"] = bool(pan.any())
|
| 215 |
+
if pan.any():
|
| 216 |
+
out["pancreas_bbox"] = _bbox(pan)
|
| 217 |
+
out["organ_volume_cc"]["pancreas"] = round(float(pan.sum()) * vox_cc, 1)
|
| 218 |
+
|
| 219 |
+
lesion = (lbl == 28)
|
| 220 |
+
out["mask_lesion_present"] = bool(lesion.any())
|
| 221 |
+
if lesion.any():
|
| 222 |
+
n_cc, lab_arr = connected_components_3d(lesion)
|
| 223 |
+
out["lesion_count"] = int(n_cc)
|
| 224 |
+
# per-component
|
| 225 |
+
comps = []
|
| 226 |
+
for cid in range(1, n_cc + 1):
|
| 227 |
+
m = (lab_arr == cid)
|
| 228 |
+
vol = float(m.sum()) * vox_cc
|
| 229 |
+
if vol < 0.05: # <0.05 cc, ignore
|
| 230 |
+
continue
|
| 231 |
+
bb = _bbox(m)
|
| 232 |
+
# which pancreas subregion dominates this lesion
|
| 233 |
+
sub_overlap = {}
|
| 234 |
+
for sid in (18, 19, 20):
|
| 235 |
+
dil = _dilate_one(m)
|
| 236 |
+
v = int(((lbl == sid) & dil).sum())
|
| 237 |
+
sub_overlap[CLASS_MAP[sid]] = v
|
| 238 |
+
dom = max(sub_overlap, key=sub_overlap.get) if sum(sub_overlap.values()) > 0 else None
|
| 239 |
+
# vessel contact (1-voxel dilated lesion ∩ vessels)
|
| 240 |
+
dil = _dilate_one(m)
|
| 241 |
+
vessel_contact = {}
|
| 242 |
+
for vid in (3, 5, 22, 26, 27): # aorta, celiac, postcava, SMA, veins
|
| 243 |
+
touch = int(((lbl == vid) & dil).sum())
|
| 244 |
+
if touch > 0:
|
| 245 |
+
vessel_contact[CLASS_MAP[vid]] = touch
|
| 246 |
+
# bile duct contact
|
| 247 |
+
for vid in (7, 21):
|
| 248 |
+
touch = int(((lbl == vid) & dil).sum())
|
| 249 |
+
if touch > 0:
|
| 250 |
+
vessel_contact[CLASS_MAP[vid]] = touch
|
| 251 |
+
comps.append({
|
| 252 |
+
"volume_cc": round(vol, 2),
|
| 253 |
+
"bbox": bb,
|
| 254 |
+
"subregion_dominant": dom,
|
| 255 |
+
"subregion_overlap_vox": sub_overlap,
|
| 256 |
+
"contact": vessel_contact,
|
| 257 |
+
})
|
| 258 |
+
comps.sort(key=lambda c: -c["volume_cc"])
|
| 259 |
+
out["lesion_components"] = comps
|
| 260 |
+
else:
|
| 261 |
+
out["lesion_count"] = 0
|
| 262 |
+
|
| 263 |
+
# Post-op heuristic: total label volume check + stomach/colon bbox check
|
| 264 |
+
# (too crude without report; we just record gall_bladder / spleen / prostate presence)
|
| 265 |
+
out["gallbladder_present"] = bool((lbl == 11).any())
|
| 266 |
+
|
| 267 |
+
return out
|
| 268 |
+
|
| 269 |
+
|
| 270 |
+
# ---------- main extractor ----------
|
| 271 |
+
|
| 272 |
+
def extract_one(pid, report_df):
|
| 273 |
+
try:
|
| 274 |
+
row = report_df.loc[report_df["PanTS ID"] == pid]
|
| 275 |
+
if len(row) == 0:
|
| 276 |
+
return {"id": pid, "error": "not in metadata"}
|
| 277 |
+
r = row.iloc[0]
|
| 278 |
+
|
| 279 |
+
fact = {
|
| 280 |
+
"id": pid,
|
| 281 |
+
"phase": str(r.get("ct phase")) if pd.notna(r.get("ct phase")) else None,
|
| 282 |
+
"sex": str(r.get("sex")) if pd.notna(r.get("sex")) else None,
|
| 283 |
+
"age": float(r["age"]) if pd.notna(r.get("age")) else None,
|
| 284 |
+
"manufacturer": str(r.get("manufacturer")) if pd.notna(r.get("manufacturer")) else None,
|
| 285 |
+
"model": str(r.get("manufacturer model")) if pd.notna(r.get("manufacturer model")) else None,
|
| 286 |
+
"study_type": str(r.get("study type")) if pd.notna(r.get("study type")) else None,
|
| 287 |
+
"tumor_flag": int(r["tumor?"]) if pd.notna(r.get("tumor?")) else None,
|
| 288 |
+
}
|
| 289 |
+
fact["report"] = parse_structured_report(r.get("structured report"))
|
| 290 |
+
fact["mask"] = mask_facts(pid)
|
| 291 |
+
|
| 292 |
+
# consolidated top-level flags (the ones V1-V5 fusion prompts will read)
|
| 293 |
+
rep = fact["report"] or {}
|
| 294 |
+
msk = fact["mask"] or {}
|
| 295 |
+
# Report is authoritative for lesion_present (determines caption content).
|
| 296 |
+
# Mask-only (report says no lesion but class 28 has voxels) is flagged but NOT treated
|
| 297 |
+
# as lesion+ because we lack size/subregion/enhancement to put in the caption.
|
| 298 |
+
rep_has_lesion = bool(rep.get("lesion_present"))
|
| 299 |
+
msk_has_lesion = bool(msk.get("mask_lesion_present", False))
|
| 300 |
+
fact["canonical"] = {
|
| 301 |
+
"lesion_present": rep_has_lesion, # authoritative from report
|
| 302 |
+
"lesion_present_mask_only": (not rep_has_lesion) and msk_has_lesion,
|
| 303 |
+
"lesion_present_report_only": rep_has_lesion and not msk_has_lesion,
|
| 304 |
+
"lesion_count_mask": msk.get("lesion_count", 0),
|
| 305 |
+
"lesion_count_report": len(rep.get("lesions") or []),
|
| 306 |
+
"lesion_list": rep.get("lesions") or [],
|
| 307 |
+
"lesion_components_mask": msk.get("lesion_components") or [],
|
| 308 |
+
"organ_status_report": rep.get("organ_status") or {},
|
| 309 |
+
"impression": rep.get("impression") or "",
|
| 310 |
+
"fov": msk.get("fov"),
|
| 311 |
+
"phase": fact["phase"],
|
| 312 |
+
"sex": fact["sex"],
|
| 313 |
+
"age": fact["age"],
|
| 314 |
+
"manufacturer": fact["manufacturer"],
|
| 315 |
+
"model": fact["model"],
|
| 316 |
+
"study_type": fact["study_type"],
|
| 317 |
+
"pancreas_volume_cc": msk.get("organ_volume_cc", {}).get("pancreas"),
|
| 318 |
+
"gallbladder_present": msk.get("gallbladder_present", None),
|
| 319 |
+
"z_physical_mm": msk.get("z_physical_mm"),
|
| 320 |
+
}
|
| 321 |
+
return fact
|
| 322 |
+
except Exception as e:
|
| 323 |
+
return {"id": pid, "error": f"{type(e).__name__}: {e}", "tb": traceback.format_exc()[-400:]}
|
| 324 |
+
|
| 325 |
+
|
| 326 |
+
def main():
|
| 327 |
+
ap = argparse.ArgumentParser()
|
| 328 |
+
ap.add_argument("--ids", required=True)
|
| 329 |
+
ap.add_argument("--out", required=True)
|
| 330 |
+
ap.add_argument("--workers", type=int, default=16)
|
| 331 |
+
ap.add_argument("--resume", action="store_true", default=True)
|
| 332 |
+
args = ap.parse_args()
|
| 333 |
+
|
| 334 |
+
ids = json.load(open(args.ids))
|
| 335 |
+
df = pd.read_excel(METADATA_XLSX)
|
| 336 |
+
|
| 337 |
+
done = set()
|
| 338 |
+
if args.resume and os.path.exists(args.out):
|
| 339 |
+
with open(args.out) as f:
|
| 340 |
+
for line in f:
|
| 341 |
+
try:
|
| 342 |
+
d = json.loads(line)
|
| 343 |
+
if "error" not in d:
|
| 344 |
+
done.add(d["id"])
|
| 345 |
+
except Exception:
|
| 346 |
+
pass
|
| 347 |
+
print(f"resume: {len(done)} already done")
|
| 348 |
+
todo = [i for i in ids if i not in done]
|
| 349 |
+
print(f"total={len(ids)} todo={len(todo)} workers={args.workers}")
|
| 350 |
+
|
| 351 |
+
os.makedirs(os.path.dirname(args.out) or ".", exist_ok=True)
|
| 352 |
+
fp = open(args.out, "a", buffering=1)
|
| 353 |
+
|
| 354 |
+
t0 = time.time()
|
| 355 |
+
ok = err = 0
|
| 356 |
+
with ProcessPoolExecutor(max_workers=args.workers) as ex:
|
| 357 |
+
# pass df via initializer — but df is only 9901 rows so cheap to pickle per task
|
| 358 |
+
futs = {ex.submit(extract_one, pid, df): pid for pid in todo}
|
| 359 |
+
for i, fut in enumerate(as_completed(futs)):
|
| 360 |
+
r = fut.result()
|
| 361 |
+
fp.write(json.dumps(r, ensure_ascii=False) + "\n")
|
| 362 |
+
if "error" in r:
|
| 363 |
+
err += 1
|
| 364 |
+
else:
|
| 365 |
+
ok += 1
|
| 366 |
+
if (i + 1) % 200 == 0 or i == len(todo) - 1:
|
| 367 |
+
dt = time.time() - t0
|
| 368 |
+
rate = (i + 1) / max(dt, 1e-3)
|
| 369 |
+
eta = (len(todo) - i - 1) / max(rate, 1e-3)
|
| 370 |
+
print(f" {i+1}/{len(todo)} rate={rate:.1f}/s eta={eta/60:.1f}min ok={ok} err={err}")
|
| 371 |
+
fp.close()
|
| 372 |
+
print(f"done. ok={ok} err={err} wall={(time.time()-t0)/60:.1f}min")
|
| 373 |
+
|
| 374 |
+
|
| 375 |
+
if __name__ == "__main__":
|
| 376 |
+
main()
|
raw_pants_train_test/metadata/pants-captions-ldm/code/caption_generation/f5_audit.py
ADDED
|
@@ -0,0 +1,333 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
F5-QA: full-corpus audit of captions_full_v2.jsonl against canonical_facts.jsonl.
|
| 3 |
+
|
| 4 |
+
Checks per variant:
|
| 5 |
+
- fill: text non-empty
|
| 6 |
+
- length band: variant-specific word-count window
|
| 7 |
+
- banned words (adenocarcinoma / TNM / stage / unresectable / etc.)
|
| 8 |
+
- lesion consistency:
|
| 9 |
+
canon lesion+ → text must contain a lesion word AND all canonical sizes should appear
|
| 10 |
+
canon lesion- → text must NOT contain an un-negated lesion word
|
| 11 |
+
- V6_negative: text must contain zero lesion tokens (even negated) — design contract
|
| 12 |
+
- number hallucination: any cm/mm dimension in text must exist in canonical sizes
|
| 13 |
+
- subregion echo: if canonical lesion has subregion (head/body/tail), text should mention it
|
| 14 |
+
- FOV echo (long variants only)
|
| 15 |
+
|
| 16 |
+
Outputs:
|
| 17 |
+
audit_report.md — human summary (per-variant pass rate, histogram, top issues)
|
| 18 |
+
qa_flagged.jsonl — one row per flagged (case, variant) with violations
|
| 19 |
+
"""
|
| 20 |
+
import os
|
| 21 |
+
import json, re, os, sys, statistics, collections
|
| 22 |
+
|
| 23 |
+
CAP = f"{os.environ.get('REPO_ROOT', '.')}/captions/captions_full_v2.jsonl"
|
| 24 |
+
CAN = f"{os.environ.get('REPO_ROOT', '.')}/canonical/canonical_facts.jsonl"
|
| 25 |
+
OUT_MD = f"{os.environ.get('REPO_ROOT', '.')}/audit_report.md"
|
| 26 |
+
OUT_FLAG = f"{os.environ.get('REPO_ROOT', '.')}/qa_flagged.jsonl"
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
BANNED = [
|
| 30 |
+
r"\badenocarcinoma\b", r"\bmalignan(t|cy|cies)\b", r"\bmetasta(sis|ses|tic)\b",
|
| 31 |
+
r"\bT[1-4][a-c]?\b", r"\bN[0-3]\b", r"\bM[01]\b",
|
| 32 |
+
r"\bunresectable\b", r"\bresectable\b",
|
| 33 |
+
r"\bstage\s*(I{1,3}V?|IV|[1-4])\b",
|
| 34 |
+
r"\bperineural invasion\b",
|
| 35 |
+
r"\bchemotherap(y|ies)\b",
|
| 36 |
+
]
|
| 37 |
+
BANNED_RE = re.compile("|".join(BANNED), re.IGNORECASE)
|
| 38 |
+
|
| 39 |
+
LESION_WORDS = re.compile(
|
| 40 |
+
r"\b(lesion|mass|tumor|tumou?r|nodule|cyst|neoplasm)s?\b", re.IGNORECASE)
|
| 41 |
+
# Pancreas-specific lesion mention: the canonical lesion_list is pancreas-only,
|
| 42 |
+
# so only flag hallucinations when the lesion word is bound to pancreas context.
|
| 43 |
+
PANC_LESION_RE = re.compile(
|
| 44 |
+
r"\b(pancreatic|pancreas|peripancreatic|ductal|intraductal|IPMN)\b[^\.]{0,80}?"
|
| 45 |
+
r"\b(lesion|mass|tumor|tumou?r|nodule|cyst|neoplasm)s?\b",
|
| 46 |
+
re.IGNORECASE)
|
| 47 |
+
# "X cyst" incidentals that must NOT count as hallucinated pancreas lesion
|
| 48 |
+
INCIDENTAL_CYST_RE = re.compile(
|
| 49 |
+
r"\b(renal|kidney|cortical|hepatic|liver|splenic|ovarian|bosniak|"
|
| 50 |
+
r"simple|parenchymal|adrenal)\b[^\.]{0,30}?\bcysts?\b",
|
| 51 |
+
re.IGNORECASE)
|
| 52 |
+
# Sentence-level negation cues. Must over-match to avoid false positives
|
| 53 |
+
# on "hallucinated" detector. Include morphological variants: absent/absence,
|
| 54 |
+
# negative/negativity, devoid, free_of, without, no/none, neither/nor, lack/lacking.
|
| 55 |
+
NEG_CUE = re.compile(
|
| 56 |
+
r"\b(no|none|without|free\s+of|devoid|absent|absence|lack|lacking|"
|
| 57 |
+
r"negativ\w*|no\s+evidence\s+of|no\s+sign\w*\s+of|unremarkable|neither|nor|"
|
| 58 |
+
r"not\s+\w+|rule[ds]?\s+out|exclud\w+)\b", re.IGNORECASE)
|
| 59 |
+
|
| 60 |
+
# match "1.2 x 3.4" or "2.4cm" or "14 mm"
|
| 61 |
+
DIM_RE = re.compile(
|
| 62 |
+
r"(?<![\d\.])(\d{1,3}(?:\.\d)?)\s*(?:x\s*\d{1,3}(?:\.\d)?\s*)?(cm|mm)\b",
|
| 63 |
+
re.IGNORECASE)
|
| 64 |
+
|
| 65 |
+
# permissible length bands (word count)
|
| 66 |
+
WORD_BAND = {
|
| 67 |
+
"V1_long_narrative": (120, 320),
|
| 68 |
+
"V2_terse_impression": (10, 50),
|
| 69 |
+
"V3_organ_bullet": (60, 180),
|
| 70 |
+
"V4_tag_string": (6, 35),
|
| 71 |
+
"V5_layered_findings": (80, 220),
|
| 72 |
+
"V6_negative_descriptive": (40, 150),
|
| 73 |
+
"V6_qa_pair": (20, 110),
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def has_unnegated_lesion(text):
|
| 78 |
+
"""True iff a pancreatic lesion word appears un-negated in some sentence.
|
| 79 |
+
Excludes incidental renal/hepatic/splenic cysts (those are VLM-reported,
|
| 80 |
+
not canonical_facts, but allowed to be mentioned since the caption is
|
| 81 |
+
descriptive, not a closed-set diagnosis)."""
|
| 82 |
+
sents = re.split(r"(?<=[\.\?!])\s+", text.strip())
|
| 83 |
+
for s in sents:
|
| 84 |
+
# explicit pancreatic lesion claim
|
| 85 |
+
if PANC_LESION_RE.search(s) and not NEG_CUE.search(s):
|
| 86 |
+
return True
|
| 87 |
+
# Also flag generic lesion/mass/tumor mention without any organ binding
|
| 88 |
+
# (i.e. "A large hypoattenuating mass is seen") but ignore incidental cysts
|
| 89 |
+
for s in sents:
|
| 90 |
+
if NEG_CUE.search(s):
|
| 91 |
+
continue
|
| 92 |
+
# strip out incidental-cyst phrases first
|
| 93 |
+
s_stripped = INCIDENTAL_CYST_RE.sub("", s)
|
| 94 |
+
m = LESION_WORDS.search(s_stripped)
|
| 95 |
+
if not m:
|
| 96 |
+
continue
|
| 97 |
+
# only flag if word is lesion/mass/tumor/neoplasm (strong claim),
|
| 98 |
+
# not a lone "cyst" without organ anchoring
|
| 99 |
+
if m.group(0).lower() in ("cyst", "cysts"):
|
| 100 |
+
continue
|
| 101 |
+
return True
|
| 102 |
+
return False
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def parse_dims_cm(text):
|
| 106 |
+
"""Return list of dims in cm (converting mm → cm)."""
|
| 107 |
+
out = []
|
| 108 |
+
for m in DIM_RE.finditer(text):
|
| 109 |
+
val = float(m.group(1))
|
| 110 |
+
unit = m.group(2).lower()
|
| 111 |
+
if unit == "mm":
|
| 112 |
+
val = val / 10.0
|
| 113 |
+
out.append(round(val, 1))
|
| 114 |
+
return out
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def load_canonical():
|
| 118 |
+
c = {}
|
| 119 |
+
with open(CAN) as f:
|
| 120 |
+
for line in f:
|
| 121 |
+
d = json.loads(line)
|
| 122 |
+
c[d["id"]] = d["canonical"]
|
| 123 |
+
return c
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
def audit_variant(pid, vname, text, canon):
|
| 127 |
+
v = []
|
| 128 |
+
if not text or not text.strip():
|
| 129 |
+
return ["empty"]
|
| 130 |
+
text_s = text.strip()
|
| 131 |
+
n_words = len(text_s.split())
|
| 132 |
+
|
| 133 |
+
# length
|
| 134 |
+
if vname == "V4_tag_string":
|
| 135 |
+
# tag string: count comma-separated tags, not words
|
| 136 |
+
n_tags = len([t for t in text_s.split(",") if t.strip()])
|
| 137 |
+
lo, hi = 6, 30
|
| 138 |
+
if n_tags < lo:
|
| 139 |
+
v.append(f"too_short:{n_tags}<{lo}tags")
|
| 140 |
+
elif n_tags > hi:
|
| 141 |
+
v.append(f"too_long:{n_tags}>{hi}tags")
|
| 142 |
+
else:
|
| 143 |
+
lo, hi = WORD_BAND.get(vname, (1, 10_000))
|
| 144 |
+
if n_words < lo:
|
| 145 |
+
v.append(f"too_short:{n_words}<{lo}")
|
| 146 |
+
elif n_words > hi:
|
| 147 |
+
v.append(f"too_long:{n_words}>{hi}")
|
| 148 |
+
|
| 149 |
+
# banned words
|
| 150 |
+
m = BANNED_RE.search(text_s)
|
| 151 |
+
if m:
|
| 152 |
+
v.append(f"banned:{m.group(0).lower()}")
|
| 153 |
+
|
| 154 |
+
canon_pos = bool(canon.get("lesion_present"))
|
| 155 |
+
# Strip incidental cysts before the lesion-word test so V4 tag strings don't
|
| 156 |
+
# get flagged for "renal cyst" etc.
|
| 157 |
+
text_for_lesion = INCIDENTAL_CYST_RE.sub("", text_s)
|
| 158 |
+
# V4 is comma-separated — treat commas as sentence terminators for neg detection
|
| 159 |
+
if vname == "V4_tag_string":
|
| 160 |
+
text_for_lesion_neg_split = re.sub(r",\s*", ". ", text_for_lesion)
|
| 161 |
+
else:
|
| 162 |
+
text_for_lesion_neg_split = text_for_lesion
|
| 163 |
+
any_lesion_word = bool(LESION_WORDS.search(text_for_lesion))
|
| 164 |
+
|
| 165 |
+
if vname == "V6_negative_descriptive":
|
| 166 |
+
# User decision 2026-04-20: V6_negative deprecated — don't ship it.
|
| 167 |
+
# Skip lesion-token contract; only keep length/banned checks.
|
| 168 |
+
pass
|
| 169 |
+
else:
|
| 170 |
+
if canon_pos:
|
| 171 |
+
if not any_lesion_word:
|
| 172 |
+
v.append("missing_lesion_mention")
|
| 173 |
+
# size echo: canonical sizes should appear at least once
|
| 174 |
+
canon_sizes = []
|
| 175 |
+
for L in canon.get("lesion_list", []):
|
| 176 |
+
sz = L.get("size_cm") or []
|
| 177 |
+
for s in sz:
|
| 178 |
+
canon_sizes.append(round(float(s), 1))
|
| 179 |
+
text_dims = parse_dims_cm(text_s)
|
| 180 |
+
# V4/V2 may only cite the largest dim; accept if any canonical max-adjacent size appears
|
| 181 |
+
if canon_sizes and not any(abs(d - cs) < 0.2 for d in text_dims for cs in canon_sizes):
|
| 182 |
+
v.append("size_not_echoed")
|
| 183 |
+
# subregion
|
| 184 |
+
subs = set()
|
| 185 |
+
for L in canon.get("lesion_list", []):
|
| 186 |
+
loc = (L.get("location") or "").lower()
|
| 187 |
+
for key in ("head", "body", "tail", "uncinate"):
|
| 188 |
+
if key in loc:
|
| 189 |
+
subs.add(key)
|
| 190 |
+
if subs and vname in ("V1_long_narrative", "V3_organ_bullet", "V5_layered_findings"):
|
| 191 |
+
if not any(k in text_s.lower() for k in subs):
|
| 192 |
+
v.append("missing_subregion")
|
| 193 |
+
else:
|
| 194 |
+
# lesion negative case — no un-negated pancreatic lesion word
|
| 195 |
+
if has_unnegated_lesion(text_for_lesion_neg_split):
|
| 196 |
+
v.append("hallucinated_lesion_mention")
|
| 197 |
+
|
| 198 |
+
# number hallucination: any cm dimension in text not matching canonical
|
| 199 |
+
if canon_pos:
|
| 200 |
+
canon_sizes = []
|
| 201 |
+
for L in canon.get("lesion_list", []):
|
| 202 |
+
for s in (L.get("size_cm") or []):
|
| 203 |
+
canon_sizes.append(round(float(s), 1))
|
| 204 |
+
text_dims = parse_dims_cm(text_s)
|
| 205 |
+
extras = [d for d in text_dims
|
| 206 |
+
if not any(abs(d - cs) < 0.2 for cs in canon_sizes)
|
| 207 |
+
and 0.3 <= d <= 20] # ignore very large or tiny numbers (HU refs, percents)
|
| 208 |
+
if len(extras) > 2:
|
| 209 |
+
v.append(f"extra_dims:{extras[:3]}")
|
| 210 |
+
else:
|
| 211 |
+
# negative case: any dim > 0.5 cm flagged as potential halluc
|
| 212 |
+
text_dims = parse_dims_cm(text_s)
|
| 213 |
+
# allow typical kidney/liver/spleen mention like "12 cm liver" — too noisy; skip
|
| 214 |
+
pass
|
| 215 |
+
|
| 216 |
+
return v
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
def main():
|
| 220 |
+
print("loading canonical...")
|
| 221 |
+
canon = load_canonical()
|
| 222 |
+
print(f" canonical n={len(canon)}")
|
| 223 |
+
|
| 224 |
+
per_variant = collections.defaultdict(lambda: {
|
| 225 |
+
"total": 0, "ok": 0, "violations": collections.Counter(),
|
| 226 |
+
"lens_words": [],
|
| 227 |
+
})
|
| 228 |
+
flagged = []
|
| 229 |
+
|
| 230 |
+
total_cases = 0
|
| 231 |
+
missing_variants = 0
|
| 232 |
+
with open(CAP) as f:
|
| 233 |
+
for line in f:
|
| 234 |
+
d = json.loads(line)
|
| 235 |
+
pid = d["id"]
|
| 236 |
+
total_cases += 1
|
| 237 |
+
if pid not in canon:
|
| 238 |
+
missing_variants += 1
|
| 239 |
+
continue
|
| 240 |
+
c = canon[pid]
|
| 241 |
+
seen = set()
|
| 242 |
+
for v in d.get("variants", []):
|
| 243 |
+
vname = v.get("variant", "?")
|
| 244 |
+
seen.add(vname)
|
| 245 |
+
text = v.get("text") or ""
|
| 246 |
+
violations = audit_variant(pid, vname, text, c)
|
| 247 |
+
stat = per_variant[vname]
|
| 248 |
+
stat["total"] += 1
|
| 249 |
+
stat["lens_words"].append(len(text.split()))
|
| 250 |
+
if not violations:
|
| 251 |
+
stat["ok"] += 1
|
| 252 |
+
else:
|
| 253 |
+
for x in violations:
|
| 254 |
+
stat["violations"][x.split(":")[0]] += 1
|
| 255 |
+
flagged.append({
|
| 256 |
+
"id": pid, "variant": vname,
|
| 257 |
+
"violations": violations,
|
| 258 |
+
"lesion_present": bool(c.get("lesion_present")),
|
| 259 |
+
"text": text[:400],
|
| 260 |
+
})
|
| 261 |
+
# missing variants?
|
| 262 |
+
expected = {"V1_long_narrative", "V2_terse_impression", "V3_organ_bullet",
|
| 263 |
+
"V4_tag_string", "V5_layered_findings"}
|
| 264 |
+
expected.add("V6_qa_pair" if c.get("lesion_present") else "V6_negative_descriptive")
|
| 265 |
+
for ev in expected - seen:
|
| 266 |
+
stat = per_variant[ev]
|
| 267 |
+
stat["total"] += 1
|
| 268 |
+
stat["violations"]["missing"] += 1
|
| 269 |
+
flagged.append({
|
| 270 |
+
"id": pid, "variant": ev, "violations": ["missing"],
|
| 271 |
+
"lesion_present": bool(c.get("lesion_present")), "text": "",
|
| 272 |
+
})
|
| 273 |
+
|
| 274 |
+
# write flagged jsonl
|
| 275 |
+
with open(OUT_FLAG, "w") as f:
|
| 276 |
+
for r in flagged:
|
| 277 |
+
f.write(json.dumps(r, ensure_ascii=False) + "\n")
|
| 278 |
+
|
| 279 |
+
# write markdown
|
| 280 |
+
with open(OUT_MD, "w") as f:
|
| 281 |
+
f.write("# F5 Caption Audit Report\n\n")
|
| 282 |
+
f.write(f"- Cases audited: {total_cases}\n")
|
| 283 |
+
f.write(f"- Canonical intersection misses: {missing_variants}\n")
|
| 284 |
+
f.write(f"- Total flagged (case, variant) rows: {len(flagged)}\n\n")
|
| 285 |
+
f.write("## Per-variant pass rate\n\n")
|
| 286 |
+
f.write("| Variant | Total | OK | Pass % | P50 words | P95 words |\n")
|
| 287 |
+
f.write("|---|---|---|---|---|---|\n")
|
| 288 |
+
for vname in sorted(per_variant):
|
| 289 |
+
s = per_variant[vname]
|
| 290 |
+
lens = s["lens_words"] or [0]
|
| 291 |
+
p50 = int(statistics.median(lens))
|
| 292 |
+
p95 = int(sorted(lens)[int(len(lens)*0.95)-1])
|
| 293 |
+
f.write(f"| {vname} | {s['total']} | {s['ok']} | "
|
| 294 |
+
f"{100*s['ok']/max(1,s['total']):.1f}% | {p50} | {p95} |\n")
|
| 295 |
+
f.write("\n## Violation breakdown\n\n")
|
| 296 |
+
for vname in sorted(per_variant):
|
| 297 |
+
s = per_variant[vname]
|
| 298 |
+
if not s["violations"]:
|
| 299 |
+
continue
|
| 300 |
+
f.write(f"### {vname}\n\n")
|
| 301 |
+
for k, c in s["violations"].most_common():
|
| 302 |
+
f.write(f"- `{k}`: {c}\n")
|
| 303 |
+
f.write("\n")
|
| 304 |
+
# top 20 flagged samples
|
| 305 |
+
f.write("## Sample flagged rows (first 20)\n\n")
|
| 306 |
+
for r in flagged[:20]:
|
| 307 |
+
f.write(f"- `{r['id']}` / `{r['variant']}` / lesion+={r['lesion_present']} / "
|
| 308 |
+
f"viol={r['violations']}\n")
|
| 309 |
+
if r["text"]:
|
| 310 |
+
f.write(f" - text: {r['text'][:180]}...\n")
|
| 311 |
+
f.write("\n")
|
| 312 |
+
|
| 313 |
+
# print summary
|
| 314 |
+
print(f"cases audited: {total_cases}")
|
| 315 |
+
print(f"flagged rows: {len(flagged)}")
|
| 316 |
+
print(f"\nPer-variant pass rate:")
|
| 317 |
+
for vname in sorted(per_variant):
|
| 318 |
+
s = per_variant[vname]
|
| 319 |
+
lens = s["lens_words"] or [0]
|
| 320 |
+
p50 = int(statistics.median(lens))
|
| 321 |
+
print(f" {vname:28s} total={s['total']:>5} ok={s['ok']:>5} "
|
| 322 |
+
f"pass={100*s['ok']/max(1,s['total']):5.1f}% p50_words={p50}")
|
| 323 |
+
print(f"\nTop violations overall:")
|
| 324 |
+
overall = collections.Counter()
|
| 325 |
+
for s in per_variant.values():
|
| 326 |
+
overall.update(s["violations"])
|
| 327 |
+
for k, c in overall.most_common(10):
|
| 328 |
+
print(f" {k}: {c}")
|
| 329 |
+
print(f"\nWrote: {OUT_MD}\n {OUT_FLAG}")
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
if __name__ == "__main__":
|
| 333 |
+
main()
|
raw_pants_train_test/metadata/pants-captions-ldm/code/caption_generation/f5b_v7.py
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
F5b: V7 pancreas-only captions, gated on canonical lesion_present AND mask component presence.
|
| 3 |
+
|
| 4 |
+
Per v4 §8.4 whitelist:
|
| 5 |
+
- Describe pancreas and lesion ONLY
|
| 6 |
+
- Use subregion from mask (pancreas_head/body/tail/uncinate)
|
| 7 |
+
- Use size_cm from canonical
|
| 8 |
+
- Use enhancement (hypo/iso/hyper-attenuating) from canonical
|
| 9 |
+
- Include vessel/duct contact only from mask.contact keys
|
| 10 |
+
- BANNED upgrades: invasion, encasement, stage, resectability, adenocarcinoma
|
| 11 |
+
- No liver/spleen/kidney content (reserved for B-pan crop supervision)
|
| 12 |
+
|
| 13 |
+
Output: captions_out/captions_v7.jsonl
|
| 14 |
+
"""
|
| 15 |
+
import os, json, re, sys, argparse, threading, time
|
| 16 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 17 |
+
|
| 18 |
+
sys.path.insert(0, f"{os.environ.get('REPO_ROOT', '.')}")
|
| 19 |
+
from fusion_run import (
|
| 20 |
+
call_text_llm, load_jsonl, BANNED_RE, KEYPOOL,
|
| 21 |
+
)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
# Additional banned for V7 (upgrades over baseline banned list)
|
| 25 |
+
V7_EXTRA_BAN = re.compile(
|
| 26 |
+
r"\b(invasion|encasement|encases?|infiltrates?|tumou?r|"
|
| 27 |
+
r"resectability|operable|staging|staged)\b",
|
| 28 |
+
re.IGNORECASE,
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
# Allowed contact phrases (whitelist) — only descriptive "abuts/contacts/touches/adjacent to"
|
| 32 |
+
ALLOWED_CONTACT_VERBS = ("abuts", "contacts", "touches", "adjacent to", "in contact with")
|
| 33 |
+
|
| 34 |
+
CONTACT_LABEL_MAP = {
|
| 35 |
+
"pancreatic_duct": "pancreatic duct",
|
| 36 |
+
"common_bile_duct": "common bile duct",
|
| 37 |
+
"celiac_artery": "celiac artery",
|
| 38 |
+
"sma": "superior mesenteric artery",
|
| 39 |
+
"smv": "superior mesenteric vein",
|
| 40 |
+
"aorta": "abdominal aorta",
|
| 41 |
+
"portal_vein": "portal vein",
|
| 42 |
+
"splenic_vein": "splenic vein",
|
| 43 |
+
"splenic_artery": "splenic artery",
|
| 44 |
+
"hepatic_artery": "hepatic artery",
|
| 45 |
+
"ivc": "inferior vena cava",
|
| 46 |
+
"duodenum": "duodenum",
|
| 47 |
+
"stomach": "stomach",
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
def format_facts_for_v7(canonical_core):
|
| 52 |
+
lesions = canonical_core.get("lesion_list", [])
|
| 53 |
+
mask_comps = canonical_core.get("lesion_components_mask", [])
|
| 54 |
+
out = {
|
| 55 |
+
"phase": canonical_core.get("phase"),
|
| 56 |
+
"pancreas_volume_cc": canonical_core.get("pancreas_volume_cc"),
|
| 57 |
+
"pancreas_status": (canonical_core.get("organ_status_report") or {}).get("pancreas", {}),
|
| 58 |
+
"lesions": [],
|
| 59 |
+
}
|
| 60 |
+
# Pair lesions with mask components by order (both produced in canonical build)
|
| 61 |
+
for i, L in enumerate(lesions):
|
| 62 |
+
mc = mask_comps[i] if i < len(mask_comps) else {}
|
| 63 |
+
contacts_kv = mc.get("contact", {}) or {}
|
| 64 |
+
# keep only contacts with substantive voxel count (>=5 voxels)
|
| 65 |
+
contacts_clean = []
|
| 66 |
+
for k, v in contacts_kv.items():
|
| 67 |
+
label = CONTACT_LABEL_MAP.get(k, k.replace("_", " "))
|
| 68 |
+
if isinstance(v, (int, float)) and v >= 5:
|
| 69 |
+
contacts_clean.append(label)
|
| 70 |
+
out["lesions"].append({
|
| 71 |
+
"subregion": mc.get("subregion_dominant", L.get("location", "pancreas")),
|
| 72 |
+
"size_cm": L.get("size_cm"),
|
| 73 |
+
"volume_cc": L.get("volume_cc"),
|
| 74 |
+
"enhancement": L.get("enhancement"),
|
| 75 |
+
"hu_mean": L.get("hu_mean"),
|
| 76 |
+
"contacts": contacts_clean,
|
| 77 |
+
})
|
| 78 |
+
return out
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
V7_PROMPT_TEMPLATE = """You are writing a PANCREAS-ONLY descriptive caption for training a text-to-image 3D medical diffusion model on a pancreas crop.
|
| 82 |
+
|
| 83 |
+
FACTS (use ONLY these values):
|
| 84 |
+
{facts}
|
| 85 |
+
|
| 86 |
+
HARD RULES:
|
| 87 |
+
- Describe the PANCREAS and its lesion ONLY. Do NOT mention liver, spleen, kidneys, habitus, bowel, bone, skin, or any extra-pancreatic finding.
|
| 88 |
+
- Size values (cm) must be taken verbatim from FACTS.lesions[].size_cm.
|
| 89 |
+
- Subregion must be one of: pancreatic head, pancreatic body, pancreatic tail, uncinate process. Use ONLY the subregion from FACTS.lesions[].subregion (strip any 'pancreas_' prefix and render with spaces).
|
| 90 |
+
- Enhancement: use ONLY the value from FACTS.lesions[].enhancement (e.g., 'isoattenuating', 'hypoattenuating', 'hyperattenuating'). Do not upgrade to 'avidly enhancing' or similar.
|
| 91 |
+
- Vessel / duct contact: use only the labels listed in FACTS.lesions[].contacts. Describe with neutral verbs like 'abuts', 'contacts', 'is adjacent to'. Do not write 'invades', 'encases', 'infiltrates', or any staging term.
|
| 92 |
+
- No diagnosis, no prognosis, no treatment. No adenocarcinoma, TNM stage, resectability.
|
| 93 |
+
|
| 94 |
+
STYLE: 50-120 words, 2-4 sentences. Flow:
|
| 95 |
+
(1) One sentence on the scan phase and pancreas morphology/volume.
|
| 96 |
+
(2) One or two sentences describing the lesion(s): subregion, size (cm), enhancement, any vessel/duct contact.
|
| 97 |
+
(3) Optionally close with a short observation on pancreatic duct or parenchyma if FACTS provides it.
|
| 98 |
+
|
| 99 |
+
Output only the caption. No markdown, no 'CAPTION:' prefix.
|
| 100 |
+
"""
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def _strip_prefix(t):
|
| 104 |
+
t = re.sub(r"^CAPTION:\s*", "", t, flags=re.IGNORECASE)
|
| 105 |
+
t = re.sub(r"^```[a-z]*\s*", "", t)
|
| 106 |
+
t = re.sub(r"\s*```$", "", t).strip()
|
| 107 |
+
return t
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
def qc_v7(text, facts):
|
| 111 |
+
v = []
|
| 112 |
+
if not text or len(text.split()) < 20:
|
| 113 |
+
v.append("too_short")
|
| 114 |
+
if BANNED_RE.search(text) or V7_EXTRA_BAN.search(text):
|
| 115 |
+
v.append("banned_word")
|
| 116 |
+
# extra-pancreatic content check
|
| 117 |
+
extra = re.search(
|
| 118 |
+
r"\b(liver|hepatic|spleen|splenic|kidney|renal|bowel|habitus|subcutaneous|rib|bone|skin|bladder)\b",
|
| 119 |
+
text, re.IGNORECASE)
|
| 120 |
+
if extra:
|
| 121 |
+
v.append(f"extra_pancreatic:{extra.group(0).lower()}")
|
| 122 |
+
# subregion echo
|
| 123 |
+
subs = set()
|
| 124 |
+
for L in facts.get("lesions", []):
|
| 125 |
+
sub = (L.get("subregion") or "").lower()
|
| 126 |
+
for key in ("head", "body", "tail", "uncinate"):
|
| 127 |
+
if key in sub:
|
| 128 |
+
subs.add(key)
|
| 129 |
+
if subs and not any(k in text.lower() for k in subs):
|
| 130 |
+
v.append("missing_subregion")
|
| 131 |
+
# size echo
|
| 132 |
+
sizes = []
|
| 133 |
+
for L in facts.get("lesions", []):
|
| 134 |
+
for s in (L.get("size_cm") or []):
|
| 135 |
+
sizes.append(round(float(s), 1))
|
| 136 |
+
if sizes:
|
| 137 |
+
size_str_ok = any(f"{s:.1f}" in text or f"{s}" in text for s in sizes)
|
| 138 |
+
if not size_str_ok:
|
| 139 |
+
v.append("missing_size")
|
| 140 |
+
return (len(v) == 0), v
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def run_one(pid, canonical):
|
| 144 |
+
canonical_core = canonical["canonical"]
|
| 145 |
+
facts = format_facts_for_v7(canonical_core)
|
| 146 |
+
facts_str = json.dumps(facts, ensure_ascii=False, indent=2)
|
| 147 |
+
prompt = V7_PROMPT_TEMPLATE.format(facts=facts_str)
|
| 148 |
+
best_text, best_ok, best_v = "", False, []
|
| 149 |
+
for attempt in range(3):
|
| 150 |
+
resp = call_text_llm(prompt, max_tokens=500, temperature=0.4 if attempt == 0 else 0.3)
|
| 151 |
+
text = _strip_prefix(resp.get("content") or "")
|
| 152 |
+
if not text:
|
| 153 |
+
continue
|
| 154 |
+
ok, viol = qc_v7(text, facts)
|
| 155 |
+
if ok:
|
| 156 |
+
return {"id": pid, "variant": "V7_pancreas_only",
|
| 157 |
+
"text": text, "ok": True, "violations": [], "dt": resp.get("dt", 0)}
|
| 158 |
+
if (len(viol) < len(best_v)) or (not best_text and not best_v):
|
| 159 |
+
best_text, best_ok, best_v = text, ok, viol
|
| 160 |
+
# on failure, append violation hints to prompt for next attempt
|
| 161 |
+
prompt = V7_PROMPT_TEMPLATE.format(facts=facts_str) + \
|
| 162 |
+
"\n\nPREVIOUS ATTEMPT FAILED these checks: " + ",".join(viol) + \
|
| 163 |
+
". Regenerate correcting them exactly.\n"
|
| 164 |
+
return {"id": pid, "variant": "V7_pancreas_only",
|
| 165 |
+
"text": best_text, "ok": best_ok, "violations": best_v, "dt": 0}
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
def main():
|
| 169 |
+
ap = argparse.ArgumentParser()
|
| 170 |
+
ap.add_argument("--canonical", default=f"{os.environ.get('REPO_ROOT', '.')}/canonical/canonical_facts.jsonl")
|
| 171 |
+
ap.add_argument("--out", default=f"{os.environ.get('REPO_ROOT', '.')}/captions/captions_v7.jsonl")
|
| 172 |
+
ap.add_argument("--workers", type=int, default=16)
|
| 173 |
+
ap.add_argument("--limit", type=int, default=0)
|
| 174 |
+
args = ap.parse_args()
|
| 175 |
+
|
| 176 |
+
print("loading canonical...", flush=True)
|
| 177 |
+
canonical_map = load_jsonl(args.canonical)
|
| 178 |
+
print(f" canonical={len(canonical_map)}", flush=True)
|
| 179 |
+
|
| 180 |
+
# Eligibility: lesion_present=true AND has lesion_components_mask entries
|
| 181 |
+
eligible = []
|
| 182 |
+
for pid, d in canonical_map.items():
|
| 183 |
+
c = d["canonical"]
|
| 184 |
+
if c.get("lesion_present") and c.get("lesion_components_mask"):
|
| 185 |
+
eligible.append(pid)
|
| 186 |
+
eligible.sort()
|
| 187 |
+
print(f" V7-eligible cases: {len(eligible)}", flush=True)
|
| 188 |
+
|
| 189 |
+
# resume
|
| 190 |
+
done = set()
|
| 191 |
+
if os.path.exists(args.out):
|
| 192 |
+
with open(args.out) as f:
|
| 193 |
+
for line in f:
|
| 194 |
+
try:
|
| 195 |
+
d = json.loads(line)
|
| 196 |
+
done.add(d["id"])
|
| 197 |
+
except: pass
|
| 198 |
+
print(f" resume: {len(done)} already written", flush=True)
|
| 199 |
+
todo = [i for i in eligible if i not in done]
|
| 200 |
+
if args.limit:
|
| 201 |
+
todo = todo[:args.limit]
|
| 202 |
+
print(f" todo: {len(todo)} workers={args.workers}", flush=True)
|
| 203 |
+
|
| 204 |
+
fp = open(args.out, "a", buffering=1)
|
| 205 |
+
lock = threading.Lock()
|
| 206 |
+
t0 = time.time()
|
| 207 |
+
ok_ct = 0
|
| 208 |
+
with ThreadPoolExecutor(max_workers=args.workers) as ex:
|
| 209 |
+
futs = {ex.submit(run_one, pid, canonical_map[pid]): pid for pid in todo}
|
| 210 |
+
for i, fut in enumerate(as_completed(futs)):
|
| 211 |
+
pid = futs[fut]
|
| 212 |
+
try:
|
| 213 |
+
r = fut.result()
|
| 214 |
+
except Exception as e:
|
| 215 |
+
r = {"id": pid, "error": str(e)}
|
| 216 |
+
with lock:
|
| 217 |
+
fp.write(json.dumps(r, ensure_ascii=False) + "\n")
|
| 218 |
+
if "error" not in r and r.get("ok"):
|
| 219 |
+
ok_ct += 1
|
| 220 |
+
if (i + 1) % 25 == 0 or i == len(todo) - 1:
|
| 221 |
+
dt = time.time() - t0
|
| 222 |
+
rate = (i + 1) / max(dt, 1e-3)
|
| 223 |
+
eta = (len(todo) - i - 1) / max(rate, 1e-3)
|
| 224 |
+
print(f" v7 {i+1}/{len(todo)} ok={ok_ct} rate={rate:.2f}/s eta={eta/60:.1f}min",
|
| 225 |
+
flush=True)
|
| 226 |
+
fp.close()
|
| 227 |
+
print(f"done. wall={(time.time()-t0)/60:.1f}min ok={ok_ct}/{len(todo)} out={args.out}",
|
| 228 |
+
flush=True)
|
| 229 |
+
|
| 230 |
+
|
| 231 |
+
if __name__ == "__main__":
|
| 232 |
+
main()
|
raw_pants_train_test/metadata/pants-captions-ldm/code/caption_generation/f5d_regen.py
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
F5d: regenerate truncated / banned-word captions from f5_regen_list.json.
|
| 3 |
+
|
| 4 |
+
Strategy:
|
| 5 |
+
- Load previous captions_full_v2.jsonl + f5_regen_list.json
|
| 6 |
+
- For each (id, variant) in regen list, re-call LLM with HIGHER max_tokens
|
| 7 |
+
so the long-form variants (V1/V3/V5) don't truncate mid-sentence.
|
| 8 |
+
- Re-QC; accept if non-truncated AND no banned word.
|
| 9 |
+
- If regen still truncated after 2 tries, keep the original (mark regen_failed).
|
| 10 |
+
- Emit captions_full_v3.jsonl (all cases, only touched variants replaced).
|
| 11 |
+
"""
|
| 12 |
+
import os, json, re, sys, argparse, threading, time
|
| 13 |
+
from concurrent.futures import ThreadPoolExecutor, as_completed
|
| 14 |
+
|
| 15 |
+
sys.path.insert(0, f"{os.environ.get('REPO_ROOT', '.')}")
|
| 16 |
+
from fusion_run import (
|
| 17 |
+
V_PROMPTS, build_facts_block, filter_vlm_a, filter_b_prose,
|
| 18 |
+
call_text_llm, load_jsonl, BANNED_RE,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
# Higher budgets than the original run to eliminate truncation.
|
| 23 |
+
MAX_TOK = {
|
| 24 |
+
"V1_long_narrative": 1024,
|
| 25 |
+
"V2_terse_impression": 140,
|
| 26 |
+
"V3_organ_bullet": 700,
|
| 27 |
+
"V4_tag_string": 160,
|
| 28 |
+
"V5_layered_findings": 700,
|
| 29 |
+
"V6_qa_pair": 240,
|
| 30 |
+
"V6_negative_descriptive": 400, # will be dropped later, but keep consistent
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def is_truncated(text, vname):
|
| 35 |
+
if not text:
|
| 36 |
+
return True
|
| 37 |
+
t = text.strip()
|
| 38 |
+
if vname == "V4_tag_string":
|
| 39 |
+
# tags: accept if >=6 tags AND doesn't end with a stray comma or fragment
|
| 40 |
+
tags = [x.strip() for x in t.split(",") if x.strip()]
|
| 41 |
+
return len(tags) < 6
|
| 42 |
+
if len(t.split()) < 5:
|
| 43 |
+
return True
|
| 44 |
+
# ends without terminal punctuation → likely truncated
|
| 45 |
+
return not re.search(r"[.!?]\"?\)?\s*$", t)
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def regen_variant(canonical_core, vlm_a, vlm_b, vname, attempts=2):
|
| 49 |
+
facts = build_facts_block(canonical_core, vlm_a, vlm_b)
|
| 50 |
+
facts_str = json.dumps(facts, ensure_ascii=False, indent=2)
|
| 51 |
+
prompt = V_PROMPTS[vname].format(facts=facts_str)
|
| 52 |
+
mt = MAX_TOK.get(vname, 800)
|
| 53 |
+
|
| 54 |
+
best_text = ""
|
| 55 |
+
best_ok = False
|
| 56 |
+
for i in range(attempts):
|
| 57 |
+
resp = call_text_llm(prompt, max_tokens=mt, temperature=0.4)
|
| 58 |
+
text = (resp.get("content") or "").strip()
|
| 59 |
+
text = re.sub(r"^```[a-z]*\s*", "", text)
|
| 60 |
+
text = re.sub(r"\s*```$", "", text).strip()
|
| 61 |
+
if not text:
|
| 62 |
+
continue
|
| 63 |
+
banned = bool(BANNED_RE.search(text))
|
| 64 |
+
trunc = is_truncated(text, vname)
|
| 65 |
+
ok = (not banned) and (not trunc)
|
| 66 |
+
if ok:
|
| 67 |
+
return {"variant": vname, "text": text, "ok": True, "violations": [],
|
| 68 |
+
"dt": resp.get("dt", 0), "regen": True}
|
| 69 |
+
# keep longest non-banned attempt as fallback
|
| 70 |
+
if (not banned) and len(text) > len(best_text):
|
| 71 |
+
best_text, best_ok = text, False
|
| 72 |
+
# fallback: return best candidate we have (may still be truncated)
|
| 73 |
+
return {"variant": vname, "text": best_text, "ok": best_ok,
|
| 74 |
+
"violations": ["regen_failed_still_trunc"] if not best_ok else [],
|
| 75 |
+
"dt": 0, "regen": True}
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def main():
|
| 79 |
+
ap = argparse.ArgumentParser()
|
| 80 |
+
ap.add_argument("--canonical", default=f"{os.environ.get('REPO_ROOT', '.')}/canonical/canonical_facts.jsonl")
|
| 81 |
+
ap.add_argument("--vlm", default=f"{os.environ.get('REPO_ROOT', '.')}/vlm_out/vlm_results.jsonl")
|
| 82 |
+
ap.add_argument("--prev", default=f"{os.environ.get('REPO_ROOT', '.')}/captions/captions_full_v2.jsonl")
|
| 83 |
+
ap.add_argument("--regen", default=f"{os.environ.get('REPO_ROOT', '.')}/f5_regen_list.json")
|
| 84 |
+
ap.add_argument("--out", default=f"{os.environ.get('REPO_ROOT', '.')}/captions/captions_full_v3.jsonl")
|
| 85 |
+
ap.add_argument("--workers", type=int, default=16)
|
| 86 |
+
args = ap.parse_args()
|
| 87 |
+
|
| 88 |
+
print("loading canonical + vlm...", flush=True)
|
| 89 |
+
canonical_map = load_jsonl(args.canonical)
|
| 90 |
+
vlm_map = load_jsonl(args.vlm)
|
| 91 |
+
print(f" canonical={len(canonical_map)} vlm={len(vlm_map)}", flush=True)
|
| 92 |
+
|
| 93 |
+
print("loading prev captions...", flush=True)
|
| 94 |
+
prev = {}
|
| 95 |
+
with open(args.prev) as f:
|
| 96 |
+
for line in f:
|
| 97 |
+
d = json.loads(line)
|
| 98 |
+
prev[d["id"]] = d
|
| 99 |
+
print(f" prev cases={len(prev)}", flush=True)
|
| 100 |
+
|
| 101 |
+
print("loading regen list...", flush=True)
|
| 102 |
+
with open(args.regen) as f:
|
| 103 |
+
regen_list = json.load(f)
|
| 104 |
+
# group by id
|
| 105 |
+
by_id = {}
|
| 106 |
+
for (pid, vname, reasons) in regen_list:
|
| 107 |
+
by_id.setdefault(pid, []).append(vname)
|
| 108 |
+
print(f" regen cases={len(by_id)} items={len(regen_list)}", flush=True)
|
| 109 |
+
|
| 110 |
+
# resume: skip ids already in out
|
| 111 |
+
done = set()
|
| 112 |
+
if os.path.exists(args.out):
|
| 113 |
+
with open(args.out) as f:
|
| 114 |
+
for line in f:
|
| 115 |
+
try:
|
| 116 |
+
d = json.loads(line)
|
| 117 |
+
done.add(d["id"])
|
| 118 |
+
except: pass
|
| 119 |
+
print(f" resume: {len(done)} already written", flush=True)
|
| 120 |
+
|
| 121 |
+
todo_ids = [i for i in prev.keys() if i not in done]
|
| 122 |
+
regen_ids = [i for i in todo_ids if i in by_id]
|
| 123 |
+
passthrough_ids = [i for i in todo_ids if i not in by_id]
|
| 124 |
+
print(f" regen todo: {len(regen_ids)} passthrough: {len(passthrough_ids)}", flush=True)
|
| 125 |
+
|
| 126 |
+
fp = open(args.out, "a", buffering=1)
|
| 127 |
+
lock = threading.Lock()
|
| 128 |
+
|
| 129 |
+
# 1) passthrough: copy cases that don't need regen
|
| 130 |
+
for pid in passthrough_ids:
|
| 131 |
+
fp.write(json.dumps(prev[pid], ensure_ascii=False) + "\n")
|
| 132 |
+
print(f" wrote {len(passthrough_ids)} passthrough cases", flush=True)
|
| 133 |
+
|
| 134 |
+
def work(pid):
|
| 135 |
+
prev_case = prev[pid]
|
| 136 |
+
canonical = canonical_map.get(pid)
|
| 137 |
+
vlm = vlm_map.get(pid)
|
| 138 |
+
if not canonical or not vlm:
|
| 139 |
+
return {"id": pid, "variants": prev_case.get("variants", [])}
|
| 140 |
+
canonical_core = canonical["canonical"]
|
| 141 |
+
vlm_a = filter_vlm_a((vlm or {}).get("A_json", {}).get("parsed") or {},
|
| 142 |
+
bool(canonical_core.get("lesion_present")))
|
| 143 |
+
vlm_b = filter_b_prose((vlm or {}).get("B_prose", {}).get("content") or "")
|
| 144 |
+
want = set(by_id.get(pid, []))
|
| 145 |
+
out_vars = []
|
| 146 |
+
for v in prev_case.get("variants", []):
|
| 147 |
+
vname = v.get("variant")
|
| 148 |
+
if vname in want:
|
| 149 |
+
nv = regen_variant(canonical_core, vlm_a, vlm_b, vname)
|
| 150 |
+
out_vars.append(nv)
|
| 151 |
+
else:
|
| 152 |
+
out_vars.append(v)
|
| 153 |
+
return {"id": pid, "variants": out_vars}
|
| 154 |
+
|
| 155 |
+
t0 = time.time()
|
| 156 |
+
with ThreadPoolExecutor(max_workers=args.workers) as ex:
|
| 157 |
+
futs = {ex.submit(work, pid): pid for pid in regen_ids}
|
| 158 |
+
for i, fut in enumerate(as_completed(futs)):
|
| 159 |
+
pid = futs[fut]
|
| 160 |
+
try:
|
| 161 |
+
r = fut.result()
|
| 162 |
+
except Exception as e:
|
| 163 |
+
r = {"id": pid, "variants": prev[pid].get("variants", []), "error": str(e)}
|
| 164 |
+
with lock:
|
| 165 |
+
fp.write(json.dumps(r, ensure_ascii=False) + "\n")
|
| 166 |
+
if (i + 1) % 25 == 0 or i == len(regen_ids) - 1:
|
| 167 |
+
dt = time.time() - t0
|
| 168 |
+
rate = (i + 1) / max(dt, 1e-3)
|
| 169 |
+
eta = (len(regen_ids) - i - 1) / max(rate, 1e-3)
|
| 170 |
+
print(f" regen {i+1}/{len(regen_ids)} rate={rate:.2f}/s eta={eta/60:.1f}min",
|
| 171 |
+
flush=True)
|
| 172 |
+
fp.close()
|
| 173 |
+
print(f"done. wall={(time.time()-t0)/60:.1f}min out={args.out}", flush=True)
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
if __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 2 |
+
F6 final corpus audit — reads captions_final.jsonl (post-merge, post-drop).
|
| 3 |
+
|
| 4 |
+
This is a thin wrapper that adapts the structure (captions dict keyed by variant name)
|
| 5 |
+
to the same audit logic as f5_audit.py.
|
| 6 |
+
"""
|
| 7 |
+
import os
|
| 8 |
+
import json, re, os, sys, statistics, collections
|
| 9 |
+
|
| 10 |
+
FINAL = f"{os.environ.get('REPO_ROOT', '.')}/captions/captions_final.jsonl"
|
| 11 |
+
OUT_MD = f"{os.environ.get('REPO_ROOT', '.')}/audit_final.md"
|
| 12 |
+
|
| 13 |
+
# Reuse the main audit definitions
|
| 14 |
+
sys.path.insert(0, f"{os.environ.get('REPO_ROOT', '.')}")
|
| 15 |
+
from f5_audit import (
|
| 16 |
+
BANNED_RE, LESION_WORDS, NEG_CUE, PANC_LESION_RE, INCIDENTAL_CYST_RE,
|
| 17 |
+
WORD_BAND, has_unnegated_lesion, parse_dims_cm,
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
# V7-specific extras
|
| 21 |
+
V7_BAN_EXTRA = re.compile(
|
| 22 |
+
r"\b(invasion|encasement|encases?|infiltrates?|resectability|"
|
| 23 |
+
r"operable|staging|staged)\b", re.IGNORECASE)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def audit_one(pid, vname, text, cond):
|
| 27 |
+
v = []
|
| 28 |
+
if not text or not text.strip():
|
| 29 |
+
return ["empty"]
|
| 30 |
+
t = text.strip()
|
| 31 |
+
n_words = len(t.split())
|
| 32 |
+
if vname == "V4_tag_string":
|
| 33 |
+
n_tags = len([x for x in t.split(",") if x.strip()])
|
| 34 |
+
if n_tags < 6:
|
| 35 |
+
v.append(f"too_short:{n_tags}<6tags")
|
| 36 |
+
elif n_tags > 30:
|
| 37 |
+
v.append(f"too_long:{n_tags}>30tags")
|
| 38 |
+
else:
|
| 39 |
+
band = {
|
| 40 |
+
"V7_pancreas_only": (40, 140),
|
| 41 |
+
**WORD_BAND,
|
| 42 |
+
}
|
| 43 |
+
lo, hi = band.get(vname, (1, 10_000))
|
| 44 |
+
if n_words < lo:
|
| 45 |
+
v.append(f"too_short:{n_words}<{lo}")
|
| 46 |
+
elif n_words > hi:
|
| 47 |
+
v.append(f"too_long:{n_words}>{hi}")
|
| 48 |
+
|
| 49 |
+
if BANNED_RE.search(t):
|
| 50 |
+
v.append("banned")
|
| 51 |
+
if vname == "V7_pancreas_only" and V7_BAN_EXTRA.search(t):
|
| 52 |
+
v.append("v7_upgrade_word")
|
| 53 |
+
|
| 54 |
+
canon_pos = bool(cond.get("lesion_present"))
|
| 55 |
+
text_for_lesion = INCIDENTAL_CYST_RE.sub("", t)
|
| 56 |
+
any_lesion_word = bool(LESION_WORDS.search(text_for_lesion))
|
| 57 |
+
|
| 58 |
+
if vname == "V4_tag_string":
|
| 59 |
+
text_for_neg = re.sub(r",\s*", ". ", text_for_lesion)
|
| 60 |
+
else:
|
| 61 |
+
text_for_neg = text_for_lesion
|
| 62 |
+
|
| 63 |
+
if canon_pos:
|
| 64 |
+
if not any_lesion_word and vname != "V7_pancreas_only":
|
| 65 |
+
v.append("missing_lesion_mention")
|
| 66 |
+
elif vname == "V7_pancreas_only" and not any_lesion_word:
|
| 67 |
+
v.append("missing_lesion_mention")
|
| 68 |
+
canon_sizes = []
|
| 69 |
+
for L in cond.get("lesion_list", []):
|
| 70 |
+
for s in (L.get("size_cm") or []):
|
| 71 |
+
canon_sizes.append(round(float(s), 1))
|
| 72 |
+
text_dims = parse_dims_cm(t)
|
| 73 |
+
if canon_sizes and not any(abs(d - cs) < 0.2 for d in text_dims for cs in canon_sizes):
|
| 74 |
+
v.append("size_not_echoed")
|
| 75 |
+
else:
|
| 76 |
+
if has_unnegated_lesion(text_for_neg):
|
| 77 |
+
v.append("hallucinated_lesion_mention")
|
| 78 |
+
|
| 79 |
+
# V7 extra: pancreas-only content
|
| 80 |
+
if vname == "V7_pancreas_only":
|
| 81 |
+
extra = re.search(
|
| 82 |
+
r"\b(liver|hepatic|spleen|splenic|kidney|renal|bowel|habitus|"
|
| 83 |
+
r"subcutaneous|rib|skin|bladder)\b", t, re.IGNORECASE)
|
| 84 |
+
if extra:
|
| 85 |
+
v.append(f"extra_pancreatic:{extra.group(0).lower()}")
|
| 86 |
+
|
| 87 |
+
return v
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
def main():
|
| 91 |
+
per_variant = collections.defaultdict(lambda: {
|
| 92 |
+
"total": 0, "ok": 0, "violations": collections.Counter(),
|
| 93 |
+
"lens_words": []})
|
| 94 |
+
flagged = []
|
| 95 |
+
total_cases = 0
|
| 96 |
+
with open(FINAL) as f:
|
| 97 |
+
for line in f:
|
| 98 |
+
d = json.loads(line)
|
| 99 |
+
total_cases += 1
|
| 100 |
+
cond = d["cond"]
|
| 101 |
+
for vname, text in (d.get("captions") or {}).items():
|
| 102 |
+
stat = per_variant[vname]
|
| 103 |
+
stat["total"] += 1
|
| 104 |
+
stat["lens_words"].append(len((text or "").split()))
|
| 105 |
+
viol = audit_one(d["id"], vname, text or "", cond)
|
| 106 |
+
if not viol:
|
| 107 |
+
stat["ok"] += 1
|
| 108 |
+
else:
|
| 109 |
+
for x in viol:
|
| 110 |
+
stat["violations"][x.split(":")[0]] += 1
|
| 111 |
+
flagged.append({"id": d["id"], "variant": vname,
|
| 112 |
+
"violations": viol, "text": (text or "")[:300],
|
| 113 |
+
"lesion_present": bool(cond.get("lesion_present"))})
|
| 114 |
+
|
| 115 |
+
print(f"cases audited: {total_cases} flagged rows: {len(flagged)}")
|
| 116 |
+
print("\nPer-variant pass rate:")
|
| 117 |
+
for vname in sorted(per_variant):
|
| 118 |
+
s = per_variant[vname]
|
| 119 |
+
lens = s["lens_words"] or [0]
|
| 120 |
+
p50 = int(statistics.median(lens))
|
| 121 |
+
print(f" {vname:28s} total={s['total']:>5} ok={s['ok']:>5} "
|
| 122 |
+
f"pass={100*s['ok']/max(1,s['total']):5.1f}% p50_words={p50}")
|
| 123 |
+
print("\nTop violations overall:")
|
| 124 |
+
overall = collections.Counter()
|
| 125 |
+
for s in per_variant.values():
|
| 126 |
+
overall.update(s["violations"])
|
| 127 |
+
for k, c in overall.most_common(10):
|
| 128 |
+
print(f" {k}: {c}")
|
| 129 |
+
|
| 130 |
+
# write markdown
|
| 131 |
+
with open(OUT_MD, "w") as f:
|
| 132 |
+
f.write("# F6 Final Corpus QA (2026-04-20)\n\n")
|
| 133 |
+
f.write(f"- Source: `{FINAL}`\n")
|
| 134 |
+
f.write(f"- Cases: {total_cases}\n")
|
| 135 |
+
f.write(f"- Flagged rows (case × variant): {len(flagged)}\n\n")
|
| 136 |
+
f.write("| Variant | Total | OK | Pass % | P50 words | P95 words |\n")
|
| 137 |
+
f.write("|---|---|---|---|---|---|\n")
|
| 138 |
+
for vname in sorted(per_variant):
|
| 139 |
+
s = per_variant[vname]
|
| 140 |
+
lens = s["lens_words"] or [0]
|
| 141 |
+
p50 = int(statistics.median(lens))
|
| 142 |
+
p95 = int(sorted(lens)[int(len(lens)*0.95)-1])
|
| 143 |
+
f.write(f"| {vname} | {s['total']} | {s['ok']} | "
|
| 144 |
+
f"{100*s['ok']/max(1,s['total']):.1f}% | {p50} | {p95} |\n")
|
| 145 |
+
f.write("\n## Top violations\n\n")
|
| 146 |
+
for k, c in overall.most_common(15):
|
| 147 |
+
f.write(f"- `{k}`: {c}\n")
|
| 148 |
+
print(f"\nWrote: {OUT_MD}")
|
| 149 |
+
|
| 150 |
+
|
| 151 |
+
if __name__ == "__main__":
|
| 152 |
+
main()
|