frameworm 1.0.0__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 (84) hide show
  1. frameworm-1.0.0/LICENSE +21 -0
  2. frameworm-1.0.0/PKG-INFO +160 -0
  3. frameworm-1.0.0/README.md +81 -0
  4. frameworm-1.0.0/cli/__init__.py +93 -0
  5. frameworm-1.0.0/cli/evaluate.py +47 -0
  6. frameworm-1.0.0/cli/export.py +65 -0
  7. frameworm-1.0.0/cli/logger.py +30 -0
  8. frameworm-1.0.0/cli/main.py +254 -0
  9. frameworm-1.0.0/cli/monitor.py +53 -0
  10. frameworm-1.0.0/cli/pipeline.py +58 -0
  11. frameworm-1.0.0/cli/search_cli.py +63 -0
  12. frameworm-1.0.0/cli/train.py +112 -0
  13. frameworm-1.0.0/core/__init__.py +80 -0
  14. frameworm-1.0.0/core/config.py +464 -0
  15. frameworm-1.0.0/core/exceptions.py +472 -0
  16. frameworm-1.0.0/core/registry.py +354 -0
  17. frameworm-1.0.0/core/testconfig.py +24 -0
  18. frameworm-1.0.0/core/types.py +381 -0
  19. frameworm-1.0.0/data/__init__.py +0 -0
  20. frameworm-1.0.0/deployment/__init__.py +10 -0
  21. frameworm-1.0.0/deployment/cli.py +93 -0
  22. frameworm-1.0.0/deployment/export.py +275 -0
  23. frameworm-1.0.0/deployment/onnx_runtime.py +132 -0
  24. frameworm-1.0.0/deployment/server.py +299 -0
  25. frameworm-1.0.0/distributed/__init__.py +38 -0
  26. frameworm-1.0.0/distributed/data_loader.py +157 -0
  27. frameworm-1.0.0/distributed/data_parallel.py +74 -0
  28. frameworm-1.0.0/distributed/profiler.py +187 -0
  29. frameworm-1.0.0/distributed/sampler.py +132 -0
  30. frameworm-1.0.0/distributed/trainer.py +204 -0
  31. frameworm-1.0.0/distributed/utils.py +229 -0
  32. frameworm-1.0.0/experiment/__init__.py +17 -0
  33. frameworm-1.0.0/experiment/cli.py +159 -0
  34. frameworm-1.0.0/experiment/experiment.py +455 -0
  35. frameworm-1.0.0/experiment/manager.py +324 -0
  36. frameworm-1.0.0/experiment/visualization.py +147 -0
  37. frameworm-1.0.0/frameworm.egg-info/PKG-INFO +160 -0
  38. frameworm-1.0.0/frameworm.egg-info/SOURCES.txt +82 -0
  39. frameworm-1.0.0/frameworm.egg-info/dependency_links.txt +1 -0
  40. frameworm-1.0.0/frameworm.egg-info/entry_points.txt +2 -0
  41. frameworm-1.0.0/frameworm.egg-info/requires.txt +37 -0
  42. frameworm-1.0.0/frameworm.egg-info/top_level.txt +15 -0
  43. frameworm-1.0.0/graph/__init__.py +29 -0
  44. frameworm-1.0.0/graph/graph.py +828 -0
  45. frameworm-1.0.0/graph/monitoring.py +189 -0
  46. frameworm-1.0.0/graph/node.py +192 -0
  47. frameworm-1.0.0/graph/visualization.py +119 -0
  48. frameworm-1.0.0/metrics/__init__.py +14 -0
  49. frameworm-1.0.0/metrics/evaluator.py +247 -0
  50. frameworm-1.0.0/metrics/fid.py +286 -0
  51. frameworm-1.0.0/metrics/inception_score.py +169 -0
  52. frameworm-1.0.0/metrics/lpips.py +97 -0
  53. frameworm-1.0.0/models/__init__.py +8 -0
  54. frameworm-1.0.0/models/base.py +90 -0
  55. frameworm-1.0.0/pipelines/__init__.py +6 -0
  56. frameworm-1.0.0/pipelines/base.py +84 -0
  57. frameworm-1.0.0/plugins/__init__.py +0 -0
  58. frameworm-1.0.0/pyproject.toml +103 -0
  59. frameworm-1.0.0/search/__init__.py +26 -0
  60. frameworm-1.0.0/search/analysis.py +182 -0
  61. frameworm-1.0.0/search/bayesian_search.py +214 -0
  62. frameworm-1.0.0/search/early_stopping.py +136 -0
  63. frameworm-1.0.0/search/grid_search.py +251 -0
  64. frameworm-1.0.0/search/hyperband.py +93 -0
  65. frameworm-1.0.0/search/random_search.py +261 -0
  66. frameworm-1.0.0/search/space.py +40 -0
  67. frameworm-1.0.0/search/space_objects.py +93 -0
  68. frameworm-1.0.0/setup.cfg +4 -0
  69. frameworm-1.0.0/setup.py +18 -0
  70. frameworm-1.0.0/trainers/__init__.py +5 -0
  71. frameworm-1.0.0/trainers/base.py +95 -0
  72. frameworm-1.0.0/training/__init__.py +42 -0
  73. frameworm-1.0.0/training/advanced.py +141 -0
  74. frameworm-1.0.0/training/callbacks.py +155 -0
  75. frameworm-1.0.0/training/evaluation.py +63 -0
  76. frameworm-1.0.0/training/loggers.py +167 -0
  77. frameworm-1.0.0/training/metrics.py +127 -0
  78. frameworm-1.0.0/training/schedulers.py +143 -0
  79. frameworm-1.0.0/training/state.py +139 -0
  80. frameworm-1.0.0/training/trainer.py +343 -0
  81. frameworm-1.0.0/utils/__init__.py +0 -0
  82. frameworm-1.0.0/utils/data_utils.py +211 -0
  83. frameworm-1.0.0/utils/memory.py +196 -0
  84. frameworm-1.0.0/utils/profiler.py +373 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aakash Ali
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,160 @@
1
+ Metadata-Version: 2.4
2
+ Name: frameworm
3
+ Version: 1.0.0
4
+ Summary: Complete Machine Learning Framework for Production
5
+ Author-email: Aakash Ali <Aakashali0440@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Aakash Ali
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/Aakash0440/frameworm
29
+ Project-URL: Documentation, https://frameworm.readthedocs.io
30
+ Project-URL: Repository, https://github.com/Aakash0440/frameworm
31
+ Project-URL: Bug Tracker, https://github.com/Aakash0440/frameworm/issues
32
+ Project-URL: Changelog, https://github.com/Aakash0440/frameworm/blob/main/CHANGELOG.md
33
+ Keywords: machine-learning,deep-learning,pytorch,training,deployment,experiments
34
+ Classifier: Development Status :: 5 - Production/Stable
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: Intended Audience :: Science/Research
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.9
40
+ Classifier: Programming Language :: Python :: 3.10
41
+ Classifier: Programming Language :: Python :: 3.11
42
+ Classifier: Programming Language :: Python :: 3.12
43
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
44
+ Requires-Python: >=3.14
45
+ Description-Content-Type: text/markdown
46
+ License-File: LICENSE
47
+ Requires-Dist: torch>=2.0.0
48
+ Requires-Dist: torchvision>=0.15.0
49
+ Requires-Dist: numpy>=1.23.0
50
+ Requires-Dist: pyyaml>=6.0
51
+ Requires-Dist: click>=8.0.0
52
+ Requires-Dist: click-completion>=0.5.0
53
+ Requires-Dist: rich>=13.0.0
54
+ Requires-Dist: tqdm>=4.65.0
55
+ Provides-Extra: search
56
+ Requires-Dist: scikit-optimize>=0.9.0; extra == "search"
57
+ Provides-Extra: deployment
58
+ Requires-Dist: fastapi>=0.104.0; extra == "deployment"
59
+ Requires-Dist: uvicorn[standard]>=0.24.0; extra == "deployment"
60
+ Requires-Dist: onnx>=1.15.0; extra == "deployment"
61
+ Requires-Dist: onnxruntime>=1.16.0; extra == "deployment"
62
+ Provides-Extra: dashboard
63
+ Requires-Dist: fastapi>=0.104.0; extra == "dashboard"
64
+ Requires-Dist: uvicorn[standard]>=0.24.0; extra == "dashboard"
65
+ Requires-Dist: psutil>=5.9.0; extra == "dashboard"
66
+ Provides-Extra: metrics
67
+ Requires-Dist: lpips>=0.1.4; extra == "metrics"
68
+ Provides-Extra: dev
69
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
70
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
71
+ Requires-Dist: black>=23.0.0; extra == "dev"
72
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
73
+ Requires-Dist: mypy>=1.5.0; extra == "dev"
74
+ Requires-Dist: isort>=5.12.0; extra == "dev"
75
+ Requires-Dist: pre-commit>=3.4.0; extra == "dev"
76
+ Provides-Extra: all
77
+ Requires-Dist: frameworm[dashboard,deployment,metrics,search]; extra == "all"
78
+ Dynamic: license-file
79
+
80
+ # FRAMEWORM
81
+
82
+ **Complete Machine Learning Framework for Production**
83
+
84
+ [![PyPI](https://img.shields.io/pypi/v/frameworm)](https://pypi.org/project/frameworm/)
85
+ [![Python](https://img.shields.io/pypi/pyversions/frameworm)](https://python.org)
86
+ [![Tests](https://img.shields.io/github/workflow/status/yourusername/frameworm/tests)](https://github.com/yourusername/frameworm/actions)
87
+ [![Coverage](https://img.shields.io/codecov/c/github/yourusername/frameworm)](https://codecov.io/gh/yourusername/frameworm)
88
+ [![Documentation](https://img.shields.io/badge/docs-mkdocs-blue)](https://frameworm.readthedocs.io)
89
+ [![License](https://img.shields.io/github/license/yourusername/frameworm)](https://github.com/yourusername/frameworm/blob/main/LICENSE)
90
+ [![Discord](https://img.shields.io/discord/123456789)](https://discord.gg/frameworm)
91
+
92
+ ---
93
+
94
+ ## Features
95
+
96
+ - 🚀 **Simple API** - Train models in minutes
97
+ - 📊 **Experiment Tracking** - Built-in, no external servers
98
+ - 🔍 **Hyperparameter Search** - Grid, random, Bayesian
99
+ - 🎯 **Production Ready** - Export, serve, deploy
100
+ - ⚡ **Fast** - Multi-GPU, distributed, mixed precision
101
+ - 🎨 **Web Dashboard** - Beautiful UI for tracking
102
+
103
+ ---
104
+
105
+ ## Quick Start
106
+ ```bash
107
+ pip install frameworm
108
+ frameworm init my-project
109
+ cd my-project
110
+ frameworm train --config config.yaml
111
+ ```
112
+
113
+ See [documentation](https://frameworm.readthedocs.io) for more.
114
+
115
+ ---
116
+
117
+ ## Why FRAMEWORM?
118
+
119
+ | Feature | FRAMEWORM | PyTorch Lightning | Others |
120
+ |---------|-----------|-------------------|--------|
121
+ | Training | ✅ | ✅ | ✅ |
122
+ | Experiment Tracking | ✅ Built-in | ⚠️ External | ⚠️ External |
123
+ | Hyperparameter Search | ✅ Built-in | ❌ | ⚠️ Limited |
124
+ | Deployment | ✅ Built-in | ❌ | ⚠️ Limited |
125
+ | Web UI | ✅ Built-in | ❌ | ❌ |
126
+ | Complexity | Low | Medium | High |
127
+
128
+ ---
129
+
130
+ ## Documentation
131
+
132
+ - [Quick Start](https://frameworm.readthedocs.io/getting-started/quickstart/)
133
+ - [User Guide](https://frameworm.readthedocs.io/user-guide/training/)
134
+ - [Tutorials](https://frameworm.readthedocs.io/tutorials/vae-tutorial/)
135
+ - [API Reference](https://frameworm.readthedocs.io/api-reference/core/)
136
+ - [Examples](https://frameworm.readthedocs.io/examples/basic-training/)
137
+
138
+ ---
139
+
140
+ ## Contributing
141
+
142
+ See [CONTRIBUTING.md](CONTRIBUTING.md)
143
+
144
+ ---
145
+
146
+ ## License
147
+
148
+ MIT License - see [LICENSE](LICENSE)
149
+
150
+ ---
151
+
152
+ ## Citation
153
+ ```bibtex
154
+ @software{frameworm2024,
155
+ title = {FRAMEWORM: Complete Machine Learning Framework},
156
+ author = {Aakash Ali},
157
+ year = {2026},
158
+ url = {https://github.com/Aakash0440/frameworm}
159
+ }
160
+ ```
@@ -0,0 +1,81 @@
1
+ # FRAMEWORM
2
+
3
+ **Complete Machine Learning Framework for Production**
4
+
5
+ [![PyPI](https://img.shields.io/pypi/v/frameworm)](https://pypi.org/project/frameworm/)
6
+ [![Python](https://img.shields.io/pypi/pyversions/frameworm)](https://python.org)
7
+ [![Tests](https://img.shields.io/github/workflow/status/yourusername/frameworm/tests)](https://github.com/yourusername/frameworm/actions)
8
+ [![Coverage](https://img.shields.io/codecov/c/github/yourusername/frameworm)](https://codecov.io/gh/yourusername/frameworm)
9
+ [![Documentation](https://img.shields.io/badge/docs-mkdocs-blue)](https://frameworm.readthedocs.io)
10
+ [![License](https://img.shields.io/github/license/yourusername/frameworm)](https://github.com/yourusername/frameworm/blob/main/LICENSE)
11
+ [![Discord](https://img.shields.io/discord/123456789)](https://discord.gg/frameworm)
12
+
13
+ ---
14
+
15
+ ## Features
16
+
17
+ - 🚀 **Simple API** - Train models in minutes
18
+ - 📊 **Experiment Tracking** - Built-in, no external servers
19
+ - 🔍 **Hyperparameter Search** - Grid, random, Bayesian
20
+ - 🎯 **Production Ready** - Export, serve, deploy
21
+ - ⚡ **Fast** - Multi-GPU, distributed, mixed precision
22
+ - 🎨 **Web Dashboard** - Beautiful UI for tracking
23
+
24
+ ---
25
+
26
+ ## Quick Start
27
+ ```bash
28
+ pip install frameworm
29
+ frameworm init my-project
30
+ cd my-project
31
+ frameworm train --config config.yaml
32
+ ```
33
+
34
+ See [documentation](https://frameworm.readthedocs.io) for more.
35
+
36
+ ---
37
+
38
+ ## Why FRAMEWORM?
39
+
40
+ | Feature | FRAMEWORM | PyTorch Lightning | Others |
41
+ |---------|-----------|-------------------|--------|
42
+ | Training | ✅ | ✅ | ✅ |
43
+ | Experiment Tracking | ✅ Built-in | ⚠️ External | ⚠️ External |
44
+ | Hyperparameter Search | ✅ Built-in | ❌ | ⚠️ Limited |
45
+ | Deployment | ✅ Built-in | ❌ | ⚠️ Limited |
46
+ | Web UI | ✅ Built-in | ❌ | ❌ |
47
+ | Complexity | Low | Medium | High |
48
+
49
+ ---
50
+
51
+ ## Documentation
52
+
53
+ - [Quick Start](https://frameworm.readthedocs.io/getting-started/quickstart/)
54
+ - [User Guide](https://frameworm.readthedocs.io/user-guide/training/)
55
+ - [Tutorials](https://frameworm.readthedocs.io/tutorials/vae-tutorial/)
56
+ - [API Reference](https://frameworm.readthedocs.io/api-reference/core/)
57
+ - [Examples](https://frameworm.readthedocs.io/examples/basic-training/)
58
+
59
+ ---
60
+
61
+ ## Contributing
62
+
63
+ See [CONTRIBUTING.md](CONTRIBUTING.md)
64
+
65
+ ---
66
+
67
+ ## License
68
+
69
+ MIT License - see [LICENSE](LICENSE)
70
+
71
+ ---
72
+
73
+ ## Citation
74
+ ```bibtex
75
+ @software{frameworm2024,
76
+ title = {FRAMEWORM: Complete Machine Learning Framework},
77
+ author = {Aakash Ali},
78
+ year = {2026},
79
+ url = {https://github.com/Aakash0440/frameworm}
80
+ }
81
+ ```
@@ -0,0 +1,93 @@
1
+ """
2
+ Project initialization.
3
+ """
4
+
5
+ import shutil
6
+ from pathlib import Path
7
+
8
+ from click import echo
9
+
10
+
11
+ def create_project(project_path: Path, template: str = "basic"):
12
+ """Create new FRAMEWORM project"""
13
+
14
+ # Create directory structure
15
+ project_path.mkdir(parents=True, exist_ok=True)
16
+
17
+ (project_path / "configs").mkdir(exist_ok=True)
18
+ (project_path / "data").mkdir(exist_ok=True)
19
+ (project_path / "experiments").mkdir(exist_ok=True)
20
+ (project_path / "checkpoints").mkdir(exist_ok=True)
21
+ (project_path / "scripts").mkdir(exist_ok=True)
22
+
23
+ # Create README
24
+ readme = project_path / "README.md"
25
+ readme.write_text(f"""# {project_path.name}
26
+
27
+ FRAMEWORM project created with template: {template}
28
+
29
+ ## Quick Start
30
+ ```bash
31
+ # Train model
32
+ frameworm train --config configs/config.yaml
33
+
34
+ # Evaluate
35
+ frameworm evaluate --checkpoint checkpoints/best.pt
36
+
37
+ # Export
38
+ frameworm export checkpoints/best.pt --format onnx
39
+
40
+ # Serve
41
+ frameworm serve exported/model.pt
42
+ ```
43
+
44
+ ## Structure
45
+
46
+ - `configs/` - Configuration files
47
+ - `data/` - Datasets
48
+ - `experiments/` - Experiment tracking
49
+ - `checkpoints/` - Model checkpoints
50
+ - `scripts/` - Custom scripts
51
+ """)
52
+
53
+ # Create basic config
54
+ config = project_path / "configs" / "config.yaml"
55
+ config.write_text(f"""# FRAMEWORM Configuration
56
+
57
+ model:
58
+ type: {template if template != 'basic' else 'vae'}
59
+ latent_dim: 128
60
+ hidden_dim: 256
61
+
62
+ training:
63
+ epochs: 100
64
+ batch_size: 128
65
+ lr: 0.001
66
+ device: cuda
67
+
68
+ data:
69
+ root: data/
70
+ image_size: 64
71
+ """)
72
+
73
+ # Create .gitignore
74
+ gitignore = project_path / ".gitignore"
75
+ gitignore.write_text("""__pycache__/
76
+ *.pyc
77
+ *.pyo
78
+ *.pyd
79
+ .Python
80
+ *.so
81
+ *.egg
82
+ *.egg-info/
83
+ dist/
84
+ build/
85
+ data/
86
+ experiments/
87
+ checkpoints/
88
+ .DS_Store
89
+ """)
90
+
91
+ echo(f"✓ Created directory structure")
92
+ echo(f"✓ Created README.md")
93
+ echo(f"✓ Created config.yaml")
@@ -0,0 +1,47 @@
1
+ """
2
+ Model evaluation command.
3
+ """
4
+
5
+ import torch
6
+ from click import echo
7
+
8
+ from core import Config, get_model
9
+ from metrics import MetricEvaluator
10
+
11
+
12
+ def run_evaluation(config_path: str, checkpoint_path: str, metrics: list, num_samples: int = 10000):
13
+ """Run model evaluation"""
14
+
15
+ # Load config
16
+ config = Config(config_path)
17
+
18
+ # Load checkpoint
19
+ checkpoint = torch.load(checkpoint_path)
20
+
21
+ # Create model
22
+ model = get_model(config.model.type)(config)
23
+ model.load_state_dict(checkpoint["model_state_dict"])
24
+ model.eval()
25
+
26
+ echo(f"✓ Model loaded from: {checkpoint_path}")
27
+
28
+ # Create evaluator
29
+ evaluator = MetricEvaluator(
30
+ metrics=metrics,
31
+ real_data=None, # Placeholder
32
+ device="cuda" if torch.cuda.is_available() else "cpu",
33
+ )
34
+
35
+ echo(f"Computing metrics: {metrics}")
36
+
37
+ # Evaluate
38
+ results = evaluator.evaluate(model, num_samples=num_samples)
39
+
40
+ echo("\n" + "=" * 60)
41
+ echo("EVALUATION RESULTS")
42
+ echo("=" * 60)
43
+
44
+ for metric, value in results.items():
45
+ echo(f"{metric}: {value:.4f}")
46
+
47
+ echo("=" * 60)
@@ -0,0 +1,65 @@
1
+ """
2
+ Model export command.
3
+ """
4
+
5
+ from pathlib import Path
6
+
7
+ import torch
8
+ from click import echo
9
+
10
+ from deployment import ModelExporter
11
+
12
+
13
+ def export_model(
14
+ checkpoint_path: str,
15
+ export_format: str = "all",
16
+ output_dir: str = "exported",
17
+ quantize: bool = False,
18
+ benchmark: bool = False,
19
+ ):
20
+ """Export model to deployment formats"""
21
+
22
+ # Load checkpoint
23
+ checkpoint = torch.load(checkpoint_path)
24
+ model = checkpoint.get("model") # Or reconstruct from state_dict
25
+
26
+ if model is None:
27
+ echo("✗ Model not found in checkpoint")
28
+ return
29
+
30
+ # Create output directory
31
+ output_path = Path(output_dir)
32
+ output_path.mkdir(exist_ok=True, parents=True)
33
+
34
+ # Example input (you'd get this from config)
35
+ example_input = torch.randn(1, 3, 64, 64)
36
+
37
+ # Create exporter
38
+ exporter = ModelExporter(model, example_input)
39
+
40
+ # Export formats
41
+ formats_to_export = []
42
+ if export_format == "all":
43
+ formats_to_export = ["torchscript", "onnx"]
44
+ else:
45
+ formats_to_export = [export_format]
46
+
47
+ for fmt in formats_to_export:
48
+ output_file = output_path / f"model.{fmt.replace('torchscript', 'pt')}"
49
+
50
+ if fmt == "torchscript":
51
+ exporter.to_torchscript(str(output_file))
52
+ elif fmt == "onnx":
53
+ exporter.to_onnx(str(output_file))
54
+
55
+ # Quantize if requested
56
+ if quantize:
57
+ quant_file = output_path / "model_quant.pt"
58
+ exporter.quantize(str(quant_file))
59
+
60
+ # Benchmark if requested
61
+ if benchmark:
62
+ echo("\nBenchmarking...")
63
+ exporter.benchmark_inference()
64
+
65
+ echo(f"\n✓ Export complete: {output_path}")
@@ -0,0 +1,30 @@
1
+ """
2
+ CLI logging utilities.
3
+ """
4
+
5
+ import logging
6
+
7
+ from rich.logging import RichHandler
8
+
9
+
10
+ def setup_logging(level: str = "INFO", log_file: str = None):
11
+ """Setup CLI logging"""
12
+
13
+ # Create logger
14
+ logger = logging.getLogger("frameworm")
15
+ logger.setLevel(getattr(logging, level.upper()))
16
+
17
+ # Console handler with rich formatting
18
+ console_handler = RichHandler(rich_tracebacks=True)
19
+ console_handler.setFormatter(logging.Formatter("%(message)s"))
20
+ logger.addHandler(console_handler)
21
+
22
+ # File handler if specified
23
+ if log_file:
24
+ file_handler = logging.FileHandler(log_file)
25
+ file_handler.setFormatter(
26
+ logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
27
+ )
28
+ logger.addHandler(file_handler)
29
+
30
+ return logger