JinghuiLuAstronaut commited on
Commit
3e1c26b
·
verified ·
1 Parent(s): 9ce8294

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. LTA_openwebtext_dualt/docs/lta_samples/metrics_20260519/owt_t5_subset10k_rho0_0p25_step35k_lm1bstate_steps1024_c1024_t1p45_n8_noscore/context1024_samples.txt +29 -0
  2. LTA_openwebtext_dualt/docs/lta_samples/metrics_20260525/owt_bert_absrope_adaln_Cv_to_2v_mask1_sameT_every1k_sde_gumbel_topp0p95_tau1p0_to_0p2_blend_c30522_61044_n128/lta_owt_bert_absrope_adaln_dirichlet_len1024_Cv_to_2v_mask1_sameT_gbs512_b4x4_1m_save1k_watch_20260525/step_0002000/sde_steps128_samples128_scored.jsonl +0 -0
  3. LTA_openwebtext_dualt/logs/qwen_service/qwen3p5_35b_a3b_transformers_gpu2_3_20260608_200311.log +67 -0
  4. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/_usd_builtins.py +112 -0
  5. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ecl.py +144 -0
  6. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/gcodelexer.py +35 -0
  7. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/hexdump.py +102 -0
  8. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ldap.py +155 -0
  9. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/mips.py +130 -0
  10. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/other.py +41 -0
  11. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/qlik.py +117 -0
  12. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/special.py +122 -0
  13. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/tal.py +77 -0
  14. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/text.py +27 -0
  15. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/web.py +24 -0
  16. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/tokenizers-0.22.2.dist-info/RECORD +31 -0
  17. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/tqdm/contrib/__init__.py +91 -0
  18. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/tqdm/contrib/bells.py +26 -0
  19. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ernie4_5_moe/configuration_ernie4_5_moe.py +121 -0
  20. LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ernie4_5_moe/modeling_ernie4_5_moe.py +742 -0
LTA_openwebtext_dualt/docs/lta_samples/metrics_20260519/owt_t5_subset10k_rho0_0p25_step35k_lm1bstate_steps1024_c1024_t1p45_n8_noscore/context1024_samples.txt ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ A: Res Res:sssingsingssssingssssingssingingssingingssssssingsssssinging Asss Assssingssssssingssingingingingingsasssingssingsssing sssssssssingsssssingssssssssss ingsssssingingssssingss:singsssingsssings Resssingsssssssssssingingssss Ressingsingsssingsingsingsingsssingssssss Asing Assssssingsss s singssingsssssassssingasssssssssssssss Resssingsingsssingssingssssssssingssingsingssss Reingsss ssssss sssssssssingingsssssssss thessingss Resssssss ssssssssssssingsssssingsssssss ssssssssssssssssingss Assssssssingsss Assssssssssingssingingsingssingss Assssss Aingss Assingsss Asssingssssssssssssssssssss Resassssssssssingsssssss sssingssssss Ins ssssings Ress sssingssssssssssssssss Ressing sss:ing Asssss s Resssss ssssa sssssssss s s ss Res Resssss Aingssssing ing ssss Assssssss Re Resssingssss Ressssssssssssss Resssssssssssssingsss Resssingssingssssssssss sss sssssssssings ssss s Resssssssss Re :ss ssssss Resssssss ssss Reas s : sssss Re sssssssssss Re Resss ingssssssings Re Asssss sssss Asssss Ass Re Ressssssssss Ress s Asss In ss Ressssssss Resssssssss a A ssss Ressssssssss Resingings Ressssssssssssssssssss:ss Ressssssingss Re Resssssssss Resss Resing Res ssssssssssssing Re Res Re ssss thesss Resssingss Resssssssssssssssings ssssssssssssingssss Ressssssssss Ressssssss Reingsssss Ressss Resssssssssss Res Ress s sss:sing Re
2
+
3
+ ---
4
+
5
+ A:s Ressssss ssssssssssssssssssingssingssssssingssingssssssssssssssssssssingsssssingssssssingssingsas thesssssssssingsssssssssssssssssssssss Resss Resssssssingsingss singsssingssssssssingingsssingsssssingsss Resssssssssingsssingsss Asssssingssingingss ssssssingsssssssssing Ressingssssssssss ssssssingss Ressssssssss Resssas Re Ressssssa sssss ssssingsingssssss sssss Ressingsss Resss Inss sssssss ssssssssssssssss ssssssss:ssss sssssssssss ssssss ssss sssss Inssssssssssssssssss sssssss Resssssssssssssssssssingsss ssingsssingsssss theingss s Resssssss ssssssssssssa sss ssssssssssingsssss ssssss s Assssssssss s sssssssssssings sss sss sss Ress Resssingssss ssssss ssssings: s sssss Res:sssssssssss s s sa Resaingsingss sssss Resss Resssssssssss ss Resssss Resssssss Ressssss Ressssssingsssss :ssssss Resss Resssss ssss Resssss Ressssssss Ressssss ss Ressings s sssssssssssss sing Res Ressssingsssss Res Resssssss ings Ressss:sssssssssss thesssssssssing s s Re singssss ssssssingssss Ass Ass Re sss Reser Oversss Ress Resssingsssssss Ressss ssss Ressingssssss Re Ressssssss Ressssssssssss Re sssssssssssssss Ressss Ressings thessss Ress: ssssssssssssssserasssssingsssssssssssssss thessss Resssingsssssssssss Resssssers ssssss: Resssssingssssss Re ssssssss ss:
6
+
7
+ ---
8
+
9
+ A Re Re:ssss Ress Reingsssssssssingssssssingingsssssssssssss Ressssssssingsassssssssssingssingsingssingsassssingssingss Reingssssingingsssssssasssasssssingssingsssssssssingssssssssssssingsss sssssss Ressssssss:ssssingsssingsssssssssingssssssssssssssssssssssssssssingsssssssssssssingsssssssssss Ressssssssssssssssssssssss ssssing as Resssssss sssssingssss Ressssssssingssssssssssssssingssssssssss ssing sssssssssssss:ssssssssssssssingsssssssingsssssingssssssssssssingssssingsasssssssssing A Resingsingssssssssss sssss Res sssssssssssss sssssssssssingssssssssssssssssing ssssingssssssssssssss Ressssssssingsssssss As ssssssssssssssssingsss Re ssssingsssssssing sing A Iningss ssss thes serssssss: Asss s ssssssss Assssssss s Asssssssassing sss:ss sssssssssss Resssssssingssss sssssss sings Rea Resss Overssingssssssssss sssss Resssssssssss ssss Resa Ressssssssingssingssssss ssingsssss Ress Overss Ress Res sings s Re sssssssssss sssss Re Resss ss Resssssss Resssssings Resssssingssss Res Resssssssing Ressssss sss Ressssssssssss sssssss Re Res Ressingssing Ressssssssssssssss Resssssssss ingsssssssssss Res ssss Res Over ssssssings sssss Re sssssss Ressingssss Re Resssssssssass: ss the Res:ingsssssssssssssssssssss thes s thesssssss Res Re Res ss Resings Resss s Ress Resss ing s:
10
+
11
+ ---
12
+
13
+ A Re Re::ssssss Reing:ssssssssssingsssssingssssssssingsssssssssssssssssssssssingingingssssssssssingsssssings Resssersingssings sssssings Res sssssingssingssssssssssssssssssssss Resssssssingss thesss sssssssssss Iningssssing singsssssssingssss Resingsssingssingingsssssingsssss Ressssssssssingssssssss ssasssssssssssssssssssingsssssingsasingsas ss ssssserssssingssss Asssingsssssssssssssssssingssssingssingsssssssingsss Resssssssssssssingsssssssssssssssssss Insssssss Resingssssssssssssssssssss Resingss ssssssssssssssss sssssssss ingasssssssssssssssssing Resssssingsssss ss sssss ssssssingsss ssssss ssss s Aingsssssssingsssss ssss sssssings Assssingsssssssss In sssingingsssssingss Ressssssssssssingsssss As s ssssss singss Ressssssss singss sssingssssss sss s sssssssss sss ssss Res ss Res Res ssssssss Resssssss Ressssssss Ressssssssssssss Ressing ssingsssssingsssssss As s Ress sssssssssssssing Res s the ss Ins A Ressssssss Resssssssssssssss Resss Resss ssssssssssssingsssings Res Ressingssssssss ss sssssssssssingingsssss sssingssingsssssssssssss s Reing thesssss sssssssssssssssssss sssssssssssssssss Reing ofsass thessingsssssingssingssssssssssssssssssss Ressssss Res Resingsssssss thesssssssssssssssing Ress Asssssssssssssss Ressssssssssssa ssssssssss theing s:
14
+
15
+ ---
16
+
17
+ A Re Re Re:ingingsssssssssssssssssssssssssssssssssssssssssssssssssing:singsssssings Ressssssssssssss s sssssssssingsssssssssssssingsssssssingssssingsssingsss thessssss Reingss Resssssssssingsssssssssssssssssssssingssssings Ressssss ssingsssssingssssssssssingsssss Resingsssssssssssssssssssssingsssssssssssingsssingsssssingings Resssssssingsasssssingsssssssssssssss Resssingssssings Aingsss ingssssings sssssss ssass Resss sssssssssss sssssssingingssssssingingssssssssssssssssss ingssssssssssssssssssssssssssssssingsssssssssssssss Overingsssssssss singssss Resssssssssssssssss ssssssss ssssssssingss Reingssss Resssssss Ressingssssssssss ssssss sss ssss Res Aingsssingsssssss sss Theing the sss:ssssingsssss Re sss Re sssssssssssss sssssssssssssss sssssssssss Resssssssssssss ss Res ssssssing ssss Ressssssss:ssss Ressssings ssssssssingsssssssss sssssssssssss As Res sss sssssssssssss ss Ress sssssss Res sssss Resssssssssss sss Res sssssssssasss ssingss Asssssssssssssssingsingss Res ssssssssssssssssssssssssingss sss Ressssssssssss s ssss Reingssss Re Res Re s the sssssssss:sssssss Resssss In ssssss Resss ing Ressssssersssss Re ssssssssssssing Resss Resssssssssss sssssssss ssss Resssss Resssssss Res Resssssss Ress:sssssssssssssssss
18
+
19
+ ---
20
+
21
+ A:: Resingsssssss Asssssingsingsssssssingsingssssssssssssssssssingsingsssingsssssssssssssssssersssingsss Backingsaingsss:ssssingssssssingssssssssss Resingsasssssingsingsssssssssssssingssss sasssssingsssssingssssingssss ssssingssssssing Resssss Asssssingssssssssssssingsssingssssingsssssssingsssssss Asssssssssssssssssssssssss Assssings sssssingingssssssssssinging sssssssssingsingsssssssssssssssssssssssss ssss Resssssss ingssssssss singssssssssssings Resssssssingssssssssingsingssssssssssingss Asssss Ressssssingsingss sss Ressssss sss sssssss singingsssssingssssssss ingssssssssssssssssssssssssssss Ressssingsss ingssssssssingsss Ress Assssssssssssssssingsssss sssssssssssss Res sssss ingsssingss Asss sss sssssssssingssssss ssssss Resssssssssssss ingsss Reing sssss ss Resssssssas Reing ss s ssssssssas Re Ressssssssssss Ress Oversss ssssssssssssssd sss ssss ssssssss Resssing Ress Res Re Ressssingssssss sssss Re Oversss Ins Resssssss Assss Insssssss Re Resssssssssss Ressssssssssss s :sssssssssssssss Res ssssssingsssingss sasss Reingsssssing:sssssssss Resingsssssssssingsssss Ressssssssssss s Re ssssssssssssssssssssssss Resings sssingsssssss ss Res Resssssssss Resssssssss Ressssssssssssingssssssssssssssssss Ressss thesssingsss s Ressssssss Ressingsss Ress sssss Re
22
+
23
+ ---
24
+
25
+ A Re::s Resssssing Ressssssingsssssssssssssssssssinging Assssingssssssssssssssssssssssssssingsingsssssings Res:ssingssssssssssingssssssssingsingssingssssssssssss sssingss Res Resssssssssssing Ressssssingsing sssssssa Ressssingssssssssssssssingasssssssssssssingssssss Assssssssssssssingssss A ssssssingssssssss ingssssssssssingss Asssingssssssssssssssssssssssss sssingssssss ssssssss Ressssss Assing ssssssssingsssingssingss Reings s sssingsssssssingsingss sssssssssssingsssingsssingssssssss:s sssssssss Resssssssssss ssingssssssss ssssssssssssssssssssss ingsssssss ssing Resssssssss Ress s ssssssssssssssingssssssssssssingssss s sssssss Res:ass ss Resssss sssssssss ssssssss sss sss ssingsssss s sssssingsss’ ssssss ss Ressssssssingssasingssasingss Insingsssssssssssssssss Resss sss Resss Asssssingsssssssssss ss ssssingsssssss Re Resingss Ressssss Ressssssss Ressss Resss Ins Ressssssssss ssss Ress Re ss s sss Resssss Assssssss sssss Ins ssss Resssss ssssss sssss sssing sssssssingss ss ingss Resssssss:singssss Ressssss Resss sssssssssingsssing Res Ress sssssssssss Reing Resssssssssss ss thes Resssss Resssssing Ressss Ressss Resssssssssssssingsssssssss Resssss Reingsss Resssssss Ress ssings Re sssssssss Res Ressssssss Reing Re Re Res Resss Ressssss Resss ssser:
26
+
27
+ ---
28
+
29
+ A: Re:ers Ressssssssssssssings Res Ressssingingsssssingssssingsssssssssssssingingssssingsssssssssss Asingssssssssss ssssingssssssssssssssssingingsingsssssssssssssings Ressingsssssssingsssssssassssssssssssssssssssssssingsssssssaingsssss ssssssss:ssssingssssssssingsssss Reings thesssssssssss Res s:ssssssss sss Reasssssingssssingingsingssssssssssssssss Re ss Ass Ressssssingssssssss sssingsssssingsss Res Asssssssssssssssssssss sssss ssssss sssssingsss Assssingssssssss Ressss Asingsssingssssssssssssssingsingssssssssssssss ssings Resssssssss ssssssssing Insssssssssssssssssssssssing Resss Ressss sssssssssssssssss s Asssss Assssasssingsssssss sssssssssssssingingsing:sssssss As ssingsss sssssssss ingssssingings Ressssssssss sssssssssingssssssssssing s ssssssssssss ssssssss sss s ssssssssssssssss ssss ssssssssss s sss Ress Resss Ressssssssssss Resss sssss:ss ss:sssss the Resssssssss sssssssss Res Resss Resss ssssss Resssss As Assssssssasssing Resss Re Ressssssssssing Resssss thesssssssssingsssssssss ssss Insssssssssssssssss Resssssssssing Ress Resssingsssssssssssingsssingsssass Resssss thesssss Ressss Resssssss Ressssssings Resa Re the Resssss sss Resssssssssssssssssssssss Resssingss thessssasssss sss sssssingssssss Resssssssssssssingsssssssss:s
LTA_openwebtext_dualt/docs/lta_samples/metrics_20260525/owt_bert_absrope_adaln_Cv_to_2v_mask1_sameT_every1k_sde_gumbel_topp0p95_tau1p0_to_0p2_blend_c30522_61044_n128/lta_owt_bert_absrope_adaln_dirichlet_len1024_Cv_to_2v_mask1_sameT_gbs512_b4x4_1m_save1k_watch_20260525/step_0002000/sde_steps128_samples128_scored.jsonl ADDED
The diff for this file is too large to render. See raw diff
 
LTA_openwebtext_dualt/logs/qwen_service/qwen3p5_35b_a3b_transformers_gpu2_3_20260608_200311.log ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [transformers] `torch_dtype` is deprecated! Use `dtype` instead!
2
+ [transformers] The fast path is not available because one of the required library is not installed. Falling back to torch implementation. To install follow https://github.com/fla-org/flash-linear-attention#installation and https://github.com/Dao-AILab/causal-conv1d
3
+
4
+ INFO: Started server process [817067]
5
+ INFO: Waiting for application startup.
6
+ INFO: Application startup complete.
7
+ INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
8
+ INFO: 127.0.0.1:39348 - "GET /healthz HTTP/1.1" 200 OK
9
+ INFO: 127.0.0.1:38936 - "GET /healthz HTTP/1.1" 200 OK
10
+ INFO: 127.0.0.1:42672 - "GET /healthz HTTP/1.1" 200 OK
11
+ INFO: 193.205.210.75:0 - "GET /healthz HTTP/1.1" 200 OK
12
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
13
+ INFO: 127.0.0.1:53660 - "GET /healthz HTTP/1.1" 200 OK
14
+ INFO: 127.0.0.1:45760 - "GET / HTTP/1.1" 404 Not Found
15
+ INFO: 127.0.0.1:37066 - "GET /healthz HTTP/1.1" 200 OK
16
+ INFO: 127.0.0.1:60836 - "GET /healthz HTTP/1.1" 200 OK
17
+ INFO: 127.0.0.1:58018 - "GET /healthz HTTP/1.1" 200 OK
18
+ INFO: 193.205.210.75:0 - "GET /v1/models HTTP/1.1" 200 OK
19
+ INFO: 193.205.210.75:0 - "GET /healthz HTTP/1.1" 200 OK
20
+ INFO: 127.0.0.1:44326 - "GET / HTTP/1.1" 404 Not Found
21
+ INFO: 193.205.210.75:0 - "GET /v1/models HTTP/1.1" 200 OK
22
+ INFO: 193.205.210.75:0 - "GET /healthz HTTP/1.1" 200 OK
23
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
24
+ INFO: 193.205.210.75:0 - "GET /healthz HTTP/1.1" 200 OK
25
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
26
+ INFO: 77.97.20.28:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
27
+ INFO: 127.0.0.1:40530 - "GET /healthz HTTP/1.1" 200 OK
28
+ INFO: 127.0.0.1:60692 - "GET /healthz HTTP/1.1" 200 OK
29
+ INFO: 193.205.210.75:0 - "GET /healthz HTTP/1.1" 200 OK
30
+ INFO: 193.205.210.75:0 - "GET /v1/models HTTP/1.1" 200 OK
31
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
32
+ INFO: 193.205.210.75:0 - "GET /healthz HTTP/1.1" 200 OK
33
+ INFO: 193.205.210.75:0 - "GET /v1/models HTTP/1.1" 200 OK
34
+ INFO: 193.205.210.75:0 - "GET /healthz HTTP/1.1" 200 OK
35
+ INFO: 193.205.210.75:0 - "GET /v1/models HTTP/1.1" 200 OK
36
+ INFO: 127.0.0.1:49442 - "GET / HTTP/1.1" 404 Not Found
37
+ INFO: 127.0.0.1:58800 - "GET /healthz HTTP/1.1" 200 OK
38
+ INFO: 127.0.0.1:47506 - "GET / HTTP/1.1" 404 Not Found
39
+ INFO: 127.0.0.1:54578 - "GET /healthz HTTP/1.1" 200 OK
40
+ INFO: 193.205.210.75:0 - "GET /healthz HTTP/1.1" 200 OK
41
+ INFO: 193.205.210.75:0 - "GET /v1/models HTTP/1.1" 200 OK
42
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
43
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
44
+ INFO: 127.0.0.1:34000 - "GET / HTTP/1.1" 404 Not Found
45
+ INFO: 77.97.20.28:0 - "POST /chat/completions HTTP/1.1" 404 Not Found
46
+ INFO: 77.97.20.28:0 - "POST /chat/completions HTTP/1.1" 404 Not Found
47
+ INFO: 77.97.20.28:0 - "POST /chat/completions HTTP/1.1" 404 Not Found
48
+ INFO: 77.97.20.28:0 - "POST /chat/completions HTTP/1.1" 404 Not Found
49
+ INFO: 77.97.20.28:0 - "POST /chat/completions HTTP/1.1" 404 Not Found
50
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
51
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
52
+ INFO: 77.97.20.28:0 - "POST /v1/chat/completions HTTP/1.1" 401 Unauthorized
53
+ INFO: 77.97.20.28:0 - "POST /v1/chat/completions HTTP/1.1" 401 Unauthorized
54
+ INFO: 77.97.20.28:0 - "POST /v1/chat/completions HTTP/1.1" 401 Unauthorized
55
+ INFO: 77.97.20.28:0 - "POST /v1/chat/completions HTTP/1.1" 401 Unauthorized
56
+ INFO: 77.97.20.28:0 - "POST /v1/chat/completions HTTP/1.1" 401 Unauthorized
57
+ INFO: 77.97.20.28:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
58
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
59
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
60
+ INFO: 77.97.20.28:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
61
+ INFO: 193.205.210.75:0 - "GET /healthz HTTP/1.1" 200 OK
62
+ INFO: 193.205.210.75:0 - "POST /v1/chat/completions HTTP/1.1" 200 OK
63
+ INFO: 77.97.20.28:0 - "POST /v1/chat/completions HTTP/1.1" 401 Unauthorized
64
+ INFO: Shutting down
65
+ INFO: Waiting for application shutdown.
66
+ INFO: Application shutdown complete.
67
+ INFO: Finished server process [817067]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/_usd_builtins.py ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers._usd_builtins
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ A collection of known USD-related keywords, attributes, and types.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ COMMON_ATTRIBUTES = [
12
+ "extent",
13
+ "xformOpOrder",
14
+ ]
15
+
16
+ KEYWORDS = [
17
+ "class",
18
+ "clips",
19
+ "custom",
20
+ "customData",
21
+ "def",
22
+ "dictionary",
23
+ "inherits",
24
+ "over",
25
+ "payload",
26
+ "references",
27
+ "rel",
28
+ "subLayers",
29
+ "timeSamples",
30
+ "uniform",
31
+ "variantSet",
32
+ "variantSets",
33
+ "variants",
34
+ ]
35
+
36
+ OPERATORS = [
37
+ "add",
38
+ "append",
39
+ "delete",
40
+ "prepend",
41
+ "reorder",
42
+ ]
43
+
44
+ SPECIAL_NAMES = [
45
+ "active",
46
+ "apiSchemas",
47
+ "defaultPrim",
48
+ "elementSize",
49
+ "endTimeCode",
50
+ "hidden",
51
+ "instanceable",
52
+ "interpolation",
53
+ "kind",
54
+ "startTimeCode",
55
+ "upAxis",
56
+ ]
57
+
58
+ TYPES = [
59
+ "asset",
60
+ "bool",
61
+ "color3d",
62
+ "color3f",
63
+ "color3h",
64
+ "color4d",
65
+ "color4f",
66
+ "color4h",
67
+ "double",
68
+ "double2",
69
+ "double3",
70
+ "double4",
71
+ "float",
72
+ "float2",
73
+ "float3",
74
+ "float4",
75
+ "frame4d",
76
+ "half",
77
+ "half2",
78
+ "half3",
79
+ "half4",
80
+ "int",
81
+ "int2",
82
+ "int3",
83
+ "int4",
84
+ "keyword",
85
+ "matrix2d",
86
+ "matrix3d",
87
+ "matrix4d",
88
+ "normal3d",
89
+ "normal3f",
90
+ "normal3h",
91
+ "point3d",
92
+ "point3f",
93
+ "point3h",
94
+ "quatd",
95
+ "quatf",
96
+ "quath",
97
+ "string",
98
+ "syn",
99
+ "token",
100
+ "uchar",
101
+ "uchar2",
102
+ "uchar3",
103
+ "uchar4",
104
+ "uint",
105
+ "uint2",
106
+ "uint3",
107
+ "uint4",
108
+ "usdaType",
109
+ "vector3d",
110
+ "vector3f",
111
+ "vector3h",
112
+ ]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ecl.py ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ecl
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the ECL language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, words
14
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Whitespace
16
+
17
+ __all__ = ['ECLLexer']
18
+
19
+
20
+ class ECLLexer(RegexLexer):
21
+ """
22
+ Lexer for the declarative big-data ECL language.
23
+ """
24
+
25
+ name = 'ECL'
26
+ url = 'https://hpccsystems.com/training/documentation/ecl-language-reference/html'
27
+ aliases = ['ecl']
28
+ filenames = ['*.ecl']
29
+ mimetypes = ['application/x-ecl']
30
+ version_added = '1.5'
31
+
32
+ flags = re.IGNORECASE | re.MULTILINE
33
+
34
+ tokens = {
35
+ 'root': [
36
+ include('whitespace'),
37
+ include('statements'),
38
+ ],
39
+ 'whitespace': [
40
+ (r'\s+', Whitespace),
41
+ (r'\/\/.*', Comment.Single),
42
+ (r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
43
+ ],
44
+ 'statements': [
45
+ include('types'),
46
+ include('keywords'),
47
+ include('functions'),
48
+ include('hash'),
49
+ (r'"', String, 'string'),
50
+ (r'\'', String, 'string'),
51
+ (r'(\d+\.\d*|\.\d+|\d+)e[+-]?\d+[lu]*', Number.Float),
52
+ (r'(\d+\.\d*|\.\d+|\d+f)f?', Number.Float),
53
+ (r'0x[0-9a-f]+[lu]*', Number.Hex),
54
+ (r'0[0-7]+[lu]*', Number.Oct),
55
+ (r'\d+[lu]*', Number.Integer),
56
+ (r'[~!%^&*+=|?:<>/-]+', Operator),
57
+ (r'[{}()\[\],.;]', Punctuation),
58
+ (r'[a-z_]\w*', Name),
59
+ ],
60
+ 'hash': [
61
+ (r'^#.*$', Comment.Preproc),
62
+ ],
63
+ 'types': [
64
+ (r'(RECORD|END)\D', Keyword.Declaration),
65
+ (r'((?:ASCII|BIG_ENDIAN|BOOLEAN|DATA|DECIMAL|EBCDIC|INTEGER|PATTERN|'
66
+ r'QSTRING|REAL|RECORD|RULE|SET OF|STRING|TOKEN|UDECIMAL|UNICODE|'
67
+ r'UNSIGNED|VARSTRING|VARUNICODE)\d*)(\s+)',
68
+ bygroups(Keyword.Type, Whitespace)),
69
+ ],
70
+ 'keywords': [
71
+ (words((
72
+ 'APPLY', 'ASSERT', 'BUILD', 'BUILDINDEX', 'EVALUATE', 'FAIL',
73
+ 'KEYDIFF', 'KEYPATCH', 'LOADXML', 'NOTHOR', 'NOTIFY', 'OUTPUT',
74
+ 'PARALLEL', 'SEQUENTIAL', 'SOAPCALL', 'CHECKPOINT', 'DEPRECATED',
75
+ 'FAILCODE', 'FAILMESSAGE', 'FAILURE', 'GLOBAL', 'INDEPENDENT',
76
+ 'ONWARNING', 'PERSIST', 'PRIORITY', 'RECOVERY', 'STORED', 'SUCCESS',
77
+ 'WAIT', 'WHEN'), suffix=r'\b'),
78
+ Keyword.Reserved),
79
+ # These are classed differently, check later
80
+ (words((
81
+ 'ALL', 'AND', 'ANY', 'AS', 'ATMOST', 'BEFORE', 'BEGINC++', 'BEST',
82
+ 'BETWEEN', 'CASE', 'CONST', 'COUNTER', 'CSV', 'DESCEND', 'ENCRYPT',
83
+ 'ENDC++', 'ENDMACRO', 'EXCEPT', 'EXCLUSIVE', 'EXPIRE', 'EXPORT',
84
+ 'EXTEND', 'FALSE', 'FEW', 'FIRST', 'FLAT', 'FULL', 'FUNCTION',
85
+ 'GROUP', 'HEADER', 'HEADING', 'HOLE', 'IFBLOCK', 'IMPORT', 'IN',
86
+ 'JOINED', 'KEEP', 'KEYED', 'LAST', 'LEFT', 'LIMIT', 'LOAD', 'LOCAL',
87
+ 'LOCALE', 'LOOKUP', 'MACRO', 'MANY', 'MAXCOUNT', 'MAXLENGTH',
88
+ 'MIN SKEW', 'MODULE', 'INTERFACE', 'NAMED', 'NOCASE', 'NOROOT',
89
+ 'NOSCAN', 'NOSORT', 'NOT', 'OF', 'ONLY', 'OPT', 'OR', 'OUTER',
90
+ 'OVERWRITE', 'PACKED', 'PARTITION', 'PENALTY', 'PHYSICALLENGTH',
91
+ 'PIPE', 'QUOTE', 'RELATIONSHIP', 'REPEAT', 'RETURN', 'RIGHT',
92
+ 'SCAN', 'SELF', 'SEPARATOR', 'SERVICE', 'SHARED', 'SKEW', 'SKIP',
93
+ 'SQL', 'STORE', 'TERMINATOR', 'THOR', 'THRESHOLD', 'TOKEN',
94
+ 'TRANSFORM', 'TRIM', 'TRUE', 'TYPE', 'UNICODEORDER', 'UNSORTED',
95
+ 'VALIDATE', 'VIRTUAL', 'WHOLE', 'WILD', 'WITHIN', 'XML', 'XPATH',
96
+ '__COMPRESSED__'), suffix=r'\b'),
97
+ Keyword.Reserved),
98
+ ],
99
+ 'functions': [
100
+ (words((
101
+ 'ABS', 'ACOS', 'ALLNODES', 'ASCII', 'ASIN', 'ASSTRING', 'ATAN',
102
+ 'ATAN2', 'AVE', 'CASE', 'CHOOSE', 'CHOOSEN', 'CHOOSESETS',
103
+ 'CLUSTERSIZE', 'COMBINE', 'CORRELATION', 'COS', 'COSH', 'COUNT',
104
+ 'COVARIANCE', 'CRON', 'DATASET', 'DEDUP', 'DEFINE', 'DENORMALIZE',
105
+ 'DISTRIBUTE', 'DISTRIBUTED', 'DISTRIBUTION', 'EBCDIC', 'ENTH',
106
+ 'ERROR', 'EVALUATE', 'EVENT', 'EVENTEXTRA', 'EVENTNAME', 'EXISTS',
107
+ 'EXP', 'FAILCODE', 'FAILMESSAGE', 'FETCH', 'FROMUNICODE',
108
+ 'GETISVALID', 'GLOBAL', 'GRAPH', 'GROUP', 'HASH', 'HASH32',
109
+ 'HASH64', 'HASHCRC', 'HASHMD5', 'HAVING', 'IF', 'INDEX',
110
+ 'INTFORMAT', 'ISVALID', 'ITERATE', 'JOIN', 'KEYUNICODE', 'LENGTH',
111
+ 'LIBRARY', 'LIMIT', 'LN', 'LOCAL', 'LOG', 'LOOP', 'MAP', 'MATCHED',
112
+ 'MATCHLENGTH', 'MATCHPOSITION', 'MATCHTEXT', 'MATCHUNICODE', 'MAX',
113
+ 'MERGE', 'MERGEJOIN', 'MIN', 'NOLOCAL', 'NONEMPTY', 'NORMALIZE',
114
+ 'PARSE', 'PIPE', 'POWER', 'PRELOAD', 'PROCESS', 'PROJECT', 'PULL',
115
+ 'RANDOM', 'RANGE', 'RANK', 'RANKED', 'REALFORMAT', 'RECORDOF',
116
+ 'REGEXFIND', 'REGEXREPLACE', 'REGROUP', 'REJECTED', 'ROLLUP',
117
+ 'ROUND', 'ROUNDUP', 'ROW', 'ROWDIFF', 'SAMPLE', 'SET', 'SIN',
118
+ 'SINH', 'SIZEOF', 'SOAPCALL', 'SORT', 'SORTED', 'SQRT', 'STEPPED',
119
+ 'STORED', 'SUM', 'TABLE', 'TAN', 'TANH', 'THISNODE', 'TOPN',
120
+ 'TOUNICODE', 'TRANSFER', 'TRIM', 'TRUNCATE', 'TYPEOF', 'UNGROUP',
121
+ 'UNICODEORDER', 'VARIANCE', 'WHICH', 'WORKUNIT', 'XMLDECODE',
122
+ 'XMLENCODE', 'XMLTEXT', 'XMLUNICODE'), suffix=r'\b'),
123
+ Name.Function),
124
+ ],
125
+ 'string': [
126
+ (r'"', String, '#pop'),
127
+ (r'\'', String, '#pop'),
128
+ (r'[^"\']+', String),
129
+ ],
130
+ }
131
+
132
+ def analyse_text(text):
133
+ """This is very difficult to guess relative to other business languages.
134
+ -> in conjunction with BEGIN/END seems relatively rare though."""
135
+ result = 0
136
+
137
+ if '->' in text:
138
+ result += 0.01
139
+ if 'BEGIN' in text:
140
+ result += 0.01
141
+ if 'END' in text:
142
+ result += 0.01
143
+
144
+ return result
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/gcodelexer.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.gcodelexer
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the G Code Language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups
12
+ from pygments.token import Comment, Name, Text, Keyword, Number
13
+
14
+ __all__ = ['GcodeLexer']
15
+
16
+
17
+ class GcodeLexer(RegexLexer):
18
+ """
19
+ For gcode source code.
20
+ """
21
+ name = 'g-code'
22
+ aliases = ['gcode']
23
+ filenames = ['*.gcode']
24
+ url = 'https://en.wikipedia.org/wiki/G-code'
25
+ version_added = '2.9'
26
+
27
+ tokens = {
28
+ 'root': [
29
+ (r';.*\n', Comment),
30
+ (r'^[gmGM]\d{1,4}\s', Name.Builtin), # M or G commands
31
+ (r'([^gGmM])([+-]?\d*[.]?\d+)', bygroups(Keyword, Number)),
32
+ (r'\s', Text.Whitespace),
33
+ (r'.*\n', Text),
34
+ ]
35
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/hexdump.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.hexdump
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for hexadecimal dumps.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, include
12
+ from pygments.token import Name, Number, String, Punctuation, Whitespace
13
+
14
+ __all__ = ['HexdumpLexer']
15
+
16
+
17
+ class HexdumpLexer(RegexLexer):
18
+ """
19
+ For typical hex dump output formats by the UNIX and GNU/Linux tools ``hexdump``,
20
+ ``hd``, ``hexcat``, ``od`` and ``xxd``, and the DOS tool ``DEBUG``. For example:
21
+
22
+ .. sourcecode:: hexdump
23
+
24
+ 00000000 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 |.ELF............|
25
+ 00000010 02 00 3e 00 01 00 00 00 c5 48 40 00 00 00 00 00 |..>......H@.....|
26
+
27
+ The specific supported formats are the outputs of:
28
+
29
+ * ``hexdump FILE``
30
+ * ``hexdump -C FILE`` -- the `canonical` format used in the example.
31
+ * ``hd FILE`` -- same as ``hexdump -C FILE``.
32
+ * ``hexcat FILE``
33
+ * ``od -t x1z FILE``
34
+ * ``xxd FILE``
35
+ * ``DEBUG.EXE FILE.COM`` and entering ``d`` to the prompt.
36
+ """
37
+ name = 'Hexdump'
38
+ aliases = ['hexdump']
39
+ url = 'https://en.wikipedia.org/wiki/Hex_dump'
40
+ version_added = '2.1'
41
+
42
+ hd = r'[0-9A-Ha-h]'
43
+
44
+ tokens = {
45
+ 'root': [
46
+ (r'\n', Whitespace),
47
+ include('offset'),
48
+ (r'('+hd+r'{2})(\-)('+hd+r'{2})',
49
+ bygroups(Number.Hex, Punctuation, Number.Hex)),
50
+ (hd+r'{2}', Number.Hex),
51
+ (r'(\s{2,3})(\>)(.{16})(\<)$',
52
+ bygroups(Whitespace, Punctuation, String, Punctuation), 'bracket-strings'),
53
+ (r'(\s{2,3})(\|)(.{16})(\|)$',
54
+ bygroups(Whitespace, Punctuation, String, Punctuation), 'piped-strings'),
55
+ (r'(\s{2,3})(\>)(.{1,15})(\<)$',
56
+ bygroups(Whitespace, Punctuation, String, Punctuation)),
57
+ (r'(\s{2,3})(\|)(.{1,15})(\|)$',
58
+ bygroups(Whitespace, Punctuation, String, Punctuation)),
59
+ (r'(\s{2,3})(.{1,15})$', bygroups(Whitespace, String)),
60
+ (r'(\s{2,3})(.{16}|.{20})$', bygroups(Whitespace, String), 'nonpiped-strings'),
61
+ (r'\s', Whitespace),
62
+ (r'^\*', Punctuation),
63
+ ],
64
+ 'offset': [
65
+ (r'^('+hd+'+)(:)', bygroups(Name.Label, Punctuation), 'offset-mode'),
66
+ (r'^'+hd+'+', Name.Label),
67
+ ],
68
+ 'offset-mode': [
69
+ (r'\s', Whitespace, '#pop'),
70
+ (hd+'+', Name.Label),
71
+ (r':', Punctuation)
72
+ ],
73
+ 'piped-strings': [
74
+ (r'\n', Whitespace),
75
+ include('offset'),
76
+ (hd+r'{2}', Number.Hex),
77
+ (r'(\s{2,3})(\|)(.{1,16})(\|)$',
78
+ bygroups(Whitespace, Punctuation, String, Punctuation)),
79
+ (r'\s', Whitespace),
80
+ (r'^\*', Punctuation),
81
+ ],
82
+ 'bracket-strings': [
83
+ (r'\n', Whitespace),
84
+ include('offset'),
85
+ (hd+r'{2}', Number.Hex),
86
+ (r'(\s{2,3})(\>)(.{1,16})(\<)$',
87
+ bygroups(Whitespace, Punctuation, String, Punctuation)),
88
+ (r'\s', Whitespace),
89
+ (r'^\*', Punctuation),
90
+ ],
91
+ 'nonpiped-strings': [
92
+ (r'\n', Whitespace),
93
+ include('offset'),
94
+ (r'('+hd+r'{2})(\-)('+hd+r'{2})',
95
+ bygroups(Number.Hex, Punctuation, Number.Hex)),
96
+ (hd+r'{2}', Number.Hex),
97
+ (r'(\s{19,})(.{1,20}?)$', bygroups(Whitespace, String)),
98
+ (r'(\s{2,3})(.{1,20})$', bygroups(Whitespace, String)),
99
+ (r'\s', Whitespace),
100
+ (r'^\*', Punctuation),
101
+ ],
102
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/ldap.py ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ldap
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Pygments lexers for LDAP.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+
14
+ from pygments.lexer import RegexLexer, bygroups, default
15
+ from pygments.token import Operator, Comment, Keyword, Literal, Name, String, \
16
+ Number, Punctuation, Whitespace, Escape
17
+
18
+ __all__ = ['LdifLexer', 'LdaprcLexer']
19
+
20
+
21
+ class LdifLexer(RegexLexer):
22
+
23
+ """
24
+ Lexer for LDIF
25
+ """
26
+
27
+ name = 'LDIF'
28
+ aliases = ['ldif']
29
+ filenames = ['*.ldif']
30
+ mimetypes = ["text/x-ldif"]
31
+ url = "https://datatracker.ietf.org/doc/html/rfc2849"
32
+ version_added = '2.17'
33
+
34
+ tokens = {
35
+ 'root': [
36
+ (r'\s*\n', Whitespace),
37
+ (r'(-)(\n)', bygroups(Punctuation, Whitespace)),
38
+ (r'(#.*)(\n)', bygroups(Comment.Single, Whitespace)),
39
+ (r'(version)(:)([ \t]*)(.*)([ \t]*\n)', bygroups(Keyword,
40
+ Punctuation, Whitespace, Number.Integer, Whitespace)),
41
+ (r'(control)(:)([ \t]*)([\.0-9]+)([ \t]+)((?:true|false)?)([ \t]*)',
42
+ bygroups(Keyword, Punctuation, Whitespace, Name.Other, Whitespace, Keyword, Whitespace), "after-control"),
43
+ (r'(deleteoldrdn)(:)([ \n]*)([0-1]+)([ \t]*\n)',
44
+ bygroups(Keyword, Punctuation, Whitespace, Number, Whitespace)),
45
+ (r'(add|delete|replace)(::?)(\s*)(.*)([ \t]*\n)', bygroups(
46
+ Keyword, Punctuation, Whitespace, Name.Attribute, Whitespace)),
47
+ (r'(changetype)(:)([ \t]*)([a-z]*)([ \t]*\n)',
48
+ bygroups(Keyword, Punctuation, Whitespace, Keyword, Whitespace)),
49
+ (r'(dn|newrdn)(::)', bygroups(Keyword, Punctuation), "base64-dn"),
50
+ (r'(dn|newrdn)(:)', bygroups(Keyword, Punctuation), "dn"),
51
+ (r'(objectclass)(:)([ \t]*)([^ \t\n]*)([ \t]*\n)', bygroups(
52
+ Keyword, Punctuation, Whitespace, Name.Class, Whitespace)),
53
+ (r'([a-zA-Z]*|[0-9][0-9\.]*[0-9])(;)',
54
+ bygroups(Name.Attribute, Punctuation), "property"),
55
+ (r'([a-zA-Z]*|[0-9][0-9\.]*[0-9])(:<)',
56
+ bygroups(Name.Attribute, Punctuation), "url"),
57
+ (r'([a-zA-Z]*|[0-9][0-9\.]*[0-9])(::?)',
58
+ bygroups(Name.Attribute, Punctuation), "value"),
59
+ ],
60
+ "after-control": [
61
+ (r":<", Punctuation, ("#pop", "url")),
62
+ (r"::?", Punctuation, ("#pop", "value")),
63
+ default("#pop"),
64
+ ],
65
+ 'property': [
66
+ (r'([-a-zA-Z0-9]*)(;)', bygroups(Name.Property, Punctuation)),
67
+ (r'([-a-zA-Z0-9]*)(:<)',
68
+ bygroups(Name.Property, Punctuation), ("#pop", "url")),
69
+ (r'([-a-zA-Z0-9]*)(::?)',
70
+ bygroups(Name.Property, Punctuation), ("#pop", "value")),
71
+ ],
72
+ 'value': [
73
+ (r'(\s*)([^\n]+\S)(\n )',
74
+ bygroups(Whitespace, String, Whitespace)),
75
+ (r'(\s*)([^\n]+\S)(\n)',
76
+ bygroups(Whitespace, String, Whitespace), "#pop"),
77
+ ],
78
+ 'url': [
79
+ (r'([ \t]*)(\S*)([ \t]*\n )',
80
+ bygroups(Whitespace, Comment.PreprocFile, Whitespace)),
81
+ (r'([ \t]*)(\S*)([ \t]*\n)', bygroups(Whitespace,
82
+ Comment.PreprocFile, Whitespace), "#pop"),
83
+ ],
84
+ "dn": [
85
+ (r'([ \t]*)([-a-zA-Z0-9\.]+)(=)', bygroups(Whitespace,
86
+ Name.Attribute, Operator), ("#pop", "dn-value")),
87
+ ],
88
+ "dn-value": [
89
+ (r'\\[^\n]', Escape),
90
+ (r',', Punctuation, ("#pop", "dn")),
91
+ (r'\+', Operator, ("#pop", "dn")),
92
+ (r'[^,\+\n]+', String),
93
+ (r'\n ', Whitespace),
94
+ (r'\n', Whitespace, "#pop"),
95
+ ],
96
+ "base64-dn": [
97
+ (r'([ \t]*)([^ \t\n][^ \t\n]*[^\n])([ \t]*\n )',
98
+ bygroups(Whitespace, Name, Whitespace)),
99
+ (r'([ \t]*)([^ \t\n][^ \t\n]*[^\n])([ \t]*\n)',
100
+ bygroups(Whitespace, Name, Whitespace), "#pop"),
101
+ ]
102
+ }
103
+
104
+
105
+ class LdaprcLexer(RegexLexer):
106
+ """
107
+ Lexer for OpenLDAP configuration files.
108
+ """
109
+
110
+ name = 'LDAP configuration file'
111
+ aliases = ['ldapconf', 'ldaprc']
112
+ filenames = ['.ldaprc', 'ldaprc', 'ldap.conf']
113
+ mimetypes = ["text/x-ldapconf"]
114
+ url = 'https://www.openldap.org/software//man.cgi?query=ldap.conf&sektion=5&apropos=0&manpath=OpenLDAP+2.4-Release'
115
+ version_added = '2.17'
116
+
117
+ _sasl_keywords = r'SASL_(?:MECH|REALM|AUTHCID|AUTHZID|CBINDING)'
118
+ _tls_keywords = r'TLS_(?:CACERT|CACERTDIR|CERT|ECNAME|KEY|CIPHER_SUITE|PROTOCOL_MIN|RANDFILE|CRLFILE)'
119
+ _literal_keywords = rf'(?:URI|SOCKET_BIND_ADDRESSES|{_sasl_keywords}|{_tls_keywords})'
120
+ _boolean_keywords = r'GSSAPI_(?:ALLOW_REMOTE_PRINCIPAL|ENCRYPT|SIGN)|REFERRALS|SASL_NOCANON'
121
+ _integer_keywords = r'KEEPALIVE_(?:IDLE|PROBES|INTERVAL)|NETWORK_TIMEOUT|PORT|SIZELIMIT|TIMELIMIT|TIMEOUT'
122
+ _secprops = r'none|noanonymous|noplain|noactive|nodict|forwardsec|passcred|(?:minssf|maxssf|maxbufsize)=\d+'
123
+
124
+ flags = re.IGNORECASE | re.MULTILINE
125
+
126
+ tokens = {
127
+ 'root': [
128
+ (r'#.*', Comment.Single),
129
+ (r'\s+', Whitespace),
130
+ (rf'({_boolean_keywords})(\s+)(on|true|yes|off|false|no)$',
131
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
132
+ (rf'({_integer_keywords})(\s+)(\d+)',
133
+ bygroups(Keyword, Whitespace, Number.Integer)),
134
+ (r'(VERSION)(\s+)(2|3)', bygroups(Keyword, Whitespace, Number.Integer)),
135
+ # Constants
136
+ (r'(DEREF)(\s+)(never|searching|finding|always)',
137
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
138
+ (rf'(SASL_SECPROPS)(\s+)((?:{_secprops})(?:,{_secprops})*)',
139
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
140
+ (r'(SASL_CBINDING)(\s+)(none|tls-unique|tls-endpoint)',
141
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
142
+ (r'(TLS_REQ(?:CERT|SAN))(\s+)(allow|demand|hard|never|try)',
143
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
144
+ (r'(TLS_CRLCHECK)(\s+)(none|peer|all)',
145
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
146
+ # Literals
147
+ (r'(BASE|BINDDN)(\s+)(\S+)$',
148
+ bygroups(Keyword, Whitespace, Literal)),
149
+ # Accepts hostname with or without port.
150
+ (r'(HOST)(\s+)([a-z0-9]+)((?::(\d+))?)',
151
+ bygroups(Keyword, Whitespace, Literal, Number.Integer)),
152
+ (rf'({_literal_keywords})(\s+)(\S+)$',
153
+ bygroups(Keyword, Whitespace, Literal)),
154
+ ],
155
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/mips.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.mips
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for MIPS assembly.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words
12
+ from pygments.token import Whitespace, Comment, String, Keyword, Name, Text
13
+
14
+ __all__ = ["MIPSLexer"]
15
+
16
+
17
+ class MIPSLexer(RegexLexer):
18
+ """
19
+ A MIPS Assembly Lexer.
20
+
21
+ Based on the Emacs major mode by hlissner:
22
+ https://github.com/hlissner/emacs-mips-mode
23
+ """
24
+
25
+ name = 'MIPS'
26
+ aliases = ['mips']
27
+ version_added = ''
28
+ # TODO: add '*.s' and '*.asm', which will require designing an analyse_text
29
+ # method for this lexer and refactoring those from Gas and Nasm in order to
30
+ # have relatively reliable detection
31
+ filenames = ['*.mips', '*.MIPS']
32
+ url = 'https://mips.com'
33
+
34
+ keywords = [
35
+ # Arithmetic insturctions
36
+ "add", "sub", "subu", "addi", "subi", "addu", "addiu",
37
+ # Multiplication/division
38
+ "mul", "mult", "multu", "mulu", "madd", "maddu", "msub", "msubu", "div", "divu",
39
+ # Bitwise operations
40
+ "and", "or", "nor", "xor", "andi", "ori", "xori", "clo", "clz",
41
+ # Shifts
42
+ "sll", "srl", "sllv", "srlv", "sra", "srav",
43
+ # Comparisons
44
+ "slt", "sltu", "slti", "sltiu",
45
+ # Move data
46
+ "mfhi", "mthi", "mflo", "mtlo", "movn", "movz", "movf", "movt",
47
+ # Jump
48
+ "j", "jal", "jalr", "jr",
49
+ # branch
50
+ "bc1f", "bc1t", "beq", "bgez", "bgezal", "bgtz", "blez", "bltzal", "bltz", "bne",
51
+ # Load
52
+ "lui", "lb", "lbu", "lh", "lhu", "lw", "lwcl", "lwl", "lwr",
53
+ # Store
54
+ "sb", "sh", "sw", "swl", "swr", # coproc: swc1 sdc1
55
+ # Concurrent load/store
56
+ "ll", "sc",
57
+ # Trap handling
58
+ "teq", "teqi", "tne", "tneqi", "tge", "tgeu", "tgei", "tgeiu", "tlt", "tltu", "tlti",
59
+ "tltiu",
60
+ # Exception / Interrupt
61
+ "eret", "break", "bop", "syscall",
62
+ # --- Floats -----------------------------------------------------
63
+ # Arithmetic
64
+ "add.s", "add.d", "sub.s", "sub.d", "mul.s", "mul.d", "div.s", "div.d", "neg.d",
65
+ "neg.s",
66
+ # Comparison
67
+ "c.e.d", "c.e.s", "c.le.d", "c.le.s", "c.lt.s", "c.lt.d", # "c.gt.s", "c.gt.d",
68
+ "madd.s", "madd.d", "msub.s", "msub.d",
69
+ # Move Floats
70
+ "mov.d", "move.s", "movf.d", "movf.s", "movt.d", "movt.s", "movn.d", "movn.s",
71
+ "movnzd", "movz.s", "movz.d",
72
+ # Conversion
73
+ "cvt.d.s", "cvt.d.w", "cvt.s.d", "cvt.s.w", "cvt.w.d", "cvt.w.s", "trunc.w.d",
74
+ "trunc.w.s",
75
+ # Math
76
+ "abs.s", "abs.d", "sqrt.s", "sqrt.d", "ceil.w.d", "ceil.w.s", "floor.w.d",
77
+ "floor.w.s", "round.w.d", "round.w.s",
78
+ ]
79
+
80
+ pseudoinstructions = [
81
+ # Arithmetic & logical
82
+ "rem", "remu", "mulo", "mulou", "abs", "neg", "negu", "not", "rol", "ror",
83
+ # branches
84
+ "b", "beqz", "bge", "bgeu", "bgt", "bgtu", "ble", "bleu", "blt", "bltu", "bnez",
85
+ # loads
86
+ "la", "li", "ld", "ulh", "ulhu", "ulw",
87
+ # Store
88
+ "sd", "ush", "usw",
89
+ # move
90
+ "move", # coproc: "mfc1.d",
91
+ # comparisons
92
+ "sgt", "sgtu", "sge", "sgeu", "sle", "sleu", "sne", "seq",
93
+ # --- Floats -----------------------------------------------------
94
+ # load-store
95
+ "l.d", "l.s", "s.d", "s.s",
96
+ ]
97
+
98
+ directives = [
99
+ ".align", ".ascii", ".asciiz", ".byte", ".data", ".double", ".extern", ".float",
100
+ ".globl", ".half", ".kdata", ".ktext", ".space", ".text", ".word",
101
+ ]
102
+
103
+ deprecated = [
104
+ "beql", "bnel", "bgtzl", "bgezl", "bltzl", "blezl", "bltzall", "bgezall",
105
+ ]
106
+
107
+ tokens = {
108
+ 'root': [
109
+ (r'\s+', Whitespace),
110
+ (r'#.*', Comment),
111
+ (r'"', String, 'string'),
112
+ (r'-?[0-9]+?', Keyword.Constant),
113
+ (r'\w*:', Name.Function),
114
+ (words(deprecated, suffix=r'\b'), Keyword.Pseudo), # need warning face
115
+ (words(pseudoinstructions, suffix=r'\b'), Name.Variable),
116
+ (words(keywords, suffix=r'\b'), Keyword),
117
+ (r'[slm][ftwd]c[0-9]([.]d)?', Keyword),
118
+ (r'\$(f?[0-2][0-9]|f?3[01]|[ft]?[0-9]|[vk][01]|a[0-3]|s[0-7]|[gsf]p|ra|at|zero)',
119
+ Keyword.Type),
120
+ (words(directives, suffix=r'\b'), Name.Entity), # Preprocessor?
121
+ (r':|,|;|\{|\}|=>|@|\$|=', Name.Builtin),
122
+ (r'\w+', Text),
123
+ (r'.', Text),
124
+ ],
125
+ 'string': [
126
+ (r'\\.', String.Escape),
127
+ (r'"', String, '#pop'),
128
+ (r'[^\\"]+', String),
129
+ ],
130
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/other.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.other
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Just export lexer classes previously contained in this module.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ # ruff: noqa: F401
12
+ from pygments.lexers.sql import SqlLexer, MySqlLexer, SqliteConsoleLexer
13
+ from pygments.lexers.shell import BashLexer, BashSessionLexer, BatchLexer, \
14
+ TcshLexer
15
+ from pygments.lexers.robotframework import RobotFrameworkLexer
16
+ from pygments.lexers.testing import GherkinLexer
17
+ from pygments.lexers.esoteric import BrainfuckLexer, BefungeLexer, RedcodeLexer
18
+ from pygments.lexers.prolog import LogtalkLexer
19
+ from pygments.lexers.snobol import SnobolLexer
20
+ from pygments.lexers.rebol import RebolLexer
21
+ from pygments.lexers.configs import KconfigLexer, Cfengine3Lexer
22
+ from pygments.lexers.modeling import ModelicaLexer
23
+ from pygments.lexers.scripting import AppleScriptLexer, MOOCodeLexer, \
24
+ HybrisLexer
25
+ from pygments.lexers.graphics import PostScriptLexer, GnuplotLexer, \
26
+ AsymptoteLexer, PovrayLexer
27
+ from pygments.lexers.business import ABAPLexer, OpenEdgeLexer, \
28
+ GoodDataCLLexer, MaqlLexer
29
+ from pygments.lexers.automation import AutoItLexer, AutohotkeyLexer
30
+ from pygments.lexers.dsls import ProtoBufLexer, BroLexer, PuppetLexer, \
31
+ MscgenLexer, VGLLexer
32
+ from pygments.lexers.basic import CbmBasicV2Lexer
33
+ from pygments.lexers.pawn import SourcePawnLexer, PawnLexer
34
+ from pygments.lexers.ecl import ECLLexer
35
+ from pygments.lexers.urbi import UrbiscriptLexer
36
+ from pygments.lexers.smalltalk import SmalltalkLexer, NewspeakLexer
37
+ from pygments.lexers.installers import NSISLexer, RPMSpecLexer
38
+ from pygments.lexers.textedit import AwkLexer
39
+ from pygments.lexers.smv import NuSMVLexer
40
+
41
+ __all__ = []
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/qlik.py ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.qlik
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the qlik scripting language
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, words
14
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
15
+ Punctuation, String, Text
16
+ from pygments.lexers._qlik_builtins import OPERATORS_LIST, STATEMENT_LIST, \
17
+ SCRIPT_FUNCTIONS, CONSTANT_LIST
18
+
19
+ __all__ = ["QlikLexer"]
20
+
21
+
22
+ class QlikLexer(RegexLexer):
23
+ """
24
+ Lexer for qlik code, including .qvs files
25
+ """
26
+
27
+ name = "Qlik"
28
+ aliases = ["qlik", "qlikview", "qliksense", "qlikscript"]
29
+ filenames = ["*.qvs", "*.qvw"]
30
+ url = "https://qlik.com"
31
+ version_added = '2.12'
32
+
33
+ flags = re.IGNORECASE
34
+
35
+ tokens = {
36
+ # Handle multi-line comments
37
+ "comment": [
38
+ (r"\*/", Comment.Multiline, "#pop"),
39
+ (r"[^*]+", Comment.Multiline),
40
+ ],
41
+ # Handle numbers
42
+ "numerics": [
43
+ (r"\b\d+\.\d+(e\d+)?[fd]?\b", Number.Float),
44
+ (r"\b\d+\b", Number.Integer),
45
+ ],
46
+ # Handle variable names in things
47
+ "interp": [
48
+ (
49
+ r"(\$\()(\w+)(\))",
50
+ bygroups(String.Interpol, Name.Variable, String.Interpol),
51
+ ),
52
+ ],
53
+ # Handle strings
54
+ "string": [
55
+ (r"'", String, "#pop"),
56
+ include("interp"),
57
+ (r"[^'$]+", String),
58
+ (r"\$", String),
59
+ ],
60
+ #
61
+ "assignment": [
62
+ (r";", Punctuation, "#pop"),
63
+ include("root"),
64
+ ],
65
+ "field_name_quote": [
66
+ (r'"', String.Symbol, "#pop"),
67
+ include("interp"),
68
+ (r"[^\"$]+", String.Symbol),
69
+ (r"\$", String.Symbol),
70
+ ],
71
+ "field_name_bracket": [
72
+ (r"\]", String.Symbol, "#pop"),
73
+ include("interp"),
74
+ (r"[^\]$]+", String.Symbol),
75
+ (r"\$", String.Symbol),
76
+ ],
77
+ "function": [(r"\)", Punctuation, "#pop"), include("root")],
78
+ "root": [
79
+ # Whitespace and comments
80
+ (r"\s+", Text.Whitespace),
81
+ (r"/\*", Comment.Multiline, "comment"),
82
+ (r"//.*\n", Comment.Single),
83
+ # variable assignment
84
+ (r"(let|set)(\s+)", bygroups(Keyword.Declaration, Text.Whitespace),
85
+ "assignment"),
86
+ # Word operators
87
+ (words(OPERATORS_LIST["words"], prefix=r"\b", suffix=r"\b"),
88
+ Operator.Word),
89
+ # Statements
90
+ (words(STATEMENT_LIST, suffix=r"\b"), Keyword),
91
+ # Table names
92
+ (r"[a-z]\w*:", Keyword.Declaration),
93
+ # Constants
94
+ (words(CONSTANT_LIST, suffix=r"\b"), Keyword.Constant),
95
+ # Functions
96
+ (words(SCRIPT_FUNCTIONS, suffix=r"(?=\s*\()"), Name.Builtin,
97
+ "function"),
98
+ # interpolation - e.g. $(variableName)
99
+ include("interp"),
100
+ # Quotes denote a field/file name
101
+ (r'"', String.Symbol, "field_name_quote"),
102
+ # Square brackets denote a field/file name
103
+ (r"\[", String.Symbol, "field_name_bracket"),
104
+ # Strings
105
+ (r"'", String, "string"),
106
+ # Numbers
107
+ include("numerics"),
108
+ # Operator symbols
109
+ (words(OPERATORS_LIST["symbols"]), Operator),
110
+ # Strings denoted by single quotes
111
+ (r"'.+?'", String),
112
+ # Words as text
113
+ (r"\b\w+\b", Text),
114
+ # Basic punctuation
115
+ (r"[,;.()\\/]", Punctuation),
116
+ ],
117
+ }
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/special.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.special
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Special lexers.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import ast
12
+
13
+ from pygments.lexer import Lexer, line_re
14
+ from pygments.token import Token, Error, Text, Generic
15
+ from pygments.util import get_choice_opt
16
+
17
+
18
+ __all__ = ['TextLexer', 'OutputLexer', 'RawTokenLexer']
19
+
20
+
21
+ class TextLexer(Lexer):
22
+ """
23
+ "Null" lexer, doesn't highlight anything.
24
+ """
25
+ name = 'Text only'
26
+ aliases = ['text']
27
+ filenames = ['*.txt']
28
+ mimetypes = ['text/plain']
29
+ url = ""
30
+ version_added = ''
31
+
32
+ priority = 0.01
33
+
34
+ def get_tokens_unprocessed(self, text):
35
+ yield 0, Text, text
36
+
37
+ def analyse_text(text):
38
+ return TextLexer.priority
39
+
40
+
41
+ class OutputLexer(Lexer):
42
+ """
43
+ Simple lexer that highlights everything as ``Token.Generic.Output``.
44
+ """
45
+ name = 'Text output'
46
+ aliases = ['output']
47
+ url = ""
48
+ version_added = '2.10'
49
+ _example = "output/output"
50
+
51
+ def get_tokens_unprocessed(self, text):
52
+ yield 0, Generic.Output, text
53
+
54
+
55
+ _ttype_cache = {}
56
+
57
+
58
+ class RawTokenLexer(Lexer):
59
+ """
60
+ Recreate a token stream formatted with the `RawTokenFormatter`.
61
+
62
+ Additional options accepted:
63
+
64
+ `compress`
65
+ If set to ``"gz"`` or ``"bz2"``, decompress the token stream with
66
+ the given compression algorithm before lexing (default: ``""``).
67
+ """
68
+ name = 'Raw token data'
69
+ aliases = []
70
+ filenames = []
71
+ mimetypes = ['application/x-pygments-tokens']
72
+ url = 'https://pygments.org/docs/formatters/#RawTokenFormatter'
73
+ version_added = ''
74
+
75
+ def __init__(self, **options):
76
+ self.compress = get_choice_opt(options, 'compress',
77
+ ['', 'none', 'gz', 'bz2'], '')
78
+ Lexer.__init__(self, **options)
79
+
80
+ def get_tokens(self, text):
81
+ if self.compress:
82
+ if isinstance(text, str):
83
+ text = text.encode('latin1')
84
+ try:
85
+ if self.compress == 'gz':
86
+ import gzip
87
+ text = gzip.decompress(text)
88
+ elif self.compress == 'bz2':
89
+ import bz2
90
+ text = bz2.decompress(text)
91
+ except OSError:
92
+ yield Error, text.decode('latin1')
93
+ if isinstance(text, bytes):
94
+ text = text.decode('latin1')
95
+
96
+ # do not call Lexer.get_tokens() because stripping is not optional.
97
+ text = text.strip('\n') + '\n'
98
+ for i, t, v in self.get_tokens_unprocessed(text):
99
+ yield t, v
100
+
101
+ def get_tokens_unprocessed(self, text):
102
+ length = 0
103
+ for match in line_re.finditer(text):
104
+ try:
105
+ ttypestr, val = match.group().rstrip().split('\t', 1)
106
+ ttype = _ttype_cache.get(ttypestr)
107
+ if not ttype:
108
+ ttype = Token
109
+ ttypes = ttypestr.split('.')[1:]
110
+ for ttype_ in ttypes:
111
+ if not ttype_ or not ttype_[0].isupper():
112
+ raise ValueError('malformed token name')
113
+ ttype = getattr(ttype, ttype_)
114
+ _ttype_cache[ttypestr] = ttype
115
+ val = ast.literal_eval(val)
116
+ if not isinstance(val, str):
117
+ raise ValueError('expected str')
118
+ except (SyntaxError, ValueError):
119
+ val = match.group()
120
+ ttype = Error
121
+ yield length, ttype, val
122
+ length += len(val)
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/tal.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.tal
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Uxntal
6
+
7
+ .. versionadded:: 2.12
8
+
9
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
10
+ :license: BSD, see LICENSE for details.
11
+ """
12
+
13
+ from pygments.lexer import RegexLexer, words
14
+ from pygments.token import Comment, Keyword, Name, String, Number, \
15
+ Punctuation, Whitespace, Literal
16
+
17
+ __all__ = ['TalLexer']
18
+
19
+
20
+ class TalLexer(RegexLexer):
21
+ """
22
+ For Uxntal source code.
23
+ """
24
+
25
+ name = 'Tal'
26
+ aliases = ['tal', 'uxntal']
27
+ filenames = ['*.tal']
28
+ mimetypes = ['text/x-uxntal']
29
+ url = 'https://wiki.xxiivv.com/site/uxntal.html'
30
+ version_added = '2.12'
31
+
32
+ instructions = [
33
+ 'BRK', 'LIT', 'INC', 'POP', 'DUP', 'NIP', 'SWP', 'OVR', 'ROT',
34
+ 'EQU', 'NEQ', 'GTH', 'LTH', 'JMP', 'JCN', 'JSR', 'STH',
35
+ 'LDZ', 'STZ', 'LDR', 'STR', 'LDA', 'STA', 'DEI', 'DEO',
36
+ 'ADD', 'SUB', 'MUL', 'DIV', 'AND', 'ORA', 'EOR', 'SFT'
37
+ ]
38
+
39
+ tokens = {
40
+ # the comment delimiters must not be adjacent to non-space characters.
41
+ # this means ( foo ) is a valid comment but (foo) is not. this also
42
+ # applies to nested comments.
43
+ 'comment': [
44
+ (r'(?<!\S)\((?!\S)', Comment.Multiline, '#push'), # nested comments
45
+ (r'(?<!\S)\)(?!\S)', Comment.Multiline, '#pop'), # nested comments
46
+ (r'[^()]+', Comment.Multiline), # comments
47
+ (r'[()]+', Comment.Multiline), # comments
48
+ ],
49
+ 'root': [
50
+ (r'\s+', Whitespace), # spaces
51
+ (r'(?<!\S)\((?!\S)', Comment.Multiline, 'comment'), # comments
52
+ (words(instructions, prefix=r'(?<!\S)', suffix=r'2?k?r?(?!\S)'),
53
+ Keyword.Reserved), # instructions
54
+ (r'[][{}](?!\S)', Punctuation), # delimiters
55
+ (r'#([0-9a-f]{2}){1,2}(?!\S)', Number.Hex), # integer
56
+ (r'"\S+', String), # raw string
57
+ (r'([0-9a-f]{2}){1,2}(?!\S)', Literal), # raw integer
58
+ (r'[|$][0-9a-f]{1,4}(?!\S)', Keyword.Declaration), # abs/rel pad
59
+ (r'%\S+', Name.Decorator), # macro
60
+ (r'@\S+', Name.Function), # label
61
+ (r'&\S+', Name.Label), # sublabel
62
+ (r'/\S+', Name.Tag), # spacer
63
+ (r'\.\S+', Name.Variable.Magic), # literal zero page addr
64
+ (r',\S+', Name.Variable.Instance), # literal rel addr
65
+ (r';\S+', Name.Variable.Global), # literal abs addr
66
+ (r'-\S+', Literal), # raw zero page addr
67
+ (r'_\S+', Literal), # raw relative addr
68
+ (r'=\S+', Literal), # raw absolute addr
69
+ (r'!\S+', Name.Function), # immediate jump
70
+ (r'\?\S+', Name.Function), # conditional immediate jump
71
+ (r'~\S+', Keyword.Namespace), # include
72
+ (r'\S+', Name.Function), # macro invocation, immediate subroutine
73
+ ]
74
+ }
75
+
76
+ def analyse_text(text):
77
+ return '|0100' in text[:500]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/text.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.text
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for non-source code file types.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ # ruff: noqa: F401
12
+ from pygments.lexers.configs import ApacheConfLexer, NginxConfLexer, \
13
+ SquidConfLexer, LighttpdConfLexer, IniLexer, RegeditLexer, PropertiesLexer, \
14
+ UnixConfigLexer
15
+ from pygments.lexers.console import PyPyLogLexer
16
+ from pygments.lexers.textedit import VimLexer
17
+ from pygments.lexers.markup import BBCodeLexer, MoinWikiLexer, RstLexer, \
18
+ TexLexer, GroffLexer
19
+ from pygments.lexers.installers import DebianControlLexer, DebianSourcesLexer, SourcesListLexer
20
+ from pygments.lexers.make import MakefileLexer, BaseMakefileLexer, CMakeLexer
21
+ from pygments.lexers.haxe import HxmlLexer
22
+ from pygments.lexers.sgf import SmartGameFormatLexer
23
+ from pygments.lexers.diff import DiffLexer, DarcsPatchLexer
24
+ from pygments.lexers.data import YamlLexer
25
+ from pygments.lexers.textfmts import IrcLogsLexer, GettextLexer, HttpLexer
26
+
27
+ __all__ = []
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/pygments/lexers/web.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.web
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Just export previously exported lexers.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ # ruff: noqa: F401
12
+ from pygments.lexers.html import HtmlLexer, DtdLexer, XmlLexer, XsltLexer, \
13
+ HamlLexer, ScamlLexer, JadeLexer
14
+ from pygments.lexers.css import CssLexer, SassLexer, ScssLexer
15
+ from pygments.lexers.javascript import JavascriptLexer, LiveScriptLexer, \
16
+ DartLexer, TypeScriptLexer, LassoLexer, ObjectiveJLexer, CoffeeScriptLexer
17
+ from pygments.lexers.actionscript import ActionScriptLexer, \
18
+ ActionScript3Lexer, MxmlLexer
19
+ from pygments.lexers.php import PhpLexer
20
+ from pygments.lexers.webmisc import DuelLexer, XQueryLexer, SlimLexer, QmlLexer
21
+ from pygments.lexers.data import JsonLexer
22
+ JSONLexer = JsonLexer # for backwards compatibility with Pygments 1.5
23
+
24
+ __all__ = []
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/tokenizers-0.22.2.dist-info/RECORD ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tokenizers-0.22.2.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
2
+ tokenizers-0.22.2.dist-info/METADATA,sha256=FaXdr0ifWSt34Kk0wO60a1ETCpQGTKEpIyr9sKOGjvw,7254
3
+ tokenizers-0.22.2.dist-info/RECORD,,
4
+ tokenizers-0.22.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ tokenizers-0.22.2.dist-info/WHEEL,sha256=5mwg5nCvp3YrLxikUrE5E0HBDKerMOoBBb70NjCncME,143
6
+ tokenizers/__init__.py,sha256=FI7LEi8_7gO-mrsf4hPdhfvGkb8q0rQ3_1MVM3gaajo,2639
7
+ tokenizers/__init__.pyi,sha256=MKWF2m4mz7IG1bPTdJ7AjXkQDNzkmQSLMmACQ2VUYJU,55891
8
+ tokenizers/decoders/__init__.py,sha256=hfwM6CFUDvlMGGL4-xsaaYz81K9P5rQI5ZL5UHWK8Y4,372
9
+ tokenizers/decoders/__init__.pyi,sha256=T60mFckMbS8YrsonOAPtfvb7VYHUJi9mm47Wd8pT62o,12019
10
+ tokenizers/implementations/__init__.py,sha256=VzAsplaIo7rl4AFO8Miu7ig7MfZjvonwVblZw01zR6M,310
11
+ tokenizers/implementations/base_tokenizer.py,sha256=PtQ2TSmoMGlTpL8oc8fDvwJVIY6isWGmps9comzsWjE,15806
12
+ tokenizers/implementations/bert_wordpiece.py,sha256=sKCum0FKPYdSgJFJN8LDerVBoTDRSqyqSdrcm-lvQqI,5520
13
+ tokenizers/implementations/byte_level_bpe.py,sha256=iBepM_z1s5Ky7zFDVrYLc3L5byYrIouk7-k0JGuF10s,4272
14
+ tokenizers/implementations/char_level_bpe.py,sha256=Nag_HFq8Rvcucqi8MhV1-0xtoR0C7FjHOecFVURL7ss,5449
15
+ tokenizers/implementations/sentencepiece_bpe.py,sha256=c08fKf6i92E2RsKgsxy7LzZfYX8-MACHSRG8U_I5ytY,3721
16
+ tokenizers/implementations/sentencepiece_unigram.py,sha256=2RoIfFVpiMkJOtOCskM_VCeCELWaC_bNnds6GvtE0KQ,7630
17
+ tokenizers/models/__init__.py,sha256=eJZ4HTAQZpxnKILNylWaTFqxXy-Ba6OKswWN47feeV8,176
18
+ tokenizers/models/__init__.pyi,sha256=2gZPQR1Z5_krTzLXx-ts5ai7Fz7bTZ0QI1OSJ5MyOuc,19517
19
+ tokenizers/normalizers/__init__.py,sha256=_06w4cqRItveEgIddYaLMScgkSOkIAMIzYCesb5AA4U,841
20
+ tokenizers/normalizers/__init__.pyi,sha256=6zYmbFtvdF1WhoWQSdEN974mxHjc7ZwJBA0TI2dJk98,25709
21
+ tokenizers/pre_tokenizers/__init__.py,sha256=KV9-EsAykGENUUzkGWCbv4n6YM6hYa1hfnY-gzBpMNE,598
22
+ tokenizers/pre_tokenizers/__init__.pyi,sha256=_pc34-Kd2N7Nvs7vTHPULBKjm18iJRM9qLOClVHw9n4,31566
23
+ tokenizers/processors/__init__.py,sha256=xM2DEKwKtHIumHsszM8AMkq-AlaqvBZFXWgLU8SNhOY,307
24
+ tokenizers/processors/__init__.pyi,sha256=5L5OBZ7SXCg7AEy51jyDHViaCSHG5c7vW4eWjSVQbUs,14348
25
+ tokenizers/tokenizers.abi3.so,sha256=wRb88egNRhzgo1wzKXTyWUnoNZQW9Qs9UzcYENLOHMw,10074176
26
+ tokenizers/tokenizers.pyi,sha256=Mq4G5RcxKiVc0FZd_Omi-bT7YQMRc-iDBU_nPCmCZOA,468
27
+ tokenizers/tools/__init__.py,sha256=xG8caB9OHC8cbB01S5vYV14HZxhO6eWbLehsb70ppio,55
28
+ tokenizers/tools/visualizer-styles.css,sha256=zAydq1oGWD8QEll4-eyL8Llw0B1sty_hpIE3tYxL02k,4850
29
+ tokenizers/tools/visualizer.py,sha256=jtxka01phNP47uQSocIQFO_DMnL3ZHdwohGVDqqYJPo,14834
30
+ tokenizers/trainers/__init__.py,sha256=UTu22AGcp76IvpW45xLRbJWET04NxPW6NfCb2YYz0EM,248
31
+ tokenizers/trainers/__init__.pyi,sha256=jKtDNXnoX6FWeCTeHz-W62Cj2_JErgYG7h1PReUz1rU,10719
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/tqdm/contrib/__init__.py ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Thin wrappers around common functions.
3
+
4
+ Subpackages contain potentially unstable extensions.
5
+ """
6
+ from warnings import warn
7
+
8
+ from ..auto import tqdm as tqdm_auto
9
+ from ..std import TqdmDeprecationWarning, tqdm
10
+ from ..utils import ObjectWrapper
11
+
12
+ __author__ = {"github.com/": ["casperdcl"]}
13
+ __all__ = ['tenumerate', 'tzip', 'tmap']
14
+
15
+
16
+ class DummyTqdmFile(ObjectWrapper):
17
+ """Dummy file-like that will write to tqdm"""
18
+
19
+ def __init__(self, wrapped):
20
+ super().__init__(wrapped)
21
+ self._buf = []
22
+
23
+ def write(self, x, nolock=False):
24
+ nl = b"\n" if isinstance(x, bytes) else "\n"
25
+ pre, sep, post = x.rpartition(nl)
26
+ if sep:
27
+ blank = type(nl)()
28
+ tqdm.write(blank.join(self._buf + [pre, sep]),
29
+ end=blank, file=self._wrapped, nolock=nolock)
30
+ self._buf = [post]
31
+ else:
32
+ self._buf.append(x)
33
+
34
+ def __del__(self):
35
+ if self._buf:
36
+ blank = type(self._buf[0])()
37
+ try:
38
+ tqdm.write(blank.join(self._buf), end=blank, file=self._wrapped)
39
+ except (OSError, ValueError):
40
+ pass
41
+
42
+
43
+ def builtin_iterable(func):
44
+ """Returns `func`"""
45
+ warn("This function has no effect, and will be removed in tqdm==5.0.0",
46
+ TqdmDeprecationWarning, stacklevel=2)
47
+ return func
48
+
49
+
50
+ def tenumerate(iterable, start=0, total=None, tqdm_class=tqdm_auto, **tqdm_kwargs):
51
+ """
52
+ Equivalent of `numpy.ndenumerate` or builtin `enumerate`.
53
+
54
+ Parameters
55
+ ----------
56
+ tqdm_class : [default: tqdm.auto.tqdm].
57
+ """
58
+ try:
59
+ import numpy as np
60
+ except ImportError:
61
+ pass
62
+ else:
63
+ if isinstance(iterable, np.ndarray):
64
+ return tqdm_class(np.ndenumerate(iterable), total=total or iterable.size,
65
+ **tqdm_kwargs)
66
+ return enumerate(tqdm_class(iterable, total=total, **tqdm_kwargs), start)
67
+
68
+
69
+ def tzip(iter1, *iter2plus, **tqdm_kwargs):
70
+ """
71
+ Equivalent of builtin `zip`.
72
+
73
+ Parameters
74
+ ----------
75
+ tqdm_class : [default: tqdm.auto.tqdm].
76
+ """
77
+ kwargs = tqdm_kwargs.copy()
78
+ tqdm_class = kwargs.pop("tqdm_class", tqdm_auto)
79
+ yield from zip(tqdm_class(iter1, **kwargs), *iter2plus)
80
+
81
+
82
+ def tmap(function, *sequences, **tqdm_kwargs):
83
+ """
84
+ Equivalent of builtin `map`.
85
+
86
+ Parameters
87
+ ----------
88
+ tqdm_class : [default: tqdm.auto.tqdm].
89
+ """
90
+ for i in tzip(*sequences, **tqdm_kwargs):
91
+ yield function(*i)
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/tqdm/contrib/bells.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Even more features than `tqdm.auto` (all the bells & whistles):
3
+
4
+ - `tqdm.auto`
5
+ - `tqdm.tqdm.pandas`
6
+ - `tqdm.contrib.telegram`
7
+ + uses `${TQDM_TELEGRAM_TOKEN}` and `${TQDM_TELEGRAM_CHAT_ID}`
8
+ - `tqdm.contrib.discord`
9
+ + uses `${TQDM_DISCORD_TOKEN}` and `${TQDM_DISCORD_CHANNEL_ID}`
10
+ """
11
+ __all__ = ['tqdm', 'trange']
12
+ import warnings
13
+ from os import getenv
14
+
15
+ if getenv("TQDM_SLACK_TOKEN") and getenv("TQDM_SLACK_CHANNEL"):
16
+ from .slack import tqdm, trange
17
+ elif getenv("TQDM_TELEGRAM_TOKEN") and getenv("TQDM_TELEGRAM_CHAT_ID"):
18
+ from .telegram import tqdm, trange
19
+ elif getenv("TQDM_DISCORD_TOKEN") and getenv("TQDM_DISCORD_CHANNEL_ID"):
20
+ from .discord import tqdm, trange
21
+ else:
22
+ from ..auto import tqdm, trange
23
+
24
+ with warnings.catch_warnings():
25
+ warnings.simplefilter("ignore", category=FutureWarning)
26
+ tqdm.pandas()
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ernie4_5_moe/configuration_ernie4_5_moe.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2025 Baidu, Inc. and 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
+ """Ernie 4.5 MoE model configuration"""
15
+
16
+ from huggingface_hub.dataclasses import strict
17
+
18
+ from ...configuration_utils import PreTrainedConfig
19
+ from ...modeling_rope_utils import RopeParameters
20
+ from ...utils import auto_docstring
21
+
22
+
23
+ @auto_docstring(checkpoint="baidu/ERNIE-4.5-21B-A3B-PT")
24
+ @strict
25
+ class Ernie4_5_MoeConfig(PreTrainedConfig):
26
+ r"""
27
+ use_bias (`bool`, *optional*, defaults to `False`):
28
+ Whether to use a bias in any of the projections including mlp and attention for example.
29
+ moe_k (`int`, *optional*, defaults to 6):
30
+ Number of selected experts.
31
+ moe_num_experts (`int`, *optional*, defaults to 64):
32
+ Number of routed experts.
33
+ moe_num_shared_experts (`int`, *optional*, defaults to 2):
34
+ The number of experts that are shared for all MoE forwards.
35
+ moe_layer_start_index (`int`, *optional*, defaults to 1):
36
+ The first index at which MoE layers start to appear.
37
+ moe_layer_end_index (`int`, *optional*, defaults to -1):
38
+ The last possible index for a MoE layer.
39
+ moe_layer_interval (`int`, *optional*, defaults to 1):
40
+ The intervals between MoE layers to appear.
41
+ moe_norm_min (`float`, *optional*, defaults to 1e-12):
42
+ Minimum division value during routing normalization.
43
+
44
+ Example:
45
+
46
+ ```python
47
+ >>> from transformers import Ernie4_5_MoeModel, Ernie4_5_MoEConfig
48
+
49
+ >>> # Initializing a Ernie4_5_MoE style configuration
50
+ >>> configuration = Ernie4_5_MoEConfig()
51
+
52
+ >>> # Initializing a model from the ERNIE-4.5-21B-A3B style configuration
53
+ >>> model = Ernie4_5_MoeModel(configuration)
54
+
55
+ >>> # Accessing the model configuration
56
+ >>> configuration = model.config
57
+ ```"""
58
+
59
+ model_type = "ernie4_5_moe"
60
+ keys_to_ignore_at_inference = ["past_key_values"]
61
+ attribute_map = {"num_experts": "moe_num_experts", "num_experts_per_tok": "moe_k"}
62
+ default_theta = 500000.0
63
+
64
+ # Default tensor parallel plan for base model `Ernie4_5_MoE`
65
+ base_model_tp_plan = {
66
+ "layers.*.self_attn.q_proj": "colwise",
67
+ "layers.*.self_attn.k_proj": "colwise",
68
+ "layers.*.self_attn.v_proj": "colwise",
69
+ "layers.*.self_attn.o_proj": "rowwise",
70
+ "layers.*.mlp.experts.gate_up_proj": "packed_colwise",
71
+ "layers.*.mlp.experts.down_proj": "rowwise",
72
+ "layers.*.mlp.experts": "moe_tp_experts",
73
+ "layers.*.mlp.shared_experts.gate_proj": "colwise",
74
+ "layers.*.mlp.shared_experts.up_proj": "colwise",
75
+ "layers.*.mlp.shared_experts.down_proj": "rowwise",
76
+ "layers.*.mlp.gate_proj": "colwise",
77
+ "layers.*.mlp.up_proj": "colwise",
78
+ "layers.*.mlp.down_proj": "rowwise",
79
+ }
80
+ base_model_pp_plan = {
81
+ "embed_tokens": (["input_ids"], ["inputs_embeds"]),
82
+ "layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
83
+ "norm": (["hidden_states"], ["hidden_states"]),
84
+ }
85
+
86
+ vocab_size: int = 103424
87
+ pad_token_id: int | None = 0
88
+ bos_token_id: int | None = 1
89
+ eos_token_id: int | list[int] | None = 2
90
+ hidden_size: int = 2560
91
+ intermediate_size: int = 12288
92
+ num_hidden_layers: int = 28
93
+ num_attention_heads: int = 20
94
+ num_key_value_heads: int | None = 4
95
+ hidden_act: str = "silu"
96
+ max_position_embeddings: int = 131072
97
+ initializer_range: float = 0.02
98
+ rms_norm_eps: float = 1e-5
99
+ use_cache: bool = True
100
+ tie_word_embeddings: bool = True
101
+ rope_parameters: RopeParameters | dict | None = None
102
+ use_bias: bool | None = False
103
+ moe_intermediate_size: int = 1536
104
+ moe_k: int | None = 6
105
+ moe_num_experts: int | None = 64
106
+ moe_num_shared_experts: int | None = 2
107
+ moe_layer_start_index: int | None = 1
108
+ moe_layer_end_index: int | None = -1
109
+ moe_layer_interval: int | None = 1
110
+ moe_norm_min: float | None = 1e-12
111
+ output_router_logits: bool | None = False
112
+ router_aux_loss_coef: float | None = 0.001
113
+
114
+ def __post_init__(self, **kwargs):
115
+ self.moe_layer_end_index = (
116
+ self.num_hidden_layers - 1 if self.moe_layer_end_index == -1 else self.moe_layer_end_index
117
+ )
118
+ super().__post_init__(**kwargs)
119
+
120
+
121
+ __all__ = ["Ernie4_5_MoeConfig"]
LTA_openwebtext_dualt/mini_owt_logdirichlet/.venv_qwen35_uv/lib/python3.12/site-packages/transformers/models/ernie4_5_moe/modeling_ernie4_5_moe.py ADDED
@@ -0,0 +1,742 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
2
+ # This file was automatically generated from src/transformers/models/ernie4_5_moe/modular_ernie4_5_moe.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_ernie4_5_moe.py file directly. One of our CI enforces this.
6
+ # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
7
+ # Copyright (c) 2025 Baidu, Inc. and 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
+
21
+ from collections.abc import Callable
22
+ from typing import Optional
23
+
24
+ import torch
25
+ import torch.nn.functional as F
26
+ from torch import nn
27
+
28
+ from ... import initialization as init
29
+ from ...activations import ACT2FN
30
+ from ...cache_utils import Cache, DynamicCache
31
+ from ...generation import GenerationMixin
32
+ from ...integrations import use_experts_implementation, use_kernel_forward_from_hub, use_kernelized_func
33
+ from ...masking_utils import create_causal_mask
34
+ from ...modeling_layers import GradientCheckpointingLayer
35
+ from ...modeling_outputs import MoeCausalLMOutputWithPast, MoeModelOutputWithPast
36
+ from ...modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
37
+ from ...modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
38
+ from ...processing_utils import Unpack
39
+ from ...utils import TransformersKwargs, auto_docstring, can_return_tuple
40
+ from ...utils.generic import maybe_autocast, merge_with_config_defaults
41
+ from ...utils.output_capturing import OutputRecorder, capture_outputs
42
+ from .configuration_ernie4_5_moe import Ernie4_5_MoeConfig
43
+
44
+
45
+ @use_kernel_forward_from_hub("RMSNorm")
46
+ class Ernie4_5_MoeRMSNorm(nn.Module):
47
+ def __init__(self, hidden_size, eps: float = 1e-6) -> None:
48
+ """
49
+ Ernie4_5_MoeRMSNorm is equivalent to T5LayerNorm
50
+ """
51
+ super().__init__()
52
+ self.weight = nn.Parameter(torch.ones(hidden_size))
53
+ self.variance_epsilon = eps
54
+
55
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
56
+ input_dtype = hidden_states.dtype
57
+ hidden_states = hidden_states.to(torch.float32)
58
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
59
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
60
+ return self.weight * hidden_states.to(input_dtype)
61
+
62
+ def extra_repr(self):
63
+ return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
64
+
65
+
66
+ class Ernie4_5_MoeMLP(nn.Module):
67
+ def __init__(self, config, intermediate_size=None):
68
+ super().__init__()
69
+ self.config = config
70
+ self.hidden_size = config.hidden_size
71
+ self.intermediate_size = config.intermediate_size if intermediate_size is None else intermediate_size
72
+
73
+ self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.use_bias)
74
+ self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=config.use_bias)
75
+ self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=config.use_bias)
76
+ self.act_fn = ACT2FN[config.hidden_act]
77
+
78
+ def forward(self, x):
79
+ down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
80
+ return down_proj
81
+
82
+
83
+ class Ernie4_5_MoeRotaryEmbedding(nn.Module):
84
+ inv_freq: torch.Tensor # fix linting for `register_buffer`
85
+
86
+ def __init__(self, config: Ernie4_5_MoeConfig, device=None):
87
+ super().__init__()
88
+ self.max_seq_len_cached = config.max_position_embeddings
89
+ self.original_max_seq_len = config.max_position_embeddings
90
+
91
+ self.config = config
92
+
93
+ self.rope_type = self.config.rope_parameters["rope_type"]
94
+ rope_init_fn: Callable = self.compute_default_rope_parameters
95
+ if self.rope_type != "default":
96
+ rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
97
+ inv_freq, self.attention_scaling = rope_init_fn(self.config, device)
98
+
99
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
100
+ self.register_buffer("original_inv_freq", inv_freq.clone(), persistent=False)
101
+
102
+ @staticmethod
103
+ def compute_default_rope_parameters(
104
+ config: Ernie4_5_MoeConfig | None = None,
105
+ device: Optional["torch.device"] = None,
106
+ seq_len: int | None = None,
107
+ ) -> tuple["torch.Tensor", float]:
108
+ """
109
+ Computes the inverse frequencies according to the original RoPE implementation
110
+ Args:
111
+ config ([`~transformers.PreTrainedConfig`]):
112
+ The model configuration.
113
+ device (`torch.device`):
114
+ The device to use for initialization of the inverse frequencies.
115
+ seq_len (`int`, *optional*):
116
+ The current sequence length. Unused for this type of RoPE.
117
+ Returns:
118
+ Tuple of (`torch.Tensor`, `float`), containing the inverse frequencies for the RoPE embeddings and the
119
+ post-processing scaling factor applied to the computed cos/sin (unused in this type of RoPE).
120
+ """
121
+ base = config.rope_parameters["rope_theta"]
122
+ dim = getattr(config, "head_dim", None) or config.hidden_size // config.num_attention_heads
123
+
124
+ attention_factor = 1.0 # Unused in this type of RoPE
125
+
126
+ # Compute the inverse frequencies
127
+ inv_freq = 1.0 / (
128
+ base ** (torch.arange(0, dim, 2, dtype=torch.int64).to(device=device, dtype=torch.float) / dim)
129
+ )
130
+ return inv_freq, attention_factor
131
+
132
+ @torch.no_grad()
133
+ @dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
134
+ def forward(self, x, position_ids):
135
+ inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
136
+ position_ids_expanded = position_ids[:, None, :].float()
137
+
138
+ device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
139
+ with maybe_autocast(device_type=device_type, enabled=False): # Force float32
140
+ freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
141
+ emb = torch.cat((freqs, freqs), dim=-1)
142
+ cos = emb.cos() * self.attention_scaling
143
+ sin = emb.sin() * self.attention_scaling
144
+
145
+ # keeping it in full precision
146
+ return cos, sin
147
+
148
+
149
+ def rotate_half(x):
150
+ """Rotates half the hidden dims of the input."""
151
+ x1 = x[..., 0::2]
152
+ x2 = x[..., 1::2]
153
+ return torch.stack((-x2, x1), dim=-1).flatten(-2)
154
+
155
+
156
+ def apply_rotary_pos_emb(q, k, cos, sin, unsqueeze_dim=1):
157
+ """Applies Rotary Position Embedding to the query and key tensors.
158
+
159
+ Args:
160
+ q (`torch.Tensor`): The query tensor.
161
+ k (`torch.Tensor`): The key tensor.
162
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
163
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
164
+ unsqueeze_dim (`int`, *optional*, defaults to 1):
165
+ The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
166
+ sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
167
+ that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
168
+ k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
169
+ cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
170
+ the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
171
+ Returns:
172
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
173
+ """
174
+ # glm rope style (with full dim) and full precision
175
+ original_dtype = q.dtype
176
+
177
+ cos = cos.unsqueeze(unsqueeze_dim)
178
+ sin = sin.unsqueeze(unsqueeze_dim)
179
+
180
+ # Interleave them instead of usual shape
181
+ cos = cos[..., : cos.shape[-1] // 2].repeat_interleave(2, dim=-1)
182
+ sin = sin[..., : sin.shape[-1] // 2].repeat_interleave(2, dim=-1)
183
+
184
+ q_embed = (q.float() * cos) + (rotate_half(q).float() * sin)
185
+ k_embed = (k.float() * cos) + (rotate_half(k).float() * sin)
186
+
187
+ return q_embed.to(original_dtype), k_embed.to(original_dtype)
188
+
189
+
190
+ def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
191
+ """
192
+ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
193
+ num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
194
+ """
195
+ batch, num_key_value_heads, slen, head_dim = hidden_states.shape
196
+ if n_rep == 1:
197
+ return hidden_states
198
+ hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
199
+ return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
200
+
201
+
202
+ def eager_attention_forward(
203
+ module: nn.Module,
204
+ query: torch.Tensor,
205
+ key: torch.Tensor,
206
+ value: torch.Tensor,
207
+ attention_mask: torch.Tensor | None,
208
+ scaling: float,
209
+ dropout: float = 0.0,
210
+ **kwargs: Unpack[TransformersKwargs],
211
+ ):
212
+ key_states = repeat_kv(key, module.num_key_value_groups)
213
+ value_states = repeat_kv(value, module.num_key_value_groups)
214
+
215
+ attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
216
+ if attention_mask is not None:
217
+ attn_weights = attn_weights + attention_mask
218
+
219
+ attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
220
+ attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
221
+ attn_output = torch.matmul(attn_weights, value_states)
222
+ attn_output = attn_output.transpose(1, 2).contiguous()
223
+
224
+ return attn_output, attn_weights
225
+
226
+
227
+ @use_kernelized_func(apply_rotary_pos_emb)
228
+ class Ernie4_5_MoeAttention(nn.Module):
229
+ """Multi-headed attention from 'Attention Is All You Need' paper"""
230
+
231
+ def __init__(self, config: Ernie4_5_MoeConfig, layer_idx: int):
232
+ super().__init__()
233
+ self.config = config
234
+ self.layer_idx = layer_idx
235
+ self.head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads)
236
+ self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
237
+ self.scaling = self.head_dim**-0.5
238
+
239
+ self.attention_dropout = 0.0
240
+ self.is_causal = True
241
+
242
+ self.q_proj = nn.Linear(config.hidden_size, config.num_attention_heads * self.head_dim, bias=config.use_bias)
243
+ self.k_proj = nn.Linear(config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.use_bias)
244
+ self.v_proj = nn.Linear(config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.use_bias)
245
+ self.o_proj = nn.Linear(config.num_attention_heads * self.head_dim, config.hidden_size, bias=config.use_bias)
246
+
247
+ def forward(
248
+ self,
249
+ hidden_states: torch.Tensor,
250
+ position_embeddings: tuple[torch.Tensor, torch.Tensor] | None = None,
251
+ attention_mask: torch.Tensor | None = None,
252
+ past_key_values: Cache | None = None,
253
+ **kwargs: Unpack[TransformersKwargs],
254
+ ) -> tuple[torch.Tensor, torch.Tensor]:
255
+ input_shape = hidden_states.shape[:-1]
256
+ hidden_shape = (*input_shape, -1, self.head_dim)
257
+
258
+ query_states = self.q_proj(hidden_states).view(hidden_shape).transpose(1, 2)
259
+ key_states = self.k_proj(hidden_states).view(hidden_shape).transpose(1, 2)
260
+ value_states = self.v_proj(hidden_states).view(hidden_shape).transpose(1, 2)
261
+
262
+ cos, sin = position_embeddings
263
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
264
+
265
+ if past_key_values is not None:
266
+ key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx)
267
+
268
+ attention_interface: Callable = ALL_ATTENTION_FUNCTIONS.get_interface(
269
+ self.config._attn_implementation, eager_attention_forward
270
+ )
271
+
272
+ attn_output, attn_weights = attention_interface(
273
+ self,
274
+ query_states,
275
+ key_states,
276
+ value_states,
277
+ attention_mask,
278
+ dropout=0.0 if not self.training else self.attention_dropout,
279
+ scaling=self.scaling,
280
+ **kwargs,
281
+ )
282
+
283
+ attn_output = attn_output.reshape(*input_shape, -1).contiguous()
284
+ attn_output = self.o_proj(attn_output)
285
+ return attn_output, attn_weights
286
+
287
+
288
+ class Ernie4_5_MoeStatics(nn.Module):
289
+ """
290
+ Stores MoE (Mixture of Experts) statistics
291
+ - Bias for the gating
292
+ - Additionally, usage per expert in the original codebase
293
+ """
294
+
295
+ def __init__(self, config):
296
+ super().__init__()
297
+
298
+ num_experts_groups = 1
299
+ num_experts = config.moe_num_experts
300
+
301
+ self.e_score_correction_bias = nn.Parameter(
302
+ torch.zeros(num_experts_groups, num_experts, dtype=torch.float32),
303
+ requires_grad=False,
304
+ )
305
+
306
+ def forward(self, hidden_states):
307
+ # NOTE: This is a workaround to enable TP with a module that only has parameters
308
+ #
309
+ # Otherwise, it stays as `DTensor` when called in the "super" forward
310
+ # 1. All other tensors are local (`torch.Tensor`)
311
+ # 2. Isolate does not work on `nn.Module` which only has parameters
312
+ return hidden_states + self.e_score_correction_bias.squeeze()
313
+
314
+
315
+ @use_experts_implementation
316
+ class Ernie4_5_MoeExperts(nn.Module):
317
+ """Collection of expert weights stored as 3D tensors."""
318
+
319
+ def __init__(self, config):
320
+ super().__init__()
321
+ self.num_experts = config.moe_num_experts
322
+ self.hidden_dim = config.hidden_size
323
+ self.intermediate_dim = config.moe_intermediate_size
324
+ self.gate_up_proj = nn.Parameter(torch.empty(self.num_experts, 2 * self.intermediate_dim, self.hidden_dim))
325
+ self.down_proj = nn.Parameter(torch.empty(self.num_experts, self.hidden_dim, self.intermediate_dim))
326
+ self.act_fn = ACT2FN[config.hidden_act]
327
+
328
+ def forward(
329
+ self,
330
+ hidden_states: torch.Tensor,
331
+ top_k_index: torch.Tensor,
332
+ top_k_weights: torch.Tensor,
333
+ ) -> torch.Tensor:
334
+ final_hidden_states = torch.zeros_like(hidden_states)
335
+ with torch.no_grad():
336
+ expert_mask = torch.nn.functional.one_hot(top_k_index, num_classes=self.num_experts)
337
+ expert_mask = expert_mask.permute(2, 1, 0)
338
+ expert_hit = torch.greater(expert_mask.sum(dim=(-1, -2)), 0).nonzero()
339
+
340
+ for expert_idx in expert_hit:
341
+ expert_idx = expert_idx[0]
342
+ if expert_idx == self.num_experts:
343
+ continue
344
+ top_k_pos, token_idx = torch.where(expert_mask[expert_idx])
345
+ current_state = hidden_states[token_idx]
346
+ gate, up = nn.functional.linear(current_state, self.gate_up_proj[expert_idx]).chunk(2, dim=-1)
347
+ current_hidden_states = self.act_fn(gate) * up
348
+ current_hidden_states = nn.functional.linear(current_hidden_states, self.down_proj[expert_idx])
349
+ current_hidden_states = current_hidden_states * top_k_weights[token_idx, top_k_pos, None]
350
+ final_hidden_states.index_add_(0, token_idx, current_hidden_states.to(final_hidden_states.dtype))
351
+
352
+ return final_hidden_states
353
+
354
+
355
+ class Ernie4_5_MoeTopKRouter(nn.Module):
356
+ def __init__(self, config):
357
+ super().__init__()
358
+ self.weight = nn.Parameter(torch.zeros(config.moe_num_experts, config.hidden_size, dtype=torch.float32))
359
+ self.moe_statics = Ernie4_5_MoeStatics(config)
360
+ self.top_k = config.moe_k
361
+ self.norm_min = config.moe_norm_min
362
+
363
+ def forward(self, hidden_states: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]:
364
+ device_type = (
365
+ hidden_states.device.type
366
+ if isinstance(hidden_states.device.type, str) and hidden_states.device.type != "mps"
367
+ else "cpu"
368
+ )
369
+
370
+ with maybe_autocast(device_type=device_type, enabled=False): # Force float32
371
+ router_logits = F.linear(hidden_states.float(), self.weight.float())
372
+ routing_weights = F.softmax(router_logits, dim=1, dtype=torch.float)
373
+ _, selected_experts = torch.topk(self.moe_statics(routing_weights), self.top_k, dim=-1)
374
+ routing_weights = torch.gather(routing_weights, dim=-1, index=selected_experts)
375
+ routing_weights = routing_weights / torch.clamp(
376
+ routing_weights.sum(dim=-1, keepdim=True), min=self.norm_min
377
+ )
378
+ routing_weights = routing_weights.to(hidden_states.dtype)
379
+ return router_logits, selected_experts, routing_weights
380
+
381
+
382
+ class Ernie4_5_MoeSparseMoeBlock(nn.Module):
383
+ def __init__(self, config):
384
+ super().__init__()
385
+ self.hidden_dim = config.hidden_size
386
+ self.num_experts = config.moe_num_experts
387
+ self.top_k = config.moe_k
388
+ self.gate = Ernie4_5_MoeTopKRouter(config)
389
+ self.experts = Ernie4_5_MoeExperts(config)
390
+
391
+ self.shared_experts = None
392
+ if config.moe_num_shared_experts > 0:
393
+ self.shared_experts = Ernie4_5_MoeMLP(config, config.moe_intermediate_size * config.moe_num_shared_experts)
394
+
395
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
396
+ batch_size, sequence_length, _ = hidden_states.shape
397
+ hidden_states = hidden_states.view(-1, self.hidden_dim)
398
+
399
+ if self.shared_experts is not None:
400
+ shared_output = self.shared_experts(hidden_states)
401
+
402
+ _, top_k_index, top_k_weights = self.gate(hidden_states)
403
+ final_hidden_states = self.experts(hidden_states, top_k_index, top_k_weights)
404
+
405
+ if self.shared_experts is not None:
406
+ final_hidden_states = final_hidden_states + shared_output
407
+
408
+ final_hidden_states = final_hidden_states.reshape(batch_size, sequence_length, self.hidden_dim)
409
+ return final_hidden_states.to(hidden_states.dtype)
410
+
411
+
412
+ class Ernie4_5_MoeDecoderLayer(GradientCheckpointingLayer):
413
+ def __init__(self, config, layer_idx):
414
+ super().__init__()
415
+ self.hidden_size = config.hidden_size
416
+
417
+ self.self_attn = Ernie4_5_MoeAttention(config, layer_idx)
418
+
419
+ if (
420
+ ((layer_idx + 1) % config.moe_layer_interval == 0)
421
+ and layer_idx >= config.moe_layer_start_index
422
+ and layer_idx <= config.moe_layer_end_index
423
+ ):
424
+ self.mlp = Ernie4_5_MoeSparseMoeBlock(config)
425
+ else:
426
+ self.mlp = Ernie4_5_MoeMLP(config)
427
+
428
+ self.input_layernorm = Ernie4_5_MoeRMSNorm(config.hidden_size, config.rms_norm_eps)
429
+ self.post_attention_layernorm = Ernie4_5_MoeRMSNorm(config.hidden_size, config.rms_norm_eps)
430
+
431
+ def forward(
432
+ self,
433
+ hidden_states: torch.Tensor,
434
+ attention_mask: torch.Tensor | None = None,
435
+ position_ids: torch.LongTensor | None = None,
436
+ past_key_values: Cache | None = None,
437
+ use_cache: bool | None = False,
438
+ position_embeddings: tuple[torch.Tensor, torch.Tensor] | None = None,
439
+ **kwargs: Unpack[TransformersKwargs],
440
+ ) -> torch.Tensor:
441
+ residual = hidden_states
442
+ hidden_states = self.input_layernorm(hidden_states)
443
+ # Self Attention
444
+ hidden_states, _ = self.self_attn(
445
+ hidden_states=hidden_states,
446
+ attention_mask=attention_mask,
447
+ position_ids=position_ids,
448
+ past_key_values=past_key_values,
449
+ use_cache=use_cache,
450
+ position_embeddings=position_embeddings,
451
+ **kwargs,
452
+ )
453
+ hidden_states = residual + hidden_states
454
+
455
+ # Fully Connected
456
+ residual = hidden_states
457
+ hidden_states = self.post_attention_layernorm(hidden_states)
458
+ hidden_states = self.mlp(hidden_states)
459
+ hidden_states = residual + hidden_states
460
+ return hidden_states
461
+
462
+
463
+ @auto_docstring
464
+ class Ernie4_5_MoePreTrainedModel(PreTrainedModel):
465
+ config: Ernie4_5_MoeConfig
466
+ base_model_prefix = "model"
467
+ supports_gradient_checkpointing = True
468
+ _no_split_modules = ["Ernie4_5_MoeDecoderLayer"]
469
+ _skip_keys_device_placement = ["past_key_values"]
470
+ _supports_flash_attn = True
471
+ _supports_sdpa = True
472
+ _supports_flex_attn = True
473
+
474
+ _can_compile_fullgraph = True
475
+ _supports_attention_backend = True
476
+ _can_record_outputs = {
477
+ "router_logits": OutputRecorder(Ernie4_5_MoeTopKRouter, index=0),
478
+ "hidden_states": Ernie4_5_MoeDecoderLayer,
479
+ "attentions": Ernie4_5_MoeAttention,
480
+ }
481
+ # Not supporting multi-token prediction (MTP) atm
482
+ _keys_to_ignore_on_load_unexpected = ["mtp"]
483
+ _keep_in_fp32_modules_strict = ["gate.weight", "moe_statics"]
484
+
485
+ @torch.no_grad()
486
+ def _init_weights(self, module):
487
+ super()._init_weights(module)
488
+ if isinstance(module, Ernie4_5_MoeStatics):
489
+ init.zeros_(module.e_score_correction_bias)
490
+ elif isinstance(module, Ernie4_5_MoeExperts):
491
+ init.normal_(module.gate_up_proj, mean=0.0, std=self.config.initializer_range)
492
+ init.normal_(module.down_proj, mean=0.0, std=self.config.initializer_range)
493
+
494
+
495
+ @auto_docstring
496
+ class Ernie4_5_MoeModel(Ernie4_5_MoePreTrainedModel):
497
+ def __init__(self, config: Ernie4_5_MoeConfig):
498
+ super().__init__(config)
499
+ self.padding_idx = config.pad_token_id
500
+ self.vocab_size = config.vocab_size
501
+
502
+ self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
503
+ self.layers = nn.ModuleList(
504
+ [Ernie4_5_MoeDecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
505
+ )
506
+ self.norm = Ernie4_5_MoeRMSNorm(config.hidden_size, eps=config.rms_norm_eps)
507
+ self.rotary_emb = Ernie4_5_MoeRotaryEmbedding(config=config)
508
+ self.gradient_checkpointing = False
509
+
510
+ # Initialize weights and apply final processing
511
+ self.post_init()
512
+
513
+ @merge_with_config_defaults
514
+ @capture_outputs
515
+ @auto_docstring
516
+ def forward(
517
+ self,
518
+ input_ids: torch.LongTensor | None = None,
519
+ attention_mask: torch.Tensor | None = None,
520
+ position_ids: torch.LongTensor | None = None,
521
+ past_key_values: Cache | None = None,
522
+ inputs_embeds: torch.FloatTensor | None = None,
523
+ use_cache: bool | None = None,
524
+ **kwargs: Unpack[TransformersKwargs],
525
+ ) -> MoeModelOutputWithPast:
526
+ if (input_ids is None) ^ (inputs_embeds is not None):
527
+ raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
528
+
529
+ if use_cache and past_key_values is None:
530
+ past_key_values = DynamicCache(config=self.config)
531
+
532
+ if inputs_embeds is None:
533
+ inputs_embeds = self.embed_tokens(input_ids)
534
+
535
+ if position_ids is None:
536
+ past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
537
+ position_ids = torch.arange(inputs_embeds.shape[1], device=inputs_embeds.device) + past_seen_tokens
538
+ position_ids = position_ids.unsqueeze(0)
539
+
540
+ causal_mask = create_causal_mask(
541
+ config=self.config,
542
+ inputs_embeds=inputs_embeds,
543
+ attention_mask=attention_mask,
544
+ past_key_values=past_key_values,
545
+ position_ids=position_ids,
546
+ )
547
+
548
+ hidden_states = inputs_embeds
549
+
550
+ # create position embeddings to be shared across the decoder layers
551
+ position_embeddings = self.rotary_emb(hidden_states, position_ids)
552
+
553
+ for decoder_layer in self.layers[: self.config.num_hidden_layers]:
554
+ hidden_states = decoder_layer(
555
+ hidden_states,
556
+ position_embeddings=position_embeddings,
557
+ attention_mask=causal_mask,
558
+ position_ids=position_ids,
559
+ past_key_values=past_key_values,
560
+ use_cache=use_cache,
561
+ **kwargs,
562
+ )
563
+
564
+ hidden_states = self.norm(hidden_states)
565
+
566
+ return MoeModelOutputWithPast( # only diff with Mistral is the output type, we need MoE
567
+ last_hidden_state=hidden_states,
568
+ past_key_values=past_key_values,
569
+ )
570
+
571
+
572
+ def load_balancing_loss_func(
573
+ gate_logits: torch.Tensor | tuple[torch.Tensor] | None,
574
+ num_experts: int | None = None,
575
+ top_k=2,
576
+ attention_mask: torch.Tensor | None = None,
577
+ ) -> torch.Tensor | int:
578
+ r"""
579
+ Computes auxiliary load balancing loss as in Switch Transformer - implemented in Pytorch.
580
+
581
+ See Switch Transformer (https://huggingface.co/papers/2101.03961) for more details. This function implements the loss
582
+ function presented in equations (4) - (6) of the paper. It aims at penalizing cases where the routing between
583
+ experts is too unbalanced.
584
+
585
+ Args:
586
+ gate_logits:
587
+ Logits from the `gate`, should be a tuple of model.config.num_hidden_layers tensors of
588
+ shape [batch_size X sequence_length, num_experts].
589
+ num_experts:
590
+ Number of experts
591
+ top_k:
592
+ The number of experts to route per-token, can be also interpreted as the `top-k` routing
593
+ parameter.
594
+ attention_mask (`torch.Tensor`, *optional*):
595
+ The attention_mask used in forward function
596
+ shape [batch_size X sequence_length] if not None.
597
+
598
+ Returns:
599
+ The auxiliary loss.
600
+ """
601
+ if gate_logits is None or not isinstance(gate_logits, tuple):
602
+ return 0
603
+
604
+ if isinstance(gate_logits, tuple):
605
+ compute_device = gate_logits[0].device
606
+ concatenated_gate_logits = torch.cat([layer_gate.to(compute_device) for layer_gate in gate_logits], dim=0)
607
+
608
+ routing_weights = torch.nn.functional.softmax(concatenated_gate_logits, dim=-1)
609
+
610
+ _, selected_experts = torch.topk(routing_weights, top_k, dim=-1)
611
+
612
+ expert_mask = torch.nn.functional.one_hot(selected_experts, num_experts)
613
+
614
+ if attention_mask is None:
615
+ # Compute the percentage of tokens routed to each experts
616
+ tokens_per_expert = torch.mean(expert_mask.float(), dim=0)
617
+
618
+ # Compute the average probability of routing to these experts
619
+ router_prob_per_expert = torch.mean(routing_weights, dim=0)
620
+ else:
621
+ batch_size, sequence_length = attention_mask.shape
622
+ num_hidden_layers = concatenated_gate_logits.shape[0] // (batch_size * sequence_length)
623
+
624
+ # Compute the mask that masks all padding tokens as 0 with the same shape of expert_mask
625
+ expert_attention_mask = (
626
+ attention_mask[None, :, :, None, None]
627
+ .expand((num_hidden_layers, batch_size, sequence_length, top_k, num_experts))
628
+ .reshape(-1, top_k, num_experts)
629
+ .to(compute_device)
630
+ )
631
+
632
+ # Compute the percentage of tokens routed to each experts
633
+ tokens_per_expert = torch.sum(expert_mask.float() * expert_attention_mask, dim=0) / torch.sum(
634
+ expert_attention_mask, dim=0
635
+ )
636
+
637
+ # Compute the mask that masks all padding tokens as 0 with the same shape of tokens_per_expert
638
+ router_per_expert_attention_mask = (
639
+ attention_mask[None, :, :, None]
640
+ .expand((num_hidden_layers, batch_size, sequence_length, num_experts))
641
+ .reshape(-1, num_experts)
642
+ .to(compute_device)
643
+ )
644
+
645
+ # Compute the average probability of routing to these experts
646
+ router_prob_per_expert = torch.sum(routing_weights * router_per_expert_attention_mask, dim=0) / torch.sum(
647
+ router_per_expert_attention_mask, dim=0
648
+ )
649
+
650
+ overall_loss = torch.sum(tokens_per_expert * router_prob_per_expert.unsqueeze(0))
651
+ return overall_loss * num_experts
652
+
653
+
654
+ @auto_docstring
655
+ class Ernie4_5_MoeForCausalLM(Ernie4_5_MoePreTrainedModel, GenerationMixin):
656
+ _tied_weights_keys = {"lm_head.weight": "model.embed_tokens.weight"}
657
+ _tp_plan = {"lm_head": "colwise_gather_output"}
658
+ _pp_plan = {"lm_head": (["hidden_states"], ["logits"])}
659
+
660
+ def __init__(self, config):
661
+ super().__init__(config)
662
+ self.model = Ernie4_5_MoeModel(config)
663
+ self.vocab_size = config.vocab_size
664
+ self.lm_head = nn.Linear(config.hidden_size, config.vocab_size, bias=config.use_bias)
665
+
666
+ self.router_aux_loss_coef = config.router_aux_loss_coef
667
+ self.num_experts = config.moe_num_experts
668
+ self.num_experts_per_tok = config.moe_k
669
+
670
+ # Initialize weights and apply final processing
671
+ self.post_init()
672
+
673
+ @can_return_tuple
674
+ @auto_docstring
675
+ def forward(
676
+ self,
677
+ input_ids: torch.LongTensor | None = None,
678
+ attention_mask: torch.Tensor | None = None,
679
+ position_ids: torch.LongTensor | None = None,
680
+ past_key_values: Cache | None = None,
681
+ inputs_embeds: torch.FloatTensor | None = None,
682
+ labels: torch.LongTensor | None = None,
683
+ use_cache: bool | None = None,
684
+ output_router_logits: bool | None = None,
685
+ logits_to_keep: int | torch.Tensor = 0,
686
+ **kwargs: Unpack[TransformersKwargs],
687
+ ) -> MoeCausalLMOutputWithPast:
688
+ r"""
689
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
690
+ Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
691
+ config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
692
+ (masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
693
+ """
694
+
695
+ output_router_logits = (
696
+ output_router_logits if output_router_logits is not None else self.config.output_router_logits
697
+ )
698
+
699
+ # decoder outputs consists of (dec_features, layer_state, dec_hidden, dec_attn)
700
+ outputs: MoeModelOutputWithPast = self.model(
701
+ input_ids=input_ids,
702
+ attention_mask=attention_mask,
703
+ position_ids=position_ids,
704
+ past_key_values=past_key_values,
705
+ inputs_embeds=inputs_embeds,
706
+ use_cache=use_cache,
707
+ output_router_logits=output_router_logits,
708
+ **kwargs,
709
+ )
710
+
711
+ hidden_states = outputs.last_hidden_state
712
+ # Only compute necessary logits, and do not upcast them to float if we are not computing the loss
713
+ slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
714
+ logits = self.lm_head(hidden_states[:, slice_indices, :])
715
+
716
+ loss = None
717
+ if labels is not None:
718
+ loss = self.loss_function(logits, labels, self.vocab_size, **kwargs)
719
+
720
+ aux_loss = None
721
+ if output_router_logits:
722
+ aux_loss = load_balancing_loss_func(
723
+ outputs.router_logits,
724
+ self.num_experts,
725
+ self.num_experts_per_tok,
726
+ attention_mask,
727
+ )
728
+ if labels is not None:
729
+ loss += self.router_aux_loss_coef * aux_loss.to(loss.device) # make sure to reside in the same device
730
+
731
+ return MoeCausalLMOutputWithPast(
732
+ loss=loss,
733
+ aux_loss=aux_loss,
734
+ logits=logits,
735
+ past_key_values=outputs.past_key_values,
736
+ hidden_states=outputs.hidden_states,
737
+ attentions=outputs.attentions,
738
+ router_logits=outputs.router_logits,
739
+ )
740
+
741
+
742
+ __all__ = ["Ernie4_5_MoeForCausalLM", "Ernie4_5_MoeModel", "Ernie4_5_MoePreTrainedModel"]