mostlyai 4.5.5__tar.gz → 4.5.7__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.5.5 → mostlyai-4.5.7}/PKG-INFO +77 -7
- {mostlyai-4.5.5 → mostlyai-4.5.7}/README.md +72 -2
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/__init__.py +1 -1
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/pull.py +4 -2
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/pull_context.py +3 -2
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/pull_utils.py +20 -8
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/routes.py +45 -34
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/client/_utils.py +1 -12
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/client/api.py +2 -4
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/client/base.py +1 -1
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/client/connectors.py +16 -4
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/client/generators.py +12 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/client/synthetic_datasets.py +12 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/domain.py +24 -5
- {mostlyai-4.5.5 → mostlyai-4.5.7}/pyproject.toml +5 -5
- {mostlyai-4.5.5 → mostlyai-4.5.7}/.gitignore +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/LICENSE +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/__init__.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/auto_detect.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/base.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/context.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/conversions.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/__init__.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/base.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/bigquery.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/databricks.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/hive.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/mssql.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/mysql.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/oracle.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/postgresql.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/snowflake.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/sqlite.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/dtype.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/exceptions.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/__init__.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/base.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/container/aws.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/container/azure.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/container/minio.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/table/csv.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/table/feather.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/table/json.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/file/utils.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/language_model.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/metadata_objects.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/non_context.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/progress_callback.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/push.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/util/__init__.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/util/common.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_data/util/kerberos.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/__init__.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/cli.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/connectors.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/__init__.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/jobs.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/plan.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/generators.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/progress.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/server.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/storage.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/client/__init__.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/client/_base_utils.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/client/_naming_conventions.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/client/exceptions.py +0 -0
- {mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mostlyai
|
|
3
|
-
Version: 4.5.
|
|
3
|
+
Version: 4.5.7
|
|
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
|
|
@@ -59,8 +59,8 @@ Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local'
|
|
|
59
59
|
Requires-Dist: filelock>=3.16.1; extra == 'local'
|
|
60
60
|
Requires-Dist: gcsfs>=2023.1.0; extra == 'local'
|
|
61
61
|
Requires-Dist: joblib>=1.4.2; extra == 'local'
|
|
62
|
-
Requires-Dist: mostlyai-engine==1.3.
|
|
63
|
-
Requires-Dist: mostlyai-qa==1.
|
|
62
|
+
Requires-Dist: mostlyai-engine==1.3.3; extra == 'local'
|
|
63
|
+
Requires-Dist: mostlyai-qa==1.7.0; extra == 'local'
|
|
64
64
|
Requires-Dist: networkx<4,>=3.0; extra == 'local'
|
|
65
65
|
Requires-Dist: openpyxl>=3.1.5; extra == 'local'
|
|
66
66
|
Requires-Dist: python-multipart>=0.0.20; extra == 'local'
|
|
@@ -81,8 +81,8 @@ Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-gpu'
|
|
|
81
81
|
Requires-Dist: filelock>=3.16.1; extra == 'local-gpu'
|
|
82
82
|
Requires-Dist: gcsfs>=2023.1.0; extra == 'local-gpu'
|
|
83
83
|
Requires-Dist: joblib>=1.4.2; extra == 'local-gpu'
|
|
84
|
-
Requires-Dist: mostlyai-engine[gpu]==1.3.
|
|
85
|
-
Requires-Dist: mostlyai-qa==1.
|
|
84
|
+
Requires-Dist: mostlyai-engine[gpu]==1.3.3; extra == 'local-gpu'
|
|
85
|
+
Requires-Dist: mostlyai-qa==1.7.0; extra == 'local-gpu'
|
|
86
86
|
Requires-Dist: networkx<4,>=3.0; extra == 'local-gpu'
|
|
87
87
|
Requires-Dist: openpyxl>=3.1.5; extra == 'local-gpu'
|
|
88
88
|
Requires-Dist: python-multipart>=0.0.20; extra == 'local-gpu'
|
|
@@ -148,7 +148,7 @@ https://github.com/user-attachments/assets/9e233213-a259-455c-b8ed-d1f1548b492f
|
|
|
148
148
|
- Single-table, multi-table, and time-series
|
|
149
149
|
- **Multiple Model Types**
|
|
150
150
|
- State-of-the-art performance via TabularARGN
|
|
151
|
-
- Fine-tune
|
|
151
|
+
- Fine-tune Hugging Face hosted language models
|
|
152
152
|
- Efficient LSTM for text synthesis from scratch
|
|
153
153
|
- **Advanced Training Options**
|
|
154
154
|
- GPU/CPU support
|
|
@@ -250,7 +250,7 @@ In either case, a modern GPU is highly recommended when working with language mo
|
|
|
250
250
|
|
|
251
251
|
Use `pip` (or better `uv pip`) to install the official `mostlyai` package via PyPI. Python 3.10 or higher is required.
|
|
252
252
|
|
|
253
|
-
It is highly recommended to install the package within a dedicated virtual environment using `uv
|
|
253
|
+
It is highly recommended to install the package within a dedicated virtual environment using `uv` (see [here](https://docs.astral.sh/uv/)):
|
|
254
254
|
|
|
255
255
|
<details>
|
|
256
256
|
|
|
@@ -336,12 +336,82 @@ pip install -U torch==2.6.0+cpu torchvision==0.21.0+cpu 'mostlyai[local]' --extr
|
|
|
336
336
|
|
|
337
337
|
> **Note for Google Colab users**: Installing any of the local extras (`mostlyai[local]`, or `mostlyai[local-gpu]`) will downgrade Numpy from 2.0 to Numpy 1.26, due to Opacus dependency. You'll need to restart the runtime after installation for the changes to take effect.
|
|
338
338
|
|
|
339
|
+
### Data Connectors
|
|
340
|
+
|
|
339
341
|
Add any of the following extras for further data connectors support in LOCAL mode: `databricks`, `googlebigquery`, `hive`, `mssql`, `mysql`, `oracle`, `postgres`, `snowflake`. E.g.
|
|
340
342
|
|
|
341
343
|
```shell
|
|
342
344
|
uv pip install -U 'mostlyai[local, databricks, snowflake]'
|
|
343
345
|
```
|
|
344
346
|
|
|
347
|
+
### Using Docker
|
|
348
|
+
|
|
349
|
+
As an alternative, you can also build a Docker image, which provides you with an isolated environment for running the SDK in LOCAL mode, with all connector dependencies pre-installed. This approach ensures a consistent runtime environment across all systems. Before proceeding, make sure [Docker](https://docs.docker.com/get-started/get-docker/) is installed on your system.
|
|
350
|
+
|
|
351
|
+
<details>
|
|
352
|
+
|
|
353
|
+
<summary>Build the image</summary>
|
|
354
|
+
|
|
355
|
+
If your environment is capable of executing Makefile (see [here](https://github.com/mostly-ai/mostlyai/blob/main/Makefile#L47-L73)), then execute `make docker-build`.
|
|
356
|
+
|
|
357
|
+
Otherwise, use `DOCKER_BUILDKIT=1 docker build . --platform=linux/amd64 -t mostlyai/mostlyai` instead.
|
|
358
|
+
|
|
359
|
+
</details>
|
|
360
|
+
|
|
361
|
+
<details>
|
|
362
|
+
|
|
363
|
+
<summary>Start the container</summary>
|
|
364
|
+
|
|
365
|
+
This will launch the SDK in LOCAL mode on port 8080 inside the container.
|
|
366
|
+
|
|
367
|
+
If your environment is capable of executing Makefile, then execute `make docker-run`. Or `make docker-run HOST_PORT=8080` to forward to a host port of your choice. One could also mount the `local_dir` via `make docker-run HOST_LOCAL_DIR=/path/to/host/folder` to make the generators and synthetic datasets directly accessible from the host.
|
|
368
|
+
|
|
369
|
+
Otherwise, use `docker run --platform=linux/amd64 -p 8080:8080 mostlyai/mostlyai` instead. Optionally, you can use the `-v` flag to mount a [volume](https://docs.docker.com/engine/storage/volumes/#syntax) for passing files between the host and the container.
|
|
370
|
+
|
|
371
|
+
</details>
|
|
372
|
+
|
|
373
|
+
<details>
|
|
374
|
+
|
|
375
|
+
<summary>Connect to the container</summary>
|
|
376
|
+
|
|
377
|
+
You can now connect to the SDK running within the container by initializing the SDK in `CLIENT` mode on the host machine.
|
|
378
|
+
|
|
379
|
+
```python
|
|
380
|
+
from mostlyai.sdk import MostlyAI
|
|
381
|
+
|
|
382
|
+
mostly = MostlyAI(base_url="http://localhost:8080")
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
</details>
|
|
386
|
+
|
|
387
|
+
### Air-gapped Environments
|
|
388
|
+
|
|
389
|
+
For air-gapped environments (without internet access), you must install the package using the provided wheel files, including any optional dependencies you require.
|
|
390
|
+
|
|
391
|
+
If your application depends on a Hugging Face language model, you’ll also need to manually download and transfer the model files.
|
|
392
|
+
|
|
393
|
+
<details>
|
|
394
|
+
|
|
395
|
+
<summary>Download models from Hugging Face Hub</summary>
|
|
396
|
+
|
|
397
|
+
<p>On a machine with internet access, run the following Python script, to download the Hugging Face model to your local Hugging Face cache.</p>
|
|
398
|
+
|
|
399
|
+
```python
|
|
400
|
+
#! uv pip install huggingface-hub
|
|
401
|
+
from pathlib import Path
|
|
402
|
+
from huggingface_hub import snapshot_download
|
|
403
|
+
path = snapshot_download(
|
|
404
|
+
repo_id="Qwen/Qwen2.5-Coder-0.5B", # change accordingly
|
|
405
|
+
token=None, # insert your HF TOKEN for gated models
|
|
406
|
+
)
|
|
407
|
+
print(f"COPY `{Path(path).parent.parent}`")
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
Next, transfer the printed directory to the air-gapped environment's cache directory located at `~/.cache/huggingface/hub/` (respectively to `HF_HOME`, if that environment variable has been set).
|
|
411
|
+
|
|
412
|
+
</details>
|
|
413
|
+
|
|
414
|
+
|
|
345
415
|
## Citation
|
|
346
416
|
|
|
347
417
|
Please consider citing our project if you find it useful:
|
|
@@ -39,7 +39,7 @@ https://github.com/user-attachments/assets/9e233213-a259-455c-b8ed-d1f1548b492f
|
|
|
39
39
|
- Single-table, multi-table, and time-series
|
|
40
40
|
- **Multiple Model Types**
|
|
41
41
|
- State-of-the-art performance via TabularARGN
|
|
42
|
-
- Fine-tune
|
|
42
|
+
- Fine-tune Hugging Face hosted language models
|
|
43
43
|
- Efficient LSTM for text synthesis from scratch
|
|
44
44
|
- **Advanced Training Options**
|
|
45
45
|
- GPU/CPU support
|
|
@@ -141,7 +141,7 @@ In either case, a modern GPU is highly recommended when working with language mo
|
|
|
141
141
|
|
|
142
142
|
Use `pip` (or better `uv pip`) to install the official `mostlyai` package via PyPI. Python 3.10 or higher is required.
|
|
143
143
|
|
|
144
|
-
It is highly recommended to install the package within a dedicated virtual environment using `uv
|
|
144
|
+
It is highly recommended to install the package within a dedicated virtual environment using `uv` (see [here](https://docs.astral.sh/uv/)):
|
|
145
145
|
|
|
146
146
|
<details>
|
|
147
147
|
|
|
@@ -227,12 +227,82 @@ pip install -U torch==2.6.0+cpu torchvision==0.21.0+cpu 'mostlyai[local]' --extr
|
|
|
227
227
|
|
|
228
228
|
> **Note for Google Colab users**: Installing any of the local extras (`mostlyai[local]`, or `mostlyai[local-gpu]`) will downgrade Numpy from 2.0 to Numpy 1.26, due to Opacus dependency. You'll need to restart the runtime after installation for the changes to take effect.
|
|
229
229
|
|
|
230
|
+
### Data Connectors
|
|
231
|
+
|
|
230
232
|
Add any of the following extras for further data connectors support in LOCAL mode: `databricks`, `googlebigquery`, `hive`, `mssql`, `mysql`, `oracle`, `postgres`, `snowflake`. E.g.
|
|
231
233
|
|
|
232
234
|
```shell
|
|
233
235
|
uv pip install -U 'mostlyai[local, databricks, snowflake]'
|
|
234
236
|
```
|
|
235
237
|
|
|
238
|
+
### Using Docker
|
|
239
|
+
|
|
240
|
+
As an alternative, you can also build a Docker image, which provides you with an isolated environment for running the SDK in LOCAL mode, with all connector dependencies pre-installed. This approach ensures a consistent runtime environment across all systems. Before proceeding, make sure [Docker](https://docs.docker.com/get-started/get-docker/) is installed on your system.
|
|
241
|
+
|
|
242
|
+
<details>
|
|
243
|
+
|
|
244
|
+
<summary>Build the image</summary>
|
|
245
|
+
|
|
246
|
+
If your environment is capable of executing Makefile (see [here](https://github.com/mostly-ai/mostlyai/blob/main/Makefile#L47-L73)), then execute `make docker-build`.
|
|
247
|
+
|
|
248
|
+
Otherwise, use `DOCKER_BUILDKIT=1 docker build . --platform=linux/amd64 -t mostlyai/mostlyai` instead.
|
|
249
|
+
|
|
250
|
+
</details>
|
|
251
|
+
|
|
252
|
+
<details>
|
|
253
|
+
|
|
254
|
+
<summary>Start the container</summary>
|
|
255
|
+
|
|
256
|
+
This will launch the SDK in LOCAL mode on port 8080 inside the container.
|
|
257
|
+
|
|
258
|
+
If your environment is capable of executing Makefile, then execute `make docker-run`. Or `make docker-run HOST_PORT=8080` to forward to a host port of your choice. One could also mount the `local_dir` via `make docker-run HOST_LOCAL_DIR=/path/to/host/folder` to make the generators and synthetic datasets directly accessible from the host.
|
|
259
|
+
|
|
260
|
+
Otherwise, use `docker run --platform=linux/amd64 -p 8080:8080 mostlyai/mostlyai` instead. Optionally, you can use the `-v` flag to mount a [volume](https://docs.docker.com/engine/storage/volumes/#syntax) for passing files between the host and the container.
|
|
261
|
+
|
|
262
|
+
</details>
|
|
263
|
+
|
|
264
|
+
<details>
|
|
265
|
+
|
|
266
|
+
<summary>Connect to the container</summary>
|
|
267
|
+
|
|
268
|
+
You can now connect to the SDK running within the container by initializing the SDK in `CLIENT` mode on the host machine.
|
|
269
|
+
|
|
270
|
+
```python
|
|
271
|
+
from mostlyai.sdk import MostlyAI
|
|
272
|
+
|
|
273
|
+
mostly = MostlyAI(base_url="http://localhost:8080")
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
</details>
|
|
277
|
+
|
|
278
|
+
### Air-gapped Environments
|
|
279
|
+
|
|
280
|
+
For air-gapped environments (without internet access), you must install the package using the provided wheel files, including any optional dependencies you require.
|
|
281
|
+
|
|
282
|
+
If your application depends on a Hugging Face language model, you’ll also need to manually download and transfer the model files.
|
|
283
|
+
|
|
284
|
+
<details>
|
|
285
|
+
|
|
286
|
+
<summary>Download models from Hugging Face Hub</summary>
|
|
287
|
+
|
|
288
|
+
<p>On a machine with internet access, run the following Python script, to download the Hugging Face model to your local Hugging Face cache.</p>
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
#! uv pip install huggingface-hub
|
|
292
|
+
from pathlib import Path
|
|
293
|
+
from huggingface_hub import snapshot_download
|
|
294
|
+
path = snapshot_download(
|
|
295
|
+
repo_id="Qwen/Qwen2.5-Coder-0.5B", # change accordingly
|
|
296
|
+
token=None, # insert your HF TOKEN for gated models
|
|
297
|
+
)
|
|
298
|
+
print(f"COPY `{Path(path).parent.parent}`")
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Next, transfer the printed directory to the air-gapped environment's cache directory located at `~/.cache/huggingface/hub/` (respectively to `HF_HOME`, if that environment variable has been set).
|
|
302
|
+
|
|
303
|
+
</details>
|
|
304
|
+
|
|
305
|
+
|
|
236
306
|
## Citation
|
|
237
307
|
|
|
238
308
|
Please consider citing our project if you find it useful:
|
|
@@ -38,6 +38,7 @@ def pull(
|
|
|
38
38
|
schema: Schema,
|
|
39
39
|
model_type: str | ModelType = ModelType.tabular,
|
|
40
40
|
max_sample_size: int | None = None,
|
|
41
|
+
trn_val_split: float | None = 0.9,
|
|
41
42
|
workspace_dir: str | Path = "engine-ws",
|
|
42
43
|
update_progress: ProgressCallback | None = None,
|
|
43
44
|
):
|
|
@@ -92,9 +93,10 @@ def pull(
|
|
|
92
93
|
pull_split(
|
|
93
94
|
tgt=tgt,
|
|
94
95
|
schema=schema,
|
|
95
|
-
|
|
96
|
-
do_ctx_only=False,
|
|
96
|
+
trn_val_split=trn_val_split,
|
|
97
97
|
model_type=model_type,
|
|
98
|
+
do_ctx_only=False,
|
|
99
|
+
workspace_dir=workspace_dir,
|
|
98
100
|
progress=progress,
|
|
99
101
|
)
|
|
100
102
|
|
|
@@ -57,9 +57,10 @@ def pull_context(
|
|
|
57
57
|
pull_split(
|
|
58
58
|
tgt=tgt,
|
|
59
59
|
schema=schema,
|
|
60
|
-
|
|
61
|
-
do_ctx_only=True,
|
|
60
|
+
trn_val_split=None,
|
|
62
61
|
model_type=model_type,
|
|
62
|
+
do_ctx_only=True,
|
|
63
|
+
workspace_dir=workspace_dir,
|
|
63
64
|
progress=ProgressCallbackWrapper(update_progress=update_progress),
|
|
64
65
|
)
|
|
65
66
|
|
|
@@ -651,6 +651,7 @@ def export_chunk(
|
|
|
651
651
|
chunk: pd.DataFrame,
|
|
652
652
|
hash_column: pd.Series,
|
|
653
653
|
n_partitions: int,
|
|
654
|
+
trn_val_split: float | None,
|
|
654
655
|
data_dir: Path,
|
|
655
656
|
do_ctx_only: bool,
|
|
656
657
|
):
|
|
@@ -677,14 +678,18 @@ def export_chunk(
|
|
|
677
678
|
_store_partition_chunk(partition_idx=f"000000-{split}", partition_chunk=chunk)
|
|
678
679
|
return
|
|
679
680
|
|
|
680
|
-
# split into partitions; plus split each partition into trn/val
|
|
681
|
-
# for that we create 10x more partitions, map modulo
|
|
681
|
+
# split into partitions; plus split each partition into trn/val based on trn_val_split
|
|
682
|
+
# for that we create 10x more partitions, map modulo based on trn_val_split
|
|
682
683
|
# don't split into partitions when pulling context only
|
|
684
|
+
trn_val_split = trn_val_split or 0.9
|
|
685
|
+
val_count = round((1 - trn_val_split) * 10) # number of partitions for validation (out of 10)
|
|
683
686
|
hashes = _hash_partitioner(hash_column, 10 * n_partitions)
|
|
684
|
-
if np.all(hashes % 10
|
|
685
|
-
hashes +=
|
|
687
|
+
if np.all(hashes % 10 < val_count):
|
|
688
|
+
hashes += val_count # ensure that we have at least one training partition
|
|
689
|
+
|
|
686
690
|
chunk["__PARTITION_GROUP"] = hashes // 10
|
|
687
|
-
chunk["__PARTITION_SPLIT"] = np.where(hashes % 10
|
|
691
|
+
chunk["__PARTITION_SPLIT"] = np.where(hashes % 10 < val_count, "val", "trn") if not do_ctx_only else "ctx"
|
|
692
|
+
|
|
688
693
|
for partition_group in chunk["__PARTITION_GROUP"].unique():
|
|
689
694
|
partition_chunk = chunk[chunk["__PARTITION_GROUP"] == partition_group]
|
|
690
695
|
for partition_split in partition_chunk["__PARTITION_SPLIT"].unique():
|
|
@@ -729,13 +734,14 @@ def split_context(
|
|
|
729
734
|
schema: Schema,
|
|
730
735
|
ctx_data_dir: Path,
|
|
731
736
|
n_partitions: int,
|
|
737
|
+
trn_val_split: float | None,
|
|
732
738
|
model_type: ModelType,
|
|
733
739
|
do_ctx_only: bool,
|
|
734
740
|
progress: ProgressCallbackWrapper,
|
|
735
741
|
):
|
|
736
742
|
ctx = schema.get_parent(tgt)
|
|
737
743
|
context_tables = schema.get_context_tables(tgt)
|
|
738
|
-
|
|
744
|
+
_, ctx_tgt_path = get_table_chain_to_tgt(
|
|
739
745
|
schema=schema,
|
|
740
746
|
tables=context_tables,
|
|
741
747
|
tgt=tgt,
|
|
@@ -819,6 +825,7 @@ def split_context(
|
|
|
819
825
|
chunk=chunk,
|
|
820
826
|
hash_column=chunk[key.ref_name()],
|
|
821
827
|
n_partitions=n_partitions,
|
|
828
|
+
trn_val_split=trn_val_split,
|
|
822
829
|
data_dir=ctx_data_dir,
|
|
823
830
|
do_ctx_only=do_ctx_only,
|
|
824
831
|
)
|
|
@@ -837,6 +844,7 @@ def split_target(
|
|
|
837
844
|
schema: Schema,
|
|
838
845
|
tgt_data_dir: Path,
|
|
839
846
|
n_partitions: int,
|
|
847
|
+
trn_val_split: float | None,
|
|
840
848
|
model_type: ModelType,
|
|
841
849
|
do_ctx_only: bool,
|
|
842
850
|
progress: ProgressCallbackWrapper,
|
|
@@ -893,6 +901,7 @@ def split_target(
|
|
|
893
901
|
chunk=chunk,
|
|
894
902
|
hash_column=_hash_column(chunk),
|
|
895
903
|
n_partitions=n_partitions,
|
|
904
|
+
trn_val_split=trn_val_split,
|
|
896
905
|
data_dir=tgt_data_dir,
|
|
897
906
|
do_ctx_only=do_ctx_only,
|
|
898
907
|
)
|
|
@@ -938,9 +947,10 @@ def pull_split(
|
|
|
938
947
|
*,
|
|
939
948
|
tgt: str,
|
|
940
949
|
schema: Schema,
|
|
941
|
-
|
|
942
|
-
do_ctx_only: bool,
|
|
950
|
+
trn_val_split: float | None,
|
|
943
951
|
model_type: ModelType,
|
|
952
|
+
do_ctx_only: bool,
|
|
953
|
+
workspace_dir: Path,
|
|
944
954
|
progress: ProgressCallbackWrapper,
|
|
945
955
|
) -> None:
|
|
946
956
|
"""Split fetched data among partitions.
|
|
@@ -987,6 +997,7 @@ def pull_split(
|
|
|
987
997
|
schema=schema,
|
|
988
998
|
ctx_data_dir=ctx_data_dir,
|
|
989
999
|
n_partitions=n_partitions,
|
|
1000
|
+
trn_val_split=trn_val_split,
|
|
990
1001
|
model_type=model_type,
|
|
991
1002
|
do_ctx_only=do_ctx_only,
|
|
992
1003
|
progress=progress,
|
|
@@ -998,6 +1009,7 @@ def pull_split(
|
|
|
998
1009
|
schema=schema,
|
|
999
1010
|
tgt_data_dir=tgt_data_dir,
|
|
1000
1011
|
n_partitions=n_partitions,
|
|
1012
|
+
trn_val_split=trn_val_split,
|
|
1001
1013
|
model_type=model_type,
|
|
1002
1014
|
do_ctx_only=do_ctx_only,
|
|
1003
1015
|
progress=progress,
|
|
@@ -133,27 +133,32 @@ class Routes:
|
|
|
133
133
|
@self.router.get("/models/{model_type}")
|
|
134
134
|
async def list_models(model_type: str) -> JSONResponse:
|
|
135
135
|
if model_type == ModelType.tabular:
|
|
136
|
-
|
|
136
|
+
models = ["MOSTLY_AI/Small", "MOSTLY_AI/Medium", "MOSTLY_AI/Large"]
|
|
137
137
|
elif model_type == ModelType.language:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return JSONResponse(content=
|
|
138
|
+
models = ["MOSTLY_AI/LSTMFromScratch-3m", "microsoft/phi-1_5", "(HuggingFace-hosted models)"]
|
|
139
|
+
else:
|
|
140
|
+
models = []
|
|
141
|
+
return JSONResponse(content=models)
|
|
142
142
|
|
|
143
143
|
## CONNECTORS
|
|
144
144
|
|
|
145
145
|
@self.router.get("/connectors")
|
|
146
146
|
async def list_connectors(
|
|
147
|
-
offset=0,
|
|
147
|
+
offset=0,
|
|
148
|
+
limit=50,
|
|
149
|
+
searchTerm: str | None = None,
|
|
150
|
+
access_type: str | None = None,
|
|
148
151
|
) -> JSONResponse:
|
|
149
152
|
connector_dirs = [p for p in (self.home_dir / "connectors").glob("*") if p.is_dir()]
|
|
150
153
|
connector_list_items = []
|
|
151
154
|
for connector_dir in connector_dirs:
|
|
152
155
|
connector = read_connector_from_json(connector_dir)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
connector_string = " ".join([connector.name or "", connector.description or ""]).lower()
|
|
157
|
+
if searchTerm and searchTerm.lower() not in connector_string:
|
|
158
|
+
continue
|
|
159
|
+
if access_type and access_type != connector.access_type:
|
|
160
|
+
continue
|
|
161
|
+
connector_list_items.append(ConnectorListItem.model_construct(**connector.model_dump()))
|
|
157
162
|
|
|
158
163
|
# use jsonable_encoder to handle non-serializable objects like datetime
|
|
159
164
|
return JSONResponse(
|
|
@@ -289,24 +294,26 @@ class Routes:
|
|
|
289
294
|
|
|
290
295
|
@self.router.get("/generators")
|
|
291
296
|
async def list_generators(
|
|
292
|
-
offset: int = 0,
|
|
297
|
+
offset: int = 0,
|
|
298
|
+
limit: int = 50,
|
|
299
|
+
searchTerm: str | None = None,
|
|
300
|
+
status: str | None = None,
|
|
293
301
|
) -> JSONResponse:
|
|
294
302
|
generator_dirs = [p for p in (self.home_dir / "generators").glob("*") if p.is_dir()]
|
|
295
303
|
generator_list_items = []
|
|
296
304
|
for generator_dir in generator_dirs:
|
|
297
305
|
generator = read_generator_from_json(generator_dir)
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
# use jsonable_encoder to handle non-serializable objects like datetime
|
|
306
|
+
generator_string = " ".join([generator.name or "", generator.description or ""]).lower()
|
|
307
|
+
if searchTerm and searchTerm.lower() not in generator_string:
|
|
308
|
+
continue
|
|
309
|
+
if status and status != generator.training_status:
|
|
310
|
+
continue
|
|
311
|
+
# use model_construct to skip validation and warnings of extra fields
|
|
312
|
+
generator_list_items.append(GeneratorListItem.model_construct(**generator.model_dump()))
|
|
313
|
+
|
|
307
314
|
return JSONResponse(
|
|
308
315
|
status_code=200,
|
|
309
|
-
content=jsonable_encoder(
|
|
316
|
+
content=jsonable_encoder( # use jsonable_encoder to handle non-serializable objects like datetime
|
|
310
317
|
{
|
|
311
318
|
"totalCount": len(generator_list_items),
|
|
312
319
|
"results": generator_list_items[int(offset) : int(offset) + int(limit)],
|
|
@@ -455,26 +462,30 @@ class Routes:
|
|
|
455
462
|
|
|
456
463
|
@self.router.get("/synthetic-datasets")
|
|
457
464
|
async def list_synthetic_datasets(
|
|
458
|
-
offset: int = 0,
|
|
465
|
+
offset: int = 0,
|
|
466
|
+
limit: int = 50,
|
|
467
|
+
searchTerm: str | None = None,
|
|
468
|
+
status: str | None = None,
|
|
459
469
|
) -> JSONResponse:
|
|
460
470
|
synthetic_dataset_dirs = [p for p in (self.home_dir / "synthetic-datasets").glob("*") if p.is_dir()]
|
|
461
471
|
synthetic_dataset_list_items = []
|
|
462
472
|
for synthetic_dataset_dir in synthetic_dataset_dirs:
|
|
463
473
|
synthetic_dataset = read_synthetic_dataset_from_json(synthetic_dataset_dir)
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
474
|
+
synthetic_dataset_string = " ".join(
|
|
475
|
+
[synthetic_dataset.name or "", synthetic_dataset.description or ""]
|
|
476
|
+
).lower()
|
|
477
|
+
if searchTerm and searchTerm.lower() not in synthetic_dataset_string:
|
|
478
|
+
continue
|
|
479
|
+
if status and status != synthetic_dataset.generation_status:
|
|
480
|
+
continue
|
|
481
|
+
# use model_construct to skip validation and warnings of extra fields
|
|
482
|
+
synthetic_dataset_list_items.append(
|
|
483
|
+
SyntheticDatasetListItem.model_construct(**synthetic_dataset.model_dump())
|
|
484
|
+
)
|
|
485
|
+
|
|
475
486
|
return JSONResponse(
|
|
476
487
|
status_code=200,
|
|
477
|
-
content=jsonable_encoder(
|
|
488
|
+
content=jsonable_encoder( # use jsonable_encoder to handle non-serializable objects like datetime
|
|
478
489
|
{
|
|
479
490
|
"totalCount": len(synthetic_dataset_list_items),
|
|
480
491
|
"results": synthetic_dataset_list_items[int(offset) : int(offset) + int(limit)],
|
|
@@ -76,17 +76,6 @@ def validate_base_url(base_url: str) -> None:
|
|
|
76
76
|
raise APIError("Invalid base URL.")
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
def validate_api_key(api_key: str) -> None:
|
|
80
|
-
"""
|
|
81
|
-
Check if the provided API key is valid. Raise an exception if it is not.
|
|
82
|
-
"""
|
|
83
|
-
api_key = str(api_key)
|
|
84
|
-
if not api_key:
|
|
85
|
-
raise APIError("Missing API key.")
|
|
86
|
-
elif len(api_key) != 71:
|
|
87
|
-
raise APIError("Invalid API key format.")
|
|
88
|
-
|
|
89
|
-
|
|
90
79
|
class _DynamicRefreshThread(Thread):
|
|
91
80
|
"""A thread that calls live.refresh() at dynamic intervals, increasing the delay between refreshes over time.
|
|
92
81
|
The refresh interval stays at initial_interval for the first fixed_time seconds,
|
|
@@ -97,7 +86,7 @@ class _DynamicRefreshThread(Thread):
|
|
|
97
86
|
self,
|
|
98
87
|
live: "Live",
|
|
99
88
|
initial_interval: float = 2.0,
|
|
100
|
-
max_interval: float =
|
|
89
|
+
max_interval: float = 30.0,
|
|
101
90
|
fixed_time: float = 30.0,
|
|
102
91
|
increasing_time: float = 60.0,
|
|
103
92
|
) -> None:
|
|
@@ -47,7 +47,6 @@ from mostlyai.sdk.client._utils import (
|
|
|
47
47
|
harmonize_sd_config,
|
|
48
48
|
Seed,
|
|
49
49
|
check_local_mode_available,
|
|
50
|
-
validate_api_key,
|
|
51
50
|
validate_base_url,
|
|
52
51
|
)
|
|
53
52
|
|
|
@@ -176,8 +175,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
176
175
|
base_url = os.getenv("MOSTLY_BASE_URL", DEFAULT_BASE_URL).rstrip("/")
|
|
177
176
|
validate_base_url(base_url)
|
|
178
177
|
if api_key is None:
|
|
179
|
-
api_key = os.getenv("MOSTLY_API_KEY")
|
|
180
|
-
validate_api_key(api_key)
|
|
178
|
+
api_key = os.getenv("MOSTLY_API_KEY", "")
|
|
181
179
|
home_dir = None
|
|
182
180
|
uds = None
|
|
183
181
|
else:
|
|
@@ -221,7 +219,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
221
219
|
msg += f" as [bold]{email}[/bold]" if email else ""
|
|
222
220
|
rich.print(msg)
|
|
223
221
|
except Exception as e:
|
|
224
|
-
rich.print(f"Failed to connect to {self.base_url}: {e}.")
|
|
222
|
+
rich.print(f"Failed to connect to {self.base_url} : {e}.")
|
|
225
223
|
else:
|
|
226
224
|
raise ValueError("Invalid SDK mode")
|
|
227
225
|
|
|
@@ -68,7 +68,7 @@ class _MostlyBaseClient:
|
|
|
68
68
|
ssl_verify: bool = True,
|
|
69
69
|
):
|
|
70
70
|
self.base_url = (base_url or os.getenv("MOSTLY_BASE_URL") or DEFAULT_BASE_URL).rstrip("/")
|
|
71
|
-
self.api_key = api_key or os.getenv("MOSTLY_API_KEY")
|
|
71
|
+
self.api_key = api_key or os.getenv("MOSTLY_API_KEY", "")
|
|
72
72
|
self.local = self.api_key == "local"
|
|
73
73
|
self.transport = httpx.HTTPTransport(uds=uds) if uds else None
|
|
74
74
|
self.timeout = timeout
|
|
@@ -47,9 +47,13 @@ class _MostlyConnectorsClient(_MostlyBaseClient):
|
|
|
47
47
|
self,
|
|
48
48
|
offset: int = 0,
|
|
49
49
|
limit: int | None = None,
|
|
50
|
-
access_type: str | None = None,
|
|
51
50
|
search_term: str | None = None,
|
|
51
|
+
access_type: str | None = None,
|
|
52
52
|
owner_id: str | list[str] | None = None,
|
|
53
|
+
visibility: str | list[str] | None = None,
|
|
54
|
+
created_from: str | None = None,
|
|
55
|
+
created_to: str | None = None,
|
|
56
|
+
sort_by: str | list[str] | None = None,
|
|
53
57
|
) -> Iterator[ConnectorListItem]:
|
|
54
58
|
"""
|
|
55
59
|
List connectors.
|
|
@@ -67,9 +71,13 @@ class _MostlyConnectorsClient(_MostlyBaseClient):
|
|
|
67
71
|
Args:
|
|
68
72
|
offset: Offset for entities in the response.
|
|
69
73
|
limit: Limit for the number of entities in the response.
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
search_term: Filter by search term in the name and description.
|
|
75
|
+
access_type: Filter by access type (e.g., READ_PROTECTED, READ_DATA or WRITE_DATA).
|
|
72
76
|
owner_id: Filter by owner ID.
|
|
77
|
+
visibility: Filter by visibility (e.g., PUBLIC, PRIVATE or UNLISTED).
|
|
78
|
+
created_from: Filter by creation date, not older than this date. Format: YYYY-MM-DD.
|
|
79
|
+
created_to: Filter by creation date, not younger than this date. Format: YYYY-MM-DD.
|
|
80
|
+
sort_by: Sort by field. Either RECENCY or NO_OF_GENERATORS.
|
|
73
81
|
|
|
74
82
|
Returns:
|
|
75
83
|
Iterator[ConnectorListItem]: An iterator over connector list items.
|
|
@@ -79,9 +87,13 @@ class _MostlyConnectorsClient(_MostlyBaseClient):
|
|
|
79
87
|
ConnectorListItem,
|
|
80
88
|
offset=offset,
|
|
81
89
|
limit=limit,
|
|
82
|
-
access_type=access_type,
|
|
83
90
|
search_term=search_term,
|
|
91
|
+
access_type=access_type,
|
|
84
92
|
owner_id=owner_id,
|
|
93
|
+
visibility=visibility,
|
|
94
|
+
created_from=created_from,
|
|
95
|
+
created_to=created_to,
|
|
96
|
+
sort_by=sort_by,
|
|
85
97
|
) as paginator:
|
|
86
98
|
yield from paginator
|
|
87
99
|
|
|
@@ -56,6 +56,10 @@ class _MostlyGeneratorsClient(_MostlyBaseClient):
|
|
|
56
56
|
status: str | list[str] | None = None,
|
|
57
57
|
search_term: str | None = None,
|
|
58
58
|
owner_id: str | list[str] | None = None,
|
|
59
|
+
visibility: str | list[str] | None = None,
|
|
60
|
+
created_from: str | None = None,
|
|
61
|
+
created_to: str | None = None,
|
|
62
|
+
sort_by: str | list[str] | None = None,
|
|
59
63
|
) -> Iterator[GeneratorListItem]:
|
|
60
64
|
"""
|
|
61
65
|
List generators.
|
|
@@ -68,6 +72,10 @@ class _MostlyGeneratorsClient(_MostlyBaseClient):
|
|
|
68
72
|
status: Filter by training status.
|
|
69
73
|
search_term: Filter by name or description.
|
|
70
74
|
owner_id: Filter by owner ID.
|
|
75
|
+
visibility: Filter by visibility (e.g., PUBLIC, PRIVATE or UNLISTED).
|
|
76
|
+
created_from: Filter by creation date, not older than this date. Format: YYYY-MM-DD.
|
|
77
|
+
created_to: Filter by creation date, not younger than this date. Format: YYYY-MM-DD.
|
|
78
|
+
sort_by: Sort by field. Either RECENCY, NO_OF_LIKES or NO_OF_SYNTHETIC_DATASETS.
|
|
71
79
|
|
|
72
80
|
Returns:
|
|
73
81
|
Iterator[GeneratorListItem]: An iterator over generator list items.
|
|
@@ -97,6 +105,10 @@ class _MostlyGeneratorsClient(_MostlyBaseClient):
|
|
|
97
105
|
status=status,
|
|
98
106
|
search_term=search_term,
|
|
99
107
|
owner_id=owner_id,
|
|
108
|
+
visibility=visibility,
|
|
109
|
+
created_from=created_from,
|
|
110
|
+
created_to=created_to,
|
|
111
|
+
sort_by=sort_by,
|
|
100
112
|
) as paginator:
|
|
101
113
|
yield from paginator
|
|
102
114
|
|
|
@@ -55,6 +55,10 @@ class _MostlySyntheticDatasetsClient(_MostlyBaseClient):
|
|
|
55
55
|
status: str | list[str] | None = None,
|
|
56
56
|
search_term: str | None = None,
|
|
57
57
|
owner_id: str | list[str] | None = None,
|
|
58
|
+
visibility: str | list[str] | None = None,
|
|
59
|
+
created_from: str | None = None,
|
|
60
|
+
created_to: str | None = None,
|
|
61
|
+
sort_by: str | list[str] | None = None,
|
|
58
62
|
) -> Iterator[SyntheticDatasetListItem]:
|
|
59
63
|
"""
|
|
60
64
|
List synthetic datasets.
|
|
@@ -67,6 +71,10 @@ class _MostlySyntheticDatasetsClient(_MostlyBaseClient):
|
|
|
67
71
|
status: Filter by generation status.
|
|
68
72
|
search_term: Filter by name or description.
|
|
69
73
|
owner_id: Filter by owner ID.
|
|
74
|
+
visibility: Filter by visibility (e.g., PUBLIC, PRIVATE or UNLISTED).
|
|
75
|
+
created_from: Filter by creation date, not older than this date. Format: YYYY-MM-DD.
|
|
76
|
+
created_to: Filter by creation date, not younger than this date. Format: YYYY-MM-DD.
|
|
77
|
+
sort_by: Sort by field. Either RECENCY, NO_OF_LIKES or NO_OF_DOWNLOADS.
|
|
70
78
|
|
|
71
79
|
Returns:
|
|
72
80
|
An iterator over synthetic datasets.
|
|
@@ -96,6 +104,10 @@ class _MostlySyntheticDatasetsClient(_MostlyBaseClient):
|
|
|
96
104
|
status=status,
|
|
97
105
|
search_term=search_term,
|
|
98
106
|
owner_id=owner_id,
|
|
107
|
+
visibility=visibility,
|
|
108
|
+
created_from=created_from,
|
|
109
|
+
created_to=created_to,
|
|
110
|
+
sort_by=sort_by,
|
|
99
111
|
) as paginator:
|
|
100
112
|
yield from paginator
|
|
101
113
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
# generated by datamodel-codegen:
|
|
16
|
-
# timestamp: 2025-04-
|
|
16
|
+
# timestamp: 2025-04-22T09:42:59+00:00
|
|
17
17
|
|
|
18
18
|
from __future__ import annotations
|
|
19
19
|
|
|
@@ -1567,11 +1567,12 @@ class Distances(CustomBaseModel):
|
|
|
1567
1567
|
an optimal sensitivity of this privacy assessment it is recommended to use a 50/50 split between training and
|
|
1568
1568
|
holdout data, and then generate synthetic data of the same size.
|
|
1569
1569
|
|
|
1570
|
-
The embeddings of these samples are then computed, and the
|
|
1570
|
+
The embeddings of these samples are then computed, and the nearest neighbor distances are calculated for each
|
|
1571
1571
|
synthetic sample to the training and holdout samples. Based on these nearest neighbor distances the following
|
|
1572
1572
|
metrics are calculated:
|
|
1573
1573
|
- Identical Match Share (IMS): The share of synthetic samples that are identical to a training or holdout sample.
|
|
1574
1574
|
- Distance to Closest Record (DCR): The average distance of synthetic to training or holdout samples.
|
|
1575
|
+
- Nearest Neighbor Distance Ratio (NNDR): The 10-th smallest ratio of the distance to nearest and second nearest neighbor.
|
|
1575
1576
|
|
|
1576
1577
|
For privacy-safe synthetic data we expect to see about as many identical matches, and about the same distances
|
|
1577
1578
|
for synthetic samples to training, as we see for synthetic samples to holdout.
|
|
@@ -1602,19 +1603,19 @@ class Distances(CustomBaseModel):
|
|
|
1602
1603
|
dcr_training: float | None = Field(
|
|
1603
1604
|
None,
|
|
1604
1605
|
alias="dcrTraining",
|
|
1605
|
-
description="Average
|
|
1606
|
+
description="Average nearest-neighbor distance between synthetic and training samples.",
|
|
1606
1607
|
ge=0.0,
|
|
1607
1608
|
)
|
|
1608
1609
|
dcr_holdout: float | None = Field(
|
|
1609
1610
|
None,
|
|
1610
1611
|
alias="dcrHoldout",
|
|
1611
|
-
description="Average
|
|
1612
|
+
description="Average nearest-neighbor distance between synthetic and holdout samples. Serves as a reference for `dcr_training`.",
|
|
1612
1613
|
ge=0.0,
|
|
1613
1614
|
)
|
|
1614
1615
|
dcr_trn_hol: float | None = Field(
|
|
1615
1616
|
None,
|
|
1616
1617
|
alias="dcrTrnHol",
|
|
1617
|
-
description="Average
|
|
1618
|
+
description="Average nearest-neighbor distance between training and holdout samples. Serves as a reference for `dcr_training`.",
|
|
1618
1619
|
ge=0.0,
|
|
1619
1620
|
)
|
|
1620
1621
|
dcr_share: float | None = Field(
|
|
@@ -1624,6 +1625,24 @@ class Distances(CustomBaseModel):
|
|
|
1624
1625
|
ge=0.0,
|
|
1625
1626
|
le=1.0,
|
|
1626
1627
|
)
|
|
1628
|
+
nndr_training: float | None = Field(
|
|
1629
|
+
None,
|
|
1630
|
+
alias="nndrTraining",
|
|
1631
|
+
description="10th smallest nearest-neighbor distance ratio between synthetic and training samples.",
|
|
1632
|
+
ge=0.0,
|
|
1633
|
+
)
|
|
1634
|
+
nndr_holdout: float | None = Field(
|
|
1635
|
+
None,
|
|
1636
|
+
alias="nndrHoldout",
|
|
1637
|
+
description="10th smallest nearest-neighbor distance ratio between synthetic and holdout samples.",
|
|
1638
|
+
ge=0.0,
|
|
1639
|
+
)
|
|
1640
|
+
nndr_trn_hol: float | None = Field(
|
|
1641
|
+
None,
|
|
1642
|
+
alias="nndrTrnHol",
|
|
1643
|
+
description="10th smallest nearest-neighbor distance ratio between training and holdout samples.",
|
|
1644
|
+
ge=0.0,
|
|
1645
|
+
)
|
|
1627
1646
|
|
|
1628
1647
|
|
|
1629
1648
|
class UserListItem(CustomBaseModel):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mostlyai"
|
|
3
|
-
version = "4.5.
|
|
3
|
+
version = "4.5.7"
|
|
4
4
|
description = "Synthetic Data SDK"
|
|
5
5
|
authors = [{ name = "MOSTLY AI", email = "dev@mostly.ai" }]
|
|
6
6
|
requires-python = ">=3.10,<3.14"
|
|
@@ -49,8 +49,8 @@ dependencies = [
|
|
|
49
49
|
local = [
|
|
50
50
|
# "mostlyai-engine @ git+https://github.com/mostly-ai/mostlyai-engine.git@main", # for development
|
|
51
51
|
# "mostlyai-qa @ git+https://github.com/mostly-ai/mostlyai-qa.git@main", # for development
|
|
52
|
-
"mostlyai-engine==1.3.
|
|
53
|
-
"mostlyai-qa==1.
|
|
52
|
+
"mostlyai-engine==1.3.3", # for release
|
|
53
|
+
"mostlyai-qa==1.7.0", # for release
|
|
54
54
|
"fastapi>=0.115.6,<0.116",
|
|
55
55
|
"uvicorn>=0.34.0,<0.35",
|
|
56
56
|
"python-multipart>=0.0.20",
|
|
@@ -75,8 +75,8 @@ local = [
|
|
|
75
75
|
local-gpu = [
|
|
76
76
|
# "mostlyai-engine[gpu] @ git+https://github.com/mostly-ai/mostlyai-engine.git@main", # for development
|
|
77
77
|
# "mostlyai-qa @ git+https://github.com/mostly-ai/mostlyai-qa.git@main", # for development
|
|
78
|
-
"mostlyai-engine[gpu]==1.3.
|
|
79
|
-
"mostlyai-qa==1.
|
|
78
|
+
"mostlyai-engine[gpu]==1.3.3", # for release
|
|
79
|
+
"mostlyai-qa==1.7.0", # for release
|
|
80
80
|
"fastapi>=0.115.6,<0.116",
|
|
81
81
|
"uvicorn>=0.34.0,<0.35",
|
|
82
82
|
"python-multipart>=0.0.20",
|
|
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.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_analyze_training_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai-4.5.5 → mostlyai-4.5.7}/mostlyai/sdk/_local/execution/step_encode_training_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai-4.5.5 → mostlyai-4.5.7}/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
|