cortex-training 0.0.3__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.
- cortex_training/__init__.py +49 -0
- cortex_training/__main__.py +20 -0
- cortex_training/_cli.py +1050 -0
- cortex_training/cli.py +103 -0
- cortex_training/client.py +2866 -0
- cortex_training/peft.py +112 -0
- cortex_training/telemetry.py +526 -0
- cortex_training/tui/__init__.py +23 -0
- cortex_training/tui/__main__.py +109 -0
- cortex_training/tui/app.py +646 -0
- cortex_training/tui/format.py +389 -0
- cortex_training/tui/log_cache.py +415 -0
- cortex_training/wire.py +414 -0
- cortex_training-0.0.3.dist-info/METADATA +143 -0
- cortex_training-0.0.3.dist-info/RECORD +19 -0
- cortex_training-0.0.3.dist-info/WHEEL +5 -0
- cortex_training-0.0.3.dist-info/entry_points.txt +3 -0
- cortex_training-0.0.3.dist-info/licenses/LICENSE +177 -0
- cortex_training-0.0.3.dist-info/top_level.txt +1 -0
cortex_training/cli.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Copyright 2025 Snowflake Inc.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
16
|
+
"""Public ``cortex-training`` command entry point."""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import sys
|
|
21
|
+
from typing import Any
|
|
22
|
+
from typing import Callable
|
|
23
|
+
from typing import TextIO
|
|
24
|
+
|
|
25
|
+
import cortex_training._cli as _implementation
|
|
26
|
+
from cortex_training.tui.__main__ import run as _run_tui
|
|
27
|
+
|
|
28
|
+
_TUI_FLAG_OPTIONS = {"--no-verify-ssl"}
|
|
29
|
+
_TUI_VALUE_OPTIONS = {
|
|
30
|
+
"--config",
|
|
31
|
+
"--base-url",
|
|
32
|
+
"--host",
|
|
33
|
+
"--pat",
|
|
34
|
+
"--database",
|
|
35
|
+
"--schema",
|
|
36
|
+
"--endpoint",
|
|
37
|
+
"--poll-interval",
|
|
38
|
+
"--poll-timeout",
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _tui_argv(argv: list[str]) -> list[str] | None:
|
|
43
|
+
prefix = []
|
|
44
|
+
index = 0
|
|
45
|
+
while index < len(argv):
|
|
46
|
+
argument = argv[index]
|
|
47
|
+
if argument == "tui":
|
|
48
|
+
return prefix + argv[index + 1 :]
|
|
49
|
+
if argument in _TUI_FLAG_OPTIONS:
|
|
50
|
+
prefix.append(argument)
|
|
51
|
+
index += 1
|
|
52
|
+
continue
|
|
53
|
+
if argument in _TUI_VALUE_OPTIONS:
|
|
54
|
+
if index + 1 >= len(argv):
|
|
55
|
+
return None
|
|
56
|
+
prefix.extend(argv[index : index + 2])
|
|
57
|
+
index += 2
|
|
58
|
+
continue
|
|
59
|
+
if any(argument.startswith(option + "=") for option in _TUI_VALUE_OPTIONS):
|
|
60
|
+
prefix.append(argument)
|
|
61
|
+
index += 1
|
|
62
|
+
continue
|
|
63
|
+
return None
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def build_parser():
|
|
68
|
+
return _implementation.build_parser(prog="cortex-training", include_tui=True)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def parse_args(argv: list[str] | None = None):
|
|
72
|
+
return _implementation.parse_args(
|
|
73
|
+
argv,
|
|
74
|
+
prog="cortex-training",
|
|
75
|
+
include_tui=True,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def main(
|
|
80
|
+
argv: list[str] | None = None,
|
|
81
|
+
*,
|
|
82
|
+
client_factory: Callable[[Any], Any] | None = None,
|
|
83
|
+
stdout: TextIO | None = None,
|
|
84
|
+
stderr: TextIO | None = None,
|
|
85
|
+
stdin: TextIO | None = None,
|
|
86
|
+
) -> int:
|
|
87
|
+
effective_argv = list(sys.argv[1:] if argv is None else argv)
|
|
88
|
+
tui_argv = _tui_argv(effective_argv)
|
|
89
|
+
if tui_argv is not None:
|
|
90
|
+
return _run_tui(tui_argv, prog="cortex-training tui")
|
|
91
|
+
return _implementation.main(
|
|
92
|
+
effective_argv,
|
|
93
|
+
prog="cortex-training",
|
|
94
|
+
include_tui=True,
|
|
95
|
+
client_factory=client_factory,
|
|
96
|
+
stdout=stdout,
|
|
97
|
+
stderr=stderr,
|
|
98
|
+
stdin=stdin,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
if __name__ == "__main__":
|
|
103
|
+
raise SystemExit(main())
|