mostlyai 4.4.9__tar.gz → 4.5.0__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.
Files changed (85) hide show
  1. {mostlyai-4.4.9 → mostlyai-4.5.0}/.gitignore +1 -0
  2. {mostlyai-4.4.9 → mostlyai-4.5.0}/PKG-INFO +61 -45
  3. {mostlyai-4.4.9 → mostlyai-4.5.0}/README.md +52 -36
  4. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/__init__.py +1 -1
  5. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/jobs.py +36 -20
  6. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_create_model_report.py +7 -2
  7. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_finalize_generation.py +3 -2
  8. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/generators.py +2 -1
  9. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/routes.py +10 -5
  10. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/server.py +3 -1
  11. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/storage.py +38 -1
  12. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/synthetic_datasets.py +2 -1
  13. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/client/_utils.py +69 -1
  14. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/client/api.py +3 -3
  15. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/domain.py +7 -9
  16. {mostlyai-4.4.9 → mostlyai-4.5.0}/pyproject.toml +15 -15
  17. {mostlyai-4.4.9 → mostlyai-4.5.0}/LICENSE +0 -0
  18. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/__init__.py +0 -0
  19. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/auto_detect.py +0 -0
  20. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/base.py +0 -0
  21. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/context.py +0 -0
  22. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/conversions.py +0 -0
  23. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/__init__.py +0 -0
  24. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/base.py +0 -0
  25. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/bigquery.py +0 -0
  26. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/databricks.py +0 -0
  27. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/hive.py +0 -0
  28. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/mssql.py +0 -0
  29. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/mysql.py +0 -0
  30. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/oracle.py +0 -0
  31. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/postgresql.py +0 -0
  32. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/snowflake.py +0 -0
  33. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/sqlite.py +0 -0
  34. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
  35. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/dtype.py +0 -0
  36. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/exceptions.py +0 -0
  37. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/__init__.py +0 -0
  38. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/base.py +0 -0
  39. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
  40. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/container/aws.py +0 -0
  41. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/container/azure.py +0 -0
  42. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
  43. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
  44. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/container/minio.py +0 -0
  45. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
  46. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/table/csv.py +0 -0
  47. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/table/feather.py +0 -0
  48. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/table/json.py +0 -0
  49. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
  50. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/file/utils.py +0 -0
  51. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/language_model.py +0 -0
  52. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/metadata_objects.py +0 -0
  53. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/non_context.py +0 -0
  54. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/progress_callback.py +0 -0
  55. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/pull.py +0 -0
  56. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/pull_context.py +0 -0
  57. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/pull_utils.py +0 -0
  58. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/push.py +0 -0
  59. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/util/__init__.py +0 -0
  60. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/util/common.py +0 -0
  61. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_data/util/kerberos.py +0 -0
  62. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/__init__.py +0 -0
  63. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/cli.py +0 -0
  64. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/connectors.py +0 -0
  65. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/__init__.py +0 -0
  66. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/plan.py +0 -0
  67. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
  68. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
  69. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
  70. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
  71. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
  72. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
  73. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
  74. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
  75. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
  76. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/_local/progress.py +0 -0
  77. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/client/__init__.py +0 -0
  78. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/client/_base_utils.py +0 -0
  79. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/client/_naming_conventions.py +0 -0
  80. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/client/base.py +0 -0
  81. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/client/connectors.py +0 -0
  82. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/client/exceptions.py +0 -0
  83. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/client/generators.py +0 -0
  84. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
  85. {mostlyai-4.4.9 → mostlyai-4.5.0}/mostlyai/sdk/py.typed +0 -0
@@ -6,3 +6,4 @@ __pycache__/
6
6
  .vscode/
7
7
  .pytest_cache/
8
8
  .ipynb_checkpoints
9
+ .DS_Store
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai
3
- Version: 4.4.9
3
+ Version: 4.5.0
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
@@ -26,14 +26,14 @@ Classifier: Typing :: Typed
26
26
  Requires-Python: <3.14,>=3.10
27
27
  Requires-Dist: duckdb>=1.2.1
28
28
  Requires-Dist: environs>=9.5.0
29
- Requires-Dist: greenlet<4,>=3.1.1
29
+ Requires-Dist: greenlet>=3.1.1
30
30
  Requires-Dist: gunicorn>=23.0.0
31
31
  Requires-Dist: httpx>=0.25.0
32
32
  Requires-Dist: ipywidgets>=8.1.0
33
33
  Requires-Dist: pandas>=2.0.0
34
34
  Requires-Dist: psutil>=5.9.5
35
35
  Requires-Dist: pyarrow>=16.0.0
36
- Requires-Dist: pycryptodomex<4,>=3.10.0
36
+ Requires-Dist: pycryptodomex>=3.10.0
37
37
  Requires-Dist: pydantic<3,>=2.4.2
38
38
  Requires-Dist: requests>=2.31.0
39
39
  Requires-Dist: rich>=13.7.0
@@ -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.1.12; extra == 'local'
63
- Requires-Dist: mostlyai-qa==1.5.14; extra == 'local'
62
+ Requires-Dist: mostlyai-engine==1.2.3; extra == 'local'
63
+ Requires-Dist: mostlyai-qa==1.5.16; 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'
@@ -82,8 +82,8 @@ Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-cpu'
82
82
  Requires-Dist: filelock>=3.16.1; extra == 'local-cpu'
83
83
  Requires-Dist: gcsfs>=2023.1.0; extra == 'local-cpu'
84
84
  Requires-Dist: joblib>=1.4.2; extra == 'local-cpu'
85
- Requires-Dist: mostlyai-engine[cpu]==1.1.12; extra == 'local-cpu'
86
- Requires-Dist: mostlyai-qa[cpu]==1.5.14; extra == 'local-cpu'
85
+ Requires-Dist: mostlyai-engine[cpu]==1.2.3; extra == 'local-cpu'
86
+ Requires-Dist: mostlyai-qa[cpu]==1.5.16; extra == 'local-cpu'
87
87
  Requires-Dist: networkx<4,>=3.0; extra == 'local-cpu'
88
88
  Requires-Dist: openpyxl>=3.1.5; extra == 'local-cpu'
89
89
  Requires-Dist: python-multipart>=0.0.20; extra == 'local-cpu'
@@ -105,8 +105,8 @@ Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-gpu'
105
105
  Requires-Dist: filelock>=3.16.1; extra == 'local-gpu'
106
106
  Requires-Dist: gcsfs>=2023.1.0; extra == 'local-gpu'
107
107
  Requires-Dist: joblib>=1.4.2; extra == 'local-gpu'
108
- Requires-Dist: mostlyai-engine[gpu]==1.1.12; extra == 'local-gpu'
109
- Requires-Dist: mostlyai-qa[gpu]==1.5.14; extra == 'local-gpu'
108
+ Requires-Dist: mostlyai-engine[gpu]==1.2.3; extra == 'local-gpu'
109
+ Requires-Dist: mostlyai-qa[gpu]==1.5.16; extra == 'local-gpu'
110
110
  Requires-Dist: networkx<4,>=3.0; extra == 'local-gpu'
111
111
  Requires-Dist: openpyxl>=3.1.5; extra == 'local-gpu'
112
112
  Requires-Dist: python-multipart>=0.0.20; extra == 'local-gpu'
@@ -172,7 +172,7 @@ https://github.com/user-attachments/assets/9e233213-a259-455c-b8ed-d1f1548b492f
172
172
  - Mixed-type data (categorical, numerical, geospatial, text, etc.)
173
173
  - Single-table, multi-table, and time-series
174
174
  - **Multiple Model Types**
175
- - TabularARGN for SOTA tabular performance
175
+ - State-of-the-art performance via TabularARGN
176
176
  - Fine-tune HuggingFace-based language models
177
177
  - Efficient LSTM for text synthesis from scratch
178
178
  - **Advanced Training Options**
@@ -198,60 +198,76 @@ https://github.com/user-attachments/assets/9e233213-a259-455c-b8ed-d1f1548b492f
198
198
  Install the SDK via pip:
199
199
 
200
200
  ```shell
201
- pip install mostlyai
201
+ pip install -U mostlyai # or 'mostlyai[local]' for LOCAL mode
202
202
  ```
203
203
 
204
- Train your first generator:
204
+ Generate synthetic samples using a pre-trained generator:
205
205
 
206
206
  ```python
207
- import pandas as pd
208
- from mostlyai.sdk import MostlyAI
209
-
210
- # load original data
211
- repo_url = "https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev"
212
- df_original = pd.read_csv(f"{repo_url}/census/census.csv.gz")
213
- df_original = df_original.sample(n=10_000) # sub-sample to speed up demo
214
-
215
207
  # initialize the SDK
208
+ from mostlyai.sdk import MostlyAI
216
209
  mostly = MostlyAI()
217
210
 
218
- # train a synthetic data generator, with default configs
219
- g = mostly.train(name="Quick Start Demo", data=df_original)
211
+ # import a trained generator
212
+ g = mostly.generators.import_from_file(
213
+ "https://github.com/mostly-ai/public-demo-data/raw/dev/census/census-generator.zip"
214
+ )
220
215
 
221
- # display the quality assurance report
222
- g.reports(display=True)
216
+ # probe for 1000 representative synthetic samples
217
+ mostly.probe(g, size=1000)
223
218
  ```
224
219
 
225
- Once the generator has been trained, generate synthetic data samples. Either via probing:
220
+ Generate synthetic sampels based on fixed column values:
226
221
 
227
222
  ```python
228
- # probe for some representative synthetic samples
229
- df_samples = mostly.probe(g, size=100)
230
- df_samples
223
+ # create 10k records of 24y male respondents
224
+ mostly.probe(g, seed=[{"age": 24, "sex": "Male"}] * 10_000)
231
225
  ```
232
226
 
233
- or by creating a synthetic dataset entity for larger data volumes:
227
+ And now train your very own synthetic data generator:
234
228
 
235
229
  ```python
236
- # generate a large representative synthetic dataset
237
- sd = mostly.generate(g, size=100_000)
238
- df_synthetic = sd.data()
239
- df_synthetic
240
- ```
230
+ # load original data
231
+ import pandas as pd
232
+ original_df = pd.read_csv(
233
+ "https://github.com/mostly-ai/public-demo-data/raw/dev/titanic/titanic.csv"
234
+ )
241
235
 
242
- or by conditionally probing / generating synthetic data:
236
+ # train a single-table generator, with default configs
237
+ g = mostly.train(
238
+ name="Quick Start Demo - Titanic",
239
+ data=original_df,
240
+ )
243
241
 
244
- ```python
245
- # create 100 seed records of 24y old Mexicans
246
- df_seed = pd.DataFrame({
247
- 'age': [24] * 100,
248
- 'native_country': ['Mexico'] * 100,
249
- })
250
- # conditionally probe, based on provided seed
251
- df_samples = mostly.probe(g, seed=df_seed)
252
- df_samples
242
+ # display the quality assurance report
243
+ g.reports(display=True)
244
+
245
+ # generate a representative synthetic dataset, with default configs
246
+ sd = mostly.generate(g)
247
+ synthetic_df = sd.data()
248
+
249
+ # probe for some samples
250
+ mostly.probe(g, size=100)
253
251
  ```
254
252
 
253
+ ## Performance
254
+
255
+ The SDK is being developed with a focus on efficiency, accuracy, and flexibility, with best-in-class performance across all three. Results will ultimately depend on the training data itself (size, structure, and content), on the available compute (CPU vs GPU), as well as on the chosen training configurations (model, epochs, samples, etc.). Thus, a crawl / walk / run approach is recommended — starting with a subset of samples training for a limited amount of time, to then gradually scale up, to yield optimal results for use case at hand.
256
+
257
+ ### Tabular Models
258
+
259
+ Tabular models within the SDK are built on TabularARGN ([arXiv:2501.12012](https://arxiv.org/abs/2501.12012)), which achieves best-in-class synthetic data quality while being 1–2 orders of magnitude more efficient than comparable models. This efficiency enables the training and generation of millions of synthetic records within minutes, even on CPU environments.
260
+
261
+ ![TabularARGN Benchmark](docs/TabularARGN-benchmark.png)
262
+
263
+ ### Language Models
264
+
265
+ The default language model is a basic, non-pre-trained LSTM (`LSTMFromScratch-3m`), particularly effective for textual data with limited scope (short lengths, narrow variety) and sufficient training samples.
266
+
267
+ Alternatively, any pre-trained SLM available via the Hugging Face Hub can be selected to be then fine-tuned on the provided training data. These models start out already with a general world knowledge, and then adapt to the training data for generating high-fidelity synthetic samples even in sparse data domains. The final performance will once again largely depend on the chosen model configurations.
268
+
269
+ In either case, a modern GPU is highly recommended when working with language models.
270
+
255
271
  ## Installation
256
272
 
257
273
  Use `pip` (or better `uv pip`) to install the official `mostlyai` package via PyPI. Python 3.10 or higher is required.
@@ -283,7 +299,7 @@ pip install -U 'mostlyai[local-cpu]' --extra-index-url https://download.pytorch.
283
299
  pip install -U 'mostlyai[local-gpu]'
284
300
  ```
285
301
 
286
- > **Note for Google Colab users**: Installing any of the local extras (`mostlyai[local]`, `mostlyai[local-cpu]`, or `mostlyai[local-gpu]`) will downgrade PyTorch from 2.6.0 to 2.5.1. You'll need to restart the runtime after installation for the changes to take effect.
302
+ > **Note for Google Colab users**: Installing any of the local extras (`mostlyai[local]`, `mostlyai[local-cpu]`, 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.
287
303
 
288
304
  Add any of the following extras for further data connectors support in LOCAL mode: `databricks`, `googlebigquery`, `hive`, `mssql`, `mysql`, `oracle`, `postgres`, `snowflake`. E.g.
289
305
 
@@ -38,7 +38,7 @@ https://github.com/user-attachments/assets/9e233213-a259-455c-b8ed-d1f1548b492f
38
38
  - Mixed-type data (categorical, numerical, geospatial, text, etc.)
39
39
  - Single-table, multi-table, and time-series
40
40
  - **Multiple Model Types**
41
- - TabularARGN for SOTA tabular performance
41
+ - State-of-the-art performance via TabularARGN
42
42
  - Fine-tune HuggingFace-based language models
43
43
  - Efficient LSTM for text synthesis from scratch
44
44
  - **Advanced Training Options**
@@ -64,60 +64,76 @@ https://github.com/user-attachments/assets/9e233213-a259-455c-b8ed-d1f1548b492f
64
64
  Install the SDK via pip:
65
65
 
66
66
  ```shell
67
- pip install mostlyai
67
+ pip install -U mostlyai # or 'mostlyai[local]' for LOCAL mode
68
68
  ```
69
69
 
70
- Train your first generator:
70
+ Generate synthetic samples using a pre-trained generator:
71
71
 
72
72
  ```python
73
- import pandas as pd
74
- from mostlyai.sdk import MostlyAI
75
-
76
- # load original data
77
- repo_url = "https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev"
78
- df_original = pd.read_csv(f"{repo_url}/census/census.csv.gz")
79
- df_original = df_original.sample(n=10_000) # sub-sample to speed up demo
80
-
81
73
  # initialize the SDK
74
+ from mostlyai.sdk import MostlyAI
82
75
  mostly = MostlyAI()
83
76
 
84
- # train a synthetic data generator, with default configs
85
- g = mostly.train(name="Quick Start Demo", data=df_original)
77
+ # import a trained generator
78
+ g = mostly.generators.import_from_file(
79
+ "https://github.com/mostly-ai/public-demo-data/raw/dev/census/census-generator.zip"
80
+ )
86
81
 
87
- # display the quality assurance report
88
- g.reports(display=True)
82
+ # probe for 1000 representative synthetic samples
83
+ mostly.probe(g, size=1000)
89
84
  ```
90
85
 
91
- Once the generator has been trained, generate synthetic data samples. Either via probing:
86
+ Generate synthetic sampels based on fixed column values:
92
87
 
93
88
  ```python
94
- # probe for some representative synthetic samples
95
- df_samples = mostly.probe(g, size=100)
96
- df_samples
89
+ # create 10k records of 24y male respondents
90
+ mostly.probe(g, seed=[{"age": 24, "sex": "Male"}] * 10_000)
97
91
  ```
98
92
 
99
- or by creating a synthetic dataset entity for larger data volumes:
93
+ And now train your very own synthetic data generator:
100
94
 
101
95
  ```python
102
- # generate a large representative synthetic dataset
103
- sd = mostly.generate(g, size=100_000)
104
- df_synthetic = sd.data()
105
- df_synthetic
106
- ```
96
+ # load original data
97
+ import pandas as pd
98
+ original_df = pd.read_csv(
99
+ "https://github.com/mostly-ai/public-demo-data/raw/dev/titanic/titanic.csv"
100
+ )
107
101
 
108
- or by conditionally probing / generating synthetic data:
102
+ # train a single-table generator, with default configs
103
+ g = mostly.train(
104
+ name="Quick Start Demo - Titanic",
105
+ data=original_df,
106
+ )
109
107
 
110
- ```python
111
- # create 100 seed records of 24y old Mexicans
112
- df_seed = pd.DataFrame({
113
- 'age': [24] * 100,
114
- 'native_country': ['Mexico'] * 100,
115
- })
116
- # conditionally probe, based on provided seed
117
- df_samples = mostly.probe(g, seed=df_seed)
118
- df_samples
108
+ # display the quality assurance report
109
+ g.reports(display=True)
110
+
111
+ # generate a representative synthetic dataset, with default configs
112
+ sd = mostly.generate(g)
113
+ synthetic_df = sd.data()
114
+
115
+ # probe for some samples
116
+ mostly.probe(g, size=100)
119
117
  ```
120
118
 
119
+ ## Performance
120
+
121
+ The SDK is being developed with a focus on efficiency, accuracy, and flexibility, with best-in-class performance across all three. Results will ultimately depend on the training data itself (size, structure, and content), on the available compute (CPU vs GPU), as well as on the chosen training configurations (model, epochs, samples, etc.). Thus, a crawl / walk / run approach is recommended — starting with a subset of samples training for a limited amount of time, to then gradually scale up, to yield optimal results for use case at hand.
122
+
123
+ ### Tabular Models
124
+
125
+ Tabular models within the SDK are built on TabularARGN ([arXiv:2501.12012](https://arxiv.org/abs/2501.12012)), which achieves best-in-class synthetic data quality while being 1–2 orders of magnitude more efficient than comparable models. This efficiency enables the training and generation of millions of synthetic records within minutes, even on CPU environments.
126
+
127
+ ![TabularARGN Benchmark](docs/TabularARGN-benchmark.png)
128
+
129
+ ### Language Models
130
+
131
+ The default language model is a basic, non-pre-trained LSTM (`LSTMFromScratch-3m`), particularly effective for textual data with limited scope (short lengths, narrow variety) and sufficient training samples.
132
+
133
+ Alternatively, any pre-trained SLM available via the Hugging Face Hub can be selected to be then fine-tuned on the provided training data. These models start out already with a general world knowledge, and then adapt to the training data for generating high-fidelity synthetic samples even in sparse data domains. The final performance will once again largely depend on the chosen model configurations.
134
+
135
+ In either case, a modern GPU is highly recommended when working with language models.
136
+
121
137
  ## Installation
122
138
 
123
139
  Use `pip` (or better `uv pip`) to install the official `mostlyai` package via PyPI. Python 3.10 or higher is required.
@@ -149,7 +165,7 @@ pip install -U 'mostlyai[local-cpu]' --extra-index-url https://download.pytorch.
149
165
  pip install -U 'mostlyai[local-gpu]'
150
166
  ```
151
167
 
152
- > **Note for Google Colab users**: Installing any of the local extras (`mostlyai[local]`, `mostlyai[local-cpu]`, or `mostlyai[local-gpu]`) will downgrade PyTorch from 2.6.0 to 2.5.1. You'll need to restart the runtime after installation for the changes to take effect.
168
+ > **Note for Google Colab users**: Installing any of the local extras (`mostlyai[local]`, `mostlyai[local-cpu]`, 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.
153
169
 
154
170
  Add any of the following extras for further data connectors support in LOCAL mode: `databricks`, `googlebigquery`, `hive`, `mssql`, `mysql`, `oracle`, `postgres`, `snowflake`. E.g.
155
171
 
@@ -15,4 +15,4 @@
15
15
  from mostlyai.sdk.client.api import MostlyAI
16
16
 
17
17
  __all__ = ["MostlyAI"]
18
- __version__ = "4.4.9" # Do not set this manually. Use poetry version [params].
18
+ __version__ = "4.5.0" # Do not set this manually. Use poetry version [params].
@@ -45,6 +45,7 @@ from mostlyai.sdk._local.execution.step_pull_training_data import (
45
45
  )
46
46
  from mostlyai.sdk._local.execution.step_train_model import execute_step_train_model
47
47
  from mostlyai.sdk._local.storage import (
48
+ get_model_label,
48
49
  read_generator_from_json,
49
50
  write_generator_to_json,
50
51
  read_connector_from_json,
@@ -93,15 +94,23 @@ def _move_training_artefacts(generator_dir: Path, job_workspace_dir: Path):
93
94
 
94
95
 
95
96
  def _move_generation_artefacts(synthetic_dataset_dir: Path, job_workspace_dir: Path):
96
- for dir in ["Logs", "RandomSamples", "ZIP", "DataQAReports"]:
97
- (synthetic_dataset_dir / dir).mkdir(exist_ok=True)
98
97
  for path in job_workspace_dir.absolute().rglob("*"):
98
+ target = None
99
99
  if path.is_dir() and path.name == "RandomSamples":
100
- path.rename(synthetic_dataset_dir / "RandomSamples")
101
- if path.is_dir() and path.name == "ZIP":
102
- path.rename(synthetic_dataset_dir / "ZIP")
103
- if path.is_file() and path.parent.name == "DataQAReports":
104
- path.rename(synthetic_dataset_dir / "DataQAReports" / path.name)
100
+ target = synthetic_dataset_dir / "RandomSamples"
101
+ elif path.is_dir() and path.name == "ZIP":
102
+ target = synthetic_dataset_dir / "ZIP"
103
+ elif path.is_file() and path.parent.name == "DataQAReports":
104
+ target = synthetic_dataset_dir / "DataQAReports" / path.name
105
+
106
+ if target:
107
+ if target.exists():
108
+ if target.is_dir():
109
+ shutil.rmtree(target)
110
+ else:
111
+ target.unlink()
112
+ target.parent.mkdir(parents=True, exist_ok=True)
113
+ shutil.move(str(path), str(target))
105
114
 
106
115
 
107
116
  def _mark_in_progress(resource: Generator | SyntheticDataset, resource_dir: Path):
@@ -316,17 +325,18 @@ class Execution:
316
325
  def execute_task_train(self, task: Task):
317
326
  # gather arguments that are common across steps
318
327
  generator = self._generator
319
- model_type = ModelType.tabular if task.type == TaskType.train_tabular else ModelType.language
320
- model_label = f"{task.target_table_name}:{model_type.value.lower()}"
321
328
  tgt_table = next(t for t in generator.tables if t.name == task.target_table_name)
329
+ model_type = ModelType.tabular if task.type == TaskType.train_tabular else ModelType.language
330
+ model_label = get_model_label(tgt_table, model_type, path_safe=False)
331
+ model_label_path = get_model_label(tgt_table, model_type, path_safe=True)
322
332
  generator_dir = self._home_dir / "generators" / generator.id
323
- workspace_dir = self._job_workspace_dir / model_label
333
+ workspace_dir = self._job_workspace_dir / model_label_path
324
334
  workspace_dir.mkdir(parents=True, exist_ok=True)
325
335
  update_progress_fn = partial(LocalProgressCallback, resource_path=generator_dir, model_label=model_label)
326
336
 
327
337
  # if training shall be continued, then let's first copy the ModelStore
328
338
  if generator.training_status == ProgressStatus.continue_:
329
- _copy_model(generator_dir=generator_dir, model_label=model_label, workspace_dir=workspace_dir)
339
+ _copy_model(generator_dir=generator_dir, model_label=model_label_path, workspace_dir=workspace_dir)
330
340
 
331
341
  # step: PULL_TRAINING_DATA
332
342
  connectors = [
@@ -421,9 +431,9 @@ class Execution:
421
431
  if step.step_code in {StepCode.generate_data_tabular, StepCode.create_data_report_tabular}
422
432
  else ModelType.language
423
433
  )
424
-
425
- model_label = f"{step.target_table_name}:{model_type.value.lower()}"
426
- workspace_dir = self._job_workspace_dir / model_label
434
+ model_label = get_model_label(step.target_table_name, model_type, path_safe=False)
435
+ model_label_path = get_model_label(step.target_table_name, model_type, path_safe=True)
436
+ workspace_dir = self._job_workspace_dir / model_label_path
427
437
  workspace_dir.mkdir(exist_ok=True)
428
438
 
429
439
  update_progress = partial(
@@ -432,7 +442,7 @@ class Execution:
432
442
 
433
443
  if step.step_code in {StepCode.generate_data_tabular, StepCode.generate_data_language}:
434
444
  # step: GENERATE_DATA
435
- _copy_model(generator_dir=generator_dir, model_label=model_label, workspace_dir=workspace_dir)
445
+ _copy_model(generator_dir=generator_dir, model_label=model_label_path, workspace_dir=workspace_dir)
436
446
 
437
447
  visited_tables.add(step.target_table_name)
438
448
 
@@ -464,7 +474,7 @@ class Execution:
464
474
 
465
475
  elif step.step_code in {StepCode.create_data_report_tabular, StepCode.create_data_report_language}:
466
476
  model_report_available = _copy_statistics(
467
- generator_dir=generator_dir, model_label=model_label, workspace_dir=workspace_dir
477
+ generator_dir=generator_dir, model_label=model_label_path, workspace_dir=workspace_dir
468
478
  )
469
479
  if not model_report_available:
470
480
  continue
@@ -479,12 +489,16 @@ class Execution:
479
489
 
480
490
  elif step.step_code in {StepCode.finalize_generation, StepCode.finalize_probing}:
481
491
  # for every LANGUAGE model generation, merge context and generated data
482
- for table in visited_tables:
483
- language_path = self._job_workspace_dir / f"{table}:{ModelType.language.value.lower()}"
492
+ for table_name in visited_tables:
493
+ language_path = self._job_workspace_dir / get_model_label(
494
+ table_lookup[table_name], ModelType.language, path_safe=True
495
+ )
484
496
  if language_path.exists():
485
497
  _merge_tabular_language_data(workspace_dir=language_path)
486
498
 
487
- tabular_workspace = self._job_workspace_dir / f"{table}:{ModelType.tabular.value.lower()}"
499
+ tabular_workspace = self._job_workspace_dir / get_model_label(
500
+ table_lookup[table_name], ModelType.tabular, path_safe=True
501
+ )
488
502
  tabular_workspace.mkdir(parents=True, exist_ok=True)
489
503
  shutil.rmtree(tabular_workspace / "SyntheticData", ignore_errors=True)
490
504
  shutil.move(language_path / "SyntheticData", tabular_workspace / "SyntheticData")
@@ -574,9 +588,11 @@ def execute_training_job(generator_id: str, home_dir: Path):
574
588
  _move_training_artefacts(generator_dir=generator_dir, job_workspace_dir=execution._job_workspace_dir)
575
589
  # flag as DONE
576
590
  _mark_done(resource=generator, resource_dir=generator_dir)
577
- except Exception:
591
+ except Exception as e:
578
592
  _mark_failed(resource=generator, resource_dir=generator_dir)
579
593
  _LOG.error(traceback.format_exc())
594
+ _LOG.error(f"Exception type: {type(e)}")
595
+ _LOG.error(f"Exception message: {e}")
580
596
  raise
581
597
  finally:
582
598
  execution.clear_job_workspace()
@@ -27,6 +27,7 @@ import pyarrow.parquet as papqt
27
27
  from mostlyai.engine._workspace import Workspace
28
28
  from mostlyai.sdk._data.util.common import strip_column_prefix, TABLE_COLUMN_INFIX, TEMPORARY_PRIMARY_KEY
29
29
  from mostlyai.sdk._local.execution.step_generate_model_report_data import qa_sample_size_heuristic
30
+ from mostlyai.sdk._local.storage import get_model_label
30
31
  from mostlyai.sdk.domain import ModelType, Generator, StepCode, ModelMetrics
31
32
 
32
33
  from mostlyai import qa
@@ -179,7 +180,9 @@ def create_report(
179
180
  hol_ctx_data=hol_ctx_data,
180
181
  ctx_primary_key=ctx_primary_key,
181
182
  tgt_context_key=tgt_context_key,
182
- report_path=workspace_dir / "ModelQAReports" / f"{target_table_name}:{model_type.name}.html",
183
+ report_path=workspace_dir
184
+ / "ModelQAReports"
185
+ / f"{get_model_label(tgt_table, model_type, path_safe=True)}.html",
183
186
  report_title="Model Report",
184
187
  report_subtitle=f" for {target_table_name[:30]}:{model_type.name}",
185
188
  report_credits=report_credits,
@@ -199,7 +202,9 @@ def create_report(
199
202
  statistics_path=workspace_dir / "ModelQAStatistics",
200
203
  ctx_primary_key=ctx_primary_key,
201
204
  tgt_context_key=tgt_context_key,
202
- report_path=workspace_dir / "DataQAReports" / f"{target_table_name}:{model_type.name}.html",
205
+ report_path=workspace_dir
206
+ / "DataQAReports"
207
+ / f"{get_model_label(tgt_table, model_type, path_safe=True)}.html",
203
208
  report_title="Data Report",
204
209
  report_subtitle=f" for {target_table_name[:30]}:{model_type.name}",
205
210
  report_credits=report_credits,
@@ -30,7 +30,8 @@ from mostlyai.sdk._data.util.common import (
30
30
  NON_CONTEXT_COLUMN_INFIX,
31
31
  IS_NULL,
32
32
  )
33
- from mostlyai.sdk.domain import Generator, SyntheticDataset
33
+ from mostlyai.sdk._local.storage import get_model_label
34
+ from mostlyai.sdk.domain import Generator, ModelType, SyntheticDataset
34
35
 
35
36
  _LOG = logging.getLogger(__name__)
36
37
 
@@ -425,7 +426,7 @@ def create_generation_schema(
425
426
  for table in generator.tables:
426
427
  # create LocalFileContainer
427
428
  container = LocalFileContainer()
428
- model_label = f"{table.name}:tabular"
429
+ model_label = get_model_label(table, ModelType.tabular, path_safe=True)
429
430
  location = str(job_workspace_dir / model_label / "SyntheticData")
430
431
  container.set_location(location)
431
432
  if step == "pull_context_data":
@@ -15,6 +15,7 @@
15
15
  from pathlib import Path
16
16
 
17
17
  from mostlyai.sdk._local.storage import (
18
+ get_model_label,
18
19
  write_generator_to_json,
19
20
  write_connector_to_json,
20
21
  write_job_progress_to_json,
@@ -115,7 +116,7 @@ def create_generator(home_dir: Path, config: GeneratorConfig) -> Generator:
115
116
  task_type=TaskType.train_tabular
116
117
  if model_type == ModelType.tabular
117
118
  else TaskType.train_language,
118
- model_label=f"{table.name}:{model_type.value.lower()}",
119
+ model_label=get_model_label(table, model_type),
119
120
  step_code=step,
120
121
  progress=ProgressValue(value=0, max=1),
121
122
  status=ProgressStatus.new,
@@ -64,6 +64,8 @@ from mostlyai.sdk.domain import (
64
64
  ConnectorDeleteDataConfig,
65
65
  )
66
66
  from mostlyai.sdk._local.storage import (
67
+ convert_model_label_path,
68
+ get_model_label,
67
69
  read_generator_from_json,
68
70
  write_generator_to_json,
69
71
  read_job_progress_from_json,
@@ -374,8 +376,8 @@ class Routes:
374
376
  generator = read_generator_from_json(generator_dir)
375
377
  table = next((t for t in generator.tables if t.id == table_id), None)
376
378
  reports_dir = self.home_dir / "generators" / id / "ModelQAReports"
377
- fn = reports_dir / f"{table.name}:{modelType.lower()}.html"
378
- return HTMLResponse(content=fn.read_text())
379
+ fn = reports_dir / f"{get_model_label(table, modelType, path_safe=True)}.html"
380
+ return HTMLResponse(content=fn.read_text(encoding="utf-8"))
379
381
 
380
382
  @self.router.get("/generators/{id}/training", response_model=JobProgress)
381
383
  async def get_training_progress(id: str) -> JobProgress:
@@ -430,7 +432,10 @@ class Routes:
430
432
  file_content = await file.read()
431
433
  try:
432
434
  with zipfile.ZipFile(BytesIO(file_content)) as zip_ref:
433
- zip_ref.extractall(generator_dir)
435
+ for zip_info in zip_ref.filelist:
436
+ zip_info.filename = convert_model_label_path(zip_info.filename)
437
+ zip_ref.extract(zip_info, generator_dir)
438
+
434
439
  except zipfile.BadZipFile:
435
440
  raise HTTPException(status_code=400, detail="Invalid ZIP file")
436
441
 
@@ -514,8 +519,8 @@ class Routes:
514
519
  reports_dir = self.home_dir / "synthetic-datasets" / id / "ModelQAReports"
515
520
  else:
516
521
  reports_dir = self.home_dir / "synthetic-datasets" / id / "DataQAReports"
517
- fn = reports_dir / f"{table.name}:{modelType.lower()}.html"
518
- return HTMLResponse(content=fn.read_text())
522
+ fn = reports_dir / f"{get_model_label(table, modelType, path_safe=True)}.html"
523
+ return HTMLResponse(content=fn.read_text(encoding="utf-8"))
519
524
 
520
525
  @self.router.get("/synthetic-datasets/{id}/generation", response_model=JobProgress)
521
526
  async def get_generation_progress(id: str) -> JobProgress:
@@ -35,7 +35,7 @@ class LocalServer:
35
35
 
36
36
  Args:
37
37
  home_dir: The directory where the SDK stores its data. Defaults to `~/mostlyai`.
38
- port: The port to bind the server to. If `None`, a Unix Domain Socket (UDS) will be used. Defaults to `None`.
38
+ port: The port to bind the server to. If `None`, a Unix Domain Socket (UDS) will be used. Defaults to `None` on Unix and `8080` on Windows.
39
39
  """
40
40
 
41
41
  def __init__(
@@ -48,6 +48,8 @@ class LocalServer:
48
48
  # check read/write access to `home_dir`
49
49
  if not os.access(self.home_dir, os.R_OK) or not os.access(self.home_dir, os.W_OK):
50
50
  raise PermissionError(f"Cannot read/write to {self.home_dir}")
51
+ if port is None and os.name == "nt":
52
+ port = 8080 # use TCP by default on Windows
51
53
  self.port = port
52
54
  # binding to all interfaces (0.0.0.0) is required for docker use case
53
55
  self.host = "0.0.0.0" if port is not None else None
@@ -15,11 +15,48 @@
15
15
  import json
16
16
  from pathlib import Path
17
17
  import zipfile
18
+ import os
18
19
  from io import BytesIO
19
20
 
20
21
  from pydantic import BaseModel
21
22
  from filelock import FileLock
22
- from mostlyai.sdk.domain import Generator, JobProgress, Connector, SyntheticDataset
23
+ from mostlyai.sdk.domain import (
24
+ Generator,
25
+ JobProgress,
26
+ Connector,
27
+ SyntheticDataset,
28
+ SourceTable,
29
+ ModelType,
30
+ SyntheticTable,
31
+ )
32
+
33
+
34
+ def get_model_label(
35
+ table: str | SourceTable | SyntheticTable, model_type: str | ModelType, path_safe: bool = False
36
+ ) -> str:
37
+ """
38
+ The model label is the name of the table with the model type. It is used to identify the model uniquely within the file storage as well as in the job progress.
39
+
40
+ For usage in file storage, we need to ensure it's path safe. Therefore, we adapt the default infix from ":" to "=" on Windows environments.
41
+ """
42
+ table_name = table.name if isinstance(table, (SourceTable, SyntheticTable)) else str(table)
43
+ path_infix = "=" if path_safe and os.name == "nt" else ":"
44
+ model_type = model_type.name if isinstance(model_type, ModelType) else ModelType(str(model_type).upper()).name
45
+ return f"{table_name}{path_infix}{model_type}"
46
+
47
+
48
+ def convert_model_label_path(file_path: str) -> str:
49
+ """
50
+ Convert the model label to a OS-compatible valid file name.
51
+ """
52
+ if os.name == "nt":
53
+ before, after = ":", "="
54
+ else:
55
+ before, after = "=", ":"
56
+ if before in file_path:
57
+ for model_type in ModelType:
58
+ file_path = file_path.replace(f"{before}{model_type.name}", f"{after}{model_type.name}")
59
+ return file_path
23
60
 
24
61
 
25
62
  def read_generator_from_json(generator_dir: Path) -> Generator:
@@ -15,6 +15,7 @@ import shutil
15
15
  from pathlib import Path
16
16
 
17
17
  from mostlyai.sdk._local.storage import (
18
+ get_model_label,
18
19
  write_synthetic_dataset_to_json,
19
20
  write_job_progress_to_json,
20
21
  read_generator_from_json,
@@ -132,7 +133,7 @@ def create_synthetic_dataset(
132
133
  progress_steps.append(
133
134
  ProgressStep(
134
135
  task_type=TaskType.generate,
135
- model_label=f"{table.name}:{model_type.value.lower()}",
136
+ model_label=get_model_label(table, model_type),
136
137
  step_code=step,
137
138
  progress=ProgressValue(value=0, max=1),
138
139
  status=ProgressStatus.new,
@@ -17,6 +17,7 @@ from pathlib import Path
17
17
  from typing import Union, Any
18
18
  from collections.abc import Callable
19
19
  from urllib.parse import urlparse
20
+ from threading import Thread, Event
20
21
 
21
22
  import pandas as pd
22
23
  import rich
@@ -86,6 +87,73 @@ def validate_api_key(api_key: str) -> None:
86
87
  raise APIError("Invalid API key format.")
87
88
 
88
89
 
90
+ class _DynamicRefreshThread(Thread):
91
+ """A thread that calls live.refresh() at dynamic intervals, increasing the delay between refreshes over time.
92
+ The refresh interval stays at initial_interval for the first fixed_time seconds,
93
+ then gradually increases to max_interval over the next increasing_time seconds.
94
+ """
95
+
96
+ def __init__(
97
+ self,
98
+ live: "Live",
99
+ initial_interval: float = 2.0,
100
+ max_interval: float = 60.0,
101
+ fixed_time: float = 30.0,
102
+ increasing_time: float = 60.0,
103
+ ) -> None:
104
+ self.live = live
105
+ self.done = Event()
106
+ self.initial_interval = initial_interval
107
+ self.max_interval = max_interval
108
+ self.fixed_time = fixed_time
109
+ self.increasing_time = increasing_time
110
+ self.current_interval = initial_interval
111
+ self.start_time = None
112
+ super().__init__(daemon=True)
113
+
114
+ def stop(self) -> None:
115
+ self.done.set()
116
+
117
+ def _calculate_interval(self, elapsed_time: float) -> float:
118
+ if elapsed_time <= self.fixed_time:
119
+ return self.initial_interval
120
+ growth_factor = min(1.0, (elapsed_time - self.fixed_time) / self.increasing_time)
121
+ interval = self.initial_interval + growth_factor * (self.max_interval - self.initial_interval)
122
+ return min(interval, self.max_interval)
123
+
124
+ def run(self) -> None:
125
+ self.start_time = time.time()
126
+ while not self.done.is_set():
127
+ # calculate next interval based on elapsed time
128
+ elapsed_time = time.time() - self.start_time
129
+ self.current_interval = self._calculate_interval(elapsed_time)
130
+ # wait for the calculated interval or until stopped
131
+ if self.done.wait(self.current_interval):
132
+ break
133
+ # refresh the display if not stopped
134
+ with self.live._lock:
135
+ if not self.done.is_set():
136
+ self.live.refresh()
137
+
138
+
139
+ class _LiveWithDynamicRefresh(Live):
140
+ def __init__(self, *args, **kwargs):
141
+ # disable auto refresh implemented in the parent class
142
+ kwargs["auto_refresh"] = False
143
+ super().__init__(*args, **kwargs)
144
+
145
+ def start(self, refresh: bool = False) -> None:
146
+ super().start(refresh)
147
+ self._refresh_thread = _DynamicRefreshThread(self)
148
+ self._refresh_thread.start()
149
+
150
+ def stop(self) -> None:
151
+ if self._refresh_thread is not None:
152
+ self._refresh_thread.stop()
153
+ self._refresh_thread = None
154
+ return super().stop()
155
+
156
+
89
157
  def job_wait(
90
158
  get_progress: Callable,
91
159
  interval: float,
@@ -132,7 +200,7 @@ def job_wait(
132
200
  }
133
201
  layout = Table.grid(expand=True)
134
202
  layout.add_row(progress)
135
- live = Live(layout, refresh_per_second=1 / interval)
203
+ live = _LiveWithDynamicRefresh(layout)
136
204
  step_id_to_layout_idx = {}
137
205
 
138
206
  def _rich_table_delete_row(table: Table, idx: int = -1) -> Table:
@@ -412,7 +412,7 @@ class MostlyAI(_MostlyBaseClient):
412
412
  ```python
413
413
  # read original data
414
414
  import pandas as pd
415
- df = pd.read_csv('https://github.com/mostly-ai/public-demo-data/raw/dev/census/census.csv.gz')
415
+ df = pd.read_csv('https://github.com/mostly-ai/public-demo-data/raw/dev/census/census10k.parquet')
416
416
  # instantiate client
417
417
  from mostlyai.sdk import MostlyAI
418
418
  mostly = MostlyAI()
@@ -480,7 +480,7 @@ class MostlyAI(_MostlyBaseClient):
480
480
  ```python
481
481
  # read original data
482
482
  import pandas as pd
483
- df_purchases = pd.read_csv('https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev/cdnow/purchases.csv.gz')
483
+ df_purchases = pd.read_csv('https://github.com/mostly-ai/public-demo-data/raw/dev/cdnow/purchases.csv.gz')
484
484
  df_users = df_purchases[['users_id']].drop_duplicates()
485
485
  # instantiate client
486
486
  from mostlyai.sdk import MostlyAI
@@ -513,7 +513,7 @@ class MostlyAI(_MostlyBaseClient):
513
513
  ```python
514
514
  # read original data
515
515
  import pandas as pd
516
- df = pd.read_parquet('https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev/headlines/headlines.parquet')
516
+ df = pd.read_parquet('https://github.com/mostly-ai/public-demo-data/raw/dev/headlines/headlines.parquet')
517
517
 
518
518
  # instantiate SDK
519
519
  from mostlyai.sdk import MostlyAI
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  # generated by datamodel-codegen:
16
- # timestamp: 2025-04-04T06:15:03+00:00
16
+ # timestamp: 2025-04-06T17:09:17+00:00
17
17
 
18
18
  from __future__ import annotations
19
19
 
@@ -2999,10 +2999,7 @@ class Generator(CustomBaseModel):
2999
2999
  short_lived_file_token=(self.metadata.short_lived_file_token if self.metadata else None),
3000
3000
  )
3001
3001
 
3002
- if display:
3003
- if not rich.console._is_jupyter():
3004
- raise ValueError("Displaying reports is only supported in Jupyter notebooks.")
3005
-
3002
+ if display and rich.console._is_jupyter():
3006
3003
  import html # noqa
3007
3004
 
3008
3005
  from IPython.display import HTML, display # noqa
@@ -3023,6 +3020,8 @@ class Generator(CustomBaseModel):
3023
3020
  with zipfile.ZipFile(file_path, "w", zipfile.ZIP_DEFLATED) as zip_file:
3024
3021
  for filename, content in reports.items():
3025
3022
  zip_file.writestr(filename, content)
3023
+ if display:
3024
+ rich.print(f"Reports saved to {file_path}")
3026
3025
  return file_path
3027
3026
 
3028
3027
  class Training:
@@ -3321,10 +3320,7 @@ class SyntheticDataset(CustomBaseModel):
3321
3320
  short_lived_file_token=(self.metadata.short_lived_file_token if self.metadata else None),
3322
3321
  )
3323
3322
 
3324
- if display:
3325
- if not rich.console._is_jupyter():
3326
- raise ValueError("Displaying reports is only supported in Jupyter notebooks.")
3327
-
3323
+ if display and rich.console._is_jupyter():
3328
3324
  import html # noqa
3329
3325
 
3330
3326
  from IPython.display import HTML, display # noqa
@@ -3345,6 +3341,8 @@ class SyntheticDataset(CustomBaseModel):
3345
3341
  with zipfile.ZipFile(file_path, "w", zipfile.ZIP_DEFLATED) as zip_file:
3346
3342
  for filename, content in reports.items():
3347
3343
  zip_file.writestr(filename, content)
3344
+ if display:
3345
+ rich.print(f"Reports saved to {file_path}")
3348
3346
  return file_path
3349
3347
 
3350
3348
  class Generation:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mostlyai"
3
- version = "4.4.9"
3
+ version = "4.5.0"
4
4
  description = "Synthetic Data SDK"
5
5
  authors = [{ name = "MOSTLY AI", email = "dev@mostly.ai" }]
6
6
  requires-python = ">=3.10,<3.14"
@@ -38,8 +38,8 @@ dependencies = [
38
38
  "environs>=9.5.0",
39
39
  "schema>=0.7.5",
40
40
  "xxhash>=3.2.0",
41
- "greenlet>=3.1.1,<4",
42
- "pycryptodomex>=3.10.0,<4",
41
+ "greenlet>=3.1.1",
42
+ "pycryptodomex>=3.10.0",
43
43
  "ipywidgets>=8.1.0",
44
44
  "duckdb>=1.2.1",
45
45
  "sqlparse>=0.5.3",
@@ -48,14 +48,14 @@ dependencies = [
48
48
  [project.optional-dependencies]
49
49
  local = [
50
50
  # local
51
- "mostlyai-engine==1.1.12",
52
- "mostlyai-qa==1.5.14",
51
+ "mostlyai-engine==1.2.3",
52
+ "mostlyai-qa==1.5.16",
53
53
  "fastapi>=0.115.6,<0.116",
54
54
  "uvicorn>=0.34.0,<0.35",
55
55
  "python-multipart>=0.0.20",
56
- "torch==2.6.0; sys_platform == 'linux'", # pinned to 2.6.0 for vllm 0.8.0 compatibility
57
- "torchaudio==2.6.0; sys_platform == 'linux'", # pinned to 2.6.0 for vllm 0.8.0 compatibility
58
- "torchvision==0.21.0; sys_platform == 'linux'", # pinned to 0.21.0 for vllm 0.8.0 compatibility
56
+ "torch==2.6.0; sys_platform == 'linux'", # pinned to 2.6.0 for vllm 0.8.2 compatibility
57
+ "torchaudio==2.6.0; sys_platform == 'linux'", # pinned to 2.6.0 for vllm 0.8.2 compatibility
58
+ "torchvision==0.21.0; sys_platform == 'linux'", # pinned to 0.21.0 for vllm 0.8.2 compatibility
59
59
  "torch>=2.6.0,<2.7.0; sys_platform != 'linux'",
60
60
  "joblib>=1.4.2",
61
61
  "sqlalchemy>=2.0.0",
@@ -73,14 +73,14 @@ local = [
73
73
  "adlfs>=2023.4.0",
74
74
  ]
75
75
  local-gpu = [
76
- "mostlyai-engine[gpu]==1.1.12",
77
- "mostlyai-qa[gpu]==1.5.14",
76
+ "mostlyai-engine[gpu]==1.2.3",
77
+ "mostlyai-qa[gpu]==1.5.16",
78
78
  "fastapi>=0.115.6,<0.116",
79
79
  "uvicorn>=0.34.0,<0.35",
80
80
  "python-multipart>=0.0.20",
81
- "torch==2.6.0; sys_platform == 'linux'", # pinned to 2.6.0 for vllm 0.8.0 compatibility
82
- "torchaudio==2.6.0; sys_platform == 'linux'", # pinned to 2.6.0 for vllm 0.8.0 compatibility
83
- "torchvision==0.21.0; sys_platform == 'linux'", # pinned to 0.21.0 for vllm 0.8.0 compatibility
81
+ "torch==2.6.0; sys_platform == 'linux'", # pinned to 2.6.0 for vllm 0.8.2 compatibility
82
+ "torchaudio==2.6.0; sys_platform == 'linux'", # pinned to 2.6.0 for vllm 0.8.2 compatibility
83
+ "torchvision==0.21.0; sys_platform == 'linux'", # pinned to 0.21.0 for vllm 0.8.2 compatibility
84
84
  "torch>=2.6.0,<2.7.0; sys_platform != 'linux'",
85
85
  "joblib>=1.4.2",
86
86
  "sqlalchemy>=2.0.0",
@@ -98,8 +98,8 @@ local-gpu = [
98
98
  "adlfs>=2023.4.0",
99
99
  ]
100
100
  local-cpu = [
101
- "mostlyai-engine[cpu]==1.1.12",
102
- "mostlyai-qa[cpu]==1.5.14",
101
+ "mostlyai-engine[cpu]==1.2.3",
102
+ "mostlyai-qa[cpu]==1.5.16",
103
103
  "fastapi>=0.115.6,<0.116",
104
104
  "uvicorn>=0.34.0,<0.35",
105
105
  "python-multipart>=0.0.20",
File without changes
File without changes