haoline 0.3.0__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 (70) hide show
  1. haoline/.streamlit/config.toml +10 -0
  2. haoline/__init__.py +248 -0
  3. haoline/analyzer.py +935 -0
  4. haoline/cli.py +2712 -0
  5. haoline/compare.py +811 -0
  6. haoline/compare_visualizations.py +1564 -0
  7. haoline/edge_analysis.py +525 -0
  8. haoline/eval/__init__.py +131 -0
  9. haoline/eval/adapters.py +844 -0
  10. haoline/eval/cli.py +390 -0
  11. haoline/eval/comparison.py +542 -0
  12. haoline/eval/deployment.py +633 -0
  13. haoline/eval/schemas.py +833 -0
  14. haoline/examples/__init__.py +15 -0
  15. haoline/examples/basic_inspection.py +74 -0
  16. haoline/examples/compare_models.py +117 -0
  17. haoline/examples/hardware_estimation.py +78 -0
  18. haoline/format_adapters.py +1001 -0
  19. haoline/formats/__init__.py +123 -0
  20. haoline/formats/coreml.py +250 -0
  21. haoline/formats/gguf.py +483 -0
  22. haoline/formats/openvino.py +255 -0
  23. haoline/formats/safetensors.py +273 -0
  24. haoline/formats/tflite.py +369 -0
  25. haoline/hardware.py +2307 -0
  26. haoline/hierarchical_graph.py +462 -0
  27. haoline/html_export.py +1573 -0
  28. haoline/layer_summary.py +769 -0
  29. haoline/llm_summarizer.py +465 -0
  30. haoline/op_icons.py +618 -0
  31. haoline/operational_profiling.py +1492 -0
  32. haoline/patterns.py +1116 -0
  33. haoline/pdf_generator.py +265 -0
  34. haoline/privacy.py +250 -0
  35. haoline/pydantic_models.py +241 -0
  36. haoline/report.py +1923 -0
  37. haoline/report_sections.py +539 -0
  38. haoline/risks.py +521 -0
  39. haoline/schema.py +523 -0
  40. haoline/streamlit_app.py +2024 -0
  41. haoline/tests/__init__.py +4 -0
  42. haoline/tests/conftest.py +123 -0
  43. haoline/tests/test_analyzer.py +868 -0
  44. haoline/tests/test_compare_visualizations.py +293 -0
  45. haoline/tests/test_edge_analysis.py +243 -0
  46. haoline/tests/test_eval.py +604 -0
  47. haoline/tests/test_format_adapters.py +460 -0
  48. haoline/tests/test_hardware.py +237 -0
  49. haoline/tests/test_hardware_recommender.py +90 -0
  50. haoline/tests/test_hierarchical_graph.py +326 -0
  51. haoline/tests/test_html_export.py +180 -0
  52. haoline/tests/test_layer_summary.py +428 -0
  53. haoline/tests/test_llm_patterns.py +540 -0
  54. haoline/tests/test_llm_summarizer.py +339 -0
  55. haoline/tests/test_patterns.py +774 -0
  56. haoline/tests/test_pytorch.py +327 -0
  57. haoline/tests/test_report.py +383 -0
  58. haoline/tests/test_risks.py +398 -0
  59. haoline/tests/test_schema.py +417 -0
  60. haoline/tests/test_tensorflow.py +380 -0
  61. haoline/tests/test_visualizations.py +316 -0
  62. haoline/universal_ir.py +856 -0
  63. haoline/visualizations.py +1086 -0
  64. haoline/visualize_yolo.py +44 -0
  65. haoline/web.py +110 -0
  66. haoline-0.3.0.dist-info/METADATA +471 -0
  67. haoline-0.3.0.dist-info/RECORD +70 -0
  68. haoline-0.3.0.dist-info/WHEEL +4 -0
  69. haoline-0.3.0.dist-info/entry_points.txt +5 -0
  70. haoline-0.3.0.dist-info/licenses/LICENSE +22 -0
@@ -0,0 +1,10 @@
1
+ [theme]
2
+ base = "dark"
3
+ primaryColor = "#10b981"
4
+ backgroundColor = "#0d0d0d"
5
+ secondaryBackgroundColor = "#161616"
6
+ textColor = "#f5f5f5"
7
+
8
+ [server]
9
+ maxUploadSize = 500
10
+
haoline/__init__.py ADDED
@@ -0,0 +1,248 @@
1
+ # Copyright (c) 2025 HaoLine Contributors
2
+ # SPDX-License-Identifier: MIT
3
+
4
+ """
5
+ HaoLine (皓线) - Universal Model Inspector.
6
+
7
+ See what's really inside your models.
8
+
9
+ This module provides utilities for analyzing neural network models to extract:
10
+ - Parameter counts and memory estimates
11
+ - FLOP estimates per operation
12
+ - Architectural pattern detection (transformers, CNNs, residual blocks)
13
+ - Risk signals for deployment
14
+ - Hardware performance estimates
15
+
16
+ Supports: ONNX, PyTorch, TensorFlow, TensorRT
17
+
18
+ Example usage:
19
+ from haoline import ModelInspector
20
+
21
+ inspector = ModelInspector()
22
+ report = inspector.inspect("model.onnx")
23
+ print(report.to_json())
24
+ """
25
+
26
+ __version__ = "0.3.0"
27
+
28
+ from .analyzer import MetricsEngine, ONNXGraphLoader
29
+ from .compare_visualizations import (
30
+ CalibrationRecommendation,
31
+ LayerPrecisionBreakdown,
32
+ NormalizedMetrics,
33
+ TradeoffPoint,
34
+ analyze_tradeoffs,
35
+ build_enhanced_markdown,
36
+ compute_normalized_metrics,
37
+ compute_tradeoff_points,
38
+ extract_layer_precision_breakdown,
39
+ generate_calibration_recommendations,
40
+ generate_compare_html,
41
+ generate_compare_pdf,
42
+ generate_layer_precision_chart,
43
+ generate_memory_savings_chart,
44
+ generate_radar_chart,
45
+ generate_tradeoff_chart,
46
+ )
47
+ from .compare_visualizations import is_available as is_compare_viz_available
48
+ from .edge_analysis import EdgeAnalysisResult, EdgeAnalyzer
49
+ from .hardware import (
50
+ HARDWARE_PROFILES,
51
+ HardwareDetector,
52
+ HardwareEstimates,
53
+ HardwareEstimator,
54
+ HardwareProfile,
55
+ detect_local_hardware,
56
+ get_profile,
57
+ list_available_profiles,
58
+ )
59
+ from .hierarchical_graph import (
60
+ HierarchicalGraph,
61
+ HierarchicalGraphBuilder,
62
+ HierarchicalNode,
63
+ )
64
+ from .hierarchical_graph import generate_summary as generate_graph_summary
65
+ from .html_export import HTMLExporter
66
+ from .html_export import generate_html as generate_graph_html
67
+ from .layer_summary import (
68
+ LayerMetrics,
69
+ LayerSummary,
70
+ LayerSummaryBuilder,
71
+ generate_html_table,
72
+ generate_markdown_table,
73
+ )
74
+ from .llm_summarizer import LLMSummarizer, LLMSummary, summarize_report
75
+ from .llm_summarizer import has_api_key as has_llm_api_key
76
+ from .llm_summarizer import is_available as is_llm_available
77
+ from .operational_profiling import (
78
+ BatchSizeSweep,
79
+ BatchSweepPoint,
80
+ BottleneckAnalysis,
81
+ GPUMetrics,
82
+ LayerProfile,
83
+ OperationalProfiler,
84
+ ProfilingResult,
85
+ ResolutionPoint,
86
+ ResolutionSweep,
87
+ SystemRequirements,
88
+ )
89
+ from .patterns import PatternAnalyzer
90
+ from .pdf_generator import PDFGenerator, generate_pdf
91
+ from .pdf_generator import is_available as is_pdf_available
92
+ from .report import (
93
+ DatasetInfo,
94
+ InspectionReport,
95
+ ModelInspector,
96
+ infer_num_classes_from_output,
97
+ )
98
+ from .report_sections import (
99
+ BlockSummaryItem,
100
+ BottleneckSection,
101
+ DetectedBlocksSection,
102
+ ExtractedReportSections,
103
+ HardwareEstimatesSection,
104
+ KVCacheSection,
105
+ MemoryBreakdownRow,
106
+ MemoryBreakdownSection,
107
+ MetricsCard,
108
+ MetricsSummary,
109
+ OperatorDistribution,
110
+ PrecisionBreakdown,
111
+ PrecisionBreakdownRow,
112
+ RiskSignalItem,
113
+ RiskSignalsSection,
114
+ SharedWeightsSection,
115
+ format_bytes,
116
+ format_number,
117
+ )
118
+ from .risks import RiskAnalyzer, RiskSignal, RiskThresholds
119
+ from .schema import (
120
+ INSPECTION_REPORT_SCHEMA,
121
+ ValidationError,
122
+ get_schema,
123
+ validate_report,
124
+ validate_report_strict,
125
+ )
126
+ from .universal_ir import (
127
+ DataType,
128
+ GraphMetadata,
129
+ SourceFormat,
130
+ TensorOrigin,
131
+ UniversalGraph,
132
+ UniversalNode,
133
+ UniversalTensor,
134
+ )
135
+ from .visualizations import (
136
+ THEME,
137
+ ChartTheme,
138
+ VisualizationGenerator,
139
+ generate_visualizations,
140
+ )
141
+ from .visualizations import is_available as is_visualization_available
142
+
143
+ __all__ = [
144
+ # Universal IR (Epic 18)
145
+ "DataType",
146
+ "GraphMetadata",
147
+ "SourceFormat",
148
+ "TensorOrigin",
149
+ "UniversalGraph",
150
+ "UniversalNode",
151
+ "UniversalTensor",
152
+ # Core
153
+ "HARDWARE_PROFILES",
154
+ "INSPECTION_REPORT_SCHEMA",
155
+ "THEME",
156
+ "BatchSizeSweep",
157
+ "BatchSweepPoint",
158
+ "BottleneckAnalysis",
159
+ "CalibrationRecommendation",
160
+ "ChartTheme",
161
+ "DatasetInfo",
162
+ "EdgeAnalysisResult",
163
+ "EdgeAnalyzer",
164
+ "GPUMetrics",
165
+ "HTMLExporter",
166
+ "HardwareDetector",
167
+ "HardwareEstimates",
168
+ "HardwareEstimator",
169
+ "HardwareProfile",
170
+ "HierarchicalGraph",
171
+ "HierarchicalGraphBuilder",
172
+ "HierarchicalNode",
173
+ "InspectionReport",
174
+ "LLMSummarizer",
175
+ "LLMSummary",
176
+ "LayerMetrics",
177
+ "LayerPrecisionBreakdown",
178
+ "LayerProfile",
179
+ "LayerSummary",
180
+ "LayerSummaryBuilder",
181
+ "MetricsEngine",
182
+ "ModelInspector",
183
+ "NormalizedMetrics",
184
+ "ONNXGraphLoader",
185
+ "OperationalProfiler",
186
+ "PDFGenerator",
187
+ "PatternAnalyzer",
188
+ "ProfilingResult",
189
+ "ResolutionPoint",
190
+ "ResolutionSweep",
191
+ "RiskAnalyzer",
192
+ "RiskSignal",
193
+ "RiskThresholds",
194
+ "SystemRequirements",
195
+ "TradeoffPoint",
196
+ "ValidationError",
197
+ "VisualizationGenerator",
198
+ "analyze_tradeoffs",
199
+ "build_enhanced_markdown",
200
+ "compute_normalized_metrics",
201
+ "compute_tradeoff_points",
202
+ "detect_local_hardware",
203
+ "extract_layer_precision_breakdown",
204
+ "generate_calibration_recommendations",
205
+ "generate_compare_html",
206
+ "generate_compare_pdf",
207
+ "generate_graph_html",
208
+ "generate_graph_summary",
209
+ "generate_html_table",
210
+ "generate_layer_precision_chart",
211
+ "generate_markdown_table",
212
+ "generate_memory_savings_chart",
213
+ "generate_pdf",
214
+ "generate_radar_chart",
215
+ "generate_tradeoff_chart",
216
+ "generate_visualizations",
217
+ "get_profile",
218
+ "get_schema",
219
+ "has_llm_api_key",
220
+ "infer_num_classes_from_output",
221
+ "is_compare_viz_available",
222
+ "is_llm_available",
223
+ "is_pdf_available",
224
+ "is_visualization_available",
225
+ "list_available_profiles",
226
+ "summarize_report",
227
+ "validate_report",
228
+ "validate_report_strict",
229
+ # Report Sections (Story 41.2)
230
+ "BlockSummaryItem",
231
+ "BottleneckSection",
232
+ "DetectedBlocksSection",
233
+ "ExtractedReportSections",
234
+ "HardwareEstimatesSection",
235
+ "KVCacheSection",
236
+ "MemoryBreakdownRow",
237
+ "MemoryBreakdownSection",
238
+ "MetricsCard",
239
+ "MetricsSummary",
240
+ "OperatorDistribution",
241
+ "PrecisionBreakdown",
242
+ "PrecisionBreakdownRow",
243
+ "RiskSignalItem",
244
+ "RiskSignalsSection",
245
+ "SharedWeightsSection",
246
+ "format_bytes",
247
+ "format_number",
248
+ ]