torobi 0.1.0

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 (101) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +71 -0
  3. data/Cargo.lock +539 -0
  4. data/Cargo.toml +6 -0
  5. data/LICENSE +21 -0
  6. data/README.md +259 -0
  7. data/config/ops.yml +230 -0
  8. data/docs/plan.md +3982 -0
  9. data/docs/vendoring.md +656 -0
  10. data/engine/Cargo.toml +35 -0
  11. data/engine/build.rs +253 -0
  12. data/engine/src/checkpoint.rs +513 -0
  13. data/engine/src/executor.rs +257 -0
  14. data/engine/src/export.rs +431 -0
  15. data/engine/src/fixtures.rs +518 -0
  16. data/engine/src/graph.rs +115 -0
  17. data/engine/src/init.rs +65 -0
  18. data/engine/src/interp.rs +985 -0
  19. data/engine/src/lib.rs +62 -0
  20. data/engine/src/main.rs +97 -0
  21. data/engine/src/memory.rs +109 -0
  22. data/engine/src/mlxc/array.rs +454 -0
  23. data/engine/src/mlxc/error.rs +205 -0
  24. data/engine/src/mlxc/fast.rs +46 -0
  25. data/engine/src/mlxc/handle.rs +155 -0
  26. data/engine/src/mlxc/io.rs +268 -0
  27. data/engine/src/mlxc/memory.rs +56 -0
  28. data/engine/src/mlxc/metal.rs +24 -0
  29. data/engine/src/mlxc/mod.rs +55 -0
  30. data/engine/src/mlxc/nn.rs +38 -0
  31. data/engine/src/mlxc/ops.rs +477 -0
  32. data/engine/src/mlxc/quantized.rs +405 -0
  33. data/engine/src/mlxc/random.rs +161 -0
  34. data/engine/src/mlxc/transforms.rs +439 -0
  35. data/engine/src/op.rs +745 -0
  36. data/engine/src/optimizer.rs +650 -0
  37. data/engine/src/plan.rs +1638 -0
  38. data/engine/src/runtime.rs +377 -0
  39. data/engine/src/session.rs +1523 -0
  40. data/engine/src/state.rs +1007 -0
  41. data/engine/src/tensor.rs +331 -0
  42. data/ext/torobi/Cargo.toml +21 -0
  43. data/ext/torobi/extconf.rb +42 -0
  44. data/ext/torobi/src/gvl.rs +182 -0
  45. data/ext/torobi/src/lib.rs +1037 -0
  46. data/lib/torobi/adapter_file.rb +184 -0
  47. data/lib/torobi/batch.rb +55 -0
  48. data/lib/torobi/checkpoint.rb +60 -0
  49. data/lib/torobi/dsl/builder.rb +414 -0
  50. data/lib/torobi/dsl/handle.rb +156 -0
  51. data/lib/torobi/dsl/layers.rb +82 -0
  52. data/lib/torobi/dsl.rb +35 -0
  53. data/lib/torobi/errors.rb +88 -0
  54. data/lib/torobi/export.rb +534 -0
  55. data/lib/torobi/freeze.rb +24 -0
  56. data/lib/torobi/freshness.rb +57 -0
  57. data/lib/torobi/grad_cache.rb +143 -0
  58. data/lib/torobi/graph_config.rb +301 -0
  59. data/lib/torobi/hooks.rb +439 -0
  60. data/lib/torobi/ir/dimensions.rb +26 -0
  61. data/lib/torobi/ir/dtype.rb +28 -0
  62. data/lib/torobi/ir/graph/check.rb +116 -0
  63. data/lib/torobi/ir/graph.rb +52 -0
  64. data/lib/torobi/ir/input_spec.rb +39 -0
  65. data/lib/torobi/ir/json.rb +45 -0
  66. data/lib/torobi/ir/node_spec.rb +52 -0
  67. data/lib/torobi/ir/parameter_spec.rb +67 -0
  68. data/lib/torobi/ir/ref.rb +52 -0
  69. data/lib/torobi/ir/source.rb +65 -0
  70. data/lib/torobi/ir.rb +23 -0
  71. data/lib/torobi/journal.rb +310 -0
  72. data/lib/torobi/lora.rb +190 -0
  73. data/lib/torobi/memory.rb +50 -0
  74. data/lib/torobi/metallib.rb +50 -0
  75. data/lib/torobi/mlx_prebuilt.json +24 -0
  76. data/lib/torobi/mlx_prebuilt.rb +378 -0
  77. data/lib/torobi/models/build.rb +37 -0
  78. data/lib/torobi/models/description.rb +59 -0
  79. data/lib/torobi/models/gemma3.rb +273 -0
  80. data/lib/torobi/models/llama.rb +381 -0
  81. data/lib/torobi/models/modern_bert.rb +513 -0
  82. data/lib/torobi/models/padding.rb +27 -0
  83. data/lib/torobi/models/windows.rb +53 -0
  84. data/lib/torobi/ops.rb +81 -0
  85. data/lib/torobi/preflight.rb +136 -0
  86. data/lib/torobi/provenance.rb +75 -0
  87. data/lib/torobi/quantization.rb +151 -0
  88. data/lib/torobi/replay.rb +229 -0
  89. data/lib/torobi/runner.rb +419 -0
  90. data/lib/torobi/session.rb +855 -0
  91. data/lib/torobi/shape.rb +438 -0
  92. data/lib/torobi/tensor_data.rb +178 -0
  93. data/lib/torobi/version.rb +5 -0
  94. data/lib/torobi/weights.rb +108 -0
  95. data/lib/torobi.rb +67 -0
  96. data/licenses/MLX.txt +21 -0
  97. data/licenses/README.md +16 -0
  98. data/licenses/gguflib.txt +21 -0
  99. data/licenses/mlx-c.txt +21 -0
  100. data/licenses/mlx-rs.txt +27 -0
  101. metadata +229 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5225f50fc40698fc78ae654ef62dd4841326614bc2cb766302685f6a8486d65a
4
+ data.tar.gz: 4eb9d32d9fc67cdcf72e42306fc485bddeb1b54c9d0ae19a5f0c8294e6bba8a0
5
+ SHA512:
6
+ metadata.gz: 408e09786cea5e28aa68075e07c38d4f14505c1a936519348b811f995a094ff077617657ec2a47ea331fc808b14f732e993a133e9c88b489008f3379eee034eb
7
+ data.tar.gz: f246101a4be03d5a7bdb03ea0354a1773807f995532e1fad3d5f609d292f97bbd7764e602313dd66142611bda300a4cdecf07568100fb66f970b297a1fbe6758
data/CHANGELOG.md ADDED
@@ -0,0 +1,71 @@
1
+ # Changelog
2
+
3
+ What changed, for somebody deciding whether to upgrade.
4
+
5
+ ## Unreleased
6
+
7
+ ## 0.1.0 - 2026-11-30
8
+
9
+ The first release: a training framework for Ruby that describes a model
10
+ in plain Ruby and runs it on MLX, on Apple Silicon. The API still moves;
11
+ nothing here is a compatibility promise yet.
12
+
13
+ ### Models and training
14
+
15
+ - A model and its objective are described in a Graph DSL (`Torobi.graph`),
16
+ frozen into a `GraphConfig`; shape and dtype mistakes are reported where
17
+ the graph is written, not on the first step.
18
+ - `Torobi::Session` runs it: `step!`, `run`, `evaluate`, `forward`,
19
+ `fetch`/`put`, `freeze!`, gradient accumulation, global-norm gradient
20
+ clipping, `grad_norm` and `param_norm`, learning-rate policies
21
+ (`Policies::Schedule`, `Policies::Linear`), and a memory cap.
22
+ - Models: `Torobi::Models::Llama` (Qwen2/2.5, sarashina2.2 and other
23
+ Llama-shaped decoders; scaled rotary embeddings and sliding-window
24
+ attention are refused), `Gemma3`, and `ModernBERT` (classifier and
25
+ embedder). A model can be held in bf16, which halves its memory
26
+ (Qwen2.5-0.5B: 1.84 GiB to 0.92 GiB).
27
+ - `Torobi::GradCache` trains a contrastive batch larger than memory.
28
+
29
+ ### LoRA and QLoRA
30
+
31
+ - `Torobi::LoRA`: `causal_lm(adapter:)` trains only the adapter; the base
32
+ bytes do not change (0.109% of Qwen2.5-0.5B's parameters at rank 8 over
33
+ `q_proj` and `v_proj`). On a bf16 model the matrices are f32.
34
+ - `dropout:` is PEFT's `lora_dropout`. It is not allowed with `GradCache`.
35
+ - `tokens: [id, ...]` is PEFT's `trainable_token_indices`: the rows of the
36
+ embedding table (and of the output layer) for those tokens train with the
37
+ adapter, which a base model needs to learn a token such as end-of-turn.
38
+ - `Torobi::Quantization` (QLoRA): a base held at 4 bits,
39
+ imported as it is from mlx-lm's `*-4bit` checkpoints, or quantized as a
40
+ bf16 checkpoint is read (Qwen2.5-0.5B: 0.92 GiB to 0.44 GiB).
41
+
42
+ ### Checkpoints, adapters and merged models
43
+
44
+ - `checkpoint!` / `restore` stop and resume a run exactly, optimizer state
45
+ included. `checkpoint!(dir, light: true)` writes only what trains, so a
46
+ LoRA run's checkpoint is the adapter's few megabytes, not the model.
47
+ - `export_adapter!` writes an adapter as PEFT saves one, and
48
+ `import_adapter!` / `Torobi::AdapterFile.read` read one back (a PEFT
49
+ adapter from another tool included, with its `lora_dropout` and trained
50
+ token rows; what is not a plain LoRA, such as DoRA, rsLoRA or a rank per
51
+ layer, is refused by name).
52
+ - `export_model!(dir, merge: adapter, dtype: :bf16)` writes a model other
53
+ tools load. A merged decoder carries its tokenizer, chat template and
54
+ `generation_config.json` (which tokens end a reply). `dtype:` writes
55
+ bf16 or f16 (half the size of f32), and a merge is computed in f32 first.
56
+ - A journal of a run, with hooks, knobs, and replay; `Torobi::Runner` runs a
57
+ long job in a process of its own with a memory cap.
58
+
59
+ ### Installing
60
+
61
+ - An `arm64-darwin` platform gem installs with no Rust toolchain, for
62
+ Ruby 3.3, 3.4 and 4.0.
63
+
64
+ ### Known limitations
65
+
66
+ - Other decoder architectures and variable-length attention are not
67
+ implemented.
68
+ - `Torobi::Memory.limit=` does not refuse an allocation that exceeds it; a
69
+ run that must stay under a number wants `Policies::MemoryGuard`.
70
+ - Apple Silicon only. Linux + NVIDIA builds and trains from a checkout, but
71
+ there is no Linux gem yet.
data/Cargo.lock ADDED
@@ -0,0 +1,539 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "aho-corasick"
7
+ version = "1.1.5"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba"
10
+ dependencies = [
11
+ "memchr",
12
+ ]
13
+
14
+ [[package]]
15
+ name = "anyhow"
16
+ version = "1.0.104"
17
+ source = "registry+https://github.com/rust-lang/crates.io-index"
18
+ checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470"
19
+
20
+ [[package]]
21
+ name = "bindgen"
22
+ version = "0.72.1"
23
+ source = "registry+https://github.com/rust-lang/crates.io-index"
24
+ checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
25
+ dependencies = [
26
+ "bitflags",
27
+ "cexpr",
28
+ "clang-sys",
29
+ "itertools",
30
+ "log",
31
+ "prettyplease",
32
+ "proc-macro2",
33
+ "quote",
34
+ "regex",
35
+ "rustc-hash",
36
+ "shlex",
37
+ "syn 2.0.119",
38
+ ]
39
+
40
+ [[package]]
41
+ name = "bitflags"
42
+ version = "2.13.1"
43
+ source = "registry+https://github.com/rust-lang/crates.io-index"
44
+ checksum = "b588b76d00fde79687d7646a9b5bdf3cc0f655e0bbd080335a95d7e96f3587da"
45
+
46
+ [[package]]
47
+ name = "block-buffer"
48
+ version = "0.10.4"
49
+ source = "registry+https://github.com/rust-lang/crates.io-index"
50
+ checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
51
+ dependencies = [
52
+ "generic-array",
53
+ ]
54
+
55
+ [[package]]
56
+ name = "cexpr"
57
+ version = "0.6.0"
58
+ source = "registry+https://github.com/rust-lang/crates.io-index"
59
+ checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
60
+ dependencies = [
61
+ "nom",
62
+ ]
63
+
64
+ [[package]]
65
+ name = "cfg-if"
66
+ version = "1.0.4"
67
+ source = "registry+https://github.com/rust-lang/crates.io-index"
68
+ checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
69
+
70
+ [[package]]
71
+ name = "clang-sys"
72
+ version = "1.9.1"
73
+ source = "registry+https://github.com/rust-lang/crates.io-index"
74
+ checksum = "157a8ba7b480713b56f4c09fd13fc3e0a22a5dfab8097ba61cbc5feef950788a"
75
+ dependencies = [
76
+ "glob",
77
+ "libc",
78
+ "libloading",
79
+ ]
80
+
81
+ [[package]]
82
+ name = "cpufeatures"
83
+ version = "0.2.17"
84
+ source = "registry+https://github.com/rust-lang/crates.io-index"
85
+ checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
86
+ dependencies = [
87
+ "libc",
88
+ ]
89
+
90
+ [[package]]
91
+ name = "crypto-common"
92
+ version = "0.1.7"
93
+ source = "registry+https://github.com/rust-lang/crates.io-index"
94
+ checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
95
+ dependencies = [
96
+ "generic-array",
97
+ "typenum",
98
+ ]
99
+
100
+ [[package]]
101
+ name = "digest"
102
+ version = "0.10.7"
103
+ source = "registry+https://github.com/rust-lang/crates.io-index"
104
+ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
105
+ dependencies = [
106
+ "block-buffer",
107
+ "crypto-common",
108
+ ]
109
+
110
+ [[package]]
111
+ name = "either"
112
+ version = "1.18.0"
113
+ source = "registry+https://github.com/rust-lang/crates.io-index"
114
+ checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34"
115
+
116
+ [[package]]
117
+ name = "errno"
118
+ version = "0.3.14"
119
+ source = "registry+https://github.com/rust-lang/crates.io-index"
120
+ checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
121
+ dependencies = [
122
+ "libc",
123
+ "windows-sys",
124
+ ]
125
+
126
+ [[package]]
127
+ name = "fastrand"
128
+ version = "2.5.0"
129
+ source = "registry+https://github.com/rust-lang/crates.io-index"
130
+ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223"
131
+
132
+ [[package]]
133
+ name = "generic-array"
134
+ version = "0.14.7"
135
+ source = "registry+https://github.com/rust-lang/crates.io-index"
136
+ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
137
+ dependencies = [
138
+ "typenum",
139
+ "version_check",
140
+ ]
141
+
142
+ [[package]]
143
+ name = "getrandom"
144
+ version = "0.4.3"
145
+ source = "registry+https://github.com/rust-lang/crates.io-index"
146
+ checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099"
147
+ dependencies = [
148
+ "cfg-if",
149
+ "libc",
150
+ "r-efi",
151
+ ]
152
+
153
+ [[package]]
154
+ name = "glob"
155
+ version = "0.3.4"
156
+ source = "registry+https://github.com/rust-lang/crates.io-index"
157
+ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
158
+
159
+ [[package]]
160
+ name = "itertools"
161
+ version = "0.13.0"
162
+ source = "registry+https://github.com/rust-lang/crates.io-index"
163
+ checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
164
+ dependencies = [
165
+ "either",
166
+ ]
167
+
168
+ [[package]]
169
+ name = "itoa"
170
+ version = "1.0.18"
171
+ source = "registry+https://github.com/rust-lang/crates.io-index"
172
+ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
173
+
174
+ [[package]]
175
+ name = "lazy_static"
176
+ version = "1.5.0"
177
+ source = "registry+https://github.com/rust-lang/crates.io-index"
178
+ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
179
+
180
+ [[package]]
181
+ name = "libc"
182
+ version = "0.2.189"
183
+ source = "registry+https://github.com/rust-lang/crates.io-index"
184
+ checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2"
185
+
186
+ [[package]]
187
+ name = "libloading"
188
+ version = "0.8.9"
189
+ source = "registry+https://github.com/rust-lang/crates.io-index"
190
+ checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
191
+ dependencies = [
192
+ "cfg-if",
193
+ "windows-link",
194
+ ]
195
+
196
+ [[package]]
197
+ name = "linux-raw-sys"
198
+ version = "0.12.1"
199
+ source = "registry+https://github.com/rust-lang/crates.io-index"
200
+ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
201
+
202
+ [[package]]
203
+ name = "log"
204
+ version = "0.4.34"
205
+ source = "registry+https://github.com/rust-lang/crates.io-index"
206
+ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
207
+
208
+ [[package]]
209
+ name = "magnus"
210
+ version = "0.8.2"
211
+ source = "registry+https://github.com/rust-lang/crates.io-index"
212
+ checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
213
+ dependencies = [
214
+ "magnus-macros",
215
+ "rb-sys",
216
+ "rb-sys-env",
217
+ "seq-macro",
218
+ ]
219
+
220
+ [[package]]
221
+ name = "magnus-macros"
222
+ version = "0.8.0"
223
+ source = "registry+https://github.com/rust-lang/crates.io-index"
224
+ checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
225
+ dependencies = [
226
+ "proc-macro2",
227
+ "quote",
228
+ "syn 2.0.119",
229
+ ]
230
+
231
+ [[package]]
232
+ name = "memchr"
233
+ version = "2.8.3"
234
+ source = "registry+https://github.com/rust-lang/crates.io-index"
235
+ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
236
+
237
+ [[package]]
238
+ name = "minimal-lexical"
239
+ version = "0.2.1"
240
+ source = "registry+https://github.com/rust-lang/crates.io-index"
241
+ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
242
+
243
+ [[package]]
244
+ name = "nom"
245
+ version = "7.1.3"
246
+ source = "registry+https://github.com/rust-lang/crates.io-index"
247
+ checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
248
+ dependencies = [
249
+ "memchr",
250
+ "minimal-lexical",
251
+ ]
252
+
253
+ [[package]]
254
+ name = "once_cell"
255
+ version = "1.21.4"
256
+ source = "registry+https://github.com/rust-lang/crates.io-index"
257
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
258
+
259
+ [[package]]
260
+ name = "prettyplease"
261
+ version = "0.2.37"
262
+ source = "registry+https://github.com/rust-lang/crates.io-index"
263
+ checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
264
+ dependencies = [
265
+ "proc-macro2",
266
+ "syn 2.0.119",
267
+ ]
268
+
269
+ [[package]]
270
+ name = "proc-macro2"
271
+ version = "1.0.107"
272
+ source = "registry+https://github.com/rust-lang/crates.io-index"
273
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
274
+ dependencies = [
275
+ "unicode-ident",
276
+ ]
277
+
278
+ [[package]]
279
+ name = "quote"
280
+ version = "1.0.47"
281
+ source = "registry+https://github.com/rust-lang/crates.io-index"
282
+ checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001"
283
+ dependencies = [
284
+ "proc-macro2",
285
+ ]
286
+
287
+ [[package]]
288
+ name = "r-efi"
289
+ version = "6.0.0"
290
+ source = "registry+https://github.com/rust-lang/crates.io-index"
291
+ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf"
292
+
293
+ [[package]]
294
+ name = "rb-sys"
295
+ version = "0.9.130"
296
+ source = "registry+https://github.com/rust-lang/crates.io-index"
297
+ checksum = "02faf625bb10ba893e3ae620f19c9fb1b5f8fcae0fe4eb86bb3f2230fad75edb"
298
+ dependencies = [
299
+ "rb-sys-build",
300
+ ]
301
+
302
+ [[package]]
303
+ name = "rb-sys-build"
304
+ version = "0.9.130"
305
+ source = "registry+https://github.com/rust-lang/crates.io-index"
306
+ checksum = "05be6f9c86fe5482808162826f6c047d093b3670582296c770de1d94f8066694"
307
+ dependencies = [
308
+ "bindgen",
309
+ "lazy_static",
310
+ "proc-macro2",
311
+ "quote",
312
+ "regex",
313
+ "shell-words",
314
+ "syn 2.0.119",
315
+ ]
316
+
317
+ [[package]]
318
+ name = "rb-sys-env"
319
+ version = "0.2.3"
320
+ source = "registry+https://github.com/rust-lang/crates.io-index"
321
+ checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
322
+
323
+ [[package]]
324
+ name = "regex"
325
+ version = "1.13.1"
326
+ source = "registry+https://github.com/rust-lang/crates.io-index"
327
+ checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d"
328
+ dependencies = [
329
+ "aho-corasick",
330
+ "memchr",
331
+ "regex-automata",
332
+ "regex-syntax",
333
+ ]
334
+
335
+ [[package]]
336
+ name = "regex-automata"
337
+ version = "0.4.18"
338
+ source = "registry+https://github.com/rust-lang/crates.io-index"
339
+ checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2"
340
+ dependencies = [
341
+ "aho-corasick",
342
+ "memchr",
343
+ "regex-syntax",
344
+ ]
345
+
346
+ [[package]]
347
+ name = "regex-syntax"
348
+ version = "0.8.11"
349
+ source = "registry+https://github.com/rust-lang/crates.io-index"
350
+ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
351
+
352
+ [[package]]
353
+ name = "rustc-hash"
354
+ version = "2.1.3"
355
+ source = "registry+https://github.com/rust-lang/crates.io-index"
356
+ checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
357
+
358
+ [[package]]
359
+ name = "rustix"
360
+ version = "1.1.4"
361
+ source = "registry+https://github.com/rust-lang/crates.io-index"
362
+ checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
363
+ dependencies = [
364
+ "bitflags",
365
+ "errno",
366
+ "libc",
367
+ "linux-raw-sys",
368
+ "windows-sys",
369
+ ]
370
+
371
+ [[package]]
372
+ name = "seq-macro"
373
+ version = "0.3.6"
374
+ source = "registry+https://github.com/rust-lang/crates.io-index"
375
+ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
376
+
377
+ [[package]]
378
+ name = "serde"
379
+ version = "1.0.229"
380
+ source = "registry+https://github.com/rust-lang/crates.io-index"
381
+ checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba"
382
+ dependencies = [
383
+ "serde_core",
384
+ "serde_derive",
385
+ ]
386
+
387
+ [[package]]
388
+ name = "serde_core"
389
+ version = "1.0.229"
390
+ source = "registry+https://github.com/rust-lang/crates.io-index"
391
+ checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48"
392
+ dependencies = [
393
+ "serde_derive",
394
+ ]
395
+
396
+ [[package]]
397
+ name = "serde_derive"
398
+ version = "1.0.229"
399
+ source = "registry+https://github.com/rust-lang/crates.io-index"
400
+ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
401
+ dependencies = [
402
+ "proc-macro2",
403
+ "quote",
404
+ "syn 3.0.4",
405
+ ]
406
+
407
+ [[package]]
408
+ name = "serde_json"
409
+ version = "1.0.151"
410
+ source = "registry+https://github.com/rust-lang/crates.io-index"
411
+ checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14"
412
+ dependencies = [
413
+ "itoa",
414
+ "memchr",
415
+ "serde",
416
+ "serde_core",
417
+ "zmij",
418
+ ]
419
+
420
+ [[package]]
421
+ name = "sha2"
422
+ version = "0.10.9"
423
+ source = "registry+https://github.com/rust-lang/crates.io-index"
424
+ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
425
+ dependencies = [
426
+ "cfg-if",
427
+ "cpufeatures",
428
+ "digest",
429
+ ]
430
+
431
+ [[package]]
432
+ name = "shell-words"
433
+ version = "1.1.1"
434
+ source = "registry+https://github.com/rust-lang/crates.io-index"
435
+ checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
436
+
437
+ [[package]]
438
+ name = "shlex"
439
+ version = "1.3.0"
440
+ source = "registry+https://github.com/rust-lang/crates.io-index"
441
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
442
+
443
+ [[package]]
444
+ name = "syn"
445
+ version = "2.0.119"
446
+ source = "registry+https://github.com/rust-lang/crates.io-index"
447
+ checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297"
448
+ dependencies = [
449
+ "proc-macro2",
450
+ "quote",
451
+ "unicode-ident",
452
+ ]
453
+
454
+ [[package]]
455
+ name = "syn"
456
+ version = "3.0.4"
457
+ source = "registry+https://github.com/rust-lang/crates.io-index"
458
+ checksum = "e6275cddf4610d1775e6d1fe9469b2e77d0f39fd98fb7450901b821e0c53649f"
459
+ dependencies = [
460
+ "proc-macro2",
461
+ "quote",
462
+ "unicode-ident",
463
+ ]
464
+
465
+ [[package]]
466
+ name = "tempfile"
467
+ version = "3.27.0"
468
+ source = "registry+https://github.com/rust-lang/crates.io-index"
469
+ checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd"
470
+ dependencies = [
471
+ "fastrand",
472
+ "getrandom",
473
+ "once_cell",
474
+ "rustix",
475
+ "windows-sys",
476
+ ]
477
+
478
+ [[package]]
479
+ name = "torobi"
480
+ version = "0.1.0"
481
+ dependencies = [
482
+ "anyhow",
483
+ "magnus",
484
+ "rb-sys",
485
+ "serde_json",
486
+ "torobi-engine",
487
+ ]
488
+
489
+ [[package]]
490
+ name = "torobi-engine"
491
+ version = "0.1.0"
492
+ dependencies = [
493
+ "anyhow",
494
+ "bindgen",
495
+ "libc",
496
+ "serde",
497
+ "serde_json",
498
+ "sha2",
499
+ "tempfile",
500
+ ]
501
+
502
+ [[package]]
503
+ name = "typenum"
504
+ version = "1.20.1"
505
+ source = "registry+https://github.com/rust-lang/crates.io-index"
506
+ checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
507
+
508
+ [[package]]
509
+ name = "unicode-ident"
510
+ version = "1.0.24"
511
+ source = "registry+https://github.com/rust-lang/crates.io-index"
512
+ checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
513
+
514
+ [[package]]
515
+ name = "version_check"
516
+ version = "0.9.5"
517
+ source = "registry+https://github.com/rust-lang/crates.io-index"
518
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
519
+
520
+ [[package]]
521
+ name = "windows-link"
522
+ version = "0.2.1"
523
+ source = "registry+https://github.com/rust-lang/crates.io-index"
524
+ checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
525
+
526
+ [[package]]
527
+ name = "windows-sys"
528
+ version = "0.61.2"
529
+ source = "registry+https://github.com/rust-lang/crates.io-index"
530
+ checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
531
+ dependencies = [
532
+ "windows-link",
533
+ ]
534
+
535
+ [[package]]
536
+ name = "zmij"
537
+ version = "1.0.23"
538
+ source = "registry+https://github.com/rust-lang/crates.io-index"
539
+ checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
data/Cargo.toml ADDED
@@ -0,0 +1,6 @@
1
+ # One workspace so the engine and the Ruby extension share a target
2
+ # directory: both link the same MLX archives, and a second copy of that
3
+ # build is not worth the disk.
4
+ [workspace]
5
+ members = ["engine", "ext/torobi"]
6
+ resolver = "2"
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 takahashim
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.