json2vec 0.1.0__tar.gz → 0.2.1__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.
- json2vec-0.2.1/PKG-INFO +388 -0
- json2vec-0.2.1/README.md +354 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/pyproject.toml +7 -2
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/architecture/counter.py +10 -0
- json2vec-0.2.1/src/json2vec/architecture/plot.py +252 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/architecture/root.py +11 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/data/datasets.py +4 -25
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/inference/deployment.py +4 -5
- json2vec-0.2.1/src/json2vec/processors/base.py +109 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/processors/extensions/example.py +1 -1
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/structs/enums.py +1 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/tensorfields/base.py +32 -5
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/tensorfields/extensions/category.py +112 -34
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/tensorfields/extensions/number.py +23 -0
- json2vec-0.2.1/src/json2vec/tensorfields/extensions/text.py +547 -0
- json2vec-0.2.1/src/json2vec.egg-info/PKG-INFO +388 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec.egg-info/SOURCES.txt +2 -1
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec.egg-info/requires.txt +3 -0
- json2vec-0.1.0/PKG-INFO +0 -227
- json2vec-0.1.0/README.md +0 -18
- json2vec-0.1.0/docs/README.md +0 -195
- json2vec-0.1.0/src/json2vec/processors/base.py +0 -102
- json2vec-0.1.0/src/json2vec.egg-info/PKG-INFO +0 -227
- {json2vec-0.1.0 → json2vec-0.2.1}/LICENSE +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/NOTICE +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/setup.cfg +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/__main__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/architecture/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/architecture/attention.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/architecture/encoder.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/architecture/node.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/architecture/pool.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/architecture/rotary.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/data/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/data/processing.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/entrypoints/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/entrypoints/pipeline.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/inference/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/inference/callback.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/logging/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/logging/config.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/logging/epoch.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/logging/throughput.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/logging/tracking.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/processors/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/processors/extensions/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/processors/spec.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/structs/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/structs/environment.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/structs/experiment.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/structs/packages.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/structs/structure.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/structs/tree.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/tensorfields/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/tensorfields/extensions/__init__.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/tensorfields/extensions/dateparts.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/tensorfields/extensions/entity.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/tensorfields/extensions/vector.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec/tensorfields/spec.py +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec.egg-info/dependency_links.txt +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec.egg-info/entry_points.txt +0 -0
- {json2vec-0.1.0 → json2vec-0.2.1}/src/json2vec.egg-info/top_level.txt +0 -0
json2vec-0.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: json2vec
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: JSON -> [*]
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
License-File: NOTICE
|
|
10
|
+
Requires-Dist: beartype>=0.21.0
|
|
11
|
+
Requires-Dist: pluggy>=1.6.0
|
|
12
|
+
Requires-Dist: faker>=37.4.0
|
|
13
|
+
Requires-Dist: rich>=14.0.0
|
|
14
|
+
Requires-Dist: pydantic>=2.11.7
|
|
15
|
+
Requires-Dist: pydantic-settings>=2.10.1
|
|
16
|
+
Requires-Dist: jmespath>=1.0.1
|
|
17
|
+
Requires-Dist: loguru>=0.7.3
|
|
18
|
+
Requires-Dist: anytree>=2.13.0
|
|
19
|
+
Requires-Dist: ordered-set>=4.1.0
|
|
20
|
+
Requires-Dist: pyarrow>=21.0.0
|
|
21
|
+
Requires-Dist: polars>=1.35.2
|
|
22
|
+
Requires-Dist: numpy>=2.2.6
|
|
23
|
+
Requires-Dist: lightning>=2.5.2
|
|
24
|
+
Requires-Dist: litserve>=0.2.13
|
|
25
|
+
Requires-Dist: tensordict>=0.10.0
|
|
26
|
+
Requires-Dist: torch>=2.7.1
|
|
27
|
+
Requires-Dist: lightning-thunder>=0.2.5
|
|
28
|
+
Requires-Dist: ipython>=9.9.0
|
|
29
|
+
Requires-Dist: jsonpatch>=1.33
|
|
30
|
+
Requires-Dist: jsonnet>=0.21.0
|
|
31
|
+
Provides-Extra: text
|
|
32
|
+
Requires-Dist: transformers>=4.55.0; extra == "text"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# JSON2Vec
|
|
36
|
+
|
|
37
|
+
`json2vec` is a schema-driven framework for learning embeddings and task
|
|
38
|
+
heads directly from nested, semi-structured records without flattening them
|
|
39
|
+
into a fixed feature table first.
|
|
40
|
+
|
|
41
|
+
The central idea is that the schema is the encoder. A declared tree of
|
|
42
|
+
contexts and typed fields becomes an addressable neural graph: leaf tensorfield
|
|
43
|
+
plugins encode raw values, context nodes aggregate child embeddings with
|
|
44
|
+
rotary self-attention and learned-query cross-attention pooling, and
|
|
45
|
+
datatype-specific decoders reconstruct masked, pruned, or supervised targets
|
|
46
|
+
from the surrounding hierarchy.
|
|
47
|
+
|
|
48
|
+
This makes `json2vec` a factory for structure-aware encoders rather than a
|
|
49
|
+
single domain model. Customer/account/transaction data, flight itineraries,
|
|
50
|
+
order fulfillment events, clickstream sessions, and other nested records can
|
|
51
|
+
all use the same machinery while keeping their proprietary data, schemas, and
|
|
52
|
+
trained checkpoints private.
|
|
53
|
+
|
|
54
|
+
## What Makes This Different
|
|
55
|
+
|
|
56
|
+
- **Attributed-distance embeddings.** The model can emit embeddings at any
|
|
57
|
+
configured field or context, not only at the root. That means two observations
|
|
58
|
+
can be similar overall while still exposing which branch of the hierarchy
|
|
59
|
+
accounts for the difference: customer profile, monthly statement, login
|
|
60
|
+
session, transaction history, or any other declared context.
|
|
61
|
+
- **Prune-trained counterfactuals.** Training can periodically remove whole
|
|
62
|
+
fields, not just mask individual values. At inference time, the
|
|
63
|
+
same mechanism supports zero-shot ablation questions such as "what changes if
|
|
64
|
+
device data is unavailable?" without retraining a separate model for every
|
|
65
|
+
feature-removal scenario.
|
|
66
|
+
- **One path for self-supervised and supervised learning.** Masked values,
|
|
67
|
+
pruned fields, and explicit supervised targets all flow through the same
|
|
68
|
+
datatype-specific heads. A new tensorfield type brings its own embedding,
|
|
69
|
+
decoding, loss, and writing logic, so the framework stays reusable as schemas
|
|
70
|
+
grow.
|
|
71
|
+
- **Schema evolution is a first-class workflow.** Because modules are addressed
|
|
72
|
+
by the schema tree, structures can be patched, fields can be added or
|
|
73
|
+
removed, and selected fields can be pruned across sessions without rebuilding
|
|
74
|
+
a separate feature pipeline.
|
|
75
|
+
- **Production semantics for missingness.** `null`, `padded`, `masked`,
|
|
76
|
+
`pruned`, and `valued` are distinct states in the tensorfield type system.
|
|
77
|
+
They are not collapsed into one generic missing-value bucket.
|
|
78
|
+
- **Online state lives with the model.** Stateful components such as category
|
|
79
|
+
vocabularies, counters, and numeric normalization state are learned during
|
|
80
|
+
streaming training and serialized with checkpoints, so deployment does not
|
|
81
|
+
depend on a parallel tokenizer or normalizer artifact.
|
|
82
|
+
- **Training-serving parity.** The same configured graph is used for fitting,
|
|
83
|
+
validation, testing, batch prediction, and LitServe-backed online inference.
|
|
84
|
+
|
|
85
|
+
The attributed embeddings and prune-trained ablations are model-level
|
|
86
|
+
explanation primitives. They help answer where two records differ and how a
|
|
87
|
+
prediction changes when an information source is withheld. They are not a
|
|
88
|
+
complete compliance story by themselves, but they make governance and audit
|
|
89
|
+
layers easier to build on top of the representation layer.
|
|
90
|
+
|
|
91
|
+
## Where It Fits
|
|
92
|
+
|
|
93
|
+
Use `json2vec` when the hierarchy is part of the signal:
|
|
94
|
+
|
|
95
|
+
- customer, account, transaction, statement, device, and session records
|
|
96
|
+
- flight itineraries, legs, segments, and events
|
|
97
|
+
- orders, shipments, fulfillment events, and support histories
|
|
98
|
+
- entities with repeated sub-objects, evolving schemas, and mixed datatypes
|
|
99
|
+
- embedding retrieval, anomaly detection, counterfactual ablation, and
|
|
100
|
+
multi-target prediction over nested records
|
|
101
|
+
|
|
102
|
+
## What It Does Not Do
|
|
103
|
+
|
|
104
|
+
`json2vec` stops at the representation and typed prediction layer. It does not
|
|
105
|
+
try to be a feature store, governance system, rule engine, authorization layer,
|
|
106
|
+
decision-capture system, or audit platform. Those systems can consume
|
|
107
|
+
`json2vec` embeddings and predictions, but their policies and operational
|
|
108
|
+
controls remain separate concerns.
|
|
109
|
+
|
|
110
|
+
It also does not require users to publish data, schemas, checkpoints, or model
|
|
111
|
+
parameters. The open-source layer is the reusable encoder and runtime
|
|
112
|
+
infrastructure. Your data stays yours, as does your parameters.
|
|
113
|
+
The framework works under the assumption that model parameters will not be shared.
|
|
114
|
+
|
|
115
|
+
## What Is In This Repository
|
|
116
|
+
|
|
117
|
+
This repository currently contains:
|
|
118
|
+
|
|
119
|
+
- the core library under `src/json2vec/`
|
|
120
|
+
- tensorfield plugins for `number`, `category`, `dateparts`, `entity`, `vector`, and `text`
|
|
121
|
+
- a processor registry for dataset-specific preprocessing
|
|
122
|
+
- a LitServe deployment entrypoint for serving from checkpoints
|
|
123
|
+
- tests covering structure loading, data processing, tensorfields, training helpers, logging, and inference
|
|
124
|
+
- diagrams plus longer design docs in `docs/`
|
|
125
|
+
|
|
126
|
+
It does not currently ship maintained example experiments or `make` shortcuts. Older references to `experiments/`, `examples/`, and `make train` were removed because they no longer reflect the checked-in code.
|
|
127
|
+
|
|
128
|
+
More examples based on publicly available will soon be included to showcase implementation and expected behavior.
|
|
129
|
+
|
|
130
|
+
## Install
|
|
131
|
+
|
|
132
|
+
For local development:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
uv sync
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
If you want an editable install:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pip install -e .
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
The package requires Python `>=3.12`.
|
|
145
|
+
|
|
146
|
+
## Core Concepts
|
|
147
|
+
|
|
148
|
+
- `Structure` defines the model tree.
|
|
149
|
+
- `Context` nodes describe hierarchical grouping and aggregation.
|
|
150
|
+
- Field `Request` nodes declare a `type`, a `query`, and type-specific options.
|
|
151
|
+
- `Address` values are stable paths such as `root/account/transaction/amount`.
|
|
152
|
+
- `jmespath` queries extract values from each observation.
|
|
153
|
+
- `TensorField` instances preserve typed content plus state tokens such as
|
|
154
|
+
`valued`, `null`, `padded`, `masked`, and `pruned`.
|
|
155
|
+
- `Parcel` objects carry embeddings from leaves to parent contexts and then up
|
|
156
|
+
the tree.
|
|
157
|
+
- `heritage` is the path from a leaf to the root; decoders use that path as
|
|
158
|
+
context when reconstructing masked, pruned, or supervised targets.
|
|
159
|
+
- `Session` combines a dataset, structure, task, masking/pruning controls, and
|
|
160
|
+
selected embedding outputs.
|
|
161
|
+
- `Experiment` is an ordered list of sessions loaded from config files.
|
|
162
|
+
|
|
163
|
+
Supported session tasks are:
|
|
164
|
+
|
|
165
|
+
- `fit`
|
|
166
|
+
- `validate`
|
|
167
|
+
- `test`
|
|
168
|
+
- `predict`
|
|
169
|
+
|
|
170
|
+
Supported dataset suffixes are:
|
|
171
|
+
|
|
172
|
+
- `ndjson`
|
|
173
|
+
- `parquet`
|
|
174
|
+
- `feather`
|
|
175
|
+
- `avro`
|
|
176
|
+
- `csv`
|
|
177
|
+
- `orc`
|
|
178
|
+
- `json`
|
|
179
|
+
|
|
180
|
+
Supported dataset roots are local paths and `s3://...` URIs. If `dataset.root` is `null`, the pipeline runs in processor-driven mode and expects the configured processor to generate observations.
|
|
181
|
+
This will likely expand to support `@register` based UDFs for arbitrary data sourcing and file format support ...
|
|
182
|
+
|
|
183
|
+
## How The Graph Runs
|
|
184
|
+
|
|
185
|
+
For each batch:
|
|
186
|
+
|
|
187
|
+
1. Each field request extracts values with its `jmespath` query.
|
|
188
|
+
2. The matching tensorfield plugin tensorizes those values, updates any online
|
|
189
|
+
state allowed for the current split, and records trainable targets when
|
|
190
|
+
masking or pruning occurs.
|
|
191
|
+
3. Leaf embedders emit parcels to their parent contexts.
|
|
192
|
+
4. Context nodes run bottom-up. Each context concatenates available child
|
|
193
|
+
parcels, applies rotary transformer layers, compresses with learned-query
|
|
194
|
+
cross-attention, and emits a new parcel to its parent.
|
|
195
|
+
5. Leaf decoders consume the parcel sequence along their heritage path to
|
|
196
|
+
reconstruct trainable targets.
|
|
197
|
+
|
|
198
|
+
Random `p_mask` corrupts individual values. Random `p_prune` removes whole
|
|
199
|
+
field instances across an observation. Session-level `pruned` fields are always
|
|
200
|
+
withheld and become supervised targets; session-level `output` addresses are
|
|
201
|
+
serialized as embeddings during prediction.
|
|
202
|
+
|
|
203
|
+
## Minimal Training Workflow
|
|
204
|
+
|
|
205
|
+
The CLI entrypoint is:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
uv run python -m json2vec --experiments /path/to/configs --experiment demo --name local-dev --notes "first run"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
The same function is also exposed as the `train` console script after installation.
|
|
212
|
+
|
|
213
|
+
Config discovery is directory-based. `json2vec` can load `.json`, `.yaml`, `.yml`, `.toml`, and `.jsonnet` experiment files. If a config directory contains exactly one experiment file, `--experiment` can be omitted.
|
|
214
|
+
|
|
215
|
+
A minimal YAML experiment looks like this:
|
|
216
|
+
|
|
217
|
+
```yaml
|
|
218
|
+
project: demo
|
|
219
|
+
sessions:
|
|
220
|
+
- name: train
|
|
221
|
+
task: fit
|
|
222
|
+
learning_rate: 0.001
|
|
223
|
+
p_mask: 0.15
|
|
224
|
+
p_prune: 0.05
|
|
225
|
+
output:
|
|
226
|
+
- root
|
|
227
|
+
dataset:
|
|
228
|
+
root: /path/to/data
|
|
229
|
+
sample_rate: 1.0
|
|
230
|
+
file_buffer_size: 16
|
|
231
|
+
observation_buffer_size: 16
|
|
232
|
+
processor: default
|
|
233
|
+
kwargs: {}
|
|
234
|
+
suffix: ndjson
|
|
235
|
+
patterns:
|
|
236
|
+
train: .*
|
|
237
|
+
validate: .*
|
|
238
|
+
test: .*
|
|
239
|
+
predict: .*
|
|
240
|
+
structure:
|
|
241
|
+
name: demo-structure
|
|
242
|
+
type: structure
|
|
243
|
+
batch_size: 2
|
|
244
|
+
dropout: 0.1
|
|
245
|
+
d_model: 16
|
|
246
|
+
fields:
|
|
247
|
+
name: root
|
|
248
|
+
type: context
|
|
249
|
+
context_size: 1
|
|
250
|
+
n_outputs: 1
|
|
251
|
+
n_layers: 1
|
|
252
|
+
n_heads: 4
|
|
253
|
+
n_linear: 1
|
|
254
|
+
fields:
|
|
255
|
+
- name: identifier
|
|
256
|
+
type: category
|
|
257
|
+
query: "[*].id"
|
|
258
|
+
max_vocab_size: 1024
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
`fit` sessions write checkpoints to `models/`. In multi-session experiments, the output checkpoint from a `fit` session is automatically passed to later `validate`, `test`, or `predict` sessions.
|
|
262
|
+
|
|
263
|
+
To turn a field into a supervised target, include its address in
|
|
264
|
+
`session.pruned` for a fit, validate, test, or predict session. The model will
|
|
265
|
+
withhold that field from the encoder and use the same datatype-specific decoder
|
|
266
|
+
that is used for masked/pruned reconstruction. To export embeddings, include
|
|
267
|
+
field or context addresses in `session.output`.
|
|
268
|
+
|
|
269
|
+
## Inference And Serving
|
|
270
|
+
|
|
271
|
+
Batch prediction uses the same experiment/session machinery as training. Prediction outputs are written to `tmp/predictions/`.
|
|
272
|
+
|
|
273
|
+
Checkpoints carry the Lightning weights, serialized session configuration, and
|
|
274
|
+
stateful tensorfield state such as online category vocabularies, numeric
|
|
275
|
+
normalization buffers, and class-frequency counters. This tight coupling is
|
|
276
|
+
intentional: the deployed model should not depend on a separate, manually
|
|
277
|
+
synchronized tokenizer or normalizer artifact.
|
|
278
|
+
|
|
279
|
+
For online serving, the repository exposes `json2vec.inference.deployment.Deployment`, which wraps a checkpoint-backed model in LitServe. Runtime configuration is environment-driven:
|
|
280
|
+
|
|
281
|
+
- `JSON2VEC_CHECKPOINT` or `CHECKPOINT`
|
|
282
|
+
- `JSON2VEC_MAX_BATCH_SIZE`
|
|
283
|
+
- `JSON2VEC_BATCH_TIMEOUT`
|
|
284
|
+
- `JSON2VEC_WORKERS_PER_DEVICE`
|
|
285
|
+
- `JSON2VEC_ACCELERATOR`
|
|
286
|
+
- `JSON2VEC_TRACK_REQUESTS`
|
|
287
|
+
|
|
288
|
+
A minimal serve entrypoint is:
|
|
289
|
+
|
|
290
|
+
```python
|
|
291
|
+
from json2vec.inference.deployment import Deployment
|
|
292
|
+
|
|
293
|
+
Deployment.serve()
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Processor Model
|
|
297
|
+
|
|
298
|
+
Processors are registered Python callables. The built-in `default` processor returns each observation unchanged.
|
|
299
|
+
|
|
300
|
+
Custom processors live under `src/json2vec/processors/extensions/` and are registered with either `@register.transformation` or `@register.generator`.
|
|
301
|
+
|
|
302
|
+
- transformation processors must return a single `dict`
|
|
303
|
+
- generator processors may yield `dict` objects or return a `list[dict]`
|
|
304
|
+
- every emitted object is wrapped as a single-item root context before tensorization
|
|
305
|
+
|
|
306
|
+
Configured `dataset.kwargs` are passed into the processor, with unsupported keyword arguments automatically ignored.
|
|
307
|
+
|
|
308
|
+
## Tensorfield Plugins
|
|
309
|
+
|
|
310
|
+
The current built-in tensorfield types are:
|
|
311
|
+
|
|
312
|
+
- `number`
|
|
313
|
+
- `category`
|
|
314
|
+
- `dateparts`
|
|
315
|
+
- `entity`
|
|
316
|
+
- `vector`
|
|
317
|
+
- `text`
|
|
318
|
+
|
|
319
|
+
Each tensorfield plugin provides a request schema plus the model components needed to encode values, decode predictions, compute losses, and optionally serialize outputs.
|
|
320
|
+
|
|
321
|
+
The `text` tensorfield requires the optional `transformers` dependency and is not installed by default.
|
|
322
|
+
|
|
323
|
+
## Runtime Environment
|
|
324
|
+
|
|
325
|
+
Training and dataloading behavior is controlled with environment variables such as:
|
|
326
|
+
|
|
327
|
+
- `JSON2VEC_LOGGER`
|
|
328
|
+
- `WANDB_API_KEY`
|
|
329
|
+
- `NEPTUNE_API_TOKEN`
|
|
330
|
+
- `COMET_API_KEY`
|
|
331
|
+
- `MLFLOW_TRACKING_URI`
|
|
332
|
+
- `JSON2VEC_TENSORBOARD_LOG_DIR`
|
|
333
|
+
- `JSON2VEC_CSV_LOG_DIR`
|
|
334
|
+
- `JSON2VEC_NUM_WORKERS`
|
|
335
|
+
- `JSON2VEC_PERSISTENT_WORKERS`
|
|
336
|
+
- `JSON2VEC_PIN_MEMORY`
|
|
337
|
+
- `JSON2VEC_SHARDING`
|
|
338
|
+
- `JSON2VEC_CHUNK_BATCH_SIZE`
|
|
339
|
+
|
|
340
|
+
Supported sharding strategies are `file`, `chunk`, and `record`.
|
|
341
|
+
|
|
342
|
+
## Repository Layout
|
|
343
|
+
|
|
344
|
+
- `src/json2vec/architecture`: model assembly, attention, pooling, and parcel routing
|
|
345
|
+
- `src/json2vec/data`: dataset fetch/read/process/batch/encode pipeline
|
|
346
|
+
- `src/json2vec/entrypoints`: training and evaluation orchestration
|
|
347
|
+
- `src/json2vec/inference`: serving and prediction callbacks
|
|
348
|
+
- `src/json2vec/logging`: tracking and runtime logging helpers
|
|
349
|
+
- `src/json2vec/processors`: processor registry and built-in extensions
|
|
350
|
+
- `src/json2vec/structs`: pydantic config models, enums, tree structures, and environment settings
|
|
351
|
+
- `src/json2vec/tensorfields`: tensorfield plugin system and built-in field types
|
|
352
|
+
- `tests/`: package test suite
|
|
353
|
+
- `docs/summary.typ` and `docs/whitepaper.typ`: longer written documentation
|
|
354
|
+
|
|
355
|
+
## Diagrams
|
|
356
|
+
|
|
357
|
+
The repository includes architecture and pipeline diagrams:
|
|
358
|
+
|
|
359
|
+

|
|
360
|
+
|
|
361
|
+

|
|
362
|
+
|
|
363
|
+

|
|
364
|
+
|
|
365
|
+

|
|
366
|
+
|
|
367
|
+
## Development
|
|
368
|
+
|
|
369
|
+
Run the test suite with:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
uv run pytest
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
Run lint checks with:
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
uv run ruff check
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
## License
|
|
382
|
+
|
|
383
|
+
Licensed under the Apache License, Version 2.0. See `LICENSE` and `NOTICE`.
|
|
384
|
+
|
|
385
|
+
## References
|
|
386
|
+
|
|
387
|
+
- `BIBLIOGRAPHY.md`
|
|
388
|
+
- `CITATION.bib`
|