ToTf 0.2.4__tar.gz → 0.2.6__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 (43) hide show
  1. {totf-0.2.4 → totf-0.2.6}/PKG-INFO +16 -1
  2. {totf-0.2.4 → totf-0.2.6}/README.md +15 -0
  3. totf-0.2.6/ToTf/__init__.py +35 -0
  4. totf-0.2.6/ToTf/backend.py +14 -0
  5. totf-0.2.6/ToTf/backend_manager.py +301 -0
  6. {totf-0.2.4 → totf-0.2.6}/ToTf.egg-info/PKG-INFO +16 -1
  7. {totf-0.2.4 → totf-0.2.6}/ToTf.egg-info/SOURCES.txt +4 -12
  8. totf-0.2.6/ToTf.egg-info/top_level.txt +1 -0
  9. {totf-0.2.4 → totf-0.2.6}/pyproject.toml +3 -3
  10. {totf-0.2.4 → totf-0.2.6}/setup.py +1 -1
  11. totf-0.2.6/test/test_phase1_utils.py +345 -0
  12. totf-0.2.4/ToTf.egg-info/top_level.txt +0 -2
  13. totf-0.2.4/pytorch/README.md +0 -200
  14. totf-0.2.4/pytorch/__init__.py +0 -28
  15. totf-0.2.4/pytorch/modelview.py +0 -347
  16. totf-0.2.4/pytorch/smartsummary.py +0 -1054
  17. totf-0.2.4/pytorch/trainingmonitor.py +0 -87
  18. totf-0.2.4/pytorch/utils.py +0 -533
  19. totf-0.2.4/tenf/README.md +0 -161
  20. totf-0.2.4/tenf/__init__.py +0 -28
  21. totf-0.2.4/tenf/computation_nodes.py +0 -176
  22. totf-0.2.4/tenf/modelview.py +0 -989
  23. totf-0.2.4/tenf/smartsummary.py +0 -846
  24. totf-0.2.4/tenf/utils.py +0 -611
  25. {totf-0.2.4 → totf-0.2.6}/LICENSE +0 -0
  26. {totf-0.2.4 → totf-0.2.6}/ToTf.egg-info/dependency_links.txt +0 -0
  27. {totf-0.2.4 → totf-0.2.6}/ToTf.egg-info/requires.txt +0 -0
  28. {totf-0.2.4 → totf-0.2.6}/setup.cfg +0 -0
  29. {totf-0.2.4 → totf-0.2.6}/test/test_connection_api.py +0 -0
  30. {totf-0.2.4 → totf-0.2.6}/test/test_connections_visual.py +0 -0
  31. {totf-0.2.4 → totf-0.2.6}/test/test_integration.py +0 -0
  32. {totf-0.2.4 → totf-0.2.6}/test/test_modelview_quick.py +0 -0
  33. {totf-0.2.4 → totf-0.2.6}/test/test_modelview_tf.py +0 -0
  34. {totf-0.2.4 → totf-0.2.6}/test/test_monitor.py +0 -0
  35. {totf-0.2.4 → totf-0.2.6}/test/test_onnx_pytorch.py +0 -0
  36. {totf-0.2.4 → totf-0.2.6}/test/test_onnx_tensorflow.py +0 -0
  37. {totf-0.2.4 → totf-0.2.6}/test/test_pytorch_modelview_quick.py +0 -0
  38. {totf-0.2.4 → totf-0.2.6}/test/test_smartsummary.py +0 -0
  39. {totf-0.2.4 → totf-0.2.6}/test/test_smartsummary_features.py +0 -0
  40. {totf-0.2.4 → totf-0.2.6}/test/test_smartsummary_tf.py +0 -0
  41. {totf-0.2.4 → totf-0.2.6}/test/test_utils_integration.py +0 -0
  42. {totf-0.2.4 → totf-0.2.6}/test/test_utils_pytorch.py +0 -0
  43. {totf-0.2.4 → totf-0.2.6}/test/test_utils_tf.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ToTf
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: A Cross-Library Compatible Library for PyTorch and TensorFlow that provides advanced features for ease of use
5
5
  Home-page: https://github.com/Akshay-Ramesh-VITC/ToTf
6
6
  Author: Akshay, Shyamanth Reddy
@@ -124,6 +124,21 @@ Framework-agnostic "missing" functions that save time and improve code quality:
124
124
  - **`LRFinder`** - Full-featured LR range test class with plotting
125
125
  - **Use case**: Automatically discover the best learning rate before training (fast.ai style), avoid manual tuning
126
126
 
127
+ #### Cross-Framework Reproducibility
128
+ - **`seed_everything(seed=42, deterministic=False, benchmark=False, verbose=False)`** - Seeds Python, NumPy, PyTorch (CPU & CUDA), and TensorFlow in a single call. Optionally sets deterministic algorithms and cuBLAS workspace config.
129
+ - **Use case**: Guaranteed reproducible experiments and benchmarks across backends without repeating 10 lines of boilerplate.
130
+
131
+ #### Tensor Health & Diagnostics
132
+ - **`inspect_tensor(tensor, name=None, print_info=True, quantiles=True)`** - One-line diagnostic inspector for PyTorch, TensorFlow, or NumPy tensors.
133
+ - **Information provided**: Shape, dtype, device, memory MB, element count, NaN/Inf detection, zero sparsity %, min, max, mean, std, and quantiles (p25, p50, p75).
134
+ - **Use case**: Rapid sanity-checking and debugging of activations, embeddings, and gradients.
135
+
136
+ #### Transfer Learning & Fine-Tuning
137
+ - **`freeze_layers(model, up_to=None, layer_names=None, layer_types=None, regex=None)`** - Freeze model parameters/layers (supports both `torch.nn.Module` and `tf.keras.Model`).
138
+ - **`unfreeze_layers(model, last_n=None, layer_names=None, layer_types=None, regex=None)`** - Selectively unfreeze layers (e.g., `last_n=1` for classification heads).
139
+ - **`freeze_batchnorm(model, freeze_eval=True)`** - Lock BatchNorm affine parameters and freeze running statistics (eval mode) during fine-tuning.
140
+ - **Use case**: Effortless backbone freezing and transfer learning across both frameworks.
141
+
127
142
  ### 📊 ModelView (PyTorch & TensorFlow)
128
143
  Publication-quality neural network architecture diagrams for both frameworks:
129
144
  - **PyTorch support** - Wraps torchview for comprehensive PyTorch model visualization
@@ -52,6 +52,21 @@ Framework-agnostic "missing" functions that save time and improve code quality:
52
52
  - **`LRFinder`** - Full-featured LR range test class with plotting
53
53
  - **Use case**: Automatically discover the best learning rate before training (fast.ai style), avoid manual tuning
54
54
 
55
+ #### Cross-Framework Reproducibility
56
+ - **`seed_everything(seed=42, deterministic=False, benchmark=False, verbose=False)`** - Seeds Python, NumPy, PyTorch (CPU & CUDA), and TensorFlow in a single call. Optionally sets deterministic algorithms and cuBLAS workspace config.
57
+ - **Use case**: Guaranteed reproducible experiments and benchmarks across backends without repeating 10 lines of boilerplate.
58
+
59
+ #### Tensor Health & Diagnostics
60
+ - **`inspect_tensor(tensor, name=None, print_info=True, quantiles=True)`** - One-line diagnostic inspector for PyTorch, TensorFlow, or NumPy tensors.
61
+ - **Information provided**: Shape, dtype, device, memory MB, element count, NaN/Inf detection, zero sparsity %, min, max, mean, std, and quantiles (p25, p50, p75).
62
+ - **Use case**: Rapid sanity-checking and debugging of activations, embeddings, and gradients.
63
+
64
+ #### Transfer Learning & Fine-Tuning
65
+ - **`freeze_layers(model, up_to=None, layer_names=None, layer_types=None, regex=None)`** - Freeze model parameters/layers (supports both `torch.nn.Module` and `tf.keras.Model`).
66
+ - **`unfreeze_layers(model, last_n=None, layer_names=None, layer_types=None, regex=None)`** - Selectively unfreeze layers (e.g., `last_n=1` for classification heads).
67
+ - **`freeze_batchnorm(model, freeze_eval=True)`** - Lock BatchNorm affine parameters and freeze running statistics (eval mode) during fine-tuning.
68
+ - **Use case**: Effortless backbone freezing and transfer learning across both frameworks.
69
+
55
70
  ### 📊 ModelView (PyTorch & TensorFlow)
56
71
  Publication-quality neural network architecture diagrams for both frameworks:
57
72
  - **PyTorch support** - Wraps torchview for comprehensive PyTorch model visualization
@@ -0,0 +1,35 @@
1
+ """
2
+ ToTf - A Cross-Library Compatible Library for PyTorch and TensorFlow
3
+ Provides additional features for ease of use not directly available in Torch or TF
4
+ """
5
+
6
+ from .backend import get_backend, _BACKEND
7
+ from .backend_manager import SmartSummary, TrainingMonitor, ModelView, draw_graph, get_component
8
+ from .backend_manager import toONNX, fromONNX
9
+ from .backend_manager import (
10
+ seed_everything,
11
+ inspect_tensor,
12
+ freeze_layers,
13
+ unfreeze_layers,
14
+ freeze_batchnorm,
15
+ )
16
+
17
+ __version__ = "0.2.6"
18
+ __author__ = "Akshay"
19
+ __all__ = [
20
+ "get_backend",
21
+ "TrainingMonitor",
22
+ "SmartSummary",
23
+ "ModelView",
24
+ "draw_graph",
25
+ "get_component",
26
+ "toONNX",
27
+ "fromONNX",
28
+ "seed_everything",
29
+ "inspect_tensor",
30
+ "freeze_layers",
31
+ "unfreeze_layers",
32
+ "freeze_batchnorm",
33
+ ]
34
+
35
+ # Use backend_manager factories for dynamic dispatch to framework implementations
@@ -0,0 +1,14 @@
1
+ import importlib.util
2
+
3
+ _BACKEND = None
4
+
5
+ if importlib.util.find_spec("torch"):
6
+ _BACKEND = "torch"
7
+ elif importlib.util.find_spec("tensorflow"):
8
+ _BACKEND = "tensorflow"
9
+ else:
10
+ raise ImportError("Neither PyTorch nor TensorFlow is installed. Please install one of them.")
11
+
12
+ def get_backend():
13
+ """Returns the detected backend: 'torch' or 'tensorflow'"""
14
+ return _BACKEND
@@ -0,0 +1,301 @@
1
+ """
2
+ Backend Manager / Dispatcher
3
+
4
+ Provides a unified API that dynamically routes calls to the appropriate
5
+ framework implementation (PyTorch or TensorFlow) based on the provided
6
+ model/tensor types or the detected default backend.
7
+
8
+ Usage:
9
+ from ToTf import SmartSummary
10
+ ss = SmartSummary(model_or_args...)
11
+
12
+ This file avoids heavy imports at module import time and only imports
13
+ framework modules lazily when needed.
14
+ """
15
+ from typing import Any, Optional, Callable, Dict
16
+ import importlib
17
+ import inspect
18
+
19
+ from . import backend as _backend_pkg
20
+
21
+
22
+ def _import_pytorch_module(name: str):
23
+ try:
24
+ return importlib.import_module(f"ToTf.pytorch.{name}")
25
+ except Exception:
26
+ return None
27
+
28
+
29
+ def _import_tensorflow_module(name: str):
30
+ try:
31
+ return importlib.import_module(f"ToTf.tenf.{name}")
32
+ except Exception:
33
+ return None
34
+
35
+
36
+ def _is_torch_tensor(obj: Any) -> bool:
37
+ try:
38
+ import torch
39
+ return isinstance(obj, torch.Tensor) or isinstance(obj, torch.nn.Module)
40
+ except Exception:
41
+ return False
42
+
43
+
44
+ def _is_tf_tensor(obj: Any) -> bool:
45
+ try:
46
+ import tensorflow as tf
47
+ return isinstance(obj, (tf.Tensor, tf.Variable, tf.keras.Model, tf.keras.layers.Layer))
48
+ except Exception:
49
+ return False
50
+
51
+
52
+ def _choose_backend_from_obj(obj: Any) -> Optional[str]:
53
+ if obj is None:
54
+ return None
55
+ if _is_torch_tensor(obj):
56
+ return "torch"
57
+ if _is_tf_tensor(obj):
58
+ return "tensorflow"
59
+ return None
60
+
61
+
62
+ def get_default_backend() -> str:
63
+ return _backend_pkg.get_backend()
64
+
65
+
66
+ def _load_backend_impl(backend_name: str, component: str):
67
+ if backend_name == "torch":
68
+ mod = _import_pytorch_module(component)
69
+ return mod
70
+ elif backend_name == "tensorflow":
71
+ mod = _import_tensorflow_module(component)
72
+ return mod
73
+ return None
74
+
75
+
76
+ def _select_backend_for_args(*args, **kwargs) -> str:
77
+ # Try to pick a backend from any args/kwargs by checking types
78
+ for a in list(args) + list(kwargs.values()):
79
+ b = _choose_backend_from_obj(a)
80
+ if b:
81
+ return b
82
+ # fallback to detected default
83
+ return get_default_backend()
84
+
85
+
86
+ def SmartSummary(*args, **kwargs):
87
+ """Factory that returns a SmartSummary instance from the appropriate backend.
88
+
89
+ Selection order:
90
+ - If first positional arg is a model object (torch.nn.Module or tf.keras.Model)
91
+ we pick the backend accordingly.
92
+ - Otherwise we inspect all args/kwargs for recognizable types (tensors or models).
93
+ - Fallback to the globally detected backend.
94
+ """
95
+ backend_name = None
96
+ if args:
97
+ backend_name = _choose_backend_from_obj(args[0])
98
+ if backend_name is None:
99
+ backend_name = _select_backend_for_args(*args, **kwargs)
100
+
101
+ impl_mod = _load_backend_impl(backend_name, "smartsummary")
102
+ if impl_mod is None:
103
+ raise ImportError(f"SmartSummary backend '{backend_name}' not available")
104
+
105
+ # The implementation exposes SmartSummary class
106
+ SmartSummaryCls = getattr(impl_mod, "SmartSummary", None)
107
+ if SmartSummaryCls is None:
108
+ raise ImportError(f"SmartSummary class not found in backend module {impl_mod}")
109
+
110
+ return SmartSummaryCls(*args, **kwargs)
111
+
112
+
113
+ def TrainingMonitor(*args, **kwargs):
114
+ backend_name = _select_backend_for_args(*args, **kwargs)
115
+ impl_mod = _load_backend_impl(backend_name, "trainingmonitor")
116
+ if impl_mod is None:
117
+ raise ImportError(f"TrainingMonitor backend '{backend_name}' not available")
118
+ TM = getattr(impl_mod, "TrainingMonitor", None)
119
+ if TM is None:
120
+ raise ImportError(f"TrainingMonitor class not found in backend module {impl_mod}")
121
+ return TM(*args, **kwargs)
122
+
123
+
124
+ def ModelView(*args, **kwargs):
125
+ backend_name = _select_backend_for_args(*args, **kwargs)
126
+ impl_mod = _load_backend_impl(backend_name, "modelview")
127
+ if impl_mod is None:
128
+ raise ImportError(f"ModelView backend '{backend_name}' not available")
129
+ MV = getattr(impl_mod, "ModelView", None)
130
+ if MV is None:
131
+ raise ImportError(f"ModelView class not found in backend module {impl_mod}")
132
+ return MV(*args, **kwargs)
133
+
134
+
135
+ def draw_graph(*args, **kwargs):
136
+ """Dispatch to the backend-specific convenience draw_graph function.
137
+
138
+ This will load the backend's `modelview` component and call its
139
+ `draw_graph` function. Selection of backend follows the same rules as
140
+ other factories (inspect args for model/tensor types, then fallback to
141
+ detected default).
142
+ """
143
+ backend_name = _select_backend_for_args(*args, **kwargs)
144
+ impl_mod = _load_backend_impl(backend_name, "modelview")
145
+ if impl_mod is None:
146
+ raise ImportError(f"draw_graph backend '{backend_name}' not available")
147
+ dg = getattr(impl_mod, "draw_graph", None)
148
+ if dg is None:
149
+ raise ImportError(f"draw_graph function not found in backend module {impl_mod}")
150
+ return dg(*args, **kwargs)
151
+
152
+
153
+ # Allow users to register custom backend modules (advanced)
154
+ _CUSTOM: Dict[str, Dict[str, Any]] = {}
155
+
156
+
157
+ def register_backend(name: str, components: Dict[str, Any]):
158
+ _CUSTOM[name] = components
159
+
160
+
161
+ def get_backend_for_obj(obj: Any) -> str:
162
+ b = _choose_backend_from_obj(obj)
163
+ if b:
164
+ return b
165
+ return get_default_backend()
166
+
167
+
168
+ def get_component(component: str, backend_name: Optional[str] = None):
169
+ """Return the backend-specific component module.
170
+
171
+ Args:
172
+ component: name of the component module (e.g. 'utils', 'smartsummary')
173
+ backend_name: 'torch' or 'tensorflow'. If None, uses detected default.
174
+
175
+ Returns:
176
+ Module object or raises ImportError if unavailable.
177
+ """
178
+ if backend_name is None:
179
+ backend_name = get_default_backend()
180
+
181
+ mod = _load_backend_impl(backend_name, component)
182
+ if mod is None:
183
+ raise ImportError(f"Component '{component}' not available for backend '{backend_name}'")
184
+ return mod
185
+
186
+
187
+ def toONNX(*args, backend_name: Optional[str] = None, **kwargs):
188
+ """
189
+ Dispatch to backend-specific toONNX implementation.
190
+
191
+ The function will try to infer backend from the first positional argument
192
+ (model) if available, otherwise use `backend_name` or the default detected backend.
193
+ """
194
+ # Try to infer backend from args
195
+ b = None
196
+ if args:
197
+ b = _choose_backend_from_obj(args[0])
198
+ if b is None:
199
+ b = backend_name or get_default_backend()
200
+
201
+ impl_mod = _load_backend_impl(b, "utils")
202
+ if impl_mod is None:
203
+ raise ImportError(f"toONNX utils not available for backend '{b}'")
204
+
205
+ fn = getattr(impl_mod, "toONNX", None)
206
+ if fn is None:
207
+ raise ImportError(f"toONNX not implemented in backend utils for '{b}'")
208
+
209
+ return fn(*args, **kwargs)
210
+
211
+
212
+ def fromONNX(onnx_path: str, *args, backend_name: Optional[str] = None, **kwargs):
213
+ """
214
+ Dispatch to a backend-agnostic ONNX inference wrapper. This currently uses onnxruntime
215
+ under the hood from each backend utils module for consistency.
216
+ """
217
+ # backend_name is less important here; both backends use onnxruntime wrapper
218
+ b = backend_name or get_default_backend()
219
+ impl_mod = _load_backend_impl(b, "utils")
220
+ if impl_mod is None:
221
+ raise ImportError(f"fromONNX utils not available for backend '{b}'")
222
+
223
+ fn = getattr(impl_mod, "fromONNX", None)
224
+ if fn is None:
225
+ raise ImportError(f"fromONNX not implemented in backend utils for '{b}'")
226
+
227
+ return fn(onnx_path, *args, **kwargs)
228
+
229
+
230
+ def seed_everything(
231
+ seed: int = 42,
232
+ deterministic: bool = False,
233
+ benchmark: bool = False,
234
+ verbose: bool = False,
235
+ backend_name: Optional[str] = None,
236
+ ) -> int:
237
+ """
238
+ Sets seeds across Python, NumPy, PyTorch, and TensorFlow for reproducibility.
239
+ """
240
+ b = backend_name or get_default_backend()
241
+ impl_mod = _load_backend_impl(b, "utils")
242
+ if impl_mod is not None and hasattr(impl_mod, "seed_everything"):
243
+ return impl_mod.seed_everything(seed=seed, deterministic=deterministic, benchmark=benchmark, verbose=verbose)
244
+ # Fallback to direct seeding
245
+ import os
246
+ import random
247
+ import numpy as np
248
+ random.seed(seed)
249
+ os.environ["PYTHONHASHSEED"] = str(seed)
250
+ np.random.seed(seed)
251
+ return seed
252
+
253
+
254
+ def inspect_tensor(
255
+ tensor: Any,
256
+ name: Optional[str] = None,
257
+ print_info: bool = True,
258
+ quantiles: bool = True,
259
+ backend_name: Optional[str] = None,
260
+ ) -> Dict[str, Any]:
261
+ """
262
+ Inspects a tensor (Torch, TF, or NumPy) and returns detailed statistics and health metrics.
263
+ """
264
+ b = _choose_backend_from_obj(tensor) or backend_name or get_default_backend()
265
+ impl_mod = _load_backend_impl(b, "utils")
266
+ if impl_mod is None or not hasattr(impl_mod, "inspect_tensor"):
267
+ raise ImportError(f"inspect_tensor utils not available for backend '{b}'")
268
+ return impl_mod.inspect_tensor(tensor, name=name, print_info=print_info, quantiles=quantiles)
269
+
270
+
271
+ def freeze_layers(model: Any, *args, backend_name: Optional[str] = None, **kwargs) -> int:
272
+ """
273
+ Freeze layers or parameters in a PyTorch or TensorFlow model for transfer learning.
274
+ """
275
+ b = _choose_backend_from_obj(model) or backend_name or get_default_backend()
276
+ impl_mod = _load_backend_impl(b, "utils")
277
+ if impl_mod is None or not hasattr(impl_mod, "freeze_layers"):
278
+ raise ImportError(f"freeze_layers utils not available for backend '{b}'")
279
+ return impl_mod.freeze_layers(model, *args, **kwargs)
280
+
281
+
282
+ def unfreeze_layers(model: Any, *args, backend_name: Optional[str] = None, **kwargs) -> int:
283
+ """
284
+ Unfreeze layers or parameters in a PyTorch or TensorFlow model.
285
+ """
286
+ b = _choose_backend_from_obj(model) or backend_name or get_default_backend()
287
+ impl_mod = _load_backend_impl(b, "utils")
288
+ if impl_mod is None or not hasattr(impl_mod, "unfreeze_layers"):
289
+ raise ImportError(f"unfreeze_layers utils not available for backend '{b}'")
290
+ return impl_mod.unfreeze_layers(model, *args, **kwargs)
291
+
292
+
293
+ def freeze_batchnorm(model: Any, *args, backend_name: Optional[str] = None, **kwargs) -> int:
294
+ """
295
+ Freeze BatchNorm layers in a PyTorch or TensorFlow model.
296
+ """
297
+ b = _choose_backend_from_obj(model) or backend_name or get_default_backend()
298
+ impl_mod = _load_backend_impl(b, "utils")
299
+ if impl_mod is None or not hasattr(impl_mod, "freeze_batchnorm"):
300
+ raise ImportError(f"freeze_batchnorm utils not available for backend '{b}'")
301
+ return impl_mod.freeze_batchnorm(model, *args, **kwargs)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ToTf
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Summary: A Cross-Library Compatible Library for PyTorch and TensorFlow that provides advanced features for ease of use
5
5
  Home-page: https://github.com/Akshay-Ramesh-VITC/ToTf
6
6
  Author: Akshay, Shyamanth Reddy
@@ -124,6 +124,21 @@ Framework-agnostic "missing" functions that save time and improve code quality:
124
124
  - **`LRFinder`** - Full-featured LR range test class with plotting
125
125
  - **Use case**: Automatically discover the best learning rate before training (fast.ai style), avoid manual tuning
126
126
 
127
+ #### Cross-Framework Reproducibility
128
+ - **`seed_everything(seed=42, deterministic=False, benchmark=False, verbose=False)`** - Seeds Python, NumPy, PyTorch (CPU & CUDA), and TensorFlow in a single call. Optionally sets deterministic algorithms and cuBLAS workspace config.
129
+ - **Use case**: Guaranteed reproducible experiments and benchmarks across backends without repeating 10 lines of boilerplate.
130
+
131
+ #### Tensor Health & Diagnostics
132
+ - **`inspect_tensor(tensor, name=None, print_info=True, quantiles=True)`** - One-line diagnostic inspector for PyTorch, TensorFlow, or NumPy tensors.
133
+ - **Information provided**: Shape, dtype, device, memory MB, element count, NaN/Inf detection, zero sparsity %, min, max, mean, std, and quantiles (p25, p50, p75).
134
+ - **Use case**: Rapid sanity-checking and debugging of activations, embeddings, and gradients.
135
+
136
+ #### Transfer Learning & Fine-Tuning
137
+ - **`freeze_layers(model, up_to=None, layer_names=None, layer_types=None, regex=None)`** - Freeze model parameters/layers (supports both `torch.nn.Module` and `tf.keras.Model`).
138
+ - **`unfreeze_layers(model, last_n=None, layer_names=None, layer_types=None, regex=None)`** - Selectively unfreeze layers (e.g., `last_n=1` for classification heads).
139
+ - **`freeze_batchnorm(model, freeze_eval=True)`** - Lock BatchNorm affine parameters and freeze running statistics (eval mode) during fine-tuning.
140
+ - **Use case**: Effortless backbone freezing and transfer learning across both frameworks.
141
+
127
142
  ### 📊 ModelView (PyTorch & TensorFlow)
128
143
  Publication-quality neural network architecture diagrams for both frameworks:
129
144
  - **PyTorch support** - Wraps torchview for comprehensive PyTorch model visualization
@@ -2,23 +2,14 @@ LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
4
  setup.py
5
+ ToTf/__init__.py
6
+ ToTf/backend.py
7
+ ToTf/backend_manager.py
5
8
  ToTf.egg-info/PKG-INFO
6
9
  ToTf.egg-info/SOURCES.txt
7
10
  ToTf.egg-info/dependency_links.txt
8
11
  ToTf.egg-info/requires.txt
9
12
  ToTf.egg-info/top_level.txt
10
- pytorch/README.md
11
- pytorch/__init__.py
12
- pytorch/modelview.py
13
- pytorch/smartsummary.py
14
- pytorch/trainingmonitor.py
15
- pytorch/utils.py
16
- tenf/README.md
17
- tenf/__init__.py
18
- tenf/computation_nodes.py
19
- tenf/modelview.py
20
- tenf/smartsummary.py
21
- tenf/utils.py
22
13
  test/test_connection_api.py
23
14
  test/test_connections_visual.py
24
15
  test/test_integration.py
@@ -27,6 +18,7 @@ test/test_modelview_tf.py
27
18
  test/test_monitor.py
28
19
  test/test_onnx_pytorch.py
29
20
  test/test_onnx_tensorflow.py
21
+ test/test_phase1_utils.py
30
22
  test/test_pytorch_modelview_quick.py
31
23
  test/test_smartsummary.py
32
24
  test/test_smartsummary_features.py
@@ -0,0 +1 @@
1
+ ToTf
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ToTf"
7
- version = "0.2.4"
7
+ version = "0.2.6"
8
8
  description = "A Cross-Library Compatible Library for PyTorch and TensorFlow that provides advanced features for ease of use"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.8"
@@ -110,8 +110,8 @@ Documentation = "https://github.com/Akshay-Ramesh-VITC/ToTf#readme"
110
110
  Repository = "https://github.com/Akshay-Ramesh-VITC/ToTf"
111
111
  "Bug Tracker" = "https://github.com/Akshay-Ramesh-VITC/ToTf/issues"
112
112
 
113
- [tool.setuptools]
114
- packages = ["pytorch", "tenf"]
113
+ [tool.setuptools.packages.find]
114
+ include = ["ToTf"]
115
115
 
116
116
  [tool.setuptools.package-data]
117
117
  "*" = ["*.md", "*.json"]
@@ -9,7 +9,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
9
9
 
10
10
  setup(
11
11
  name="ToTf",
12
- version="0.2.4",
12
+ version="0.2.6",
13
13
  author="Akshay",
14
14
  author_email="akshay.r2023@vitstudent.ac.in",
15
15
  description="A Cross-Library Compatible Library for PyTorch and TensorFlow",