glitchlings 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.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.
PKG-INFO DELETED
@@ -1,244 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: glitchlings
3
- Version: 0.1.0
4
- Summary: Monsters for your language games.
5
- Project-URL: Homepage, https://github.com/osoleve/glitchlings
6
- Project-URL: Repository, https://github.com/osoleve/glitchlings.git
7
- Project-URL: Issues, https://github.com/osoleve/glitchlings/issues
8
- Project-URL: Changelog, https://github.com/osoleve/glitchlings/releases
9
- Author: osoleve
10
- License: MIT License
11
-
12
- Copyright (c) 2025 osoleve
13
-
14
- Permission is hereby granted, free of charge, to any person obtaining a copy
15
- of this software and associated documentation files (the "Software"), to deal
16
- in the Software without restriction, including without limitation the rights
17
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
- copies of the Software, and to permit persons to whom the Software is
19
- furnished to do so, subject to the following conditions:
20
-
21
- The above copyright notice and this permission notice shall be included in all
22
- copies or substantial portions of the Software.
23
-
24
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
- SOFTWARE.
31
- License-File: LICENSE
32
- Keywords: adversarial,data,evaluation,glitch,nlp,text
33
- Classifier: Development Status :: 3 - Alpha
34
- Classifier: Intended Audience :: Developers
35
- Classifier: License :: OSI Approved :: MIT License
36
- Classifier: Operating System :: OS Independent
37
- Classifier: Programming Language :: Python
38
- Classifier: Programming Language :: Python :: 3
39
- Classifier: Programming Language :: Python :: 3.12
40
- Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
41
- Classifier: Topic :: Software Development :: Testing
42
- Requires-Python: >=3.12
43
- Requires-Dist: confusable-homoglyphs>=3.3.1
44
- Requires-Dist: datasets>=4.0.0
45
- Requires-Dist: jellyfish>=1.2.0
46
- Requires-Dist: nltk>=3.9.1
47
- Provides-Extra: dev
48
- Requires-Dist: pytest>=8.0.0; extra == 'dev'
49
- Provides-Extra: prime
50
- Requires-Dist: verifiers>=0.1.3.post0; extra == 'prime'
51
- Description-Content-Type: text/markdown
52
-
53
- #
54
-
55
- ```plaintext
56
- .─') _ .─') _
57
- ( OO) ) ( OO ) )
58
- ░██████ ░██ ░██ ░██ ░██ ░██ ░██
59
- ░██ ░██ ░██ ░██ ░██ ░██
60
- ░██ ░██ ░██░████████ ░███████ ░████████ ░██ ░██░████████ ░████████ ░███████
61
- ░██ █████ ░██ ░██ ░██ ░██('─.░██ ░██ ░██ ░██ ░██░██ ░██ ░██.─')░██ ░██
62
- ░██ ██ ░██ ░██ ░██ ░██( OO ) ╱░██ ░██ ░██ ░██░██ ░██ ░██(OO)░██ ░███████
63
- ░██ ░███ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██ o░███ ░██
64
- ░█████░█ ░██ ░██ ░████ ░███████ ░██ ░██ ░██ ░██░██ ░██ ░█████░██ ░███████
65
- ░██
66
- ░███████
67
-
68
- Every language game breeds monsters.
69
- ```
70
-
71
- `Glitchlings` are **utilities for corrupting the text inputs to your language models in deterministic, _linguistically principled_** ways.
72
- Each embodies a different way that documents can be compromised in the wild.
73
-
74
- If reinforcement learning environments are games, then `Glitchling`s are enemies to breathe new life into old challenges.
75
-
76
- They do this by breaking surface patterns in the input while keeping the target output intact.
77
-
78
- Some `Glitchling`s are petty nuisances. Some `Glitchling`s are eldritch horrors.
79
- Together, they create truly nightmarish scenarios for your language models.
80
-
81
- After all, what good is general intelligence if it can't handle a little chaos?
82
-
83
- -_The Curator_
84
-
85
- ## Quickstart
86
-
87
- ```python
88
- from glitchlings import summon, SAMPLE_TEXT
89
-
90
- gaggle = summon(["reduple", "mim1c", "typogre", "rushmore"])
91
- gaggle(SAMPLE_TEXT)
92
- ```
93
-
94
- > Onҽ m‎ھ‎rning, wһen Gregor Samƽa woke from trouble𝐝 𝑑reams, he found himself transformed in his bed into a horrible vermin‎٠‎ He l lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightlh domed and divided by arches ino stiff sections. The bedding was adly able to cover it and and seemed ready to slide off any moment. His many legxs, pitifully thin compared with the size of the the rest of him, waved about helplessly ashe looked looked.
95
-
96
- ## Motivation
97
-
98
- If your model performs well on a particular task, but not when `Glitchling`s are present, it's a sign that it hasn't actually generalized to the problem.
99
-
100
- Conversely, training a model to perform well in the presence of the types of perturbations introduced by `Glitchling`s should help it generalize better.
101
-
102
- ## Your First Battle
103
-
104
- Summon your chosen `Glitchling` (_or a few, if ya nasty_) and call it on your text or slot it into `Dataset.map(...)`, supplying a seed if desired.
105
- Some `Glitchling`s may have additional keyword arguments but they will always be optional with what I decide are "reasonable defaults".
106
- Seed defaults to 151, obviously.
107
-
108
- Calling a `Glitchling` on a `str` transparently calls `.corrupt(str, ...) -> str`.
109
- This means that as long as your glitchlings get along logically, they play nicely with one another.
110
-
111
- When summoned as a `Gaggle`, the `Glitchling`s will automatically order themselves into attack waves, based on the scope of the change they make:
112
-
113
- 1. Document
114
- 2. Paragraph
115
- 3. Sentence
116
- 4. Word
117
- 5. Character
118
-
119
- They're horrible little gremlins, but they're not _unreasonable_.
120
-
121
- ## Starter 'lings
122
-
123
- For maintainability reasons, all `Glitchling` have consented to be given nicknames once they're in your care. See the [Monster Manual](MONSTER_MANUAL.md) for a complete bestiary.
124
-
125
- ### Typogre
126
-
127
- _What a nice word, would be a shame if something happened to it._
128
-
129
- > _**Fatfinger.**_ Typogre introduces character-level errors (duplicating, dropping, adding, or swapping) based on the layout of a (currently QWERTY) keyboard.
130
- >
131
- > Args
132
- >
133
- > - `max_change_rate (float)`: The maximum number of edits to make as a percentage of the length (default: 0.02, 2%).
134
- > - `preserve_first_last (bool)`: Avoid editing the first and last character of a word (default: False).
135
- > - `keyboard (str)`: Keyboard layout key-neighbor map to use (default: "CURATOR_QWERTY").
136
- > - `seed (int)`: The random seed for reproducibility (default: 151).
137
-
138
- ### Mim1c
139
-
140
- _Wait, was that...?_
141
-
142
- > _**Confusion.**_ Mim1c replaces non-space characters with Unicode Confusables, characters that are distinct but would not usually confuse a human reader.
143
- >
144
- > Args
145
- >
146
- > - `replacement_rate (float)`: The maximum proportion of characters to replace (default: 0.02, 2%).
147
- > - `classes (list[str] | "all")`: Restrict replacements to these Unicode script classes (default: ["LATIN", "GREEK", "CYRILLIC"]).
148
- > - `seed (int)`: The random seed for reproducibility (default: 151).
149
-
150
- ### Scannequin
151
-
152
- _How can a computer need reading glasses?_
153
-
154
- > _**OCR Artifacts.**_ Scannequin mimics optical character recognition errors by swapping visually similar character sequences (like rn↔m, cl↔d, O↔0, l/I/1).
155
- >
156
- > Args
157
- >
158
- > - `error_rate (float)`: The maximum proportion of eligible confusion spans to replace (default: 0.02, 2%).
159
- > - `seed (int)`: The random seed for reproducibility (default: 151).
160
-
161
- ### Jargoyle
162
-
163
- _Uh oh. The worst person you know just bought a thesaurus._
164
-
165
- > _**Sesquipedalianism.**_ Jargoyle, the insufferable `Glitchling`, replaces nouns with synonyms at random, without regard for connotational or denotational differences.
166
- >
167
- > Args
168
- >
169
- > - `replacement_rate (float)`: The maximum proportion of words to replace (default: 0.1, 10%).
170
- > - `part_of_speech`: The WordNet part of speech to target (default: nouns). Accepts `wn.NOUN`, `wn.VERB`, `wn.ADJ`, or `wn.ADV`.
171
- > - `seed (int)`: The random seed for reproducibility (default: 151).
172
-
173
- ### Reduple
174
-
175
- _Did you say that or did I?_
176
-
177
- > _**Broken Record.**_ Reduple stutters through text by randomly reduplicating words. Like a nervous speaker, it creates natural repetitions that test a model's ability to handle redundancy without losing the thread.
178
- >
179
- > Args
180
- >
181
- > - `reduplication_rate (float)`: The maximum proportion of words to reduplicate (default: 0.05, 5%).
182
- > - `seed (int)`: The random seed for reproducibility (default: 151).
183
-
184
- ### Rushmore
185
-
186
- _I accidentally an entire word._
187
-
188
- > _**Hasty Omission.**_ The evil (?) twin of `reduple`, Rushmore moves with such frantic speed that it causes words to simply vanish from existence as it passes.
189
- >
190
- > Args
191
- >
192
- > - `max_deletion_rate (float)`: The maximum proportion of words to delete (default: 0.01, 1%).
193
- > - `seed (int)`: The random seed for reproducibility (default: 151).
194
-
195
- ### Redactyl
196
-
197
- _Oops, that was my black highlighter._
198
-
199
- > _**FOIA Reply.**_ Redactyl obscures random words in your document like an NSA analyst with a bad sense of humor.
200
- >
201
- > ### Args
202
- >
203
- > - `replacement_char (str)`: The character to use for redaction (default: █).
204
- > - `redaction_rate (float)`: The maximum proportion of words to redact (default: 0.05, 5%).
205
- > - `merge_adjacent (bool)`: Whether to redact the space between adjacent redacted words (default: False).
206
- > - `seed (int)`: The random seed for reproducibility (default: 151).
207
-
208
- ## Field Report: Uncontained Specimens
209
-
210
- ### _Containment procedures pending_
211
-
212
- - `ekkokin` substitutes words with homophones (phonetic equivalents).
213
- - `nylingual` backtranslates portions of text.
214
- - `glothopper` introduces code-switching effects, blending languages or dialects.
215
- - `palimpsest` rewrites, but leaves accidental traces of the past.
216
- - `vesuvius` is an apocryphal `Glitchling` with ties to _[Nosy, aren't we? -The Curator]_
217
-
218
- ## Apocrypha
219
-
220
- Cave paintings and oral tradition contain many depictions of strange, otherworldly `Glitchling`s.
221
- These _Apocryphal `Glitchling`_ are said to possess unique abilities or behaviors.
222
- If you encounter one of these elusive beings, please document your findings and share them with _The Curator_.
223
-
224
- ### Reproducible Corruption
225
-
226
- Every `Glitchling` owns its own independent `random.Random` instance. That means:
227
-
228
- - No `random.seed(...)` calls touch Python's global RNG.
229
- - Supplying a `seed` when you construct a `Glitchling` (or when you `summon(...)`) makes its behavior reproducible.
230
- - Re-running a `Gaggle` with the same master seed and the same input text (_and same external data!_) yields identical corruption output.
231
- - Corruption functions are written to accept an `rng` parameter internally so that all randomness is centralized and testable.
232
-
233
- #### Caveats
234
-
235
- - If you mutate a glitchling's parameters after you've used it (e.g. `typogre.set_param(...)`) the outputs may not be the same as before the change. So don't do that.
236
-
237
- #### At Wits' End?
238
-
239
- If you're trying to add a new glitchling and can't seem to make it deterministic, here are some places to look for determinism-breaking code:
240
-
241
- 1. Search for any direct calls to `random.choice`, `random.shuffle`, or `set(...)` ordering without going through the provided `rng`.
242
- 2. Ensure you sort collections before shuffling or sampling.
243
- 3. Make sure indices are chosen from a stable reference (e.g., original text) when applying length‑changing edits.
244
- 4. Make sure there are enough sort keys to maintain stability.
README.md DELETED
@@ -1,192 +0,0 @@
1
- #
2
-
3
- ```plaintext
4
- .─') _ .─') _
5
- ( OO) ) ( OO ) )
6
- ░██████ ░██ ░██ ░██ ░██ ░██ ░██
7
- ░██ ░██ ░██ ░██ ░██ ░██
8
- ░██ ░██ ░██░████████ ░███████ ░████████ ░██ ░██░████████ ░████████ ░███████
9
- ░██ █████ ░██ ░██ ░██ ░██('─.░██ ░██ ░██ ░██ ░██░██ ░██ ░██.─')░██ ░██
10
- ░██ ██ ░██ ░██ ░██ ░██( OO ) ╱░██ ░██ ░██ ░██░██ ░██ ░██(OO)░██ ░███████
11
- ░██ ░███ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██ o░███ ░██
12
- ░█████░█ ░██ ░██ ░████ ░███████ ░██ ░██ ░██ ░██░██ ░██ ░█████░██ ░███████
13
- ░██
14
- ░███████
15
-
16
- Every language game breeds monsters.
17
- ```
18
-
19
- `Glitchlings` are **utilities for corrupting the text inputs to your language models in deterministic, _linguistically principled_** ways.
20
- Each embodies a different way that documents can be compromised in the wild.
21
-
22
- If reinforcement learning environments are games, then `Glitchling`s are enemies to breathe new life into old challenges.
23
-
24
- They do this by breaking surface patterns in the input while keeping the target output intact.
25
-
26
- Some `Glitchling`s are petty nuisances. Some `Glitchling`s are eldritch horrors.
27
- Together, they create truly nightmarish scenarios for your language models.
28
-
29
- After all, what good is general intelligence if it can't handle a little chaos?
30
-
31
- -_The Curator_
32
-
33
- ## Quickstart
34
-
35
- ```python
36
- from glitchlings import summon, SAMPLE_TEXT
37
-
38
- gaggle = summon(["reduple", "mim1c", "typogre", "rushmore"])
39
- gaggle(SAMPLE_TEXT)
40
- ```
41
-
42
- > Onҽ m‎ھ‎rning, wһen Gregor Samƽa woke from trouble𝐝 𝑑reams, he found himself transformed in his bed into a horrible vermin‎٠‎ He l lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightlh domed and divided by arches ino stiff sections. The bedding was adly able to cover it and and seemed ready to slide off any moment. His many legxs, pitifully thin compared with the size of the the rest of him, waved about helplessly ashe looked looked.
43
-
44
- ## Motivation
45
-
46
- If your model performs well on a particular task, but not when `Glitchling`s are present, it's a sign that it hasn't actually generalized to the problem.
47
-
48
- Conversely, training a model to perform well in the presence of the types of perturbations introduced by `Glitchling`s should help it generalize better.
49
-
50
- ## Your First Battle
51
-
52
- Summon your chosen `Glitchling` (_or a few, if ya nasty_) and call it on your text or slot it into `Dataset.map(...)`, supplying a seed if desired.
53
- Some `Glitchling`s may have additional keyword arguments but they will always be optional with what I decide are "reasonable defaults".
54
- Seed defaults to 151, obviously.
55
-
56
- Calling a `Glitchling` on a `str` transparently calls `.corrupt(str, ...) -> str`.
57
- This means that as long as your glitchlings get along logically, they play nicely with one another.
58
-
59
- When summoned as a `Gaggle`, the `Glitchling`s will automatically order themselves into attack waves, based on the scope of the change they make:
60
-
61
- 1. Document
62
- 2. Paragraph
63
- 3. Sentence
64
- 4. Word
65
- 5. Character
66
-
67
- They're horrible little gremlins, but they're not _unreasonable_.
68
-
69
- ## Starter 'lings
70
-
71
- For maintainability reasons, all `Glitchling` have consented to be given nicknames once they're in your care. See the [Monster Manual](MONSTER_MANUAL.md) for a complete bestiary.
72
-
73
- ### Typogre
74
-
75
- _What a nice word, would be a shame if something happened to it._
76
-
77
- > _**Fatfinger.**_ Typogre introduces character-level errors (duplicating, dropping, adding, or swapping) based on the layout of a (currently QWERTY) keyboard.
78
- >
79
- > Args
80
- >
81
- > - `max_change_rate (float)`: The maximum number of edits to make as a percentage of the length (default: 0.02, 2%).
82
- > - `preserve_first_last (bool)`: Avoid editing the first and last character of a word (default: False).
83
- > - `keyboard (str)`: Keyboard layout key-neighbor map to use (default: "CURATOR_QWERTY").
84
- > - `seed (int)`: The random seed for reproducibility (default: 151).
85
-
86
- ### Mim1c
87
-
88
- _Wait, was that...?_
89
-
90
- > _**Confusion.**_ Mim1c replaces non-space characters with Unicode Confusables, characters that are distinct but would not usually confuse a human reader.
91
- >
92
- > Args
93
- >
94
- > - `replacement_rate (float)`: The maximum proportion of characters to replace (default: 0.02, 2%).
95
- > - `classes (list[str] | "all")`: Restrict replacements to these Unicode script classes (default: ["LATIN", "GREEK", "CYRILLIC"]).
96
- > - `seed (int)`: The random seed for reproducibility (default: 151).
97
-
98
- ### Scannequin
99
-
100
- _How can a computer need reading glasses?_
101
-
102
- > _**OCR Artifacts.**_ Scannequin mimics optical character recognition errors by swapping visually similar character sequences (like rn↔m, cl↔d, O↔0, l/I/1).
103
- >
104
- > Args
105
- >
106
- > - `error_rate (float)`: The maximum proportion of eligible confusion spans to replace (default: 0.02, 2%).
107
- > - `seed (int)`: The random seed for reproducibility (default: 151).
108
-
109
- ### Jargoyle
110
-
111
- _Uh oh. The worst person you know just bought a thesaurus._
112
-
113
- > _**Sesquipedalianism.**_ Jargoyle, the insufferable `Glitchling`, replaces nouns with synonyms at random, without regard for connotational or denotational differences.
114
- >
115
- > Args
116
- >
117
- > - `replacement_rate (float)`: The maximum proportion of words to replace (default: 0.1, 10%).
118
- > - `part_of_speech`: The WordNet part of speech to target (default: nouns). Accepts `wn.NOUN`, `wn.VERB`, `wn.ADJ`, or `wn.ADV`.
119
- > - `seed (int)`: The random seed for reproducibility (default: 151).
120
-
121
- ### Reduple
122
-
123
- _Did you say that or did I?_
124
-
125
- > _**Broken Record.**_ Reduple stutters through text by randomly reduplicating words. Like a nervous speaker, it creates natural repetitions that test a model's ability to handle redundancy without losing the thread.
126
- >
127
- > Args
128
- >
129
- > - `reduplication_rate (float)`: The maximum proportion of words to reduplicate (default: 0.05, 5%).
130
- > - `seed (int)`: The random seed for reproducibility (default: 151).
131
-
132
- ### Rushmore
133
-
134
- _I accidentally an entire word._
135
-
136
- > _**Hasty Omission.**_ The evil (?) twin of `reduple`, Rushmore moves with such frantic speed that it causes words to simply vanish from existence as it passes.
137
- >
138
- > Args
139
- >
140
- > - `max_deletion_rate (float)`: The maximum proportion of words to delete (default: 0.01, 1%).
141
- > - `seed (int)`: The random seed for reproducibility (default: 151).
142
-
143
- ### Redactyl
144
-
145
- _Oops, that was my black highlighter._
146
-
147
- > _**FOIA Reply.**_ Redactyl obscures random words in your document like an NSA analyst with a bad sense of humor.
148
- >
149
- > ### Args
150
- >
151
- > - `replacement_char (str)`: The character to use for redaction (default: █).
152
- > - `redaction_rate (float)`: The maximum proportion of words to redact (default: 0.05, 5%).
153
- > - `merge_adjacent (bool)`: Whether to redact the space between adjacent redacted words (default: False).
154
- > - `seed (int)`: The random seed for reproducibility (default: 151).
155
-
156
- ## Field Report: Uncontained Specimens
157
-
158
- ### _Containment procedures pending_
159
-
160
- - `ekkokin` substitutes words with homophones (phonetic equivalents).
161
- - `nylingual` backtranslates portions of text.
162
- - `glothopper` introduces code-switching effects, blending languages or dialects.
163
- - `palimpsest` rewrites, but leaves accidental traces of the past.
164
- - `vesuvius` is an apocryphal `Glitchling` with ties to _[Nosy, aren't we? -The Curator]_
165
-
166
- ## Apocrypha
167
-
168
- Cave paintings and oral tradition contain many depictions of strange, otherworldly `Glitchling`s.
169
- These _Apocryphal `Glitchling`_ are said to possess unique abilities or behaviors.
170
- If you encounter one of these elusive beings, please document your findings and share them with _The Curator_.
171
-
172
- ### Reproducible Corruption
173
-
174
- Every `Glitchling` owns its own independent `random.Random` instance. That means:
175
-
176
- - No `random.seed(...)` calls touch Python's global RNG.
177
- - Supplying a `seed` when you construct a `Glitchling` (or when you `summon(...)`) makes its behavior reproducible.
178
- - Re-running a `Gaggle` with the same master seed and the same input text (_and same external data!_) yields identical corruption output.
179
- - Corruption functions are written to accept an `rng` parameter internally so that all randomness is centralized and testable.
180
-
181
- #### Caveats
182
-
183
- - If you mutate a glitchling's parameters after you've used it (e.g. `typogre.set_param(...)`) the outputs may not be the same as before the change. So don't do that.
184
-
185
- #### At Wits' End?
186
-
187
- If you're trying to add a new glitchling and can't seem to make it deterministic, here are some places to look for determinism-breaking code:
188
-
189
- 1. Search for any direct calls to `random.choice`, `random.shuffle`, or `set(...)` ordering without going through the provided `rng`.
190
- 2. Ensure you sort collections before shuffling or sampling.
191
- 3. Make sure indices are chosen from a stable reference (e.g., original text) when applying length‑changing edits.
192
- 4. Make sure there are enough sort keys to maintain stability.
RELEASE.md DELETED
@@ -1,47 +0,0 @@
1
- # Releasing glitchlings to PyPI
2
-
3
- This project is configured to publish to PyPI via GitHub Actions when you push a version tag.
4
-
5
- ## 1) One-time setup
6
-
7
- - Decide publishing auth method:
8
- - Preferred: PyPI Trusted Publishing using OIDC. Enable it for the `glitchlings` project in PyPI and grant the GitHub repo `osoleve/glitchlings` permission.
9
- - Alternative: Create a PyPI token (scoped to the project) and add it as a repository secret `PYPI_API_TOKEN`.
10
- - (Optional) Add `TEST_PYPI_API_TOKEN` if you want automatic TestPyPI uploads on pushes to `trunk`.
11
-
12
- ## 2) Versioning
13
-
14
- - Update `version` in `pyproject.toml`.
15
- - Follow SemVer tags like `v0.1.1`.
16
-
17
- ## 3) Dry-run on TestPyPI (optional)
18
-
19
- - Push to `trunk`. If `TEST_PYPI_API_TOKEN` is set, a wheel and sdist will be uploaded to TestPyPI automatically.
20
-
21
- ## 4) Publish to PyPI
22
-
23
- - Create and push a tag from the repository root:
24
-
25
- ```pwsh
26
- git tag v0.1.1
27
- git push origin v0.1.1
28
- ```
29
-
30
- - The workflow `.github/workflows/publish.yml` will build the package from the `glitchlings/` directory and publish the artifacts to PyPI.
31
-
32
- ## 5) Verify
33
-
34
- - Check the run in GitHub Actions.
35
- - Verify the release on PyPI project page.
36
-
37
- ## Notes
38
-
39
- - The package uses Hatchling and includes a console script `glitchlings` that runs `glitchlings.main:main`.
40
- - Build locally:
41
-
42
- ```pwsh
43
- python -m pip install --upgrade build
44
- python -m build glitchlings
45
- ```
46
-
47
- - If adding new modules, ensure they live under the `glitchlings/` directory so they are included in the wheel.
__init__.py DELETED
@@ -1,73 +0,0 @@
1
- from .zoo import (
2
- typogre,
3
- mim1c,
4
- jargoyle,
5
- redactyl,
6
- reduple,
7
- rushmore,
8
- scannequin,
9
- Glitchling,
10
- Gaggle,
11
- summon,
12
- )
13
- from .util import SAMPLE_TEXT
14
-
15
-
16
- __all__ = [
17
- "typogre",
18
- "mim1c",
19
- "jargoyle",
20
- "reduple",
21
- "rushmore",
22
- "redactyl",
23
- "scannequin",
24
- "summon",
25
- "Glitchling",
26
- "Gaggle",
27
- "SAMPLE_TEXT",
28
- ]
29
-
30
-
31
- if __name__ == "__main__":
32
- # Example usage
33
- import verifiers as vf
34
- from openai import OpenAI
35
- from dlc import prime as gl
36
- from typing import cast
37
-
38
- openai = OpenAI()
39
-
40
- # redactyl.set_param("redaction_rate", 0.5)
41
- # jargoyle.set_param("replacement_rate", 0.25)
42
-
43
- # gaggle = summon(["reduple", "mim1c", "typogre", jargoyle, "rushmore", redactyl])
44
- # corrupted = gaggle(SAMPLE_TEXT)
45
- # print(SAMPLE_TEXT, end="\n\n")
46
- # print(gaggle.pretty_diff(SAMPLE_TEXT), end="\n\n")
47
- # print(corrupted)
48
-
49
- # env = load_environment("alphabet-sort")
50
- # x = env.evaluate(client=openai, model="gpt-4.1-nano", num_examples=100)
51
- # dx = env.make_dataset(x).to_dict()
52
- # print(sum(dx["weighted_reward"]))
53
-
54
- bare_env = vf.load_environment("alphabet-sort")
55
- x = bare_env.evaluate(client=openai, model="gpt-4.1-nano", num_examples=10)
56
- dx = cast(dict[str, list[float]], bare_env.make_dataset(x).to_dict()) # type: ignore
57
- original = 100 * sum(dx["reward"]) / max(1, len(dx["reward"]))
58
-
59
- easy_env = gl.load_environment("alphabet-sort")
60
- y = easy_env.evaluate(client=openai, model="gpt-4.1-nano", num_examples=10)
61
- dy = cast(dict[str, list[float]], easy_env.make_dataset(y).to_dict()) # type: ignore
62
- easy = 100 * sum(dy["reward"]) / max(1, len(dy["reward"]))
63
- easy_drop = 100 * (original - easy) / original
64
-
65
- crazy_env = gl.load_environment("alphabet-sort", CR=gl.CR.Four)
66
- z = crazy_env.evaluate(client=openai, model="gpt-4.1-nano", num_examples=10)
67
- dz = cast(dict[str, list[float]], crazy_env.make_dataset(z).to_dict()) # type: ignore
68
- crazy = 100 * sum(dz["reward"]) / max(1, len(dz["reward"]))
69
- crazy_drop = 100 * (original - crazy) / original
70
-
71
- print(f"Base Environment: {original:.1f}%")
72
- print(f"Glitchlings (CR 1): {easy:.1f}% ({easy_drop:.1f}% drop)")
73
- print(f"Glitchlings (CR 4): {crazy:.1f}% ({crazy_drop:.1f}% drop)")