glitchlings 0.2.5__cp312-cp312-macosx_11_0_universal2.whl → 0.2.6__cp312-cp312-macosx_11_0_universal2.whl
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.
- glitchlings/dlc/prime.py +18 -1
- glitchlings/zoo/core.py +12 -4
- glitchlings/zoo/redactyl.py +4 -1
- {glitchlings-0.2.5.dist-info → glitchlings-0.2.6.dist-info}/METADATA +2 -2
- {glitchlings-0.2.5.dist-info → glitchlings-0.2.6.dist-info}/RECORD +9 -9
- {glitchlings-0.2.5.dist-info → glitchlings-0.2.6.dist-info}/WHEEL +0 -0
- {glitchlings-0.2.5.dist-info → glitchlings-0.2.6.dist-info}/entry_points.txt +0 -0
- {glitchlings-0.2.5.dist-info → glitchlings-0.2.6.dist-info}/licenses/LICENSE +0 -0
- {glitchlings-0.2.5.dist-info → glitchlings-0.2.6.dist-info}/top_level.txt +0 -0
glitchlings/dlc/prime.py
CHANGED
@@ -49,7 +49,24 @@ def _resolve_columns(dataset: Dataset, columns: Sequence[str] | None) -> list[st
|
|
49
49
|
if candidate in available:
|
50
50
|
return [candidate]
|
51
51
|
|
52
|
-
|
52
|
+
try:
|
53
|
+
dataset_length = len(dataset) # type: ignore[arg-type]
|
54
|
+
except TypeError:
|
55
|
+
preview_rows: list[dict[str, Any]]
|
56
|
+
take_fn = getattr(dataset, "take", None)
|
57
|
+
if callable(take_fn):
|
58
|
+
preview_rows = list(take_fn(1))
|
59
|
+
else:
|
60
|
+
iterator = iter(dataset)
|
61
|
+
try:
|
62
|
+
first_row = next(iterator)
|
63
|
+
except StopIteration:
|
64
|
+
preview_rows = []
|
65
|
+
else:
|
66
|
+
preview_rows = [first_row]
|
67
|
+
sample = dict(preview_rows[0]) if preview_rows else {}
|
68
|
+
else:
|
69
|
+
sample = dataset[0] if dataset_length else {}
|
53
70
|
inferred = [
|
54
71
|
name
|
55
72
|
for name in dataset.column_names
|
glitchlings/zoo/core.py
CHANGED
@@ -27,17 +27,25 @@ log = logging.getLogger(__name__)
|
|
27
27
|
|
28
28
|
|
29
29
|
_PIPELINE_FEATURE_FLAG_ENV = "GLITCHLINGS_RUST_PIPELINE"
|
30
|
+
_PIPELINE_ENABLE_VALUES = {"1", "true", "yes", "on"}
|
31
|
+
_PIPELINE_DISABLE_VALUES = {"0", "false", "no", "off"}
|
30
32
|
|
31
33
|
|
32
34
|
def _pipeline_feature_flag_enabled() -> bool:
|
33
|
-
"""Return ``True`` when the environment explicitly
|
35
|
+
"""Return ``True`` when the environment does not explicitly disable the Rust pipeline."""
|
34
36
|
|
35
37
|
value = os.environ.get(_PIPELINE_FEATURE_FLAG_ENV)
|
36
38
|
if value is None:
|
37
|
-
return
|
39
|
+
return True
|
38
40
|
|
39
41
|
normalized = value.strip().lower()
|
40
|
-
|
42
|
+
if normalized in _PIPELINE_DISABLE_VALUES:
|
43
|
+
return False
|
44
|
+
|
45
|
+
if normalized in _PIPELINE_ENABLE_VALUES:
|
46
|
+
return True
|
47
|
+
|
48
|
+
return True
|
41
49
|
|
42
50
|
if TYPE_CHECKING: # pragma: no cover - typing only
|
43
51
|
from datasets import Dataset # type: ignore
|
@@ -356,7 +364,7 @@ class Gaggle(Glitchling):
|
|
356
364
|
|
357
365
|
@staticmethod
|
358
366
|
def rust_pipeline_enabled() -> bool:
|
359
|
-
"""Return ``True`` when the Rust pipeline is available and
|
367
|
+
"""Return ``True`` when the Rust pipeline is available and not explicitly disabled."""
|
360
368
|
|
361
369
|
return Gaggle.rust_pipeline_supported() and _pipeline_feature_flag_enabled()
|
362
370
|
|
glitchlings/zoo/redactyl.py
CHANGED
@@ -86,7 +86,10 @@ def _python_redact_words(
|
|
86
86
|
if core_length <= 0:
|
87
87
|
core_length = 1
|
88
88
|
weights.append(1.0 if unweighted else float(core_length))
|
89
|
-
|
89
|
+
raw_quota = len(word_indices) * rate
|
90
|
+
num_to_redact = int(raw_quota)
|
91
|
+
if rate > 0:
|
92
|
+
num_to_redact = max(1, num_to_redact)
|
90
93
|
if num_to_redact > len(word_indices):
|
91
94
|
raise ValueError("Sample larger than population or is negative")
|
92
95
|
indices_to_redact = _weighted_sample_without_replacement(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: glitchlings
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.6
|
4
4
|
Summary: Monsters for your language games.
|
5
5
|
Author: osoleve
|
6
6
|
License: Apache License
|
@@ -296,7 +296,7 @@ print(gaggle(SAMPLE_TEXT))
|
|
296
296
|
|
297
297
|
Consult the [Glitchlings Usage Guide](docs/index.md)
|
298
298
|
for end-to-end instructions spanning the Python API, CLI, HuggingFace and Prime Intellect
|
299
|
-
integrations, and the
|
299
|
+
integrations, and the autodetected Rust pipeline (enabled whenever the extension is present).
|
300
300
|
|
301
301
|
## Motivation
|
302
302
|
|
@@ -4,24 +4,24 @@ glitchlings/_zoo_rust.cpython-312-darwin.so,sha256=rk_0Xo2XvfLW0XpFH6c9mI4HSSzEF
|
|
4
4
|
glitchlings/main.py,sha256=u6969Vl0n47e3S-ZlYZBj3HWVsjs-hvW6RpF9RYuXnc,5931
|
5
5
|
glitchlings/dlc/__init__.py,sha256=eTLEEWrVWPqniXHqee4W23H1rjElI1PQ_jcqWFe9D3g,141
|
6
6
|
glitchlings/dlc/huggingface.py,sha256=I1QWanWVxO02awgSpHDtgQEVF-9AQRLtsta2RCitWhE,2933
|
7
|
-
glitchlings/dlc/prime.py,sha256=
|
7
|
+
glitchlings/dlc/prime.py,sha256=wpRMNtgka1vNlEzifeCjGMp1q_-QclZn3NxXczGnNpM,9278
|
8
8
|
glitchlings/util/__init__.py,sha256=7KiZ0gKMjocfd34cajneZhTqYb7Hkwi_PpjltPqvkNI,4498
|
9
9
|
glitchlings/zoo/__init__.py,sha256=pdQSiQjMCqnhrM3qSRvu98FJd-EyXLNNwvthnYSXpmM,4282
|
10
10
|
glitchlings/zoo/_ocr_confusions.py,sha256=MkCbwk9T24SO2pD3JNPajYCfpMMlm2vQ5_sJty5GoXE,1218
|
11
11
|
glitchlings/zoo/_rate.py,sha256=TMyfVFV7pLxSGVswPlOAtBvk25Bjtx5xXTtpb_utgik,527
|
12
|
-
glitchlings/zoo/core.py,sha256=
|
12
|
+
glitchlings/zoo/core.py,sha256=xLF9Op07KtMH0ql1-O7KyZ6lLESsdeNkvxdyiSOzhAc,14236
|
13
13
|
glitchlings/zoo/jargoyle.py,sha256=T6vPWBxceIPE6gOQ7BaihaqALOJwzXuhfiZzvKa4S50,10666
|
14
14
|
glitchlings/zoo/mim1c.py,sha256=yAt1ngR3j2KXLbzc8LhrQlIWRO_KT5dFK1EE8QivMAQ,3429
|
15
15
|
glitchlings/zoo/ocr_confusions.tsv,sha256=KhtR7vJDTITpfTSGa-I7RHr6CK7LkGi2KjdhEWipI6o,183
|
16
|
-
glitchlings/zoo/redactyl.py,sha256=
|
16
|
+
glitchlings/zoo/redactyl.py,sha256=wn7hxbtA0xMRuIXa6NNeeNOi0h0S8vh2bAa3x5Ec_Y0,6783
|
17
17
|
glitchlings/zoo/reduple.py,sha256=YNhTBH25XsXLeQD8xxXPE_JJMiCtmEpUFGGn36rd2tY,4857
|
18
18
|
glitchlings/zoo/rushmore.py,sha256=oG8MmMbrpmHH4rOp-NXkQznVlBCtSnrOttAZMdVlMkc,4729
|
19
19
|
glitchlings/zoo/scannequin.py,sha256=Ps8nxysKjkJV408zaL1kjVjy4jliATDBpYcNHLWbNFg,4859
|
20
20
|
glitchlings/zoo/typogre.py,sha256=xD02ldcMIA07XsdSts2bUniOc-k_DqTf0PBMaXGjLZE,6009
|
21
21
|
glitchlings/zoo/zeedub.py,sha256=D6rGk3O02OQ9jEIO9o0Ag-maVzNPN5O6qO3klG6Y62c,3552
|
22
|
-
glitchlings-0.2.
|
23
|
-
glitchlings-0.2.
|
24
|
-
glitchlings-0.2.
|
25
|
-
glitchlings-0.2.
|
26
|
-
glitchlings-0.2.
|
27
|
-
glitchlings-0.2.
|
22
|
+
glitchlings-0.2.6.dist-info/licenses/LICENSE,sha256=YCvGip-LoaRyu6h0nPo71q6eHEkzUpsE11psDJOIRkw,11337
|
23
|
+
glitchlings-0.2.6.dist-info/METADATA,sha256=5Xg6w5_-87bIRXY51i-nd7EmJMVPLtcBH_V3tj74CWI,26749
|
24
|
+
glitchlings-0.2.6.dist-info/WHEEL,sha256=o0zAoJUNILGJZxEeFPjb7OMHp_94eqIkZBeZ0gvgOpo,114
|
25
|
+
glitchlings-0.2.6.dist-info/entry_points.txt,sha256=kGOwuAsjFDLtztLisaXtOouq9wFVMOJg5FzaAkg-Hto,54
|
26
|
+
glitchlings-0.2.6.dist-info/top_level.txt,sha256=VHFNBrLjtDwPCYXbGKi6o17Eueedi81eNbR3hBOoST0,12
|
27
|
+
glitchlings-0.2.6.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|