lstm-generation
Run, adapt, or modernize deepjazz's legacy LSTM generation workflow safely.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- lstm-generation
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Run, adapt, or modernize deepjazz's legacy LSTM generation workflow safely.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/generation-workflow.md4.1 KB
- 参考文档references/lstm-architecture.md2.3 KB
- 参考文档references/modernization-notes.md2.8 KB
- 参考文档references/troubleshooting.md2.6 KB
- 脚本scripts/legacy_generation_check.py7.7 KB
03 SKILL.md 正文
deepjazz LSTM Generation
Use this sub-skill when the task is to run, adapt, troubleshoot, or modernize the legacy deepjazz LSTM generation path: preprocess grammar corpus, build/train the Keras/Theano model, generate measure grammars, prune/QA, unparse to notes, and write MIDI.
This skill distills the relevant generation and model behavior into the bundled references below. Do not depend on reading legacy source files at runtime to recover constants, APIs, or control flow.
Route elsewhere
- For MIDI compatibility, melody/accompaniment part selection, and measure-window checks, use
../midi-preprocessing/. - For grammar token semantics, grammar pruning details, unparse edge cases, and QA helper behavior, use
../grammar-and-qa/.
Start safely
-
Use a legacy environment for faithful execution: Python 2.7, Keras 1.2.x, Theano 0.9.x, NumPy 1.16.x, and music21 3.1.x. Set
KERAS_BACKEND=theanobefore importing Keras when using the legacy stack. -
Before any training or playback-capable command, run the safe diagnostic:
python scripts/legacy_generation_check.py --check-imports --show-settings --expect-theanoTo inspect API signatures in a local deepjazz-style working copy without training, playback, or writes:
python scripts/legacy_generation_check.py --repo-root <deepjazz-style-root> --check-imports --show-settings --expect-theano -
Treat full generation as side-effectful: it trains an LSTM, attempts realtime MIDI playback, and writes a MIDI file. On headless servers, use an adapted entrypoint that disables playback before invoking generation.
-
Treat Theano CUDA as a legacy optional acceleration path only. The CPU path is the safe baseline; the CUDA command requires an old NVIDIA/CUDA/Theano stack and is not verified by this skill.
What to read or run
- Read
references/generation-workflow.mdfor the public end-to-end generation flow, legacy CPU/GPU command shapes, constants, side effects, and headless one-epoch guidance. - Read
references/lstm-architecture.mdforbuild_model(corpus, val_indices, max_len, N_epochs=128), one-hot shapes, layer stack, compile/fit parameters, and inference sampling shapes. - Read
references/modernization-notes.mdwhen porting the model to Python 3 ortf.keraswhile preserving corpus/value mappings and the grammar pipeline. - Read
references/troubleshooting.mdfor backend mismatch, missing dependency, Python 3, Theano CUDA, playback, output-path, speed, and nondeterminism failures. - Run
scripts/legacy_generation_check.pyfor deterministic, no-training/no-playback dependency, backend, distilled-setting, and optional signature checks.
Core distilled facts
| Area | Legacy behavior |
|---|---|
| Generator API | generate(data_fn, out_fn, N_epochs) trains, generates, plays, then writes MIDI. |
| Default CLI epoch count | 128 if the command-line epoch argument is absent or invalid. |
| Default input | Metheny MIDI fixture path under a midi/ directory. Route compatibility checks to midi-preprocessing. |
| Default output naming | deepjazz_on_metheny...<N>_epoch(s).midi under a midi/ directory. Prefer explicit .midi output paths in adaptations. |
| Model settings | max_len=20, max_tries=1000, diversity=0.5. |
| Music settings | tempo marker bpm=130. |
| Training | Two stacked LSTM(128) layers with dropout, categorical crossentropy, RMSprop, batch size 128, nb_epoch=N_epochs. |
| Safety hazards | Full generation can be slow, nondeterministic, playback-dependent, and write output files. The bundled helper avoids all of those side effects. |
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).