td-toolkit / td_lang /__init__.py
td-builder's picture
Fixed code: vocab mismatch fix for cross-arch merging (Llama/Falcon)
5d61448 verified
"""
TD Lang β€” Domain-specific language for Time Dilation project.
Compiles .td files into Python code that calls td_fuse.
Write simple scripts instead of complex Python.
Architecture:
td_lang/
β”œβ”€β”€ __init__.py <- This file
β”œβ”€β”€ __main__.py <- Entry point for python -m td_lang
β”œβ”€β”€ grammar.py <- Lark grammar + parse tree transformer
β”œβ”€β”€ ast_nodes.py <- Dataclass AST nodes for each command
β”œβ”€β”€ compiler.py <- AST -> Python code generation
β”œβ”€β”€ executor.py <- Run compiled code, track lineage
β”œβ”€β”€ cli.py <- Command-line interface
β”œβ”€β”€ errors.py <- Custom exceptions
└── examples/
β”œβ”€β”€ demo_merge.td <- Basic merge example
β”œβ”€β”€ demo_heal.td <- Merge + heal example
β”œβ”€β”€ demo_full.td <- Full pipeline with gates + budget
β”œβ”€β”€ demo_loop.td <- Self-improvement loop example
β”œβ”€β”€ demo_phase3.td <- Fork/edit/prune/reset example
└── demo_phase4.td <- Contracts + snapshot + report example
Phase 1: load, merge, heal, eval, commit
Phase 2: diagnose, synth, train, debate
Phase 3: fork, reset, prune, edit
Phase 4: snapshot, report, data_contract, reward_contract
Phase 5: CLI polish, --version, info command, --verbose
Phase 6: fuse, absorb (easy merge)
Phase 7: repeat, if/else (loop control)
Phase 8: setup, on_error, notify, save (autopilot)
Phase 9: schedule (time-based execution)
Phase 10: download, log, compare, verify (toolbox)
Phase 11: vote, prompt, distill, rollback (intelligence)
Phase 12: curriculum, star, best_of, exploit (RL & fine-tuning)
Phase 13: arena (real RL with memory, curiosity, anti-lying, cross-check)
Engine upgrades: QLoRA training, self-contained eval, model-generated synth problems
Mega diagnose: self-diagnosis + domain profiling + layer speed testing
Designed from interviews test_14 (10 commands) and test_17 (ForgeSpec 2.0).
"""
from .grammar import parse_td_file, parse_td_string # noqa: F401
from .compiler import compile_program # noqa: F401
from .executor import TDExecutor, check_td_file, compile_td_file, run_td_file # noqa: F401
__version__ = "0.2.0"
__author__ = "Milan (TD Project)"
__all__ = [
"parse_td_file",
"parse_td_string",
"compile_program",
"TDExecutor",
"check_td_file",
"compile_td_file",
"run_td_file",
"__version__",
"__author__",
]