invarlock 0.3.7__tar.gz → 0.3.9__tar.gz

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 (158) hide show
  1. invarlock-0.3.9/PKG-INFO +303 -0
  2. invarlock-0.3.9/README.md +196 -0
  3. {invarlock-0.3.7 → invarlock-0.3.9}/pyproject.toml +9 -9
  4. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/__init__.py +3 -3
  5. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/auto.py +2 -10
  6. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/hf_loading.py +7 -7
  7. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/hf_mixin.py +28 -5
  8. invarlock-0.3.9/src/invarlock/assurance/__init__.py +35 -0
  9. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/calibration/spectral_null.py +1 -1
  10. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/adapter_auto.py +1 -5
  11. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/app.py +57 -27
  12. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/commands/__init__.py +2 -2
  13. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/commands/calibrate.py +48 -4
  14. invarlock-0.3.7/src/invarlock/cli/commands/certify.py → invarlock-0.3.9/src/invarlock/cli/commands/evaluate.py +69 -46
  15. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/commands/explain_gates.py +94 -51
  16. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/commands/export_html.py +11 -9
  17. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/commands/report.py +121 -47
  18. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/commands/run.py +274 -66
  19. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/commands/verify.py +84 -89
  20. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/determinism.py +1 -1
  21. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/provenance.py +3 -3
  22. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/bootstrap.py +1 -1
  23. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/retry.py +14 -14
  24. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/runner.py +1 -1
  25. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/edits/noop.py +2 -2
  26. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/edits/quant_rtn.py +2 -2
  27. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/__init__.py +1 -1
  28. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/bench.py +11 -7
  29. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/primary_metric.py +1 -1
  30. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards/spectral.py +2 -2
  31. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards_ref/spectral_ref.py +1 -1
  32. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/model_profile.py +16 -35
  33. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/observability/health.py +38 -20
  34. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/plugins/hf_bnb_adapter.py +32 -21
  35. invarlock-0.3.9/src/invarlock/reporting/__init__.py +21 -0
  36. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/html.py +7 -7
  37. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/normalizer.py +2 -2
  38. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/policy_utils.py +1 -1
  39. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/primary_metric_utils.py +11 -11
  40. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/render.py +126 -120
  41. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/report.py +43 -37
  42. invarlock-0.3.7/src/invarlock/reporting/certificate.py → invarlock-0.3.9/src/invarlock/reporting/report_builder.py +103 -99
  43. invarlock-0.3.7/src/invarlock/reporting/certificate_schema.py → invarlock-0.3.9/src/invarlock/reporting/report_schema.py +22 -22
  44. invarlock-0.3.9/src/invarlock.egg-info/PKG-INFO +303 -0
  45. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock.egg-info/SOURCES.txt +3 -3
  46. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock.egg-info/requires.txt +7 -7
  47. invarlock-0.3.7/PKG-INFO +0 -602
  48. invarlock-0.3.7/README.md +0 -495
  49. invarlock-0.3.7/src/invarlock/assurance/__init__.py +0 -43
  50. invarlock-0.3.7/src/invarlock/reporting/__init__.py +0 -7
  51. invarlock-0.3.7/src/invarlock.egg-info/PKG-INFO +0 -602
  52. {invarlock-0.3.7 → invarlock-0.3.9}/LICENSE +0 -0
  53. {invarlock-0.3.7 → invarlock-0.3.9}/MANIFEST.in +0 -0
  54. {invarlock-0.3.7 → invarlock-0.3.9}/setup.cfg +0 -0
  55. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/__main__.py +0 -0
  56. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/_data/runtime/profiles/ci_cpu.yaml +0 -0
  57. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/_data/runtime/profiles/release.yaml +0 -0
  58. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/_data/runtime/tiers.yaml +0 -0
  59. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/__init__.py +0 -0
  60. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/_capabilities.py +0 -0
  61. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/base.py +0 -0
  62. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/base_types.py +0 -0
  63. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/capabilities.py +0 -0
  64. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/hf_causal.py +0 -0
  65. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/hf_causal_onnx.py +0 -0
  66. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/hf_mlm.py +0 -0
  67. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/hf_seq2seq.py +0 -0
  68. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/adapters/py.typed +0 -0
  69. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/calibration/__init__.py +0 -0
  70. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/calibration/variance_ve.py +0 -0
  71. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/__init__.py +0 -0
  72. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/__main__.py +0 -0
  73. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/_evidence.py +0 -0
  74. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/_json.py +0 -0
  75. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/commands/doctor.py +0 -0
  76. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/commands/plugins.py +0 -0
  77. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/config.py +0 -0
  78. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/constants.py +0 -0
  79. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/device.py +0 -0
  80. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/doctor_helpers.py +0 -0
  81. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/errors.py +0 -0
  82. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/output.py +0 -0
  83. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/overhead_utils.py +0 -0
  84. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/cli/utils.py +0 -0
  85. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/config.py +0 -0
  86. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/__init__.py +0 -0
  87. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/abi.py +0 -0
  88. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/api.py +0 -0
  89. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/auto_tuning.py +0 -0
  90. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/checkpoint.py +0 -0
  91. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/contracts.py +0 -0
  92. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/error_utils.py +0 -0
  93. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/events.py +0 -0
  94. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/exceptions.py +0 -0
  95. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/registry.py +0 -0
  96. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/core/types.py +0 -0
  97. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/edits/__init__.py +0 -0
  98. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/edits/_edit_utils.py +0 -0
  99. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/edits/_external_utils.py +0 -0
  100. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/edits/py.typed +0 -0
  101. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/edits/registry.py +0 -0
  102. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/bench_regression.py +0 -0
  103. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/bootstrap.py +0 -0
  104. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/data.py +0 -0
  105. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/metrics.py +0 -0
  106. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/probes/__init__.py +0 -0
  107. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/probes/fft.py +0 -0
  108. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/probes/mi.py +0 -0
  109. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/probes/post_attention.py +0 -0
  110. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/providers/base.py +0 -0
  111. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/providers/seq2seq.py +0 -0
  112. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/providers/text_lm.py +0 -0
  113. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/providers/vision_text.py +0 -0
  114. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/py.typed +0 -0
  115. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/tail_stats.py +0 -0
  116. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/tasks/__init__.py +0 -0
  117. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/tasks/classification.py +0 -0
  118. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/tasks/qa.py +0 -0
  119. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/eval/tasks/text_generation.py +0 -0
  120. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards/__init__.py +0 -0
  121. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards/_contracts.py +0 -0
  122. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards/_estimators.py +0 -0
  123. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards/invariants.py +0 -0
  124. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards/policies.py +0 -0
  125. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards/py.typed +0 -0
  126. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards/rmt.py +0 -0
  127. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards/tier_config.py +0 -0
  128. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards/variance.py +0 -0
  129. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards_ref/__init__.py +0 -0
  130. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards_ref/rmt_ref.py +0 -0
  131. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/guards_ref/variance_ref.py +0 -0
  132. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/model_utils.py +0 -0
  133. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/observability/__init__.py +0 -0
  134. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/observability/alerting.py +0 -0
  135. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/observability/core.py +0 -0
  136. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/observability/exporters.py +0 -0
  137. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/observability/metrics.py +0 -0
  138. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/observability/py.typed +0 -0
  139. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/observability/utils.py +0 -0
  140. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/plugins/__init__.py +0 -0
  141. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/plugins/hello_guard.py +0 -0
  142. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/plugins/hf_awq_adapter.py +0 -0
  143. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/plugins/hf_gptq_adapter.py +0 -0
  144. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/plugins/py.typed +0 -0
  145. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/py.typed +0 -0
  146. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/dataset_hashing.py +0 -0
  147. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/guards_analysis.py +0 -0
  148. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/report_types.py +0 -0
  149. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/telemetry.py +0 -0
  150. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/utils.py +0 -0
  151. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/reporting/validate.py +0 -0
  152. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/security.py +0 -0
  153. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/sparsity_utils.py +0 -0
  154. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/utils/__init__.py +0 -0
  155. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock/utils/digest.py +0 -0
  156. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock.egg-info/dependency_links.txt +0 -0
  157. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock.egg-info/entry_points.txt +0 -0
  158. {invarlock-0.3.7 → invarlock-0.3.9}/src/invarlock.egg-info/top_level.txt +0 -0
@@ -0,0 +1,303 @@
1
+ Metadata-Version: 2.4
2
+ Name: invarlock
3
+ Version: 0.3.9
4
+ Summary: Edit‑agnostic robustness evaluation reports for weight edits (InvarLock framework)
5
+ Author-email: InvarLock Team <oss@invarlock.dev>
6
+ Maintainer-email: InvarLock Maintainers <support@invarlock.dev>
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Homepage, https://github.com/invarlock/invarlock
9
+ Project-URL: Repository, https://github.com/invarlock/invarlock
10
+ Project-URL: Documentation, https://github.com/invarlock/invarlock/tree/main/docs
11
+ Project-URL: Issues, https://github.com/invarlock/invarlock/issues
12
+ Project-URL: Changelog, https://github.com/invarlock/invarlock/blob/main/CHANGELOG.md
13
+ Keywords: machine-learning,deep-learning,transformers,pytorch,llm,quantization,safety,evaluation,certification
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Operating System :: OS Independent
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.12
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: typer>=0.15
27
+ Requires-Dist: click>=8.1
28
+ Requires-Dist: shellingham>=1.5.0
29
+ Requires-Dist: pandas>=2.2
30
+ Requires-Dist: scikit-learn>=1.4
31
+ Requires-Dist: pydantic>=2.0
32
+ Requires-Dist: rich>=13.0
33
+ Requires-Dist: pyyaml>=6.0
34
+ Requires-Dist: markdown>=3.5
35
+ Requires-Dist: psutil>=5.9
36
+ Requires-Dist: hypothesis>=6.98
37
+ Requires-Dist: typing_extensions>=4.7
38
+ Requires-Dist: jsonschema>=4.0
39
+ Provides-Extra: adapters
40
+ Requires-Dist: torch>=2.1.0; extra == "adapters"
41
+ Requires-Dist: transformers>=5.0.0; extra == "adapters"
42
+ Provides-Extra: hf
43
+ Requires-Dist: torch>=2.1.0; extra == "hf"
44
+ Requires-Dist: transformers>=5.0.0; extra == "hf"
45
+ Requires-Dist: datasets>=3.0; extra == "hf"
46
+ Requires-Dist: numpy>=1.24; extra == "hf"
47
+ Requires-Dist: huggingface_hub>=1.0.0; extra == "hf"
48
+ Requires-Dist: aiohttp>=3.12.14; extra == "hf"
49
+ Requires-Dist: h2>=4.3.0; extra == "hf"
50
+ Requires-Dist: pillow>=11.3.0; extra == "hf"
51
+ Provides-Extra: guards
52
+ Requires-Dist: torch>=2.1.0; extra == "guards"
53
+ Requires-Dist: numpy>=1.24; extra == "guards"
54
+ Provides-Extra: edits
55
+ Requires-Dist: torch>=2.1.0; extra == "edits"
56
+ Provides-Extra: eval
57
+ Requires-Dist: torch>=2.1.0; extra == "eval"
58
+ Requires-Dist: datasets>=3.0; extra == "eval"
59
+ Provides-Extra: gptq
60
+ Requires-Dist: torch>=2.1.0; extra == "gptq"
61
+ Requires-Dist: auto-gptq>=0.7.0; platform_system == "Linux" and extra == "gptq"
62
+ Requires-Dist: triton>=2.3.0; platform_system == "Linux" and extra == "gptq"
63
+ Requires-Dist: transformers>=5.0.0; extra == "gptq"
64
+ Provides-Extra: awq
65
+ Requires-Dist: torch>=2.1.0; extra == "awq"
66
+ Requires-Dist: autoawq>=0.2.0; platform_system == "Linux" and extra == "awq"
67
+ Requires-Dist: transformers>=5.0.0; extra == "awq"
68
+ Requires-Dist: triton>=2.3.0; platform_system == "Linux" and extra == "awq"
69
+ Provides-Extra: gpu
70
+ Requires-Dist: torch>=2.1.0; extra == "gpu"
71
+ Requires-Dist: accelerate>=0.27; extra == "gpu"
72
+ Requires-Dist: bitsandbytes>=0.41; platform_system == "Linux" and extra == "gpu"
73
+ Provides-Extra: all
74
+ Requires-Dist: torch>=2.1.0; extra == "all"
75
+ Requires-Dist: transformers>=5.0.0; extra == "all"
76
+ Requires-Dist: datasets>=3.0; extra == "all"
77
+ Requires-Dist: numpy>=1.24; extra == "all"
78
+ Requires-Dist: huggingface_hub>=1.0.0; extra == "all"
79
+ Requires-Dist: accelerate>=0.27; extra == "all"
80
+ Requires-Dist: bitsandbytes>=0.41; platform_system == "Linux" and extra == "all"
81
+ Requires-Dist: auto-gptq>=0.7.0; platform_system == "Linux" and extra == "all"
82
+ Requires-Dist: autoawq>=0.2.0; platform_system == "Linux" and extra == "all"
83
+ Requires-Dist: triton>=2.3.0; platform_system == "Linux" and extra == "all"
84
+ Requires-Dist: aiohttp>=3.12.14; extra == "all"
85
+ Requires-Dist: h2>=4.3.0; extra == "all"
86
+ Requires-Dist: pillow>=11.3.0; extra == "all"
87
+ Provides-Extra: onnx
88
+ Requires-Dist: optimum>=1.17.0; extra == "onnx"
89
+ Requires-Dist: onnxruntime>=1.17.0; extra == "onnx"
90
+ Provides-Extra: dev
91
+ Requires-Dist: pytest>=7.0; extra == "dev"
92
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
93
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
94
+ Requires-Dist: black>=23.0; extra == "dev"
95
+ Requires-Dist: mypy>=1.0; extra == "dev"
96
+ Requires-Dist: hypothesis>=6.98; extra == "dev"
97
+ Requires-Dist: pre-commit>=3.0; extra == "dev"
98
+ Requires-Dist: mkdocs>=1.5; extra == "dev"
99
+ Requires-Dist: mkdocs-material>=9.5; extra == "dev"
100
+ Requires-Dist: mkdocs-mermaid2-plugin>=1.1; extra == "dev"
101
+ Requires-Dist: sphinx>=7.0; extra == "dev"
102
+ Requires-Dist: matplotlib>=3.7; extra == "dev"
103
+ Requires-Dist: bitsandbytes>=0.41; extra == "dev"
104
+ Requires-Dist: build>=0.10.0; extra == "dev"
105
+ Requires-Dist: twine>=4.0.0; extra == "dev"
106
+ Dynamic: license-file
107
+
108
+ <p align="center">
109
+ <picture>
110
+ <source
111
+ media="(prefers-color-scheme: dark)"
112
+ srcset="docs/assets/invarlock-logo-dark.svg"
113
+ />
114
+ <img src="docs/assets/invarlock-logo.svg" alt="InvarLock" />
115
+ </picture>
116
+ </p>
117
+
118
+ <p align="center"><em>Edit‑agnostic robustness reports for weight edits</em></p>
119
+
120
+ <p align="center">
121
+ <a href="https://github.com/invarlock/invarlock/actions/workflows/ci.yml">
122
+ <img alt="CI" src="https://img.shields.io/github/actions/workflow/status/invarlock/invarlock/ci.yml?branch=main&logo=github&label=CI" />
123
+ </a>
124
+ <a href="https://pypi.org/project/invarlock/">
125
+ <img alt="PyPI" src="https://badge.fury.io/py/invarlock.svg" />
126
+ </a>
127
+ <a href="https://github.com/invarlock/invarlock/blob/main/docs/user-guide/quickstart.md">
128
+ <img alt="Docs" src="https://img.shields.io/badge/docs-quickstart-blue.svg" />
129
+ </a>
130
+ <a href="LICENSE">
131
+ <img alt="License: Apache-2.0" src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" />
132
+ </a>
133
+ <a href="https://www.python.org/downloads/release/python-3120/">
134
+ <img alt="Python 3.12+" src="https://img.shields.io/badge/python-3.12+-blue.svg" />
135
+ </a>
136
+ </p>
137
+
138
+ <p align="center">
139
+ <strong>Catch silent quality regressions from quantization, pruning, and weight edits before they ship.</strong>
140
+ </p>
141
+
142
+ Quantizing, pruning, or otherwise editing a model’s weights can silently degrade quality.
143
+ InvarLock compares an edited **subject** checkpoint against a fixed **baseline** with paired
144
+ evaluation windows, enforces a guard pipeline (invariants → spectral → RMT → variance), and
145
+ produces a machine‑readable Evaluation Report you can gate in CI.
146
+
147
+ ## Why InvarLock?
148
+
149
+ - **Quality gates for weight edits**: catch regressions before deployment.
150
+ - **Statistical guarantees**: paired primary metrics with confidence intervals.
151
+ - **Auditable evidence**: deterministic pairing metadata + policy digests in `evaluation.report.json`.
152
+ - **CI/CD-friendly**: stable exit codes, `--json` outputs, and portable “proof packs”.
153
+ - **Offline-first**: network is disabled by default; enable downloads per command.
154
+
155
+ ## Who is this for?
156
+
157
+ - ML engineers shipping quantized/pruned checkpoints.
158
+ - MLOps teams building CI quality gates and reviewable artifacts.
159
+ - Researchers validating compression/edit methods with reproducible, paired eval.
160
+
161
+ ## How it works
162
+
163
+ ```text
164
+ ┌───────────────────────┐ ┌────────────────────────────────────────────┐
165
+ │ Baseline (checkpoint) │────►│ │
166
+ └───────────────────────┘ │ invarlock evaluate │
167
+ │ ├─► Paired windows (deterministic) │
168
+ ┌───────────────────────┐ │ ├─► GuardChain pipeline │
169
+ │ Subject (checkpoint) │────►│ │ └─► invariants → spectral → RMT → VE │
170
+ └───────────────────────┘ │ └─► Emit: evaluation.report.json │
171
+ │ │
172
+ └────────────────────────────────────────────┘
173
+
174
+ ┌───────────────┴───────────────┐
175
+ ▼ ▼
176
+ ✅ PASS ❌ FAIL
177
+ (ship) (rollback)
178
+
179
+ ```
180
+
181
+ ## Quick start
182
+
183
+ Colab (CPU-friendly):
184
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/invarlock/invarlock/blob/main/notebooks/invarlock_quickstart_cpu.ipynb)
185
+
186
+ ```bash
187
+ # HF adapter stack (torch/transformers)
188
+ pip install "invarlock[hf]"
189
+
190
+ # Version + report schema (when available)
191
+ invarlock --version
192
+
193
+ # Compare baseline vs subject (downloads require explicit network enable)
194
+ INVARLOCK_ALLOW_NETWORK=1 invarlock evaluate \
195
+ --baseline gpt2 \
196
+ --subject gpt2 \
197
+ --adapter auto \
198
+ --profile dev \
199
+ --quiet
200
+
201
+ # Validate the evaluation report
202
+ invarlock verify reports/eval/evaluation.report.json
203
+
204
+ # Render HTML for sharing
205
+ invarlock report html -i reports/eval/evaluation.report.json -o reports/eval/evaluation.html
206
+ ```
207
+
208
+ Example output (abridged; counts vary by profile/config):
209
+
210
+ ```text
211
+ INVARLOCK v<version> · EVALUATE
212
+ Baseline: gpt2 -> Subject: gpt2 · Profile: dev
213
+ Status: PASS · Gates: <passed>/<total> passed
214
+ Primary metric ratio: <ratio>
215
+ Output: reports/eval/evaluation.report.json
216
+ ```
217
+
218
+ ## Proof packs (portable evidence bundles)
219
+
220
+ Proof packs bundle reports + verification metadata into a distributable artifact.
221
+
222
+ - Guide: <https://github.com/invarlock/invarlock/blob/main/docs/user-guide/proof-packs.md>
223
+ - Verify: `scripts/proof_packs/verify_pack.sh --pack <dir> --strict` (or `PACK_STRICT_MODE=1 ...`)
224
+
225
+ Note: `configs/` and `scripts/` are repo resources and are not shipped in wheels; clone the repo to use
226
+ presets and proof-pack helpers.
227
+
228
+ ## Installation
229
+
230
+ ```bash
231
+ # Minimal CLI (no torch/transformers)
232
+ pip install invarlock
233
+
234
+ # HF workflows (torch/transformers)
235
+ pip install "invarlock[hf]"
236
+ ```
237
+
238
+ Optional extras: `invarlock[gpu]`, `invarlock[awq,gptq]`. Full setup: <https://github.com/invarlock/invarlock/blob/main/docs/user-guide/getting-started.md>.
239
+
240
+ ## Documentation
241
+
242
+ - Quickstart: <https://github.com/invarlock/invarlock/blob/main/docs/user-guide/quickstart.md>
243
+ - Compare & evaluate (BYOE): <https://github.com/invarlock/invarlock/blob/main/docs/user-guide/compare-and-evaluate.md>
244
+ - Reading a report: <https://github.com/invarlock/invarlock/blob/main/docs/user-guide/reading-report.md>
245
+ - CLI reference: <https://github.com/invarlock/invarlock/blob/main/docs/reference/cli.md>
246
+ - Assurance case: <https://github.com/invarlock/invarlock/blob/main/docs/assurance/00-safety-case.md>
247
+ - Threat model: <https://github.com/invarlock/invarlock/blob/main/docs/security/threat-model.md>
248
+
249
+ ## Community
250
+
251
+ - Questions/ideas: <https://github.com/invarlock/invarlock/discussions>
252
+ - Bug reports: <https://github.com/invarlock/invarlock/issues>
253
+ - Contact: <mailto:support@invarlock.dev>
254
+
255
+ ## Citation
256
+
257
+ If you use InvarLock in scientific work, please cite it (canonical metadata is in `CITATION.cff`):
258
+
259
+ ```bibtex
260
+ @software{invarlock,
261
+ title = {InvarLock: Edit-agnostic robustness evaluation reports for weight edits},
262
+ author = {{InvarLock Maintainers}},
263
+ url = {https://github.com/invarlock/invarlock},
264
+ }
265
+ ```
266
+
267
+ ## Limitations
268
+
269
+ - InvarLock evaluates an edited model relative to a baseline under a specific configuration; results are not “global” guarantees.
270
+ - Not a content-safety/alignment tool.
271
+ - Native Windows is not supported (use WSL2 or Linux).
272
+
273
+ ## Support matrix
274
+
275
+ <!-- markdownlint-disable MD060 -->
276
+ | Platform | Status | Notes |
277
+ | ---------------------- | --------------- | ----------------------------------------- |
278
+ | Python 3.12+ | ✅ Required | |
279
+ | Linux | ✅ Full | Primary dev target |
280
+ | macOS (Intel/M-series) | ✅ Full | MPS supported (default on Apple Silicon) |
281
+ | Windows | ❌ Not supported | Use WSL2 or a Linux container if required |
282
+ | CUDA | ✅ Recommended | For larger models |
283
+ | CPU | ✅ Fallback | Slower but functional |
284
+ <!-- markdownlint-enable MD060 -->
285
+
286
+ ## Project status
287
+
288
+ InvarLock is pre‑1.0. Until 1.0, minor releases may include breaking changes. See [`CHANGELOG.md`](CHANGELOG.md).
289
+
290
+ For guidance on where to ask questions, how to report bugs, and what to expect in terms of response times, see
291
+ [`SUPPORT.md`](SUPPORT.md).
292
+
293
+ ## Contributing
294
+
295
+ - Contributing guide: <https://github.com/invarlock/invarlock/blob/main/CONTRIBUTING.md>
296
+ - Fast local checks (repo clone):
297
+ - `make dev-install`
298
+ - `make test`
299
+ - `make lint`
300
+
301
+ ## License
302
+
303
+ Apache-2.0 — see `LICENSE`.
@@ -0,0 +1,196 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source
4
+ media="(prefers-color-scheme: dark)"
5
+ srcset="docs/assets/invarlock-logo-dark.svg"
6
+ />
7
+ <img src="docs/assets/invarlock-logo.svg" alt="InvarLock" />
8
+ </picture>
9
+ </p>
10
+
11
+ <p align="center"><em>Edit‑agnostic robustness reports for weight edits</em></p>
12
+
13
+ <p align="center">
14
+ <a href="https://github.com/invarlock/invarlock/actions/workflows/ci.yml">
15
+ <img alt="CI" src="https://img.shields.io/github/actions/workflow/status/invarlock/invarlock/ci.yml?branch=main&logo=github&label=CI" />
16
+ </a>
17
+ <a href="https://pypi.org/project/invarlock/">
18
+ <img alt="PyPI" src="https://badge.fury.io/py/invarlock.svg" />
19
+ </a>
20
+ <a href="https://github.com/invarlock/invarlock/blob/main/docs/user-guide/quickstart.md">
21
+ <img alt="Docs" src="https://img.shields.io/badge/docs-quickstart-blue.svg" />
22
+ </a>
23
+ <a href="LICENSE">
24
+ <img alt="License: Apache-2.0" src="https://img.shields.io/badge/License-Apache_2.0-blue.svg" />
25
+ </a>
26
+ <a href="https://www.python.org/downloads/release/python-3120/">
27
+ <img alt="Python 3.12+" src="https://img.shields.io/badge/python-3.12+-blue.svg" />
28
+ </a>
29
+ </p>
30
+
31
+ <p align="center">
32
+ <strong>Catch silent quality regressions from quantization, pruning, and weight edits before they ship.</strong>
33
+ </p>
34
+
35
+ Quantizing, pruning, or otherwise editing a model’s weights can silently degrade quality.
36
+ InvarLock compares an edited **subject** checkpoint against a fixed **baseline** with paired
37
+ evaluation windows, enforces a guard pipeline (invariants → spectral → RMT → variance), and
38
+ produces a machine‑readable Evaluation Report you can gate in CI.
39
+
40
+ ## Why InvarLock?
41
+
42
+ - **Quality gates for weight edits**: catch regressions before deployment.
43
+ - **Statistical guarantees**: paired primary metrics with confidence intervals.
44
+ - **Auditable evidence**: deterministic pairing metadata + policy digests in `evaluation.report.json`.
45
+ - **CI/CD-friendly**: stable exit codes, `--json` outputs, and portable “proof packs”.
46
+ - **Offline-first**: network is disabled by default; enable downloads per command.
47
+
48
+ ## Who is this for?
49
+
50
+ - ML engineers shipping quantized/pruned checkpoints.
51
+ - MLOps teams building CI quality gates and reviewable artifacts.
52
+ - Researchers validating compression/edit methods with reproducible, paired eval.
53
+
54
+ ## How it works
55
+
56
+ ```text
57
+ ┌───────────────────────┐ ┌────────────────────────────────────────────┐
58
+ │ Baseline (checkpoint) │────►│ │
59
+ └───────────────────────┘ │ invarlock evaluate │
60
+ │ ├─► Paired windows (deterministic) │
61
+ ┌───────────────────────┐ │ ├─► GuardChain pipeline │
62
+ │ Subject (checkpoint) │────►│ │ └─► invariants → spectral → RMT → VE │
63
+ └───────────────────────┘ │ └─► Emit: evaluation.report.json │
64
+ │ │
65
+ └────────────────────────────────────────────┘
66
+
67
+ ┌───────────────┴───────────────┐
68
+ ▼ ▼
69
+ ✅ PASS ❌ FAIL
70
+ (ship) (rollback)
71
+
72
+ ```
73
+
74
+ ## Quick start
75
+
76
+ Colab (CPU-friendly):
77
+ [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/invarlock/invarlock/blob/main/notebooks/invarlock_quickstart_cpu.ipynb)
78
+
79
+ ```bash
80
+ # HF adapter stack (torch/transformers)
81
+ pip install "invarlock[hf]"
82
+
83
+ # Version + report schema (when available)
84
+ invarlock --version
85
+
86
+ # Compare baseline vs subject (downloads require explicit network enable)
87
+ INVARLOCK_ALLOW_NETWORK=1 invarlock evaluate \
88
+ --baseline gpt2 \
89
+ --subject gpt2 \
90
+ --adapter auto \
91
+ --profile dev \
92
+ --quiet
93
+
94
+ # Validate the evaluation report
95
+ invarlock verify reports/eval/evaluation.report.json
96
+
97
+ # Render HTML for sharing
98
+ invarlock report html -i reports/eval/evaluation.report.json -o reports/eval/evaluation.html
99
+ ```
100
+
101
+ Example output (abridged; counts vary by profile/config):
102
+
103
+ ```text
104
+ INVARLOCK v<version> · EVALUATE
105
+ Baseline: gpt2 -> Subject: gpt2 · Profile: dev
106
+ Status: PASS · Gates: <passed>/<total> passed
107
+ Primary metric ratio: <ratio>
108
+ Output: reports/eval/evaluation.report.json
109
+ ```
110
+
111
+ ## Proof packs (portable evidence bundles)
112
+
113
+ Proof packs bundle reports + verification metadata into a distributable artifact.
114
+
115
+ - Guide: <https://github.com/invarlock/invarlock/blob/main/docs/user-guide/proof-packs.md>
116
+ - Verify: `scripts/proof_packs/verify_pack.sh --pack <dir> --strict` (or `PACK_STRICT_MODE=1 ...`)
117
+
118
+ Note: `configs/` and `scripts/` are repo resources and are not shipped in wheels; clone the repo to use
119
+ presets and proof-pack helpers.
120
+
121
+ ## Installation
122
+
123
+ ```bash
124
+ # Minimal CLI (no torch/transformers)
125
+ pip install invarlock
126
+
127
+ # HF workflows (torch/transformers)
128
+ pip install "invarlock[hf]"
129
+ ```
130
+
131
+ Optional extras: `invarlock[gpu]`, `invarlock[awq,gptq]`. Full setup: <https://github.com/invarlock/invarlock/blob/main/docs/user-guide/getting-started.md>.
132
+
133
+ ## Documentation
134
+
135
+ - Quickstart: <https://github.com/invarlock/invarlock/blob/main/docs/user-guide/quickstart.md>
136
+ - Compare & evaluate (BYOE): <https://github.com/invarlock/invarlock/blob/main/docs/user-guide/compare-and-evaluate.md>
137
+ - Reading a report: <https://github.com/invarlock/invarlock/blob/main/docs/user-guide/reading-report.md>
138
+ - CLI reference: <https://github.com/invarlock/invarlock/blob/main/docs/reference/cli.md>
139
+ - Assurance case: <https://github.com/invarlock/invarlock/blob/main/docs/assurance/00-safety-case.md>
140
+ - Threat model: <https://github.com/invarlock/invarlock/blob/main/docs/security/threat-model.md>
141
+
142
+ ## Community
143
+
144
+ - Questions/ideas: <https://github.com/invarlock/invarlock/discussions>
145
+ - Bug reports: <https://github.com/invarlock/invarlock/issues>
146
+ - Contact: <mailto:support@invarlock.dev>
147
+
148
+ ## Citation
149
+
150
+ If you use InvarLock in scientific work, please cite it (canonical metadata is in `CITATION.cff`):
151
+
152
+ ```bibtex
153
+ @software{invarlock,
154
+ title = {InvarLock: Edit-agnostic robustness evaluation reports for weight edits},
155
+ author = {{InvarLock Maintainers}},
156
+ url = {https://github.com/invarlock/invarlock},
157
+ }
158
+ ```
159
+
160
+ ## Limitations
161
+
162
+ - InvarLock evaluates an edited model relative to a baseline under a specific configuration; results are not “global” guarantees.
163
+ - Not a content-safety/alignment tool.
164
+ - Native Windows is not supported (use WSL2 or Linux).
165
+
166
+ ## Support matrix
167
+
168
+ <!-- markdownlint-disable MD060 -->
169
+ | Platform | Status | Notes |
170
+ | ---------------------- | --------------- | ----------------------------------------- |
171
+ | Python 3.12+ | ✅ Required | |
172
+ | Linux | ✅ Full | Primary dev target |
173
+ | macOS (Intel/M-series) | ✅ Full | MPS supported (default on Apple Silicon) |
174
+ | Windows | ❌ Not supported | Use WSL2 or a Linux container if required |
175
+ | CUDA | ✅ Recommended | For larger models |
176
+ | CPU | ✅ Fallback | Slower but functional |
177
+ <!-- markdownlint-enable MD060 -->
178
+
179
+ ## Project status
180
+
181
+ InvarLock is pre‑1.0. Until 1.0, minor releases may include breaking changes. See [`CHANGELOG.md`](CHANGELOG.md).
182
+
183
+ For guidance on where to ask questions, how to report bugs, and what to expect in terms of response times, see
184
+ [`SUPPORT.md`](SUPPORT.md).
185
+
186
+ ## Contributing
187
+
188
+ - Contributing guide: <https://github.com/invarlock/invarlock/blob/main/CONTRIBUTING.md>
189
+ - Fast local checks (repo clone):
190
+ - `make dev-install`
191
+ - `make test`
192
+ - `make lint`
193
+
194
+ ## License
195
+
196
+ Apache-2.0 — see `LICENSE`.
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "invarlock"
7
- version = "0.3.7"
8
- description = "Edit‑agnostic robustness certificates for weight edits (InvarLock framework)"
7
+ version = "0.3.9"
8
+ description = "Edit‑agnostic robustness evaluation reports for weight edits (InvarLock framework)"
9
9
  authors = [{ name = "InvarLock Team", email = "oss@invarlock.dev" }]
10
10
  maintainers = [{ name = "InvarLock Maintainers", email = "support@invarlock.dev" }]
11
11
  license = "Apache-2.0"
@@ -52,16 +52,16 @@ Changelog = "https://github.com/invarlock/invarlock/blob/main/CHANGELOG.md"
52
52
  # Core torch dependencies for adapters
53
53
  adapters = [
54
54
  "torch>=2.1.0",
55
- "transformers>=4.53.0",
55
+ "transformers>=5.0.0",
56
56
  ]
57
57
 
58
58
  # Hugging Face workflow (adapters + evaluation stack)
59
59
  hf = [
60
60
  "torch>=2.1.0",
61
- "transformers>=4.53.0",
61
+ "transformers>=5.0.0",
62
62
  "datasets>=3.0",
63
63
  "numpy>=1.24",
64
- "huggingface_hub>=0.23",
64
+ "huggingface_hub>=1.0.0",
65
65
  "aiohttp>=3.12.14",
66
66
  "h2>=4.3.0",
67
67
  "pillow>=11.3.0",
@@ -89,14 +89,14 @@ gptq = [
89
89
  "torch>=2.1.0",
90
90
  "auto-gptq>=0.7.0; platform_system == \"Linux\"",
91
91
  "triton>=2.3.0; platform_system == \"Linux\"",
92
- "transformers>=4.53.0",
92
+ "transformers>=5.0.0",
93
93
  ]
94
94
 
95
95
 
96
96
  awq = [
97
97
  "torch>=2.1.0",
98
98
  "autoawq>=0.2.0; platform_system == \"Linux\"",
99
- "transformers>=4.53.0",
99
+ "transformers>=5.0.0",
100
100
  "triton>=2.3.0; platform_system == \"Linux\"",
101
101
  ]
102
102
 
@@ -111,10 +111,10 @@ gpu = [
111
111
  # Complete installation with all features
112
112
  all = [
113
113
  "torch>=2.1.0",
114
- "transformers>=4.53.0",
114
+ "transformers>=5.0.0",
115
115
  "datasets>=3.0",
116
116
  "numpy>=1.24",
117
- "huggingface_hub>=0.23",
117
+ "huggingface_hub>=1.0.0",
118
118
  "accelerate>=0.27",
119
119
  "bitsandbytes>=0.41; platform_system == \"Linux\"",
120
120
  "auto-gptq>=0.7.0; platform_system == \"Linux\"",
@@ -1,5 +1,5 @@
1
1
  """
2
- InvarLock: Edit‑agnostic robustness certificates for weight edits
2
+ InvarLock: Edit‑agnostic evaluation reports for weight edits
3
3
  =============================================================
4
4
 
5
5
  Core runtime package — torch-independent utilities, configuration, and interfaces.
@@ -9,10 +9,10 @@ For torch-dependent functionality, see subpackages under `invarlock.*`:
9
9
  - `invarlock.adapters`: Model adapters (HF causal/MLM/seq2seq + auto)
10
10
  - `invarlock.guards`: Safety mechanisms (invariants, spectral, RMT, variance)
11
11
  - `invarlock.edits`: Built-in quantization and edit interfaces
12
- - `invarlock.eval`: Metrics, guard-overhead checks, and certification
12
+ - `invarlock.eval`: Metrics, guard-overhead checks, and evaluation reporting
13
13
  """
14
14
 
15
- __version__ = "0.3.7"
15
+ __version__ = "0.3.9"
16
16
 
17
17
  # Core exports - torch-independent
18
18
  from .config import CFG, Defaults, get_default_config
@@ -38,11 +38,7 @@ def _detect_quantization_from_path(model_id: str) -> str | None:
38
38
  return "hf_awq"
39
39
  elif quant_method == "gptq":
40
40
  return "hf_gptq"
41
- elif (
42
- quant_method == "bitsandbytes"
43
- or quant_cfg.get("load_in_8bit")
44
- or quant_cfg.get("load_in_4bit")
45
- ):
41
+ elif "bitsandbytes" in quant_method or "bnb" in quant_method:
46
42
  return "hf_bnb"
47
43
 
48
44
  except Exception:
@@ -78,11 +74,7 @@ def _detect_quantization_from_model(model: Any) -> str | None:
78
74
  return "hf_awq"
79
75
  elif quant_method == "gptq":
80
76
  return "hf_gptq"
81
- elif (
82
- quant_method == "bitsandbytes"
83
- or quant_cfg.get("load_in_8bit")
84
- or quant_cfg.get("load_in_4bit")
85
- ):
77
+ elif "bitsandbytes" in quant_method or "bnb" in quant_method:
86
78
  return "hf_bnb"
87
79
  else:
88
80
  # Object-style config
@@ -50,7 +50,7 @@ def resolve_trust_remote_code(
50
50
  return default
51
51
 
52
52
 
53
- def default_torch_dtype() -> torch.dtype:
53
+ def default_dtype() -> torch.dtype:
54
54
  """Pick a safe default dtype for HF loads based on hardware."""
55
55
  if torch.cuda.is_available():
56
56
  try:
@@ -69,10 +69,10 @@ def default_torch_dtype() -> torch.dtype:
69
69
  return torch.float32
70
70
 
71
71
 
72
- def resolve_torch_dtype(kwargs: dict[str, Any] | None = None) -> torch.dtype | str:
73
- """Resolve torch_dtype from kwargs or choose a hardware-aware default."""
74
- if kwargs and "torch_dtype" in kwargs:
75
- val = kwargs.get("torch_dtype")
72
+ def resolve_dtype(kwargs: dict[str, Any] | None = None) -> torch.dtype | str:
73
+ """Resolve dtype from kwargs or choose a hardware-aware default."""
74
+ if kwargs and "dtype" in kwargs:
75
+ val = kwargs.get("dtype")
76
76
  if isinstance(val, torch.dtype):
77
77
  return val
78
78
  if isinstance(val, str):
@@ -91,7 +91,7 @@ def resolve_torch_dtype(kwargs: dict[str, Any] | None = None) -> torch.dtype | s
91
91
  if s in mapping:
92
92
  return mapping[s]
93
93
 
94
- return default_torch_dtype()
94
+ return default_dtype()
95
95
 
96
96
 
97
- __all__ = ["resolve_trust_remote_code", "default_torch_dtype", "resolve_torch_dtype"]
97
+ __all__ = ["resolve_trust_remote_code", "default_dtype", "resolve_dtype"]