neuralops 1.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (519) hide show
  1. neuralops/__init__.py +235 -0
  2. neuralops/analysis/__init__.py +101 -0
  3. neuralops/analysis/comparison/__init__.py +28 -0
  4. neuralops/analysis/comparison/statistical_tests.py +761 -0
  5. neuralops/analysis/generate_all_modules_analysis.py +56 -0
  6. neuralops/analysis/generate_sweep_publication_artifacts.py +684 -0
  7. neuralops/analysis/layerwise_analyzer.py +369 -0
  8. neuralops/analysis/metrics.py +88 -0
  9. neuralops/analysis/model_comparison.py +45 -0
  10. neuralops/analysis/module_analysis/__init__.py +50 -0
  11. neuralops/analysis/module_analysis/aggregators.py +150 -0
  12. neuralops/analysis/module_analysis/constants.py +599 -0
  13. neuralops/analysis/module_analysis/main.py +290 -0
  14. neuralops/analysis/module_analysis/parsers.py +115 -0
  15. neuralops/analysis/module_analysis/reporters.py +140 -0
  16. neuralops/analysis/plotting.py +538 -0
  17. neuralops/analysis/report_generator.py +96 -0
  18. neuralops/analysis/utils.py +70 -0
  19. neuralops/attentions/__init__.py +159 -0
  20. neuralops/attentions/adaptive/__init__.py +125 -0
  21. neuralops/attentions/adaptive/adaptive_span_attention.py +1143 -0
  22. neuralops/attentions/adaptive/block_transformer_hiba.py +1075 -0
  23. neuralops/attentions/adaptive/eat.py +1048 -0
  24. neuralops/attentions/adaptive/infini_attention.py +708 -0
  25. neuralops/attentions/adaptive/lola_attention.py +917 -0
  26. neuralops/attentions/adaptive/progressive_token_pruning.py +905 -0
  27. neuralops/attentions/adaptive/sink_attention.py +41 -0
  28. neuralops/attentions/adaptive/span_expanded_attention.py +823 -0
  29. neuralops/attentions/adaptive/squeezing_heads_distill.py +1067 -0
  30. neuralops/attentions/adaptive/token_compressed_attention.py +1073 -0
  31. neuralops/attentions/dense/__init__.py +29 -0
  32. neuralops/attentions/dense/full_attention.py +713 -0
  33. neuralops/attentions/dense/zeros_attention.py +771 -0
  34. neuralops/attentions/experimental/__init__.py +17 -0
  35. neuralops/attentions/experimental/template_attention.py +864 -0
  36. neuralops/attentions/fast_kernels/__init__.py +65 -0
  37. neuralops/attentions/fast_kernels/adasplash_attention.py +945 -0
  38. neuralops/attentions/fast_kernels/flash_attention3.py +969 -0
  39. neuralops/attentions/fast_kernels/flash_attention3_fp8.py +1062 -0
  40. neuralops/attentions/fast_kernels/soa_attn.py +963 -0
  41. neuralops/attentions/fast_kernels/xattention.py +1045 -0
  42. neuralops/attentions/gated/__init__.py +113 -0
  43. neuralops/attentions/gated/decay_linear_attention.py +1033 -0
  44. neuralops/attentions/gated/gated_delta_net.py +1185 -0
  45. neuralops/attentions/gated/gated_deltanet_block.py +387 -0
  46. neuralops/attentions/gated/gated_linear_attention.py +916 -0
  47. neuralops/attentions/gated/hgrn2_gated_deltanet.py +440 -0
  48. neuralops/attentions/gated/hgrn2_gated_layer.py +668 -0
  49. neuralops/attentions/gated/hgrn2_gated_outer.py +742 -0
  50. neuralops/attentions/gated/hla_attention.py +638 -0
  51. neuralops/attentions/gated/kda_attention.py +890 -0
  52. neuralops/attentions/hybrid/__init__.py +185 -0
  53. neuralops/attentions/hybrid/fusion_attn.py +1280 -0
  54. neuralops/attentions/hybrid/gated_hybrid_kernel_attention.py +1367 -0
  55. neuralops/attentions/hybrid/granite_hybrid.py +706 -0
  56. neuralops/attentions/hybrid/halo_regla.py +675 -0
  57. neuralops/attentions/hybrid/hybrid_attention.py +856 -0
  58. neuralops/attentions/hybrid/hybrid_local_kernel_attention.py +1211 -0
  59. neuralops/attentions/hybrid/landmark_local_attention.py +1094 -0
  60. neuralops/attentions/hybrid/mixattention_moska.py +1020 -0
  61. neuralops/attentions/hybrid/optimized_hybrid_attention.py +898 -0
  62. neuralops/attentions/hybrid/positive_kernel_linear_attention.py +1013 -0
  63. neuralops/attentions/hybrid/refined_landmark_attention.py +1131 -0
  64. neuralops/attentions/hybrid/regla_attention.py +969 -0
  65. neuralops/attentions/hybrid/spectron_fp8_attention.py +1369 -0
  66. neuralops/attentions/hybrid/split_head_hybrid_attention.py +1305 -0
  67. neuralops/attentions/hybrid/tri_branch_hybrid_attention.py +1200 -0
  68. neuralops/attentions/linear/__init__.py +197 -0
  69. neuralops/attentions/linear/chela_slay.py +1266 -0
  70. neuralops/attentions/linear/cosformer.py +482 -0
  71. neuralops/attentions/linear/galerkin_attention.py +994 -0
  72. neuralops/attentions/linear/linformer_attention.py +1107 -0
  73. neuralops/attentions/linear/nasc_attention.py +980 -0
  74. neuralops/attentions/linear/nystrom_attention.py +919 -0
  75. neuralops/attentions/linear/performer_attention.py +1209 -0
  76. neuralops/attentions/linear/primal_attention.py +831 -0
  77. neuralops/attentions/linear/rala_attention.py +834 -0
  78. neuralops/attentions/linear/rpc_attention.py +1008 -0
  79. neuralops/attentions/linear/spectra_v2.py +798 -0
  80. neuralops/attentions/linear/spectraformer_attention.py +854 -0
  81. neuralops/attentions/linear/spectron.py +1265 -0
  82. neuralops/attentions/linear/tlinformer_attention.py +1005 -0
  83. neuralops/attentions/linear/tpa_attention.py +1135 -0
  84. neuralops/attentions/linear/triton_cosformer.py +874 -0
  85. neuralops/attentions/modern/__init__.py +125 -0
  86. neuralops/attentions/modern/alibi.py +53 -0
  87. neuralops/attentions/modern/cross_attention.py +82 -0
  88. neuralops/attentions/modern/gqa_attention.py +981 -0
  89. neuralops/attentions/modern/mla_attention.py +980 -0
  90. neuralops/attentions/modern/mqa.py +84 -0
  91. neuralops/attentions/modern/nha_attention.py +1023 -0
  92. neuralops/attentions/modern/qcqa_attention.py +966 -0
  93. neuralops/attentions/modern/sliding_window.py +60 -0
  94. neuralops/attentions/modern/unified_rope.py +801 -0
  95. neuralops/attentions/modern/vig_attention.py +845 -0
  96. neuralops/attentions/modern/wgqa_attention.py +962 -0
  97. neuralops/attentions/sparse/__init__.py +149 -0
  98. neuralops/attentions/sparse/adaptive_sparse_attention.py +1065 -0
  99. neuralops/attentions/sparse/bam_umoe.py +1063 -0
  100. neuralops/attentions/sparse/cluster_attention.py +1110 -0
  101. neuralops/attentions/sparse/expert_choice_moe.py +1010 -0
  102. neuralops/attentions/sparse/hamming_attention.py +782 -0
  103. neuralops/attentions/sparse/lsh_attention.py +1058 -0
  104. neuralops/attentions/sparse/moba_attention.py +1022 -0
  105. neuralops/attentions/sparse/moe_deltakv_paged.py +1222 -0
  106. neuralops/attentions/sparse/nsa_attention.py +810 -0
  107. neuralops/attentions/sparse/padre_attention.py +873 -0
  108. neuralops/attentions/sparse/reap_moe.py +1168 -0
  109. neuralops/attentions/sparse/routing_attention.py +961 -0
  110. neuralops/attentions/ssm/__init__.py +209 -0
  111. neuralops/attentions/ssm/goldfinch_ahn.py +1074 -0
  112. neuralops/attentions/ssm/griffin_ssd.py +736 -0
  113. neuralops/attentions/ssm/hymba_transx.py +1070 -0
  114. neuralops/attentions/ssm/jamba.py +692 -0
  115. neuralops/attentions/ssm/jamba_info.py +1116 -0
  116. neuralops/attentions/ssm/mamba_block.py +938 -0
  117. neuralops/attentions/ssm/mamba_svd_flash.py +1397 -0
  118. neuralops/attentions/ssm/nexus.py +1268 -0
  119. neuralops/attentions/ssm/orion.py +1194 -0
  120. neuralops/attentions/ssm/phantom.py +872 -0
  121. neuralops/attentions/ssm/samba_m3.py +925 -0
  122. neuralops/attentions/ssm/samba_moe.py +424 -0
  123. neuralops/attentions/ssm/selective_ssm.py +286 -0
  124. neuralops/attentions/ssm/simple_ssm.py +330 -0
  125. neuralops/attentions/ssm/spectral_mamba.py +984 -0
  126. neuralops/attentions/ssm/upi_stuffed_mamba.py +990 -0
  127. neuralops/attentions/ssm/vspec.py +1074 -0
  128. neuralops/attentions/svd/__init__.py +257 -0
  129. neuralops/attentions/svd/adaptive_svd_attention.py +1047 -0
  130. neuralops/attentions/svd/asvd_attention.py +1083 -0
  131. neuralops/attentions/svd/compressed_attention.py +722 -0
  132. neuralops/attentions/svd/compressed_mha_attention.py +752 -0
  133. neuralops/attentions/svd/factorised_matrix_state.py +972 -0
  134. neuralops/attentions/svd/fused_svd_kernel.py +1288 -0
  135. neuralops/attentions/svd/lora_attention.py +854 -0
  136. neuralops/attentions/svd/minimal_nova.py +860 -0
  137. neuralops/attentions/svd/minimal_svd.py +817 -0
  138. neuralops/attentions/svd/naive_svd.py +102 -0
  139. neuralops/attentions/svd/projection_factorized_attn.py +277 -0
  140. neuralops/attentions/svd/residual_svd_attention.py +778 -0
  141. neuralops/attentions/svd/salt_attention.py +1030 -0
  142. neuralops/attentions/svd/svd_attention.py +960 -0
  143. neuralops/attentions/svd/svd_compressed.py +1254 -0
  144. neuralops/attentions/svd/svd_linear_attention.py +1582 -0
  145. neuralops/attentions/svd/svd_linear_decay.py +194 -0
  146. neuralops/attentions/svd/svd_llm_v2_attention.py +975 -0
  147. neuralops/attentions/svd/svd_mamba.py +1012 -0
  148. neuralops/attentions/svd/svd_projection_attention.py +840 -0
  149. neuralops/attentions/svd/triton_svd_linear_attention.py +1183 -0
  150. neuralops/benchmarks/__init__.py +44 -0
  151. neuralops/benchmarks/__main__.py +8 -0
  152. neuralops/benchmarks/adapters/__init__.py +13 -0
  153. neuralops/benchmarks/adapters/classification.py +211 -0
  154. neuralops/benchmarks/adapters/perplexity.py +173 -0
  155. neuralops/benchmarks/adapters/ruler.py +190 -0
  156. neuralops/benchmarks/adapters/zeroshot.py +243 -0
  157. neuralops/benchmarks/api.py +120 -0
  158. neuralops/benchmarks/cli.py +224 -0
  159. neuralops/benchmarks/config.py +151 -0
  160. neuralops/benchmarks/core/__init__.py +48 -0
  161. neuralops/benchmarks/core/arguments.py +174 -0
  162. neuralops/benchmarks/core/data_loader.py +149 -0
  163. neuralops/benchmarks/core/evaluation.py +212 -0
  164. neuralops/benchmarks/core/kd.py +124 -0
  165. neuralops/benchmarks/core/model_loader.py +247 -0
  166. neuralops/benchmarks/core/stats.py +99 -0
  167. neuralops/benchmarks/core/training.py +96 -0
  168. neuralops/benchmarks/discovery.py +138 -0
  169. neuralops/benchmarks/discovery_overrides.json +13 -0
  170. neuralops/benchmarks/eval_suite.py +78 -0
  171. neuralops/benchmarks/executor.py +312 -0
  172. neuralops/benchmarks/gpu_live_probe.py +2 -0
  173. neuralops/benchmarks/harvest_gpu_benchmark_data.py +2 -0
  174. neuralops/benchmarks/kd_quick_test.py +20 -0
  175. neuralops/benchmarks/kernel_benchmark.py +51 -0
  176. neuralops/benchmarks/launch_parallel_sweep.py +20 -0
  177. neuralops/benchmarks/multi_mode_benchmark.py +20 -0
  178. neuralops/benchmarks/orchestrator.py +220 -0
  179. neuralops/benchmarks/registry.py +63 -0
  180. neuralops/benchmarks/result.py +108 -0
  181. neuralops/benchmarks/run_all_benchmarks.py +20 -0
  182. neuralops/benchmarks/run_all_modules_scheduler.py +20 -0
  183. neuralops/benchmarks/run_gpt2_sweep.py +20 -0
  184. neuralops/benchmarks/run_long_context_sweep.py +20 -0
  185. neuralops/benchmarks/run_multiseed.py +20 -0
  186. neuralops/benchmarks/run_multiseed_rigor.py +20 -0
  187. neuralops/benchmarks/run_one_module_isolated.py +20 -0
  188. neuralops/benchmarks/run_quality_sweep.py +20 -0
  189. neuralops/benchmarks/run_rank_sweeper.py +20 -0
  190. neuralops/benchmarks/run_ruler_benchmark.py +20 -0
  191. neuralops/benchmarks/run_seqlen_scaling.py +20 -0
  192. neuralops/benchmarks/run_seqlen_scaling_bench.py +20 -0
  193. neuralops/benchmarks/run_whitened_svd.py +20 -0
  194. neuralops/benchmarks/runner.py +51 -0
  195. neuralops/benchmarks/suite_runner.py +119 -0
  196. neuralops/benchmarks/utils/__init__.py +1 -0
  197. neuralops/benchmarks/utils/gpu_probe.py +255 -0
  198. neuralops/benchmarks/utils/harvest_data.py +38 -0
  199. neuralops/benchmarks/writers.py +136 -0
  200. neuralops/compression_engine/__init__.py +89 -0
  201. neuralops/compression_engine/experimental/__init__.py +65 -0
  202. neuralops/compression_engine/experimental/flat_llm.py +680 -0
  203. neuralops/compression_engine/experimental/hashed_net_compressor.py +942 -0
  204. neuralops/compression_engine/experimental/liftr.py +645 -0
  205. neuralops/compression_engine/experimental/lillama_compressor.py +708 -0
  206. neuralops/compression_engine/experimental/roast_hashed_linear.py +585 -0
  207. neuralops/compression_engine/kv_cache/__init__.py +77 -0
  208. neuralops/compression_engine/kv_cache/aatc_xkv_compressor.py +995 -0
  209. neuralops/compression_engine/kv_cache/cachenotes_compressor.py +1121 -0
  210. neuralops/compression_engine/kv_cache/delta_kv.py +620 -0
  211. neuralops/compression_engine/kv_cache/hybridkv_compressor.py +422 -0
  212. neuralops/compression_engine/kv_cache/kvtc_compressor.py +824 -0
  213. neuralops/compression_engine/kv_cache/zerokv_neo_compressor.py +500 -0
  214. neuralops/compression_engine/low_rank/__init__.py +293 -0
  215. neuralops/compression_engine/low_rank/a3_compressor.py +1304 -0
  216. neuralops/compression_engine/low_rank/come_compressor.py +1137 -0
  217. neuralops/compression_engine/low_rank/compot_compressor.py +496 -0
  218. neuralops/compression_engine/low_rank/cr_compressor.py +544 -0
  219. neuralops/compression_engine/low_rank/cur_compressor.py +508 -0
  220. neuralops/compression_engine/low_rank/cur_moe_compressor.py +477 -0
  221. neuralops/compression_engine/low_rank/dora_qlora.py +131 -0
  222. neuralops/compression_engine/low_rank/drone_compressor.py +305 -0
  223. neuralops/compression_engine/low_rank/enlighten_compressor.py +498 -0
  224. neuralops/compression_engine/low_rank/frandi_compressor.py +798 -0
  225. neuralops/compression_engine/low_rank/grecodec_compressor.py +581 -0
  226. neuralops/compression_engine/low_rank/lsc_compressor.py +722 -0
  227. neuralops/compression_engine/low_rank/mgie_svd_compressor.py +634 -0
  228. neuralops/compression_engine/low_rank/mlorq_compressor.py +873 -0
  229. neuralops/compression_engine/low_rank/modegpt_compressor.py +829 -0
  230. neuralops/compression_engine/low_rank/nmf_compressor.py +646 -0
  231. neuralops/compression_engine/low_rank/oats_compressor.py +692 -0
  232. neuralops/compression_engine/low_rank/rpca_compressor.py +490 -0
  233. neuralops/compression_engine/low_rank/salr.py +596 -0
  234. neuralops/compression_engine/low_rank/sdrm_compressor.py +545 -0
  235. neuralops/compression_engine/low_rank/slim_compressor.py +324 -0
  236. neuralops/compression_engine/low_rank/soka_compressor.py +360 -0
  237. neuralops/compression_engine/low_rank/svd_llm_compressor.py +770 -0
  238. neuralops/compression_engine/low_rank/tomoe_compressor.py +767 -0
  239. neuralops/compression_engine/low_rank/uniql_compressor.py +559 -0
  240. neuralops/compression_engine/pruning/__init__.py +113 -0
  241. neuralops/compression_engine/pruning/admm_compressor.py +541 -0
  242. neuralops/compression_engine/pruning/admm_pruner.py +992 -0
  243. neuralops/compression_engine/pruning/armor_pruner.py +971 -0
  244. neuralops/compression_engine/pruning/ast_pruner.py +785 -0
  245. neuralops/compression_engine/pruning/bonsai_pruner.py +638 -0
  246. neuralops/compression_engine/pruning/flap.py +582 -0
  247. neuralops/compression_engine/pruning/mamba_shedder.py +921 -0
  248. neuralops/compression_engine/pruning/proxsparse.py +709 -0
  249. neuralops/compression_engine/pruning/sparsegpt.py +437 -0
  250. neuralops/compression_engine/pruning/wanda.py +67 -0
  251. neuralops/compression_engine/quantization/__init__.py +101 -0
  252. neuralops/compression_engine/quantization/astro_quantizer.py +869 -0
  253. neuralops/compression_engine/quantization/awq.py +64 -0
  254. neuralops/compression_engine/quantization/coopq_quantizer.py +705 -0
  255. neuralops/compression_engine/quantization/faq_quantizer.py +851 -0
  256. neuralops/compression_engine/quantization/gptq.py +101 -0
  257. neuralops/compression_engine/quantization/huffman_coder.py +639 -0
  258. neuralops/compression_engine/quantization/kmeans_quantize.py +879 -0
  259. neuralops/compression_engine/quantization/rotational_slicegpt_int4.py +717 -0
  260. neuralops/compression_engine/quantization/slicegpt.py +618 -0
  261. neuralops/compression_engine/quantization/slicegpt_pca.py +885 -0
  262. neuralops/compression_engine/quantization/smoothquant.py +60 -0
  263. neuralops/compression_engine/svd/__init__.py +221 -0
  264. neuralops/compression_engine/svd/aa_svd_compressor.py +949 -0
  265. neuralops/compression_engine/svd/adaptive_ranks.py +1258 -0
  266. neuralops/compression_engine/svd/adasvd_compressor.py +1462 -0
  267. neuralops/compression_engine/svd/direct_svd.py +567 -0
  268. neuralops/compression_engine/svd/dobi_svd.py +665 -0
  269. neuralops/compression_engine/svd/dynamic_rank.py +1072 -0
  270. neuralops/compression_engine/svd/entropy_budget_allocation.py +587 -0
  271. neuralops/compression_engine/svd/erc_svd.py +562 -0
  272. neuralops/compression_engine/svd/fwsvd_compressor.py +416 -0
  273. neuralops/compression_engine/svd/gfws_d_compressor.py +638 -0
  274. neuralops/compression_engine/svd/hybrid_svd_layer.py +617 -0
  275. neuralops/compression_engine/svd/optimal_subspace_projection.py +731 -0
  276. neuralops/compression_engine/svd/residual_svd_compressor.py +457 -0
  277. neuralops/compression_engine/svd/saes_svd_v2.py +318 -0
  278. neuralops/compression_engine/svd/subspace_projection.py +660 -0
  279. neuralops/compression_engine/svd/svd_linear.py +458 -0
  280. neuralops/compression_engine/svd/swift_svd.py +530 -0
  281. neuralops/compression_engine/svd/swift_svd_act.py +796 -0
  282. neuralops/compression_engine/tensor_decomp/__init__.py +41 -0
  283. neuralops/compression_engine/tensor_decomp/kronecker_compressor.py +1028 -0
  284. neuralops/compression_engine/tensor_decomp/kronecker_tt_lora.py +897 -0
  285. neuralops/compression_engine/tensor_decomp/tt_compressor.py +949 -0
  286. neuralops/config/__init__.py +51 -0
  287. neuralops/config/compression_config.py +94 -0
  288. neuralops/config/config.py +65 -0
  289. neuralops/config/data_config.py +24 -0
  290. neuralops/config/experiment_config.py +45 -0
  291. neuralops/config/hardware_config.py +13 -0
  292. neuralops/config/loader.py +60 -0
  293. neuralops/config/method_config.py +61 -0
  294. neuralops/config/model_config.py +13 -0
  295. neuralops/config/sweep_config.py +15 -0
  296. neuralops/config/training_config.py +29 -0
  297. neuralops/core/__init__.py +97 -0
  298. neuralops/core/_attention_extractors.py +131 -0
  299. neuralops/core/_attention_helpers.py +256 -0
  300. neuralops/core/_attention_injectors.py +541 -0
  301. neuralops/core/_attention_surgery.py +414 -0
  302. neuralops/core/_attention_wrapper.py +497 -0
  303. neuralops/core/adapters.py +254 -0
  304. neuralops/core/architecture.py +202 -0
  305. neuralops/core/attention_mask.py +172 -0
  306. neuralops/core/attention_utils.py +121 -0
  307. neuralops/core/autograd/__init__.py +6 -0
  308. neuralops/core/autograd/flash_attention.py +85 -0
  309. neuralops/core/autograd/fused_backward.py +64 -0
  310. neuralops/core/base.py +190 -0
  311. neuralops/core/common.py +553 -0
  312. neuralops/core/compression_engine.py +21 -0
  313. neuralops/core/compression_pipeline.py +63 -0
  314. neuralops/core/config.py +17 -0
  315. neuralops/core/cuda_graph.py +50 -0
  316. neuralops/core/deprecated_aliases.json +659 -0
  317. neuralops/core/fused_norm_attention.py +50 -0
  318. neuralops/core/gqa_utils.py +88 -0
  319. neuralops/core/legacy_ensemble.py +18 -0
  320. neuralops/core/memory.py +87 -0
  321. neuralops/core/metrics.py +120 -0
  322. neuralops/core/model_family.py +247 -0
  323. neuralops/core/model_utils.py +154 -0
  324. neuralops/core/model_wrapper.py +236 -0
  325. neuralops/core/multi_mode_benchmark.py +17 -0
  326. neuralops/core/pruning_utils.py +490 -0
  327. neuralops/core/quantized_attention.py +79 -0
  328. neuralops/core/registry.py +408 -0
  329. neuralops/core/replace_attention.py +260 -0
  330. neuralops/core/rope.py +147 -0
  331. neuralops/core/selective_scan.py +253 -0
  332. neuralops/core/snapshot_restore.py +96 -0
  333. neuralops/core/svd_utils.py +65 -0
  334. neuralops/core/t5_compat.py +205 -0
  335. neuralops/core/triton_kernels/__init__.py +100 -0
  336. neuralops/core/triton_kernels/_common.py +615 -0
  337. neuralops/core/triton_kernels/_types.py +452 -0
  338. neuralops/core/triton_kernels/autotuner.py +58 -0
  339. neuralops/core/triton_kernels/block_sparse.py +44 -0
  340. neuralops/core/triton_kernels/elementwise.py +52 -0
  341. neuralops/core/triton_kernels/flash_decoding.py +91 -0
  342. neuralops/core/triton_kernels/fms_scan.py +545 -0
  343. neuralops/core/triton_kernels/fused_rope.py +60 -0
  344. neuralops/core/triton_kernels/gdn_scan.py +503 -0
  345. neuralops/core/triton_kernels/gla_scan.py +482 -0
  346. neuralops/core/triton_kernels/gqa.py +166 -0
  347. neuralops/core/triton_kernels/hgrn2_scan.py +254 -0
  348. neuralops/core/triton_kernels/linear_attn.py +451 -0
  349. neuralops/core/triton_kernels/low_rank.py +261 -0
  350. neuralops/core/triton_kernels/paged_attention.py +96 -0
  351. neuralops/core/triton_kernels/selective_scan.py +437 -0
  352. neuralops/core/triton_kernels/sliding_window.py +120 -0
  353. neuralops/core/triton_kernels/softplus.py +59 -0
  354. neuralops/core/triton_kernels/sparse_attn.py +291 -0
  355. neuralops/core/triton_kernels/state_update.py +309 -0
  356. neuralops/core/triton_kernels/varlen_attention.py +51 -0
  357. neuralops/core/triton_linear_attn.py +31 -0
  358. neuralops/core/triton_sparse_attn.py +36 -0
  359. neuralops/core/utils.py +102 -0
  360. neuralops/data/__init__.py +87 -0
  361. neuralops/data/augmentation.py +27 -0
  362. neuralops/data/base.py +367 -0
  363. neuralops/data/benchmark_datasets/__init__.py +50 -0
  364. neuralops/data/benchmark_datasets/loaders.py +308 -0
  365. neuralops/data/benchmark_datasets/manifest.py +328 -0
  366. neuralops/data/benchmark_datasets/synthetic.py +430 -0
  367. neuralops/data/benchmark_datasets.py +43 -0
  368. neuralops/data/cached_tensors.py +168 -0
  369. neuralops/data/custom.py +24 -0
  370. neuralops/data/custom_loader.py +106 -0
  371. neuralops/data/dataset_discovery.py +12 -0
  372. neuralops/data/dataset_loader.py +146 -0
  373. neuralops/data/glue.py +67 -0
  374. neuralops/data/glue_loader.py +212 -0
  375. neuralops/data/multi_choice.py +186 -0
  376. neuralops/data/prepare_datasets.py +496 -0
  377. neuralops/data/preprocessing.py +33 -0
  378. neuralops/data/synthetic_generator.py +397 -0
  379. neuralops/data/task_mapper.py +57 -0
  380. neuralops/data/validation.py +77 -0
  381. neuralops/evaluation/__init__.py +37 -0
  382. neuralops/evaluation/ab_testing.py +53 -0
  383. neuralops/evaluation/eval_all_models_datasets.py +197 -0
  384. neuralops/evaluation/eval_data.py +329 -0
  385. neuralops/evaluation/eval_patcher.py +545 -0
  386. neuralops/evaluation/eval_perplexity.py +384 -0
  387. neuralops/evaluation/eval_pipeline.py +1108 -0
  388. neuralops/evaluation/eval_reporter.py +169 -0
  389. neuralops/evaluation/eval_types.py +391 -0
  390. neuralops/evaluation/eval_utils.py +125 -0
  391. neuralops/evaluation/fairness.py +255 -0
  392. neuralops/evaluation/full_mnli_validation.py +343 -0
  393. neuralops/evaluation/label_quality.py +208 -0
  394. neuralops/evaluation/metrics.py +6 -0
  395. neuralops/evaluation/retraining.py +252 -0
  396. neuralops/evaluation/run_baseline_comparison.py +274 -0
  397. neuralops/evaluation/run_lm_eval_harness.py +388 -0
  398. neuralops/experiment_logging/__init__.py +21 -0
  399. neuralops/experiment_logging/callbacks.py +56 -0
  400. neuralops/experiment_logging/config.py +27 -0
  401. neuralops/experiment_logging/integration.py +56 -0
  402. neuralops/experiment_logging/logger.py +194 -0
  403. neuralops/experiment_logging/tracker.py +39 -0
  404. neuralops/experiment_utils/__init__.py +21 -0
  405. neuralops/experiment_utils/comparison.py +250 -0
  406. neuralops/experiment_utils/config.py +148 -0
  407. neuralops/experiment_utils/data.py +44 -0
  408. neuralops/experiment_utils/main.py +367 -0
  409. neuralops/experiment_utils/model.py +49 -0
  410. neuralops/experiment_utils/orchestrator.py +189 -0
  411. neuralops/experiment_utils/runner.py +13 -0
  412. neuralops/experiment_utils/tasks.py +230 -0
  413. neuralops/experiment_utils/train.py +86 -0
  414. neuralops/inference/__init__.py +20 -0
  415. neuralops/inference/engine.py +254 -0
  416. neuralops/inference/paged_cache.py +107 -0
  417. neuralops/integrations/__init__.py +15 -0
  418. neuralops/integrations/distributed_compile.py +54 -0
  419. neuralops/integrations/hf_automodel.py +61 -0
  420. neuralops/integrations/serving.py +33 -0
  421. neuralops/main.py +855 -0
  422. neuralops/py.typed +0 -0
  423. neuralops/results_saver/__init__.py +21 -0
  424. neuralops/results_saver/backends/__init__.py +9 -0
  425. neuralops/results_saver/backends/huggingface.py +79 -0
  426. neuralops/results_saver/config.py +86 -0
  427. neuralops/results_saver/pipeline/__init__.py +5 -0
  428. neuralops/results_saver/pipeline/result_writer.py +242 -0
  429. neuralops/results_saver/saver.py +506 -0
  430. neuralops/results_saver/storage/__init__.py +0 -0
  431. neuralops/results_saver/storage/sqlite_ops.py +127 -0
  432. neuralops/results_saver/writers/__init__.py +0 -0
  433. neuralops/results_saver/writers/csv_writer.py +108 -0
  434. neuralops/results_saver/writers/json_parquet_writer.py +108 -0
  435. neuralops/results_saver/writers/plot_writer.py +105 -0
  436. neuralops/runners/__init__.py +26 -0
  437. neuralops/runners/module_sweeps/__init__.py +0 -0
  438. neuralops/runners/monitor/__init__.py +47 -0
  439. neuralops/runners/monitor/endpoints.py +141 -0
  440. neuralops/runners/monitor/rendering.py +32 -0
  441. neuralops/runners/monitor/server.py +178 -0
  442. neuralops/runners/monitor/stats.py +192 -0
  443. neuralops/runners/monitor/telemetry.py +160 -0
  444. neuralops/runners/run_autonomous_48h_pipeline.py +649 -0
  445. neuralops/runners/run_continuous_orchestrator.py +165 -0
  446. neuralops/runners/run_master_pipeline.py +163 -0
  447. neuralops/runners/run_monitor_server.py +75 -0
  448. neuralops/runners/run_sweep.py +57 -0
  449. neuralops/runners/unified_orchestrator.py +271 -0
  450. neuralops/tracking/__init__.py +24 -0
  451. neuralops/tracking/backends.py +257 -0
  452. neuralops/tracking/callbacks.py +34 -0
  453. neuralops/tracking/tracker.py +138 -0
  454. neuralops/trainer/__init__.py +143 -0
  455. neuralops/trainer/base_trainer.py +16 -0
  456. neuralops/trainer/callbacks.py +100 -0
  457. neuralops/trainer/custom_loop_trainer.py +237 -0
  458. neuralops/trainer/hf_trainer.py +122 -0
  459. neuralops/trainer/hyperopt.py +148 -0
  460. neuralops/trainer/losses.py +94 -0
  461. neuralops/trainer/methods/__init__.py +52 -0
  462. neuralops/trainer/methods/fisher.py +100 -0
  463. neuralops/trainer/methods/gelora.py +141 -0
  464. neuralops/trainer/methods/llrd.py +76 -0
  465. neuralops/trainer/methods/lora.py +164 -0
  466. neuralops/trainer/methods/mixout.py +58 -0
  467. neuralops/trainer/methods/rdrop_r3f.py +140 -0
  468. neuralops/trainer/methods/registry.py +59 -0
  469. neuralops/trainer/metrics.py +113 -0
  470. neuralops/trainer/optimizers/__init__.py +53 -0
  471. neuralops/trainer/optimizers/factory.py +139 -0
  472. neuralops/trainer/optimizers/muon.py +257 -0
  473. neuralops/trainer/optimizers/riemannian.py +354 -0
  474. neuralops/trainer/optimizers/stiefel.py +165 -0
  475. neuralops/trainer/optimizers.py +47 -0
  476. neuralops/trainer/registry.py +43 -0
  477. neuralops/trainer/results_manager.py +179 -0
  478. neuralops/trainer/rl_trainer.py +177 -0
  479. neuralops/trainer/schedulers.py +65 -0
  480. neuralops/trainer/train_lra.py +426 -0
  481. neuralops/trainer/trainer.py +270 -0
  482. neuralops/trainer/trainer_factory.py +15 -0
  483. neuralops/trainer/trainer_svd.py +133 -0
  484. neuralops/trainer/unsloth_trainer.py +82 -0
  485. neuralops/trainer/utils.py +455 -0
  486. neuralops/training/__init__.py +18 -0
  487. neuralops/training/checkpointing.py +53 -0
  488. neuralops/training/trainer.py +173 -0
  489. neuralops/utils/__init__.py +96 -0
  490. neuralops/utils/architecture.py +145 -0
  491. neuralops/utils/attention_profiler.py +63 -0
  492. neuralops/utils/attention_utils.py +0 -0
  493. neuralops/utils/checkpoint.py +69 -0
  494. neuralops/utils/compat/__init__.py +53 -0
  495. neuralops/utils/compat/aliases.py +49 -0
  496. neuralops/utils/compat/architectures.py +495 -0
  497. neuralops/utils/compat/param_recovery.py +372 -0
  498. neuralops/utils/compat.py +51 -0
  499. neuralops/utils/config.py +47 -0
  500. neuralops/utils/device.py +13 -0
  501. neuralops/utils/helpers.py +97 -0
  502. neuralops/utils/hf_git_exporter.py +560 -0
  503. neuralops/utils/layer_norm_fix.py +193 -0
  504. neuralops/utils/logger.py +37 -0
  505. neuralops/utils/lora.py +265 -0
  506. neuralops/utils/metrics.py +71 -0
  507. neuralops/utils/model_family.py +26 -0
  508. neuralops/utils/paths.py +22 -0
  509. neuralops/utils/profiler.py +167 -0
  510. neuralops/utils/qwen_compat.py +270 -0
  511. neuralops/utils/replace_attention.py +598 -0
  512. neuralops/utils/results_saver.py +76 -0
  513. neuralops/utils/seed.py +16 -0
  514. neuralops-1.1.1.dist-info/METADATA +538 -0
  515. neuralops-1.1.1.dist-info/RECORD +519 -0
  516. neuralops-1.1.1.dist-info/WHEEL +5 -0
  517. neuralops-1.1.1.dist-info/entry_points.txt +2 -0
  518. neuralops-1.1.1.dist-info/licenses/LICENSE +21 -0
  519. neuralops-1.1.1.dist-info/top_level.txt +1 -0
neuralops/__init__.py ADDED
@@ -0,0 +1,235 @@
1
+ """
2
+ NeuralOps Core ML Framework & Efficient Transformer Toolkit.
3
+
4
+ A unified, modular, and high-performance toolkit for custom attention mechanisms,
5
+ model compression (SVD, quantization, pruning, distillation), distributed training,
6
+ hyperparameter optimization, federated learning, data loading, benchmarking,
7
+ and interactive visualization.
8
+ """
9
+
10
+ import importlib
11
+ from typing import Any, List
12
+
13
+ __version__ = "1.1.1"
14
+
15
+ import importlib.machinery
16
+ import importlib.util
17
+
18
+ # Transparent Import Hook for Cleaned Submodule Aliases
19
+ import sys
20
+ from importlib.abc import MetaPathFinder
21
+
22
+
23
+ class _AliasLoader:
24
+ def __init__(self, mod):
25
+ """Execute __init__ operation."""
26
+ self.mod = mod
27
+
28
+ def create_module(self, spec):
29
+ """Execute create_module operation."""
30
+ return self.mod
31
+
32
+ def exec_module(self, module):
33
+ """Execute exec_module operation."""
34
+ pass
35
+
36
+
37
+ class _ModuleAliasFinder(MetaPathFinder):
38
+ _ALIASES = {
39
+ # Attentions
40
+ "neuralops.attentions.gqa": "neuralops.attentions.gqa_attention",
41
+ "neuralops.attentions.galerkin": "neuralops.attentions.galerkin_attention",
42
+ "neuralops.attentions.galerkin_inject": "neuralops.attentions.galerkin_attention",
43
+ "neuralops.attentions.adaptive_span_inject": "neuralops.attentions.adaptive_span_attention",
44
+ "neuralops.attentions.adaptive_sparse_inject": "neuralops.attentions.adaptive_sparse_attention",
45
+ "neuralops.attentions.adasplash_inject": "neuralops.attentions.adasplash_attention",
46
+ "neuralops.attentions.aegis_hybrid_attention": "neuralops.attentions.aegis_hybrid",
47
+ "neuralops.attentions.aegis_v1": "neuralops.attentions.aegis_v2",
48
+ "neuralops.attentions.aegis_v3": "neuralops.attentions.aegis_v2",
49
+ "neuralops.attentions.aegis_v4": "neuralops.attentions.aegis_v2",
50
+ "neuralops.attentions.minimal_aurora": "neuralops.attentions.minimal_svd",
51
+ "neuralops.attentions.minimal_prism": "neuralops.attentions.minimal_svd",
52
+ "neuralops.attentions.minimal_svd_v2": "neuralops.attentions.minimal_svd",
53
+ "neuralops.attentions.cluster_inject": "neuralops.attentions.cluster_attention",
54
+ "neuralops.attentions.compressed_mha": "neuralops.attentions.compressed_mha_attention",
55
+ "neuralops.attentions.cosformer_inject": "neuralops.attentions.cosformer",
56
+ "neuralops.attentions.hla_inject": "neuralops.attentions.hla_attention",
57
+ "neuralops.attentions.kda_inject": "neuralops.attentions.kda_attention",
58
+ "neuralops.attentions.leka_v1_inject": "neuralops.attentions.leka_v1",
59
+ "neuralops.attentions.leka_v2_inject": "neuralops.attentions.leka_v2",
60
+ "neuralops.attentions.leka_v3_inject": "neuralops.attentions.leka_v3",
61
+ "neuralops.attentions.mamba_attention": "neuralops.attentions.mamba_block",
62
+ "neuralops.attentions.moba": "neuralops.attentions.moba_attention",
63
+ "neuralops.attentions.nha_compressor": "neuralops.attentions.nha_attention",
64
+ "neuralops.attentions.rpc": "neuralops.attentions.rpc_attention",
65
+ "neuralops.attentions.salt": "neuralops.attentions.salt_attention",
66
+ "neuralops.attentions.soa_fused_module": "neuralops.attentions.soa_attn",
67
+ "neuralops.attentions.SOAFusedAttention": "neuralops.attentions.soa_attn",
68
+ "neuralops.attentions.soa_module": "neuralops.attentions.soa_attn",
69
+ "neuralops.attentions.spectra_v2_attention": "neuralops.attentions.spectra_v2",
70
+ "neuralops.attentions.svd_compressed_attention": "neuralops.attentions.svd_compressed",
71
+ "neuralops.attentions.svd_llm_v2": "neuralops.attentions.svd_llm_v2_attention",
72
+ "neuralops.attentions.svd_proj_attn": "neuralops.attentions.svd_projection_attention",
73
+ "neuralops.attentions.token_compressed": "neuralops.attentions.token_compressed_attention",
74
+ "neuralops.attentions.tt": "neuralops.attentions.token_compressed_attention",
75
+ "neuralops.attentions.upi_mamba": "neuralops.attentions.upi_stuffed_mamba",
76
+ "neuralops.attentions.mamba": "neuralops.attentions.mamba_block",
77
+ "neuralops.attentions.mamba_inject": "neuralops.attentions.mamba_block",
78
+ "neuralops.attentions.simple_ssm": "neuralops.attentions.selective_ssm",
79
+ "neuralops.attentions.smart_weighted_ensemble": "neuralops.attentions.hybrid_attention",
80
+ "neuralops.attentions.weighted_ensemble": "neuralops.attentions.hybrid_attention",
81
+ "neuralops.attentions.spectron_attention": "neuralops.attentions.spectron",
82
+ "neuralops.attentions.squeezing_heads": "neuralops.attentions.squeezing_heads_distill",
83
+ "neuralops.attentions.squeezing_heads_distiller": "neuralops.attentions.squeezing_heads_distill",
84
+ "neuralops.attentions.spectral_mamba_attention": "neuralops.attentions.spectral_mamba",
85
+ "neuralops.attentions.svd_sequence_attention": "neuralops.attentions.svd_attention",
86
+ "neuralops.attentions.rala_compressor": "neuralops.attentions.rala_attention",
87
+ "neuralops.attentions.selective_scan": "neuralops.core.selective_scan",
88
+ "neuralops.attentions.ssm_scan": "neuralops.core.selective_scan",
89
+ "neuralops.attentions.legacy_ensemble": "neuralops.core.legacy_ensemble",
90
+ # Compressors
91
+ "neuralops.compression_engine.aasvd": "neuralops.compression_engine.aa_svd_compressor",
92
+ "neuralops.compression_engine.adasvd": "neuralops.compression_engine.adasvd_compressor",
93
+ "neuralops.compression_engine.cur_moe": "neuralops.compression_engine.cur_moe_compressor",
94
+ "neuralops.compression_engine.frandi": "neuralops.compression_engine.frandi_compressor",
95
+ "neuralops.compression_engine.grecodec": "neuralops.compression_engine.grecodec_compressor",
96
+ "neuralops.compression_engine.hybridkv": "neuralops.compression_engine.hybridkv_compressor",
97
+ "neuralops.compression_engine.kvtc": "neuralops.compression_engine.kvtc_compressor",
98
+ "neuralops.compression_engine.modegpt": "neuralops.compression_engine.modegpt_compressor",
99
+ "neuralops.compression_engine.oats": "neuralops.compression_engine.oats_compressor",
100
+ "neuralops.compression_engine.proxsparse_pruner": "neuralops.compression_engine.proxsparse",
101
+ "neuralops.compression_engine.rpca": "neuralops.compression_engine.rpca_compressor",
102
+ "neuralops.compression_engine.saes_svd": "neuralops.compression_engine.saes_svd_v2",
103
+ "neuralops.compression_engine.saes_svd_compressor": "neuralops.compression_engine.saes_svd_v2",
104
+ "neuralops.compression_engine.sdrm": "neuralops.compression_engine.sdrm_compressor",
105
+ "neuralops.compression_engine.slicegpt_compressor": "neuralops.compression_engine.slicegpt",
106
+ "neuralops.compression_engine.soka": "neuralops.compression_engine.soka_compressor",
107
+ "neuralops.compression_engine.swift_svd_compressor": "neuralops.compression_engine.swift_svd_act",
108
+ "neuralops.compression_engine.zerokv_neo": "neuralops.compression_engine.zerokv_neo_compressor",
109
+ "neuralops.compression_engine.cure": "neuralops.compression_engine.cur_moe_compressor",
110
+ "neuralops.compression_engine.dobi": "neuralops.compression_engine.dobi_svd",
111
+ "neuralops.compression_engine.dynamic_entropy": "neuralops.compression_engine.dynamic_rank",
112
+ "neuralops.compression_engine.tomoe": "neuralops.compression_engine.tomoe_compressor",
113
+ "neuralops.compression_engine.adaptive_compressor": "neuralops.compression_engine.adaptive_ranks",
114
+ "neuralops.compression_engine.padre_attention": "neuralops.attentions.padre_attention",
115
+ "neuralops.compression_engine.spectraformer_attention": "neuralops.attentions.spectraformer_attention",
116
+ "neuralops.compression_engine.tlinformer_attention": "neuralops.attentions.tlinformer_attention",
117
+ "neuralops.compression_engine.pruning_utils": "neuralops.core.pruning_utils",
118
+ "neuralops.compression_engine.cur_linear": "neuralops.compression_engine.cur_compressor",
119
+ "neuralops.compression_engine.kronecker_linear": "neuralops.compression_engine.kronecker_compressor",
120
+ "neuralops.compression_engine.tt_linear": "neuralops.compression_engine.tt_compressor",
121
+ "neuralops.compression_engine.hashed_linear": "neuralops.compression_engine.hashed_net_compressor",
122
+ "neuralops.compression_engine.come": "neuralops.compression_engine.come_compressor",
123
+ "neuralops.compression_engine.rala_compressor": "neuralops.attentions.rala_attention",
124
+ # Reorganized Benchmarks & Sweepers
125
+ "neuralops.run_quality_sweep": "neuralops.benchmarks.run_quality_sweep",
126
+ "neuralops.run_rank_sweeper": "neuralops.benchmarks.run_rank_sweeper",
127
+ "neuralops.run_all_benchmarks": "neuralops.benchmarks.run_all_benchmarks",
128
+ "neuralops.run_gpt2_sweep": "neuralops.benchmarks.run_gpt2_sweep",
129
+ "neuralops.run_long_context_sweep": "neuralops.benchmarks.run_long_context_sweep",
130
+ "neuralops.run_seqlen_scaling": "neuralops.benchmarks.run_seqlen_scaling",
131
+ "neuralops.run_seqlen_scaling_bench": "neuralops.benchmarks.run_seqlen_scaling_bench",
132
+ "neuralops.run_multiseed": "neuralops.benchmarks.run_multiseed",
133
+ "neuralops.run_multiseed_rigor": "neuralops.benchmarks.run_multiseed_rigor",
134
+ "neuralops.run_one_module_isolated": "neuralops.benchmarks.run_one_module_isolated",
135
+ "neuralops.run_ruler_benchmark": "neuralops.benchmarks.run_ruler_benchmark",
136
+ "neuralops.run_whitened_svd": "neuralops.benchmarks.run_whitened_svd",
137
+ "neuralops.launch_parallel_sweep": "neuralops.benchmarks.launch_parallel_sweep",
138
+ "neuralops.run_all_modules_scheduler": "neuralops.benchmarks.run_all_modules_scheduler",
139
+ "neuralops.kd_quick_test": "neuralops.benchmarks.kd_quick_test",
140
+ # Reorganized Evaluation & Verification
141
+ "neuralops.eval_all_models_datasets": "neuralops.evaluation.eval_all_models_datasets",
142
+ "neuralops.eval_perplexity": "neuralops.evaluation.eval_perplexity",
143
+ "neuralops.full_mnli_validation": "neuralops.evaluation.full_mnli_validation",
144
+ "neuralops.run_lm_eval_harness": "neuralops.evaluation.run_lm_eval_harness",
145
+ "neuralops.run_baseline_comparison": "neuralops.evaluation.run_baseline_comparison",
146
+ # Reorganized Trainer & Analysis
147
+ "neuralops.train_lra": "neuralops.trainer.train_lra",
148
+ "neuralops.generate_all_modules_analysis": "neuralops.analysis.generate_all_modules_analysis",
149
+ }
150
+
151
+ def find_spec(self, fullname, path, target=None):
152
+ """Execute find_spec operation."""
153
+ if fullname in self._ALIASES:
154
+ canonical = self._ALIASES[fullname]
155
+ try:
156
+ mod = importlib.import_module(canonical)
157
+ sys.modules[fullname] = mod
158
+ return getattr(mod, "__spec__", None)
159
+ except Exception:
160
+ pass
161
+ return None
162
+
163
+
164
+ if not any(isinstance(finder, _ModuleAliasFinder) for finder in sys.meta_path):
165
+ sys.meta_path.insert(0, _ModuleAliasFinder())
166
+
167
+
168
+ # Symbol to (module_path, attr_name) mapping for fast, lazy resolution
169
+ _LAZY_EXPORTS = {
170
+ "ABTestResult": ("neuralops.evaluation.ab_testing", "ABTestResult"),
171
+ "ABTester": ("neuralops.evaluation.ab_testing", "ABTester"),
172
+ "ATTENTION_REGISTRY": ("neuralops.core.registry", "ATTENTION_REGISTRY"),
173
+ "BaseAttention": ("neuralops.core.base", "BaseAttention"),
174
+ "BaseCompressor": ("neuralops.core.base", "BaseCompressor"),
175
+ "BaseTrainer": ("neuralops.trainer.base_trainer", "BaseTrainer"),
176
+ "BenchmarkDatasetInfo": ("neuralops.data.benchmark_datasets", "BenchmarkDatasetInfo"),
177
+ "BenchmarkDatasetRegistry": ("neuralops.data.benchmark_datasets", "BenchmarkDatasetRegistry"),
178
+ "COMPRESSOR_REGISTRY": ("neuralops.core.registry", "COMPRESSOR_REGISTRY"),
179
+ "CompressionPipeline": ("neuralops.core.compression_pipeline", "CompressionPipeline"),
180
+ "CustomLoopTrainer": ("neuralops.trainer.custom_loop_trainer", "CustomLoopTrainer"),
181
+ "DataConfig": ("neuralops.data.base", "DataConfig"),
182
+ "ExperimentConfig": ("neuralops.data.dataset_loader", "ExperimentConfig"),
183
+ "FairnessEvaluator": ("neuralops.evaluation.fairness", "FairnessEvaluator"),
184
+ "FairnessReport": ("neuralops.evaluation.fairness", "FairnessReport"),
185
+ "GLUE_TASK_KEYS": ("neuralops.data.glue_loader", "GLUE_TASK_KEYS"),
186
+ "HuggingFaceTrainer": ("neuralops.trainer.hf_trainer", "HuggingFaceTrainer"),
187
+ "LabelQualityDetector": ("neuralops.evaluation.label_quality", "LabelQualityDetector"),
188
+ "LabelQualityReport": ("neuralops.evaluation.label_quality", "LabelQualityReport"),
189
+ "MultiModeBenchmarkRunner": ("neuralops.benchmarks.multi_mode_benchmark", "MultiModeBenchmarkRunner"),
190
+ "ResultWriter": ("neuralops.pipeline.result_writer", "ResultWriter"),
191
+ "ResultsSaver": ("neuralops.results_saver", "ResultsSaver"),
192
+ "RetrainDecision": ("neuralops.evaluation.retraining", "RetrainDecision"),
193
+ "RetrainPolicy": ("neuralops.evaluation.retraining", "RetrainPolicy"),
194
+ "RetrainingOrchestrator": ("neuralops.evaluation.retraining", "RetrainingOrchestrator"),
195
+ "TaskType": ("neuralops.data.base", "TaskType"),
196
+ "TrainerRegistry": ("neuralops.trainer.registry", "TrainerRegistry"),
197
+ "UnifiedTransformerConfig": ("neuralops.core.model_wrapper", "UnifiedTransformerConfig"),
198
+ "UnifiedTransformerModel": ("neuralops.core.model_wrapper", "UnifiedTransformerModel"),
199
+ "aggregate_results": ("neuralops.trainer.metrics", "aggregate_results"),
200
+ "compress_model": ("neuralops.core.compression_pipeline", "compress_model"),
201
+ "create_dataloader": ("neuralops.data.base", "create_dataloader"),
202
+ "detect_architecture": ("neuralops.core.architecture", "detect_architecture"),
203
+ "fms_scan_triton": ("neuralops.core.triton_kernels", "fms_scan_triton"),
204
+ "generate_synthetic_data": ("neuralops.data.synthetic_generator", "generate_synthetic_data"),
205
+ "get_calibration_dataloader": ("neuralops.data", "get_calibration_dataloader"),
206
+ "get_task_metrics": ("neuralops.trainer.metrics", "get_task_metrics"),
207
+ "gla_scan_triton": ("neuralops.core.triton_kernels", "gla_scan_triton"),
208
+ "inject_attention": ("neuralops.core.attention_utils", "inject_attention"),
209
+ "linear_attn": ("neuralops.core.triton_kernels", "linear_attn"),
210
+ "load_benchmark_dataset": ("neuralops.data.benchmark_datasets", "load_benchmark_dataset"),
211
+ "load_dataset": ("neuralops.data.dataset_loader", "load_dataset"),
212
+ "load_glue_local": ("neuralops.data.glue_loader", "load_glue_local"),
213
+ "preprocess_function": ("neuralops.data.base", "preprocess_function"),
214
+ "run_universal_generation": ("neuralops.data.synthetic_generator", "run_universal_generation"),
215
+ "selective_scan_fn": ("neuralops.core.triton_kernels", "selective_scan_fn"),
216
+ "triton_dispatch": ("neuralops.core.triton_kernels", "triton_dispatch"),
217
+ }
218
+
219
+ __all__: list[str] = ["__version__"] + sorted(list(_LAZY_EXPORTS.keys()))
220
+
221
+
222
+ def __getattr__(name: str) -> Any:
223
+ """Execute __getattr__ operation."""
224
+ if name in _LAZY_EXPORTS:
225
+ module_path, attr_name = _LAZY_EXPORTS[name]
226
+ module = importlib.import_module(module_path)
227
+ val = getattr(module, attr_name)
228
+ globals()[name] = val # cache attribute on module
229
+ return val
230
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
231
+
232
+
233
+ def __dir__() -> list[str]:
234
+ """Execute __dir__ operation."""
235
+ return sorted(list(globals().keys()) + __all__)
@@ -0,0 +1,101 @@
1
+ """
2
+ Analysis tools: plotting, metrics, layerwise analysis, model comparison, reporting.
3
+ """
4
+
5
+ from .layerwise_analyzer import LayerwiseAnalyzer, estimate_intrinsic_dimension
6
+ from .metrics import MetricsTracker, aggregate_results, compute_metrics
7
+ from .model_comparison import ModelComparison, quick_compare
8
+ from .plotting import (
9
+ create_comprehensive_plots,
10
+ plot_accuracy_curve,
11
+ plot_attention_heatmap,
12
+ plot_confusion_matrix,
13
+ plot_gpu_memory,
14
+ plot_gradient_flow,
15
+ plot_loss_curve,
16
+ plot_lr_schedule,
17
+ plot_parameter_distribution,
18
+ plot_pareto_front,
19
+ plot_radar_chart,
20
+ plot_rank_allocation,
21
+ plot_tradeoff,
22
+ plot_training_history,
23
+ plot_training_time,
24
+ set_style,
25
+ )
26
+ from .report_generator import (
27
+ generate_full_report,
28
+ generate_html_report,
29
+ generate_interactive_report,
30
+ generate_latex_table,
31
+ )
32
+ from .utils import (
33
+ correlation_matrix,
34
+ detect_least_compressible_layers,
35
+ filter_results,
36
+ get_best_configurations,
37
+ statistical_tests,
38
+ )
39
+
40
+ __all__ = [
41
+ "plot_loss_curve",
42
+ "plot_accuracy_curve",
43
+ "plot_lr_schedule",
44
+ "plot_training_time",
45
+ "plot_confusion_matrix",
46
+ "plot_gradient_flow",
47
+ "plot_gpu_memory",
48
+ "plot_parameter_distribution",
49
+ "plot_rank_allocation",
50
+ "plot_radar_chart",
51
+ "plot_attention_heatmap",
52
+ "create_comprehensive_plots",
53
+ "plot_tradeoff",
54
+ "plot_pareto_front",
55
+ "plot_training_history",
56
+ "set_style",
57
+ "MetricsTracker",
58
+ "compute_metrics",
59
+ "aggregate_results",
60
+ "LayerwiseAnalyzer",
61
+ "estimate_intrinsic_dimension",
62
+ "ModelComparison",
63
+ "quick_compare",
64
+ "generate_html_report",
65
+ "generate_latex_table",
66
+ "generate_full_report",
67
+ "generate_interactive_report",
68
+ "detect_least_compressible_layers",
69
+ "filter_results",
70
+ "correlation_matrix",
71
+ "statistical_tests",
72
+ ]
73
+
74
+ # Statistical testing suite
75
+ from .comparison import ( # noqa: E402
76
+ bayesian_correlated_ttest,
77
+ bayesian_signed_rank_test,
78
+ finner_correction,
79
+ hochberg_correction,
80
+ holland_copenhaver_correction,
81
+ holm_correction,
82
+ hommel_correction,
83
+ mcnemar_test,
84
+ run_full_statistical_analysis,
85
+ sign_test,
86
+ wilcoxon_signed_rank_test,
87
+ )
88
+
89
+ __all__ += [
90
+ "holm_correction",
91
+ "hochberg_correction",
92
+ "finner_correction",
93
+ "hommel_correction",
94
+ "holland_copenhaver_correction",
95
+ "wilcoxon_signed_rank_test",
96
+ "sign_test",
97
+ "mcnemar_test",
98
+ "bayesian_correlated_ttest",
99
+ "bayesian_signed_rank_test",
100
+ "run_full_statistical_analysis",
101
+ ]
@@ -0,0 +1,28 @@
1
+ """Statistical comparison utilities for benchmark analysis."""
2
+ from neuralops.analysis.comparison.statistical_tests import (
3
+ bayesian_correlated_ttest,
4
+ bayesian_signed_rank_test,
5
+ finner_correction,
6
+ hochberg_correction,
7
+ holland_copenhaver_correction,
8
+ holm_correction,
9
+ hommel_correction,
10
+ mcnemar_test,
11
+ run_full_statistical_analysis,
12
+ sign_test,
13
+ wilcoxon_signed_rank_test,
14
+ )
15
+
16
+ __all__ = [
17
+ "holm_correction",
18
+ "hochberg_correction",
19
+ "finner_correction",
20
+ "hommel_correction",
21
+ "holland_copenhaver_correction",
22
+ "wilcoxon_signed_rank_test",
23
+ "sign_test",
24
+ "mcnemar_test",
25
+ "bayesian_correlated_ttest",
26
+ "bayesian_signed_rank_test",
27
+ "run_full_statistical_analysis",
28
+ ]