Skip to main content

SID reglog parsing, tokenization, and macro transforms extracted from the preframr research codebase.

Project description

preframr-tokens

SID reglog parsing, tokenization, and macro transforms extracted from the preframr research codebase.

Torch-free. The training-side concerns (model, loss, DataLoader, predict) live in the main preframr repo; this package contains the stable parsing + encoding layer that produces the parsed parquets + unigram tokenizer alphabet that downstream training consumes.

Install

pip install preframr-tokens

Modules

  • preframr_tokens.reglogparser -- SID dump → parsed dataframe pipeline. RegLogParser.
  • preframr_tokens.regtokenizer -- alphabet build + unigram tokenizer fit. RegTokenizer.
  • preframr_tokens.macros.* -- declarative Transform registry plus the macro / pre-norm passes (slope, preset, hard_restart, legato_per_cluster, voice_block_order, ctrl_bigram, loop, etc.). Macros declare OP_CODES, LOSS_TIER, SUBSTITUTABLE_OPS, MUST_FOLLOW, etc. on their classes; pipeline_check.validate_pipeline_spec validates a pipeline declaratively.
  • preframr_tokens.stfconstants -- SID register IDs, op codes, pandas dtypes, PAL clock constants.
  • preframr_tokens.engine_fingerprint -- engine clustering for cross-engine evaluation pinning.
  • preframr_tokens.coarsen_pass -- tracker-export pass (lossy audio-domain bucketing).
  • preframr_tokens.dump_meta -- per-dump metadata sidecar with code-hash staleness gate.
  • preframr_tokens.reglog_helpers -- palette IO + dtype tightening.
  • preframr_tokens.alphabet_projection -- eval-set atom projection table.
  • preframr_tokens.reg_mappers -- FreqMapper (PAL clock + cents quantization).
  • preframr_tokens.constrained_decode -- per-step structural-validity mask for sampling-time logit guarding. Pure numpy state machine; consumers (torch users) apply the returned bool mask with a single masked_fill at the boundary.
  • preframr_tokens.blocks -- block iteration + materialization helpers: iter_voiced_blocks, materialize_block_array, parser_worker, glob_dumps, reg_widths_path, self_contained_prompt_df, plus the SeqMeta dataclass and parse_eval_reglogs / LEGACY_EVAL_SUBSET_NAME for eval-subset routing. Torch-free; main repo's RegDataset wraps the outputs in DataLoaders.
  • preframr_tokens.audit_primitives -- pure-Python token-level audit functions: tier_accuracy (per-tier hit-rate + content/ structural ratio), detect_tail_cycle (loop-collapse detector), distinct_n (n-gram diversity). Used by the generalization-gate callback in main repo and by post-hoc audit scripts.
  • preframr_tokens.parse_runner -- write_df(args, logger, dump_file)
    • parse_corpus(args, logger) parallel dump-parsing orchestrator. Main-repo preframr/parse.py is a thin argparse shim around this.
  • preframr_tokens.corpus -- Corpus class: torch-free corpus orchestration owning the RegTokenizer + reg_widths + tokenize-stage metadata. Methods load_dfs, make_tokens, encode_and_save_cached_blocks, try_preload_from_disk, preload, iter_block_seqs, iter_predict_block_seqs cover the full parse → tokenize → load pipeline up to the point where blocks need to be routed into a torch BlockMapper (main repo's RegDataset is a thin adapter that does that routing).

Library-only

No CLI entry points. Consumers build their own (the main preframr repo's parse.py and stftokenize.py are simple wrappers that construct RegLogParser / RegTokenizer from an argparse.Namespace).

Stability

Library follows semver from v1.0. Pre-1.0 releases may break API as the preframr codebase evolves. Token-alphabet shape changes bump major version since they invalidate downstream checkpoints.

License

Apache 2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

preframr_tokens-0.7.0.tar.gz (146.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

preframr_tokens-0.7.0-py3-none-any.whl (117.1 kB view details)

Uploaded Python 3

File details

Details for the file preframr_tokens-0.7.0.tar.gz.

File metadata

  • Download URL: preframr_tokens-0.7.0.tar.gz
  • Upload date:
  • Size: 146.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for preframr_tokens-0.7.0.tar.gz
Algorithm Hash digest
SHA256 b96961ede2b90a9f62c5b5146f5fca1ac55f6118c2fa205a8e379723e3f5e7b4
MD5 1cc63fc66300840f6bd133f16c41e2b4
BLAKE2b-256 e092c9b300ec8a96d8aaa69c01b76c46944c53e69b5f4512d05fd3643e6c9383

See more details on using hashes here.

Provenance

The following attestation bundles were made for preframr_tokens-0.7.0.tar.gz:

Publisher: release.yml on anarkiwi/preframr-tokens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file preframr_tokens-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: preframr_tokens-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 117.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for preframr_tokens-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c58d0460710a3e59f3e0db7084b573c086e7d60899053b5b4d7dedc60d263368
MD5 b801f691fb22eb62511ee32bdf121c9b
BLAKE2b-256 77698fdd82e9c9c0313b24d151f8b831120f596bf3840d2c0a31e2314d6e62b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for preframr_tokens-0.7.0-py3-none-any.whl:

Publisher: release.yml on anarkiwi/preframr-tokens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page