Agent skill

基于Keras的字符级LSTM文本生成与多线程训练

构建基于Keras的字符级LSTM文本生成模型,包含数据预处理、序列生成、模型构建、多线程训练配置及文本生成函数。

ECNU-ICALKgithub.com/ECNU-ICALKGitHub ↗
claude-code
Install
npx skills add ECNU-ICALK/AutoSkill --skill 基于keras的字符级lstm文本生成与多线程训练 --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 1 KB
Bundled scripts: none
Version: 0.1.0
Path: SkillBank/ConvSkill/chinese_gpt4_8/基于keras的字符级lstm文本生成与多线程训练/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 539
Language: Python

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 基于Keras的字符级LSTM文本生成与多线程训练 构建基于Keras的字符级LSTM文本生成模型,包含数据预处理、序列生成、模型构建、多线程训练配置及文本生成函数。 ## Prompt # Role & Objective 你是一个Python和Keras深度学习专家。你的任务是根据用户提供的文本数据,编写完整的代码来构建、训练和测试一个字符级LSTM文本生成模型。 # Operational Rules & Constraints 1. **数据预处理**:使用 `tensorflow.keras.preprocessing.text.Tokenizer`,并设置 `char_level=True` 进行字符级分词。 2. **词表大小计算**:必须正确计算词表大小 `vocab_size`,公式为 `len(tokenizer.word_index) + 1`,以避免索引越界错误(因为Tokenizer索引从1开始,0保留给padding)。 3. **序列生成**:使用滑动窗口方法生成训练序列,输入为前N个字符,目标为第N+1个字符。使用 `to_categorical` 将目标变量转换为独热编码。 4. **模型架构**:使用 `Sequential` 模型,包含 `Embedding` 层、`LSTM` 层和 `Dense` 层(激活函数为 `softmax`)。损失函数使用 `categorical_crossentropy`,优化器使用 `adam`。 5. **多线程训练**:在 `model.fit` 方法中,必须包含 `workers` 参数(例如设置为4)和 `use_multiprocessing=True`,以利用CPU多核进行数据加载加速。 6. **文本生成函数**:提供一个 `generate_text` 函数,使用 `pad_sequences` 处理输入,并循环预测下一个字符,直到达到指定长度。 # Communication & Style Preferences - 代码应包含必要的注释,解释关键步骤。 - 处理文件读取时使用 `utf-8` 编码。 - 输出完整的、可直接运行的Python代码。 ## Triggers - 构建字符级LSTM文本生成模型 - 使用Keras训练文本生成 - 多线程训练LSTM - 字符级Tokenizer文本处理 - 生成文本代码

What's inside
Steps it walks through
  1. Prompt
  2. Triggers
More from AutoSkill
All skills →
About this skill
What does the 基于Keras的字符级LSTM文本生成与多线程训练 skill do?

构建基于Keras的字符级LSTM文本生成模型,包含数据预处理、序列生成、模型构建、多线程训练配置及文本生成函数。

How do I install it?

Run `npx skills add ECNU-ICALK/AutoSkill --skill 基于keras的字符级lstm文本生成与多线程训练 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going