executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
generationGuides agents through textgenrnn generate, generate_samples, generate_to_file, save/load, prefix, temperature, interactive, and synthesize workflows.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this sub-skill when the user wants to run, inspect, or troubleshoot
text generation with textgenrnn models. It covers default bundled weights,
custom weight/vocabulary/config triplets, sampling controls, interactive
next-token selection, writing generated text to files, weight save/load, and
multi-model synthesis.
Do not reopen the source repository or notebooks for these tasks. Use this router plus the bundled references and helper script.
Activate this sub-skill for requests that mention any of the following with
textgenrnn:
textgenrnn() or load pretrained/default weights;generate, generate_samples, or generate_to_file;prefix, temperature, temperature cycles, or max_gen_length;interactive=True, top_n, or terminal next-character controls;save or load;weights_path, vocab_path, and config_path files;synthesize or synthesize_to_file;Stay in this sub-skill for generation-time behavior only.
train_on_texts, train_new_model, train_from_file, or
train_from_largetext_file, route to training.encode_text_vectors, PCA/t-SNE vectors, and similarity, route to
embedding-analysis.pkg_resources
problems, consult the root
installation and compatibility guide.from textgenrnn import textgenrnn.textgenrnn==2.0.0.pkg_resources is available through a compatible setuptools install.textgenrnn(...).generate(..., return_as_list=True) so generated
strings are returned instead of only printed.generate_to_file(destination_path, ...) or
scripts/smoke_generate.py --output-file ....max_gen_length small for smoke tests and increase it only when the
user asks for longer outputs.Minimal API example:
from textgenrnn import textgenrnn
textgen = textgenrnn()
texts = textgen.generate(n=3, return_as_list=True, max_gen_length=80,
progress=False)
Custom model example:
from textgenrnn import textgenrnn
textgen = textgenrnn(weights_path="my_model_weights.hdf5",
vocab_path="my_model_vocab.json",
config_path="my_model_config.json",
name="my_model")
texts = textgen.generate(n=2, prefix="Once", temperature=[0.2, 1.0],
max_gen_length=120, return_as_list=True,
progress=False)
temperature may be one float or a list of floats. A list cycles across
generated tokens, which can mix conservative and creative sampling.prefix seeds the generated text. Characters or words not in the model
vocabulary may be encoded as unknowns, so a prefix cannot guarantee quality.max_gen_length limits generated token length, not training context length;
model context length comes from the config max_length.progress=False for automation to avoid progress bars.Use generate(interactive=True, top_n=N) only in a real terminal with stdin.
The model prints the top N next character/word choices and accepts:
s to stop;x to backspace;o to type a custom token.Do not use interactive mode in unattended scripts, CI jobs, notebooks without stdin, or background agent runs.
generate_to_file(destination_path, **kwargs) overwrites the destination and
writes one generated text per line.save(weights_path="textgenrnn_weights_saved.hdf5") saves weights only.load(weights_path) reloads weights into the current architecture and current
vocabulary/config. For custom architectures, instantiate with the correct
config_path and vocab_path before loading weights.Import synthesis helpers from textgenrnn.utils:
from textgenrnn.utils import synthesize, synthesize_to_file
Pass a list of instantiated textgenrnn objects. Synthesis shuffles model order
for each generated text and switches models at stop tokens by default. Use
stop_tokens=[] to switch after every character for character-level models.
From the generated skill directory or any other working directory with a compatible installed textgenrnn environment:
python sub-skills/generation/scripts/smoke_generate.py \
--n 2 --prefix "Once" --temperature 0.2,1.0 --max-gen-length 80 \
--output-file generated.txt
Use --weights-path, --vocab-path, and --config-path together for a custom
scratch-trained model. Add --quiet when only the output file matters.