mostlyai 4.2.1__tar.gz → 4.2.3__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.
- {mostlyai-4.2.1 → mostlyai-4.2.3}/PKG-INFO +20 -8
- {mostlyai-4.2.1 → mostlyai-4.2.3}/README.md +1 -1
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/__init__.py +1 -1
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_create_data_report.py +1 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_deliver_data.py +1 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/generators.py +1 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/server.py +3 -4
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/synthetic_datasets.py +1 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/client/_utils.py +74 -6
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/client/api.py +29 -11
- {mostlyai-4.2.1 → mostlyai-4.2.3}/pyproject.toml +22 -8
- {mostlyai-4.2.1 → mostlyai-4.2.3}/.gitignore +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/LICENSE +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/__init__.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/auto_detect.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/base.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/context.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/conversions.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/__init__.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/base.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/bigquery.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/databricks.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/hive.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/mssql.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/mysql.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/oracle.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/postgresql.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/snowflake.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/sqlite.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/dtype.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/exceptions.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/__init__.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/base.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/container/aws.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/container/azure.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/container/minio.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/table/csv.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/table/feather.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/table/json.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/file/utils.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/language_model.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/metadata_objects.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/non_context.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/progress_callback.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/pull.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/pull_context.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/pull_utils.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/push.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/util/__init__.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/util/common.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_data/util/kerberos.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/__init__.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/cli.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/connectors.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/__init__.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/jobs.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/plan.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/progress.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/routes.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/storage.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/client/__init__.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/client/_base_utils.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/client/_naming_conventions.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/client/base.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/client/connectors.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/client/exceptions.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/client/generators.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
- {mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/domain.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mostlyai
|
|
3
|
-
Version: 4.2.
|
|
3
|
+
Version: 4.2.3
|
|
4
4
|
Summary: Synthetic Data SDK
|
|
5
5
|
Project-URL: homepage, https://app.mostly.ai/
|
|
6
6
|
Project-URL: repository, https://github.com/mostly-ai/mostlyai
|
|
@@ -24,12 +24,8 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
24
24
|
Classifier: Topic :: Software Development :: Libraries
|
|
25
25
|
Classifier: Typing :: Typed
|
|
26
26
|
Requires-Python: <3.14,>=3.10
|
|
27
|
-
Requires-Dist: adlfs>=2023.4.0
|
|
28
|
-
Requires-Dist: azure-storage-blob>=12.16.0
|
|
29
|
-
Requires-Dist: cloudpathlib[azure,gs,s3]>=0.17.0
|
|
30
27
|
Requires-Dist: environs>=9.5.0
|
|
31
28
|
Requires-Dist: filelock>=3.16.1
|
|
32
|
-
Requires-Dist: gcsfs>=2023.1.0
|
|
33
29
|
Requires-Dist: greenlet<4,>=3.1.1
|
|
34
30
|
Requires-Dist: gunicorn>=23.0.0
|
|
35
31
|
Requires-Dist: httpx>=0.25.0
|
|
@@ -44,11 +40,9 @@ Requires-Dist: pycryptodomex<4,>=3.10.0
|
|
|
44
40
|
Requires-Dist: pydantic<3,>=2.4.2
|
|
45
41
|
Requires-Dist: requests>=2.31.0
|
|
46
42
|
Requires-Dist: rich>=13.7.0
|
|
47
|
-
Requires-Dist: s3fs>=2023.1.0
|
|
48
43
|
Requires-Dist: schema>=0.7.5
|
|
49
44
|
Requires-Dist: semantic-version>=2.10.0
|
|
50
45
|
Requires-Dist: smart-open>=6.0.0
|
|
51
|
-
Requires-Dist: smart-open[azure,gcs,s3]>=6.3.0
|
|
52
46
|
Requires-Dist: sqlalchemy>=2.0.0
|
|
53
47
|
Requires-Dist: sshtunnel<0.5,>=0.4.0
|
|
54
48
|
Requires-Dist: typer>=0.9.0
|
|
@@ -63,25 +57,43 @@ Requires-Dist: impyla<0.20,>=0.19.0; extra == 'hive'
|
|
|
63
57
|
Requires-Dist: kerberos<2,>=1.3.1; extra == 'hive'
|
|
64
58
|
Requires-Dist: pyhive[hive-pure-sasl]<0.8,>=0.7.0; extra == 'hive'
|
|
65
59
|
Provides-Extra: local
|
|
60
|
+
Requires-Dist: adlfs>=2023.4.0; extra == 'local'
|
|
61
|
+
Requires-Dist: azure-storage-blob>=12.16.0; extra == 'local'
|
|
62
|
+
Requires-Dist: cloudpathlib[azure,gs,s3]>=0.17.0; extra == 'local'
|
|
66
63
|
Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local'
|
|
64
|
+
Requires-Dist: gcsfs>=2023.1.0; extra == 'local'
|
|
67
65
|
Requires-Dist: mostlyai-engine==1.1.4; extra == 'local'
|
|
68
66
|
Requires-Dist: mostlyai-qa==1.5.5; extra == 'local'
|
|
69
67
|
Requires-Dist: python-multipart>=0.0.20; extra == 'local'
|
|
68
|
+
Requires-Dist: s3fs>=2023.1.0; extra == 'local'
|
|
69
|
+
Requires-Dist: smart-open[azure,gcs,s3]>=6.3.0; extra == 'local'
|
|
70
70
|
Requires-Dist: torch<2.6.0,>=2.5.1; extra == 'local'
|
|
71
71
|
Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local'
|
|
72
72
|
Provides-Extra: local-cpu
|
|
73
|
+
Requires-Dist: adlfs>=2023.4.0; extra == 'local-cpu'
|
|
74
|
+
Requires-Dist: azure-storage-blob>=12.16.0; extra == 'local-cpu'
|
|
75
|
+
Requires-Dist: cloudpathlib[azure,gs,s3]>=0.17.0; extra == 'local-cpu'
|
|
73
76
|
Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-cpu'
|
|
77
|
+
Requires-Dist: gcsfs>=2023.1.0; extra == 'local-cpu'
|
|
74
78
|
Requires-Dist: mostlyai-engine[cpu]==1.1.4; extra == 'local-cpu'
|
|
75
79
|
Requires-Dist: mostlyai-qa[cpu]==1.5.5; extra == 'local-cpu'
|
|
76
80
|
Requires-Dist: python-multipart>=0.0.20; extra == 'local-cpu'
|
|
81
|
+
Requires-Dist: s3fs>=2023.1.0; extra == 'local-cpu'
|
|
82
|
+
Requires-Dist: smart-open[azure,gcs,s3]>=6.3.0; extra == 'local-cpu'
|
|
77
83
|
Requires-Dist: torch<2.6.0,>=2.5.1; (sys_platform != 'linux') and extra == 'local-cpu'
|
|
78
84
|
Requires-Dist: torch==2.5.1+cpu; (sys_platform == 'linux') and extra == 'local-cpu'
|
|
79
85
|
Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local-cpu'
|
|
80
86
|
Provides-Extra: local-gpu
|
|
87
|
+
Requires-Dist: adlfs>=2023.4.0; extra == 'local-gpu'
|
|
88
|
+
Requires-Dist: azure-storage-blob>=12.16.0; extra == 'local-gpu'
|
|
89
|
+
Requires-Dist: cloudpathlib[azure,gs,s3]>=0.17.0; extra == 'local-gpu'
|
|
81
90
|
Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-gpu'
|
|
91
|
+
Requires-Dist: gcsfs>=2023.1.0; extra == 'local-gpu'
|
|
82
92
|
Requires-Dist: mostlyai-engine[gpu]==1.1.4; extra == 'local-gpu'
|
|
83
93
|
Requires-Dist: mostlyai-qa[gpu]==1.5.5; extra == 'local-gpu'
|
|
84
94
|
Requires-Dist: python-multipart>=0.0.20; extra == 'local-gpu'
|
|
95
|
+
Requires-Dist: s3fs>=2023.1.0; extra == 'local-gpu'
|
|
96
|
+
Requires-Dist: smart-open[azure,gcs,s3]>=6.3.0; extra == 'local-gpu'
|
|
85
97
|
Requires-Dist: torch<2.6.0,>=2.5.1; extra == 'local-gpu'
|
|
86
98
|
Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local-gpu'
|
|
87
99
|
Provides-Extra: mssql
|
|
@@ -143,7 +155,7 @@ pip install -U mostlyai
|
|
|
143
155
|
# for CPU on macOS
|
|
144
156
|
pip install -U 'mostlyai[local]'
|
|
145
157
|
# for CPU on Linux
|
|
146
|
-
#pip install -U mostlyai[local] --extra-index-url https://download.pytorch.org/whl/cpu
|
|
158
|
+
#pip install -U mostlyai[local-cpu] --extra-index-url https://download.pytorch.org/whl/cpu
|
|
147
159
|
# for GPU on Linux
|
|
148
160
|
#pip install -U mostlyai[local-gpu]
|
|
149
161
|
```
|
|
@@ -45,7 +45,7 @@ pip install -U mostlyai
|
|
|
45
45
|
# for CPU on macOS
|
|
46
46
|
pip install -U 'mostlyai[local]'
|
|
47
47
|
# for CPU on Linux
|
|
48
|
-
#pip install -U mostlyai[local] --extra-index-url https://download.pytorch.org/whl/cpu
|
|
48
|
+
#pip install -U mostlyai[local-cpu] --extra-index-url https://download.pytorch.org/whl/cpu
|
|
49
49
|
# for GPU on Linux
|
|
50
50
|
#pip install -U mostlyai[local-gpu]
|
|
51
51
|
```
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
14
15
|
from pathlib import Path
|
|
15
16
|
|
|
16
17
|
from mostlyai.sdk._data.base import Schema, DataContainer
|
|
@@ -21,6 +21,7 @@ from threading import Thread
|
|
|
21
21
|
import rich
|
|
22
22
|
from fastapi import FastAPI
|
|
23
23
|
import uvicorn
|
|
24
|
+
|
|
24
25
|
from mostlyai.sdk._local.routes import Routes
|
|
25
26
|
|
|
26
27
|
import os
|
|
@@ -65,15 +66,13 @@ class LocalServer:
|
|
|
65
66
|
|
|
66
67
|
def start(self):
|
|
67
68
|
if not self._server:
|
|
68
|
-
rich.print(
|
|
69
|
-
f"Starting Synthetic Data SDK in local mode using [link=file://{self.home_dir} dodger_blue2 underline]file://{self.home_dir}[/]"
|
|
70
|
-
)
|
|
71
69
|
self._create_server()
|
|
72
70
|
self._thread = Thread(target=self._run_server, daemon=True)
|
|
73
71
|
self._thread.start()
|
|
74
72
|
# make sure the socket file is cleaned up on exit
|
|
75
73
|
atexit.register(self._clear_socket_file)
|
|
76
|
-
|
|
74
|
+
# give the server a moment to start
|
|
75
|
+
time.sleep(0.5)
|
|
77
76
|
|
|
78
77
|
def stop(self):
|
|
79
78
|
if self._server and self._server.started:
|
|
@@ -19,6 +19,9 @@ from collections.abc import Callable
|
|
|
19
19
|
|
|
20
20
|
import pandas as pd
|
|
21
21
|
import rich
|
|
22
|
+
from rich import box
|
|
23
|
+
from rich.console import RenderableType
|
|
24
|
+
from rich.live import Live
|
|
22
25
|
from rich.progress import (
|
|
23
26
|
Progress,
|
|
24
27
|
TextColumn,
|
|
@@ -27,6 +30,8 @@ from rich.progress import (
|
|
|
27
30
|
TimeElapsedColumn,
|
|
28
31
|
)
|
|
29
32
|
from rich.style import Style
|
|
33
|
+
from rich.table import Table
|
|
34
|
+
from rich.text import Text
|
|
30
35
|
|
|
31
36
|
from mostlyai.sdk.domain import (
|
|
32
37
|
StepCode,
|
|
@@ -43,6 +48,24 @@ from mostlyai.sdk.domain import (
|
|
|
43
48
|
from mostlyai.sdk.client._naming_conventions import map_camel_to_snake_case
|
|
44
49
|
|
|
45
50
|
|
|
51
|
+
## utils for manipulating rich's Table object
|
|
52
|
+
def _delete_row(table: Table, idx: int = -1) -> Table:
|
|
53
|
+
for column in table.columns:
|
|
54
|
+
column._cells = column._cells[:idx] + column._cells[idx + 1 :]
|
|
55
|
+
table.rows = table.rows[:idx] + table.rows[idx + 1 :]
|
|
56
|
+
return table
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _insert_row(*renderables: RenderableType | None, table: Table, idx: int = -1) -> Table:
|
|
60
|
+
table.add_row(*renderables)
|
|
61
|
+
for column in table.columns:
|
|
62
|
+
column._cells.insert(idx, column._cells[-1])
|
|
63
|
+
column._cells.pop()
|
|
64
|
+
table.rows.insert(idx, table.rows[-1])
|
|
65
|
+
table.rows.pop()
|
|
66
|
+
return table
|
|
67
|
+
|
|
68
|
+
|
|
46
69
|
def job_wait(
|
|
47
70
|
get_progress: Callable,
|
|
48
71
|
interval: float,
|
|
@@ -64,7 +87,8 @@ def job_wait(
|
|
|
64
87
|
),
|
|
65
88
|
TaskProgressColumn(),
|
|
66
89
|
TimeElapsedColumn(),
|
|
67
|
-
|
|
90
|
+
auto_refresh=False, # auto refresh will be handled by Live object
|
|
91
|
+
expand=True,
|
|
68
92
|
)
|
|
69
93
|
progress_bars = {
|
|
70
94
|
"overall": progress.add_task(
|
|
@@ -86,10 +110,14 @@ def job_wait(
|
|
|
86
110
|
total=step.progress.max,
|
|
87
111
|
)
|
|
88
112
|
}
|
|
113
|
+
layout = Table.grid(expand=True)
|
|
114
|
+
layout.add_row(progress)
|
|
115
|
+
live = Live(layout, refresh_per_second=1 / interval)
|
|
116
|
+
step_id_to_layout_idx = {}
|
|
89
117
|
try:
|
|
90
118
|
if progress_bar:
|
|
91
119
|
# loop until job has completed
|
|
92
|
-
|
|
120
|
+
live.start()
|
|
93
121
|
while True:
|
|
94
122
|
# sleep for interval seconds
|
|
95
123
|
time.sleep(interval)
|
|
@@ -108,26 +136,66 @@ def job_wait(
|
|
|
108
136
|
)
|
|
109
137
|
if current_task.started and job.end_date is not None:
|
|
110
138
|
progress.stop_task(current_task_id)
|
|
139
|
+
|
|
111
140
|
for i, step in enumerate(job.steps):
|
|
141
|
+
# create the latest training log table
|
|
142
|
+
if step.step_code == StepCode.train_model:
|
|
143
|
+
messages = step.messages or []
|
|
144
|
+
messages = messages[-6:]
|
|
145
|
+
last_checkpoint_idx = next(
|
|
146
|
+
(len(messages) - 1 - j for j, msg in enumerate(reversed(messages)) if msg["is_checkpoint"]),
|
|
147
|
+
-1,
|
|
148
|
+
)
|
|
149
|
+
training_log = Table(
|
|
150
|
+
title=f"Latest training log for `{step.model_label}`",
|
|
151
|
+
box=box.SIMPLE_HEAD,
|
|
152
|
+
expand=True,
|
|
153
|
+
header_style="none",
|
|
154
|
+
)
|
|
155
|
+
columns = ["Epochs", "Samples", "Elapsed Time", "Val Loss"]
|
|
156
|
+
if messages and messages[0].get("dp_eps"):
|
|
157
|
+
columns.append("Diff Privacy (ε/δ)")
|
|
158
|
+
for col in columns:
|
|
159
|
+
training_log.add_column(col, justify="right")
|
|
160
|
+
for j, message in enumerate(messages):
|
|
161
|
+
formatted_message = [
|
|
162
|
+
f"{message['epoch']:.2f}" if message.get("epoch") else "-",
|
|
163
|
+
f"{message['samples']:,}" if message.get("samples") else "-",
|
|
164
|
+
f"{message['total_time']:.0f}s" if message.get("total_time") else "-",
|
|
165
|
+
f"{message['val_loss']:.4f}" if message.get("val_loss") else "-",
|
|
166
|
+
]
|
|
167
|
+
if message.get("dp_eps"):
|
|
168
|
+
formatted_message += [f"{message['dp_eps']:.2f} / {message['dp_delta']:.0e}"]
|
|
169
|
+
style = "#14b57d on #f0fff7" if j == last_checkpoint_idx else "bright_black"
|
|
170
|
+
training_log.add_row(*formatted_message, style=style)
|
|
112
171
|
current_task_id = progress_bars[step.id]
|
|
113
172
|
current_task = progress.tasks[current_task_id]
|
|
114
173
|
if not current_task.started and step.start_date is not None:
|
|
115
174
|
progress.start_task(current_task_id)
|
|
175
|
+
if step.step_code == StepCode.train_model:
|
|
176
|
+
layout.add_row(Text("\n\n"))
|
|
177
|
+
layout.add_row(training_log)
|
|
178
|
+
step_id_to_layout_idx[step.id] = len(layout.rows) - 1
|
|
116
179
|
if step.progress.max > 0:
|
|
117
180
|
progress.update(
|
|
118
181
|
current_task_id,
|
|
119
182
|
total=step.progress.max,
|
|
120
183
|
completed=step.progress.value,
|
|
121
184
|
)
|
|
122
|
-
if current_task.started
|
|
123
|
-
|
|
185
|
+
if current_task.started:
|
|
186
|
+
if step.step_code == StepCode.train_model:
|
|
187
|
+
_delete_row(layout, step_id_to_layout_idx[step.id])
|
|
188
|
+
_insert_row(training_log, table=layout, idx=step_id_to_layout_idx[step.id])
|
|
189
|
+
if step.end_date is not None:
|
|
190
|
+
progress.stop_task(current_task_id)
|
|
191
|
+
live.update(layout)
|
|
124
192
|
# break if step has failed or been canceled
|
|
125
193
|
if step.status in (ProgressStatus.failed, ProgressStatus.canceled):
|
|
126
194
|
rich.print(f"[red]Step {step.model_label} {step.step_code.value} {step.status.lower()}")
|
|
127
195
|
return
|
|
128
196
|
# check whether we are done
|
|
129
197
|
if job.progress.value >= job.progress.max:
|
|
130
|
-
|
|
198
|
+
live.refresh()
|
|
131
199
|
time.sleep(1) # give the system a moment to update the status
|
|
132
200
|
return
|
|
133
201
|
else:
|
|
@@ -142,7 +210,7 @@ def job_wait(
|
|
|
142
210
|
return
|
|
143
211
|
finally:
|
|
144
212
|
if progress_bar:
|
|
145
|
-
|
|
213
|
+
live.stop()
|
|
146
214
|
|
|
147
215
|
|
|
148
216
|
def _get_subject_table_names(generator: Generator) -> list[str]:
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
14
15
|
from pathlib import Path
|
|
15
16
|
from typing import Any, Literal
|
|
16
17
|
|
|
17
18
|
import pandas as pd
|
|
18
19
|
import rich
|
|
19
20
|
|
|
21
|
+
from mostlyai import sdk
|
|
20
22
|
from mostlyai.sdk.client.base import GET, _MostlyBaseClient
|
|
21
23
|
from mostlyai.sdk.client.connectors import _MostlyConnectorsClient
|
|
22
24
|
from mostlyai.sdk.client.exceptions import APIError
|
|
@@ -116,10 +118,12 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
116
118
|
)
|
|
117
119
|
|
|
118
120
|
self.local = LocalServer(home_dir=local_dir)
|
|
121
|
+
home_dir = self.local.home_dir
|
|
119
122
|
base_url = self.local.base_url
|
|
120
123
|
api_key = "local"
|
|
121
124
|
uds = self.local.uds
|
|
122
125
|
else:
|
|
126
|
+
home_dir = None
|
|
123
127
|
uds = None
|
|
124
128
|
|
|
125
129
|
client_kwargs = {
|
|
@@ -134,19 +138,33 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
134
138
|
self.generators = _MostlyGeneratorsClient(**client_kwargs)
|
|
135
139
|
self.synthetic_datasets = _MostlySyntheticDatasetsClient(**client_kwargs)
|
|
136
140
|
self.synthetic_probes = _MostlySyntheticProbesClient(**client_kwargs)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
if local:
|
|
142
|
+
rich.print(f"Initializing [bold]Synthetic Data SDK[/bold] {sdk.__version__} in [bold]local[/bold] mode")
|
|
143
|
+
msg = f"Connected to [link=file://{home_dir} dodger_blue2 underline]{home_dir}[/]"
|
|
144
|
+
import torch # noqa
|
|
145
|
+
import psutil # noqa
|
|
146
|
+
|
|
147
|
+
msg += f" with {psutil.virtual_memory().total / (1024**3):.0f} GB RAM"
|
|
148
|
+
msg += f", {psutil.cpu_count(logical=True)} CPUs"
|
|
149
|
+
if torch.cuda.is_available():
|
|
150
|
+
msg += f", {torch.cuda.device_count()}x {torch.cuda.get_device_name()}"
|
|
140
151
|
else:
|
|
141
|
-
msg
|
|
142
|
-
|
|
143
|
-
msg += f" ({version})"
|
|
144
|
-
email = self.me().email
|
|
145
|
-
if email:
|
|
146
|
-
msg += f" as [bold]{email}[/bold]"
|
|
152
|
+
msg += ", 0 GPUs"
|
|
153
|
+
msg += " available"
|
|
147
154
|
rich.print(msg)
|
|
148
|
-
|
|
149
|
-
rich.print(f"
|
|
155
|
+
else:
|
|
156
|
+
rich.print(f"Initializing [bold]Synthetic Data SDK[/bold] {sdk.__version__} in [bold]client[/bold] mode")
|
|
157
|
+
try:
|
|
158
|
+
server_version = self.about().version
|
|
159
|
+
email = self.me().email
|
|
160
|
+
msg = (
|
|
161
|
+
f"Connected to [link={self.base_url} dodger_blue2 underline]{self.base_url}[/]"
|
|
162
|
+
f" {server_version}"
|
|
163
|
+
f" as [bold]{email}[/bold]"
|
|
164
|
+
)
|
|
165
|
+
rich.print(msg)
|
|
166
|
+
except Exception as e:
|
|
167
|
+
rich.print(f"Failed to connect to {self.base_url}: {e}.")
|
|
150
168
|
|
|
151
169
|
def __repr__(self) -> str:
|
|
152
170
|
if self.local:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mostlyai"
|
|
3
|
-
version = "4.2.
|
|
3
|
+
version = "4.2.3"
|
|
4
4
|
description = "Synthetic Data SDK"
|
|
5
5
|
authors = [{ name = "MOSTLY AI", email = "dev@mostly.ai" }]
|
|
6
6
|
requires-python = ">=3.10,<3.14"
|
|
@@ -48,13 +48,6 @@ dependencies = [
|
|
|
48
48
|
"networkx>=3.0,<4",
|
|
49
49
|
"ipywidgets>=8.1.0",
|
|
50
50
|
"filelock>=3.16.1",
|
|
51
|
-
# cloud-based connectors
|
|
52
|
-
"s3fs>=2023.1.0",
|
|
53
|
-
"gcsfs>=2023.1.0",
|
|
54
|
-
"cloudpathlib[gs, s3, azure]>=0.17.0",
|
|
55
|
-
"smart-open[gcs, s3, azure]>=6.3.0",
|
|
56
|
-
"azure-storage-blob>=12.16.0",
|
|
57
|
-
"adlfs>=2023.4.0",
|
|
58
51
|
]
|
|
59
52
|
|
|
60
53
|
[project.optional-dependencies]
|
|
@@ -66,6 +59,13 @@ local = [
|
|
|
66
59
|
"uvicorn>=0.34.0,<0.35",
|
|
67
60
|
"python-multipart>=0.0.20",
|
|
68
61
|
"torch>=2.5.1,<2.6.0",
|
|
62
|
+
# cloud-based connectors
|
|
63
|
+
"s3fs>=2023.1.0",
|
|
64
|
+
"gcsfs>=2023.1.0",
|
|
65
|
+
"cloudpathlib[gs, s3, azure]>=0.17.0",
|
|
66
|
+
"smart-open[gcs, s3, azure]>=6.3.0",
|
|
67
|
+
"azure-storage-blob>=12.16.0",
|
|
68
|
+
"adlfs>=2023.4.0",
|
|
69
69
|
]
|
|
70
70
|
local-gpu = [
|
|
71
71
|
"mostlyai-engine[gpu]==1.1.4",
|
|
@@ -74,6 +74,13 @@ local-gpu = [
|
|
|
74
74
|
"uvicorn>=0.34.0,<0.35",
|
|
75
75
|
"python-multipart>=0.0.20",
|
|
76
76
|
"torch>=2.5.1,<2.6.0",
|
|
77
|
+
# cloud-based connectors
|
|
78
|
+
"s3fs>=2023.1.0",
|
|
79
|
+
"gcsfs>=2023.1.0",
|
|
80
|
+
"cloudpathlib[gs, s3, azure]>=0.17.0",
|
|
81
|
+
"smart-open[gcs, s3, azure]>=6.3.0",
|
|
82
|
+
"azure-storage-blob>=12.16.0",
|
|
83
|
+
"adlfs>=2023.4.0",
|
|
77
84
|
]
|
|
78
85
|
local-cpu = [
|
|
79
86
|
"mostlyai-engine[cpu]==1.1.4",
|
|
@@ -83,6 +90,13 @@ local-cpu = [
|
|
|
83
90
|
"python-multipart>=0.0.20",
|
|
84
91
|
"torch==2.5.1+cpu; sys_platform == 'linux'",
|
|
85
92
|
"torch>=2.5.1,<2.6.0; sys_platform != 'linux'",
|
|
93
|
+
# cloud-based connectors
|
|
94
|
+
"s3fs>=2023.1.0",
|
|
95
|
+
"gcsfs>=2023.1.0",
|
|
96
|
+
"cloudpathlib[gs, s3, azure]>=0.17.0",
|
|
97
|
+
"smart-open[gcs, s3, azure]>=6.3.0",
|
|
98
|
+
"azure-storage-blob>=12.16.0",
|
|
99
|
+
"adlfs>=2023.4.0",
|
|
86
100
|
]
|
|
87
101
|
# connectors
|
|
88
102
|
databricks = ["databricks-sql-connector>=3.2.0,<4"]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_analyze_training_data.py
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_encode_training_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai-4.2.1 → mostlyai-4.2.3}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|