flexlock 0.8.2__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.
flexlock/__init__.py ADDED
@@ -0,0 +1,87 @@
1
+ """FlexLock: A lightweight library for reproducible ML experiments."""
2
+
3
+ __version__ = "0.8.2"
4
+
5
+ from loguru import logger
6
+
7
+ logger.disable("flexlock")
8
+
9
+ from .flexcli import flexcli
10
+ from .snapshot import snapshot
11
+ from .mlflow import mlflow_context
12
+ from .debug import debug_on_fail
13
+ from .resolvers import register_resolvers
14
+ from .api import Project
15
+
16
+
17
+ def submit(config=None, **kwargs):
18
+ """Submit a configuration without instantiating a :class:`Project`.
19
+
20
+ Sugar over ``Project().submit(config, **kwargs)`` — use when you have a
21
+ ready ``DictConfig`` and don't need the multi-stage pipeline plumbing
22
+ (``proj.get``, ``proj.defaults``, etc.). All ``Project.submit`` kwargs
23
+ (``sweep``, ``slurm_config``, ``smart_run``, ``overrides``, …) are
24
+ forwarded as-is.
25
+
26
+ Example::
27
+
28
+ from flexlock import submit, py2cfg
29
+ cfg = py2cfg(train, lr=0.01, save_dir='outputs/train')
30
+ result = submit(cfg, slurm_config='configs/slurm_gpu.yaml')
31
+ """
32
+ return Project().submit(config, **kwargs)
33
+ from .utils import (
34
+ py2cfg,
35
+ load_python_defaults,
36
+ extract_tracking_info,
37
+ load_sweep,
38
+ enqueue_to_file,
39
+ log_to_file,
40
+ parse_sweep_string,
41
+ select_and_freeze_root_refs,
42
+ )
43
+ from .runner import FlexLockRunner
44
+ from .data_hash import hash_data
45
+ from .git_utils import get_git_tree_hash
46
+
47
+ # Import exceptions for public API
48
+ from .exceptions import (
49
+ FlexLockError,
50
+ FlexLockConfigError,
51
+ FlexLockExecutionError,
52
+ FlexLockSnapshotError,
53
+ FlexLockValidationError,
54
+ FlexLockCacheError,
55
+ FlexLockBackendError,
56
+ )
57
+
58
+ # Register OmegaConf resolvers when the library is imported
59
+ register_resolvers()
60
+
61
+ __all__ = [
62
+ "__version__",
63
+ "flexcli",
64
+ "snapshot",
65
+ "mlflow_context",
66
+ "debug_on_fail",
67
+ "Project",
68
+ "submit",
69
+ "py2cfg",
70
+ "load_python_defaults",
71
+ "load_sweep",
72
+ "enqueue_to_file",
73
+ "log_to_file",
74
+ "parse_sweep_string",
75
+ "select_and_freeze_root_refs",
76
+ "FlexLockRunner",
77
+ "hash_data",
78
+ "get_git_tree_hash",
79
+ # Exceptions
80
+ "FlexLockError",
81
+ "FlexLockConfigError",
82
+ "FlexLockExecutionError",
83
+ "FlexLockSnapshotError",
84
+ "FlexLockValidationError",
85
+ "FlexLockCacheError",
86
+ "FlexLockBackendError",
87
+ ]