trustformers_debug/
lib.rs

1//! # TrustformeRS Debug
2//!
3//! Advanced debugging tools for TrustformeRS models including tensor inspection,
4//! gradient debugging, and model diagnostics.
5
6// Allow ambiguous glob re-exports - documented below with clear guidance on which version to use
7#![allow(ambiguous_glob_reexports)]
8// Allow large error types in Result (TrustformersError is large by design)
9#![allow(clippy::result_large_err)]
10// Allow large enum variants (debug reports contain comprehensive data)
11#![allow(clippy::large_enum_variant)]
12// Allow common patterns in debugging/profiling code
13#![allow(clippy::too_many_arguments)]
14#![allow(clippy::type_complexity)]
15#![allow(clippy::excessive_nesting)]
16
17pub mod advanced_gpu_profiler;
18pub mod advanced_ml_debugging;
19pub mod ai_code_analyzer;
20pub mod anomaly_detector;
21pub mod architecture_analysis;
22pub mod auto_debugger;
23pub mod behavior_analysis;
24pub mod cicd_integration;
25pub mod collaboration;
26pub mod computation_graph;
27pub mod dashboard;
28pub mod data_export;
29pub mod differential_debugging;
30pub mod distributed_debugger;
31pub mod environmental_monitor;
32pub mod error_recovery;
33pub mod flame_graph_profiler;
34pub mod gradient_debugger;
35pub mod health_checker;
36pub mod hooks;
37pub mod ide_integration;
38pub mod interactive_debugger;
39pub mod interpretability_tools;
40pub mod kernel_optimizer;
41pub mod llm_debugging;
42pub mod memory_profiler;
43pub mod model_diagnostics;
44pub mod model_diagnostics_main;
45pub use model_diagnostics_main::{ModelDiagnostics, ModelDiagnosticsReport};
46
47// Import specific types from model_diagnostics to avoid conflicts
48pub use model_diagnostics::{
49    ActivationHeatmap,
50    ActiveAlert,
51    // Advanced analytics
52    AdvancedAnalytics,
53    AlertConfig,
54    // Alert system
55    AlertManager,
56    AlertSeverity,
57    AlertStatistics,
58
59    AlertStatus,
60    AlertThresholds,
61    AnalyticsConfig,
62    AnalyticsReport,
63    AnomalyDetectionResults,
64    ArchitecturalAnalysis,
65    AttentionVisualization,
66    AutoDebugConfig,
67    // Auto-debugging system
68    AutoDebugger,
69    ConvergenceStatus,
70    DebuggingRecommendation,
71    DebuggingReport,
72    HiddenStateAnalysis,
73
74    IdentifiedIssue,
75    IssueCategory,
76    IssueSeverity,
77
78    LayerActivationStats,
79    LayerAnalysis,
80    LayerAnalysisConfig,
81
82    // Layer analysis (prefixed to avoid conflicts)
83    LayerAnalyzer,
84    ModelArchitectureInfo,
85    ModelDiagnosticAlert,
86    // Core types that don't conflict
87    ModelPerformanceMetrics,
88    OverfittingIndicator,
89    // Performance analysis (prefixed to avoid conflicts)
90    PerformanceAnalyzer,
91    PerformanceAnomaly,
92
93    PerformanceSummary,
94    PlateauInfo,
95    StatisticalAnalysis,
96    TrainingDynamics,
97    // Training analysis (prefixed to avoid conflicts)
98    TrainingDynamicsAnalyzer,
99
100    TrainingStability,
101    UnderfittingIndicator,
102    WeightDistribution,
103};
104pub mod neural_network_debugging;
105pub mod profiler;
106pub mod quantum_debugging;
107pub mod realtime_dashboard;
108pub mod regression_detector;
109pub mod report_generation;
110pub mod simulation_tools;
111pub mod streaming_debugger;
112pub mod team_dashboard;
113pub mod tensor_inspector;
114pub mod training_dynamics;
115pub mod utilities;
116pub mod visualization;
117#[cfg(feature = "wasm")]
118pub mod wasm_interface;
119
120// GPU profiling imports (specific to avoid conflicts)
121pub use advanced_gpu_profiler::{
122    AdvancedGpuMemoryProfiler, AdvancedGpuProfilingConfig, CrossDeviceTransfer,
123    GpuMemoryAllocation, GpuMemoryType, HighImpactOptimization, KernelOptimizationSummaryReport,
124    MemoryAnalysisReport, MemoryFragmentationSnapshot,
125};
126
127// Kernel optimization imports (specific)
128pub use kernel_optimizer::{
129    KernelOptimizationAnalyzer, KernelOptimizationConfig, KernelOptimizationReport,
130    KernelProfileData,
131};
132
133// ============================================================================
134// Module Re-exports
135// ============================================================================
136//
137// ⚠️  TYPE NAME CONFLICTS (Documented for clarity):
138// The following types are defined in multiple modules. The LAST import wins in Rust.
139// If you need a specific version, import directly from the module:
140//
141// - `LRScheduleType`: defined in `training_dynamics` (PRIMARY) and `advanced_ml_debugging`
142//   → Use `training_dynamics::LRScheduleType` for training schedules
143//   → Use `advanced_ml_debugging::LRScheduleType` for ML debugging contexts
144//
145// - `RiskLevel`: defined in `llm_debugging` (PRIMARY) and `advanced_ml_debugging`
146//   → Use `llm_debugging::RiskLevel` for LLM safety analysis
147//   → Use `advanced_ml_debugging::RiskLevel` for general ML risk assessment
148//
149// - `InteractionType`: defined in `simulation_tools` (PRIMARY) and `advanced_ml_debugging`
150//   → Use `simulation_tools::InteractionType` for simulation interactions
151//   → Use `advanced_ml_debugging::InteractionType` for ML component interactions
152//
153// - `BottleneckType`: defined in `profiler` (PRIMARY) and `advanced_ml_debugging`
154//   → Use `profiler::BottleneckType` for performance bottlenecks
155//   → Use `advanced_ml_debugging::BottleneckType` for ML-specific bottlenecks
156//
157// - `FeatureSensitivityAnalysis`: defined in `simulation_tools` (PRIMARY) and `advanced_ml_debugging`
158//   → Use `simulation_tools::FeatureSensitivityAnalysis` for simulation feature analysis
159//   → Use `advanced_ml_debugging::FeatureSensitivityAnalysis` for ML feature analysis
160//
161// - `RobustnessAssessment`: defined in `simulation_tools` (PRIMARY) and `advanced_ml_debugging`
162//   → Use `simulation_tools::RobustnessAssessment` for simulation robustness
163//   → Use `advanced_ml_debugging::RobustnessAssessment` for ML robustness
164//
165// - `PatternType`: defined in `memory_profiler` (PRIMARY) and `ai_code_analyzer`
166//   → Use `memory_profiler::PatternType` for memory allocation patterns
167//   → Use `ai_code_analyzer::PatternType` for code patterns
168//
169// - `IssueType`: defined in `auto_debugger` (PRIMARY) and `ai_code_analyzer`
170//   → Use `auto_debugger::IssueType` for debugging issues
171//   → Use `ai_code_analyzer::IssueType` for code analysis issues
172//
173// ============================================================================
174
175// Primary exports (order determines which type wins for ambiguous names)
176pub use advanced_ml_debugging::*;
177pub use ai_code_analyzer::*;
178pub use anomaly_detector::*;
179pub use architecture_analysis::*;
180pub use auto_debugger::*;
181pub use behavior_analysis::*;
182pub use cicd_integration::*;
183pub use collaboration::*;
184pub use computation_graph::*;
185pub use dashboard::*;
186pub use data_export::*;
187pub use differential_debugging::*;
188pub use distributed_debugger::*;
189pub use environmental_monitor::*;
190pub use error_recovery::*;
191pub use flame_graph_profiler::*;
192pub use gradient_debugger::*;
193pub use health_checker::*;
194pub use hooks::*;
195pub use ide_integration::*;
196pub use interactive_debugger::*;
197pub use llm_debugging::*;
198pub use memory_profiler::*;
199pub use model_diagnostics::*;
200pub use neural_network_debugging::*;
201pub use profiler::*;
202pub use quantum_debugging::*;
203pub use realtime_dashboard::{AlertSeverity as DashboardAlertSeverity, *};
204pub use regression_detector::*;
205pub use report_generation::*;
206pub use simulation_tools::*;
207pub use streaming_debugger::*;
208pub use team_dashboard::*;
209pub use tensor_inspector::*;
210pub use training_dynamics::*; // LRScheduleType from here is PRIMARY
211pub use utilities::*;
212pub use visualization::*;
213#[cfg(feature = "wasm")]
214pub use wasm_interface::*;
215
216use scirs2_core::ndarray::ArrayD; // SciRS2 Integration Policy
217
218// ============================================================================
219// NEW MODULAR ARCHITECTURE
220// ============================================================================
221
222/// Core debugging session and configuration management
223pub mod core;
224
225/// Simplified debugging interface with one-line functions
226pub mod interface;
227
228/// Guided debugging system with step-by-step workflows
229pub mod guided;
230
231/// Interactive tutorial and learning system
232pub mod tutorial;
233
234/// Context-aware help system
235pub mod help;
236
237/// Performance optimization system for production debugging
238pub mod performance;
239
240// Re-export all public items from modules for backward compatibility
241pub use core::*;
242pub use guided::*;
243pub use help::*;
244pub use interface::*;
245pub use performance::*;
246pub use tutorial::*;