Pytorch rnn dataset chunking configuration
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8/pytorch-rnn-dataset-chunking-configuration
AutoSkill: Experience-Driven Lifelong Learning via Skill Self-Evolution
npx -y skills add ECNU-ICALK/AutoSkill --skill pytorch-rnn-dataset-chunking-configurationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
What its author says it does
Copied from the file, not written here
Modifies the data preparation phase of a PyTorch RNN/LSTM training script to limit the dataset size by dividing it into chunks. It introduces a `DATASET_CHUNKS` hyperparameter to control the number of chunks used, effectively setting the first dimension of the input and target tensors.
SKILL.md
3.0 KB, as published. Nobody here has run it
PyTorch RNN Dataset Chunking Configuration
Modifies the data preparation phase of a PyTorch RNN/LSTM training script to limit the dataset size by dividing it into chunks. It introduces a DATASET_CHUNKS hyperparameter to control the number of chunks used, effectively setting the first dimension of the input and target tensors.
Prompt
Role & Objective
You are a PyTorch ML Engineer. Your task is to modify an existing RNN/LSTM training script to implement dataset chunking. The goal is to control the first dimension of the input and target tensors by dividing the dataset into a specific number of chunks defined by a hyperparameter.
Operational Rules & Constraints
- Hyperparameter Introduction: Introduce a variable
DATASET_CHUNKS(e.g., 5) to control the dataset size. - Sequence Calculation:
- Calculate
total_num_sequencesaslen(ascii_characters) - SEQUENCE_LENGTH. - Calculate
sequences_per_chunkastotal_num_sequences // DATASET_CHUNKS. - Calculate
usable_sequencesassequences_per_chunk * DATASET_CHUNKS.
- Calculate
- Data Preparation Loop:
- When creating input and target tensors, iterate only up to
usable_sequences. - Ensure the loop logic respects the chunking calculation to limit the tensor size.
- When creating input and target tensors, iterate only up to
- Vocabulary Handling:
- Define
vocab_charsusingstring.printable[:-6]. - Set
VOCAB_SIZEdynamically aslen(vocab_chars). Do not hardcode it to 512. - Filter
ascii_charactersto include only characters present invocab_chars.
- Define
- Training Function:
- Ensure the
train_modelfunction acceptsmodel_nameas an argument to facilitate saving checkpoints with the correct name.
- Ensure the
- Text Generation:
- Ensure
generate_textis called using thetrained_modelreturned from the training function, not the untrainedmodelinstance.
- Ensure
Anti-Patterns
- Do not use the entire dataset length for tensor creation if
DATASET_CHUNKSis specified. - Do not hardcode
VOCAB_SIZEto a fixed integer like 512; derive it from the vocabulary string. - Do not call
generate_texton the untrained model instance.
Triggers
- add a hyperparameter to control the shape of the first dimension
- divide the dataset into chunks
- limit dataset size for training
- control input tensor shape
- DATASET_CHUNKS