JinghuiLuAstronaut commited on
Commit
8305ea2
·
verified ·
1 Parent(s): 9dc7320

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. LTA_openwebtext_dualt/logs/build_owt_gpt2_len1024_cached_chunks_fast.log +100 -0
  2. LTA_openwebtext_dualt/logs/infer_owt_compact_v2048_latest_compare_dir_dual_steps128_c1024_t1p4_n8.log +29 -0
  3. LTA_openwebtext_dualt/logs/lm1b_classic_dirichlet_every1k_infer_watch/infer_lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_20k_save1k_20260523_step_0004000_t1p45.log +36 -0
  4. LTA_openwebtext_dualt/logs/lm1b_classic_dirichlet_every1k_infer_watch/infer_lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_20k_save1k_20260523_step_0014000_t1p45.log +36 -0
  5. LTA_openwebtext_dualt/logs/lta_lm1b_bert_absrope_time4_dirichlet_len128_C1_to_1024_mask1_sameT_gbs512_b32_4gpu_1m_save1k_20260526.log +193 -0
  6. LTA_openwebtext_dualt/logs/lta_lm1b_dirichlet_len1024_Cv_to_2v_gbs512_8gpu_20k_save1k_gumbelwatch_20260524_watcher.pid +1 -0
  7. LTA_openwebtext_dualt/logs/lta_owt_t5elf_dirichlet_len1024_Cv_to_2v_mask1_gbs512_b32_4gpu_20k_save1k_20260525.nohup.log +204 -0
  8. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/packaging/_structures.py +33 -0
  9. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/packaging/requirements.py +129 -0
  10. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/packaging/tags.py +932 -0
  11. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/shellingham/__init__.py +23 -0
  12. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/shellingham/_core.py +11 -0
  13. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/aria/configuration_aria.py +149 -0
  14. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/__init__.py +31 -0
  15. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/configuration_ovis2.py +102 -0
  16. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/image_processing_ovis2.py +327 -0
  17. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/image_processing_pil_ovis2.py +297 -0
  18. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/modular_ovis2.py +448 -0
  19. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/processing_ovis2.py +149 -0
  20. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/timesformer/__init__.py +27 -0
LTA_openwebtext_dualt/logs/build_owt_gpt2_len1024_cached_chunks_fast.log ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [cache] records=100000 chunks=108485 buffer_tokens=653 elapsed=141.8s recent=141.8s
2
+ [cache] records=200000 chunks=218385 buffer_tokens=769 elapsed=291.6s recent=149.8s
3
+ [cache] records=300000 chunks=327438 buffer_tokens=316 elapsed=439.4s recent=147.8s
4
+ [cache] records=400000 chunks=436813 buffer_tokens=707 elapsed=588.4s recent=149.0s
5
+ [cache] records=500000 chunks=544661 buffer_tokens=271 elapsed=735.3s recent=146.9s
6
+ [cache] records=600000 chunks=652783 buffer_tokens=137 elapsed=882.9s recent=147.6s
7
+ [cache] records=700000 chunks=761924 buffer_tokens=967 elapsed=1033.7s recent=150.9s
8
+ [cache] records=800000 chunks=869711 buffer_tokens=865 elapsed=1181.7s recent=148.0s
9
+ [cache] records=900000 chunks=978424 buffer_tokens=33 elapsed=1330.2s recent=148.5s
10
+ [cache] records=1000000 chunks=1104688 buffer_tokens=596 elapsed=1503.6s recent=173.4s
11
+ [cache] records=1100000 chunks=1213189 buffer_tokens=557 elapsed=1652.5s recent=148.9s
12
+ [cache] records=1200000 chunks=1321827 buffer_tokens=796 elapsed=1799.1s recent=146.6s
13
+ [cache] records=1300000 chunks=1429996 buffer_tokens=815 elapsed=1946.7s recent=147.5s
14
+ [cache] records=1400000 chunks=1538134 buffer_tokens=601 elapsed=2094.5s recent=147.9s
15
+ [cache] records=1500000 chunks=1647134 buffer_tokens=193 elapsed=2244.5s recent=150.0s
16
+ [cache] records=1600000 chunks=1755751 buffer_tokens=62 elapsed=2394.0s recent=149.4s
17
+ [cache] records=1700000 chunks=1865278 buffer_tokens=483 elapsed=2544.0s recent=150.1s
18
+ [cache] records=1800000 chunks=1973006 buffer_tokens=453 elapsed=2692.5s recent=148.5s
19
+ [cache] records=1900000 chunks=2081066 buffer_tokens=830 elapsed=2840.7s recent=148.1s
20
+ [cache] records=2000000 chunks=2207191 buffer_tokens=545 elapsed=3011.7s recent=171.0s
21
+ [cache] records=2100000 chunks=2316435 buffer_tokens=164 elapsed=3160.0s recent=148.3s
22
+ [cache] records=2200000 chunks=2425486 buffer_tokens=111 elapsed=3308.1s recent=148.1s
23
+ [cache] records=2300000 chunks=2534619 buffer_tokens=319 elapsed=3456.0s recent=148.0s
24
+ [cache] records=2400000 chunks=2644127 buffer_tokens=375 elapsed=3604.4s recent=148.3s
25
+ [cache] records=2500000 chunks=2751903 buffer_tokens=709 elapsed=3750.8s recent=146.4s
26
+ [cache] records=2600000 chunks=2861117 buffer_tokens=983 elapsed=3898.9s recent=148.1s
27
+ [cache] records=2700000 chunks=2968962 buffer_tokens=768 elapsed=4045.3s recent=146.4s
28
+ [cache] records=2800000 chunks=3076780 buffer_tokens=114 elapsed=4191.5s recent=146.2s
29
+ [cache] records=2900000 chunks=3203666 buffer_tokens=101 elapsed=4363.9s recent=172.4s
30
+ [cache] records=3000000 chunks=3311828 buffer_tokens=634 elapsed=4511.5s recent=147.5s
31
+ [cache] records=3100000 chunks=3419378 buffer_tokens=156 elapsed=4657.2s recent=145.8s
32
+ [cache] records=3200000 chunks=3527966 buffer_tokens=367 elapsed=4805.4s recent=148.1s
33
+ [cache] records=3300000 chunks=3637008 buffer_tokens=810 elapsed=4953.5s recent=148.2s
34
+ [cache] records=3400000 chunks=3744903 buffer_tokens=142 elapsed=5100.9s recent=147.4s
35
+ [cache] records=3500000 chunks=3853630 buffer_tokens=506 elapsed=5249.2s recent=148.3s
36
+ [cache] records=3600000 chunks=3962366 buffer_tokens=775 elapsed=5396.6s recent=147.5s
37
+ [cache] records=3700000 chunks=4070628 buffer_tokens=493 elapsed=5543.8s recent=147.1s
38
+ [cache] records=3800000 chunks=4178761 buffer_tokens=792 elapsed=5691.1s recent=147.3s
39
+ [cache] records=3900000 chunks=4305753 buffer_tokens=676 elapsed=5862.8s recent=171.7s
40
+ [cache] records=4000000 chunks=4413812 buffer_tokens=682 elapsed=6009.9s recent=147.1s
41
+ [cache] records=4100000 chunks=4522560 buffer_tokens=647 elapsed=6158.3s recent=148.4s
42
+ [cache] records=4200000 chunks=4632049 buffer_tokens=558 elapsed=6307.0s recent=148.7s
43
+ [cache] records=4300000 chunks=4740354 buffer_tokens=841 elapsed=6454.7s recent=147.7s
44
+ [cache] records=4400000 chunks=4849473 buffer_tokens=213 elapsed=6604.8s recent=150.1s
45
+ [cache] records=4500000 chunks=4958322 buffer_tokens=735 elapsed=6754.8s recent=150.0s
46
+ [cache] records=4600000 chunks=5067328 buffer_tokens=236 elapsed=6904.6s recent=149.8s
47
+ [cache] records=4700000 chunks=5175728 buffer_tokens=876 elapsed=7053.9s recent=149.2s
48
+ [cache] records=4800000 chunks=5283551 buffer_tokens=95 elapsed=7202.6s recent=148.7s
49
+ [cache] records=4900000 chunks=5411131 buffer_tokens=453 elapsed=7376.1s recent=173.5s
50
+ [cache] records=5000000 chunks=5519097 buffer_tokens=852 elapsed=7523.4s recent=147.3s
51
+ [cache] records=5100000 chunks=5628354 buffer_tokens=500 elapsed=7672.1s recent=148.7s
52
+ [cache] records=5200000 chunks=5737569 buffer_tokens=612 elapsed=7821.8s recent=149.7s
53
+ [cache] records=5300000 chunks=5846808 buffer_tokens=279 elapsed=7971.0s recent=149.2s
54
+ [cache] records=5400000 chunks=5954738 buffer_tokens=842 elapsed=8120.0s recent=149.0s
55
+ [cache] records=5500000 chunks=6063404 buffer_tokens=780 elapsed=8269.6s recent=149.6s
56
+ [cache] records=5600000 chunks=6172338 buffer_tokens=71 elapsed=8418.5s recent=148.9s
57
+ [cache] records=5700000 chunks=6281171 buffer_tokens=125 elapsed=8568.2s recent=149.7s
58
+ [cache] records=5800000 chunks=6407255 buffer_tokens=713 elapsed=8741.0s recent=172.8s
59
+ [cache] records=5900000 chunks=6515836 buffer_tokens=484 elapsed=8889.8s recent=148.7s
60
+ [cache] records=6000000 chunks=6624316 buffer_tokens=735 elapsed=9038.9s recent=149.1s
61
+ [cache] records=6100000 chunks=6732297 buffer_tokens=387 elapsed=9186.4s recent=147.4s
62
+ [cache] records=6200000 chunks=6840706 buffer_tokens=840 elapsed=9335.2s recent=148.9s
63
+ [cache] records=6300000 chunks=6948960 buffer_tokens=730 elapsed=9483.9s recent=148.7s
64
+ [cache] records=6400000 chunks=7057042 buffer_tokens=438 elapsed=9630.5s recent=146.6s
65
+ [cache] records=6500000 chunks=7166013 buffer_tokens=783 elapsed=9778.9s recent=148.4s
66
+ [cache] records=6600000 chunks=7273882 buffer_tokens=179 elapsed=9925.8s recent=146.9s
67
+ [cache] records=6700000 chunks=7381269 buffer_tokens=200 elapsed=10072.4s recent=146.6s
68
+ [cache] records=6800000 chunks=7507592 buffer_tokens=1000 elapsed=10244.1s recent=171.6s
69
+ [cache] records=6900000 chunks=7616146 buffer_tokens=383 elapsed=10391.8s recent=147.8s
70
+ [cache] records=7000000 chunks=7724177 buffer_tokens=569 elapsed=10539.5s recent=147.7s
71
+ [cache] records=7100000 chunks=7832286 buffer_tokens=528 elapsed=10687.1s recent=147.5s
72
+ [cache] records=7200000 chunks=7940257 buffer_tokens=491 elapsed=10833.1s recent=146.1s
73
+ [cache] records=7300000 chunks=8048719 buffer_tokens=784 elapsed=10980.6s recent=147.5s
74
+ [cache] records=7400000 chunks=8156886 buffer_tokens=224 elapsed=11127.1s recent=146.5s
75
+ [cache] records=7500000 chunks=8264279 buffer_tokens=418 elapsed=11273.5s recent=146.4s
76
+ [cache] records=7600000 chunks=8372134 buffer_tokens=795 elapsed=11420.1s recent=146.6s
77
+ [cache] records=7700000 chunks=8481587 buffer_tokens=164 elapsed=11568.6s recent=148.4s
78
+ [cache] records=7800000 chunks=8608641 buffer_tokens=245 elapsed=11742.0s recent=173.5s
79
+ [cache] records=7900000 chunks=8716430 buffer_tokens=913 elapsed=11889.2s recent=147.2s
80
+ {
81
+ "data_path": "/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext",
82
+ "text_column": "text",
83
+ "txt_record_mode": "auto",
84
+ "openwebtext_split": "train_minus_100k",
85
+ "detokenizer": null,
86
+ "max_len": 1024,
87
+ "payload_len": 1022,
88
+ "num_chunks": 8734897,
89
+ "num_records": 7913769,
90
+ "dtype": "int32",
91
+ "bos_id": 50256,
92
+ "eos_id": 50256,
93
+ "vocab_size": 50257,
94
+ "packing": "flm_stream_wrapped",
95
+ "dropped_remainder_tokens": 595,
96
+ "builder": "fast_encode_batch_ordered_v2",
97
+ "encode_batch_size": 16384,
98
+ "write_batch_chunks": 16384
99
+ }
100
+ [cache] done elapsed=11914.3s bytes=35778138112
LTA_openwebtext_dualt/logs/infer_owt_compact_v2048_latest_compare_dir_dual_steps128_c1024_t1p4_n8.log ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [infer] ckpt=runs/lta_owt_compact_gpt2bpe_v2048_stream1024_fullycoupled_rmsnorm_nobias_adamw_wd0p1_logitnormal_m1p5_s0p8_hardce_mask1p0-1p0_fp32_ddit768x12_gbs512_8gpu_1m_20260517_141027/latest.pt
2
+ [infer] rule=dirichlet_resample out=docs/lta_samples/metrics_20260519/owt_compact_v2048_latest_compare_dir_dual_steps128_c1024_t1p4_n8/dirichlet_resample.jsonl
3
+ [ckpt] runs/lta_owt_compact_gpt2bpe_v2048_stream1024_fullycoupled_rmsnorm_nobias_adamw_wd0p1_logitnormal_m1p5_s0p8_hardce_mask1p0-1p0_fp32_ddit768x12_gbs512_8gpu_1m_20260517_141027/latest.pt step=75000
4
+ [decode-base] n=8 max_len=1024 steps=128 model_t=post
5
+ [decode-time] schedule=linear s=[0.0,0.25] gumbel=(2.2,0.8) force_final=True t0=0.000000 t_mid=0.500000 t_end=1.000000 dt_mean=0.007812 dt_max=0.007812
6
+ [decode] temp=1.40 final=state rule=dirichlet_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 1/8
7
+ [decode] temp=1.40 final=state rule=dirichlet_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 2/8
8
+ [decode] temp=1.40 final=state rule=dirichlet_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 3/8
9
+ [decode] temp=1.40 final=state rule=dirichlet_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 4/8
10
+ [decode] temp=1.40 final=state rule=dirichlet_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 5/8
11
+ [decode] temp=1.40 final=state rule=dirichlet_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 6/8
12
+ [decode] temp=1.40 final=state rule=dirichlet_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 7/8
13
+ [decode] temp=1.40 final=state rule=dirichlet_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 8/8
14
+ [summary] {"type": "summary", "checkpoint": "runs/lta_owt_compact_gpt2bpe_v2048_stream1024_fullycoupled_rmsnorm_nobias_adamw_wd0p1_logitnormal_m1p5_s0p8_hardce_mask1p0-1p0_fp32_ddit768x12_gbs512_8gpu_1m_20260517_141027/latest.pt", "step": 75000, "decode": {"steps": 128, "model_t_mode": "post", "decode_time_schedule": "linear", "decode_s_min_frac": 0.0, "decode_s_max_frac": 0.25, "decode_force_final_t": true, "decode_time_grid": [0.0, 0.0078125, 0.015625, 0.0234375, 0.03125, 0.0390625, 0.046875, 0.0546875, 0.0625, 0.0703125, 0.078125, 0.0859375, 0.09375, 0.1015625, 0.109375, 0.1171875, 0.125, 0.1328125, 0.140625, 0.1484375, 0.15625, 0.1640625, 0.171875, 0.1796875, 0.1875, 0.1953125, 0.203125, 0.2109375, 0.21875, 0.2265625, 0.234375, 0.2421875, 0.25, 0.2578125, 0.265625, 0.2734375, 0.28125, 0.2890625, 0.296875, 0.3046875, 0.3125, 0.3203125, 0.328125, 0.3359375, 0.34375, 0.3515625, 0.359375, 0.3671875, 0.375, 0.3828125, 0.390625, 0.3984375, 0.40625, 0.4140625, 0.421875, 0.4296875, 0.4375, 0.4453125, 0.453125, 0.4609375, 0.46875, 0.4765625, 0.484375, 0.4921875, 0.5, 0.5078125, 0.515625, 0.5234375, 0.53125, 0.5390625, 0.546875, 0.5546875, 0.5625, 0.5703125, 0.578125, 0.5859375, 0.59375, 0.6015625, 0.609375, 0.6171875, 0.625, 0.6328125, 0.640625, 0.6484375, 0.65625, 0.6640625, 0.671875, 0.6796875, 0.6875, 0.6953125, 0.703125, 0.7109375, 0.71875, 0.7265625, 0.734375, 0.7421875, 0.75, 0.7578125, 0.765625, 0.7734375, 0.78125, 0.7890625, 0.796875, 0.8046875, 0.8125, 0.8203125, 0.828125, 0.8359375, 0.84375, 0.8515625, 0.859375, 0.8671875, 0.875, 0.8828125, 0.890625, 0.8984375, 0.90625, 0.9140625, 0.921875, 0.9296875, 0.9375, 0.9453125, 0.953125, 0.9609375, 0.96875, 0.9765625, 0.984375, 0.9921875, 1.0], "decode_rule": "dirichlet_resample", "support_power": 1.0, "semantic_power": 1.0, "anchor_mode": "onehot", "cfg_scale": 0.0, "cfg_power": 1.0, "cfg_start": 0.0, "cfg_prior": "uniform", "decode_freq_penalty_alpha": 0.0, "decode_freq_penalty_beta": 0.0, "decode_freq_penalty_floor": 0.0, "decode_freq_penalty_start": 0.0, "decode_freq_penalty_end": 1.0, "decode_freq_penalty_power": 1.0, "start_t": 0.0, "start_init": "noise", "noise_init": "dirichlet", "noise_sigma": -1.0, "dirichlet_concentration": 1.0, "concentration_min": 1.0, "concentration_max": 1024.0, "target_prob": 1.0, "endpoint_temp": 1.4, "final_from": "state", "final_sample_mode": "argmax", "final_sample_temp": 1.0, "final_top_k": 64, "final_top_p": 0.95, "final_freq_penalty_alpha": 0.0, "final_freq_penalty_beta": 0.0, "final_freq_penalty_floor": 0.0, "lock_bos": false, "n_samples": 8, "seed": 20260519}, "raw_genppl": {"ppl": 5.721501467126203, "nll_per_token": 1.7442312651989507, "tokens": 2040, "kept_samples": 8, "total_samples": 8, "empty_rate": 0.0, "skipped_samples": 0}, "stripped_genppl": {"ppl": 6.053917778986924, "nll_per_token": 1.800705629236558, "tokens": 2040, "kept_samples": 8, "total_samples": 8, "empty_rate": 0.0, "skipped_samples": 0}, "diversity": {"sample_entropy": 0.8634121112371498, "unique_tokens": 30, "token_count": 8192, "distinct_1": 0.003662109375, "distinct_2": 0.02297165200391007, "top_token_mass": 0.3948974609375}}
15
+ [done] docs/lta_samples/metrics_20260519/owt_compact_v2048_latest_compare_dir_dual_steps128_c1024_t1p4_n8/dirichlet_resample.jsonl
16
+ [infer] rule=dual_line_resample out=docs/lta_samples/metrics_20260519/owt_compact_v2048_latest_compare_dir_dual_steps128_c1024_t1p4_n8/dual_line_resample.jsonl
17
+ [ckpt] runs/lta_owt_compact_gpt2bpe_v2048_stream1024_fullycoupled_rmsnorm_nobias_adamw_wd0p1_logitnormal_m1p5_s0p8_hardce_mask1p0-1p0_fp32_ddit768x12_gbs512_8gpu_1m_20260517_141027/latest.pt step=75000
18
+ [decode-base] n=8 max_len=1024 steps=128 model_t=post
19
+ [decode-time] schedule=linear s=[0.0,0.25] gumbel=(2.2,0.8) force_final=True t0=0.000000 t_mid=0.500000 t_end=1.000000 dt_mean=0.007812 dt_max=0.007812
20
+ [decode] temp=1.40 final=state rule=dual_line_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 1/8
21
+ [decode] temp=1.40 final=state rule=dual_line_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 2/8
22
+ [decode] temp=1.40 final=state rule=dual_line_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 3/8
23
+ [decode] temp=1.40 final=state rule=dual_line_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 4/8
24
+ [decode] temp=1.40 final=state rule=dual_line_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 5/8
25
+ [decode] temp=1.40 final=state rule=dual_line_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 6/8
26
+ [decode] temp=1.40 final=state rule=dual_line_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 7/8
27
+ [decode] temp=1.40 final=state rule=dual_line_resample support=1 semantic=1 anchor=onehot cfg=0/1@0:uniform decode_freq_penalty=0/0/0-1^1 final_sample=argmax/1/k64/p0.95 freq_penalty=0/0/0 start_t=0 start_init=noise time_path=0.0000->1.0000 generated 8/8
28
+ [summary] {"type": "summary", "checkpoint": "runs/lta_owt_compact_gpt2bpe_v2048_stream1024_fullycoupled_rmsnorm_nobias_adamw_wd0p1_logitnormal_m1p5_s0p8_hardce_mask1p0-1p0_fp32_ddit768x12_gbs512_8gpu_1m_20260517_141027/latest.pt", "step": 75000, "decode": {"steps": 128, "model_t_mode": "post", "decode_time_schedule": "linear", "decode_s_min_frac": 0.0, "decode_s_max_frac": 0.25, "decode_force_final_t": true, "decode_time_grid": [0.0, 0.0078125, 0.015625, 0.0234375, 0.03125, 0.0390625, 0.046875, 0.0546875, 0.0625, 0.0703125, 0.078125, 0.0859375, 0.09375, 0.1015625, 0.109375, 0.1171875, 0.125, 0.1328125, 0.140625, 0.1484375, 0.15625, 0.1640625, 0.171875, 0.1796875, 0.1875, 0.1953125, 0.203125, 0.2109375, 0.21875, 0.2265625, 0.234375, 0.2421875, 0.25, 0.2578125, 0.265625, 0.2734375, 0.28125, 0.2890625, 0.296875, 0.3046875, 0.3125, 0.3203125, 0.328125, 0.3359375, 0.34375, 0.3515625, 0.359375, 0.3671875, 0.375, 0.3828125, 0.390625, 0.3984375, 0.40625, 0.4140625, 0.421875, 0.4296875, 0.4375, 0.4453125, 0.453125, 0.4609375, 0.46875, 0.4765625, 0.484375, 0.4921875, 0.5, 0.5078125, 0.515625, 0.5234375, 0.53125, 0.5390625, 0.546875, 0.5546875, 0.5625, 0.5703125, 0.578125, 0.5859375, 0.59375, 0.6015625, 0.609375, 0.6171875, 0.625, 0.6328125, 0.640625, 0.6484375, 0.65625, 0.6640625, 0.671875, 0.6796875, 0.6875, 0.6953125, 0.703125, 0.7109375, 0.71875, 0.7265625, 0.734375, 0.7421875, 0.75, 0.7578125, 0.765625, 0.7734375, 0.78125, 0.7890625, 0.796875, 0.8046875, 0.8125, 0.8203125, 0.828125, 0.8359375, 0.84375, 0.8515625, 0.859375, 0.8671875, 0.875, 0.8828125, 0.890625, 0.8984375, 0.90625, 0.9140625, 0.921875, 0.9296875, 0.9375, 0.9453125, 0.953125, 0.9609375, 0.96875, 0.9765625, 0.984375, 0.9921875, 1.0], "decode_rule": "dual_line_resample", "support_power": 1.0, "semantic_power": 1.0, "anchor_mode": "onehot", "cfg_scale": 0.0, "cfg_power": 1.0, "cfg_start": 0.0, "cfg_prior": "uniform", "decode_freq_penalty_alpha": 0.0, "decode_freq_penalty_beta": 0.0, "decode_freq_penalty_floor": 0.0, "decode_freq_penalty_start": 0.0, "decode_freq_penalty_end": 1.0, "decode_freq_penalty_power": 1.0, "start_t": 0.0, "start_init": "noise", "noise_init": "dirichlet", "noise_sigma": -1.0, "dirichlet_concentration": 1.0, "concentration_min": 1.0, "concentration_max": 1024.0, "target_prob": 1.0, "endpoint_temp": 1.4, "final_from": "state", "final_sample_mode": "argmax", "final_sample_temp": 1.0, "final_top_k": 64, "final_top_p": 0.95, "final_freq_penalty_alpha": 0.0, "final_freq_penalty_beta": 0.0, "final_freq_penalty_floor": 0.0, "lock_bos": false, "n_samples": 8, "seed": 20260519}, "raw_genppl": {"ppl": 10.269459151870745, "nll_per_token": 2.329174359639486, "tokens": 2040, "kept_samples": 8, "total_samples": 8, "empty_rate": 0.0, "skipped_samples": 0}, "stripped_genppl": {"ppl": 10.226794329481784, "nll_per_token": 2.3250111710791495, "tokens": 2040, "kept_samples": 8, "total_samples": 8, "empty_rate": 0.0, "skipped_samples": 0}, "diversity": {"sample_entropy": 0.8533172316541697, "unique_tokens": 60, "token_count": 8192, "distinct_1": 0.00732421875, "distinct_2": 0.028470185728250243, "top_token_mass": 0.4017333984375}}
29
+ [done] docs/lta_samples/metrics_20260519/owt_compact_v2048_latest_compare_dir_dual_steps128_c1024_t1p4_n8/dual_line_resample.jsonl
LTA_openwebtext_dualt/logs/lm1b_classic_dirichlet_every1k_infer_watch/infer_lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_20k_save1k_20260523_step_0004000_t1p45.log ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [watch-classic-1k] 2026-05-23_18:14:51 infer runs/lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_20k_save1k_20260523/step_0004000.pt -> docs/lta_samples/metrics_20260523/lm1b_classic_dirichlet_len512_every1k_normal_steps_state_t1p45_c1024_n256/lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_20k_save1k_20260523/step_0004000
2
+ [ckpt] runs/lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_20k_save1k_20260523/step_0004000.pt step=4000
3
+ [decode] steps128_c1024_t1p45 generated 8/256
4
+ [decode] steps128_c1024_t1p45 generated 16/256
5
+ [decode] steps128_c1024_t1p45 generated 24/256
6
+ [decode] steps128_c1024_t1p45 generated 32/256
7
+ [decode] steps128_c1024_t1p45 generated 40/256
8
+ [decode] steps128_c1024_t1p45 generated 48/256
9
+ [decode] steps128_c1024_t1p45 generated 56/256
10
+ [decode] steps128_c1024_t1p45 generated 64/256
11
+ [decode] steps128_c1024_t1p45 generated 72/256
12
+ [decode] steps128_c1024_t1p45 generated 80/256
13
+ [decode] steps128_c1024_t1p45 generated 88/256
14
+ [decode] steps128_c1024_t1p45 generated 96/256
15
+ [decode] steps128_c1024_t1p45 generated 104/256
16
+ [decode] steps128_c1024_t1p45 generated 112/256
17
+ [decode] steps128_c1024_t1p45 generated 120/256
18
+ [decode] steps128_c1024_t1p45 generated 128/256
19
+ [decode] steps128_c1024_t1p45 generated 136/256
20
+ [decode] steps128_c1024_t1p45 generated 144/256
21
+ [decode] steps128_c1024_t1p45 generated 152/256
22
+ [decode] steps128_c1024_t1p45 generated 160/256
23
+ [decode] steps128_c1024_t1p45 generated 168/256
24
+ [decode] steps128_c1024_t1p45 generated 176/256
25
+ [decode] steps128_c1024_t1p45 generated 184/256
26
+ [decode] steps128_c1024_t1p45 generated 192/256
27
+ [decode] steps128_c1024_t1p45 generated 200/256
28
+ [decode] steps128_c1024_t1p45 generated 208/256
29
+ [decode] steps128_c1024_t1p45 generated 216/256
30
+ [decode] steps128_c1024_t1p45 generated 224/256
31
+ [decode] steps128_c1024_t1p45 generated 232/256
32
+ [decode] steps128_c1024_t1p45 generated 240/256
33
+ [decode] steps128_c1024_t1p45 generated 248/256
34
+ [decode] steps128_c1024_t1p45 generated 256/256
35
+ [summary] {"name": "steps128_c1024_t1p45", "step": 4000, "decode_steps": 128, "concentration_max": 1024.0, "raw_genppl": 11.650994762534163, "stripped_genppl": 11.735267921260704, "sample_entropy": 0.14561788086881036, "distinct_1": 0.0013427734375, "distinct_2": 0.00368456457925636, "top_token_mass": 0.9227676391601562, "raw_kept": 256, "stripped_kept": 256}
36
+ [watch-classic-1k] 2026-05-23_18:20:56 done step_0004000
LTA_openwebtext_dualt/logs/lm1b_classic_dirichlet_every1k_infer_watch/infer_lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_20k_save1k_20260523_step_0014000_t1p45.log ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [watch-classic-1k] 2026-05-23_21:55:07 infer runs/lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_20k_save1k_20260523/step_0014000.pt -> docs/lta_samples/metrics_20260523/lm1b_classic_dirichlet_len512_every1k_normal_steps_state_t1p45_c1024_n256/lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_20k_save1k_20260523/step_0014000
2
+ [ckpt] runs/lta_lm1b_classic_dirichlet_len512_gbs512_4gpu_20k_save1k_20260523/step_0014000.pt step=14000
3
+ [decode] steps128_c1024_t1p45 generated 8/256
4
+ [decode] steps128_c1024_t1p45 generated 16/256
5
+ [decode] steps128_c1024_t1p45 generated 24/256
6
+ [decode] steps128_c1024_t1p45 generated 32/256
7
+ [decode] steps128_c1024_t1p45 generated 40/256
8
+ [decode] steps128_c1024_t1p45 generated 48/256
9
+ [decode] steps128_c1024_t1p45 generated 56/256
10
+ [decode] steps128_c1024_t1p45 generated 64/256
11
+ [decode] steps128_c1024_t1p45 generated 72/256
12
+ [decode] steps128_c1024_t1p45 generated 80/256
13
+ [decode] steps128_c1024_t1p45 generated 88/256
14
+ [decode] steps128_c1024_t1p45 generated 96/256
15
+ [decode] steps128_c1024_t1p45 generated 104/256
16
+ [decode] steps128_c1024_t1p45 generated 112/256
17
+ [decode] steps128_c1024_t1p45 generated 120/256
18
+ [decode] steps128_c1024_t1p45 generated 128/256
19
+ [decode] steps128_c1024_t1p45 generated 136/256
20
+ [decode] steps128_c1024_t1p45 generated 144/256
21
+ [decode] steps128_c1024_t1p45 generated 152/256
22
+ [decode] steps128_c1024_t1p45 generated 160/256
23
+ [decode] steps128_c1024_t1p45 generated 168/256
24
+ [decode] steps128_c1024_t1p45 generated 176/256
25
+ [decode] steps128_c1024_t1p45 generated 184/256
26
+ [decode] steps128_c1024_t1p45 generated 192/256
27
+ [decode] steps128_c1024_t1p45 generated 200/256
28
+ [decode] steps128_c1024_t1p45 generated 208/256
29
+ [decode] steps128_c1024_t1p45 generated 216/256
30
+ [decode] steps128_c1024_t1p45 generated 224/256
31
+ [decode] steps128_c1024_t1p45 generated 232/256
32
+ [decode] steps128_c1024_t1p45 generated 240/256
33
+ [decode] steps128_c1024_t1p45 generated 248/256
34
+ [decode] steps128_c1024_t1p45 generated 256/256
35
+ [summary] {"name": "steps128_c1024_t1p45", "step": 14000, "decode_steps": 128, "concentration_max": 1024.0, "raw_genppl": 26.115239555828243, "stripped_genppl": 28.510617958544135, "sample_entropy": 4.184041060828689, "distinct_1": 0.02449798583984375, "distinct_2": 0.16947468199608612, "top_token_mass": 0.12488555908203125, "raw_kept": 256, "stripped_kept": 256}
36
+ [watch-classic-1k] 2026-05-23_22:01:32 done step_0014000
LTA_openwebtext_dualt/logs/lta_lm1b_bert_absrope_time4_dirichlet_len128_C1_to_1024_mask1_sameT_gbs512_b32_4gpu_1m_save1k_20260526.log ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ *****************************************
3
+ Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.
4
+ *****************************************
5
+ NCCL version 2.25.1+cuda12.8
6
+ {
7
+ "device": "cuda:0",
8
+ "rank": 0,
9
+ "world_size": 4,
10
+ "samples": "wrapped_stream",
11
+ "vocab_size": 30522,
12
+ "tokenizer_vocab_size": 30522,
13
+ "save_dir": "runs/lta_lm1b_bert_absrope_time4_dirichlet_len128_C1_to_1024_mask1_sameT_gbs512_b32_4gpu_1m_save1k_20260526",
14
+ "max_len": 128,
15
+ "effective_model_max_len": 128,
16
+ "batch_size": 32,
17
+ "grad_accum": 4,
18
+ "effective_batch_size": 512,
19
+ "global_batch_size": 512,
20
+ "lr_schedule": "constant_warmup",
21
+ "optimizer": "adamw",
22
+ "epochs": 0.0,
23
+ "steps_per_epoch": 0,
24
+ "total_steps": 1000000,
25
+ "warmup_steps": 2500,
26
+ "warmup_epochs": -1.0,
27
+ "min_lr": 6e-05,
28
+ "weight_decay": 0.0,
29
+ "output_weight_decay": -1.0,
30
+ "adamw_param_groups": "nanogpt",
31
+ "adam_beta1": 0.9,
32
+ "adam_beta2": 0.999,
33
+ "adam_eps": 1e-08,
34
+ "muon_impl": "legacy",
35
+ "muon_momentum": 0.95,
36
+ "muon_ns_steps": 5,
37
+ "muon_update_scale": 1.0,
38
+ "muon_nesterov": false,
39
+ "muon_width_scale": false,
40
+ "muon_grouping": "",
41
+ "muon_param_count": 0,
42
+ "muon_adam_param_count": 0,
43
+ "muon_param_names": [],
44
+ "muon_adam_param_names": [],
45
+ "muon_effective_nesterov": false,
46
+ "muon_effective_width_scale": false,
47
+ "muon_effective_weight_decay": 0.0,
48
+ "muon_adam_fallback_nesterov": false,
49
+ "muon_adam_fallback_weight_decay": 0.0,
50
+ "ema_decay": 0.0,
51
+ "ema_start_step": 0,
52
+ "model_type": "ddit_elf",
53
+ "ddit_mlp_type": "gelu",
54
+ "elf_num_time_tokens": 4,
55
+ "elf_num_model_mode_tokens": 0,
56
+ "abs_pos_embed": true,
57
+ "qk_norm": true,
58
+ "output_bias": false,
59
+ "output_init_std": -1.0,
60
+ "norm_type": "rmsnorm",
61
+ "target_loss": "hard_ce",
62
+ "linear_soft_target_power": 1.0,
63
+ "linear_soft_target_min_conf": 0.0,
64
+ "linear_soft_target_max_conf": 1.0,
65
+ "t_sampling_mode": "uniform",
66
+ "t_sampling_power": 1.0,
67
+ "t_sampling_eps": 0.0001,
68
+ "t_sampling_logit_mean": -1.5,
69
+ "t_sampling_logit_std": 0.8,
70
+ "t_sampling_gumbel_loc": 2.2,
71
+ "t_sampling_gumbel_scale": 0.8,
72
+ "dual_t": true,
73
+ "corrupt_t_mode": "same",
74
+ "corrupt_min_t": 0.0,
75
+ "corrupt_max_t": 1.0,
76
+ "prefix_block_prob": 0.0,
77
+ "prefix_block_len": 128,
78
+ "block_ar_two_stream": false,
79
+ "block_ar_block_len": 128,
80
+ "mask_ratio_floor_schedule": "none",
81
+ "dirichlet_endpoint_mode": "categorical_dual_t",
82
+ "dirichlet_semantic_t_mode": "same",
83
+ "dirichlet_semantic_t_value": 0.0,
84
+ "dirichlet_semantic_t_curve": "linear",
85
+ "dirichlet_semantic_t_power": 1.0,
86
+ "dirichlet_support_t_curve": "linear",
87
+ "dirichlet_support_t_power": 1.0,
88
+ "endpoint_sequence_random_prob_alpha": 0.0,
89
+ "categorical_wrong_from_full_vocab": true,
90
+ "categorical_wrong_from_batch_valid_tokens": false,
91
+ "categorical_wrong_basin_token_ids": "",
92
+ "categorical_wrong_basin_prob": 0.0,
93
+ "categorical_wrong_unigram_prob": 0.0,
94
+ "categorical_wrong_uniform_prob": 0.0,
95
+ "categorical_wrong_prob_floor": 0.0,
96
+ "categorical_gold_prob_floor": 0.0,
97
+ "categorical_gold_prob_ceil": 1.0,
98
+ "categorical_wrong_corpus_unigram_path": "",
99
+ "categorical_wrong_corpus_unigram_alpha": 1.0,
100
+ "categorical_wrong_basin_shared_prob": 0.0,
101
+ "categorical_wrong_unigram_shared_prob": 0.0,
102
+ "mask_mixture_original_prob": 0.0,
103
+ "mask_mixture_lowk_prob": 0.0,
104
+ "mask_mixture_lowcorrupt_prob": 0.0,
105
+ "mask_mixture_block_prob": 0.0,
106
+ "mask_mixture_all_prob": 0.0,
107
+ "mask_mixture_lowk_clean_tokens": "1,2,4,8,16,32,64",
108
+ "mask_mixture_lowcorrupt_tokens": "1,2,4,8,16,32,64",
109
+ "mask_mixture_block_tokens": "64,128",
110
+ "simplex_bridge_sampler": "dirichlet",
111
+ "logistic_normal_sigma_min": 0.18,
112
+ "logistic_normal_sigma_max": 2.2,
113
+ "logistic_normal_tau_min": 0.65,
114
+ "logistic_normal_tau_max": 1.15,
115
+ "torch_compile": false,
116
+ "compile_mode": "max-autotune",
117
+ "state_format": "prob",
118
+ "meanflow_weight": 0.0,
119
+ "rollout_train_prob": 0.0,
120
+ "rollout_train_steps": 1,
121
+ "rollout_train_steps_min": -1,
122
+ "rollout_train_infer_steps": 64,
123
+ "rollout_train_time_mode": "fixed_steps",
124
+ "rollout_train_s_dist": "uniform",
125
+ "rollout_train_s_min_frac": 0.0,
126
+ "rollout_train_s_max_frac": 0.125,
127
+ "rollout_train_s_beta_alpha": 2.0,
128
+ "rollout_train_s_beta_beta": 6.0,
129
+ "rollout_train_temp": 1.0,
130
+ "rollout_train_max_gamma": 1.0,
131
+ "rollout_train_rule": "flowmap",
132
+ "rollout_train_corrupt_only": true,
133
+ "rollout_train_samplewise": false,
134
+ "rollout_train_compute_always": false,
135
+ "rollout_train_keep_grad": false,
136
+ "rollout_train_sync_t": false,
137
+ "rollout_train_state_mix_mode": "final",
138
+ "rollout_train_state_mix_alpha": 0.5,
139
+ "bridge_noise_init": "logistic_normal",
140
+ "noise_sigma": -1.0,
141
+ "allow_tf32": true,
142
+ "activation_checkpointing": false,
143
+ "activation_checkpoint_interval": 1,
144
+ "activation_checkpoint_scope": "block",
145
+ "ddp_static_graph": false,
146
+ "ddp_gradient_as_bucket_view": true,
147
+ "blocking_data_transfer": false,
148
+ "dataloader_prefetch_factor": 2,
149
+ "full_train_stats": false,
150
+ "tokenized_hf": false,
151
+ "tokenized_pad_token": "pad",
152
+ "elf_conditional_hf": false,
153
+ "record_pad_truncate": false,
154
+ "record_add_eos": false,
155
+ "record_add_special_tokens": false,
156
+ "record_pad_token": "pad",
157
+ "record_shuffle_buffer": 10000,
158
+ "wrap": true,
159
+ "wrap_mode": "stream",
160
+ "wrap_record_buffer_size": 200,
161
+ "owt_cached_chunks": false,
162
+ "owt_chunk_cache_dir": "",
163
+ "owt_chunk_cache_rebuild": false,
164
+ "owt_chunk_cache_write_batch": 4096,
165
+ "owt_exact_repeat_per_chunk": 0,
166
+ "online_chunk_shuffle": false,
167
+ "online_chunk_shuffle_buffer": 10000,
168
+ "openwebtext_split": "all",
169
+ "detokenizer": "auto",
170
+ "resolved_detokenizer": "lm1b",
171
+ "num_workers": 0,
172
+ "latest_every": 1000,
173
+ "resume_path": ""
174
+ }
175
+ step=100 micro_steps=400 elapsed=186.5s lr=1.212000e-05 loss=10.1123 loss_recon=10.1123 loss_meanflow=0.0000 mean_model_t=0.5013 mean_corrupt_t=0.5013 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.0303 corrupt_frac=1.0000 acc_corrupt=0.0303 loss_corrupt=10.1123 wrong_frac=0.4988 init_acc_corrupt=0.4667 acc_corrupt_t_0p0_0p2=0.0293 corrupt_frac_t_0p0_0p2=0.2025 acc_corrupt_t_0p2_0p4=0.0302 corrupt_frac_t_0p2_0p4=0.1960 acc_corrupt_t_0p4_0p6=0.0309 corrupt_frac_t_0p4_0p6=0.1990 acc_corrupt_t_0p6_0p8=0.0314 corrupt_frac_t_0p6_0p8=0.1995 acc_corrupt_t_0p8_1p0=0.0300 corrupt_frac_t_0p8_1p0=0.2030 out_w_norm=0.8830 out_g_norm=1.5783 loss_all=9.6849 init_gold_top10=0.5627 init_gold_top100=0.5703
176
+ step=200 micro_steps=800 elapsed=190.5s lr=2.412000e-05 loss=9.0364 loss_recon=9.0364 loss_meanflow=0.0000 mean_model_t=0.5016 mean_corrupt_t=0.5016 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.0307 corrupt_frac=1.0000 acc_corrupt=0.0307 loss_corrupt=9.0364 wrong_frac=0.4983 init_acc_corrupt=0.4677 acc_corrupt_t_0p0_0p2=0.0307 corrupt_frac_t_0p0_0p2=0.2011 acc_corrupt_t_0p2_0p4=0.0315 corrupt_frac_t_0p2_0p4=0.1982 acc_corrupt_t_0p4_0p6=0.0308 corrupt_frac_t_0p4_0p6=0.1974 acc_corrupt_t_0p6_0p8=0.0302 corrupt_frac_t_0p6_0p8=0.1988 acc_corrupt_t_0p8_1p0=0.0304 corrupt_frac_t_0p8_1p0=0.2059 out_w_norm=5.6664 out_g_norm=1.7135 loss_all=8.3520 init_gold_top10=0.4731 init_gold_top100=0.4768
177
+ step=300 micro_steps=1200 elapsed=191.3s lr=3.612000e-05 loss=7.7637 loss_recon=7.7637 loss_meanflow=0.0000 mean_model_t=0.4957 mean_corrupt_t=0.4957 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.0421 corrupt_frac=1.0000 acc_corrupt=0.0421 loss_corrupt=7.7637 wrong_frac=0.5036 init_acc_corrupt=0.4610 acc_corrupt_t_0p0_0p2=0.0423 corrupt_frac_t_0p0_0p2=0.2036 acc_corrupt_t_0p2_0p4=0.0424 corrupt_frac_t_0p2_0p4=0.2020 acc_corrupt_t_0p4_0p6=0.0419 corrupt_frac_t_0p4_0p6=0.2033 acc_corrupt_t_0p6_0p8=0.0419 corrupt_frac_t_0p6_0p8=0.1990 acc_corrupt_t_0p8_1p0=0.0421 corrupt_frac_t_0p8_1p0=0.1941 out_w_norm=12.5051 out_g_norm=1.5277 loss_all=7.2514 init_gold_top10=0.5310 init_gold_top100=0.5371
178
+ step=400 micro_steps=1600 elapsed=169.7s lr=4.812000e-05 loss=7.0507 loss_recon=7.0507 loss_meanflow=0.0000 mean_model_t=0.5004 mean_corrupt_t=0.5004 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.0453 corrupt_frac=1.0000 acc_corrupt=0.0453 loss_corrupt=7.0507 wrong_frac=0.4999 init_acc_corrupt=0.4660 acc_corrupt_t_0p0_0p2=0.0449 corrupt_frac_t_0p0_0p2=0.2009 acc_corrupt_t_0p2_0p4=0.0457 corrupt_frac_t_0p2_0p4=0.1997 acc_corrupt_t_0p4_0p6=0.0450 corrupt_frac_t_0p4_0p6=0.1975 acc_corrupt_t_0p6_0p8=0.0456 corrupt_frac_t_0p6_0p8=0.2042 acc_corrupt_t_0p8_1p0=0.0455 corrupt_frac_t_0p8_1p0=0.1983 out_w_norm=19.3630 out_g_norm=0.4905 loss_all=6.8370 init_gold_top10=0.5823 init_gold_top100=0.5859
179
+ step=500 micro_steps=2000 elapsed=168.7s lr=6.012000e-05 loss=6.8048 loss_recon=6.8048 loss_meanflow=0.0000 mean_model_t=0.5017 mean_corrupt_t=0.5017 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.0569 corrupt_frac=1.0000 acc_corrupt=0.0569 loss_corrupt=6.8048 wrong_frac=0.4982 init_acc_corrupt=0.4674 acc_corrupt_t_0p0_0p2=0.0563 corrupt_frac_t_0p0_0p2=0.1966 acc_corrupt_t_0p2_0p4=0.0573 corrupt_frac_t_0p2_0p4=0.1988 acc_corrupt_t_0p4_0p6=0.0564 corrupt_frac_t_0p4_0p6=0.2046 acc_corrupt_t_0p6_0p8=0.0570 corrupt_frac_t_0p6_0p8=0.1975 acc_corrupt_t_0p8_1p0=0.0576 corrupt_frac_t_0p8_1p0=0.2036 out_w_norm=24.2355 out_g_norm=0.2417 loss_all=6.7435 init_gold_top10=0.4373 init_gold_top100=0.4431
180
+ step=600 micro_steps=2400 elapsed=168.4s lr=7.212000e-05 loss=6.4767 loss_recon=6.4767 loss_meanflow=0.0000 mean_model_t=0.4973 mean_corrupt_t=0.4973 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.0951 corrupt_frac=1.0000 acc_corrupt=0.0951 loss_corrupt=6.4767 wrong_frac=0.5030 init_acc_corrupt=0.4624 acc_corrupt_t_0p0_0p2=0.0637 corrupt_frac_t_0p0_0p2=0.2057 acc_corrupt_t_0p2_0p4=0.0788 corrupt_frac_t_0p2_0p4=0.1970 acc_corrupt_t_0p4_0p6=0.0988 corrupt_frac_t_0p4_0p6=0.2034 acc_corrupt_t_0p6_0p8=0.1124 corrupt_frac_t_0p6_0p8=0.1965 acc_corrupt_t_0p8_1p0=0.1232 corrupt_frac_t_0p8_1p0=0.1980 out_w_norm=27.9859 out_g_norm=0.3179 loss_all=6.2120 init_gold_top10=0.5012 init_gold_top100=0.5088
181
+ step=700 micro_steps=2800 elapsed=168.5s lr=8.412000e-05 loss=5.8641 loss_recon=5.8641 loss_meanflow=0.0000 mean_model_t=0.4936 mean_corrupt_t=0.4936 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.2140 corrupt_frac=1.0000 acc_corrupt=0.2140 loss_corrupt=5.8641 wrong_frac=0.5063 init_acc_corrupt=0.4583 acc_corrupt_t_0p0_0p2=0.0739 corrupt_frac_t_0p0_0p2=0.2048 acc_corrupt_t_0p2_0p4=0.1517 corrupt_frac_t_0p2_0p4=0.2040 acc_corrupt_t_0p4_0p6=0.2294 corrupt_frac_t_0p4_0p6=0.2013 acc_corrupt_t_0p6_0p8=0.2895 corrupt_frac_t_0p6_0p8=0.1971 acc_corrupt_t_0p8_1p0=0.3351 corrupt_frac_t_0p8_1p0=0.1947 out_w_norm=32.6670 out_g_norm=0.3211 loss_all=5.3731 init_gold_top10=0.5059 init_gold_top100=0.5112
182
+ step=800 micro_steps=3200 elapsed=168.9s lr=9.612000e-05 loss=5.2292 loss_recon=5.2292 loss_meanflow=0.0000 mean_model_t=0.4981 mean_corrupt_t=0.4981 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.3267 corrupt_frac=1.0000 acc_corrupt=0.3267 loss_corrupt=5.2292 wrong_frac=0.5016 init_acc_corrupt=0.4637 acc_corrupt_t_0p0_0p2=0.0815 corrupt_frac_t_0p0_0p2=0.2012 acc_corrupt_t_0p2_0p4=0.2131 corrupt_frac_t_0p2_0p4=0.2014 acc_corrupt_t_0p4_0p6=0.3479 corrupt_frac_t_0p4_0p6=0.1986 acc_corrupt_t_0p6_0p8=0.4521 corrupt_frac_t_0p6_0p8=0.2019 acc_corrupt_t_0p8_1p0=0.5435 corrupt_frac_t_0p8_1p0=0.1970 out_w_norm=37.6251 out_g_norm=0.2018 loss_all=4.9786 init_gold_top10=0.4893 init_gold_top100=0.4961
183
+ step=900 micro_steps=3600 elapsed=168.9s lr=1.081200e-04 loss=4.7043 loss_recon=4.7043 loss_meanflow=0.0000 mean_model_t=0.5073 mean_corrupt_t=0.5073 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.3935 corrupt_frac=1.0000 acc_corrupt=0.3935 loss_corrupt=4.7043 wrong_frac=0.4933 init_acc_corrupt=0.4729 acc_corrupt_t_0p0_0p2=0.0859 corrupt_frac_t_0p0_0p2=0.1908 acc_corrupt_t_0p2_0p4=0.2439 corrupt_frac_t_0p2_0p4=0.1955 acc_corrupt_t_0p4_0p6=0.4140 corrupt_frac_t_0p4_0p6=0.2045 acc_corrupt_t_0p6_0p8=0.5422 corrupt_frac_t_0p6_0p8=0.2084 acc_corrupt_t_0p8_1p0=0.6559 corrupt_frac_t_0p8_1p0=0.2014 out_w_norm=42.6753 out_g_norm=0.1519 loss_all=4.5171 init_gold_top10=0.5010 init_gold_top100=0.5071
184
+ step=1000 micro_steps=4000 elapsed=169.5s lr=1.201200e-04 loss=4.4151 loss_recon=4.4151 loss_meanflow=0.0000 mean_model_t=0.4991 mean_corrupt_t=0.4991 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.4339 corrupt_frac=1.0000 acc_corrupt=0.4339 loss_corrupt=4.4151 wrong_frac=0.5013 init_acc_corrupt=0.4646 acc_corrupt_t_0p0_0p2=0.0865 corrupt_frac_t_0p0_0p2=0.2031 acc_corrupt_t_0p2_0p4=0.2662 corrupt_frac_t_0p2_0p4=0.1991 acc_corrupt_t_0p4_0p6=0.4582 corrupt_frac_t_0p4_0p6=0.1998 acc_corrupt_t_0p6_0p8=0.6153 corrupt_frac_t_0p6_0p8=0.1950 acc_corrupt_t_0p8_1p0=0.7476 corrupt_frac_t_0p8_1p0=0.2034 out_w_norm=47.9426 out_g_norm=0.1355 loss_all=4.4417 init_gold_top10=0.4824 init_gold_top100=0.4880
185
+ step=1100 micro_steps=4400 elapsed=210.8s lr=1.321200e-04 loss=4.1825 loss_recon=4.1825 loss_meanflow=0.0000 mean_model_t=0.4995 mean_corrupt_t=0.4995 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.4663 corrupt_frac=1.0000 acc_corrupt=0.4663 loss_corrupt=4.1825 wrong_frac=0.5006 init_acc_corrupt=0.4649 acc_corrupt_t_0p0_0p2=0.0887 corrupt_frac_t_0p0_0p2=0.2027 acc_corrupt_t_0p2_0p4=0.2773 corrupt_frac_t_0p2_0p4=0.1986 acc_corrupt_t_0p4_0p6=0.4939 corrupt_frac_t_0p4_0p6=0.1970 acc_corrupt_t_0p6_0p8=0.6610 corrupt_frac_t_0p6_0p8=0.2014 acc_corrupt_t_0p8_1p0=0.8100 corrupt_frac_t_0p8_1p0=0.2013 out_w_norm=53.2951 out_g_norm=0.1301 loss_all=4.2400 init_gold_top10=0.4680 init_gold_top100=0.4744
186
+ step=1200 micro_steps=4800 elapsed=217.5s lr=1.441200e-04 loss=4.0361 loss_recon=4.0361 loss_meanflow=0.0000 mean_model_t=0.4959 mean_corrupt_t=0.4959 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.4813 corrupt_frac=1.0000 acc_corrupt=0.4813 loss_corrupt=4.0361 wrong_frac=0.5039 init_acc_corrupt=0.4606 acc_corrupt_t_0p0_0p2=0.0911 corrupt_frac_t_0p0_0p2=0.2047 acc_corrupt_t_0p2_0p4=0.2904 corrupt_frac_t_0p2_0p4=0.2081 acc_corrupt_t_0p4_0p6=0.5115 corrupt_frac_t_0p4_0p6=0.1931 acc_corrupt_t_0p6_0p8=0.6914 corrupt_frac_t_0p6_0p8=0.1963 acc_corrupt_t_0p8_1p0=0.8453 corrupt_frac_t_0p8_1p0=0.1993 out_w_norm=58.5677 out_g_norm=0.1257 loss_all=3.9159 init_gold_top10=0.5178 init_gold_top100=0.5210
187
+ step=1300 micro_steps=5200 elapsed=213.6s lr=1.561200e-04 loss=3.8590 loss_recon=3.8590 loss_meanflow=0.0000 mean_model_t=0.5035 mean_corrupt_t=0.5035 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5001 corrupt_frac=1.0000 acc_corrupt=0.5001 loss_corrupt=3.8590 wrong_frac=0.4961 init_acc_corrupt=0.4694 acc_corrupt_t_0p0_0p2=0.0917 corrupt_frac_t_0p0_0p2=0.2007 acc_corrupt_t_0p2_0p4=0.2950 corrupt_frac_t_0p2_0p4=0.1952 acc_corrupt_t_0p4_0p6=0.5277 corrupt_frac_t_0p4_0p6=0.1989 acc_corrupt_t_0p6_0p8=0.7082 corrupt_frac_t_0p6_0p8=0.1996 acc_corrupt_t_0p8_1p0=0.8635 corrupt_frac_t_0p8_1p0=0.2066 out_w_norm=63.6326 out_g_norm=0.1224 loss_all=3.3433 init_gold_top10=0.5500 init_gold_top100=0.5549
188
+ step=1400 micro_steps=5600 elapsed=170.8s lr=1.681200e-04 loss=3.8081 loss_recon=3.8081 loss_meanflow=0.0000 mean_model_t=0.4996 mean_corrupt_t=0.4996 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5029 corrupt_frac=1.0000 acc_corrupt=0.5029 loss_corrupt=3.8081 wrong_frac=0.5007 init_acc_corrupt=0.4649 acc_corrupt_t_0p0_0p2=0.0926 corrupt_frac_t_0p0_0p2=0.1982 acc_corrupt_t_0p2_0p4=0.3024 corrupt_frac_t_0p2_0p4=0.2064 acc_corrupt_t_0p4_0p6=0.5355 corrupt_frac_t_0p4_0p6=0.2013 acc_corrupt_t_0p6_0p8=0.7179 corrupt_frac_t_0p6_0p8=0.1927 acc_corrupt_t_0p8_1p0=0.8722 corrupt_frac_t_0p8_1p0=0.2020 out_w_norm=68.3892 out_g_norm=0.1220 loss_all=3.3125 init_gold_top10=0.5654 init_gold_top100=0.5728
189
+ step=1500 micro_steps=6000 elapsed=172.2s lr=1.801200e-04 loss=3.7324 loss_recon=3.7324 loss_meanflow=0.0000 mean_model_t=0.5012 mean_corrupt_t=0.5012 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5097 corrupt_frac=1.0000 acc_corrupt=0.5097 loss_corrupt=3.7324 wrong_frac=0.4984 init_acc_corrupt=0.4672 acc_corrupt_t_0p0_0p2=0.0927 corrupt_frac_t_0p0_0p2=0.1995 acc_corrupt_t_0p2_0p4=0.3029 corrupt_frac_t_0p2_0p4=0.1982 acc_corrupt_t_0p4_0p6=0.5403 corrupt_frac_t_0p4_0p6=0.2019 acc_corrupt_t_0p6_0p8=0.7248 corrupt_frac_t_0p6_0p8=0.2023 acc_corrupt_t_0p8_1p0=0.8839 corrupt_frac_t_0p8_1p0=0.1987 out_w_norm=72.8833 out_g_norm=0.1208 loss_all=4.1249 init_gold_top10=0.4473 init_gold_top100=0.4573
190
+ step=1600 micro_steps=6400 elapsed=172.8s lr=1.921200e-04 loss=3.6736 loss_recon=3.6736 loss_meanflow=0.0000 mean_model_t=0.5013 mean_corrupt_t=0.5013 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5143 corrupt_frac=1.0000 acc_corrupt=0.5143 loss_corrupt=3.6736 wrong_frac=0.4987 init_acc_corrupt=0.4670 acc_corrupt_t_0p0_0p2=0.0922 corrupt_frac_t_0p0_0p2=0.1989 acc_corrupt_t_0p2_0p4=0.3047 corrupt_frac_t_0p2_0p4=0.1967 acc_corrupt_t_0p4_0p6=0.5451 corrupt_frac_t_0p4_0p6=0.2019 acc_corrupt_t_0p6_0p8=0.7290 corrupt_frac_t_0p6_0p8=0.2000 acc_corrupt_t_0p8_1p0=0.8899 corrupt_frac_t_0p8_1p0=0.2025 out_w_norm=77.1516 out_g_norm=0.1206 loss_all=3.4935 init_gold_top10=0.5088 init_gold_top100=0.5166
191
+ step=1700 micro_steps=6800 elapsed=171.9s lr=2.041200e-04 loss=3.5917 loss_recon=3.5917 loss_meanflow=0.0000 mean_model_t=0.5053 mean_corrupt_t=0.5053 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5223 corrupt_frac=1.0000 acc_corrupt=0.5223 loss_corrupt=3.5917 wrong_frac=0.4942 init_acc_corrupt=0.4717 acc_corrupt_t_0p0_0p2=0.0939 corrupt_frac_t_0p0_0p2=0.1970 acc_corrupt_t_0p2_0p4=0.3090 corrupt_frac_t_0p2_0p4=0.1931 acc_corrupt_t_0p4_0p6=0.5527 corrupt_frac_t_0p4_0p6=0.2037 acc_corrupt_t_0p6_0p8=0.7371 corrupt_frac_t_0p6_0p8=0.2016 acc_corrupt_t_0p8_1p0=0.8944 corrupt_frac_t_0p8_1p0=0.2050 out_w_norm=81.2332 out_g_norm=0.1188 loss_all=2.9977 init_gold_top10=0.5801 init_gold_top100=0.5813
192
+ step=1800 micro_steps=7200 elapsed=171.1s lr=2.161200e-04 loss=3.6236 loss_recon=3.6236 loss_meanflow=0.0000 mean_model_t=0.4975 mean_corrupt_t=0.4975 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5167 corrupt_frac=1.0000 acc_corrupt=0.5167 loss_corrupt=3.6236 wrong_frac=0.5032 init_acc_corrupt=0.4621 acc_corrupt_t_0p0_0p2=0.0940 corrupt_frac_t_0p0_0p2=0.2045 acc_corrupt_t_0p2_0p4=0.3115 corrupt_frac_t_0p2_0p4=0.1988 acc_corrupt_t_0p4_0p6=0.5554 corrupt_frac_t_0p4_0p6=0.1986 acc_corrupt_t_0p6_0p8=0.7369 corrupt_frac_t_0p6_0p8=0.2023 acc_corrupt_t_0p8_1p0=0.8991 corrupt_frac_t_0p8_1p0=0.1967 out_w_norm=85.1363 out_g_norm=0.1236 loss_all=4.2999 init_gold_top10=0.3867 init_gold_top100=0.4004
193
+ step=1900 micro_steps=7600 elapsed=169.2s lr=2.281200e-04 loss=3.5647 loss_recon=3.5647 loss_meanflow=0.0000 mean_model_t=0.4990 mean_corrupt_t=0.4990 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5224 corrupt_frac=1.0000 acc_corrupt=0.5224 loss_corrupt=3.5647 wrong_frac=0.5005 init_acc_corrupt=0.4652 acc_corrupt_t_0p0_0p2=0.0948 corrupt_frac_t_0p0_0p2=0.2051 acc_corrupt_t_0p2_0p4=0.3171 corrupt_frac_t_0p2_0p4=0.1954 acc_corrupt_t_0p4_0p6=0.5616 corrupt_frac_t_0p4_0p6=0.2013 acc_corrupt_t_0p6_0p8=0.7467 corrupt_frac_t_0p6_0p8=0.2020 acc_corrupt_t_0p8_1p0=0.9013 corrupt_frac_t_0p8_1p0=0.1967 out_w_norm=88.8849 out_g_norm=0.1189 loss_all=3.5332 init_gold_top10=0.4932 init_gold_top100=0.4985
LTA_openwebtext_dualt/logs/lta_lm1b_dirichlet_len1024_Cv_to_2v_gbs512_8gpu_20k_save1k_gumbelwatch_20260524_watcher.pid ADDED
@@ -0,0 +1 @@
 
 
1
+ 10234
LTA_openwebtext_dualt/logs/lta_owt_t5elf_dirichlet_len1024_Cv_to_2v_mask1_gbs512_b32_4gpu_20k_save1k_20260525.nohup.log ADDED
@@ -0,0 +1,204 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [launch] run=lta_owt_t5elf_dirichlet_len1024_Cv_to_2v_mask1_gbs512_b32_4gpu_20k_save1k_20260525
2
+ [launch] data_path=/e2e-data/evad-tech-vla/wanghan58/data/embedded-language-flows/openwebtext-t5 mode=tokenized_hf_pad_pad split=train_minus_100k text_column=text
3
+ [launch] max_len=1024 gbs=512 per_gpu=32 total_steps=20000
4
+ [launch] dirichlet C=32100->64200 wrong_floor=0.0
5
+ [launch] abs_pos=0 force_special_corrupt=none special_endpoint_gold=none special_loss=nonex1.0
6
+ [launch] watcher disabled
7
+
8
+ *****************************************
9
+ Setting OMP_NUM_THREADS environment variable for each process to be 1 in default, to avoid your system being overloaded, please further tune the variable for optimal performance in your application as needed.
10
+ *****************************************
11
+ NCCL version 2.25.1+cuda12.8
12
+ {
13
+ "device": "cuda:0",
14
+ "rank": 0,
15
+ "world_size": 4,
16
+ "samples": "tokenized_hf:9737184:pad=0",
17
+ "vocab_size": 32100,
18
+ "tokenizer_vocab_size": 32100,
19
+ "save_dir": "runs/lta_owt_t5elf_dirichlet_len1024_Cv_to_2v_mask1_gbs512_b32_4gpu_20k_save1k_20260525",
20
+ "max_len": 1024,
21
+ "effective_model_max_len": 1024,
22
+ "batch_size": 32,
23
+ "grad_accum": 4,
24
+ "effective_batch_size": 512,
25
+ "global_batch_size": 512,
26
+ "lr_schedule": "constant_warmup",
27
+ "optimizer": "adamw",
28
+ "epochs": 0.0,
29
+ "steps_per_epoch": 19018,
30
+ "total_steps": 20000,
31
+ "warmup_steps": 2500,
32
+ "warmup_epochs": -1.0,
33
+ "min_lr": 6e-05,
34
+ "weight_decay": 0.0,
35
+ "output_weight_decay": -1.0,
36
+ "adamw_param_groups": "nanogpt",
37
+ "adam_beta1": 0.9,
38
+ "adam_beta2": 0.999,
39
+ "adam_eps": 1e-08,
40
+ "muon_impl": "legacy",
41
+ "muon_momentum": 0.95,
42
+ "muon_ns_steps": 5,
43
+ "muon_update_scale": 1.0,
44
+ "muon_nesterov": false,
45
+ "muon_width_scale": false,
46
+ "muon_grouping": "",
47
+ "muon_param_count": 0,
48
+ "muon_adam_param_count": 0,
49
+ "muon_param_names": [],
50
+ "muon_adam_param_names": [],
51
+ "muon_effective_nesterov": false,
52
+ "muon_effective_width_scale": false,
53
+ "muon_effective_weight_decay": 0.0,
54
+ "muon_adam_fallback_nesterov": false,
55
+ "muon_adam_fallback_weight_decay": 0.0,
56
+ "ema_decay": 0.0,
57
+ "ema_start_step": 0,
58
+ "model_type": "ddit",
59
+ "ddit_mlp_type": "gelu",
60
+ "block_anchor_every": 0,
61
+ "block_anchor_init_std": 0.02,
62
+ "bos_anchor_every": 0,
63
+ "bos_anchor_token_id": -1,
64
+ "bos_anchor_extra_len": 0,
65
+ "abs_pos_embed": false,
66
+ "abs_pos_init_std": 0.02,
67
+ "elf_num_time_tokens": 4,
68
+ "elf_num_model_mode_tokens": 0,
69
+ "qk_norm": true,
70
+ "output_bias": false,
71
+ "output_init_std": -1.0,
72
+ "norm_type": "rmsnorm",
73
+ "target_loss": "hard_ce",
74
+ "linear_soft_target_power": 1.0,
75
+ "linear_soft_target_min_conf": 0.0,
76
+ "linear_soft_target_max_conf": 1.0,
77
+ "t_sampling_mode": "uniform",
78
+ "t_sampling_power": 1.0,
79
+ "t_sampling_eps": 0.0001,
80
+ "t_sampling_logit_mean": -1.5,
81
+ "t_sampling_logit_std": 0.8,
82
+ "t_sampling_gumbel_loc": 2.2,
83
+ "t_sampling_gumbel_scale": 0.8,
84
+ "dual_t": true,
85
+ "corrupt_t_mode": "independent",
86
+ "corrupt_min_t": 0.0,
87
+ "corrupt_max_t": 1.0,
88
+ "prefix_block_prob": 0.0,
89
+ "prefix_block_len": 128,
90
+ "block_ar_two_stream": false,
91
+ "block_ar_block_len": 128,
92
+ "mask_ratio_floor_schedule": "none",
93
+ "dirichlet_endpoint_mode": "categorical_dual_t",
94
+ "dirichlet_semantic_t_mode": "same",
95
+ "dirichlet_semantic_t_value": 0.0,
96
+ "dirichlet_semantic_t_curve": "linear",
97
+ "dirichlet_semantic_t_power": 1.0,
98
+ "dirichlet_support_t_curve": "linear",
99
+ "dirichlet_support_t_power": 1.0,
100
+ "endpoint_sequence_random_prob_alpha": 0.0,
101
+ "categorical_wrong_from_full_vocab": true,
102
+ "categorical_wrong_from_batch_valid_tokens": false,
103
+ "categorical_wrong_basin_token_ids": "",
104
+ "categorical_wrong_basin_prob": 0.0,
105
+ "categorical_wrong_unigram_prob": 0.0,
106
+ "categorical_wrong_uniform_prob": 0.0,
107
+ "categorical_wrong_prob_floor": 0.0,
108
+ "categorical_gold_prob_floor": 0.0,
109
+ "categorical_gold_prob_ceil": 1.0,
110
+ "categorical_wrong_corpus_unigram_path": "",
111
+ "categorical_wrong_corpus_unigram_alpha": 1.0,
112
+ "categorical_wrong_basin_shared_prob": 0.0,
113
+ "categorical_wrong_unigram_shared_prob": 0.0,
114
+ "mask_mixture_original_prob": 0.0,
115
+ "mask_mixture_lowk_prob": 0.0,
116
+ "mask_mixture_lowcorrupt_prob": 0.0,
117
+ "mask_mixture_block_prob": 0.0,
118
+ "mask_mixture_all_prob": 0.0,
119
+ "mask_mixture_lowk_clean_tokens": "1,2,4,8,16,32,64",
120
+ "mask_mixture_lowcorrupt_tokens": "1,2,4,8,16,32,64",
121
+ "mask_mixture_block_tokens": "64,128",
122
+ "simplex_bridge_sampler": "dirichlet",
123
+ "logistic_normal_sigma_min": 0.18,
124
+ "logistic_normal_sigma_max": 2.2,
125
+ "logistic_normal_tau_min": 0.65,
126
+ "logistic_normal_tau_max": 1.15,
127
+ "torch_compile": false,
128
+ "compile_mode": "max-autotune",
129
+ "state_format": "prob",
130
+ "meanflow_weight": 0.0,
131
+ "rollout_train_prob": 0.0,
132
+ "rollout_train_steps": 1,
133
+ "rollout_train_steps_min": -1,
134
+ "rollout_train_infer_steps": 64,
135
+ "rollout_train_time_mode": "fixed_steps",
136
+ "rollout_train_s_dist": "uniform",
137
+ "rollout_train_s_min_frac": 0.0,
138
+ "rollout_train_s_max_frac": 0.125,
139
+ "rollout_train_s_beta_alpha": 2.0,
140
+ "rollout_train_s_beta_beta": 6.0,
141
+ "rollout_train_temp": 1.0,
142
+ "rollout_train_max_gamma": 1.0,
143
+ "rollout_train_rule": "flowmap",
144
+ "rollout_train_corrupt_only": true,
145
+ "rollout_train_samplewise": false,
146
+ "rollout_train_compute_always": false,
147
+ "rollout_train_keep_grad": false,
148
+ "rollout_train_sync_t": false,
149
+ "rollout_train_state_mix_mode": "final",
150
+ "rollout_train_state_mix_alpha": 0.5,
151
+ "bridge_noise_init": "logistic_normal",
152
+ "noise_sigma": -1.0,
153
+ "allow_tf32": true,
154
+ "activation_checkpointing": false,
155
+ "activation_checkpoint_interval": 1,
156
+ "activation_checkpoint_scope": "block",
157
+ "ddp_static_graph": false,
158
+ "ddp_gradient_as_bucket_view": true,
159
+ "blocking_data_transfer": false,
160
+ "dataloader_prefetch_factor": 2,
161
+ "full_train_stats": false,
162
+ "tokenized_hf": true,
163
+ "tokenized_pad_token": "pad",
164
+ "elf_conditional_hf": false,
165
+ "record_pad_truncate": false,
166
+ "record_add_eos": false,
167
+ "record_add_special_tokens": false,
168
+ "record_pad_token": "pad",
169
+ "record_shuffle_buffer": 10000,
170
+ "wrap": false,
171
+ "wrap_mode": "stream",
172
+ "wrap_record_buffer_size": 200,
173
+ "owt_cached_chunks": false,
174
+ "owt_chunk_cache_dir": "",
175
+ "owt_chunk_cache_rebuild": false,
176
+ "owt_chunk_cache_write_batch": 4096,
177
+ "owt_exact_repeat_per_chunk": 0,
178
+ "online_chunk_shuffle": false,
179
+ "online_chunk_shuffle_buffer": 10000,
180
+ "openwebtext_split": "all",
181
+ "detokenizer": "auto",
182
+ "resolved_detokenizer": null,
183
+ "num_workers": 8,
184
+ "latest_every": 1000,
185
+ "resume_path": ""
186
+ }
187
+ step=100 epoch=1/2 epoch_step=100/19018 micro_steps=400 elapsed=200.7s lr=1.212000e-05 loss=10.1985 loss_recon=10.1985 loss_meanflow=0.0000 mean_model_t=0.5004 mean_corrupt_t=0.4966 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.3703 corrupt_frac=1.0000 acc_corrupt=0.3703 loss_corrupt=10.1985 wrong_frac=0.5036 init_acc_corrupt=0.4964 acc_corrupt_t_0p0_0p2=0.0746 corrupt_frac_t_0p0_0p2=0.2026 acc_corrupt_t_0p2_0p4=0.1967 corrupt_frac_t_0p2_0p4=0.2058 acc_corrupt_t_0p4_0p6=0.3447 corrupt_frac_t_0p4_0p6=0.1937 acc_corrupt_t_0p6_0p8=0.5246 corrupt_frac_t_0p6_0p8=0.2019 acc_corrupt_t_0p8_1p0=0.7248 corrupt_frac_t_0p8_1p0=0.1960 out_w_norm=1.0610 out_g_norm=1.1618 loss_all=9.7534 init_gold_top10=0.4680 init_gold_top100=0.4698
188
+ step=200 epoch=1/2 epoch_step=200/19018 micro_steps=800 elapsed=199.4s lr=2.412000e-05 loss=8.9228 loss_recon=8.9228 loss_meanflow=0.0000 mean_model_t=0.4969 mean_corrupt_t=0.5032 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.0558 corrupt_frac=1.0000 acc_corrupt=0.0558 loss_corrupt=8.9228 wrong_frac=0.4974 init_acc_corrupt=0.5026 acc_corrupt_t_0p0_0p2=0.0439 corrupt_frac_t_0p0_0p2=0.1932 acc_corrupt_t_0p2_0p4=0.0445 corrupt_frac_t_0p2_0p4=0.2028 acc_corrupt_t_0p4_0p6=0.0465 corrupt_frac_t_0p4_0p6=0.2034 acc_corrupt_t_0p6_0p8=0.0586 corrupt_frac_t_0p6_0p8=0.1996 acc_corrupt_t_0p8_1p0=0.0852 corrupt_frac_t_0p8_1p0=0.2009 out_w_norm=7.1043 out_g_norm=1.6873 loss_all=8.0208 init_gold_top10=0.4885 init_gold_top100=0.4902
189
+ step=300 epoch=1/2 epoch_step=300/19018 micro_steps=1200 elapsed=226.1s lr=3.612000e-05 loss=7.0822 loss_recon=7.0822 loss_meanflow=0.0000 mean_model_t=0.4995 mean_corrupt_t=0.4971 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.1080 corrupt_frac=1.0000 acc_corrupt=0.1080 loss_corrupt=7.0822 wrong_frac=0.5029 init_acc_corrupt=0.4971 acc_corrupt_t_0p0_0p2=0.0511 corrupt_frac_t_0p0_0p2=0.2049 acc_corrupt_t_0p2_0p4=0.0777 corrupt_frac_t_0p2_0p4=0.1954 acc_corrupt_t_0p4_0p6=0.1070 corrupt_frac_t_0p4_0p6=0.2034 acc_corrupt_t_0p6_0p8=0.1400 corrupt_frac_t_0p6_0p8=0.2009 acc_corrupt_t_0p8_1p0=0.1660 corrupt_frac_t_0p8_1p0=0.1954 out_w_norm=13.5033 out_g_norm=1.2325 loss_all=5.8280 init_gold_top10=0.5261 init_gold_top100=0.5270
190
+ step=400 epoch=1/2 epoch_step=400/19018 micro_steps=1600 elapsed=199.5s lr=4.812000e-05 loss=4.4781 loss_recon=4.4781 loss_meanflow=0.0000 mean_model_t=0.4998 mean_corrupt_t=0.4972 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.4401 corrupt_frac=1.0000 acc_corrupt=0.4401 loss_corrupt=4.4781 wrong_frac=0.5029 init_acc_corrupt=0.4971 acc_corrupt_t_0p0_0p2=0.1077 corrupt_frac_t_0p0_0p2=0.2051 acc_corrupt_t_0p2_0p4=0.2716 corrupt_frac_t_0p2_0p4=0.2005 acc_corrupt_t_0p4_0p6=0.4383 corrupt_frac_t_0p4_0p6=0.2012 acc_corrupt_t_0p6_0p8=0.6137 corrupt_frac_t_0p6_0p8=0.1928 acc_corrupt_t_0p8_1p0=0.7803 corrupt_frac_t_0p8_1p0=0.2018 out_w_norm=19.2735 out_g_norm=0.4549 loss_all=3.8788 init_gold_top10=0.5142 init_gold_top100=0.5154
191
+ step=500 epoch=1/2 epoch_step=500/19018 micro_steps=2000 elapsed=199.5s lr=6.012000e-05 loss=3.9170 loss_recon=3.9170 loss_meanflow=0.0000 mean_model_t=0.4974 mean_corrupt_t=0.5002 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5027 corrupt_frac=1.0000 acc_corrupt=0.5027 loss_corrupt=3.9170 wrong_frac=0.5004 init_acc_corrupt=0.4996 acc_corrupt_t_0p0_0p2=0.1147 corrupt_frac_t_0p0_0p2=0.2013 acc_corrupt_t_0p2_0p4=0.3073 corrupt_frac_t_0p2_0p4=0.1991 acc_corrupt_t_0p4_0p6=0.5015 corrupt_frac_t_0p4_0p6=0.1994 acc_corrupt_t_0p6_0p8=0.6964 corrupt_frac_t_0p6_0p8=0.1978 acc_corrupt_t_0p8_1p0=0.8928 corrupt_frac_t_0p8_1p0=0.2025 out_w_norm=22.6140 out_g_norm=0.3801 loss_all=3.6717 init_gold_top10=0.5317 init_gold_top100=0.5332
192
+ step=600 epoch=1/2 epoch_step=600/19018 micro_steps=2400 elapsed=199.5s lr=7.212000e-05 loss=3.8422 loss_recon=3.8422 loss_meanflow=0.0000 mean_model_t=0.4983 mean_corrupt_t=0.5039 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5099 corrupt_frac=1.0000 acc_corrupt=0.5099 loss_corrupt=3.8422 wrong_frac=0.4967 init_acc_corrupt=0.5033 acc_corrupt_t_0p0_0p2=0.1191 corrupt_frac_t_0p0_0p2=0.1962 acc_corrupt_t_0p2_0p4=0.3077 corrupt_frac_t_0p2_0p4=0.1950 acc_corrupt_t_0p4_0p6=0.5053 corrupt_frac_t_0p4_0p6=0.2069 acc_corrupt_t_0p6_0p8=0.7012 corrupt_frac_t_0p6_0p8=0.2041 acc_corrupt_t_0p8_1p0=0.9011 corrupt_frac_t_0p8_1p0=0.1993 out_w_norm=23.8739 out_g_norm=0.3429 loss_all=4.1737 init_gold_top10=0.4535 init_gold_top100=0.4548
193
+ step=700 epoch=1/2 epoch_step=700/19018 micro_steps=2800 elapsed=199.5s lr=8.412000e-05 loss=3.7273 loss_recon=3.7273 loss_meanflow=0.0000 mean_model_t=0.4997 mean_corrupt_t=0.5042 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5165 corrupt_frac=1.0000 acc_corrupt=0.5165 loss_corrupt=3.7273 wrong_frac=0.4958 init_acc_corrupt=0.5042 acc_corrupt_t_0p0_0p2=0.1227 corrupt_frac_t_0p0_0p2=0.1949 acc_corrupt_t_0p2_0p4=0.3148 corrupt_frac_t_0p2_0p4=0.1977 acc_corrupt_t_0p4_0p6=0.5121 corrupt_frac_t_0p4_0p6=0.2004 acc_corrupt_t_0p6_0p8=0.7082 corrupt_frac_t_0p6_0p8=0.2050 acc_corrupt_t_0p8_1p0=0.9019 corrupt_frac_t_0p8_1p0=0.2030 out_w_norm=24.9630 out_g_norm=0.3548 loss_all=4.1789 init_gold_top10=0.4437 init_gold_top100=0.4450
194
+ step=800 epoch=1/2 epoch_step=800/19018 micro_steps=3200 elapsed=200.5s lr=9.612000e-05 loss=3.6741 loss_recon=3.6741 loss_meanflow=0.0000 mean_model_t=0.5031 mean_corrupt_t=0.4978 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5160 corrupt_frac=1.0000 acc_corrupt=0.5160 loss_corrupt=3.6741 wrong_frac=0.5020 init_acc_corrupt=0.4980 acc_corrupt_t_0p0_0p2=0.1243 corrupt_frac_t_0p0_0p2=0.2044 acc_corrupt_t_0p2_0p4=0.3250 corrupt_frac_t_0p2_0p4=0.1984 acc_corrupt_t_0p4_0p6=0.5212 corrupt_frac_t_0p4_0p6=0.1988 acc_corrupt_t_0p6_0p8=0.7155 corrupt_frac_t_0p6_0p8=0.1989 acc_corrupt_t_0p8_1p0=0.9035 corrupt_frac_t_0p8_1p0=0.1999 out_w_norm=26.0897 out_g_norm=0.3698 loss_all=3.3709 init_gold_top10=0.5284 init_gold_top100=0.5297
195
+ step=900 epoch=1/2 epoch_step=900/19018 micro_steps=3600 elapsed=200.5s lr=1.081200e-04 loss=3.5740 loss_recon=3.5740 loss_meanflow=0.0000 mean_model_t=0.4997 mean_corrupt_t=0.5014 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5228 corrupt_frac=1.0000 acc_corrupt=0.5228 loss_corrupt=3.5740 wrong_frac=0.4989 init_acc_corrupt=0.5012 acc_corrupt_t_0p0_0p2=0.1279 corrupt_frac_t_0p0_0p2=0.1955 acc_corrupt_t_0p2_0p4=0.3258 corrupt_frac_t_0p2_0p4=0.2058 acc_corrupt_t_0p4_0p6=0.5272 corrupt_frac_t_0p4_0p6=0.1979 acc_corrupt_t_0p6_0p8=0.7187 corrupt_frac_t_0p6_0p8=0.1978 acc_corrupt_t_0p8_1p0=0.9052 corrupt_frac_t_0p8_1p0=0.2040 out_w_norm=27.1010 out_g_norm=0.3675 loss_all=3.9080 init_gold_top10=0.4464 init_gold_top100=0.4482
196
+ step=1000 epoch=1/2 epoch_step=1000/19018 micro_steps=4000 elapsed=210.6s lr=1.201200e-04 loss=3.5327 loss_recon=3.5327 loss_meanflow=0.0000 mean_model_t=0.5026 mean_corrupt_t=0.4997 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5239 corrupt_frac=1.0000 acc_corrupt=0.5239 loss_corrupt=3.5327 wrong_frac=0.5001 init_acc_corrupt=0.4999 acc_corrupt_t_0p0_0p2=0.1297 corrupt_frac_t_0p0_0p2=0.2010 acc_corrupt_t_0p2_0p4=0.3304 corrupt_frac_t_0p2_0p4=0.2006 acc_corrupt_t_0p4_0p6=0.5322 corrupt_frac_t_0p4_0p6=0.1958 acc_corrupt_t_0p6_0p8=0.7208 corrupt_frac_t_0p6_0p8=0.2033 acc_corrupt_t_0p8_1p0=0.9072 corrupt_frac_t_0p8_1p0=0.1993 out_w_norm=28.0792 out_g_norm=0.3662 loss_all=3.1546 init_gold_top10=0.5438 init_gold_top100=0.5452
197
+ step=1100 epoch=1/2 epoch_step=1100/19018 micro_steps=4400 elapsed=225.3s lr=1.321200e-04 loss=3.4852 loss_recon=3.4852 loss_meanflow=0.0000 mean_model_t=0.5014 mean_corrupt_t=0.5007 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5269 corrupt_frac=1.0000 acc_corrupt=0.5269 loss_corrupt=3.4852 wrong_frac=0.4993 init_acc_corrupt=0.5008 acc_corrupt_t_0p0_0p2=0.1325 corrupt_frac_t_0p0_0p2=0.1999 acc_corrupt_t_0p2_0p4=0.3354 corrupt_frac_t_0p2_0p4=0.1979 acc_corrupt_t_0p4_0p6=0.5330 corrupt_frac_t_0p4_0p6=0.2044 acc_corrupt_t_0p6_0p8=0.7262 corrupt_frac_t_0p6_0p8=0.1983 acc_corrupt_t_0p8_1p0=0.9077 corrupt_frac_t_0p8_1p0=0.1995 out_w_norm=29.1077 out_g_norm=0.3601 loss_all=3.1611 init_gold_top10=0.5427 init_gold_top100=0.5437
198
+ step=1200 epoch=1/2 epoch_step=1200/19018 micro_steps=4800 elapsed=199.5s lr=1.441200e-04 loss=3.4507 loss_recon=3.4507 loss_meanflow=0.0000 mean_model_t=0.5030 mean_corrupt_t=0.5005 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5286 corrupt_frac=1.0000 acc_corrupt=0.5286 loss_corrupt=3.4507 wrong_frac=0.4995 init_acc_corrupt=0.5005 acc_corrupt_t_0p0_0p2=0.1307 corrupt_frac_t_0p0_0p2=0.1980 acc_corrupt_t_0p2_0p4=0.3380 corrupt_frac_t_0p2_0p4=0.2011 acc_corrupt_t_0p4_0p6=0.5372 corrupt_frac_t_0p4_0p6=0.2018 acc_corrupt_t_0p6_0p8=0.7286 corrupt_frac_t_0p6_0p8=0.2042 acc_corrupt_t_0p8_1p0=0.9088 corrupt_frac_t_0p8_1p0=0.1959 out_w_norm=30.2570 out_g_norm=0.3400 loss_all=3.7855 init_gold_top10=0.4513 init_gold_top100=0.4527
199
+ step=1300 epoch=1/2 epoch_step=1300/19018 micro_steps=5200 elapsed=199.5s lr=1.561200e-04 loss=3.4260 loss_recon=3.4260 loss_meanflow=0.0000 mean_model_t=0.5031 mean_corrupt_t=0.5000 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5299 corrupt_frac=1.0000 acc_corrupt=0.5299 loss_corrupt=3.4260 wrong_frac=0.4997 init_acc_corrupt=0.5003 acc_corrupt_t_0p0_0p2=0.1330 corrupt_frac_t_0p0_0p2=0.1987 acc_corrupt_t_0p2_0p4=0.3374 corrupt_frac_t_0p2_0p4=0.1973 acc_corrupt_t_0p4_0p6=0.5402 corrupt_frac_t_0p4_0p6=0.2074 acc_corrupt_t_0p6_0p8=0.7292 corrupt_frac_t_0p6_0p8=0.2066 acc_corrupt_t_0p8_1p0=0.9107 corrupt_frac_t_0p8_1p0=0.1925 out_w_norm=31.5035 out_g_norm=0.3191 loss_all=2.8906 init_gold_top10=0.5694 init_gold_top100=0.5705
200
+ step=1400 epoch=1/2 epoch_step=1400/19018 micro_steps=5600 elapsed=199.5s lr=1.681200e-04 loss=3.4040 loss_recon=3.4040 loss_meanflow=0.0000 mean_model_t=0.4973 mean_corrupt_t=0.5001 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5313 corrupt_frac=1.0000 acc_corrupt=0.5313 loss_corrupt=3.4040 wrong_frac=0.4995 init_acc_corrupt=0.5005 acc_corrupt_t_0p0_0p2=0.1332 corrupt_frac_t_0p0_0p2=0.1993 acc_corrupt_t_0p2_0p4=0.3377 corrupt_frac_t_0p2_0p4=0.1990 acc_corrupt_t_0p4_0p6=0.5388 corrupt_frac_t_0p4_0p6=0.2007 acc_corrupt_t_0p6_0p8=0.7315 corrupt_frac_t_0p6_0p8=0.2052 acc_corrupt_t_0p8_1p0=0.9111 corrupt_frac_t_0p8_1p0=0.1983 out_w_norm=32.9606 out_g_norm=0.2942 loss_all=2.8138 init_gold_top10=0.5705 init_gold_top100=0.5716
201
+ step=1500 epoch=1/2 epoch_step=1500/19018 micro_steps=6000 elapsed=199.6s lr=1.801200e-04 loss=3.3915 loss_recon=3.3915 loss_meanflow=0.0000 mean_model_t=0.5006 mean_corrupt_t=0.4996 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5313 corrupt_frac=1.0000 acc_corrupt=0.5313 loss_corrupt=3.3915 wrong_frac=0.5006 init_acc_corrupt=0.4994 acc_corrupt_t_0p0_0p2=0.1336 corrupt_frac_t_0p0_0p2=0.1960 acc_corrupt_t_0p2_0p4=0.3407 corrupt_frac_t_0p2_0p4=0.2036 acc_corrupt_t_0p4_0p6=0.5395 corrupt_frac_t_0p4_0p6=0.2020 acc_corrupt_t_0p6_0p8=0.7314 corrupt_frac_t_0p6_0p8=0.2017 acc_corrupt_t_0p8_1p0=0.9111 corrupt_frac_t_0p8_1p0=0.1967 out_w_norm=34.6646 out_g_norm=0.2818 loss_all=3.3737 init_gold_top10=0.5000 init_gold_top100=0.5015
202
+ step=1600 epoch=1/2 epoch_step=1600/19018 micro_steps=6400 elapsed=199.5s lr=1.921200e-04 loss=3.3626 loss_recon=3.3626 loss_meanflow=0.0000 mean_model_t=0.4998 mean_corrupt_t=0.5003 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5335 corrupt_frac=1.0000 acc_corrupt=0.5335 loss_corrupt=3.3626 wrong_frac=0.4994 init_acc_corrupt=0.5006 acc_corrupt_t_0p0_0p2=0.1365 corrupt_frac_t_0p0_0p2=0.2023 acc_corrupt_t_0p2_0p4=0.3397 corrupt_frac_t_0p2_0p4=0.1965 acc_corrupt_t_0p4_0p6=0.5408 corrupt_frac_t_0p4_0p6=0.1999 acc_corrupt_t_0p6_0p8=0.7328 corrupt_frac_t_0p6_0p8=0.1957 acc_corrupt_t_0p8_1p0=0.9115 corrupt_frac_t_0p8_1p0=0.2065 out_w_norm=36.5363 out_g_norm=0.2637 loss_all=3.5901 init_gold_top10=0.4688 init_gold_top100=0.4702
203
+ step=1700 epoch=1/2 epoch_step=1700/19018 micro_steps=6800 elapsed=199.6s lr=2.041200e-04 loss=3.3443 loss_recon=3.3443 loss_meanflow=0.0000 mean_model_t=0.4981 mean_corrupt_t=0.4997 mean_loss_t_weight=1.0000 linear_soft_target_mean_conf=0.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 grad_enabled_before_rollout=1.0000 grad_enabled_after_rollout=1.0000 logits_requires_grad=1.0000 raw_loss_requires_grad=1.0000 acc_all=0.5344 corrupt_frac=1.0000 acc_corrupt=0.5344 loss_corrupt=3.3443 wrong_frac=0.4994 init_acc_corrupt=0.5006 acc_corrupt_t_0p0_0p2=0.1348 corrupt_frac_t_0p0_0p2=0.2017 acc_corrupt_t_0p2_0p4=0.3426 corrupt_frac_t_0p2_0p4=0.1997 acc_corrupt_t_0p4_0p6=0.5449 corrupt_frac_t_0p4_0p6=0.1972 acc_corrupt_t_0p6_0p8=0.7340 corrupt_frac_t_0p6_0p8=0.1989 acc_corrupt_t_0p8_1p0=0.9131 corrupt_frac_t_0p8_1p0=0.2034 out_w_norm=38.5982 out_g_norm=0.2560 loss_all=3.2181 init_gold_top10=0.5173 init_gold_top100=0.5193
204
+ Terminated
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/packaging/_structures.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is dual licensed under the terms of the Apache License, Version
2
+ # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3
+ # for complete details.
4
+
5
+ """Backward-compatibility shim for unpickling Version objects serialized before
6
+ packaging 26.1.
7
+
8
+ Old pickles reference ``packaging._structures.InfinityType`` and
9
+ ``packaging._structures.NegativeInfinityType``. This module provides minimal
10
+ stand-in classes so that ``pickle.loads()`` can resolve those references.
11
+ The deserialized objects are not used for comparisons — ``Version.__setstate__``
12
+ discards the stale ``_key`` cache and recomputes it from the core version fields.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+
18
+ class InfinityType:
19
+ """Stand-in for the removed ``InfinityType`` used in old comparison keys."""
20
+
21
+ def __repr__(self) -> str:
22
+ return "Infinity"
23
+
24
+
25
+ class NegativeInfinityType:
26
+ """Stand-in for the removed ``NegativeInfinityType`` used in old comparison keys."""
27
+
28
+ def __repr__(self) -> str:
29
+ return "-Infinity"
30
+
31
+
32
+ Infinity = InfinityType()
33
+ NegativeInfinity = NegativeInfinityType()
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/packaging/requirements.py ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is dual licensed under the terms of the Apache License, Version
2
+ # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3
+ # for complete details.
4
+ from __future__ import annotations
5
+
6
+ from typing import Iterator
7
+
8
+ from ._parser import parse_requirement as _parse_requirement
9
+ from ._tokenizer import ParserSyntaxError
10
+ from .markers import Marker, _normalize_extra_values
11
+ from .specifiers import SpecifierSet
12
+ from .utils import canonicalize_name
13
+
14
+ __all__ = [
15
+ "InvalidRequirement",
16
+ "Requirement",
17
+ ]
18
+
19
+
20
+ def __dir__() -> list[str]:
21
+ return __all__
22
+
23
+
24
+ class InvalidRequirement(ValueError):
25
+ """
26
+ An invalid requirement was found, users should refer to PEP 508.
27
+ """
28
+
29
+
30
+ class Requirement:
31
+ """Parse a requirement.
32
+
33
+ Parse a given requirement string into its parts, such as name, specifier,
34
+ URL, and extras. Raises InvalidRequirement on a badly-formed requirement
35
+ string.
36
+
37
+ Instances are safe to serialize with :mod:`pickle`. They use a stable
38
+ format so the same pickle can be loaded in future packaging releases.
39
+
40
+ .. versionchanged:: 26.2
41
+
42
+ Added a stable pickle format. Pickles created with packaging 26.2+ can
43
+ be unpickled with future releases. Backward compatibility with pickles
44
+ from packaging < 26.2 is supported but may be removed in a future
45
+ release.
46
+ """
47
+
48
+ # TODO: Can we test whether something is contained within a requirement?
49
+ # If so how do we do that? Do we need to test against the _name_ of
50
+ # the thing as well as the version? What about the markers?
51
+ # TODO: Can we normalize the name and extra name?
52
+
53
+ def __init__(self, requirement_string: str) -> None:
54
+ try:
55
+ parsed = _parse_requirement(requirement_string)
56
+ except ParserSyntaxError as e:
57
+ raise InvalidRequirement(str(e)) from e
58
+
59
+ self.name: str = parsed.name
60
+ self.url: str | None = parsed.url or None
61
+ self.extras: set[str] = set(parsed.extras or [])
62
+ self.specifier: SpecifierSet = SpecifierSet(parsed.specifier)
63
+ self.marker: Marker | None = None
64
+ if parsed.marker is not None:
65
+ self.marker = Marker.__new__(Marker)
66
+ self.marker._markers = _normalize_extra_values(parsed.marker)
67
+
68
+ def _iter_parts(self, name: str) -> Iterator[str]:
69
+ yield name
70
+
71
+ if self.extras:
72
+ formatted_extras = ",".join(sorted(self.extras))
73
+ yield f"[{formatted_extras}]"
74
+
75
+ if self.specifier:
76
+ yield str(self.specifier)
77
+
78
+ if self.url:
79
+ yield f" @ {self.url}"
80
+ if self.marker:
81
+ yield " "
82
+
83
+ if self.marker:
84
+ yield f"; {self.marker}"
85
+
86
+ def __getstate__(self) -> str:
87
+ # Return the requirement string for compactness and stability.
88
+ # Re-parsed on load to reconstruct all fields.
89
+ return str(self)
90
+
91
+ def __setstate__(self, state: object) -> None:
92
+ if isinstance(state, str):
93
+ # New format (26.2+): just the requirement string.
94
+ try:
95
+ tmp = Requirement(state)
96
+ except InvalidRequirement as exc:
97
+ raise TypeError(f"Cannot restore Requirement from {state!r}") from exc
98
+ self.name = tmp.name
99
+ self.url = tmp.url
100
+ self.extras = tmp.extras
101
+ self.specifier = tmp.specifier
102
+ self.marker = tmp.marker
103
+ return
104
+ if isinstance(state, dict):
105
+ # Old format (packaging <= 26.1, no __slots__): plain __dict__.
106
+ self.__dict__.update(state)
107
+ return
108
+ raise TypeError(f"Cannot restore Requirement from {state!r}")
109
+
110
+ def __str__(self) -> str:
111
+ return "".join(self._iter_parts(self.name))
112
+
113
+ def __repr__(self) -> str:
114
+ return f"<{self.__class__.__name__}({str(self)!r})>"
115
+
116
+ def __hash__(self) -> int:
117
+ return hash(tuple(self._iter_parts(canonicalize_name(self.name))))
118
+
119
+ def __eq__(self, other: object) -> bool:
120
+ if not isinstance(other, Requirement):
121
+ return NotImplemented
122
+
123
+ return (
124
+ canonicalize_name(self.name) == canonicalize_name(other.name)
125
+ and self.extras == other.extras
126
+ and self.specifier == other.specifier
127
+ and self.url == other.url
128
+ and self.marker == other.marker
129
+ )
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/packaging/tags.py ADDED
@@ -0,0 +1,932 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is dual licensed under the terms of the Apache License, Version
2
+ # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3
+ # for complete details.
4
+
5
+ from __future__ import annotations
6
+
7
+ import logging
8
+ import operator
9
+ import platform
10
+ import re
11
+ import struct
12
+ import subprocess
13
+ import sys
14
+ import sysconfig
15
+ from importlib.machinery import EXTENSION_SUFFIXES
16
+ from typing import (
17
+ TYPE_CHECKING,
18
+ Iterable,
19
+ Iterator,
20
+ Sequence,
21
+ Tuple,
22
+ TypeVar,
23
+ cast,
24
+ )
25
+
26
+ from . import _manylinux, _musllinux
27
+
28
+ if TYPE_CHECKING:
29
+ from collections.abc import Callable, Iterable
30
+ from typing import AbstractSet
31
+
32
+
33
+ __all__ = [
34
+ "INTERPRETER_SHORT_NAMES",
35
+ "AppleVersion",
36
+ "PythonVersion",
37
+ "Tag",
38
+ "UnsortedTagsError",
39
+ "android_platforms",
40
+ "compatible_tags",
41
+ "cpython_tags",
42
+ "create_compatible_tags_selector",
43
+ "generic_tags",
44
+ "interpreter_name",
45
+ "interpreter_version",
46
+ "ios_platforms",
47
+ "mac_platforms",
48
+ "parse_tag",
49
+ "platform_tags",
50
+ "sys_tags",
51
+ ]
52
+
53
+
54
+ def __dir__() -> list[str]:
55
+ return __all__
56
+
57
+
58
+ logger = logging.getLogger(__name__)
59
+
60
+ PythonVersion = Sequence[int]
61
+ AppleVersion = Tuple[int, int]
62
+ _T = TypeVar("_T")
63
+
64
+ INTERPRETER_SHORT_NAMES: dict[str, str] = {
65
+ "python": "py", # Generic.
66
+ "cpython": "cp",
67
+ "pypy": "pp",
68
+ "ironpython": "ip",
69
+ "jython": "jy",
70
+ }
71
+
72
+
73
+ # This function can be unit tested without reloading the module
74
+ # (Unlike _32_BIT_INTERPRETER)
75
+ def _compute_32_bit_interpreter() -> bool:
76
+ return struct.calcsize("P") == 4
77
+
78
+
79
+ _32_BIT_INTERPRETER = _compute_32_bit_interpreter()
80
+
81
+
82
+ class UnsortedTagsError(ValueError):
83
+ """
84
+ Raised when a tag component is not in sorted order per PEP 425.
85
+ """
86
+
87
+
88
+ class Tag:
89
+ """
90
+ A representation of the tag triple for a wheel.
91
+
92
+ Instances are considered immutable and thus are hashable. Equality checking
93
+ is also supported.
94
+
95
+ Instances are safe to serialize with :mod:`pickle`. They use a stable
96
+ format so the same pickle can be loaded in future packaging releases.
97
+
98
+ .. versionchanged:: 26.2
99
+
100
+ Added a stable pickle format. Pickles created with packaging 26.2+ can
101
+ be unpickled with future releases. Backward compatibility with pickles
102
+ from packaging < 26.2 is supported but may be removed in a future
103
+ release.
104
+ """
105
+
106
+ __slots__ = ["_abi", "_hash", "_interpreter", "_platform"]
107
+
108
+ def __init__(self, interpreter: str, abi: str, platform: str) -> None:
109
+ """
110
+ :param str interpreter: The interpreter name, e.g. ``"py"``
111
+ (see :attr:`INTERPRETER_SHORT_NAMES` for mapping
112
+ well-known interpreter names to their short names).
113
+ :param str abi: The ABI that a wheel supports, e.g. ``"cp37m"``.
114
+ :param str platform: The OS/platform the wheel supports,
115
+ e.g. ``"win_amd64"``.
116
+ """
117
+ self._interpreter = interpreter.lower()
118
+ self._abi = abi.lower()
119
+ self._platform = platform.lower()
120
+ # The __hash__ of every single element in a Set[Tag] will be evaluated each time
121
+ # that a set calls its `.disjoint()` method, which may be called hundreds of
122
+ # times when scanning a page of links for packages with tags matching that
123
+ # Set[Tag]. Pre-computing the value here produces significant speedups for
124
+ # downstream consumers.
125
+ self._hash = hash((self._interpreter, self._abi, self._platform))
126
+
127
+ @property
128
+ def interpreter(self) -> str:
129
+ """
130
+ The interpreter name, e.g. ``"py"`` (see
131
+ :attr:`INTERPRETER_SHORT_NAMES` for mapping well-known interpreter
132
+ names to their short names).
133
+ """
134
+ return self._interpreter
135
+
136
+ @property
137
+ def abi(self) -> str:
138
+ """
139
+ The supported ABI.
140
+ """
141
+ return self._abi
142
+
143
+ @property
144
+ def platform(self) -> str:
145
+ """
146
+ The OS/platform.
147
+ """
148
+ return self._platform
149
+
150
+ def __eq__(self, other: object) -> bool:
151
+ if not isinstance(other, Tag):
152
+ return NotImplemented
153
+
154
+ return (
155
+ (self._hash == other._hash) # Short-circuit ASAP for perf reasons.
156
+ and (self._platform == other._platform)
157
+ and (self._abi == other._abi)
158
+ and (self._interpreter == other._interpreter)
159
+ )
160
+
161
+ def __hash__(self) -> int:
162
+ return self._hash
163
+
164
+ def __str__(self) -> str:
165
+ return f"{self._interpreter}-{self._abi}-{self._platform}"
166
+
167
+ def __repr__(self) -> str:
168
+ return f"<{self} @ {id(self)}>"
169
+
170
+ def __getstate__(self) -> tuple[str, str, str]:
171
+ # Return state as a 3-item tuple: (interpreter, abi, platform).
172
+ # Cache member _hash is excluded and will be recomputed.
173
+ return (self._interpreter, self._abi, self._platform)
174
+
175
+ def __setstate__(self, state: object) -> None:
176
+ if isinstance(state, tuple):
177
+ if len(state) == 3 and all(isinstance(s, str) for s in state):
178
+ # New format (26.2+): (interpreter, abi, platform)
179
+ self._interpreter, self._abi, self._platform = state
180
+ self._hash = hash((self._interpreter, self._abi, self._platform))
181
+ return
182
+ if len(state) == 2 and isinstance(state[1], dict):
183
+ # Old format (packaging <= 26.1, __slots__): (None, {slot: value}).
184
+ _, slots = state
185
+ try:
186
+ interpreter = slots["_interpreter"]
187
+ abi = slots["_abi"]
188
+ platform = slots["_platform"]
189
+ except KeyError:
190
+ raise TypeError(f"Cannot restore Tag from {state!r}") from None
191
+ if not all(
192
+ isinstance(value, str) for value in (interpreter, abi, platform)
193
+ ):
194
+ raise TypeError(f"Cannot restore Tag from {state!r}")
195
+ self._interpreter = interpreter.lower()
196
+ self._abi = abi.lower()
197
+ self._platform = platform.lower()
198
+ self._hash = hash((self._interpreter, self._abi, self._platform))
199
+ return
200
+ raise TypeError(f"Cannot restore Tag from {state!r}")
201
+
202
+
203
+ def parse_tag(tag: str, *, validate_order: bool = False) -> frozenset[Tag]:
204
+ """
205
+ Parses the provided tag (e.g. `py3-none-any`) into a frozenset of
206
+ :class:`Tag` instances.
207
+
208
+ Returning a set is required due to the possibility that the tag is a
209
+ `compressed tag set`_, e.g. ``"py2.py3-none-any"`` which supports both
210
+ Python 2 and Python 3.
211
+
212
+ If **validate_order** is true, compressed tag set components are checked
213
+ to be in sorted order as required by PEP 425.
214
+
215
+ :param str tag: The tag to parse, e.g. ``"py3-none-any"``.
216
+ :param bool validate_order: Check whether compressed tag set components
217
+ are in sorted order.
218
+ :raises UnsortedTagsError: If **validate_order** is true and any compressed tag
219
+ set component is not in sorted order.
220
+
221
+ .. versionadded:: 26.1
222
+ The *validate_order* parameter.
223
+ """
224
+ tags = set()
225
+ interpreters, abis, platforms = tag.split("-")
226
+ if validate_order:
227
+ for component in (interpreters, abis, platforms):
228
+ parts = component.split(".")
229
+ if parts != sorted(parts):
230
+ raise UnsortedTagsError(
231
+ f"Tag component {component!r} is not in sorted order per PEP 425"
232
+ )
233
+ for interpreter in interpreters.split("."):
234
+ for abi in abis.split("."):
235
+ for platform_ in platforms.split("."):
236
+ tags.add(Tag(interpreter, abi, platform_))
237
+ return frozenset(tags)
238
+
239
+
240
+ def _get_config_var(name: str, warn: bool = False) -> int | str | None:
241
+ value: int | str | None = sysconfig.get_config_var(name)
242
+ if value is None and warn:
243
+ logger.debug(
244
+ "Config variable '%s' is unset, Python ABI tag may be incorrect", name
245
+ )
246
+ return value
247
+
248
+
249
+ def _normalize_string(string: str) -> str:
250
+ return string.replace(".", "_").replace("-", "_").replace(" ", "_")
251
+
252
+
253
+ def _is_threaded_cpython(abis: list[str]) -> bool:
254
+ """
255
+ Determine if the ABI corresponds to a threaded (`--disable-gil`) build.
256
+
257
+ The threaded builds are indicated by a "t" in the abiflags.
258
+ """
259
+ if len(abis) == 0:
260
+ return False
261
+ # expect e.g., cp313
262
+ m = re.match(r"cp\d+(.*)", abis[0])
263
+ if not m:
264
+ return False
265
+ abiflags = m.group(1)
266
+ return "t" in abiflags
267
+
268
+
269
+ def _abi3_applies(python_version: PythonVersion, threading: bool) -> bool:
270
+ """
271
+ Determine if the Python version supports abi3.
272
+
273
+ PEP 384 was first implemented in Python 3.2. The free-threaded
274
+ builds do not support abi3.
275
+ """
276
+ return len(python_version) > 1 and tuple(python_version) >= (3, 2) and not threading
277
+
278
+
279
+ def _abi3t_applies(python_version: PythonVersion, threading: bool) -> bool:
280
+ """
281
+ Determine if the Python version supports abi3t.
282
+
283
+ PEP 803 was first implemented in Python 3.15 but, per PEP 803, this
284
+ returns tags going back to Python 3.2 to mirror the abi3
285
+ implementation and leave open the possibility of abi3t wheels
286
+ supporting older Python versions.
287
+
288
+ """
289
+ return len(python_version) > 1 and tuple(python_version) >= (3, 2) and threading
290
+
291
+
292
+ def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> list[str]:
293
+ py_version = tuple(py_version) # To allow for version comparison.
294
+ abis = []
295
+ version = _version_nodot(py_version[:2])
296
+ threading = debug = pymalloc = ucs4 = ""
297
+ with_debug = _get_config_var("Py_DEBUG", warn)
298
+ has_refcount = hasattr(sys, "gettotalrefcount")
299
+ # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled
300
+ # extension modules is the best option.
301
+ # https://github.com/pypa/pip/issues/3383#issuecomment-173267692
302
+ has_ext = "_d.pyd" in EXTENSION_SUFFIXES
303
+ if with_debug or (with_debug is None and (has_refcount or has_ext)):
304
+ debug = "d"
305
+ if py_version >= (3, 13) and _get_config_var("Py_GIL_DISABLED", warn):
306
+ threading = "t"
307
+ if py_version < (3, 8):
308
+ with_pymalloc = _get_config_var("WITH_PYMALLOC", warn)
309
+ if with_pymalloc or with_pymalloc is None:
310
+ pymalloc = "m"
311
+ if py_version < (3, 3):
312
+ unicode_size = _get_config_var("Py_UNICODE_SIZE", warn)
313
+ if unicode_size == 4 or (
314
+ unicode_size is None and sys.maxunicode == 0x10FFFF
315
+ ):
316
+ ucs4 = "u"
317
+ elif debug:
318
+ # Debug builds can also load "normal" extension modules.
319
+ # We can also assume no UCS-4 or pymalloc requirement.
320
+ abis.append(f"cp{version}{threading}")
321
+ abis.insert(0, f"cp{version}{threading}{debug}{pymalloc}{ucs4}")
322
+ return abis
323
+
324
+
325
+ def cpython_tags(
326
+ python_version: PythonVersion | None = None,
327
+ abis: Iterable[str] | None = None,
328
+ platforms: Iterable[str] | None = None,
329
+ *,
330
+ warn: bool = False,
331
+ ) -> Iterator[Tag]:
332
+ """
333
+ Yields the tags for the CPython interpreter.
334
+
335
+ The specific tags generated are:
336
+
337
+ - ``cp<python_version>-<abi>-<platform>``
338
+ - ``cp<python_version>-<stable_abi>-<platform>``
339
+ - ``cp<python_version>-none-<platform>``
340
+ - ``cp<older version>-<stable_abi>-<platform>`` where "older version" is all older
341
+ minor versions down to Python 3.2 (when ``abi3`` was introduced)
342
+
343
+ If ``python_version`` only provides a major-only version then only
344
+ user-provided ABIs via ``abis`` and the ``none`` ABI will be used.
345
+
346
+ The ``stable_abi`` will be either ``abi3`` or ``abi3t`` if `abi` is a
347
+ GIL-enabled ABI like `"cp315"` or a free-threaded ABI like `"cp315t"`,
348
+ respectively.
349
+
350
+ :param Sequence python_version: A one- or two-item sequence representing the
351
+ targeted Python version. Defaults to
352
+ ``sys.version_info[:2]``.
353
+ :param Iterable abis: Iterable of compatible ABIs. Defaults to the ABIs
354
+ compatible with the current system.
355
+ :param Iterable platforms: Iterable of compatible platforms. Defaults to the
356
+ platforms compatible with the current system.
357
+ :param bool warn: Whether warnings should be logged. Defaults to ``False``.
358
+ """
359
+ if not python_version:
360
+ python_version = sys.version_info[:2]
361
+
362
+ interpreter = f"cp{_version_nodot(python_version[:2])}"
363
+
364
+ if abis is None:
365
+ abis = _cpython_abis(python_version, warn) if len(python_version) > 1 else []
366
+ abis = list(abis)
367
+ # 'abi3' and 'none' are explicitly handled later.
368
+ for explicit_abi in ("abi3", "none"):
369
+ try:
370
+ abis.remove(explicit_abi)
371
+ except ValueError: # noqa: PERF203
372
+ pass
373
+
374
+ platforms = list(platforms or platform_tags())
375
+ for abi in abis:
376
+ for platform_ in platforms:
377
+ yield Tag(interpreter, abi, platform_)
378
+
379
+ threading = _is_threaded_cpython(abis)
380
+ use_abi3 = _abi3_applies(python_version, threading)
381
+ use_abi3t = _abi3t_applies(python_version, threading)
382
+
383
+ if use_abi3:
384
+ yield from (Tag(interpreter, "abi3", platform_) for platform_ in platforms)
385
+ if use_abi3t:
386
+ yield from (Tag(interpreter, "abi3t", platform_) for platform_ in platforms)
387
+
388
+ yield from (Tag(interpreter, "none", platform_) for platform_ in platforms)
389
+
390
+ if use_abi3 or use_abi3t:
391
+ for minor_version in range(python_version[1] - 1, 1, -1):
392
+ for platform_ in platforms:
393
+ version = _version_nodot((python_version[0], minor_version))
394
+ interpreter = f"cp{version}"
395
+ if use_abi3:
396
+ yield Tag(interpreter, "abi3", platform_)
397
+ if use_abi3t:
398
+ # Support for abi3t was introduced in Python 3.15, but in
399
+ # principle abi3t wheels are possible for older limited API
400
+ # versions, so allow things like ("cp37", "abi3t", "platform")
401
+ yield Tag(interpreter, "abi3t", platform_)
402
+
403
+
404
+ def _generic_abi() -> list[str]:
405
+ """
406
+ Return the ABI tag based on EXT_SUFFIX.
407
+ """
408
+ # The following are examples of `EXT_SUFFIX`.
409
+ # We want to keep the parts which are related to the ABI and remove the
410
+ # parts which are related to the platform:
411
+ # - linux: '.cpython-310-x86_64-linux-gnu.so' => cp310
412
+ # - mac: '.cpython-310-darwin.so' => cp310
413
+ # - win: '.cp310-win_amd64.pyd' => cp310
414
+ # - win: '.pyd' => cp37 (uses _cpython_abis())
415
+ # - pypy: '.pypy38-pp73-x86_64-linux-gnu.so' => pypy38_pp73
416
+ # - graalpy: '.graalpy-38-native-x86_64-darwin.dylib'
417
+ # => graalpy_38_native
418
+
419
+ ext_suffix = _get_config_var("EXT_SUFFIX", warn=True)
420
+ if not isinstance(ext_suffix, str) or ext_suffix[0] != ".":
421
+ raise SystemError("invalid sysconfig.get_config_var('EXT_SUFFIX')")
422
+ parts = ext_suffix.split(".")
423
+ if len(parts) < 3:
424
+ # CPython3.7 and earlier uses ".pyd" on Windows.
425
+ return _cpython_abis(sys.version_info[:2])
426
+ soabi = parts[1]
427
+ if soabi.startswith("cpython"):
428
+ # non-windows
429
+ abi = "cp" + soabi.split("-")[1]
430
+ elif soabi.startswith("cp"):
431
+ # windows
432
+ abi = soabi.split("-")[0]
433
+ elif soabi.startswith("pypy"):
434
+ abi = "-".join(soabi.split("-")[:2])
435
+ elif soabi.startswith("graalpy"):
436
+ abi = "-".join(soabi.split("-")[:3])
437
+ elif soabi:
438
+ # pyston, ironpython, others?
439
+ abi = soabi
440
+ else:
441
+ return []
442
+ return [_normalize_string(abi)]
443
+
444
+
445
+ def generic_tags(
446
+ interpreter: str | None = None,
447
+ abis: Iterable[str] | None = None,
448
+ platforms: Iterable[str] | None = None,
449
+ *,
450
+ warn: bool = False,
451
+ ) -> Iterator[Tag]:
452
+ """
453
+ Yields the tags for an interpreter which requires no specialization.
454
+
455
+ This function should be used if one of the other interpreter-specific
456
+ functions provided by this module is not appropriate (i.e. not calculating
457
+ tags for a CPython interpreter).
458
+
459
+ The specific tags generated are:
460
+
461
+ - ``<interpreter>-<abi>-<platform>``
462
+
463
+ The ``"none"`` ABI will be added if it was not explicitly provided.
464
+
465
+ :param str interpreter: The name of the interpreter. Defaults to being
466
+ calculated.
467
+ :param Iterable abis: Iterable of compatible ABIs. Defaults to the ABIs
468
+ compatible with the current system.
469
+ :param Iterable platforms: Iterable of compatible platforms. Defaults to the
470
+ platforms compatible with the current system.
471
+ :param bool warn: Whether warnings should be logged. Defaults to ``False``.
472
+ """
473
+ if not interpreter:
474
+ interp_name = interpreter_name()
475
+ interp_version = interpreter_version(warn=warn)
476
+ interpreter = f"{interp_name}{interp_version}"
477
+ abis = _generic_abi() if abis is None else list(abis)
478
+ platforms = list(platforms or platform_tags())
479
+ if "none" not in abis:
480
+ abis.append("none")
481
+ for abi in abis:
482
+ for platform_ in platforms:
483
+ yield Tag(interpreter, abi, platform_)
484
+
485
+
486
+ def _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]:
487
+ """
488
+ Yields Python versions in descending order.
489
+
490
+ After the latest version, the major-only version will be yielded, and then
491
+ all previous versions of that major version.
492
+ """
493
+ if len(py_version) > 1:
494
+ yield f"py{_version_nodot(py_version[:2])}"
495
+ yield f"py{py_version[0]}"
496
+ if len(py_version) > 1:
497
+ for minor in range(py_version[1] - 1, -1, -1):
498
+ yield f"py{_version_nodot((py_version[0], minor))}"
499
+
500
+
501
+ def compatible_tags(
502
+ python_version: PythonVersion | None = None,
503
+ interpreter: str | None = None,
504
+ platforms: Iterable[str] | None = None,
505
+ ) -> Iterator[Tag]:
506
+ """
507
+ Yields the tags for an interpreter compatible with the Python version
508
+ specified by ``python_version``.
509
+
510
+ The specific tags generated are:
511
+
512
+ - ``py*-none-<platform>``
513
+ - ``<interpreter>-none-any`` if ``interpreter`` is provided
514
+ - ``py*-none-any``
515
+
516
+ :param Sequence python_version: A one- or two-item sequence representing the
517
+ compatible version of Python. Defaults to
518
+ ``sys.version_info[:2]``.
519
+ :param str interpreter: The name of the interpreter (if known), e.g.
520
+ ``"cp38"``. Defaults to the current interpreter.
521
+ :param Iterable platforms: Iterable of compatible platforms. Defaults to the
522
+ platforms compatible with the current system.
523
+ """
524
+ if not python_version:
525
+ python_version = sys.version_info[:2]
526
+ platforms = list(platforms or platform_tags())
527
+ for version in _py_interpreter_range(python_version):
528
+ for platform_ in platforms:
529
+ yield Tag(version, "none", platform_)
530
+ if interpreter:
531
+ yield Tag(interpreter, "none", "any")
532
+ for version in _py_interpreter_range(python_version):
533
+ yield Tag(version, "none", "any")
534
+
535
+
536
+ def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str:
537
+ if not is_32bit:
538
+ return arch
539
+
540
+ if arch.startswith("ppc"):
541
+ return "ppc"
542
+
543
+ return "i386"
544
+
545
+
546
+ def _mac_binary_formats(version: AppleVersion, cpu_arch: str) -> list[str]:
547
+ formats = [cpu_arch]
548
+ if cpu_arch == "x86_64":
549
+ if version < (10, 4):
550
+ return []
551
+ formats.extend(["intel", "fat64", "fat32"])
552
+
553
+ elif cpu_arch == "i386":
554
+ if version < (10, 4):
555
+ return []
556
+ formats.extend(["intel", "fat32", "fat"])
557
+
558
+ elif cpu_arch == "ppc64":
559
+ # TODO: Need to care about 32-bit PPC for ppc64 through 10.2?
560
+ if version > (10, 5) or version < (10, 4):
561
+ return []
562
+ formats.append("fat64")
563
+
564
+ elif cpu_arch == "ppc":
565
+ if version > (10, 6):
566
+ return []
567
+ formats.extend(["fat32", "fat"])
568
+
569
+ if cpu_arch in {"arm64", "x86_64"}:
570
+ formats.append("universal2")
571
+
572
+ if cpu_arch in {"x86_64", "i386", "ppc64", "ppc", "intel"}:
573
+ formats.append("universal")
574
+
575
+ return formats
576
+
577
+
578
+ def mac_platforms(
579
+ version: AppleVersion | None = None, arch: str | None = None
580
+ ) -> Iterator[str]:
581
+ """
582
+ Yields the :attr:`~Tag.platform` tags for macOS.
583
+
584
+ The `version` parameter is a two-item tuple specifying the macOS version to
585
+ generate platform tags for. The `arch` parameter is the CPU architecture to
586
+ generate platform tags for. Both parameters default to the appropriate value
587
+ for the current system.
588
+
589
+ :param tuple version: A two-item tuple representing the version of macOS.
590
+ Defaults to the current system's version.
591
+ :param str arch: The CPU architecture. Defaults to the architecture of the
592
+ current system, e.g. ``"x86_64"``.
593
+
594
+ .. note::
595
+ Equivalent support for the other major platforms is purposefully not
596
+ provided:
597
+
598
+ - On Windows, platform compatibility is statically specified
599
+ - On Linux, code must be run on the system itself to determine
600
+ compatibility
601
+ """
602
+ version_str, _, cpu_arch = platform.mac_ver()
603
+ if version is None:
604
+ version = cast("AppleVersion", tuple(map(int, version_str.split(".")[:2])))
605
+ if version == (10, 16):
606
+ # When built against an older macOS SDK, Python will report macOS 10.16
607
+ # instead of the real version.
608
+ version_str = subprocess.run(
609
+ [
610
+ sys.executable,
611
+ "-sS",
612
+ "-c",
613
+ "import platform; print(platform.mac_ver()[0])",
614
+ ],
615
+ check=True,
616
+ env={"SYSTEM_VERSION_COMPAT": "0"},
617
+ stdout=subprocess.PIPE,
618
+ text=True,
619
+ ).stdout
620
+ version = cast("AppleVersion", tuple(map(int, version_str.split(".")[:2])))
621
+
622
+ if arch is None:
623
+ arch = _mac_arch(cpu_arch)
624
+
625
+ if (10, 0) <= version < (11, 0):
626
+ # Prior to Mac OS 11, each yearly release of Mac OS bumped the
627
+ # "minor" version number. The major version was always 10.
628
+ major_version = 10
629
+ for minor_version in range(version[1], -1, -1):
630
+ compat_version = major_version, minor_version
631
+ binary_formats = _mac_binary_formats(compat_version, arch)
632
+ for binary_format in binary_formats:
633
+ yield f"macosx_{major_version}_{minor_version}_{binary_format}"
634
+
635
+ if version >= (11, 0):
636
+ # Starting with Mac OS 11, each yearly release bumps the major version
637
+ # number. The minor versions are now the midyear updates.
638
+ minor_version = 0
639
+ for major_version in range(version[0], 10, -1):
640
+ compat_version = major_version, minor_version
641
+ binary_formats = _mac_binary_formats(compat_version, arch)
642
+ for binary_format in binary_formats:
643
+ yield f"macosx_{major_version}_{minor_version}_{binary_format}"
644
+
645
+ if version >= (11, 0):
646
+ # Mac OS 11 on x86_64 is compatible with binaries from previous releases.
647
+ # Arm64 support was introduced in 11.0, so no Arm binaries from previous
648
+ # releases exist.
649
+ #
650
+ # However, the "universal2" binary format can have a
651
+ # macOS version earlier than 11.0 when the x86_64 part of the binary supports
652
+ # that version of macOS.
653
+ major_version = 10
654
+ if arch == "x86_64":
655
+ for minor_version in range(16, 3, -1):
656
+ compat_version = major_version, minor_version
657
+ binary_formats = _mac_binary_formats(compat_version, arch)
658
+ for binary_format in binary_formats:
659
+ yield f"macosx_{major_version}_{minor_version}_{binary_format}"
660
+ else:
661
+ for minor_version in range(16, 3, -1):
662
+ compat_version = major_version, minor_version
663
+ binary_format = "universal2"
664
+ yield f"macosx_{major_version}_{minor_version}_{binary_format}"
665
+
666
+
667
+ def ios_platforms(
668
+ version: AppleVersion | None = None, multiarch: str | None = None
669
+ ) -> Iterator[str]:
670
+ """
671
+
672
+ Yields the :attr:`~Tag.platform` tags for iOS.
673
+
674
+ :param tuple version: A two-item tuple representing the version of iOS.
675
+ Defaults to the current system's version.
676
+ :param str multiarch: The CPU architecture+ABI to be used. This should be in
677
+ the format by ``sys.implementation._multiarch`` (e.g.,
678
+ ``arm64_iphoneos`` or ``x86_64_iphonesimulator``).
679
+ Defaults to the current system's multiarch value.
680
+
681
+ .. note::
682
+ Behavior of this method is undefined if invoked on non-iOS platforms
683
+ without providing explicit version and multiarch arguments.
684
+ """
685
+ if version is None:
686
+ # if iOS is the current platform, ios_ver *must* be defined. However,
687
+ # it won't exist for CPython versions before 3.13, which causes a mypy
688
+ # error.
689
+ _, release, _, _ = platform.ios_ver() # type: ignore[attr-defined, unused-ignore]
690
+ version = cast("AppleVersion", tuple(map(int, release.split(".")[:2])))
691
+
692
+ if multiarch is None:
693
+ multiarch = sys.implementation._multiarch
694
+ multiarch = multiarch.replace("-", "_")
695
+
696
+ ios_platform_template = "ios_{major}_{minor}_{multiarch}"
697
+
698
+ # Consider any iOS major.minor version from the version requested, down to
699
+ # 12.0. 12.0 is the first iOS version that is known to have enough features
700
+ # to support CPython. Consider every possible minor release up to X.9. There
701
+ # highest the minor has ever gone is 8 (14.8 and 15.8) but having some extra
702
+ # candidates that won't ever match doesn't really hurt, and it saves us from
703
+ # having to keep an explicit list of known iOS versions in the code. Return
704
+ # the results descending order of version number.
705
+
706
+ # If the requested major version is less than 12, there won't be any matches.
707
+ if version[0] < 12:
708
+ return
709
+
710
+ # Consider the actual X.Y version that was requested.
711
+ yield ios_platform_template.format(
712
+ major=version[0], minor=version[1], multiarch=multiarch
713
+ )
714
+
715
+ # Consider every minor version from X.0 to the minor version prior to the
716
+ # version requested by the platform.
717
+ for minor in range(version[1] - 1, -1, -1):
718
+ yield ios_platform_template.format(
719
+ major=version[0], minor=minor, multiarch=multiarch
720
+ )
721
+
722
+ for major in range(version[0] - 1, 11, -1):
723
+ for minor in range(9, -1, -1):
724
+ yield ios_platform_template.format(
725
+ major=major, minor=minor, multiarch=multiarch
726
+ )
727
+
728
+
729
+ def android_platforms(
730
+ api_level: int | None = None, abi: str | None = None
731
+ ) -> Iterator[str]:
732
+ """
733
+ Yields the :attr:`~Tag.platform` tags for Android. If this function is invoked on
734
+ non-Android platforms, the ``api_level`` and ``abi`` arguments are required.
735
+
736
+ :param int api_level: The maximum `API level
737
+ <https://developer.android.com/tools/releases/platforms>`__ to return. Defaults
738
+ to the current system's version, as returned by ``platform.android_ver``.
739
+ :param str abi: The `Android ABI <https://developer.android.com/ndk/guides/abis>`__,
740
+ e.g. ``arm64_v8a``. Defaults to the current system's ABI , as returned by
741
+ ``sysconfig.get_platform``. Hyphens and periods will be replaced with
742
+ underscores.
743
+ """
744
+ if platform.system() != "Android" and (api_level is None or abi is None):
745
+ raise TypeError(
746
+ "on non-Android platforms, the api_level and abi arguments are required"
747
+ )
748
+
749
+ if api_level is None:
750
+ # Python 3.13 was the first version to return platform.system() == "Android",
751
+ # and also the first version to define platform.android_ver().
752
+ api_level = platform.android_ver().api_level # type: ignore[attr-defined]
753
+
754
+ if abi is None:
755
+ abi = sysconfig.get_platform().split("-")[-1]
756
+ abi = _normalize_string(abi)
757
+
758
+ # 16 is the minimum API level known to have enough features to support CPython
759
+ # without major patching. Yield every API level from the maximum down to the
760
+ # minimum, inclusive.
761
+ min_api_level = 16
762
+ for ver in range(api_level, min_api_level - 1, -1):
763
+ yield f"android_{ver}_{abi}"
764
+
765
+
766
+ def _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]:
767
+ linux = _normalize_string(sysconfig.get_platform())
768
+ if not linux.startswith("linux_"):
769
+ # we should never be here, just yield the sysconfig one and return
770
+ yield linux
771
+ return
772
+ if is_32bit:
773
+ if linux == "linux_x86_64":
774
+ linux = "linux_i686"
775
+ elif linux == "linux_aarch64":
776
+ linux = "linux_armv8l"
777
+ _, arch = linux.split("_", 1)
778
+ archs = {"armv8l": ["armv8l", "armv7l"]}.get(arch, [arch])
779
+ yield from _manylinux.platform_tags(archs)
780
+ yield from _musllinux.platform_tags(archs)
781
+ for arch in archs:
782
+ yield f"linux_{arch}"
783
+
784
+
785
+ def _emscripten_platforms() -> Iterator[str]:
786
+ pyemscripten_platform_version = sysconfig.get_config_var(
787
+ "PYEMSCRIPTEN_PLATFORM_VERSION"
788
+ )
789
+ if pyemscripten_platform_version:
790
+ yield f"pyemscripten_{pyemscripten_platform_version}_wasm32"
791
+ yield from _generic_platforms()
792
+
793
+
794
+ def _generic_platforms() -> Iterator[str]:
795
+ yield _normalize_string(sysconfig.get_platform())
796
+
797
+
798
+ def platform_tags() -> Iterator[str]:
799
+ """
800
+ Yields the :attr:`~Tag.platform` tags for the running interpreter.
801
+ """
802
+ if platform.system() == "Darwin":
803
+ return mac_platforms()
804
+ elif platform.system() == "iOS":
805
+ return ios_platforms()
806
+ elif platform.system() == "Android":
807
+ return android_platforms()
808
+ elif platform.system() == "Linux":
809
+ return _linux_platforms()
810
+ elif platform.system() == "Emscripten":
811
+ return _emscripten_platforms()
812
+ else:
813
+ return _generic_platforms()
814
+
815
+
816
+ def interpreter_name() -> str:
817
+ """
818
+ Returns the name of the running interpreter.
819
+
820
+ Some implementations have a reserved, two-letter abbreviation which will
821
+ be returned when appropriate.
822
+
823
+ This typically acts as the prefix to the :attr:`~Tag.interpreter` tag.
824
+ """
825
+ name = sys.implementation.name
826
+ return INTERPRETER_SHORT_NAMES.get(name) or name
827
+
828
+
829
+ def interpreter_version(*, warn: bool = False) -> str:
830
+ """
831
+ Returns the running interpreter's version.
832
+
833
+ This typically acts as the suffix to the :attr:`~Tag.interpreter` tag.
834
+
835
+ :param bool warn: Whether warnings should be logged. Defaults to ``False``.
836
+ """
837
+ version = _get_config_var("py_version_nodot", warn=warn)
838
+ return str(version) if version else _version_nodot(sys.version_info[:2])
839
+
840
+
841
+ def _version_nodot(version: PythonVersion) -> str:
842
+ return "".join(map(str, version))
843
+
844
+
845
+ def sys_tags(*, warn: bool = False) -> Iterator[Tag]:
846
+ """
847
+ Yields the sequence of tag triples that the running interpreter supports.
848
+
849
+ The iterable is ordered so that the best-matching tag is first in the
850
+ sequence. The exact preferential order to tags is interpreter-specific, but
851
+ in general the tag importance is in the order of:
852
+
853
+ 1. Interpreter
854
+ 2. Platform
855
+ 3. ABI
856
+
857
+ This order is due to the fact that an ABI is inherently tied to the
858
+ platform, but platform-specific code is not necessarily tied to the ABI. The
859
+ interpreter is the most important tag as it dictates basic support for any
860
+ wheel.
861
+
862
+ The function returns an iterable in order to allow for the possible
863
+ short-circuiting of tag generation if the entire sequence is not necessary
864
+ and tag calculation happens to be expensive.
865
+
866
+ :param bool warn: Whether warnings should be logged. Defaults to ``False``.
867
+
868
+ .. versionchanged:: 21.3
869
+ Added the `pp3-none-any` tag (:issue:`311`).
870
+ .. versionchanged:: 27.0
871
+ Added the `abi3t` tag (:issue:`1099`).
872
+ """
873
+
874
+ interp_name = interpreter_name()
875
+ if interp_name == "cp":
876
+ yield from cpython_tags(warn=warn)
877
+ else:
878
+ yield from generic_tags()
879
+
880
+ if interp_name == "pp":
881
+ interp = "pp3"
882
+ elif interp_name == "cp":
883
+ interp = "cp" + interpreter_version(warn=warn)
884
+ else:
885
+ interp = None
886
+ yield from compatible_tags(interpreter=interp)
887
+
888
+
889
+ def create_compatible_tags_selector(
890
+ tags: Iterable[Tag],
891
+ ) -> Callable[[Iterable[tuple[_T, AbstractSet[Tag]]]], Iterator[_T]]:
892
+ """Create a callable to select things compatible with supported tags.
893
+
894
+ This function accepts an ordered sequence of tags, with the preferred
895
+ tags first.
896
+
897
+ The returned callable accepts an iterable of tuples (thing, set[Tag]),
898
+ and returns an iterator of things, with the things with the best
899
+ matching tags first.
900
+
901
+ Example to select compatible wheel filenames:
902
+
903
+ >>> from packaging import tags
904
+ >>> from packaging.utils import parse_wheel_filename
905
+ >>> selector = tags.create_compatible_tags_selector(tags.sys_tags())
906
+ >>> filenames = ["foo-1.0-py3-none-any.whl", "foo-1.0-py2-none-any.whl"]
907
+ >>> list(selector([
908
+ ... (filename, parse_wheel_filename(filename)[-1]) for filename in filenames
909
+ ... ]))
910
+ ['foo-1.0-py3-none-any.whl']
911
+
912
+ .. versionadded:: 26.1
913
+ """
914
+ tag_ranks: dict[Tag, int] = {}
915
+ for rank, tag in enumerate(tags):
916
+ tag_ranks.setdefault(tag, rank) # ignore duplicate tags, keep first
917
+ supported_tags = tag_ranks.keys()
918
+
919
+ def selector(
920
+ tagged_things: Iterable[tuple[_T, AbstractSet[Tag]]],
921
+ ) -> Iterator[_T]:
922
+ ranked_things: list[tuple[_T, int]] = []
923
+ for thing, thing_tags in tagged_things:
924
+ supported_thing_tags = thing_tags & supported_tags
925
+ if supported_thing_tags:
926
+ thing_rank = min(tag_ranks[t] for t in supported_thing_tags)
927
+ ranked_things.append((thing, thing_rank))
928
+ return iter(
929
+ thing for thing, _ in sorted(ranked_things, key=operator.itemgetter(1))
930
+ )
931
+
932
+ return selector
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/shellingham/__init__.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import importlib
2
+ import os
3
+
4
+ from ._core import ShellDetectionFailure
5
+
6
+ __version__ = "1.5.4"
7
+
8
+
9
+ def detect_shell(pid=None, max_depth=10):
10
+ name = os.name
11
+ try:
12
+ impl = importlib.import_module(".{}".format(name), __name__)
13
+ except ImportError:
14
+ message = "Shell detection not implemented for {0!r}".format(name)
15
+ raise RuntimeError(message)
16
+ try:
17
+ get_shell = impl.get_shell
18
+ except AttributeError:
19
+ raise RuntimeError("get_shell not implemented for {0!r}".format(name))
20
+ shell = get_shell(pid, max_depth=max_depth)
21
+ if shell:
22
+ return shell
23
+ raise ShellDetectionFailure()
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/shellingham/_core.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SHELL_NAMES = (
2
+ {"sh", "bash", "dash", "ash"} # Bourne.
3
+ | {"csh", "tcsh"} # C.
4
+ | {"ksh", "zsh", "fish"} # Common alternatives.
5
+ | {"cmd", "powershell", "pwsh"} # Microsoft.
6
+ | {"elvish", "xonsh", "nu"} # More exotic.
7
+ )
8
+
9
+
10
+ class ShellDetectionFailure(EnvironmentError):
11
+ pass
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/aria/configuration_aria.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
2
+ # This file was automatically generated from src/transformers/models/aria/modular_aria.py.
3
+ # Do NOT edit this file manually as any edits will be overwritten by the generation of
4
+ # the file from the modular. If any change should be done, please apply the change to the
5
+ # modular_aria.py file directly. One of our CI enforces this.
6
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
7
+ # Copyright 2024 The Rhymes-AI Teams Authors and The HuggingFace Inc. team. All rights reserved.
8
+ #
9
+ # Licensed under the Apache License, Version 2.0 (the "License");
10
+ # you may not use this file except in compliance with the License.
11
+ # You may obtain a copy of the License at
12
+ #
13
+ # http://www.apache.org/licenses/LICENSE-2.0
14
+ #
15
+ # Unless required by applicable law or agreed to in writing, software
16
+ # distributed under the License is distributed on an "AS IS" BASIS,
17
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ # See the License for the specific language governing permissions and
19
+ # limitations under the License.
20
+ from huggingface_hub.dataclasses import strict
21
+
22
+ from ...configuration_utils import PreTrainedConfig
23
+ from ...modeling_rope_utils import RopeParameters
24
+ from ...utils import auto_docstring
25
+ from ...utils.type_validators import interval
26
+ from ..auto import CONFIG_MAPPING, AutoConfig
27
+
28
+
29
+ @auto_docstring(checkpoint="rhymes-ai/Aria")
30
+ @strict
31
+ class AriaTextConfig(PreTrainedConfig):
32
+ r"""
33
+ moe_num_experts (`int`, *optional*, defaults to 8):
34
+ The number of experts in the MoE layer.
35
+ moe_topk (`int`, *optional*, defaults to 2):
36
+ The number of top experts to route to for each token.
37
+ moe_num_shared_experts (`int`, *optional*, defaults to 2):
38
+ The number of shared experts.
39
+ """
40
+
41
+ model_type = "aria_text"
42
+ keys_to_ignore_at_inference = ["past_key_values"]
43
+ base_model_tp_plan = {
44
+ "layers.*.self_attn.q_proj": "colwise",
45
+ "layers.*.self_attn.k_proj": "colwise",
46
+ "layers.*.self_attn.v_proj": "colwise",
47
+ "layers.*.self_attn.o_proj": "rowwise",
48
+ "layers.*.mlp.shared_experts.gate_proj": "colwise",
49
+ "layers.*.mlp.shared_experts.up_proj": "colwise",
50
+ "layers.*.mlp.shared_experts.down_proj": "rowwise",
51
+ }
52
+ base_model_pp_plan = {
53
+ "embed_tokens": (["input_ids"], ["inputs_embeds"]),
54
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
55
+ "norm": (["hidden_states"], ["hidden_states"]),
56
+ }
57
+
58
+ vocab_size: int = 32000
59
+ hidden_size: int = 4096
60
+
61
+ intermediate_size: int = 4096
62
+ num_hidden_layers: int = 32
63
+ num_attention_heads: int = 32
64
+ num_key_value_heads: int | None = None
65
+ hidden_act: str = "silu"
66
+ max_position_embeddings: int = 2048
67
+ initializer_range: float = interval(min=0.0, max=1.0)(default=0.02)
68
+ rms_norm_eps: float = 1e-6
69
+ use_cache: bool = True
70
+ pad_token_id: int | None = 2
71
+ bos_token_id: int | None = 1
72
+ eos_token_id: int | list[int] | None = 2
73
+ pretraining_tp: int | None = 1
74
+ tie_word_embeddings: bool = False
75
+ rope_parameters: RopeParameters | dict | None = None
76
+ attention_bias: bool = False
77
+ attention_dropout: int | float | None = 0.0
78
+ mlp_bias: bool = False
79
+ head_dim: int | None = None
80
+ base_config_key = "text_config"
81
+ moe_num_experts: int = 8
82
+ moe_topk: int = 2
83
+ moe_num_shared_experts: int = 2
84
+
85
+ def __post_init__(self, **kwargs):
86
+ if self.head_dim is None:
87
+ self.head_dim = self.hidden_size // self.num_attention_heads
88
+ if self.num_key_value_heads is None:
89
+ self.num_key_value_heads = self.num_attention_heads
90
+
91
+ super().__post_init__(**kwargs)
92
+
93
+ def validate_architecture(self):
94
+ """Part of `@strict`-powered validation. Validates the architecture of the config."""
95
+ if self.hidden_size % self.num_attention_heads != 0:
96
+ raise ValueError(
97
+ f"The hidden size ({self.hidden_size}) is not a multiple of the number of attention "
98
+ f"heads ({self.num_attention_heads})."
99
+ )
100
+
101
+
102
+ @auto_docstring(checkpoint="rhymes-ai/Aria")
103
+ @strict
104
+ class AriaConfig(PreTrainedConfig):
105
+ r"""
106
+ projector_patch_to_query_dict (`dict`, *optional*):
107
+ Mapping of patch sizes to query dimensions.
108
+ """
109
+
110
+ model_type = "aria"
111
+ attribute_map = {
112
+ "image_token_id": "image_token_index",
113
+ }
114
+ sub_configs = {"text_config": AriaTextConfig, "vision_config": AutoConfig}
115
+
116
+ vision_config: dict | PreTrainedConfig | None = None
117
+ text_config: dict | AriaTextConfig | None = None
118
+ vision_feature_layer: int | list[int] = -1
119
+ projector_patch_to_query_dict: dict | None = None
120
+ image_token_index: int = 9
121
+ initializer_range: float = 0.02
122
+ tie_word_embeddings: bool = False
123
+
124
+ def __post_init__(self, **kwargs):
125
+ # Convert the keys and values of projector_patch_to_query_dict to integers
126
+ # This ensures consistency even if they were provided as strings
127
+ if self.projector_patch_to_query_dict is None:
128
+ self.projector_patch_to_query_dict = {
129
+ 1225: 128,
130
+ 4900: 256,
131
+ }
132
+ self.projector_patch_to_query_dict = {int(k): int(v) for k, v in self.projector_patch_to_query_dict.items()}
133
+ self.max_value_projector_patch_to_query_dict = max(self.projector_patch_to_query_dict.values())
134
+
135
+ if isinstance(self.vision_config, dict):
136
+ self.vision_config["model_type"] = "idefics3_vision"
137
+ self.vision_config = CONFIG_MAPPING[self.vision_config["model_type"]](**self.vision_config)
138
+ elif self.vision_config is None:
139
+ self.vision_config = CONFIG_MAPPING["idefics3_vision"]()
140
+
141
+ if isinstance(self.text_config, dict) and "model_type" in self.text_config:
142
+ self.text_config = AriaTextConfig(**self.text_config)
143
+ elif self.text_config is None:
144
+ self.text_config = AriaTextConfig()
145
+
146
+ super().__post_init__(**kwargs)
147
+
148
+
149
+ __all__ = ["AriaConfig", "AriaTextConfig"]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/__init__.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2025 The HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ from typing import TYPE_CHECKING
16
+
17
+ from ...utils import _LazyModule
18
+ from ...utils.import_utils import define_import_structure
19
+
20
+
21
+ if TYPE_CHECKING:
22
+ from .configuration_ovis2 import *
23
+ from .image_processing_ovis2 import *
24
+ from .image_processing_pil_ovis2 import *
25
+ from .modeling_ovis2 import *
26
+ from .processing_ovis2 import *
27
+ else:
28
+ import sys
29
+
30
+ _file = globals()["__file__"]
31
+ sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/configuration_ovis2.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2025 The HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ from huggingface_hub.dataclasses import strict
17
+
18
+ from ...configuration_utils import PreTrainedConfig
19
+ from ...utils import auto_docstring
20
+ from ..qwen2.configuration_qwen2 import Qwen2Config
21
+
22
+
23
+ @auto_docstring(checkpoint="thisisiron/Ovis2-1B-hf")
24
+ @strict
25
+ class Ovis2VisionConfig(PreTrainedConfig):
26
+ r"""
27
+ hidden_stride (`int`, *optional*, defaults to 1):
28
+ The stride of the hidden layer in the Vision Transformer.
29
+ num_visual_indicator_tokens (`int`, *optional*, defaults to 5):
30
+ Number of visual indicator tokens.
31
+ tokenize_function (`str`, *optional*, defaults to `"softmax"`):
32
+ The function used to tokenize the visual indicator tokens.
33
+ """
34
+
35
+ base_config_key = "vision_config"
36
+
37
+ hidden_size: int = 1024
38
+ intermediate_size: int = 2816
39
+ num_hidden_layers: int = 24
40
+ num_attention_heads: int = 8
41
+ num_channels: int = 3
42
+ image_size: int | list[int] | tuple[int, int] = 224
43
+ patch_size: int | list[int] | tuple[int, int] = 14
44
+ rms_norm_eps: float = 1e-5
45
+ attention_dropout: float | int = 0.0
46
+ qkv_bias: bool = False
47
+ mlp_bias: bool = False
48
+ hidden_act: str = "silu"
49
+ vocab_size: int = 16384
50
+ hidden_stride: int = 1
51
+ num_visual_indicator_tokens: int = 5
52
+ initializer_range: float = 0.02
53
+ tokenize_function: str = "softmax"
54
+
55
+
56
+ @auto_docstring(checkpoint="thisisiron/Ovis2-1B-hf")
57
+ @strict
58
+ class Ovis2Config(PreTrainedConfig):
59
+ r"""
60
+ visual_indicator_token_ids (`List[int]`, *optional*, defaults to `[151666, 151667, 151668, 151669, 151670]`):
61
+ The visual indicator token ids to encode the image prompt.
62
+
63
+ ```python
64
+ >>> from transformers import Ovis2ForConditionalGeneration, Ovis2Config
65
+
66
+ >>> # Initializing a Ovis2 style configuration
67
+ >>> configuration = Ovis2Config()
68
+
69
+ >>> # Initializing a model from the Ovis2-2B style configuration
70
+ >>> model = Ovis2ForConditionalGeneration(configuration)
71
+
72
+ >>> # Accessing the model configuration
73
+ >>> configuration = model.config
74
+ ```
75
+ """
76
+
77
+ model_type = "ovis2"
78
+ sub_configs = {"text_config": Qwen2Config, "vision_config": Ovis2VisionConfig}
79
+
80
+ vision_config: dict | PreTrainedConfig | None = None
81
+ text_config: dict | PreTrainedConfig | None = None
82
+ image_token_id: int = 151665
83
+ visual_indicator_token_ids: list[int] | tuple[int, ...] = (151666, 151667, 151668, 151669, 151670)
84
+ vocab_size: int = 151643
85
+ hidden_size: int = 1536
86
+ tie_word_embeddings: bool = True
87
+
88
+ def __post_init__(self, **kwargs):
89
+ if isinstance(self.vision_config, dict):
90
+ self.vision_config = Ovis2VisionConfig(**self.vision_config)
91
+ if self.vision_config is None:
92
+ self.vision_config = Ovis2VisionConfig(num_visual_indicator_tokens=len(self.visual_indicator_token_ids))
93
+
94
+ if isinstance(self.text_config, dict):
95
+ self.text_config = Qwen2Config(**self.text_config)
96
+ elif self.text_config is None:
97
+ self.text_config = Qwen2Config()
98
+
99
+ super().__post_init__(**kwargs)
100
+
101
+
102
+ __all__ = ["Ovis2VisionConfig", "Ovis2Config"]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/image_processing_ovis2.py ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2025 The HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """Image processor class for OVIS2."""
15
+
16
+ from functools import lru_cache
17
+
18
+ import torch
19
+ from torchvision.transforms.v2 import functional as tvF
20
+
21
+ from ...image_processing_backends import TorchvisionBackend
22
+ from ...image_processing_utils import BatchFeature
23
+ from ...image_transforms import group_images_by_shape, reorder_images
24
+ from ...image_utils import (
25
+ OPENAI_CLIP_MEAN,
26
+ OPENAI_CLIP_STD,
27
+ ImageInput,
28
+ PILImageResampling,
29
+ SizeDict,
30
+ )
31
+ from ...processing_utils import ImagesKwargs, Unpack
32
+ from ...utils import TensorType, auto_docstring
33
+
34
+
35
+ # Helper functions for patch/tile calculations
36
+ @lru_cache(maxsize=10)
37
+ def get_all_supported_aspect_ratios(min_image_tiles: int, max_image_tiles: int) -> list[tuple[int, int]]:
38
+ """Computes all allowed aspect ratios for a given minimum and maximum number of input tiles."""
39
+ aspect_ratios = []
40
+ for width in range(1, max_image_tiles + 1):
41
+ for height in range(1, max_image_tiles + 1):
42
+ if width * height <= max_image_tiles and width * height >= min_image_tiles:
43
+ aspect_ratios.append((width, height))
44
+ return sorted(aspect_ratios, key=lambda x: x[0] * x[1])
45
+
46
+
47
+ @lru_cache(maxsize=100)
48
+ def get_optimal_tiled_canvas(
49
+ original_image_size: tuple[int, int],
50
+ target_tile_size: tuple[int, int],
51
+ min_image_tiles: int,
52
+ max_image_tiles: int,
53
+ ) -> tuple[int, int]:
54
+ """Find the canvas with the closest aspect ratio to the original image aspect ratio."""
55
+ possible_tile_arrangements = get_all_supported_aspect_ratios(min_image_tiles, max_image_tiles)
56
+ original_height, original_width = original_image_size
57
+ target_tile_height, target_tile_width = target_tile_size
58
+ aspect_ratio = original_width / original_height
59
+ area = original_width * original_height
60
+
61
+ best_ratio_diff = float("inf")
62
+ best_grid = (1, 1)
63
+ for grid in possible_tile_arrangements:
64
+ grid_aspect_ratio = grid[0] / grid[1]
65
+ ratio_diff = abs(aspect_ratio - grid_aspect_ratio)
66
+ if ratio_diff < best_ratio_diff:
67
+ best_ratio_diff = ratio_diff
68
+ best_grid = grid
69
+ elif ratio_diff == best_ratio_diff:
70
+ if area > 0.5 * target_tile_height * target_tile_width * grid[0] * grid[1]:
71
+ best_grid = grid
72
+ return best_grid
73
+
74
+
75
+ def compute_patch_covering_area(left: int, upper: int, right: int, lower: int, side: int) -> float:
76
+ w = right - left
77
+ h = lower - upper
78
+ w, h = max(w, h), min(w, h)
79
+ if w > side:
80
+ h = h / w * side
81
+ w = side
82
+ return w * h
83
+
84
+
85
+ def split_image_into_grid(h: int, w: int, grid: tuple[int, int]) -> list[tuple[int, int, int, int]]:
86
+ row_height = h // grid[0]
87
+ col_width = w // grid[1]
88
+ return [
89
+ (
90
+ col * col_width,
91
+ row * row_height,
92
+ w if col == grid[1] - 1 else (col + 1) * col_width,
93
+ h if row == grid[0] - 1 else (row + 1) * row_height,
94
+ )
95
+ for row in range(grid[0])
96
+ for col in range(grid[1])
97
+ ]
98
+
99
+
100
+ @lru_cache(maxsize=100)
101
+ def get_min_tile_covering_grid(
102
+ image_size: tuple[int, int],
103
+ target_patch_size: int,
104
+ max_image_tiles: int,
105
+ covering_threshold: float = 0.9,
106
+ ) -> tuple[int, int]:
107
+ image_height, image_width = image_size
108
+ image_area = image_width * image_height
109
+ candidate_tile_grids = get_all_supported_aspect_ratios(1, max_image_tiles)
110
+ evaluated_grids = []
111
+ sufficient_covering_grids = []
112
+
113
+ for tile_grid in candidate_tile_grids:
114
+ tile_regions = split_image_into_grid(image_height, image_width, tile_grid)
115
+ tile_covering_ratio = (
116
+ sum(compute_patch_covering_area(*region, target_patch_size) for region in tile_regions) / image_area
117
+ )
118
+ evaluated_grids.append((tile_grid, tile_covering_ratio))
119
+ if tile_covering_ratio > covering_threshold:
120
+ sufficient_covering_grids.append((tile_grid, tile_covering_ratio))
121
+
122
+ if sufficient_covering_grids:
123
+ return min(sufficient_covering_grids, key=lambda x: (x[0][0] * x[0][1], -x[1]))[0]
124
+ return min(evaluated_grids, key=lambda x: (-x[1], x[0][0] * x[0][1]))[0]
125
+
126
+
127
+ class Ovis2ImageProcessorKwargs(ImagesKwargs, total=False):
128
+ """
129
+ crop_to_patches (`bool`, *optional*, defaults to `False`):
130
+ Whether to crop the image to patches. Can be overridden by the `crop_to_patches` parameter in the
131
+ `preprocess` method.
132
+ min_patches (`int`, *optional*, defaults to 1):
133
+ The minimum number of patches to be extracted from the image. Only has an effect if `crop_to_patches` is
134
+ set to `True`. Can be overridden by the `min_patches` parameter in the `preprocess` method.
135
+ max_patches (`int`, *optional*, defaults to 12):
136
+ The maximum number of patches to be extracted from the image. Only has an effect if `crop_to_patches` is
137
+ set to `True`. Can be overridden by the `max_patches` parameter in the `preprocess` method.
138
+ use_covering_area_grid (`bool`, *optional*, defaults to `True`):
139
+ Whether to use the covering area grid to determine the number of patches. Only has an effect if
140
+ `crop_to_patches` is set to `True`. Can be overridden by the `use_covering_area_grid` parameter in the
141
+ `preprocess` method.
142
+ """
143
+
144
+ crop_to_patches: bool
145
+ min_patches: int
146
+ max_patches: int
147
+ use_covering_area_grid: bool
148
+
149
+
150
+ @auto_docstring
151
+ class Ovis2ImageProcessor(TorchvisionBackend):
152
+ resample = PILImageResampling.BICUBIC
153
+ image_mean = OPENAI_CLIP_MEAN
154
+ image_std = OPENAI_CLIP_STD
155
+ size = {"height": 384, "width": 384}
156
+ default_to_square = True
157
+ do_resize = True
158
+ do_rescale = True
159
+ do_normalize = True
160
+ do_convert_rgb = True
161
+ crop_to_patches = False
162
+ min_patches = 1
163
+ max_patches = 12
164
+ use_covering_area_grid = True
165
+ valid_kwargs = Ovis2ImageProcessorKwargs
166
+
167
+ def __init__(self, **kwargs: Unpack[Ovis2ImageProcessorKwargs]):
168
+ super().__init__(**kwargs)
169
+
170
+ @auto_docstring
171
+ def preprocess(self, images: ImageInput, **kwargs: Unpack[Ovis2ImageProcessorKwargs]) -> BatchFeature:
172
+ return super().preprocess(images, **kwargs)
173
+
174
+ def crop_image_to_patches(
175
+ self,
176
+ images: "torch.Tensor",
177
+ min_patches: int,
178
+ max_patches: int,
179
+ use_covering_area_grid: bool = True,
180
+ covering_threshold: float = 0.9,
181
+ patch_size: SizeDict | None = None,
182
+ resample: "PILImageResampling | tvF.InterpolationMode | int | None" = None,
183
+ ):
184
+ """
185
+ Crop the images to patches and return a list of cropped images.
186
+ The number of patches and their grid arrangement are determined by the original image size,
187
+ the target patch size and the minimum and maximum number of patches.
188
+ The aspect ratio of the patches grid is chosen to be the closest to the original image aspect ratio.
189
+
190
+ Args:
191
+ images (`torch.Tensor`):
192
+ The images to be cropped.
193
+ min_patches (`int`):
194
+ The minimum number of patches to be extracted from the image.
195
+ max_patches (`int`):
196
+ The maximum number of patches to be extracted from the image.
197
+ use_covering_area_grid (`bool`, *optional*, defaults to `True`):
198
+ Whether to use the original OVIS2 approach: compute the minimal number of tiles that cover at least 90%
199
+ of the image area. If `False`, the closest aspect ratio to the target is used.
200
+ covering_threshold (`float`, *optional*, defaults to `0.9`):
201
+ The threshold for the covering area. Only has an effect if `use_covering_area_grid` is set to `True`.
202
+ patch_size (`SizeDict`, *optional*):
203
+ The size of the output patches.
204
+ resample (`PILImageResampling | tvF.InterpolationMode | int | None`, *optional*):
205
+ Resampling filter to use if resizing the image.
206
+
207
+ Returns:
208
+ Tuple[`torch.Tensor`, `list`]: A tuple containing the processed images tensor and the grid information.
209
+ """
210
+ num_image = images.shape[0]
211
+ patch_size_height, patch_size_width = patch_size.height, patch_size.width
212
+ original_height, original_width = images.shape[-2:]
213
+
214
+ if use_covering_area_grid:
215
+ # Use the original OVIS2 approach: compute the minimal number of tiles that cover at least 90% of the image area
216
+ num_columns, num_rows = get_min_tile_covering_grid(
217
+ (original_height, original_width),
218
+ target_patch_size=patch_size_height, # square patch size
219
+ max_image_tiles=max_patches,
220
+ covering_threshold=covering_threshold,
221
+ )
222
+ else:
223
+ # find the closest aspect ratio to the target
224
+ num_columns, num_rows = get_optimal_tiled_canvas(
225
+ (original_height, original_width), (patch_size_height, patch_size_width), min_patches, max_patches
226
+ )
227
+
228
+ # calculate the target width and height
229
+ target_width = patch_size_width * num_columns
230
+ target_height = patch_size_height * num_rows
231
+ num_blocks = num_columns * num_rows
232
+
233
+ # resize the image so that each patch is of patch_size
234
+ resized_image = self.resize(images, SizeDict(height=target_height, width=target_width), resample=resample)
235
+ # split the image into patches
236
+ processed_images = []
237
+ for i in range(num_blocks):
238
+ column = i % num_columns
239
+ row = i // num_columns
240
+ box = (
241
+ column * patch_size_width,
242
+ row * patch_size_height,
243
+ (column + 1) * patch_size_width,
244
+ (row + 1) * patch_size_height,
245
+ )
246
+ # split the image
247
+ patch_image = resized_image[..., box[1] : box[3], box[0] : box[2]]
248
+ processed_images.append(patch_image)
249
+
250
+ if len(processed_images) != 1:
251
+ thumbnail_img = self.resize(images, patch_size, resample=resample)
252
+ processed_images.insert(0, thumbnail_img)
253
+
254
+ processed_images = torch.stack(processed_images, dim=0).transpose(0, 1).contiguous()
255
+ grid = [[num_rows, num_columns] for _ in range(num_image)]
256
+
257
+ return processed_images, grid
258
+
259
+ def _preprocess(
260
+ self,
261
+ images: list["torch.Tensor"],
262
+ do_resize: bool,
263
+ size: SizeDict,
264
+ resample: "PILImageResampling | tvF.InterpolationMode | int | None",
265
+ do_center_crop: bool,
266
+ crop_size: SizeDict,
267
+ do_rescale: bool,
268
+ rescale_factor: float,
269
+ do_normalize: bool,
270
+ image_mean: float | list[float] | None,
271
+ image_std: float | list[float] | None,
272
+ disable_grouping: bool | None,
273
+ return_tensors: str | TensorType | None,
274
+ crop_to_patches: bool = False,
275
+ min_patches: int = 1,
276
+ max_patches: int = 12,
277
+ use_covering_area_grid: bool = True,
278
+ **kwargs,
279
+ ) -> BatchFeature:
280
+ if crop_to_patches and max_patches > 1:
281
+ grouped_images, grouped_images_index = group_images_by_shape(images, disable_grouping=disable_grouping)
282
+ processed_images_grouped = {}
283
+ grids = {}
284
+ for shape, stacked_images in grouped_images.items():
285
+ stacked_images, grid = self.crop_image_to_patches(
286
+ stacked_images,
287
+ min_patches,
288
+ max_patches,
289
+ patch_size=size,
290
+ use_covering_area_grid=use_covering_area_grid,
291
+ resample=resample,
292
+ )
293
+ processed_images_grouped[shape] = stacked_images
294
+ grids[shape] = grid
295
+ images = reorder_images(processed_images_grouped, grouped_images_index)
296
+ images = [image for images_list in images for image in images_list]
297
+ grids = reorder_images(grids, grouped_images_index)
298
+ else:
299
+ grids = [[1, 1] for _ in range(len(images))]
300
+
301
+ # Group images by size for batched resizing
302
+ grouped_images, grouped_images_index = group_images_by_shape(images, disable_grouping=disable_grouping)
303
+ resized_images_grouped = {}
304
+ for shape, stacked_images in grouped_images.items():
305
+ if do_resize:
306
+ stacked_images = self.resize(image=stacked_images, size=size, resample=resample)
307
+ resized_images_grouped[shape] = stacked_images
308
+ resized_images = reorder_images(resized_images_grouped, grouped_images_index)
309
+
310
+ # Group images by size for further processing
311
+ # Needed in case do_resize is False, or resize returns images with different sizes
312
+ grouped_images, grouped_images_index = group_images_by_shape(resized_images, disable_grouping=disable_grouping)
313
+ processed_images_grouped = {}
314
+ for shape, stacked_images in grouped_images.items():
315
+ if do_center_crop:
316
+ stacked_images = self.center_crop(stacked_images, crop_size)
317
+ # Fused rescale and normalize
318
+ stacked_images = self.rescale_and_normalize(
319
+ stacked_images, do_rescale, rescale_factor, do_normalize, image_mean, image_std
320
+ )
321
+ processed_images_grouped[shape] = stacked_images
322
+
323
+ processed_images = reorder_images(processed_images_grouped, grouped_images_index)
324
+ return BatchFeature(data={"pixel_values": processed_images, "grids": grids}, tensor_type=return_tensors)
325
+
326
+
327
+ __all__ = ["Ovis2ImageProcessor"]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/image_processing_pil_ovis2.py ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2025 The HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ """PIL Image processor class for OVIS2."""
15
+
16
+ from functools import lru_cache
17
+
18
+ import numpy as np
19
+
20
+ from ...image_processing_backends import PilBackend
21
+ from ...image_processing_utils import BatchFeature
22
+ from ...image_transforms import to_channel_dimension_format
23
+ from ...image_utils import (
24
+ OPENAI_CLIP_MEAN,
25
+ OPENAI_CLIP_STD,
26
+ ChannelDimension,
27
+ ImageInput,
28
+ PILImageResampling,
29
+ SizeDict,
30
+ infer_channel_dimension_format,
31
+ )
32
+ from ...processing_utils import ImagesKwargs, Unpack
33
+ from ...utils import TensorType, auto_docstring
34
+
35
+
36
+ # Adapted from transformers.models.ovis2.image_processing_ovis2.Ovis2ImageProcessorKwargs
37
+ class Ovis2ImageProcessorKwargs(ImagesKwargs, total=False):
38
+ """
39
+ crop_to_patches (`bool`, *optional*, defaults to `False`):
40
+ Whether to crop the image to patches. Can be overridden by the `crop_to_patches` parameter in the
41
+ `preprocess` method.
42
+ min_patches (`int`, *optional*, defaults to 1):
43
+ The minimum number of patches to be extracted from the image. Only has an effect if `crop_to_patches` is
44
+ set to `True`. Can be overridden by the `min_patches` parameter in the `preprocess` method.
45
+ max_patches (`int`, *optional*, defaults to 12):
46
+ The maximum number of patches to be extracted from the image. Only has an effect if `crop_to_patches` is
47
+ set to `True`. Can be overridden by the `max_patches` parameter in the `preprocess` method.
48
+ use_covering_area_grid (`bool`, *optional*, defaults to `True`):
49
+ Whether to use the covering area grid to determine the number of patches. Only has an effect if
50
+ `crop_to_patches` is set to `True`. Can be overridden by the `use_covering_area_grid` parameter in the
51
+ `preprocess` method.
52
+ """
53
+
54
+ crop_to_patches: bool
55
+ min_patches: int
56
+ max_patches: int
57
+ use_covering_area_grid: bool
58
+
59
+
60
+ # Adapted from transformers.models.ovis2.image_processing_ovis2.get_all_supported_aspect_ratios
61
+ @lru_cache(maxsize=10)
62
+ def get_all_supported_aspect_ratios(min_image_tiles: int, max_image_tiles: int) -> list[tuple[int, int]]:
63
+ """Computes all allowed aspect ratios for a given minimum and maximum number of input tiles."""
64
+ aspect_ratios = []
65
+ for width in range(1, max_image_tiles + 1):
66
+ for height in range(1, max_image_tiles + 1):
67
+ if width * height <= max_image_tiles and width * height >= min_image_tiles:
68
+ aspect_ratios.append((width, height))
69
+ return sorted(aspect_ratios, key=lambda x: x[0] * x[1])
70
+
71
+
72
+ # Adapted from transformers.models.ovis2.image_processing_ovis2.compute_patch_covering_area
73
+ def compute_patch_covering_area(left: int, upper: int, right: int, lower: int, side: int) -> float:
74
+ w = right - left
75
+ h = lower - upper
76
+ w, h = max(w, h), min(w, h)
77
+ if w > side:
78
+ h = h / w * side
79
+ w = side
80
+ return w * h
81
+
82
+
83
+ # Adapted from transformers.models.ovis2.image_processing_ovis2.split_image_into_grid
84
+ def split_image_into_grid(h: int, w: int, grid: tuple[int, int]) -> list[tuple[int, int, int, int]]:
85
+ row_height = h // grid[0]
86
+ col_width = w // grid[1]
87
+ return [
88
+ (
89
+ col * col_width,
90
+ row * row_height,
91
+ w if col == grid[1] - 1 else (col + 1) * col_width,
92
+ h if row == grid[0] - 1 else (row + 1) * row_height,
93
+ )
94
+ for row in range(grid[0])
95
+ for col in range(grid[1])
96
+ ]
97
+
98
+
99
+ # Adapted from transformers.models.ovis2.image_processing_ovis2.get_min_tile_covering_grid
100
+ @lru_cache(maxsize=100)
101
+ def get_min_tile_covering_grid(
102
+ image_size: tuple[int, int],
103
+ target_patch_size: int,
104
+ max_image_tiles: int,
105
+ covering_threshold: float = 0.9,
106
+ ) -> tuple[int, int]:
107
+ image_height, image_width = image_size
108
+ image_area = image_width * image_height
109
+ candidate_tile_grids = get_all_supported_aspect_ratios(1, max_image_tiles)
110
+ evaluated_grids = []
111
+ sufficient_covering_grids = []
112
+
113
+ for tile_grid in candidate_tile_grids:
114
+ tile_regions = split_image_into_grid(image_height, image_width, tile_grid)
115
+ tile_covering_ratio = (
116
+ sum(compute_patch_covering_area(*region, target_patch_size) for region in tile_regions) / image_area
117
+ )
118
+ evaluated_grids.append((tile_grid, tile_covering_ratio))
119
+ if tile_covering_ratio > covering_threshold:
120
+ sufficient_covering_grids.append((tile_grid, tile_covering_ratio))
121
+
122
+ if sufficient_covering_grids:
123
+ return min(sufficient_covering_grids, key=lambda x: (x[0][0] * x[0][1], -x[1]))[0]
124
+ return min(evaluated_grids, key=lambda x: (-x[1], x[0][0] * x[0][1]))[0]
125
+
126
+
127
+ # Adapted from transformers.models.ovis2.image_processing_ovis2.get_optimal_tiled_canvas
128
+ @lru_cache(maxsize=100)
129
+ def get_optimal_tiled_canvas(
130
+ original_image_size: tuple[int, int],
131
+ target_tile_size: tuple[int, int],
132
+ min_image_tiles: int,
133
+ max_image_tiles: int,
134
+ ) -> tuple[int, int]:
135
+ """Find the canvas with the closest aspect ratio to the original image aspect ratio."""
136
+ possible_tile_arrangements = get_all_supported_aspect_ratios(min_image_tiles, max_image_tiles)
137
+ original_height, original_width = original_image_size
138
+ target_tile_height, target_tile_width = target_tile_size
139
+ aspect_ratio = original_width / original_height
140
+ area = original_width * original_height
141
+
142
+ best_ratio_diff = float("inf")
143
+ best_grid = (1, 1)
144
+ for grid in possible_tile_arrangements:
145
+ grid_aspect_ratio = grid[0] / grid[1]
146
+ ratio_diff = abs(aspect_ratio - grid_aspect_ratio)
147
+ if ratio_diff < best_ratio_diff:
148
+ best_ratio_diff = ratio_diff
149
+ best_grid = grid
150
+ elif ratio_diff == best_ratio_diff:
151
+ if area > 0.5 * target_tile_height * target_tile_width * grid[0] * grid[1]:
152
+ best_grid = grid
153
+ return best_grid
154
+
155
+
156
+ @auto_docstring
157
+ class Ovis2ImageProcessorPil(PilBackend):
158
+ resample = PILImageResampling.BICUBIC
159
+ image_mean = OPENAI_CLIP_MEAN
160
+ image_std = OPENAI_CLIP_STD
161
+ size = {"height": 384, "width": 384}
162
+ default_to_square = True
163
+ do_resize = True
164
+ do_rescale = True
165
+ do_normalize = True
166
+ do_convert_rgb = True
167
+ crop_to_patches = False
168
+ min_patches = 1
169
+ max_patches = 12
170
+ use_covering_area_grid = True
171
+ valid_kwargs = Ovis2ImageProcessorKwargs
172
+
173
+ def __init__(self, **kwargs: Unpack[Ovis2ImageProcessorKwargs]):
174
+ super().__init__(**kwargs)
175
+
176
+ @auto_docstring
177
+ def preprocess(self, images: ImageInput, **kwargs: Unpack[Ovis2ImageProcessorKwargs]) -> BatchFeature:
178
+ return super().preprocess(images, **kwargs)
179
+
180
+ def crop_image_to_patches(
181
+ self,
182
+ image: np.ndarray,
183
+ min_patches: int,
184
+ max_patches: int,
185
+ use_covering_area_grid: bool = True,
186
+ covering_threshold: float = 0.9,
187
+ patch_size: SizeDict | None = None,
188
+ resample: "PILImageResampling | None" = None,
189
+ ):
190
+ """
191
+ Crop the image to patches and return a list of cropped images.
192
+ Mirrors TorchvisionBackend.crop_image_to_patches.
193
+ """
194
+ # Normalize to CHW when called directly (e.g. from tests); _preprocess already receives CHW
195
+ input_data_format = infer_channel_dimension_format(image)
196
+ image = to_channel_dimension_format(image, ChannelDimension.FIRST, input_data_format)
197
+
198
+ patch_size_height, patch_size_width = patch_size.height, patch_size.width
199
+ original_height, original_width = image.shape[-2:]
200
+
201
+ if use_covering_area_grid:
202
+ # Use the original OVIS2 approach: compute the minimal number of tiles that cover at least 90% of the image area
203
+ num_columns, num_rows = get_min_tile_covering_grid(
204
+ (original_height, original_width),
205
+ target_patch_size=patch_size_height, # square patch size
206
+ max_image_tiles=max_patches,
207
+ covering_threshold=covering_threshold,
208
+ )
209
+ else:
210
+ # find the closest aspect ratio to the target
211
+ num_columns, num_rows = get_optimal_tiled_canvas(
212
+ (original_height, original_width), (patch_size_height, patch_size_width), min_patches, max_patches
213
+ )
214
+
215
+ # calculate the target width and height
216
+ target_width = patch_size_width * num_columns
217
+ target_height = patch_size_height * num_rows
218
+ num_blocks = num_columns * num_rows
219
+
220
+ # resize the image so that each patch is of patch_size
221
+ resized_image = self.resize(image, SizeDict(height=target_height, width=target_width), resample=resample)
222
+ # split the image into patches
223
+ processed_images = []
224
+ for i in range(num_blocks):
225
+ column = i % num_columns
226
+ row = i // num_columns
227
+ box = (
228
+ column * patch_size_width,
229
+ row * patch_size_height,
230
+ (column + 1) * patch_size_width,
231
+ (row + 1) * patch_size_height,
232
+ )
233
+ patch_image = resized_image[:, box[1] : box[3], box[0] : box[2]]
234
+ processed_images.append(patch_image)
235
+
236
+ if len(processed_images) != 1:
237
+ thumbnail_img = self.resize(image, patch_size, resample=resample)
238
+ processed_images.insert(0, thumbnail_img)
239
+
240
+ return processed_images, [num_rows, num_columns]
241
+
242
+ def _preprocess(
243
+ self,
244
+ images: list[np.ndarray],
245
+ do_resize: bool,
246
+ size: SizeDict,
247
+ resample: "PILImageResampling | None",
248
+ do_center_crop: bool,
249
+ crop_size: SizeDict,
250
+ do_rescale: bool,
251
+ rescale_factor: float,
252
+ do_normalize: bool,
253
+ image_mean: float | list[float] | None,
254
+ image_std: float | list[float] | None,
255
+ return_tensors: str | TensorType | None,
256
+ crop_to_patches: bool = False,
257
+ min_patches: int = 1,
258
+ max_patches: int = 12,
259
+ use_covering_area_grid: bool = True,
260
+ **kwargs,
261
+ ) -> BatchFeature:
262
+ if crop_to_patches and max_patches > 1:
263
+ # Crop to patches first
264
+ processed_images = []
265
+ grids = []
266
+ for image in images:
267
+ patches, grid = self.crop_image_to_patches(
268
+ image,
269
+ min_patches,
270
+ max_patches,
271
+ patch_size=size,
272
+ use_covering_area_grid=use_covering_area_grid,
273
+ resample=resample,
274
+ )
275
+ processed_images.extend(patches)
276
+ grids.append(grid)
277
+ images = processed_images
278
+ else:
279
+ grids = [[1, 1] for _ in range(len(images))]
280
+
281
+ # Process all images (including patches if any) through the standard pipeline
282
+ processed_images = []
283
+ for image in images:
284
+ if do_resize:
285
+ image = self.resize(image, size=size, resample=resample)
286
+ if do_center_crop:
287
+ image = self.center_crop(image, crop_size)
288
+ if do_rescale:
289
+ image = self.rescale(image, rescale_factor)
290
+ if do_normalize:
291
+ image = self.normalize(image, image_mean, image_std)
292
+ processed_images.append(image)
293
+
294
+ return BatchFeature(data={"pixel_values": processed_images, "grids": grids}, tensor_type=return_tensors)
295
+
296
+
297
+ __all__ = ["Ovis2ImageProcessorPil"]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/modular_ovis2.py ADDED
@@ -0,0 +1,448 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2025 The HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import math
16
+ from dataclasses import dataclass
17
+
18
+ import torch
19
+ from torch import nn
20
+
21
+ from ... import initialization as init
22
+ from ...cache_utils import Cache
23
+ from ...generation import GenerationMixin
24
+ from ...modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
25
+ from ...modeling_utils import PreTrainedModel
26
+ from ...processing_utils import Unpack
27
+ from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
28
+ from ...utils.generic import merge_with_config_defaults
29
+ from ...utils.output_capturing import capture_outputs
30
+ from ..aimv2.modeling_aimv2 import Aimv2Attention, Aimv2EncoderLayer
31
+ from ..auto import AutoModel
32
+ from ..llama.modeling_llama import LlamaMLP, LlamaRMSNorm
33
+ from ..llava.modeling_llava import LlavaForConditionalGeneration, LlavaModel
34
+ from ..llava_next.modeling_llava_next import LlavaNextCausalLMOutputWithPast, LlavaNextModelOutputWithPast
35
+ from ..siglip.modeling_siglip import SiglipEncoder, SiglipVisionEmbeddings
36
+ from .configuration_ovis2 import Ovis2Config, Ovis2VisionConfig
37
+
38
+
39
+ def hard_softmax(logits: torch.Tensor, dim: int):
40
+ y_soft = logits.softmax(dim)
41
+ # Straight through.
42
+ index = y_soft.max(dim, keepdim=True)[1]
43
+ y_hard = torch.zeros_like(logits, memory_format=torch.legacy_contiguous_format).scatter_(dim, index, 1.0)
44
+ ret = y_hard - y_soft.detach() + y_soft
45
+
46
+ return ret
47
+
48
+
49
+ @auto_docstring
50
+ @dataclass
51
+ class BaseModelOutputWithVisualIndicatorFeatures(BaseModelOutputWithPooling):
52
+ r"""
53
+ visual_indicator_features (`torch.FloatTensor` of shape `(batch_size, visual_indicator_size)`):
54
+ Visual indicator features extracted from the model, which can be used for auxiliary tasks or further processing.
55
+ """
56
+
57
+ visual_indicator_features: torch.FloatTensor | None = None
58
+
59
+
60
+ class Ovis2ModelOutputWithPast(LlavaNextModelOutputWithPast):
61
+ pass
62
+
63
+
64
+ class Ovis2CausalLMOutputWithPast(LlavaNextCausalLMOutputWithPast):
65
+ pass
66
+
67
+
68
+ class Ovis2RMSNorm(LlamaRMSNorm):
69
+ pass
70
+
71
+
72
+ class Ovis2VisionMLP(LlamaMLP):
73
+ pass
74
+
75
+
76
+ class Ovis2VisionEmbeddings(SiglipVisionEmbeddings):
77
+ def __init__(self, config: Ovis2VisionConfig):
78
+ super().__init__(config)
79
+ self.rms_norm = Ovis2RMSNorm(config.hidden_size, config.rms_norm_eps)
80
+
81
+ def interpolate_pos_encoding(self):
82
+ raise NotImplementedError("Not needed for Ovis2")
83
+
84
+ def forward(self, pixel_values: torch.FloatTensor) -> torch.Tensor:
85
+ target_dtype = self.patch_embedding.weight.dtype
86
+ patch_embeds = self.patch_embedding(pixel_values.to(dtype=target_dtype))
87
+ embeddings = patch_embeds.flatten(2).transpose(1, 2)
88
+ embeddings = self.rms_norm(embeddings)
89
+
90
+ embeddings = embeddings + self.position_embedding(self.position_ids)
91
+
92
+ return embeddings
93
+
94
+
95
+ class Ovis2VisionAttention(Aimv2Attention):
96
+ pass
97
+
98
+
99
+ class Ovis2VisionEncoderLayer(Aimv2EncoderLayer):
100
+ def __init__(self, config: Ovis2VisionConfig):
101
+ super().__init__()
102
+ self.attention = Ovis2VisionAttention(config)
103
+
104
+
105
+ class Ovis2VisionEncoder(SiglipEncoder):
106
+ def __init__(self, config: Ovis2VisionConfig):
107
+ super().__init__(config)
108
+ self.layers = nn.ModuleList([Ovis2VisionEncoderLayer(config) for _ in range(config.num_hidden_layers)])
109
+
110
+ @can_return_tuple
111
+ @auto_docstring
112
+ def forward(
113
+ self,
114
+ inputs_embeds,
115
+ attention_mask: torch.Tensor | None = None,
116
+ **kwargs: Unpack[TransformersKwargs],
117
+ ) -> BaseModelOutput:
118
+ hidden_states = inputs_embeds
119
+ for encoder_layer in self.layers:
120
+ hidden_states = encoder_layer(hidden_states, attention_mask, **kwargs)
121
+
122
+ return BaseModelOutput(last_hidden_state=hidden_states)
123
+
124
+
125
+ class Ovis2VisionTransformer(nn.Module):
126
+ def __init__(self, config: Ovis2VisionConfig):
127
+ super().__init__()
128
+ self.config = config
129
+ self.embeddings = Ovis2VisionEmbeddings(config)
130
+ self.encoder = Ovis2VisionEncoder(config)
131
+ self.rms_norm = Ovis2RMSNorm(config.hidden_size, config.rms_norm_eps)
132
+ self.gradient_checkpointing = False
133
+
134
+ @can_return_tuple
135
+ def forward(
136
+ self,
137
+ pixel_values,
138
+ attention_mask: torch.Tensor | None = None,
139
+ **kwargs,
140
+ ):
141
+ hidden_states = self.embeddings(pixel_values)
142
+
143
+ encoder_outputs: BaseModelOutput = self.encoder(
144
+ inputs_embeds=hidden_states,
145
+ attention_mask=attention_mask,
146
+ **kwargs,
147
+ )
148
+
149
+ last_hidden_state = encoder_outputs.last_hidden_state
150
+ last_hidden_state = self.rms_norm(last_hidden_state)
151
+
152
+ return BaseModelOutput(last_hidden_state=last_hidden_state)
153
+
154
+
155
+ class Ovis2VisualEmbeddingTable(nn.Embedding):
156
+ def forward(self, visual_tokens: torch.Tensor) -> torch.Tensor:
157
+ if visual_tokens.dtype in [torch.int8, torch.int16, torch.int32, torch.int64, torch.long]:
158
+ return super().forward(visual_tokens)
159
+ return torch.matmul(visual_tokens, self.weight)
160
+
161
+
162
+ class Ovis2PreTrainedModel(PreTrainedModel):
163
+ config: Ovis2Config
164
+ base_model_prefix = "model"
165
+ input_modalities = ("image", "text")
166
+ supports_gradient_checkpointing = True
167
+ _no_split_modules = ["Ovis2VisionAttention"]
168
+ _skip_keys_device_placement = ["past_key_values"]
169
+ _supports_cache_class = True
170
+ _supports_flash_attn = True
171
+ _supports_flex_attn = True
172
+ _supports_sdpa = True
173
+
174
+ _can_compile_fullgraph = True
175
+ _supports_attention_backend = True
176
+
177
+ def _init_weights(self, module):
178
+ super()._init_weights(module)
179
+ if isinstance(module, Ovis2VisionEmbeddings):
180
+ init.copy_(module.position_ids, torch.arange(module.position_ids.shape[-1]).expand((1, -1)))
181
+
182
+
183
+ class Ovis2VisionModel(Ovis2PreTrainedModel):
184
+ config: Ovis2VisionConfig
185
+ _can_record_outputs = {
186
+ "hidden_states": Ovis2VisionEncoderLayer,
187
+ "attentions": Ovis2VisionAttention,
188
+ }
189
+
190
+ def __init__(self, config: Ovis2VisionConfig):
191
+ super().__init__(config)
192
+ self.config = config
193
+ self.transformer = Ovis2VisionTransformer(config)
194
+ self.num_visual_indicator_tokens = config.num_visual_indicator_tokens
195
+ self.vocab_size = config.vocab_size
196
+ self.head_linear = nn.Linear(
197
+ config.hidden_size * config.hidden_stride * config.hidden_stride,
198
+ self.vocab_size - self.num_visual_indicator_tokens,
199
+ bias=False,
200
+ )
201
+ self.head_norm = nn.LayerNorm(self.vocab_size - self.num_visual_indicator_tokens)
202
+
203
+ self.post_init()
204
+
205
+ @merge_with_config_defaults
206
+ @capture_outputs
207
+ def forward(
208
+ self, pixel_values: torch.FloatTensor, **kwargs: Unpack[TransformersKwargs]
209
+ ) -> tuple | BaseModelOutputWithVisualIndicatorFeatures:
210
+ outputs = self.transformer(pixel_values, **kwargs)
211
+ last_hidden_state = outputs[0]
212
+ if self.config.hidden_stride > 1:
213
+ num_images, seq_len, hidden_dim = last_hidden_state.shape
214
+ hidden_stride = self.config.hidden_stride
215
+
216
+ sqrt_l = int(math.sqrt(seq_len))
217
+ if sqrt_l * sqrt_l != seq_len:
218
+ raise ValueError("Token sequence length must be a perfect square")
219
+
220
+ pad_size = (hidden_stride - (sqrt_l % hidden_stride)) % hidden_stride
221
+ last_hidden_state = nn.functional.pad(last_hidden_state, (0, 0, 0, pad_size, 0, pad_size), "constant", 0)
222
+ sqrt_l += pad_size
223
+
224
+ last_hidden_state = last_hidden_state.reshape(
225
+ num_images, sqrt_l // hidden_stride, hidden_stride, sqrt_l // hidden_stride, hidden_stride, hidden_dim
226
+ )
227
+ last_hidden_state = last_hidden_state.permute(0, 1, 3, 2, 4, 5)
228
+ last_hidden_state = last_hidden_state.reshape(
229
+ num_images, -1, hidden_stride * hidden_stride * hidden_dim
230
+ ) # (n, (sqrt_l//hs)^2, hs^2*d)
231
+
232
+ logits = self.head_linear(last_hidden_state)
233
+ logits = self.head_norm(logits)
234
+
235
+ if self.config.tokenize_function == "gumbel_argmax":
236
+ prob_token = nn.functional.gumbel_softmax(logits, dim=-1, hard=True)
237
+ elif self.config.tokenize_function == "st_argmax":
238
+ prob_token = hard_softmax(logits, dim=-1)
239
+ elif self.config.tokenize_function == "softmax":
240
+ prob_token = nn.functional.softmax(logits, dim=-1)
241
+
242
+ return BaseModelOutputWithVisualIndicatorFeatures(
243
+ last_hidden_state=last_hidden_state,
244
+ pooler_output=prob_token,
245
+ )
246
+
247
+
248
+ class Ovis2Model(LlavaModel):
249
+ def __init__(self, config: Ovis2Config):
250
+ super().__init__(config)
251
+ self.vision_tower = Ovis2VisionModel(config.vision_config)
252
+ self.visual_embeddings_table = Ovis2VisualEmbeddingTable(config.vision_config.vocab_size, config.hidden_size)
253
+
254
+ self.visual_vocab_size = config.vision_config.vocab_size
255
+ self.vocab_size = config.vocab_size
256
+ self.visual_indicator_token_ids = config.visual_indicator_token_ids
257
+ self.language_model = AutoModel.from_config(config.text_config)
258
+ del self.multi_modal_projector
259
+
260
+ @can_return_tuple
261
+ @auto_docstring(
262
+ custom_intro="Obtains image last hidden states from the vision tower and apply multimodal projection."
263
+ )
264
+ def get_image_features(
265
+ self,
266
+ pixel_values: torch.FloatTensor,
267
+ **kwargs: Unpack[TransformersKwargs],
268
+ ) -> tuple | BaseModelOutputWithVisualIndicatorFeatures:
269
+ image_outputs = self.vision_tower(pixel_values, return_dict=True, **kwargs)
270
+ image_features = image_outputs.pooler_output
271
+ batch_size, img_seq_len, _ = image_features.shape
272
+ padding_tensor = torch.zeros(
273
+ (batch_size, img_seq_len, self.vision_tower.num_visual_indicator_tokens),
274
+ dtype=image_features.dtype,
275
+ device=image_features.device,
276
+ requires_grad=False,
277
+ layout=image_features.layout,
278
+ )
279
+ image_features = torch.cat([image_features, padding_tensor], dim=2)
280
+ image_features = self.visual_embeddings_table(image_features)
281
+
282
+ visual_indicator = torch.arange(
283
+ self.visual_vocab_size - self.vision_tower.num_visual_indicator_tokens,
284
+ self.visual_vocab_size,
285
+ dtype=torch.long,
286
+ ).to(image_features.device)
287
+ image_outputs.pooler_output = image_features
288
+ image_outputs.visual_indicator_features = self.visual_embeddings_table(visual_indicator)
289
+
290
+ return image_outputs
291
+
292
+ @can_return_tuple
293
+ @auto_docstring
294
+ def forward(
295
+ self,
296
+ input_ids: torch.LongTensor | None = None,
297
+ pixel_values: torch.FloatTensor | None = None,
298
+ attention_mask: torch.Tensor | None = None,
299
+ position_ids: torch.LongTensor | None = None,
300
+ past_key_values: Cache | None = None,
301
+ inputs_embeds: torch.FloatTensor | None = None,
302
+ labels: torch.LongTensor | None = None,
303
+ use_cache: bool | None = None,
304
+ logits_to_keep: int | torch.Tensor = 0,
305
+ **kwargs,
306
+ ) -> tuple | Ovis2ModelOutputWithPast:
307
+ if (input_ids is None) ^ (inputs_embeds is not None):
308
+ raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
309
+
310
+ if inputs_embeds is None:
311
+ inputs_embeds = self.get_input_embeddings()(input_ids)
312
+
313
+ if pixel_values is not None:
314
+ image_outputs = self.get_image_features(pixel_values=pixel_values, return_dict=True)
315
+ image_features = image_outputs.pooler_output
316
+ visual_indicator_features = image_outputs.visual_indicator_features
317
+
318
+ special_image_mask = self.get_placeholder_mask(
319
+ input_ids,
320
+ inputs_embeds=inputs_embeds,
321
+ image_features=image_features,
322
+ )
323
+ inputs_embeds = inputs_embeds.masked_scatter(special_image_mask, image_features)
324
+
325
+ for i, visual_indicator_id in enumerate(self.visual_indicator_token_ids):
326
+ if input_ids is None:
327
+ mask = inputs_embeds == self.get_input_embeddings()(
328
+ torch.tensor(visual_indicator_id, dtype=torch.long, device=inputs_embeds.device)
329
+ )
330
+ mask = mask.all(-1)
331
+ else:
332
+ mask = (input_ids == visual_indicator_id).to(inputs_embeds.device)
333
+
334
+ if mask.any():
335
+ inputs_embeds[mask] = (
336
+ visual_indicator_features[i]
337
+ .expand_as(inputs_embeds[mask])
338
+ .to(inputs_embeds.device, inputs_embeds.dtype)
339
+ )
340
+
341
+ outputs = self.language_model(
342
+ attention_mask=attention_mask,
343
+ position_ids=position_ids,
344
+ past_key_values=past_key_values,
345
+ inputs_embeds=inputs_embeds,
346
+ use_cache=use_cache,
347
+ logits_to_keep=logits_to_keep,
348
+ **kwargs,
349
+ )
350
+
351
+ return Ovis2ModelOutputWithPast(
352
+ last_hidden_state=outputs.last_hidden_state,
353
+ past_key_values=outputs.past_key_values,
354
+ hidden_states=outputs.hidden_states,
355
+ attentions=outputs.attentions,
356
+ image_hidden_states=image_features if pixel_values is not None else None,
357
+ )
358
+
359
+
360
+ @auto_docstring
361
+ class Ovis2ForConditionalGeneration(LlavaForConditionalGeneration, GenerationMixin):
362
+ def __init__(self, config: Ovis2Config):
363
+ super().__init__(config)
364
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=False)
365
+
366
+ @auto_docstring
367
+ def get_image_features(
368
+ self, pixel_values: torch.FloatTensor, **kwargs: Unpack[TransformersKwargs]
369
+ ) -> tuple | BaseModelOutputWithVisualIndicatorFeatures:
370
+ return self.model.get_image_features(pixel_values=pixel_values, **kwargs)
371
+
372
+ @can_return_tuple
373
+ @auto_docstring
374
+ def forward(
375
+ self,
376
+ input_ids: torch.LongTensor | None = None,
377
+ pixel_values: torch.FloatTensor | None = None,
378
+ attention_mask: torch.Tensor | None = None,
379
+ position_ids: torch.LongTensor | None = None,
380
+ past_key_values: Cache | None = None,
381
+ inputs_embeds: torch.FloatTensor | None = None,
382
+ labels: torch.LongTensor | None = None,
383
+ use_cache: bool | None = None,
384
+ logits_to_keep: int | torch.Tensor = 0,
385
+ **kwargs,
386
+ ) -> tuple | Ovis2CausalLMOutputWithPast:
387
+ r"""
388
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
389
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
390
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
391
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
392
+
393
+ Example:
394
+
395
+ ```python
396
+ >>> from PIL import Image
397
+ >>> import httpx
398
+ >>> from io import BytesIO
399
+ >>> from transformers import AutoProcessor, Ovis2ForConditionalGeneration
400
+
401
+ >>> model = Ovis2ForConditionalGeneration.from_pretrained("thisisiron/Ovis2-2B-hf")
402
+ >>> processor = AutoProcessor.from_pretrained("thisisiron/Ovis2-2B-hf")
403
+
404
+ >>> prompt = "<|im_start|>user\n<image>\nDescribe the image.<|im_end|>\n<|im_start|>assistant\n"
405
+ >>> url = "http://images.cocodataset.org/val2014/COCO_val2014_000000537955.jpg"
406
+ >>> with httpx.stream("GET", url) as response:
407
+ ... image = Image.open(BytesIO(response.read()))
408
+
409
+ >>> inputs = processor(images=image, text=prompt, return_tensors="pt")
410
+
411
+ >>> # Generate
412
+ >>> generate_ids = model.generate(**inputs, max_new_tokens=15)
413
+ >>> processor.batch_decode(generate_ids, skip_special_tokens=True)[0]
414
+ "user\n\nDescribe the image.\nassistant\nThe image features a brown dog standing on a wooden floor, looking up with"
415
+ ```"""
416
+ outputs = self.model(
417
+ input_ids=input_ids,
418
+ pixel_values=pixel_values,
419
+ attention_mask=attention_mask,
420
+ position_ids=position_ids,
421
+ past_key_values=past_key_values,
422
+ inputs_embeds=inputs_embeds,
423
+ use_cache=use_cache,
424
+ **kwargs,
425
+ )
426
+
427
+ hidden_states = outputs[0]
428
+ # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
429
+ slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
430
+ logits = self.lm_head(hidden_states[:, slice_indices, :])
431
+
432
+ loss = None
433
+ if labels is not None:
434
+ loss = self.loss_function(
435
+ logits=logits, labels=labels, vocab_size=self.config.text_config.vocab_size, **kwargs
436
+ )
437
+
438
+ return Ovis2CausalLMOutputWithPast(
439
+ loss=loss,
440
+ logits=logits,
441
+ past_key_values=outputs.past_key_values,
442
+ hidden_states=outputs.hidden_states,
443
+ attentions=outputs.attentions,
444
+ image_hidden_states=outputs.image_hidden_states,
445
+ )
446
+
447
+
448
+ __all__ = ["Ovis2PreTrainedModel", "Ovis2Model", "Ovis2ForConditionalGeneration"]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ovis2/processing_ovis2.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2025 The HuggingFace Inc. team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ from ...feature_extraction_utils import BatchFeature
17
+ from ...image_utils import ImageInput
18
+ from ...processing_utils import ProcessingKwargs, ProcessorMixin, Unpack
19
+ from ...tokenization_utils_base import PreTokenizedInput, TextInput
20
+ from ...utils import auto_docstring, logging
21
+
22
+
23
+ logger = logging.get_logger(__name__)
24
+
25
+
26
+ class Ovis2ProcessorKwargs(ProcessingKwargs, total=False):
27
+ _defaults = {
28
+ "text_kwargs": {
29
+ "padding": False,
30
+ },
31
+ "image_kwargs": {},
32
+ }
33
+
34
+
35
+ @auto_docstring
36
+ class Ovis2Processor(ProcessorMixin):
37
+ def __init__(
38
+ self,
39
+ image_processor=None,
40
+ tokenizer=None,
41
+ chat_template=None,
42
+ image_token="<image>",
43
+ image_seq_length=256,
44
+ **kwargs,
45
+ ):
46
+ r"""
47
+ image_token (`str`, *optional*, defaults to `"<image>"`):
48
+ Special token used to denote image location.
49
+ image_seq_length (`int`, *optional*, defaults to 256):
50
+ The number of image tokens to be used for each image in the input.
51
+ """
52
+ self.image_seq_length = image_seq_length
53
+ self.image_token = tokenizer.image_token if hasattr(tokenizer, "image_token") else image_token
54
+ self.image_token_id = (
55
+ tokenizer.image_token_id
56
+ if getattr(tokenizer, "image_token_id", None)
57
+ else tokenizer.convert_tokens_to_ids(self.image_token)
58
+ )
59
+ super().__init__(image_processor, tokenizer, chat_template=chat_template, **kwargs)
60
+
61
+ @auto_docstring
62
+ def __call__(
63
+ self,
64
+ images: ImageInput | None = None,
65
+ text: TextInput | PreTokenizedInput | list[TextInput] | list[PreTokenizedInput] = None,
66
+ **kwargs: Unpack[Ovis2ProcessorKwargs],
67
+ ) -> BatchFeature:
68
+ r"""
69
+ Returns:
70
+ [`BatchFeature`]: A [`BatchFeature`] with the following fields:
71
+
72
+ - **input_ids** -- List of token ids to be fed to a model. Returned when `text` is not `None`.
73
+ - **attention_mask** -- List of indices specifying which tokens should be attended to by the model (when
74
+ `return_attention_mask=True` or if *"attention_mask"* is in `self.model_input_names` and if `text` is not
75
+ `None`).
76
+ - **pixel_values** -- Pixel values to be fed to a model. Returned when `images` is not `None`.
77
+ - **image_sizes** -- Size of each image that will be used to unpad an image. Returned when `images` is not `None`.
78
+ """
79
+
80
+ output_kwargs = self._merge_kwargs(
81
+ Ovis2ProcessorKwargs,
82
+ tokenizer_init_kwargs=self.tokenizer.init_kwargs,
83
+ **kwargs,
84
+ )
85
+
86
+ if isinstance(text, str):
87
+ text = [text]
88
+ elif not isinstance(text, list) and not isinstance(text[0], str):
89
+ raise TypeError("Invalid input text. Please provide a string, or a list of strings")
90
+
91
+ image_inputs = {}
92
+
93
+ if images is not None:
94
+ image_inputs = self.image_processor(images, **output_kwargs["images_kwargs"])
95
+ image_grids = image_inputs.pop("grids").tolist()
96
+ text = self._expand_image_tokens(text, image_grids)
97
+
98
+ text_inputs = self.tokenizer(text, **output_kwargs["text_kwargs"])
99
+ return BatchFeature(data={**text_inputs, **image_inputs})
100
+
101
+ def _expand_image_tokens(
102
+ self,
103
+ text: list[TextInput],
104
+ grids: list[list[int]],
105
+ ):
106
+ processed_text = []
107
+ grid_index = 0
108
+ for sample in text:
109
+ while "<image>" in sample:
110
+ grid = grids[grid_index]
111
+ row, col = grid[0], grid[1]
112
+ placeholder = f"<IMG_START>{'<IMG_ATOM>' * self.image_seq_length}<IMG_GRID>"
113
+ if row * col > 1:
114
+ for r in range(row):
115
+ for c in range(col):
116
+ placeholder += f"{'<IMG_ATOM>' * self.image_seq_length}"
117
+ if c < col - 1:
118
+ placeholder += "<IMG_COL>"
119
+ if r < row - 1:
120
+ placeholder += "<IMG_ROW>"
121
+ placeholder += "<IMG_END>"
122
+
123
+ sample = sample.replace("<image>", placeholder, 1)
124
+ grid_index += 1
125
+ processed_text.append(sample)
126
+ return processed_text
127
+
128
+ def batch_decode(self, *args, **kwargs):
129
+ """
130
+ This method forwards all its arguments to Qwen2TokenizerFast's [`~PreTrainedTokenizer.batch_decode`]. Please
131
+ refer to the docstring of this method for more information.
132
+ """
133
+ return self.tokenizer.batch_decode(*args, **kwargs)
134
+
135
+ def decode(self, *args, **kwargs):
136
+ """
137
+ This method forwards all its arguments to Qwen2TokenizerFast's [`~PreTrainedTokenizer.decode`]. Please refer to
138
+ the docstring of this method for more information.
139
+ """
140
+ return self.tokenizer.decode(*args, **kwargs)
141
+
142
+ @property
143
+ def model_input_names(self):
144
+ tokenizer_input_names = self.tokenizer.model_input_names
145
+ image_processor_input_names = self.image_processor.model_input_names
146
+ return list(tokenizer_input_names) + list(image_processor_input_names)
147
+
148
+
149
+ __all__ = ["Ovis2Processor"]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/timesformer/__init__.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ from typing import TYPE_CHECKING
15
+
16
+ from ...utils import _LazyModule
17
+ from ...utils.import_utils import define_import_structure
18
+
19
+
20
+ if TYPE_CHECKING:
21
+ from .configuration_timesformer import *
22
+ from .modeling_timesformer import *
23
+ else:
24
+ import sys
25
+
26
+ _file = globals()["__file__"]
27
+ sys.modules[__name__] = _LazyModule(__name__, _file, define_import_structure(_file), module_spec=__spec__)