JinghuiLuAstronaut commited on
Commit
5b741e2
·
verified ·
1 Parent(s): 448dcc3

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. LTA_openwebtext_dualt/logs/rollout_smoke/lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_20260513_143811.log +245 -0
  2. LTA_openwebtext_dualt/logs/rollout_smoke/lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_zeroanchor_20260513_145605.log +119 -0
  3. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/numpy/array_api/tests/test_creation_functions.py +142 -0
  4. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/numpy/array_api/tests/test_data_type_functions.py +31 -0
  5. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/numpy/array_api/tests/test_indexing_functions.py +24 -0
  6. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/numpy/array_api/tests/test_validation.py +27 -0
  7. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/depth_anything/modeling_depth_anything.py +416 -0
  8. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/vits/tokenization_vits.py +248 -0
  9. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_003000.pt +3 -0
  10. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_028000.pt +3 -0
  11. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_095000.pt +3 -0
  12. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_191000.pt +3 -0
  13. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_001000.pt +3 -0
  14. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_017000.pt +3 -0
  15. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_038000.pt +3 -0
  16. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_137000.pt +3 -0
  17. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_203000.pt +3 -0
  18. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_294000.pt +3 -0
  19. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_452000.pt +3 -0
  20. LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_486000.pt +3 -0
LTA_openwebtext_dualt/logs/rollout_smoke/lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_20260513_143811.log ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [launch] method=owt_categorical_fullvocab_c1024_fullycoupled host=di-20260411014000-djqhq time=2026-05-13T14:38:11+00:00
2
+ [launch] cwd=/e2e-data/evad-tech-vla/wanghan58/workspace/LTA_openwebtext_dualt
3
+ [launch] run_name=lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_20260513_143811
4
+ [launch] save_dir=runs/lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_20260513_143811
5
+ [launch] log_file=logs/lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_20260513_143811.log
6
+ [launch] data_path=/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext
7
+ [launch] tokenizer=/e2e-data/evad-tech-vla/wanghan58/models/flowtext_scorers/gpt2-standard/tokenizer.json
8
+ [launch] split=train_minus_100k text_column=text
9
+ [launch] owt_cached_chunks=1 cache_dir=/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext_lta_cached_chunks/gpt2_len1024_train_minus_100k
10
+ [launch] nproc_per_node=4 global_batch_size=8 per_gpu_batch_size=2
11
+ [launch] model d_model=768 n_layers=12 n_heads=12 dim_ff=3072 dropout=0.0
12
+ [launch] optimizer=adamw lr=6e-4 wd=0.1 ema=0.0
13
+ [launch] rollout_train prob=0.5 steps=1 infer_steps=64 temp=1.45 max_gamma=1.0 corrupt_only=1
14
+ [launch] perf allow_tf32=1 activation_checkpointing=0 checkpoint_interval=1 prefetch=2
15
+ NCCL version 2.25.1+cuda12.8
16
+ {
17
+ "device": "cuda:0",
18
+ "rank": 0,
19
+ "world_size": 4,
20
+ "samples": "owt_cached_chunks:8734897",
21
+ "vocab_size": 50257,
22
+ "tokenizer_vocab_size": 50257,
23
+ "save_dir": "runs/lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_20260513_143811",
24
+ "batch_size": 2,
25
+ "grad_accum": 1,
26
+ "effective_batch_size": 8,
27
+ "global_batch_size": 8,
28
+ "lr_schedule": "cosine",
29
+ "optimizer": "adamw",
30
+ "warmup_steps": 1,
31
+ "min_lr": 6e-05,
32
+ "weight_decay": 0.1,
33
+ "adamw_param_groups": "nanogpt",
34
+ "adam_beta1": 0.9,
35
+ "adam_beta2": 0.95,
36
+ "adam_eps": 1e-08,
37
+ "muon_momentum": 0.95,
38
+ "muon_ns_steps": 5,
39
+ "muon_update_scale": 1.0,
40
+ "ema_decay": 0.0,
41
+ "ema_start_step": 0,
42
+ "model_type": "ddit",
43
+ "dual_t": true,
44
+ "corrupt_t_mode": "same",
45
+ "corrupt_min_t": 0.0,
46
+ "corrupt_max_t": 1.0,
47
+ "prefix_block_prob": 0.0,
48
+ "prefix_block_len": 128,
49
+ "dirichlet_endpoint_mode": "categorical_dual_t",
50
+ "dirichlet_semantic_t_mode": "same",
51
+ "dirichlet_semantic_t_value": 0.0,
52
+ "categorical_wrong_from_full_vocab": true,
53
+ "categorical_wrong_from_batch_valid_tokens": false,
54
+ "mask_mixture_original_prob": 0.0,
55
+ "mask_mixture_lowk_prob": 0.0,
56
+ "mask_mixture_lowcorrupt_prob": 0.0,
57
+ "mask_mixture_block_prob": 0.0,
58
+ "mask_mixture_all_prob": 0.0,
59
+ "mask_mixture_lowk_clean_tokens": "1,2,4,8,16,32,64",
60
+ "mask_mixture_lowcorrupt_tokens": "1,2,4,8,16,32,64",
61
+ "mask_mixture_block_tokens": "64,128",
62
+ "simplex_bridge_sampler": "dirichlet",
63
+ "logistic_normal_sigma_min": 0.18,
64
+ "logistic_normal_sigma_max": 2.2,
65
+ "logistic_normal_tau_min": 0.65,
66
+ "logistic_normal_tau_max": 1.15,
67
+ "torch_compile": false,
68
+ "compile_mode": "max-autotune",
69
+ "state_format": "prob",
70
+ "target_loss": "hard_ce",
71
+ "meanflow_weight": 0.0,
72
+ "rollout_train_prob": 0.5,
73
+ "rollout_train_steps": 1,
74
+ "rollout_train_infer_steps": 64,
75
+ "rollout_train_temp": 1.45,
76
+ "rollout_train_max_gamma": 1.0,
77
+ "rollout_train_corrupt_only": true,
78
+ "bridge_noise_init": "logistic_normal",
79
+ "noise_sigma": -1.0,
80
+ "allow_tf32": true,
81
+ "activation_checkpointing": false,
82
+ "activation_checkpoint_interval": 1,
83
+ "ddp_static_graph": false,
84
+ "ddp_gradient_as_bucket_view": true,
85
+ "blocking_data_transfer": false,
86
+ "dataloader_prefetch_factor": 2,
87
+ "full_train_stats": false,
88
+ "record_pad_truncate": false,
89
+ "record_add_eos": false,
90
+ "record_add_special_tokens": false,
91
+ "record_pad_token": "pad",
92
+ "record_shuffle_buffer": 10000,
93
+ "wrap": true,
94
+ "wrap_mode": "stream",
95
+ "wrap_record_buffer_size": 200,
96
+ "owt_cached_chunks": true,
97
+ "owt_chunk_cache_dir": "/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext_lta_cached_chunks/gpt2_len1024_train_minus_100k",
98
+ "owt_chunk_cache_rebuild": false,
99
+ "owt_chunk_cache_write_batch": 4096,
100
+ "owt_exact_repeat_per_chunk": 0,
101
+ "online_chunk_shuffle": false,
102
+ "online_chunk_shuffle_buffer": 10000,
103
+ "openwebtext_split": "train_minus_100k",
104
+ "detokenizer": "auto",
105
+ "resolved_detokenizer": null,
106
+ "num_workers": 0,
107
+ "latest_every": 100000,
108
+ "resume_path": ""
109
+ }
110
+ step=1 micro_steps=1 elapsed=1.1s lr=6.000000e-04 acc_all=0.0005 acc_corrupt=0.0011 corrupt_frac=0.4424 loss_all=10.8125 loss_corrupt=10.8125 acc_corrupt_t_0p0_0p2=0.0015 corrupt_frac_t_0p0_0p2=0.7163 acc_corrupt_t_0p8_1p0=0.0000 corrupt_frac_t_0p8_1p0=0.2837 loss=10.8125 loss_recon=10.8125 loss_meanflow=0.0000 mean_model_t=0.5059 mean_corrupt_t=0.5059 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=1.0000 wrong_frac=0.6821 init_acc_corrupt=0.2815 init_gold_top10=0.3013 init_gold_top100=0.3918
111
+ [rank1]: Traceback (most recent call last):
112
+ [rank1]: File "/e2e-data/evad-tech-vla/wanghan58/workspace/LTA_openwebtext_dualt/train.py", line 1487, in <module>
113
+ [rank1]: main()
114
+ [rank1]: File "/e2e-data/evad-tech-vla/wanghan58/workspace/LTA_openwebtext_dualt/train.py", line 1372, in main
115
+ [rank1]: logits = trainable_model(loss_state, model_t, bridge.attn_mask)
116
+ [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117
+ [rank1]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
118
+ [rank1]: return self._call_impl(*args, **kwargs)
119
+ [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
120
+ [rank1]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1750, in _call_impl
121
+ [rank1]: return forward_call(*args, **kwargs)
122
+ [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
123
+ [rank1]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/parallel/distributed.py", line 1650, in forward
124
+ [rank1]: inputs, kwargs = self._pre_forward(*inputs, **kwargs)
125
+ [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
126
+ [rank1]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/parallel/distributed.py", line 1539, in _pre_forward
127
+ [rank1]: if torch.is_grad_enabled() and self.reducer._rebuild_buckets():
128
+ [rank1]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
129
+ [rank1]: RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by passing the keyword argument `find_unused_parameters=True` to `torch.nn.parallel.DistributedDataParallel`, and by
130
+ [rank1]: making sure all `forward` function outputs participate in calculating loss.
131
+ [rank1]: If you already have done the above, then the distributed data parallel module wasn't able to locate the output tensors in the return value of your module's `forward` function. Please include the loss function and the structure of the return value of `forward` of your module when reporting this issue (e.g. list, dict, iterable).
132
+ [rank1]: Parameter indices which did not receive grad for rank 1: 0 1 2 3 4 6 7 9 10 11 12 13 14 16 17 19 20 21 22 23 24 26 27 29 30 31 32 33 34 36 37 39 40 41 42 43 44 46 47 49 50 51 52 53 54 56 57 59 60 61 62 63 64 66 67 69 70 71 72 73 74 76 77 79 80 81 82 83 84 86 87 89 90 91 92 93 94 96 97 99 100 101 102 103 104 106 107 109 110 111 112 113 114 116 117 119 120 121 122 123 ...
133
+ [rank1]: In addition, you can set the environment variable TORCH_DISTRIBUTED_DEBUG to either INFO or DETAIL to print out information about which particular parameters did not receive gradient on this rank as part of this error
134
+ [rank0]: Traceback (most recent call last):
135
+ [rank0]: File "/e2e-data/evad-tech-vla/wanghan58/workspace/LTA_openwebtext_dualt/train.py", line 1487, in <module>
136
+ [rank0]: main()
137
+ [rank0]: File "/e2e-data/evad-tech-vla/wanghan58/workspace/LTA_openwebtext_dualt/train.py", line 1372, in main
138
+ [rank0]: logits = trainable_model(loss_state, model_t, bridge.attn_mask)
139
+ [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
140
+ [rank0]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
141
+ [rank0]: return self._call_impl(*args, **kwargs)
142
+ [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
143
+ [rank0]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1750, in _call_impl
144
+ [rank0]: return forward_call(*args, **kwargs)
145
+ [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
146
+ [rank0]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/parallel/distributed.py", line 1650, in forward
147
+ [rank0]: inputs, kwargs = self._pre_forward(*inputs, **kwargs)
148
+ [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
149
+ [rank0]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/parallel/distributed.py", line 1539, in _pre_forward
150
+ [rank0]: if torch.is_grad_enabled() and self.reducer._rebuild_buckets():
151
+ [rank0]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
152
+ [rank0]: RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by passing the keyword argument `find_unused_parameters=True` to `torch.nn.parallel.DistributedDataParallel`, and by
153
+ [rank0]: making sure all `forward` function outputs participate in calculating loss.
154
+ [rank0]: If you already have done the above, then the distributed data parallel module wasn't able to locate the output tensors in the return value of your module's `forward` function. Please include the loss function and the structure of the return value of `forward` of your module when reporting this issue (e.g. list, dict, iterable).
155
+ [rank0]: Parameter indices which did not receive grad for rank 0: 0 1 2 3 4 6 7 9 10 11 12 13 14 16 17 19 20 21 22 23 24 26 27 29 30 31 32 33 34 36 37 39 40 41 42 43 44 46 47 49 50 51 52 53 54 56 57 59 60 61 62 63 64 66 67 69 70 71 72 73 74 76 77 79 80 81 82 83 84 86 87 89 90 91 92 93 94 96 97 99 100 101 102 103 104 106 107 109 110 111 112 113 114 116 117 119 120 121 122 123 ...
156
+ [rank0]: In addition, you can set the environment variable TORCH_DISTRIBUTED_DEBUG to either INFO or DETAIL to print out information about which particular parameters did not receive gradient on this rank as part of this error
157
+ [rank3]: Traceback (most recent call last):
158
+ [rank3]: File "/e2e-data/evad-tech-vla/wanghan58/workspace/LTA_openwebtext_dualt/train.py", line 1487, in <module>
159
+ [rank3]: main()
160
+ [rank3]: File "/e2e-data/evad-tech-vla/wanghan58/workspace/LTA_openwebtext_dualt/train.py", line 1372, in main
161
+ [rank3]: logits = trainable_model(loss_state, model_t, bridge.attn_mask)
162
+ [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163
+ [rank3]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
164
+ [rank3]: return self._call_impl(*args, **kwargs)
165
+ [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
166
+ [rank3]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1750, in _call_impl
167
+ [rank3]: return forward_call(*args, **kwargs)
168
+ [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
169
+ [rank3]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/parallel/distributed.py", line 1650, in forward
170
+ [rank3]: inputs, kwargs = self._pre_forward(*inputs, **kwargs)
171
+ [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
172
+ [rank3]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/parallel/distributed.py", line 1539, in _pre_forward
173
+ [rank3]: if torch.is_grad_enabled() and self.reducer._rebuild_buckets():
174
+ [rank3]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
175
+ [rank3]: RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by passing the keyword argument `find_unused_parameters=True` to `torch.nn.parallel.DistributedDataParallel`, and by
176
+ [rank3]: making sure all `forward` function outputs participate in calculating loss.
177
+ [rank3]: If you already have done the above, then the distributed data parallel module wasn't able to locate the output tensors in the return value of your module's `forward` function. Please include the loss function and the structure of the return value of `forward` of your module when reporting this issue (e.g. list, dict, iterable).
178
+ [rank3]: Parameter indices which did not receive grad for rank 3: 0 1 2 3 4 6 7 9 10 11 12 13 14 16 17 19 20 21 22 23 24 26 27 29 30 31 32 33 34 36 37 39 40 41 42 43 44 46 47 49 50 51 52 53 54 56 57 59 60 61 62 63 64 66 67 69 70 71 72 73 74 76 77 79 80 81 82 83 84 86 87 89 90 91 92 93 94 96 97 99 100 101 102 103 104 106 107 109 110 111 112 113 114 116 117 119 120 121 122 123 ...
179
+ [rank3]: In addition, you can set the environment variable TORCH_DISTRIBUTED_DEBUG to either INFO or DETAIL to print out information about which particular parameters did not receive gradient on this rank as part of this error
180
+ [rank2]: Traceback (most recent call last):
181
+ [rank2]: File "/e2e-data/evad-tech-vla/wanghan58/workspace/LTA_openwebtext_dualt/train.py", line 1487, in <module>
182
+ [rank2]: main()
183
+ [rank2]: File "/e2e-data/evad-tech-vla/wanghan58/workspace/LTA_openwebtext_dualt/train.py", line 1372, in main
184
+ [rank2]: logits = trainable_model(loss_state, model_t, bridge.attn_mask)
185
+ [rank2]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
186
+ [rank2]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
187
+ [rank2]: return self._call_impl(*args, **kwargs)
188
+ [rank2]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
189
+ [rank2]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py", line 1750, in _call_impl
190
+ [rank2]: return forward_call(*args, **kwargs)
191
+ [rank2]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
192
+ [rank2]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/parallel/distributed.py", line 1650, in forward
193
+ [rank2]: inputs, kwargs = self._pre_forward(*inputs, **kwargs)
194
+ [rank2]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
195
+ [rank2]: File "/usr/local/lib/python3.12/dist-packages/torch/nn/parallel/distributed.py", line 1539, in _pre_forward
196
+ [rank2]: if torch.is_grad_enabled() and self.reducer._rebuild_buckets():
197
+ [rank2]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
198
+ [rank2]: RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates that your module has parameters that were not used in producing loss. You can enable unused parameter detection by passing the keyword argument `find_unused_parameters=True` to `torch.nn.parallel.DistributedDataParallel`, and by
199
+ [rank2]: making sure all `forward` function outputs participate in calculating loss.
200
+ [rank2]: If you already have done the above, then the distributed data parallel module wasn't able to locate the output tensors in the return value of your module's `forward` function. Please include the loss function and the structure of the return value of `forward` of your module when reporting this issue (e.g. list, dict, iterable).
201
+ [rank2]: Parameter indices which did not receive grad for rank 2: 0 1 2 3 4 6 7 9 10 11 12 13 14 16 17 19 20 21 22 23 24 26 27 29 30 31 32 33 34 36 37 39 40 41 42 43 44 46 47 49 50 51 52 53 54 56 57 59 60 61 62 63 64 66 67 69 70 71 72 73 74 76 77 79 80 81 82 83 84 86 87 89 90 91 92 93 94 96 97 99 100 101 102 103 104 106 107 109 110 111 112 113 114 116 117 119 120 121 122 123 ...
202
+ [rank2]: In addition, you can set the environment variable TORCH_DISTRIBUTED_DEBUG to either INFO or DETAIL to print out information about which particular parameters did not receive gradient on this rank as part of this error
203
+ [rank0]:[W513 14:38:19.182594534 ProcessGroupNCCL.cpp:1487] Warning: WARNING: destroy_process_group() was not called before program exit, which can leak resources. For more info, please see https://pytorch.org/docs/stable/distributed.html#shutdown (function operator())
204
+ W0513 14:38:20.047000 621905 torch/distributed/elastic/multiprocessing/api.py:898] Sending process 621911 closing signal SIGTERM
205
+ W0513 14:38:20.047000 621905 torch/distributed/elastic/multiprocessing/api.py:898] Sending process 621912 closing signal SIGTERM
206
+ E0513 14:38:20.262000 621905 torch/distributed/elastic/multiprocessing/api.py:870] failed (exitcode: 1) local_rank: 0 (pid: 621909) of binary: /usr/bin/python
207
+ Traceback (most recent call last):
208
+ File "<frozen runpy>", line 198, in _run_module_as_main
209
+ File "<frozen runpy>", line 88, in _run_code
210
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/run.py", line 922, in <module>
211
+ main()
212
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/elastic/multiprocessing/errors/__init__.py", line 355, in wrapper
213
+ return f(*args, **kwargs)
214
+ ^^^^^^^^^^^^^^^^^^
215
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/run.py", line 918, in main
216
+ run(args)
217
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/run.py", line 909, in run
218
+ elastic_launch(
219
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/launcher/api.py", line 139, in __call__
220
+ return launch_agent(self._config, self._entrypoint, list(args))
221
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
222
+ File "/usr/local/lib/python3.12/dist-packages/torch/distributed/launcher/api.py", line 270, in launch_agent
223
+ raise ChildFailedError(
224
+ torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
225
+ ============================================================
226
+ train.py FAILED
227
+ ------------------------------------------------------------
228
+ Failures:
229
+ [1]:
230
+ time : 2026-05-13_14:38:20
231
+ host : localhost
232
+ rank : 1 (local_rank: 1)
233
+ exitcode : 1 (pid: 621910)
234
+ error_file: <N/A>
235
+ traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
236
+ ------------------------------------------------------------
237
+ Root Cause (first observed failure):
238
+ [0]:
239
+ time : 2026-05-13_14:38:20
240
+ host : localhost
241
+ rank : 0 (local_rank: 0)
242
+ exitcode : 1 (pid: 621909)
243
+ error_file: <N/A>
244
+ traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
245
+ ============================================================
LTA_openwebtext_dualt/logs/rollout_smoke/lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_zeroanchor_20260513_145605.log ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [launch] method=owt_categorical_fullvocab_c1024_fullycoupled host=di-20260411014000-djqhq time=2026-05-13T14:56:05+00:00
2
+ [launch] cwd=/e2e-data/evad-tech-vla/wanghan58/workspace/LTA_openwebtext_dualt
3
+ [launch] run_name=lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_zeroanchor_20260513_145605
4
+ [launch] save_dir=runs/lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_zeroanchor_20260513_145605
5
+ [launch] log_file=logs/lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_zeroanchor_20260513_145605.log
6
+ [launch] data_path=/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext
7
+ [launch] tokenizer=/e2e-data/evad-tech-vla/wanghan58/models/flowtext_scorers/gpt2-standard/tokenizer.json
8
+ [launch] split=train_minus_100k text_column=text
9
+ [launch] owt_cached_chunks=1 cache_dir=/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext_lta_cached_chunks/gpt2_len1024_train_minus_100k
10
+ [launch] nproc_per_node=4 global_batch_size=8 per_gpu_batch_size=2
11
+ [launch] model d_model=768 n_layers=12 n_heads=12 dim_ff=3072 dropout=0.0
12
+ [launch] optimizer=adamw lr=6e-4 wd=0.1 ema=0.0
13
+ [launch] rollout_train prob=0.5 steps=1 infer_steps=64 temp=1.45 max_gamma=1.0 corrupt_only=1
14
+ [launch] perf allow_tf32=1 activation_checkpointing=0 checkpoint_interval=1 prefetch=2
15
+ NCCL version 2.25.1+cuda12.8
16
+ {
17
+ "device": "cuda:0",
18
+ "rank": 0,
19
+ "world_size": 4,
20
+ "samples": "owt_cached_chunks:8734897",
21
+ "vocab_size": 50257,
22
+ "tokenizer_vocab_size": 50257,
23
+ "save_dir": "runs/lta_owt_gpt2cached_len1024_rollout1_p05_smoke4gpu_zeroanchor_20260513_145605",
24
+ "batch_size": 2,
25
+ "grad_accum": 1,
26
+ "effective_batch_size": 8,
27
+ "global_batch_size": 8,
28
+ "lr_schedule": "cosine",
29
+ "optimizer": "adamw",
30
+ "warmup_steps": 1,
31
+ "min_lr": 6e-05,
32
+ "weight_decay": 0.1,
33
+ "adamw_param_groups": "nanogpt",
34
+ "adam_beta1": 0.9,
35
+ "adam_beta2": 0.95,
36
+ "adam_eps": 1e-08,
37
+ "muon_momentum": 0.95,
38
+ "muon_ns_steps": 5,
39
+ "muon_update_scale": 1.0,
40
+ "ema_decay": 0.0,
41
+ "ema_start_step": 0,
42
+ "model_type": "ddit",
43
+ "dual_t": true,
44
+ "corrupt_t_mode": "same",
45
+ "corrupt_min_t": 0.0,
46
+ "corrupt_max_t": 1.0,
47
+ "prefix_block_prob": 0.0,
48
+ "prefix_block_len": 128,
49
+ "dirichlet_endpoint_mode": "categorical_dual_t",
50
+ "dirichlet_semantic_t_mode": "same",
51
+ "dirichlet_semantic_t_value": 0.0,
52
+ "categorical_wrong_from_full_vocab": true,
53
+ "categorical_wrong_from_batch_valid_tokens": false,
54
+ "mask_mixture_original_prob": 0.0,
55
+ "mask_mixture_lowk_prob": 0.0,
56
+ "mask_mixture_lowcorrupt_prob": 0.0,
57
+ "mask_mixture_block_prob": 0.0,
58
+ "mask_mixture_all_prob": 0.0,
59
+ "mask_mixture_lowk_clean_tokens": "1,2,4,8,16,32,64",
60
+ "mask_mixture_lowcorrupt_tokens": "1,2,4,8,16,32,64",
61
+ "mask_mixture_block_tokens": "64,128",
62
+ "simplex_bridge_sampler": "dirichlet",
63
+ "logistic_normal_sigma_min": 0.18,
64
+ "logistic_normal_sigma_max": 2.2,
65
+ "logistic_normal_tau_min": 0.65,
66
+ "logistic_normal_tau_max": 1.15,
67
+ "torch_compile": false,
68
+ "compile_mode": "max-autotune",
69
+ "state_format": "prob",
70
+ "target_loss": "hard_ce",
71
+ "meanflow_weight": 0.0,
72
+ "rollout_train_prob": 0.5,
73
+ "rollout_train_steps": 1,
74
+ "rollout_train_infer_steps": 64,
75
+ "rollout_train_temp": 1.45,
76
+ "rollout_train_max_gamma": 1.0,
77
+ "rollout_train_corrupt_only": true,
78
+ "bridge_noise_init": "logistic_normal",
79
+ "noise_sigma": -1.0,
80
+ "allow_tf32": true,
81
+ "activation_checkpointing": false,
82
+ "activation_checkpoint_interval": 1,
83
+ "ddp_static_graph": false,
84
+ "ddp_gradient_as_bucket_view": true,
85
+ "blocking_data_transfer": false,
86
+ "dataloader_prefetch_factor": 2,
87
+ "full_train_stats": false,
88
+ "record_pad_truncate": false,
89
+ "record_add_eos": false,
90
+ "record_add_special_tokens": false,
91
+ "record_pad_token": "pad",
92
+ "record_shuffle_buffer": 10000,
93
+ "wrap": true,
94
+ "wrap_mode": "stream",
95
+ "wrap_record_buffer_size": 200,
96
+ "owt_cached_chunks": true,
97
+ "owt_chunk_cache_dir": "/e2e-data/evad-tech-vla/wanghan58/data/small_benchmarks/langflow_2604_11748/openwebtext_lta_cached_chunks/gpt2_len1024_train_minus_100k",
98
+ "owt_chunk_cache_rebuild": false,
99
+ "owt_chunk_cache_write_batch": 4096,
100
+ "owt_exact_repeat_per_chunk": 0,
101
+ "online_chunk_shuffle": false,
102
+ "online_chunk_shuffle_buffer": 10000,
103
+ "openwebtext_split": "train_minus_100k",
104
+ "detokenizer": "auto",
105
+ "resolved_detokenizer": null,
106
+ "num_workers": 0,
107
+ "latest_every": 100000,
108
+ "resume_path": ""
109
+ }
110
+ step=1 micro_steps=1 elapsed=1.3s lr=6.000000e-04 acc_all=0.0005 acc_corrupt=0.0011 corrupt_frac=0.4424 loss_all=10.8125 loss_corrupt=10.8125 acc_corrupt_t_0p0_0p2=0.0015 corrupt_frac_t_0p0_0p2=0.7163 acc_corrupt_t_0p8_1p0=0.0000 corrupt_frac_t_0p8_1p0=0.2837 loss=10.8125 loss_recon=10.8125 loss_meanflow=0.0000 mean_model_t=0.5059 mean_corrupt_t=0.5059 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=1.0000 wrong_frac=0.6821 init_acc_corrupt=0.2815 init_gold_top10=0.3013 init_gold_top100=0.3918
111
+ step=2 micro_steps=2 elapsed=0.1s lr=5.819078e-04 acc_all=0.0000 acc_corrupt=0.0000 corrupt_frac=0.3232 loss_all=10.8125 loss_corrupt=10.8125 acc_corrupt_t_0p0_0p2=0.0000 corrupt_frac_t_0p0_0p2=0.6178 acc_corrupt_t_0p6_0p8=0.0000 corrupt_frac_t_0p6_0p8=0.3822 loss=10.8125 loss_recon=10.8125 loss_meanflow=0.0000 mean_model_t=0.3631 mean_corrupt_t=0.3631 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 wrong_frac=0.7160 init_acc_corrupt=0.2795 init_gold_top10=0.2795 init_gold_top100=0.3429
112
+ step=3 micro_steps=3 elapsed=0.1s lr=5.298133e-04 acc_all=0.4302 acc_corrupt=0.3588 corrupt_frac=0.5811 loss_all=10.7038 loss_corrupt=10.7224 acc_corrupt_t_0p6_0p8=0.3588 corrupt_frac_t_0p6_0p8=1.0000 loss=10.7224 loss_recon=10.7224 loss_meanflow=0.0000 mean_model_t=0.7308 mean_corrupt_t=0.7308 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=1.0000 wrong_frac=0.2840 init_acc_corrupt=0.7160 init_gold_top10=0.7168 init_gold_top100=0.7168
113
+ step=4 micro_steps=4 elapsed=0.1s lr=4.500000e-04 acc_all=0.2832 acc_corrupt=0.2274 corrupt_frac=0.8008 loss_all=10.6833 loss_corrupt=10.7115 acc_corrupt_t_0p0_0p2=0.0106 corrupt_frac_t_0p0_0p2=0.4018 acc_corrupt_t_0p6_0p8=0.3731 corrupt_frac_t_0p6_0p8=0.5982 loss=10.7115 loss_recon=10.7115 loss_meanflow=0.0000 mean_model_t=0.4127 mean_corrupt_t=0.4127 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=1.0000 wrong_frac=0.5305 init_acc_corrupt=0.4433 init_gold_top10=0.4585 init_gold_top100=0.4799
114
+ step=5 micro_steps=5 elapsed=0.1s lr=3.520945e-04 acc_all=0.2959 acc_corrupt=0.1660 corrupt_frac=0.4707 loss_all=10.5903 loss_corrupt=10.6686 acc_corrupt_t_0p2_0p4=0.1038 corrupt_frac_t_0p2_0p4=0.5996 acc_corrupt_t_0p6_0p8=0.2591 corrupt_frac_t_0p6_0p8=0.4004 loss=10.6686 loss_recon=10.6686 loss_meanflow=0.0000 mean_model_t=0.4543 mean_corrupt_t=0.4543 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=1.0000 wrong_frac=0.5944 init_acc_corrupt=0.3402 init_gold_top10=0.4046 init_gold_top100=0.4253
115
+ step=6 micro_steps=6 elapsed=0.1s lr=2.479055e-04 acc_all=0.4238 acc_corrupt=0.0720 corrupt_frac=0.1968 loss_all=10.1890 loss_corrupt=10.3091 acc_corrupt_t_0p0_0p2=0.0648 corrupt_frac_t_0p0_0p2=0.7270 acc_corrupt_t_0p2_0p4=0.0909 corrupt_frac_t_0p2_0p4=0.2730 loss=10.3091 loss_recon=10.3091 loss_meanflow=0.0000 mean_model_t=0.1681 mean_corrupt_t=0.1681 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=1.0000 wrong_frac=0.8908 init_acc_corrupt=0.0471 init_gold_top10=0.0819 init_gold_top100=0.3722
116
+ step=7 micro_steps=7 elapsed=0.1s lr=1.500000e-04 acc_all=0.2603 acc_corrupt=0.2154 corrupt_frac=0.5190 loss_all=9.9921 loss_corrupt=10.0241 acc_corrupt_t_0p2_0p4=0.0707 corrupt_frac_t_0p2_0p4=0.3462 acc_corrupt_t_0p8_1p0=0.2921 corrupt_frac_t_0p8_1p0=0.6538 loss=10.0241 loss_recon=10.0241 loss_meanflow=0.0000 mean_model_t=0.5883 mean_corrupt_t=0.5883 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 wrong_frac=0.2926 init_acc_corrupt=0.6604 init_gold_top10=0.7065 init_gold_top100=0.7300
117
+ step=8 micro_steps=8 elapsed=0.1s lr=7.018667e-05 acc_all=0.1675 acc_corrupt=0.1367 corrupt_frac=0.7002 loss_all=9.9359 loss_corrupt=9.9788 acc_corrupt_t_0p4_0p6=0.0887 corrupt_frac_t_0p4_0p6=0.3222 acc_corrupt_t_0p6_0p8=0.1595 corrupt_frac_t_0p6_0p8=0.6778 loss=9.9788 loss_recon=9.9788 loss_meanflow=0.0000 mean_model_t=0.5913 mean_corrupt_t=0.5913 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 wrong_frac=0.3487 init_acc_corrupt=0.6471 init_gold_top10=0.6513 init_gold_top100=0.6520
118
+ step=9 micro_steps=9 elapsed=0.1s lr=6.000000e-05 acc_all=0.0732 acc_corrupt=0.0556 corrupt_frac=0.8696 loss_all=9.8117 loss_corrupt=9.8197 acc_corrupt_t_0p8_1p0=0.0556 corrupt_frac_t_0p8_1p0=1.0000 loss=9.8197 loss_recon=9.8197 loss_meanflow=0.0000 mean_model_t=0.9805 mean_corrupt_t=0.9805 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=1.0000 wrong_frac=0.0152 init_acc_corrupt=0.5368 init_gold_top10=0.6850 init_gold_top100=0.7468
119
+ step=10 micro_steps=10 elapsed=0.1s lr=6.000000e-05 acc_all=0.1436 acc_corrupt=0.0897 corrupt_frac=0.4189 loss_all=9.6189 loss_corrupt=9.6655 acc_corrupt_t_0p2_0p4=0.0786 corrupt_frac_t_0p2_0p4=0.5932 acc_corrupt_t_0p4_0p6=0.1060 corrupt_frac_t_0p4_0p6=0.4068 loss=9.6655 loss_recon=9.6655 loss_meanflow=0.0000 mean_model_t=0.3837 mean_corrupt_t=0.3837 mean_loss_t_weight=1.0000 prior_center_loss_beta=0.0000 rollout_train_applied=0.0000 wrong_frac=0.6049 init_acc_corrupt=0.3520 init_gold_top10=0.3951 init_gold_top100=0.3951
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/numpy/array_api/tests/test_creation_functions.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from numpy.testing import assert_raises
2
+ import numpy as np
3
+
4
+ from .. import all
5
+ from .._creation_functions import (
6
+ asarray,
7
+ arange,
8
+ empty,
9
+ empty_like,
10
+ eye,
11
+ full,
12
+ full_like,
13
+ linspace,
14
+ meshgrid,
15
+ ones,
16
+ ones_like,
17
+ zeros,
18
+ zeros_like,
19
+ )
20
+ from .._dtypes import float32, float64
21
+ from .._array_object import Array
22
+
23
+
24
+ def test_asarray_errors():
25
+ # Test various protections against incorrect usage
26
+ assert_raises(TypeError, lambda: Array([1]))
27
+ assert_raises(TypeError, lambda: asarray(["a"]))
28
+ assert_raises(ValueError, lambda: asarray([1.0], dtype=np.float16))
29
+ assert_raises(OverflowError, lambda: asarray(2**100))
30
+ # Preferably this would be OverflowError
31
+ # assert_raises(OverflowError, lambda: asarray([2**100]))
32
+ assert_raises(TypeError, lambda: asarray([2**100]))
33
+ asarray([1], device="cpu") # Doesn't error
34
+ assert_raises(ValueError, lambda: asarray([1], device="gpu"))
35
+
36
+ assert_raises(ValueError, lambda: asarray([1], dtype=int))
37
+ assert_raises(ValueError, lambda: asarray([1], dtype="i"))
38
+
39
+
40
+ def test_asarray_copy():
41
+ a = asarray([1])
42
+ b = asarray(a, copy=True)
43
+ a[0] = 0
44
+ assert all(b[0] == 1)
45
+ assert all(a[0] == 0)
46
+ a = asarray([1])
47
+ b = asarray(a, copy=np._CopyMode.ALWAYS)
48
+ a[0] = 0
49
+ assert all(b[0] == 1)
50
+ assert all(a[0] == 0)
51
+ a = asarray([1])
52
+ b = asarray(a, copy=np._CopyMode.NEVER)
53
+ a[0] = 0
54
+ assert all(b[0] == 0)
55
+ assert_raises(NotImplementedError, lambda: asarray(a, copy=False))
56
+ assert_raises(NotImplementedError,
57
+ lambda: asarray(a, copy=np._CopyMode.IF_NEEDED))
58
+
59
+
60
+ def test_arange_errors():
61
+ arange(1, device="cpu") # Doesn't error
62
+ assert_raises(ValueError, lambda: arange(1, device="gpu"))
63
+ assert_raises(ValueError, lambda: arange(1, dtype=int))
64
+ assert_raises(ValueError, lambda: arange(1, dtype="i"))
65
+
66
+
67
+ def test_empty_errors():
68
+ empty((1,), device="cpu") # Doesn't error
69
+ assert_raises(ValueError, lambda: empty((1,), device="gpu"))
70
+ assert_raises(ValueError, lambda: empty((1,), dtype=int))
71
+ assert_raises(ValueError, lambda: empty((1,), dtype="i"))
72
+
73
+
74
+ def test_empty_like_errors():
75
+ empty_like(asarray(1), device="cpu") # Doesn't error
76
+ assert_raises(ValueError, lambda: empty_like(asarray(1), device="gpu"))
77
+ assert_raises(ValueError, lambda: empty_like(asarray(1), dtype=int))
78
+ assert_raises(ValueError, lambda: empty_like(asarray(1), dtype="i"))
79
+
80
+
81
+ def test_eye_errors():
82
+ eye(1, device="cpu") # Doesn't error
83
+ assert_raises(ValueError, lambda: eye(1, device="gpu"))
84
+ assert_raises(ValueError, lambda: eye(1, dtype=int))
85
+ assert_raises(ValueError, lambda: eye(1, dtype="i"))
86
+
87
+
88
+ def test_full_errors():
89
+ full((1,), 0, device="cpu") # Doesn't error
90
+ assert_raises(ValueError, lambda: full((1,), 0, device="gpu"))
91
+ assert_raises(ValueError, lambda: full((1,), 0, dtype=int))
92
+ assert_raises(ValueError, lambda: full((1,), 0, dtype="i"))
93
+
94
+
95
+ def test_full_like_errors():
96
+ full_like(asarray(1), 0, device="cpu") # Doesn't error
97
+ assert_raises(ValueError, lambda: full_like(asarray(1), 0, device="gpu"))
98
+ assert_raises(ValueError, lambda: full_like(asarray(1), 0, dtype=int))
99
+ assert_raises(ValueError, lambda: full_like(asarray(1), 0, dtype="i"))
100
+
101
+
102
+ def test_linspace_errors():
103
+ linspace(0, 1, 10, device="cpu") # Doesn't error
104
+ assert_raises(ValueError, lambda: linspace(0, 1, 10, device="gpu"))
105
+ assert_raises(ValueError, lambda: linspace(0, 1, 10, dtype=float))
106
+ assert_raises(ValueError, lambda: linspace(0, 1, 10, dtype="f"))
107
+
108
+
109
+ def test_ones_errors():
110
+ ones((1,), device="cpu") # Doesn't error
111
+ assert_raises(ValueError, lambda: ones((1,), device="gpu"))
112
+ assert_raises(ValueError, lambda: ones((1,), dtype=int))
113
+ assert_raises(ValueError, lambda: ones((1,), dtype="i"))
114
+
115
+
116
+ def test_ones_like_errors():
117
+ ones_like(asarray(1), device="cpu") # Doesn't error
118
+ assert_raises(ValueError, lambda: ones_like(asarray(1), device="gpu"))
119
+ assert_raises(ValueError, lambda: ones_like(asarray(1), dtype=int))
120
+ assert_raises(ValueError, lambda: ones_like(asarray(1), dtype="i"))
121
+
122
+
123
+ def test_zeros_errors():
124
+ zeros((1,), device="cpu") # Doesn't error
125
+ assert_raises(ValueError, lambda: zeros((1,), device="gpu"))
126
+ assert_raises(ValueError, lambda: zeros((1,), dtype=int))
127
+ assert_raises(ValueError, lambda: zeros((1,), dtype="i"))
128
+
129
+
130
+ def test_zeros_like_errors():
131
+ zeros_like(asarray(1), device="cpu") # Doesn't error
132
+ assert_raises(ValueError, lambda: zeros_like(asarray(1), device="gpu"))
133
+ assert_raises(ValueError, lambda: zeros_like(asarray(1), dtype=int))
134
+ assert_raises(ValueError, lambda: zeros_like(asarray(1), dtype="i"))
135
+
136
+ def test_meshgrid_dtype_errors():
137
+ # Doesn't raise
138
+ meshgrid()
139
+ meshgrid(asarray([1.], dtype=float32))
140
+ meshgrid(asarray([1.], dtype=float32), asarray([1.], dtype=float32))
141
+
142
+ assert_raises(ValueError, lambda: meshgrid(asarray([1.], dtype=float32), asarray([1.], dtype=float64)))
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/numpy/array_api/tests/test_data_type_functions.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from numpy.testing import assert_raises
4
+ from numpy import array_api as xp
5
+ import numpy as np
6
+
7
+ @pytest.mark.parametrize(
8
+ "from_, to, expected",
9
+ [
10
+ (xp.int8, xp.int16, True),
11
+ (xp.int16, xp.int8, False),
12
+ (xp.bool, xp.int8, False),
13
+ (xp.asarray(0, dtype=xp.uint8), xp.int8, False),
14
+ ],
15
+ )
16
+ def test_can_cast(from_, to, expected):
17
+ """
18
+ can_cast() returns correct result
19
+ """
20
+ assert xp.can_cast(from_, to) == expected
21
+
22
+ def test_isdtype_strictness():
23
+ assert_raises(TypeError, lambda: xp.isdtype(xp.float64, 64))
24
+ assert_raises(ValueError, lambda: xp.isdtype(xp.float64, 'f8'))
25
+
26
+ assert_raises(TypeError, lambda: xp.isdtype(xp.float64, (('integral',),)))
27
+ assert_raises(TypeError, lambda: xp.isdtype(xp.float64, np.object_))
28
+
29
+ # TODO: These will require https://github.com/numpy/numpy/issues/23883
30
+ # assert_raises(TypeError, lambda: xp.isdtype(xp.float64, None))
31
+ # assert_raises(TypeError, lambda: xp.isdtype(xp.float64, np.float64))
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/numpy/array_api/tests/test_indexing_functions.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from numpy import array_api as xp
4
+
5
+
6
+ @pytest.mark.parametrize(
7
+ "x, indices, axis, expected",
8
+ [
9
+ ([2, 3], [1, 1, 0], 0, [3, 3, 2]),
10
+ ([2, 3], [1, 1, 0], -1, [3, 3, 2]),
11
+ ([[2, 3]], [1], -1, [[3]]),
12
+ ([[2, 3]], [0, 0], 0, [[2, 3], [2, 3]]),
13
+ ],
14
+ )
15
+ def test_take_function(x, indices, axis, expected):
16
+ """
17
+ Indices respect relative order of a descending stable-sort
18
+
19
+ See https://github.com/numpy/numpy/issues/20778
20
+ """
21
+ x = xp.asarray(x)
22
+ indices = xp.asarray(indices)
23
+ out = xp.take(x, indices, axis=axis)
24
+ assert xp.all(out == xp.asarray(expected))
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/numpy/array_api/tests/test_validation.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Callable
2
+
3
+ import pytest
4
+
5
+ from numpy import array_api as xp
6
+
7
+
8
+ def p(func: Callable, *args, **kwargs):
9
+ f_sig = ", ".join(
10
+ [str(a) for a in args] + [f"{k}={v}" for k, v in kwargs.items()]
11
+ )
12
+ id_ = f"{func.__name__}({f_sig})"
13
+ return pytest.param(func, args, kwargs, id=id_)
14
+
15
+
16
+ @pytest.mark.parametrize(
17
+ "func, args, kwargs",
18
+ [
19
+ p(xp.can_cast, 42, xp.int8),
20
+ p(xp.can_cast, xp.int8, 42),
21
+ p(xp.result_type, 42),
22
+ ],
23
+ )
24
+ def test_raises_on_invalid_types(func, args, kwargs):
25
+ """Function raises TypeError when passed invalidly-typed inputs"""
26
+ with pytest.raises(TypeError):
27
+ func(*args, **kwargs)
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/depth_anything/modeling_depth_anything.py ADDED
@@ -0,0 +1,416 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2024 TikTok and 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
+ """PyTorch Depth Anything model."""
15
+
16
+ import torch
17
+ from torch import nn
18
+
19
+ from ...backbone_utils import load_backbone
20
+ from ...modeling_outputs import DepthEstimatorOutput
21
+ from ...modeling_utils import PreTrainedModel
22
+ from ...utils import auto_docstring, logging
23
+ from .configuration_depth_anything import DepthAnythingConfig
24
+
25
+
26
+ logger = logging.get_logger(__name__)
27
+
28
+ # General docstring
29
+
30
+
31
+ class DepthAnythingReassembleLayer(nn.Module):
32
+ def __init__(self, config, channels, factor):
33
+ super().__init__()
34
+ self.projection = nn.Conv2d(in_channels=config.reassemble_hidden_size, out_channels=channels, kernel_size=1)
35
+
36
+ # up/down sampling depending on factor
37
+ if factor > 1:
38
+ self.resize = nn.ConvTranspose2d(channels, channels, kernel_size=factor, stride=factor, padding=0)
39
+ elif factor == 1:
40
+ self.resize = nn.Identity()
41
+ elif factor < 1:
42
+ # so should downsample
43
+ self.resize = nn.Conv2d(channels, channels, kernel_size=3, stride=int(1 / factor), padding=1)
44
+
45
+ # Copied from transformers.models.dpt.modeling_dpt.DPTReassembleLayer.forward
46
+ def forward(self, hidden_state):
47
+ hidden_state = self.projection(hidden_state)
48
+ hidden_state = self.resize(hidden_state)
49
+
50
+ return hidden_state
51
+
52
+
53
+ class DepthAnythingReassembleStage(nn.Module):
54
+ """
55
+ This class reassembles the hidden states of the backbone into image-like feature representations at various
56
+ resolutions.
57
+
58
+ This happens in 3 stages:
59
+ 1. Take the patch embeddings and reshape them to image-like feature representations.
60
+ 2. Project the channel dimension of the hidden states according to `config.neck_hidden_sizes`.
61
+ 3. Resizing the spatial dimensions (height, width).
62
+
63
+ Args:
64
+ config (`[DepthAnythingConfig]`):
65
+ Model configuration class defining the model architecture.
66
+ """
67
+
68
+ def __init__(self, config):
69
+ super().__init__()
70
+
71
+ self.config = config
72
+ self.layers = nn.ModuleList()
73
+ for channels, factor in zip(config.neck_hidden_sizes, config.reassemble_factors):
74
+ self.layers.append(DepthAnythingReassembleLayer(config, channels=channels, factor=factor))
75
+
76
+ def forward(self, hidden_states: list[torch.Tensor], patch_height=None, patch_width=None) -> list[torch.Tensor]:
77
+ """
78
+ Args:
79
+ hidden_states (`list[torch.FloatTensor]`, each of shape `(batch_size, sequence_length + 1, hidden_size)`):
80
+ List of hidden states from the backbone.
81
+ """
82
+ out = []
83
+
84
+ for i, hidden_state in enumerate(hidden_states):
85
+ # reshape to (batch_size, num_channels, height, width)
86
+ hidden_state = hidden_state[:, 1:]
87
+ batch_size, _, num_channels = hidden_state.shape
88
+ hidden_state = hidden_state.reshape(batch_size, patch_height, patch_width, num_channels)
89
+ hidden_state = hidden_state.permute(0, 3, 1, 2).contiguous()
90
+ hidden_state = self.layers[i](hidden_state)
91
+ out.append(hidden_state)
92
+
93
+ return out
94
+
95
+
96
+ class DepthAnythingPreActResidualLayer(nn.Module):
97
+ """
98
+ ResidualConvUnit, pre-activate residual unit.
99
+
100
+ Args:
101
+ config (`[DepthAnythingConfig]`):
102
+ Model configuration class defining the model architecture.
103
+ """
104
+
105
+ def __init__(self, config):
106
+ super().__init__()
107
+
108
+ self.activation1 = nn.ReLU()
109
+ self.convolution1 = nn.Conv2d(
110
+ config.fusion_hidden_size,
111
+ config.fusion_hidden_size,
112
+ kernel_size=3,
113
+ stride=1,
114
+ padding=1,
115
+ bias=True,
116
+ )
117
+
118
+ self.activation2 = nn.ReLU()
119
+ self.convolution2 = nn.Conv2d(
120
+ config.fusion_hidden_size,
121
+ config.fusion_hidden_size,
122
+ kernel_size=3,
123
+ stride=1,
124
+ padding=1,
125
+ bias=True,
126
+ )
127
+
128
+ def forward(self, hidden_state: torch.Tensor) -> torch.Tensor:
129
+ residual = hidden_state
130
+ hidden_state = self.activation1(hidden_state)
131
+ hidden_state = self.convolution1(hidden_state)
132
+ hidden_state = self.activation2(hidden_state)
133
+ hidden_state = self.convolution2(hidden_state)
134
+
135
+ return hidden_state + residual
136
+
137
+
138
+ class DepthAnythingFeatureFusionLayer(nn.Module):
139
+ """Feature fusion layer, merges feature maps from different stages.
140
+
141
+ Args:
142
+ config (`[DepthAnythingConfig]`):
143
+ Model configuration class defining the model architecture.
144
+ """
145
+
146
+ def __init__(self, config):
147
+ super().__init__()
148
+
149
+ self.projection = nn.Conv2d(config.fusion_hidden_size, config.fusion_hidden_size, kernel_size=1, bias=True)
150
+
151
+ self.residual_layer1 = DepthAnythingPreActResidualLayer(config)
152
+ self.residual_layer2 = DepthAnythingPreActResidualLayer(config)
153
+
154
+ def forward(self, hidden_state, residual=None, size=None):
155
+ if residual is not None:
156
+ if hidden_state.shape != residual.shape:
157
+ residual = nn.functional.interpolate(
158
+ residual, size=(hidden_state.shape[2], hidden_state.shape[3]), mode="bilinear", align_corners=False
159
+ )
160
+ hidden_state = hidden_state + self.residual_layer1(residual)
161
+
162
+ hidden_state = self.residual_layer2(hidden_state)
163
+
164
+ modifier = {"scale_factor": 2} if size is None else {"size": size}
165
+
166
+ hidden_state = nn.functional.interpolate(
167
+ hidden_state,
168
+ **modifier,
169
+ mode="bilinear",
170
+ align_corners=True,
171
+ )
172
+ hidden_state = self.projection(hidden_state)
173
+
174
+ return hidden_state
175
+
176
+
177
+ class DepthAnythingFeatureFusionStage(nn.Module):
178
+ # Copied from transformers.models.dpt.modeling_dpt.DPTFeatureFusionStage.__init__ with DPT->DepthAnything
179
+ def __init__(self, config: DepthAnythingConfig):
180
+ super().__init__()
181
+ self.layers = nn.ModuleList()
182
+ for _ in range(len(config.neck_hidden_sizes)):
183
+ self.layers.append(DepthAnythingFeatureFusionLayer(config))
184
+
185
+ def forward(self, hidden_states, size=None):
186
+ # reversing the hidden_states, we start from the last
187
+ hidden_states = hidden_states[::-1]
188
+
189
+ fused_hidden_states = []
190
+ fused_hidden_state = None
191
+
192
+ for idx, (hidden_state, layer) in enumerate(zip(hidden_states, self.layers)):
193
+ size = hidden_states[idx + 1].shape[2:] if idx != (len(hidden_states) - 1) else None
194
+
195
+ if fused_hidden_state is None:
196
+ # first layer only uses the last hidden_state
197
+ fused_hidden_state = layer(hidden_state, size=size)
198
+ else:
199
+ fused_hidden_state = layer(fused_hidden_state, hidden_state, size=size)
200
+
201
+ fused_hidden_states.append(fused_hidden_state)
202
+
203
+ return fused_hidden_states
204
+
205
+
206
+ # Modified from transformers.models.dpt.modeling_dpt.DPTPreTrainedModel with DPT->DepthAnything,dpt->depth_anything
207
+ # avoiding sdpa and flash_attn_2 support, it's done in the backend
208
+ @auto_docstring
209
+ class DepthAnythingPreTrainedModel(PreTrainedModel):
210
+ config: DepthAnythingConfig
211
+ base_model_prefix = "depth_anything"
212
+ main_input_name = "pixel_values"
213
+ input_modalities = ("image",)
214
+ supports_gradient_checkpointing = True
215
+
216
+
217
+ class DepthAnythingNeck(nn.Module):
218
+ """
219
+ DepthAnythingNeck. A neck is a module that is normally used between the backbone and the head. It takes a list of tensors as
220
+ input and produces another list of tensors as output. For DepthAnything, it includes 2 stages:
221
+
222
+ * DepthAnythingReassembleStage
223
+ * DepthAnythingFeatureFusionStage.
224
+
225
+ Args:
226
+ config (dict): config dict.
227
+ """
228
+
229
+ def __init__(self, config):
230
+ super().__init__()
231
+ self.config = config
232
+
233
+ self.reassemble_stage = DepthAnythingReassembleStage(config)
234
+
235
+ self.convs = nn.ModuleList()
236
+ for channel in config.neck_hidden_sizes:
237
+ self.convs.append(nn.Conv2d(channel, config.fusion_hidden_size, kernel_size=3, padding=1, bias=False))
238
+
239
+ # fusion
240
+ self.fusion_stage = DepthAnythingFeatureFusionStage(config)
241
+
242
+ def forward(self, hidden_states: list[torch.Tensor], patch_height=None, patch_width=None) -> list[torch.Tensor]:
243
+ """
244
+ Args:
245
+ hidden_states (`list[torch.FloatTensor]`, each of shape `(batch_size, sequence_length, hidden_size)` or `(batch_size, hidden_size, height, width)`):
246
+ List of hidden states from the backbone.
247
+ """
248
+ if not isinstance(hidden_states, (tuple, list)):
249
+ raise TypeError("hidden_states should be a tuple or list of tensors")
250
+
251
+ if len(hidden_states) != len(self.config.neck_hidden_sizes):
252
+ raise ValueError("The number of hidden states should be equal to the number of neck hidden sizes.")
253
+
254
+ # postprocess hidden states
255
+ hidden_states = self.reassemble_stage(hidden_states, patch_height, patch_width)
256
+
257
+ features = [self.convs[i](feature) for i, feature in enumerate(hidden_states)]
258
+
259
+ # fusion blocks
260
+ output = self.fusion_stage(features)
261
+
262
+ return output
263
+
264
+
265
+ class DepthAnythingDepthEstimationHead(nn.Module):
266
+ """
267
+ Output head consisting of 3 convolutional layers. It progressively halves the feature dimension and upsamples
268
+ the predictions to the input resolution after the first convolutional layer (details can be found in the DPT paper's
269
+ supplementary material). The final activation function is either ReLU or Sigmoid, depending on the depth estimation
270
+ type (relative or metric). For metric depth estimation, the output is scaled by the maximum depth used during pretraining.
271
+ """
272
+
273
+ def __init__(self, config):
274
+ super().__init__()
275
+
276
+ self.head_in_index = config.head_in_index
277
+ self.patch_size = config.patch_size
278
+
279
+ features = config.fusion_hidden_size
280
+ self.conv1 = nn.Conv2d(features, features // 2, kernel_size=3, stride=1, padding=1)
281
+ self.conv2 = nn.Conv2d(features // 2, config.head_hidden_size, kernel_size=3, stride=1, padding=1)
282
+ self.activation1 = nn.ReLU()
283
+ self.conv3 = nn.Conv2d(config.head_hidden_size, 1, kernel_size=1, stride=1, padding=0)
284
+ if config.depth_estimation_type == "relative":
285
+ self.activation2 = nn.ReLU()
286
+ elif config.depth_estimation_type == "metric":
287
+ self.activation2 = nn.Sigmoid()
288
+ else:
289
+ raise ValueError(f"Unknown depth estimation type: {config.depth_estimation_type}")
290
+ self.max_depth = config.max_depth
291
+
292
+ def forward(self, hidden_states: list[torch.Tensor], patch_height, patch_width) -> torch.Tensor:
293
+ hidden_states = hidden_states[self.head_in_index]
294
+
295
+ predicted_depth = self.conv1(hidden_states)
296
+ predicted_depth = nn.functional.interpolate(
297
+ predicted_depth,
298
+ (int(patch_height * self.patch_size), int(patch_width * self.patch_size)),
299
+ mode="bilinear",
300
+ align_corners=True,
301
+ )
302
+ predicted_depth = self.conv2(predicted_depth)
303
+ predicted_depth = self.activation1(predicted_depth)
304
+ predicted_depth = self.conv3(predicted_depth)
305
+ predicted_depth = self.activation2(predicted_depth) * self.max_depth
306
+ predicted_depth = predicted_depth.squeeze(dim=1) # shape (batch_size, height, width)
307
+
308
+ return predicted_depth
309
+
310
+
311
+ @auto_docstring(
312
+ custom_intro="""
313
+ Depth Anything Model with a depth estimation head on top (consisting of 3 convolutional layers) e.g. for KITTI, NYUv2.
314
+ """
315
+ )
316
+ class DepthAnythingForDepthEstimation(DepthAnythingPreTrainedModel):
317
+ _no_split_modules = ["DPTViTEmbeddings"]
318
+
319
+ def __init__(self, config):
320
+ super().__init__(config)
321
+
322
+ self.backbone = load_backbone(config)
323
+ self.neck = DepthAnythingNeck(config)
324
+ self.head = DepthAnythingDepthEstimationHead(config)
325
+
326
+ # Initialize weights and apply final processing
327
+ self.post_init()
328
+
329
+ @auto_docstring
330
+ def forward(
331
+ self,
332
+ pixel_values: torch.FloatTensor,
333
+ labels: torch.LongTensor | None = None,
334
+ output_attentions: bool | None = None,
335
+ output_hidden_states: bool | None = None,
336
+ return_dict: bool | None = None,
337
+ **kwargs,
338
+ ) -> tuple[torch.Tensor] | DepthEstimatorOutput:
339
+ r"""
340
+ labels (`torch.LongTensor` of shape `(batch_size, height, width)`, *optional*):
341
+ Ground truth depth estimation maps for computing the loss.
342
+
343
+ Examples:
344
+ ```python
345
+ >>> from transformers import AutoImageProcessor, AutoModelForDepthEstimation
346
+ >>> import torch
347
+ >>> import numpy as np
348
+ >>> from PIL import Image
349
+ >>> import httpx
350
+ >>> from io import BytesIO
351
+
352
+ >>> url = "http://images.cocodataset.org/val2017/000000039769.jpg"
353
+ >>> with httpx.stream("GET", url) as response:
354
+ ... image = Image.open(BytesIO(response.read()))
355
+
356
+ >>> image_processor = AutoImageProcessor.from_pretrained("LiheYoung/depth-anything-small-hf")
357
+ >>> model = AutoModelForDepthEstimation.from_pretrained("LiheYoung/depth-anything-small-hf")
358
+
359
+ >>> # prepare image for the model
360
+ >>> inputs = image_processor(images=image, return_tensors="pt")
361
+
362
+ >>> with torch.no_grad():
363
+ ... outputs = model(**inputs)
364
+
365
+ >>> # interpolate to original size
366
+ >>> post_processed_output = image_processor.post_process_depth_estimation(
367
+ ... outputs,
368
+ ... target_sizes=[(image.height, image.width)],
369
+ ... )
370
+
371
+ >>> # visualize the prediction
372
+ >>> predicted_depth = post_processed_output[0]["predicted_depth"]
373
+ >>> depth = predicted_depth * 255 / predicted_depth.max()
374
+ >>> depth = depth.detach().cpu().numpy()
375
+ >>> depth = Image.fromarray(depth.astype("uint8"))
376
+ ```"""
377
+ loss = None
378
+ if labels is not None:
379
+ raise NotImplementedError("Training is not implemented yet")
380
+
381
+ return_dict = return_dict if return_dict is not None else self.config.return_dict
382
+ output_hidden_states = (
383
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
384
+ )
385
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
386
+
387
+ outputs = self.backbone.forward_with_filtered_kwargs(
388
+ pixel_values, output_hidden_states=output_hidden_states, output_attentions=output_attentions
389
+ )
390
+ hidden_states = outputs.feature_maps
391
+
392
+ _, _, height, width = pixel_values.shape
393
+ patch_size = self.config.patch_size
394
+ patch_height = height // patch_size
395
+ patch_width = width // patch_size
396
+
397
+ hidden_states = self.neck(hidden_states, patch_height, patch_width)
398
+
399
+ predicted_depth = self.head(hidden_states, patch_height, patch_width)
400
+
401
+ if not return_dict:
402
+ if output_hidden_states:
403
+ output = (predicted_depth,) + outputs[1:]
404
+ else:
405
+ output = (predicted_depth,) + outputs[2:]
406
+ return ((loss,) + output) if loss is not None else output
407
+
408
+ return DepthEstimatorOutput(
409
+ loss=loss,
410
+ predicted_depth=predicted_depth,
411
+ hidden_states=outputs.hidden_states if output_hidden_states else None,
412
+ attentions=outputs.attentions,
413
+ )
414
+
415
+
416
+ __all__ = ["DepthAnythingForDepthEstimation", "DepthAnythingPreTrainedModel"]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/vits/tokenization_vits.py ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2023 The Kakao Enterprise Authors, the MMS-TTS Authors and 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
+ """Tokenization class for VITS."""
15
+
16
+ import json
17
+ import os
18
+ import re
19
+ from typing import Any
20
+
21
+ from ...tokenization_python import PreTrainedTokenizer
22
+ from ...utils import is_phonemizer_available, is_uroman_available, logging
23
+
24
+
25
+ if is_phonemizer_available():
26
+ import phonemizer
27
+
28
+ if is_uroman_available():
29
+ import uroman as ur
30
+
31
+ logger = logging.get_logger(__name__)
32
+
33
+ VOCAB_FILES_NAMES = {"vocab_file": "vocab.json"}
34
+
35
+
36
+ def has_non_roman_characters(input_string):
37
+ # Find any character outside the ASCII range
38
+ non_roman_pattern = re.compile(r"[^\x00-\x7F]")
39
+
40
+ # Search the input string for non-Roman characters
41
+ match = non_roman_pattern.search(input_string)
42
+ has_non_roman = match is not None
43
+ return has_non_roman
44
+
45
+
46
+ class VitsTokenizer(PreTrainedTokenizer):
47
+ """
48
+ Construct a VITS tokenizer. Also supports MMS-TTS.
49
+
50
+ This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
51
+ this superclass for more information regarding those methods.
52
+
53
+ Args:
54
+ vocab_file (`str`):
55
+ Path to the vocabulary file.
56
+ language (`str`, *optional*):
57
+ Language identifier.
58
+ add_blank (`bool`, *optional*, defaults to `True`):
59
+ Whether to insert token id 0 in between the other tokens.
60
+ normalize (`bool`, *optional*, defaults to `True`):
61
+ Whether to normalize the input text by removing all casing and punctuation.
62
+ phonemize (`bool`, *optional*, defaults to `True`):
63
+ Whether to convert the input text into phonemes.
64
+ is_uroman (`bool`, *optional*, defaults to `False`):
65
+ Whether the `uroman` Romanizer needs to be applied to the input text prior to tokenizing.
66
+ """
67
+
68
+ vocab_files_names = VOCAB_FILES_NAMES
69
+ model_input_names = ["input_ids", "attention_mask"]
70
+
71
+ def __init__(
72
+ self,
73
+ vocab_file,
74
+ pad_token="<pad>",
75
+ unk_token="<unk>",
76
+ language=None,
77
+ add_blank=True,
78
+ normalize=True,
79
+ phonemize=True,
80
+ is_uroman=False,
81
+ **kwargs,
82
+ ) -> None:
83
+ with open(vocab_file, encoding="utf-8") as vocab_handle:
84
+ self.encoder = json.load(vocab_handle)
85
+
86
+ self.decoder = {v: k for k, v in self.encoder.items()}
87
+ self.language = language
88
+ self.add_blank = add_blank
89
+ self.normalize = normalize
90
+ self.phonemize = phonemize
91
+
92
+ self.is_uroman = is_uroman
93
+
94
+ super().__init__(
95
+ pad_token=pad_token,
96
+ unk_token=unk_token,
97
+ language=language,
98
+ add_blank=add_blank,
99
+ normalize=normalize,
100
+ phonemize=phonemize,
101
+ is_uroman=is_uroman,
102
+ special_tokens_pattern="none",
103
+ **kwargs,
104
+ )
105
+
106
+ @property
107
+ def vocab_size(self):
108
+ return len(self.encoder)
109
+
110
+ def get_vocab(self):
111
+ vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
112
+ vocab.update(self.added_tokens_encoder)
113
+ return vocab
114
+
115
+ def normalize_text(self, input_string):
116
+ """Lowercase the input string, respecting any special token ids that may be part or entirely upper-cased."""
117
+ all_vocabulary = list(self.encoder.keys()) + list(self.added_tokens_encoder.keys())
118
+ filtered_text = ""
119
+
120
+ i = 0
121
+ while i < len(input_string):
122
+ found_match = False
123
+ for word in all_vocabulary:
124
+ if input_string[i : i + len(word)] == word:
125
+ filtered_text += word
126
+ i += len(word)
127
+ found_match = True
128
+ break
129
+
130
+ if not found_match:
131
+ filtered_text += input_string[i].lower()
132
+ i += 1
133
+
134
+ return filtered_text
135
+
136
+ def _preprocess_char(self, text):
137
+ """Special treatment of characters in certain languages"""
138
+ if self.language == "ron":
139
+ text = text.replace("ț", "ţ")
140
+ return text
141
+
142
+ def prepare_for_tokenization(
143
+ self, text: str, is_split_into_words: bool = False, normalize: bool | None = None, **kwargs
144
+ ) -> tuple[str, dict[str, Any]]:
145
+ """
146
+ Performs any necessary transformations before tokenization.
147
+
148
+ This method should pop the arguments from kwargs and return the remaining `kwargs` as well. We test the
149
+ `kwargs` at the end of the encoding process to be sure all the arguments have been used.
150
+
151
+ Args:
152
+ text (`str`):
153
+ The text to prepare.
154
+ is_split_into_words (`bool`, *optional*, defaults to `False`):
155
+ Whether or not the input is already pre-tokenized (e.g., split into words). If set to `True`, the
156
+ tokenizer assumes the input is already split into words (for instance, by splitting it on whitespace)
157
+ which it will tokenize.
158
+ normalize (`bool`, *optional*, defaults to `None`):
159
+ Whether or not to apply punctuation and casing normalization to the text inputs. Typically, VITS is
160
+ trained on lower-cased and un-punctuated text. Hence, normalization is used to ensure that the input
161
+ text consists only of lower-case characters.
162
+ kwargs (`dict[str, Any]`, *optional*):
163
+ Keyword arguments to use for the tokenization.
164
+
165
+ Returns:
166
+ `tuple[str, dict[str, Any]]`: The prepared text and the unused kwargs.
167
+ """
168
+ normalize = normalize if normalize is not None else self.normalize
169
+
170
+ if normalize:
171
+ # normalise for casing
172
+ text = self.normalize_text(text)
173
+
174
+ filtered_text = self._preprocess_char(text)
175
+
176
+ if has_non_roman_characters(filtered_text) and self.is_uroman:
177
+ if not is_uroman_available():
178
+ logger.warning(
179
+ "Text to the tokenizer contains non-Roman characters. To apply the `uroman` pre-processing "
180
+ "step automatically, ensure the `uroman` Romanizer is installed with: `pip install uroman` "
181
+ "Note `uroman` requires python version >= 3.10"
182
+ "Otherwise, apply the Romanizer manually as per the instructions: https://github.com/isi-nlp/uroman"
183
+ )
184
+ else:
185
+ uroman = ur.Uroman()
186
+ filtered_text = uroman.romanize_string(filtered_text)
187
+
188
+ if self.phonemize:
189
+ if not is_phonemizer_available():
190
+ raise ImportError("Please install the `phonemizer` Python package to use this tokenizer.")
191
+
192
+ filtered_text = phonemizer.phonemize(
193
+ filtered_text,
194
+ language="en-us",
195
+ backend="espeak",
196
+ strip=True,
197
+ preserve_punctuation=True,
198
+ with_stress=True,
199
+ )
200
+ filtered_text = re.sub(r"\s+", " ", filtered_text)
201
+ elif normalize:
202
+ # strip any chars outside of the vocab (punctuation)
203
+ filtered_text = "".join(list(filter(lambda char: char in self.encoder, filtered_text))).strip()
204
+
205
+ return filtered_text, kwargs
206
+
207
+ def _tokenize(self, text: str) -> list[str]:
208
+ """Tokenize a string by inserting the `<pad>` token at the boundary between adjacent characters."""
209
+ tokens = list(text)
210
+
211
+ if self.add_blank:
212
+ interspersed = [self._convert_id_to_token(0)] * (len(tokens) * 2 + 1)
213
+ interspersed[1::2] = tokens
214
+ tokens = interspersed
215
+
216
+ return tokens
217
+
218
+ def convert_tokens_to_string(self, tokens: list[str]) -> str:
219
+ if self.add_blank and len(tokens) > 1:
220
+ tokens = tokens[1::2]
221
+ return "".join(tokens)
222
+
223
+ def _convert_token_to_id(self, token):
224
+ """Converts a token (str) in an id using the vocab."""
225
+ if token in self.encoder:
226
+ return self.encoder[token]
227
+ return self.unk_token_id
228
+
229
+ def _convert_id_to_token(self, index):
230
+ """Converts an index (integer) in a token (str) using the vocab."""
231
+ return self.decoder.get(index)
232
+
233
+ def save_vocabulary(self, save_directory: str, filename_prefix: str | None = None) -> tuple[str] | None:
234
+ if not os.path.isdir(save_directory):
235
+ logger.error(f"Vocabulary path ({save_directory}) should be a directory")
236
+ return
237
+
238
+ vocab_file = os.path.join(
239
+ save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"]
240
+ )
241
+
242
+ with open(vocab_file, "w", encoding="utf-8") as f:
243
+ f.write(json.dumps(self.encoder, indent=2, sort_keys=True, ensure_ascii=False) + "\n")
244
+
245
+ return (vocab_file,)
246
+
247
+
248
+ __all__ = ["VitsTokenizer"]
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_003000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ac8f92205c6cb4280043abddbc8b19d4e7fc310febfd37f32a27aad08d224906
3
+ size 927700322
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_028000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1d0e5cfaa25abe5aa36d94234881e4ad77383c41ff53edb8533750b918dc3222
3
+ size 927700322
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_095000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:483b698fb5206eca54d4c50ca22d3238d8d9d2d6f79d1d9a1b9d087e2b1a2c34
3
+ size 927700322
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck128_unfixed_norm_stateprobadd_selfcond_ce_fast_20260609_230847/step_191000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:905981ceaddbc055b627881f991969bb2644fa16c0bd10c1f3997a7f86f804b7
3
+ size 927700322
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_001000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b38f0f8808758a28ed748a50433f4bdbdc9c62e660d6c3319dfa1206a3e94754
3
+ size 962143586
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_017000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fedb05159c4c0eba6d2edc1126d4b4cc896ac77399e8c3e1d6e9a2bed6418aad
3
+ size 962143586
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_038000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7afd5e0fa4b7a04b7a4961b7e32330364181f94b9d828e8ac260216c970c1235
3
+ size 962143586
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_137000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:41d571669b4d3fb51d955394a1f65d08480b25365a2421d4f5ec405ac5f09e09
3
+ size 962143586
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_203000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4bea6ac499c025cdde123d7312b579d2a8062615a6ff8a86062820fcb79ed385
3
+ size 962143586
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_294000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fb7ac863fcfd329d1bc25dc5b8b30abd826e2eb6dbb93179256650f2d2c27949
3
+ size 962143586
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_452000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e9633b9b9e02960dfc729709d4c44bb8944a883c13ac00b3c89a1f399f464aa5
3
+ size 962143586
LTA_openwebtext_dualt/mini_owt_logdirichlet/runs/owt_t5_elftokenized_full_len1024_C1_to_1024_pow1_d768_l12_h12_gbs512_2x8gpu_50ep_lr3e3_ema0p9999_elfopt_not5_bottleneck256_unfixed_norm_stateprobadd_selfcond_ce_fast_20260612_050225/step_486000.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6677756395b35b5c8a5b5e626c0a9608f90fdb8ffb24bb909c1aec4b78dd0d94
3
+ size 962143586