mostlyai-engine 1.0.0__tar.gz → 1.0.2__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 (47) hide show
  1. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/PKG-INFO +24 -12
  2. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/README.md +14 -6
  3. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/__init__.py +3 -2
  4. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/training.py +2 -2
  5. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_tabular/training.py +2 -2
  6. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_workspace.py +0 -15
  7. mostlyai_engine-1.0.2/mostlyai/engine/logging.py +34 -0
  8. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/training.py +2 -2
  9. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/pyproject.toml +10 -6
  10. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/.gitignore +0 -0
  11. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/LICENSE +0 -0
  12. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_common.py +0 -0
  13. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_dtypes.py +0 -0
  14. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_encoding_types/__init__.py +0 -0
  15. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_encoding_types/language/__init__.py +0 -0
  16. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_encoding_types/language/text.py +0 -0
  17. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_encoding_types/tabular/__init__.py +0 -0
  18. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_encoding_types/tabular/categorical.py +0 -0
  19. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_encoding_types/tabular/character.py +0 -0
  20. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_encoding_types/tabular/datetime.py +0 -0
  21. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_encoding_types/tabular/itt.py +0 -0
  22. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_encoding_types/tabular/lat_long.py +0 -0
  23. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_encoding_types/tabular/numeric.py +0 -0
  24. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/__init__.py +0 -0
  25. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/common.py +0 -0
  26. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/encoding.py +0 -0
  27. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/engine/__init__.py +0 -0
  28. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/engine/base.py +0 -0
  29. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/engine/hf_engine.py +0 -0
  30. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/engine/vllm_engine.py +0 -0
  31. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/formatron_utils.py +0 -0
  32. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/generation.py +0 -0
  33. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/lstm.py +0 -0
  34. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_language/tokenizer_utils.py +0 -0
  35. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_memory.py +0 -0
  36. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_tabular/__init__.py +0 -0
  37. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_tabular/argn.py +0 -0
  38. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_tabular/common.py +0 -0
  39. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_tabular/encoding.py +0 -0
  40. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_tabular/fairness.py +0 -0
  41. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_tabular/generation.py +0 -0
  42. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/_training_utils.py +0 -0
  43. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/analysis.py +0 -0
  44. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/domain.py +0 -0
  45. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/encoding.py +0 -0
  46. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/generation.py +0 -0
  47. {mostlyai_engine-1.0.0 → mostlyai_engine-1.0.2}/mostlyai/engine/splitting.py +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai-engine
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Synthetic Data - Engine
5
- Project-URL: Homepage, https://github.com/mostly-ai/mostlyai-engine
6
- Project-URL: Documentation, https://mostly-ai.github.io/mostlyai-engine/
7
- Project-URL: Source, https://github.com/mostly-ai/mostlyai-engine
5
+ Project-URL: homepage, https://github.com/mostly-ai/mostlyai-engine
6
+ Project-URL: repository, https://github.com/mostly-ai/mostlyai-engine
7
+ Project-URL: documentation, https://mostly-ai.github.io/mostlyai-engine/
8
8
  Author-email: MOSTLY AI <dev@mostly.ai>
9
9
  License-Expression: Apache-2.0
10
10
  License-File: LICENSE
@@ -17,9 +17,13 @@ Classifier: Intended Audience :: Science/Research
17
17
  Classifier: Intended Audience :: Telecommunications Industry
18
18
  Classifier: License :: OSI Approved :: Apache Software License
19
19
  Classifier: Operating System :: OS Independent
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
20
24
  Classifier: Topic :: Software Development :: Libraries
21
25
  Classifier: Typing :: Typed
22
- Requires-Python: <3.13,>=3.10
26
+ Requires-Python: >=3.10
23
27
  Requires-Dist: accelerate<0.32,>=0.31.0
24
28
  Requires-Dist: datasets<3,>=2.20.0
25
29
  Requires-Dist: formatron<0.5,>=0.4.11
@@ -29,7 +33,7 @@ Requires-Dist: numpy<2,>=1.26.3
29
33
  Requires-Dist: opacus<2,>=1.5.2
30
34
  Requires-Dist: pandas~=2.2.0
31
35
  Requires-Dist: peft<0.12,>=0.11.1
32
- Requires-Dist: psutil<6,>=5.9.8
36
+ Requires-Dist: psutil<6,>=5.9.5
33
37
  Requires-Dist: pyarrow>=16.0.0
34
38
  Requires-Dist: rich<14,>=13.9.4
35
39
  Requires-Dist: setuptools<76,>=75.0.0
@@ -77,7 +81,7 @@ pip install -U mostlyai-engine
77
81
 
78
82
  or alternatively for a GPU setup:
79
83
  ```bash
80
- pip install -U mostlyai-engine[gpu]
84
+ pip install -U 'mostlyai-engine[gpu]'
81
85
  ```
82
86
 
83
87
 
@@ -90,8 +94,9 @@ from pathlib import Path
90
94
  import pandas as pd
91
95
  from mostlyai import engine
92
96
 
93
- # set up workspace
97
+ # set up workspace and default logging
94
98
  ws = Path("ws-tabular-flat")
99
+ engine.init_logging()
95
100
 
96
101
  # load original data
97
102
  url = "https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev/census"
@@ -105,7 +110,10 @@ engine.split( # split data as PQT files for `trn` + `val
105
110
  )
106
111
  engine.analyze(workspace_dir=ws) # generate column-level statistics to `{ws}/ModelData/tgt-stats/stats.json`
107
112
  engine.encode(workspace_dir=ws) # encode training data to `{ws}/OriginalData/encoded-data`
108
- engine.train(workspace_dir=ws) # train model and store to `{ws}/ModelData/model-data`
113
+ engine.train( # train model and store to `{ws}/ModelStore/model-data`
114
+ workspace_dir=ws,
115
+ max_training_time=1, # limit TRAIN to 1 minute for demo purposes
116
+ )
109
117
  engine.generate(workspace_dir=ws) # use model to generate synthetic samples to `{ws}/SyntheticData`
110
118
  pd.read_parquet(ws / "SyntheticData") # load synthetic data
111
119
  ```
@@ -117,8 +125,11 @@ from pathlib import Path
117
125
  import pandas as pd
118
126
  from mostlyai import engine
119
127
 
120
- # set up workspace
128
+ engine.init_logging()
129
+
130
+ # set up workspace and default logging
121
131
  ws = Path("ws-tabular-sequential")
132
+ engine.init_logging()
122
133
 
123
134
  # load original data
124
135
  url = "https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev/baseball"
@@ -138,7 +149,7 @@ engine.analyze(workspace_dir=ws) # generate column-level statistics to `{ws
138
149
  engine.encode(workspace_dir=ws) # encode training data to `{ws}/OriginalData/encoded-data`
139
150
  engine.train( # train model and store to `{ws}/ModelStore/model-data`
140
151
  workspace_dir=ws,
141
- max_training_time=2, # limit TRAIN to 1 minute for demo purposes
152
+ max_training_time=1, # limit TRAIN to 1 minute for demo purposes
142
153
  )
143
154
  engine.generate(workspace_dir=ws) # use model to generate synthetic samples to `{ws}/SyntheticData`
144
155
  pd.read_parquet(ws / "SyntheticData") # load synthetic data
@@ -151,8 +162,9 @@ from pathlib import Path
151
162
  import pandas as pd
152
163
  from mostlyai import engine
153
164
 
154
- # set up workspace
165
+ # init workspace and logging
155
166
  ws = Path("ws-language-flat")
167
+ engine.init_logging()
156
168
 
157
169
  # load original data
158
170
  trn_df = pd.read_parquet("https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev/headlines/headlines.parquet")
@@ -30,7 +30,7 @@ pip install -U mostlyai-engine
30
30
 
31
31
  or alternatively for a GPU setup:
32
32
  ```bash
33
- pip install -U mostlyai-engine[gpu]
33
+ pip install -U 'mostlyai-engine[gpu]'
34
34
  ```
35
35
 
36
36
 
@@ -43,8 +43,9 @@ from pathlib import Path
43
43
  import pandas as pd
44
44
  from mostlyai import engine
45
45
 
46
- # set up workspace
46
+ # set up workspace and default logging
47
47
  ws = Path("ws-tabular-flat")
48
+ engine.init_logging()
48
49
 
49
50
  # load original data
50
51
  url = "https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev/census"
@@ -58,7 +59,10 @@ engine.split( # split data as PQT files for `trn` + `val
58
59
  )
59
60
  engine.analyze(workspace_dir=ws) # generate column-level statistics to `{ws}/ModelData/tgt-stats/stats.json`
60
61
  engine.encode(workspace_dir=ws) # encode training data to `{ws}/OriginalData/encoded-data`
61
- engine.train(workspace_dir=ws) # train model and store to `{ws}/ModelData/model-data`
62
+ engine.train( # train model and store to `{ws}/ModelStore/model-data`
63
+ workspace_dir=ws,
64
+ max_training_time=1, # limit TRAIN to 1 minute for demo purposes
65
+ )
62
66
  engine.generate(workspace_dir=ws) # use model to generate synthetic samples to `{ws}/SyntheticData`
63
67
  pd.read_parquet(ws / "SyntheticData") # load synthetic data
64
68
  ```
@@ -70,8 +74,11 @@ from pathlib import Path
70
74
  import pandas as pd
71
75
  from mostlyai import engine
72
76
 
73
- # set up workspace
77
+ engine.init_logging()
78
+
79
+ # set up workspace and default logging
74
80
  ws = Path("ws-tabular-sequential")
81
+ engine.init_logging()
75
82
 
76
83
  # load original data
77
84
  url = "https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev/baseball"
@@ -91,7 +98,7 @@ engine.analyze(workspace_dir=ws) # generate column-level statistics to `{ws
91
98
  engine.encode(workspace_dir=ws) # encode training data to `{ws}/OriginalData/encoded-data`
92
99
  engine.train( # train model and store to `{ws}/ModelStore/model-data`
93
100
  workspace_dir=ws,
94
- max_training_time=2, # limit TRAIN to 1 minute for demo purposes
101
+ max_training_time=1, # limit TRAIN to 1 minute for demo purposes
95
102
  )
96
103
  engine.generate(workspace_dir=ws) # use model to generate synthetic samples to `{ws}/SyntheticData`
97
104
  pd.read_parquet(ws / "SyntheticData") # load synthetic data
@@ -104,8 +111,9 @@ from pathlib import Path
104
111
  import pandas as pd
105
112
  from mostlyai import engine
106
113
 
107
- # set up workspace
114
+ # init workspace and logging
108
115
  ws = Path("ws-language-flat")
116
+ engine.init_logging()
109
117
 
110
118
  # load original data
111
119
  trn_df = pd.read_parquet("https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev/headlines/headlines.parquet")
@@ -13,6 +13,7 @@
13
13
  # limitations under the License.
14
14
  import warnings
15
15
 
16
+ from mostlyai.engine.logging import init_logging
16
17
  from mostlyai.engine.splitting import split
17
18
  from mostlyai.engine.analysis import analyze
18
19
  from mostlyai.engine.training import train
@@ -20,8 +21,8 @@ from mostlyai.engine.encoding import encode
20
21
  from mostlyai.engine.generation import generate
21
22
 
22
23
 
23
- __all__ = ["split", "analyze", "encode", "train", "generate"]
24
- __version__ = "1.0.0"
24
+ __all__ = ["split", "analyze", "encode", "train", "generate", "init_logging"]
25
+ __version__ = "1.0.2"
25
26
 
26
27
  # suppress specific warning related to os.fork() in multi-threaded processes
27
28
  warnings.filterwarnings("ignore", category=DeprecationWarning, message=".*multi-threaded.*fork.*")
@@ -197,8 +197,8 @@ def _calculate_val_loss(model: PreTrainedModel | GradSampleModule, val_dataloade
197
197
  def train(
198
198
  *,
199
199
  model: str = "MOSTLY_AI/LSTMFromScratch-3m",
200
- max_training_time: float = 60.0,
201
- max_epochs: float = 100.0,
200
+ max_training_time: float = 14400.0, # 10 days
201
+ max_epochs: float = 100.0, # 100 epochs
202
202
  batch_size: int | None = None,
203
203
  gradient_accumulation_steps: int | None = None,
204
204
  enable_flexible_generation: bool = True,
@@ -339,8 +339,8 @@ def _calculate_average_trn_loss(trn_sample_losses: list[torch.Tensor], n: int |
339
339
  def train(
340
340
  *,
341
341
  model: str = "MOSTLY_AI/Medium",
342
- max_training_time: float = 60.0,
343
- max_epochs: float = 100.0,
342
+ max_training_time: float = 14400.0, # 10 days
343
+ max_epochs: float = 100.0, # 100 epochs
344
344
  batch_size: int | None = None,
345
345
  gradient_accumulation_steps: int | None = None,
346
346
  max_sequence_window: int = 100,
@@ -168,21 +168,6 @@ class Workspace:
168
168
  self.generated_data_path = Path(self._ws_path) / Path(*generated_data)
169
169
  self.generated_data = make_path_desc(parts=generated_data, fetch_multiple=fetch_part_parquets)
170
170
 
171
- # Report-related
172
- self.report_ctx_data_path = self._ws_path / "report-ctx-data"
173
- self.report_ctx_data = make_path_desc(
174
- parts=["report-ctx-data"],
175
- fetch_multiple=fetch_part_parquets,
176
- )
177
- self.report_trn_ctx_data = make_path_desc(
178
- parts=["report-ctx-data"],
179
- fetch_multiple=fetch_part_trn_parquets,
180
- )
181
- self.report_val_ctx_data = make_path_desc(
182
- parts=["report-ctx-data"],
183
- fetch_multiple=fetch_part_val_parquets,
184
- )
185
-
186
171
 
187
172
  def ensure_workspace_dir(workspace_dir: str | Path) -> Path:
188
173
  workspace_dir = Path(workspace_dir)
@@ -0,0 +1,34 @@
1
+ # Copyright 2025 MOSTLY AI
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ import sys
16
+ import logging
17
+
18
+ _LOG = logging.getLogger(__name__.rsplit(".", 1)[0]) # get the logger with the root module name (mostlyai.engine)
19
+
20
+
21
+ def init_logging() -> None:
22
+ """
23
+ Initialize the logging configuration. Either log to stdout or to a file.
24
+ """
25
+
26
+ # log to stdout
27
+ handler = logging.StreamHandler(stream=sys.stdout)
28
+ handler.setFormatter(logging.Formatter("[%(asctime)s] %(levelname)-7s: %(message)s"))
29
+ handler.setLevel(logging.INFO)
30
+
31
+ if not _LOG.hasHandlers():
32
+ _LOG.addHandler(handler)
33
+ _LOG.setLevel(logging.INFO)
34
+ _LOG.propagate = False
@@ -26,8 +26,8 @@ from mostlyai.engine._workspace import resolve_model_type
26
26
  def train(
27
27
  *,
28
28
  model: str | None = None,
29
- max_training_time: float = 60.0,
30
- max_epochs: float = 100.0,
29
+ max_training_time: float = 14400.0, # 10 days
30
+ max_epochs: float = 100.0, # 100 epochs
31
31
  batch_size: int | None = None,
32
32
  gradient_accumulation_steps: int | None = None,
33
33
  enable_flexible_generation: bool = True,
@@ -1,9 +1,9 @@
1
1
  [project]
2
2
  name = "mostlyai-engine"
3
- version = "1.0.0"
3
+ version = "1.0.2"
4
4
  description = "Synthetic Data - Engine"
5
5
  authors = [{ name = "MOSTLY AI", email = "dev@mostly.ai" }]
6
- requires-python = ">=3.10,<3.13"
6
+ requires-python = ">=3.10"
7
7
  readme = "README.md"
8
8
  license = "Apache-2.0"
9
9
  classifiers = [
@@ -14,6 +14,10 @@ classifiers = [
14
14
  "Intended Audience :: Financial and Insurance Industry",
15
15
  "Intended Audience :: Healthcare Industry",
16
16
  "Intended Audience :: Telecommunications Industry",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.13",
17
21
  "License :: OSI Approved :: Apache Software License",
18
22
  "Operating System :: OS Independent",
19
23
  "Topic :: Software Development :: Libraries",
@@ -27,7 +31,7 @@ dependencies = [
27
31
  "torch==2.5.1; sys_platform == 'darwin'",
28
32
  "pyarrow>=16.0.0",
29
33
  "joblib>=1.3.0,<2",
30
- "psutil>=5.9.8,<6",
34
+ "psutil>=5.9.5,<6", # upgrade when colab psutil is updated
31
35
  "tokenizers>=0.20.1,<0.21",
32
36
  "transformers>=4.45.2,<5",
33
37
  "datasets>=2.20.0,<3",
@@ -69,9 +73,9 @@ docs = [
69
73
  ]
70
74
 
71
75
  [project.urls]
72
- Homepage = "https://github.com/mostly-ai/mostlyai-engine"
73
- Documentation = "https://mostly-ai.github.io/mostlyai-engine/"
74
- Source = "https://github.com/mostly-ai/mostlyai-engine"
76
+ homepage = "https://github.com/mostly-ai/mostlyai-engine"
77
+ repository = "https://github.com/mostly-ai/mostlyai-engine"
78
+ documentation = "https://mostly-ai.github.io/mostlyai-engine/"
75
79
 
76
80
  [tool.uv]
77
81
  default-groups = ["test", "dev", "docs"]
File without changes