nnlogging 0.1.2__py3-none-any.whl → 0.1.4__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.
- nnlogging/__init__.py +3 -15
- nnlogging/exceptions/__init__.py +15 -0
- nnlogging/exceptions/branch_exists.py +29 -0
- nnlogging/exceptions/branch_not_found.py +29 -0
- nnlogging/exceptions/task_exists.py +31 -0
- nnlogging/exceptions/task_not_found.py +29 -0
- nnlogging/global_.py +322 -0
- nnlogging/options/__init__.py +31 -0
- nnlogging/options/branch_config.py +19 -0
- nnlogging/options/log_option.py +34 -0
- nnlogging/options/logger_config.py +16 -0
- nnlogging/options/rich_console.py +44 -0
- nnlogging/options/rich_handler.py +47 -0
- nnlogging/options/rich_progress.py +62 -0
- nnlogging/options/run_config.py +27 -0
- nnlogging/options/task_option.py +17 -0
- nnlogging/options/track_option.py +19 -0
- nnlogging/shell.py +92 -273
- nnlogging/shell_funcs/__init__.py +4 -0
- nnlogging/shell_funcs/branch_.py +79 -0
- nnlogging/{utils/shell_funcs → shell_funcs}/logger_.py +55 -62
- nnlogging/shell_funcs/run_.py +84 -0
- nnlogging/{utils/shell_funcs → shell_funcs}/task_.py +42 -42
- nnlogging/typings/aliases.py +8 -56
- nnlogging/typings/exts.py +15 -0
- nnlogging/typings/protocols.py +43 -1
- nnlogging/utils/factories.py +112 -0
- nnlogging/utils/helpers.py +61 -26
- {nnlogging-0.1.2.dist-info → nnlogging-0.1.4.dist-info}/METADATA +25 -32
- nnlogging-0.1.4.dist-info/RECORD +31 -0
- nnlogging/shell_protocol.py +0 -86
- nnlogging/typings/__init__.py +0 -41
- nnlogging/typings/exceptions.py +0 -10
- nnlogging/typings/generics.py +0 -23
- nnlogging/utils/__init__.py +0 -83
- nnlogging/utils/exception/__init__.py +0 -11
- nnlogging/utils/exception/branch_exists.py +0 -49
- nnlogging/utils/exception/branch_not_found.py +0 -49
- nnlogging/utils/exception/task_exists.py +0 -54
- nnlogging/utils/exception/task_not_found.py +0 -49
- nnlogging/utils/factory_funcs/rich_.py +0 -154
- nnlogging/utils/factory_funcs/shell_.py +0 -192
- nnlogging/utils/shell_funcs/branch_.py +0 -164
- nnlogging/utils/shell_funcs/run_.py +0 -97
- nnlogging-0.1.2.dist-info/RECORD +0 -24
- {nnlogging-0.1.2.dist-info → nnlogging-0.1.4.dist-info}/WHEEL +0 -0
nnlogging/typings/protocols.py
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
from
|
|
1
|
+
from logging import Logger as LoggingLogger
|
|
2
|
+
from typing import Protocol, TypeAlias, runtime_checkable
|
|
3
|
+
|
|
4
|
+
from aim import Run as AimRun
|
|
5
|
+
|
|
6
|
+
from nnlogging.options import (
|
|
7
|
+
BranchConfigOption,
|
|
8
|
+
LoggerConfigOption,
|
|
9
|
+
LogOptionDict,
|
|
10
|
+
RunConfigOption,
|
|
11
|
+
)
|
|
12
|
+
from nnlogging.typings.aliases import Branch
|
|
13
|
+
from nnlogging.typings.exts import Unpack
|
|
2
14
|
|
|
3
15
|
|
|
4
16
|
@runtime_checkable
|
|
@@ -12,3 +24,33 @@ class TerminalWritable(Protocol):
|
|
|
12
24
|
def write(self, text: str, /) -> int: ...
|
|
13
25
|
def flush(self) -> None: ...
|
|
14
26
|
def isatty(self) -> bool: ...
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
Sink: TypeAlias = Writable | TerminalWritable
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ExceptionProtocol(Protocol):
|
|
33
|
+
branches: dict[str, Branch]
|
|
34
|
+
|
|
35
|
+
def exception(
|
|
36
|
+
self, msg: str, /, *args: object, **kwargs: Unpack[LogOptionDict]
|
|
37
|
+
): ...
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ShellProtocol(ExceptionProtocol, Protocol):
|
|
41
|
+
name: str
|
|
42
|
+
logger: LoggingLogger | None
|
|
43
|
+
run: AimRun | None
|
|
44
|
+
branches: dict[str, Branch]
|
|
45
|
+
logger_config: LoggerConfigOption
|
|
46
|
+
run_config: RunConfigOption
|
|
47
|
+
branch_config: BranchConfigOption
|
|
48
|
+
strict: bool
|
|
49
|
+
|
|
50
|
+
def log(
|
|
51
|
+
self,
|
|
52
|
+
level: int,
|
|
53
|
+
msg: object,
|
|
54
|
+
*args: object,
|
|
55
|
+
**kwargs: Unpack[LogOptionDict],
|
|
56
|
+
): ...
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from collections.abc import Collection
|
|
3
|
+
from dataclasses import asdict
|
|
4
|
+
from logging import Formatter as LoggingFormatter
|
|
5
|
+
from sys import stderr
|
|
6
|
+
from typing import cast
|
|
7
|
+
|
|
8
|
+
from aim import Run as AimRun
|
|
9
|
+
from rich.console import Console as RichConsole
|
|
10
|
+
from rich.logging import RichHandler
|
|
11
|
+
from rich.progress import Progress as RichProgress, ProgressColumn as RichProgressColumn
|
|
12
|
+
|
|
13
|
+
from nnlogging.options import (
|
|
14
|
+
BranchConfigOptionDict,
|
|
15
|
+
LoggerConfigOption,
|
|
16
|
+
LoggerConfigOptionDict,
|
|
17
|
+
RichConsoleOption,
|
|
18
|
+
RichConsoleOptionDict,
|
|
19
|
+
RichHandlerOption,
|
|
20
|
+
RichHandlerOptionDict,
|
|
21
|
+
RichProgressOption,
|
|
22
|
+
RichProgressOptionDict,
|
|
23
|
+
RunConfigOption,
|
|
24
|
+
RunConfigOptionDict,
|
|
25
|
+
)
|
|
26
|
+
from nnlogging.typings.aliases import Branch
|
|
27
|
+
from nnlogging.typings.exts import Unpack
|
|
28
|
+
from nnlogging.typings.protocols import Sink
|
|
29
|
+
from nnlogging.utils.helpers import filter_by_typeddict
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def get_rich_console(
|
|
33
|
+
sink: Sink = stderr,
|
|
34
|
+
/,
|
|
35
|
+
**kwargs: Unpack[RichConsoleOptionDict],
|
|
36
|
+
):
|
|
37
|
+
options = asdict(RichConsoleOption(**kwargs))
|
|
38
|
+
console = RichConsole(
|
|
39
|
+
file=sink, # pyright: ignore[reportArgumentType],
|
|
40
|
+
**options,
|
|
41
|
+
)
|
|
42
|
+
return console
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def get_rich_handler(
|
|
46
|
+
console: RichConsole | None = None,
|
|
47
|
+
/,
|
|
48
|
+
**kwargs: Unpack[RichHandlerOptionDict],
|
|
49
|
+
):
|
|
50
|
+
options = asdict(RichHandlerOption(**kwargs))
|
|
51
|
+
log_message_format = cast(LoggingFormatter, options.pop("log_message_format"))
|
|
52
|
+
handler = RichHandler(
|
|
53
|
+
console=console or get_rich_console(),
|
|
54
|
+
**options,
|
|
55
|
+
)
|
|
56
|
+
handler.setFormatter(log_message_format)
|
|
57
|
+
return handler
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def get_rich_progress(
|
|
61
|
+
console: RichConsole | None = None,
|
|
62
|
+
/,
|
|
63
|
+
**kwargs: Unpack[RichProgressOptionDict],
|
|
64
|
+
):
|
|
65
|
+
options = asdict(RichProgressOption(**kwargs))
|
|
66
|
+
columns = cast(Collection[str | RichProgressColumn], options.pop("columns"))
|
|
67
|
+
progress = RichProgress(
|
|
68
|
+
*columns,
|
|
69
|
+
console=console,
|
|
70
|
+
**options,
|
|
71
|
+
)
|
|
72
|
+
return progress
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def get_logging_logger(
|
|
76
|
+
**kwargs: Unpack[LoggerConfigOptionDict],
|
|
77
|
+
):
|
|
78
|
+
options = asdict(LoggerConfigOption(**kwargs))
|
|
79
|
+
logger = logging.getLogger(options["name"])
|
|
80
|
+
logger.setLevel(options["level"])
|
|
81
|
+
logger.propagate = options["propagate"]
|
|
82
|
+
return logger
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def get_aim_run(
|
|
86
|
+
**kwargs: Unpack[RunConfigOptionDict],
|
|
87
|
+
):
|
|
88
|
+
options = asdict(RunConfigOption(**kwargs))
|
|
89
|
+
run = AimRun(**options)
|
|
90
|
+
return run
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def get_branch(
|
|
94
|
+
sink: Sink = stderr,
|
|
95
|
+
/,
|
|
96
|
+
**kwargs: Unpack[BranchConfigOptionDict],
|
|
97
|
+
):
|
|
98
|
+
console = get_rich_console(
|
|
99
|
+
sink,
|
|
100
|
+
**filter_by_typeddict(kwargs, RichConsoleOptionDict),
|
|
101
|
+
)
|
|
102
|
+
handler = get_rich_handler(
|
|
103
|
+
console,
|
|
104
|
+
**filter_by_typeddict(kwargs, RichHandlerOptionDict),
|
|
105
|
+
)
|
|
106
|
+
branch = Branch(
|
|
107
|
+
console=console,
|
|
108
|
+
handler=handler,
|
|
109
|
+
progress=None,
|
|
110
|
+
tasks=dict(),
|
|
111
|
+
)
|
|
112
|
+
return branch
|
nnlogging/utils/helpers.py
CHANGED
|
@@ -1,39 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
from
|
|
1
|
+
import threading
|
|
2
|
+
from collections.abc import Mapping
|
|
3
|
+
from typing import Any, TypeVar, cast
|
|
3
4
|
|
|
4
|
-
from nnlogging.
|
|
5
|
+
from nnlogging.options import (
|
|
6
|
+
LoggingLogOptionDict,
|
|
7
|
+
LogOptionDict,
|
|
8
|
+
RichConsoleOptionDict,
|
|
9
|
+
RichHandlerOptionDict,
|
|
10
|
+
RichPrintOptionDict,
|
|
11
|
+
RichProgressOptionDict,
|
|
12
|
+
)
|
|
5
13
|
|
|
6
14
|
|
|
7
|
-
def
|
|
8
|
-
|
|
9
|
-
default: T,
|
|
15
|
+
def get_name(
|
|
16
|
+
inst: object,
|
|
10
17
|
/,
|
|
11
|
-
) ->
|
|
12
|
-
return
|
|
18
|
+
) -> object:
|
|
19
|
+
return getattr(inst, "name", inst)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
LogOptionT = TypeVar(
|
|
23
|
+
"LogOptionT",
|
|
24
|
+
bound=LogOptionDict | LoggingLogOptionDict | dict[str, Any],
|
|
25
|
+
)
|
|
13
26
|
|
|
14
27
|
|
|
15
|
-
def
|
|
16
|
-
|
|
28
|
+
def inc_stacklevel(
|
|
29
|
+
dct: LogOptionT,
|
|
17
30
|
/,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return
|
|
31
|
+
) -> LogOptionT:
|
|
32
|
+
if "stacklevel" in dct:
|
|
33
|
+
dct["stacklevel"] = dct["stacklevel"] + 1
|
|
34
|
+
return dct
|
|
22
35
|
|
|
23
36
|
|
|
24
|
-
def
|
|
25
|
-
|
|
37
|
+
def inject_excinfo(
|
|
38
|
+
dct: LogOptionT,
|
|
39
|
+
e: BaseException | bool = True,
|
|
26
40
|
/,
|
|
27
|
-
):
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return
|
|
41
|
+
) -> LogOptionT:
|
|
42
|
+
if "exc_info" not in dct:
|
|
43
|
+
dct["exc_info"] = e
|
|
44
|
+
return dct
|
|
31
45
|
|
|
32
46
|
|
|
33
|
-
|
|
34
|
-
|
|
47
|
+
TypedDictT = TypeVar(
|
|
48
|
+
"TypedDictT",
|
|
49
|
+
bound=RichConsoleOptionDict
|
|
50
|
+
| RichHandlerOptionDict
|
|
51
|
+
| RichProgressOptionDict
|
|
52
|
+
| LoggingLogOptionDict
|
|
53
|
+
| RichPrintOptionDict,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def filter_by_typeddict(
|
|
58
|
+
dct: Mapping[str, object],
|
|
35
59
|
/,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return
|
|
60
|
+
typpeddict: type[TypedDictT],
|
|
61
|
+
) -> TypedDictT:
|
|
62
|
+
keys = typpeddict.__annotations__.keys()
|
|
63
|
+
return cast(TypedDictT, {k: v for k, v in dct.items() if k in keys}) # pyright: ignore[reportInvalidCast]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def with_lock(lock: threading.Lock):
|
|
67
|
+
def decorator(f):
|
|
68
|
+
def wrapper(*args, **kwargs):
|
|
69
|
+
with lock:
|
|
70
|
+
return f(*args, **kwargs)
|
|
71
|
+
|
|
72
|
+
return wrapper
|
|
73
|
+
|
|
74
|
+
return decorator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nnlogging
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: A powerful and elegant logging library designed specifically for neural network and machine learning experiments. nnlogging seamlessly integrates [Rich](https://github.com/Textualize/rich) for beautiful terminal output and [Aim](https://github.com/aimhubio/aim) for comprehensive experiment tracking.
|
|
5
5
|
Requires-Python: <3.13,>=3.10
|
|
6
6
|
Requires-Dist: aim>=3.29.0
|
|
@@ -29,8 +29,8 @@ library for neural network and machine learning experiments, combining
|
|
|
29
29
|
integrated progress bars.
|
|
30
30
|
- 📊 **Effortless Experiment Tracking** - Seamless Aim integration for metrics,
|
|
31
31
|
parameters, and system monitoring.
|
|
32
|
-
- 🔧 **Simplified API** - Get started in
|
|
33
|
-
|
|
32
|
+
- 🔧 **Simplified API** - Get started in one line of code with the global
|
|
33
|
+
functions.
|
|
34
34
|
- 📈 **Advanced Progress Tracking** - Manage multiple progress bars for
|
|
35
35
|
training, validation, and other tasks.
|
|
36
36
|
- 🎯 **ML-Focused Design** - Purpose-built for the machine learning workflow.
|
|
@@ -55,16 +55,13 @@ Get the global shell or customize your shell from scratch to use logging methods
|
|
|
55
55
|
and trackings.
|
|
56
56
|
|
|
57
57
|
```python
|
|
58
|
-
|
|
58
|
+
import nnlogging
|
|
59
59
|
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
shell.warn("Learning rate seems high.")
|
|
66
|
-
shell.debug("This is a detailed debug message.")
|
|
67
|
-
shell.error("CUDA out of memory.", extra={"show_locals": True})
|
|
60
|
+
# Log messages!
|
|
61
|
+
nnlogging.info("Starting training...")
|
|
62
|
+
nnlogging.warn("Learning rate seems high.")
|
|
63
|
+
nnlogging.debug("This is a detailed debug message.")
|
|
64
|
+
nnlogging.error("CUDA out of memory.", extra={"show_locals": True})
|
|
68
65
|
```
|
|
69
66
|
|
|
70
67
|
### Experiment Tracking with Aim
|
|
@@ -73,12 +70,10 @@ Configure the Aim run to track metrics, hyperparameters, and more.
|
|
|
73
70
|
|
|
74
71
|
```python
|
|
75
72
|
import random
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
shell = get_global_shell()
|
|
73
|
+
import nnlogging
|
|
79
74
|
|
|
80
75
|
# 1. Configure the experiment tracker
|
|
81
|
-
|
|
76
|
+
nnlogging.run_configure(
|
|
82
77
|
experiment="resnet_training",
|
|
83
78
|
log_system_params=True, # Track CPU/GPU usage
|
|
84
79
|
capture_terminal_logs=True # Save console output in Aim
|
|
@@ -86,16 +81,16 @@ shell.run_configure(
|
|
|
86
81
|
|
|
87
82
|
# 2. Log hyperparameters
|
|
88
83
|
config = {"lr": 0.001, "batch_size": 32, "model": "ResNet50"}
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
nnlogging.update_metadata("hparams", config)
|
|
85
|
+
nnlogging.info(f"Using config: {config}")
|
|
91
86
|
|
|
92
87
|
# 3. Track metrics in your training loop
|
|
93
88
|
for epoch in range(10):
|
|
94
89
|
train_loss = 1.0 / (epoch + 1) + random.random() * 0.1
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
nnlogging.track(train_loss, name="train_loss", epoch=epoch)
|
|
91
|
+
nnlogging.info(f"Epoch {epoch}: Loss={train_loss:.4f}")
|
|
97
92
|
|
|
98
|
-
|
|
93
|
+
nnlogging.info("Experiment finished!")
|
|
99
94
|
```
|
|
100
95
|
|
|
101
96
|
To view the results, run `aim up` in your terminal.
|
|
@@ -106,34 +101,32 @@ Add tasks to the logger to display and update rich progress bars.
|
|
|
106
101
|
|
|
107
102
|
```python
|
|
108
103
|
import time
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
shell = get_global_shell()
|
|
104
|
+
import nnlogging
|
|
112
105
|
|
|
113
106
|
# 1. Add a task to the progress display
|
|
114
|
-
|
|
107
|
+
nnlogging.task_add("training", desc="Training", total=500)
|
|
115
108
|
|
|
116
109
|
# 2. Update the task during your training loop
|
|
117
110
|
for step in range(500):
|
|
118
111
|
# training_step()
|
|
119
112
|
time.sleep(0.01)
|
|
120
|
-
|
|
113
|
+
nnlogging.advance("training", 1)
|
|
121
114
|
|
|
122
115
|
if step % 100 == 0:
|
|
123
|
-
|
|
116
|
+
nnlogging.info(f"Completed step {step}")
|
|
124
117
|
|
|
125
118
|
# 3. Remove the task when finished
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
nnlogging.task_remove("training")
|
|
120
|
+
nnlogging.info("Training complete!")
|
|
128
121
|
```
|
|
129
122
|
|
|
130
123
|
## 🔄 Workflow
|
|
131
124
|
|
|
132
|
-
1.
|
|
125
|
+
1. **Import `nnlogging`** - Import the `nnlogging` library at the start of your
|
|
133
126
|
script.
|
|
134
127
|
2. **`run_configure()`** - (Optional) Configure Aim for experiment tracking.
|
|
135
|
-
3. **Log & Track** - Use `
|
|
136
|
-
throughout your code.
|
|
128
|
+
3. **Log & Track** - Use `nnlogging.info()`, `nnlogging.track()`, and
|
|
129
|
+
`nnlogging.advance()` throughout your code.
|
|
137
130
|
4. **Visualize** - Run `aim up` to launch the Aim UI and analyze your results.
|
|
138
131
|
|
|
139
132
|
## 🤝 Contributing
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
nnlogging/__init__.py,sha256=LxZc3hpo_z0rH7yWRU3GAVMhVUc_-EQKeFG-msPzJxY,69
|
|
2
|
+
nnlogging/global_.py,sha256=L6tOsKIWxglceEyYf9b0yTWWaaVgwbrdvxUK_ZZkraw,5704
|
|
3
|
+
nnlogging/shell.py,sha256=RIbHbm28_f_3mqtUO4AU-901eeMeEKkxUqDFqvuD_Ms,5481
|
|
4
|
+
nnlogging/exceptions/__init__.py,sha256=Wz5SOYX7zZObWV3KRvFA2JsxixIjgO8eW-zfwlMnt0o,533
|
|
5
|
+
nnlogging/exceptions/branch_exists.py,sha256=NnwHDBMBG2b8BtQvda-cSGwXFffnnEolCYmFbd90sl8,709
|
|
6
|
+
nnlogging/exceptions/branch_not_found.py,sha256=ragJ0Z8m4_HUvCz-092-owNFK9aYXOwixhLPFAHHxGM,706
|
|
7
|
+
nnlogging/exceptions/task_exists.py,sha256=VBmBFJtFVnzQStZDP1ApISM6YUa1RTeYYPSaVZJdb24,781
|
|
8
|
+
nnlogging/exceptions/task_not_found.py,sha256=GJKC9fOnulVV1SghMnI68n2dlgBp5ypjLuQunrxUulE,696
|
|
9
|
+
nnlogging/options/__init__.py,sha256=ItPUHN7dJvVEfaTbRTIafPYyvWpK5nE6VfcZWei78H4,1092
|
|
10
|
+
nnlogging/options/branch_config.py,sha256=KnvtUuGda1qoAtgntS1JCdRu8sske5wLx-jZZXFSmkE,592
|
|
11
|
+
nnlogging/options/log_option.py,sha256=gvmOhIXgic_DRwdnNz10YzfGF3HLZNhBX_OsUOvk-t8,814
|
|
12
|
+
nnlogging/options/logger_config.py,sha256=5y2WxYnNt1jxWnkKOVaUHl8a4z9lEzG-p9vw3D15F8c,386
|
|
13
|
+
nnlogging/options/rich_console.py,sha256=HbgbZgoQIL15sKunQCPc012MS_QC2EOwu5gQotL3LiE,1420
|
|
14
|
+
nnlogging/options/rich_handler.py,sha256=JR65KUtRJa02FpESraIHysX30GG89GLD6vIs_nnp7xk,1643
|
|
15
|
+
nnlogging/options/rich_progress.py,sha256=ztM7zNY6y6tPmFz6BVWqympk6lQ5sQmnMJvWFWeZUqs,1675
|
|
16
|
+
nnlogging/options/run_config.py,sha256=YEtGS5oQP5wDcYKv6egL1dKfpVjlV0d3H4qAYVlbhPY,842
|
|
17
|
+
nnlogging/options/task_option.py,sha256=pPppAfbdz3OjsHGywKLIgTWHP9vzfvE6vCxh_J7oWeI,412
|
|
18
|
+
nnlogging/options/track_option.py,sha256=TNsno3dX5fyW4S-CkgtS5UXKwIgm4mCMSlKCUTZqtxE,454
|
|
19
|
+
nnlogging/shell_funcs/__init__.py,sha256=dtahWAUZLdGnFr2XmWGJ9kAr6XYVaOo7b_ckktvN1Fg,87
|
|
20
|
+
nnlogging/shell_funcs/branch_.py,sha256=XV66VbAeEOisX2JbyiT0wbK7oQ-binLetDhgxVNB7zo,1978
|
|
21
|
+
nnlogging/shell_funcs/logger_.py,sha256=t3WGU7Lcrg9dZM4MOH6K0h5PiwIcZhCEtiP3RIUPm8k,4064
|
|
22
|
+
nnlogging/shell_funcs/run_.py,sha256=SN52ub-TXwJFg4CUPcwjD0PhITDXxVQHsUCF58NYxSo,1556
|
|
23
|
+
nnlogging/shell_funcs/task_.py,sha256=IpcuWVWArq2ZnygbIOatNOFjkTyUapz4q_QSQsMhhpc,3209
|
|
24
|
+
nnlogging/typings/aliases.py,sha256=hnT-Zd9JBDR3-RbqI0RmH8ZtoIqhPsp_k_0qYscMhDM,563
|
|
25
|
+
nnlogging/typings/exts.py,sha256=lcLkliPdtkaFl0NrzacDkpaeXV4b99lKWAZvZzpuSxw,271
|
|
26
|
+
nnlogging/typings/protocols.py,sha256=fzgZoBa2uvEPZvJjP0t4hkSLCST69KczbOqFVTf4M1c,1282
|
|
27
|
+
nnlogging/utils/factories.py,sha256=PLtNL_RRiW4TiYTtyuWYXQe4rOXleyfiabUc63wNc8Q,2857
|
|
28
|
+
nnlogging/utils/helpers.py,sha256=ct40BUt0jb7pgMQxzw_cFuE0BFs5LIbNZjG25G_k8yY,1485
|
|
29
|
+
nnlogging-0.1.4.dist-info/METADATA,sha256=wj6NSy9OAxiN5rMRRhzBZpmWmifwl7pDCmqnQfL7L0c,4427
|
|
30
|
+
nnlogging-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
31
|
+
nnlogging-0.1.4.dist-info/RECORD,,
|
nnlogging/shell_protocol.py
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
from logging import Logger as LoggingLogger
|
|
2
|
-
from typing import Protocol, runtime_checkable
|
|
3
|
-
|
|
4
|
-
from aim import Run as AimRun
|
|
5
|
-
from aim.sdk.types import AimObject
|
|
6
|
-
|
|
7
|
-
from nnlogging.typings import Branch, LogOptions
|
|
8
|
-
from nnlogging.utils.factory_funcs.shell_ import BranchConfig, LoggerConfig, RunConfig
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
@runtime_checkable
|
|
12
|
-
class ShellProtocol(Protocol):
|
|
13
|
-
logger_config: LoggerConfig
|
|
14
|
-
run_config: RunConfig
|
|
15
|
-
branch_config: BranchConfig
|
|
16
|
-
logger: LoggingLogger | None
|
|
17
|
-
run: AimRun | None
|
|
18
|
-
branches: dict[str, Branch]
|
|
19
|
-
|
|
20
|
-
def logger_configure(
|
|
21
|
-
self,
|
|
22
|
-
config: LoggerConfig | None,
|
|
23
|
-
/,
|
|
24
|
-
): ...
|
|
25
|
-
def run_configure(
|
|
26
|
-
self,
|
|
27
|
-
conf: RunConfig | None,
|
|
28
|
-
/,
|
|
29
|
-
): ...
|
|
30
|
-
def branch_configure(
|
|
31
|
-
self,
|
|
32
|
-
conf: BranchConfig | None,
|
|
33
|
-
/,
|
|
34
|
-
): ...
|
|
35
|
-
def branch_add(
|
|
36
|
-
self,
|
|
37
|
-
name: str,
|
|
38
|
-
/,
|
|
39
|
-
): ...
|
|
40
|
-
def branch_remove(
|
|
41
|
-
self,
|
|
42
|
-
name: str,
|
|
43
|
-
/,
|
|
44
|
-
): ...
|
|
45
|
-
def task_add(
|
|
46
|
-
self,
|
|
47
|
-
name: str,
|
|
48
|
-
/,
|
|
49
|
-
*,
|
|
50
|
-
desc: str,
|
|
51
|
-
total: float | None,
|
|
52
|
-
): ...
|
|
53
|
-
def task_remove(
|
|
54
|
-
self,
|
|
55
|
-
name: str,
|
|
56
|
-
/,
|
|
57
|
-
): ...
|
|
58
|
-
def log(
|
|
59
|
-
self,
|
|
60
|
-
level: int,
|
|
61
|
-
msg: object,
|
|
62
|
-
/,
|
|
63
|
-
): ...
|
|
64
|
-
def exception(
|
|
65
|
-
self,
|
|
66
|
-
msg: object,
|
|
67
|
-
/,
|
|
68
|
-
*,
|
|
69
|
-
log_options: LogOptions | None = None,
|
|
70
|
-
): ...
|
|
71
|
-
def advance(
|
|
72
|
-
self,
|
|
73
|
-
name: str,
|
|
74
|
-
/,
|
|
75
|
-
value: float,
|
|
76
|
-
): ...
|
|
77
|
-
def track(
|
|
78
|
-
self,
|
|
79
|
-
value: object,
|
|
80
|
-
/,
|
|
81
|
-
name: str | None,
|
|
82
|
-
*,
|
|
83
|
-
step: int | None,
|
|
84
|
-
epoch: int | None,
|
|
85
|
-
context: AimObject,
|
|
86
|
-
): ...
|
nnlogging/typings/__init__.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
from .aliases import (
|
|
2
|
-
Branch,
|
|
3
|
-
ConsolePrintOptions,
|
|
4
|
-
ExcInfo,
|
|
5
|
-
FormatTimeCallable,
|
|
6
|
-
GenericPath,
|
|
7
|
-
LogOptions,
|
|
8
|
-
Sink,
|
|
9
|
-
)
|
|
10
|
-
from .exceptions import (
|
|
11
|
-
BranchExistsError,
|
|
12
|
-
BranchNotFoundError,
|
|
13
|
-
TaskExistsError,
|
|
14
|
-
TaskNotFoundError,
|
|
15
|
-
)
|
|
16
|
-
from .generics import DataclassT, Omitable, Pathlike, T
|
|
17
|
-
from .protocols import TerminalWritable, Writable
|
|
18
|
-
|
|
19
|
-
__all__ = [
|
|
20
|
-
# aliases
|
|
21
|
-
"Branch",
|
|
22
|
-
"Sink",
|
|
23
|
-
"GenericPath",
|
|
24
|
-
"FormatTimeCallable",
|
|
25
|
-
"ExcInfo",
|
|
26
|
-
"ConsolePrintOptions",
|
|
27
|
-
"LogOptions",
|
|
28
|
-
# generics
|
|
29
|
-
"T",
|
|
30
|
-
"DataclassT",
|
|
31
|
-
"Omitable",
|
|
32
|
-
"Pathlike",
|
|
33
|
-
# protocols
|
|
34
|
-
"Writable",
|
|
35
|
-
"TerminalWritable",
|
|
36
|
-
# exception
|
|
37
|
-
"BranchNotFoundError",
|
|
38
|
-
"BranchExistsError",
|
|
39
|
-
"TaskExistsError",
|
|
40
|
-
"TaskNotFoundError",
|
|
41
|
-
]
|
nnlogging/typings/exceptions.py
DELETED
nnlogging/typings/generics.py
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from dataclasses import Field
|
|
3
|
-
from os import PathLike
|
|
4
|
-
from types import EllipsisType
|
|
5
|
-
from typing import Any, ClassVar, Protocol, TypeVar
|
|
6
|
-
|
|
7
|
-
if sys.version_info >= (3, 12):
|
|
8
|
-
from typing import TypeAliasType
|
|
9
|
-
else:
|
|
10
|
-
from typing_extensions import TypeAliasType
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class DataclassInstance(Protocol):
|
|
14
|
-
__dataclass_fields__: ClassVar[dict[str, Field[Any]]] # pyright: ignore[reportExplicitAny]
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
T = TypeVar("T")
|
|
18
|
-
PathT = TypeVar("PathT", str, bytes)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Omitable = TypeAliasType("Omitable", T | EllipsisType, type_params=(T,))
|
|
22
|
-
DataclassT = TypeVar("DataclassT", bound=DataclassInstance)
|
|
23
|
-
Pathlike = TypeAliasType("Pathlike", PathT | PathLike[PathT], type_params=(PathT,))
|
nnlogging/utils/__init__.py
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
``nnlogging.utils``
|
|
3
|
-
"""
|
|
4
|
-
|
|
5
|
-
from .exception import (
|
|
6
|
-
raise_branch_exists_error,
|
|
7
|
-
raise_branch_not_found_error,
|
|
8
|
-
raise_task_exists_error,
|
|
9
|
-
raise_task_not_found_error,
|
|
10
|
-
)
|
|
11
|
-
from .factory_funcs.rich_ import (
|
|
12
|
-
get_rich_console,
|
|
13
|
-
get_rich_handler,
|
|
14
|
-
get_rich_progress,
|
|
15
|
-
get_rich_progress_default_columns,
|
|
16
|
-
)
|
|
17
|
-
from .factory_funcs.shell_ import (
|
|
18
|
-
BranchConfig,
|
|
19
|
-
LoggerConfig,
|
|
20
|
-
RunConfig,
|
|
21
|
-
get_aim_run,
|
|
22
|
-
get_branch,
|
|
23
|
-
get_logging_logger,
|
|
24
|
-
)
|
|
25
|
-
from .helpers import evolve_, get__debugging, get_name, or_
|
|
26
|
-
from .shell_funcs.branch_ import branch_add, branch_configure, branch_remove
|
|
27
|
-
from .shell_funcs.logger_ import (
|
|
28
|
-
critical,
|
|
29
|
-
debug,
|
|
30
|
-
error,
|
|
31
|
-
exception,
|
|
32
|
-
info,
|
|
33
|
-
log,
|
|
34
|
-
logger_configure,
|
|
35
|
-
warn,
|
|
36
|
-
)
|
|
37
|
-
from .shell_funcs.run_ import add_tag, remove_tag, run_configure, track, update_metadata
|
|
38
|
-
from .shell_funcs.task_ import advance, task_add, task_remove
|
|
39
|
-
|
|
40
|
-
__all__ = [
|
|
41
|
-
# helper
|
|
42
|
-
"evolve_",
|
|
43
|
-
"or_",
|
|
44
|
-
"get__debugging",
|
|
45
|
-
"get_name",
|
|
46
|
-
# rich factory
|
|
47
|
-
"get_rich_console",
|
|
48
|
-
"get_rich_handler",
|
|
49
|
-
"get_rich_progress",
|
|
50
|
-
"get_rich_progress_default_columns",
|
|
51
|
-
# shell factory
|
|
52
|
-
"LoggerConfig",
|
|
53
|
-
"get_logging_logger",
|
|
54
|
-
"RunConfig",
|
|
55
|
-
"get_aim_run",
|
|
56
|
-
"BranchConfig",
|
|
57
|
-
"get_branch",
|
|
58
|
-
# shell func
|
|
59
|
-
"branch_add",
|
|
60
|
-
"branch_configure",
|
|
61
|
-
"branch_remove",
|
|
62
|
-
"critical",
|
|
63
|
-
"debug",
|
|
64
|
-
"error",
|
|
65
|
-
"exception",
|
|
66
|
-
"info",
|
|
67
|
-
"log",
|
|
68
|
-
"logger_configure",
|
|
69
|
-
"warn",
|
|
70
|
-
"add_tag",
|
|
71
|
-
"remove_tag",
|
|
72
|
-
"run_configure",
|
|
73
|
-
"track",
|
|
74
|
-
"update_metadata",
|
|
75
|
-
"advance",
|
|
76
|
-
"task_add",
|
|
77
|
-
"task_remove",
|
|
78
|
-
# exception
|
|
79
|
-
"raise_branch_exists_error",
|
|
80
|
-
"raise_branch_not_found_error",
|
|
81
|
-
"raise_task_exists_error",
|
|
82
|
-
"raise_task_not_found_error",
|
|
83
|
-
]
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
from .branch_exists import raise_branch_exists_error
|
|
2
|
-
from .branch_not_found import raise_branch_not_found_error
|
|
3
|
-
from .task_exists import raise_task_exists_error
|
|
4
|
-
from .task_not_found import raise_task_not_found_error
|
|
5
|
-
|
|
6
|
-
__all__ = [
|
|
7
|
-
"raise_branch_exists_error",
|
|
8
|
-
"raise_branch_not_found_error",
|
|
9
|
-
"raise_task_exists_error",
|
|
10
|
-
"raise_task_not_found_error",
|
|
11
|
-
]
|