mostlyai-engine 1.1.4__tar.gz → 1.1.6__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_engine-1.1.4 → mostlyai_engine-1.1.6}/PKG-INFO +13 -6
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/README.md +8 -3
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/__init__.py +1 -1
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/generation.py +14 -12
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/pyproject.toml +5 -3
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/.gitignore +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/LICENSE +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_common.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_dtypes.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/__init__.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/language/__init__.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/language/categorical.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/language/datetime.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/language/numeric.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/language/text.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/__init__.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/categorical.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/character.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/datetime.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/itt.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/lat_long.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/numeric.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/__init__.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/common.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/encoding.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/engine/__init__.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/engine/base.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/engine/hf_engine.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/engine/vllm_engine.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/formatron_utils.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/lstm.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/tokenizer_utils.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/training.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_memory.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_tabular/__init__.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_tabular/argn.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_tabular/common.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_tabular/encoding.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_tabular/fairness.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_tabular/generation.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_tabular/training.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_training_utils.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_workspace.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/analysis.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/domain.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/encoding.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/generation.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/logging.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/splitting.py +0 -0
- {mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/training.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mostlyai-engine
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.6
|
|
4
4
|
Summary: Synthetic Data Engine
|
|
5
5
|
Project-URL: homepage, https://github.com/mostly-ai/mostlyai-engine
|
|
6
6
|
Project-URL: repository, https://github.com/mostly-ai/mostlyai-engine
|
|
@@ -45,15 +45,22 @@ Provides-Extra: cpu
|
|
|
45
45
|
Requires-Dist: torch==2.5.1+cpu; (sys_platform == 'linux') and extra == 'cpu'
|
|
46
46
|
Requires-Dist: torch>=2.5.1; (sys_platform != 'linux') and extra == 'cpu'
|
|
47
47
|
Provides-Extra: gpu
|
|
48
|
-
Requires-Dist: bitsandbytes<0.
|
|
48
|
+
Requires-Dist: bitsandbytes<0.43,>=0.42.0; (sys_platform == 'darwin') and extra == 'gpu'
|
|
49
|
+
Requires-Dist: bitsandbytes<0.44,>=0.43.3; (sys_platform == 'linux') and extra == 'gpu'
|
|
49
50
|
Requires-Dist: torch>=2.5.1; extra == 'gpu'
|
|
50
|
-
Requires-Dist: vllm<0.
|
|
51
|
+
Requires-Dist: vllm<0.7.3,>=0.7.2; (sys_platform == 'linux') and extra == 'gpu'
|
|
52
|
+
Requires-Dist: vllm<0.8,>=0.7.3; (sys_platform == 'darwin') and extra == 'gpu'
|
|
51
53
|
Description-Content-Type: text/markdown
|
|
52
54
|
|
|
53
55
|
# Synthetic Data Engine 💎
|
|
54
|
-
[](https://mostly-ai.github.io/mostlyai-engine/)    [](https://pypi.org/project/mostlyai-engine/)
|
|
55
56
|
|
|
56
|
-
[
|
|
57
|
+

|
|
58
|
+
[](https://mostly-ai.github.io/mostlyai-engine/)
|
|
59
|
+
[](https://pypi.org/project/mostlyai-engine/)
|
|
60
|
+

|
|
61
|
+

|
|
62
|
+
|
|
63
|
+
[Documentation](https://mostly-ai.github.io/mostlyai-engine/) | [Technical Paper](https://arxiv.org/abs/2501.12012) | [Free Cloud Service](https://app.mostly.ai/)
|
|
57
64
|
|
|
58
65
|
Create high-fidelity privacy-safe synthetic data:
|
|
59
66
|
|
|
@@ -69,7 +76,7 @@ Create high-fidelity privacy-safe synthetic data:
|
|
|
69
76
|
|
|
70
77
|
...all within your safe compute environment, all with a few lines of Python code 💥.
|
|
71
78
|
|
|
72
|
-
Note: This library is the underlying model engine of the [Synthetic Data SDK
|
|
79
|
+
Note: This library is the underlying model engine of the [Synthetic Data SDK](https://github.com/mostly-ai/mostlyai). Please refer to the latter, for an easy-to-use, higher-level software toolkit.
|
|
73
80
|
|
|
74
81
|
|
|
75
82
|
## Installation
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
# Synthetic Data Engine 💎
|
|
2
|
-
[](https://mostly-ai.github.io/mostlyai-engine/)    [](https://pypi.org/project/mostlyai-engine/)
|
|
3
2
|
|
|
4
|
-
[
|
|
3
|
+

|
|
4
|
+
[](https://mostly-ai.github.io/mostlyai-engine/)
|
|
5
|
+
[](https://pypi.org/project/mostlyai-engine/)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
[Documentation](https://mostly-ai.github.io/mostlyai-engine/) | [Technical Paper](https://arxiv.org/abs/2501.12012) | [Free Cloud Service](https://app.mostly.ai/)
|
|
5
10
|
|
|
6
11
|
Create high-fidelity privacy-safe synthetic data:
|
|
7
12
|
|
|
@@ -17,7 +22,7 @@ Create high-fidelity privacy-safe synthetic data:
|
|
|
17
22
|
|
|
18
23
|
...all within your safe compute environment, all with a few lines of Python code 💥.
|
|
19
24
|
|
|
20
|
-
Note: This library is the underlying model engine of the [Synthetic Data SDK
|
|
25
|
+
Note: This library is the underlying model engine of the [Synthetic Data SDK](https://github.com/mostly-ai/mostlyai). Please refer to the latter, for an easy-to-use, higher-level software toolkit.
|
|
21
26
|
|
|
22
27
|
|
|
23
28
|
## Installation
|
|
@@ -22,7 +22,7 @@ from mostlyai.engine.generation import generate
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
__all__ = ["split", "analyze", "encode", "train", "generate", "init_logging"]
|
|
25
|
-
__version__ = "1.1.
|
|
25
|
+
__version__ = "1.1.6"
|
|
26
26
|
|
|
27
27
|
# suppress specific warning related to os.fork() in multi-threaded processes
|
|
28
28
|
warnings.filterwarnings("ignore", category=DeprecationWarning, message=".*multi-threaded.*fork.*")
|
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
import contextlib
|
|
16
|
+
import importlib
|
|
16
17
|
import json
|
|
17
18
|
import os
|
|
19
|
+
import platform
|
|
18
20
|
|
|
19
21
|
import json_repair
|
|
20
22
|
import logging
|
|
@@ -23,7 +25,6 @@ from pathlib import Path
|
|
|
23
25
|
|
|
24
26
|
import pandas as pd
|
|
25
27
|
import torch
|
|
26
|
-
from huggingface_hub import constants as hf_constants
|
|
27
28
|
from transformers import (
|
|
28
29
|
PreTrainedTokenizerBase,
|
|
29
30
|
)
|
|
@@ -101,15 +102,10 @@ def decode_buffered_samples(
|
|
|
101
102
|
tgt_data = tgt_data.map(
|
|
102
103
|
lambda x: x.encode("utf-8", errors="surrogatepass").decode("utf-8", errors="replace") if not pd.isna(x) else x
|
|
103
104
|
)
|
|
104
|
-
# overwrite generated columns with the seeded values
|
|
105
|
-
tgt_data.update(tgt_seed)
|
|
106
105
|
|
|
107
106
|
# prepend the context keys to the data (if not dummy context)
|
|
108
107
|
if ctx_keys.name != DUMMY_CONTEXT_KEY:
|
|
109
108
|
tgt_data = pd.concat([ctx_keys, tgt_data], axis=1)
|
|
110
|
-
invalid_percentage = ((tgt_data[tgt_stats["columns"].keys()] == INVALID_VALUE).sum() / len(tgt_data) * 100.0).map(
|
|
111
|
-
"{:.2f}%".format
|
|
112
|
-
)
|
|
113
109
|
|
|
114
110
|
for col in tgt_stats["columns"].keys():
|
|
115
111
|
col_stats = tgt_stats["columns"][col]
|
|
@@ -122,6 +118,12 @@ def decode_buffered_samples(
|
|
|
122
118
|
else:
|
|
123
119
|
tgt_data[col] = decode_text(tgt_data[col], col_stats)
|
|
124
120
|
|
|
121
|
+
# overwrite generated columns with the seeded values
|
|
122
|
+
tgt_data.update(tgt_seed)
|
|
123
|
+
|
|
124
|
+
invalid_percentage = ((tgt_data[tgt_stats["columns"].keys()] == INVALID_VALUE).sum() / len(tgt_data) * 100.0).map(
|
|
125
|
+
"{:.2f}%".format
|
|
126
|
+
)
|
|
125
127
|
_LOG.info(f"percentage of invalid values: {invalid_percentage.to_dict()}")
|
|
126
128
|
_LOG.info(f"decoded {tgt_data.shape} from {len(buffer.buffer)} batches in {time.time() - t0:.2f}s")
|
|
127
129
|
return tgt_data
|
|
@@ -236,14 +238,14 @@ def generate(
|
|
|
236
238
|
_LOG.info(f"{max_new_tokens=}")
|
|
237
239
|
|
|
238
240
|
t0 = time.time()
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
# set the default env var so that we don't pass it explicitly to vLLM
|
|
243
|
-
os.environ["HF_TOKEN"] = os.getenv("MOSTLY_HUGGING_FACE_TOKEN") or os.getenv("HF_TOKEN", "")
|
|
241
|
+
# use MOSTLY_HUGGING_FACE_TOKEN if available, otherwise HF_TOKEN should be unset or with a pre-set value as is
|
|
242
|
+
if os.getenv("MOSTLY_HUGGING_FACE_TOKEN"):
|
|
243
|
+
os.environ["HF_TOKEN"] = os.environ["MOSTLY_HUGGING_FACE_TOKEN"]
|
|
244
244
|
|
|
245
245
|
is_peft_adapter = (workspace.model_path / "adapter_config.json").exists()
|
|
246
|
-
if is_peft_adapter and
|
|
246
|
+
if is_peft_adapter and (
|
|
247
|
+
device.type == "cuda" or (platform.system() == "Darwin" and importlib.util.find_spec("vllm") is not None)
|
|
248
|
+
):
|
|
247
249
|
from mostlyai.engine._language.engine.vllm_engine import VLLMEngine
|
|
248
250
|
|
|
249
251
|
engine = VLLMEngine(workspace.model_path, device, max_new_tokens, MAX_LENGTH)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mostlyai-engine"
|
|
3
|
-
version = "1.1.
|
|
3
|
+
version = "1.1.6"
|
|
4
4
|
description = "Synthetic Data Engine"
|
|
5
5
|
authors = [{ name = "MOSTLY AI", email = "dev@mostly.ai" }]
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -47,8 +47,10 @@ dependencies = [
|
|
|
47
47
|
[project.optional-dependencies]
|
|
48
48
|
gpu = [
|
|
49
49
|
"torch>=2.5.1",
|
|
50
|
-
"bitsandbytes>=0.
|
|
51
|
-
"vllm>=0.7.
|
|
50
|
+
"bitsandbytes>=0.42.0,<0.43; sys_platform == 'darwin'",
|
|
51
|
+
"vllm>=0.7.3,<0.8; sys_platform == 'darwin'",
|
|
52
|
+
"bitsandbytes>=0.43.3,<0.44; sys_platform == 'linux'",
|
|
53
|
+
"vllm>=0.7.2,<0.7.3; sys_platform == 'linux'",
|
|
52
54
|
]
|
|
53
55
|
cpu = [
|
|
54
56
|
"torch==2.5.1+cpu; sys_platform == 'linux'",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/language/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/language/datetime.py
RENAMED
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/language/numeric.py
RENAMED
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/language/text.py
RENAMED
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/character.py
RENAMED
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/datetime.py
RENAMED
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/itt.py
RENAMED
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/lat_long.py
RENAMED
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_encoding_types/tabular/numeric.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/engine/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/engine/hf_engine.py
RENAMED
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/engine/vllm_engine.py
RENAMED
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/formatron_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{mostlyai_engine-1.1.4 → mostlyai_engine-1.1.6}/mostlyai/engine/_language/tokenizer_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|