[Prototype] Improved model preprocessing, new batch structure#471
Draft
jlamypoirier wants to merge 2 commits intojlp_simplify_mtpfrom
Draft
[Prototype] Improved model preprocessing, new batch structure#471jlamypoirier wants to merge 2 commits intojlp_simplify_mtpfrom
jlamypoirier wants to merge 2 commits intojlp_simplify_mtpfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ Description
Main features:
PreprocessedBatchstructure to handle this preprocessing, and potentially replace the arbitrarykwargswe pass to the layers.samples(mostly). We now pack documents directly into batches, and always use the varlen implementation of mixers (no cross-document attention. Merge thebatchandsequencedimensions into a singletokendimension.Detailed changes (non-exhaustive):
BatchPreprocessingConfigstructure (ex.LanguageModelBatchPreprocessingConfig) which configures both data and model preprocessing.Sample/Batchstructure intoDocument(single document) andBatch(multiple documents, inherit fromSample). Convert to dataclasses, remove methods from abstract base classes as the functionnality may depend on the document type.PreprocessedBatchstructure which handles model preprocessing and store its result as a list ofMicroBatch(actually micro-sequences).num_tokenskwarg/attribute to keep track of this padding.sample->document/batchNone. Handle theseNoneentries inBatch.from_documentsand inPreprocessedBatch.from_batch.memmapdirectory.get_preprocessing_configto base models and layers, which helps constructing the model preprocessing config based on what the model needs. This follows the same structure as thepreprocessmethod, which it aims to replace.cross_document_attentionfield, always use varlen attention.preprocess_meta, adjustpreprocess_batchto take aPreprocessedBatchSamplingData, ReworkGPTData.setupintosample_datasetwhich samples one dataset at the time, which evaluators call directly.Future steps:
kwargsin layers with theMicroBatchstructure.preprocessmethod in base models and layers. (Still needed for rotary embeddings and stochastic mixer)preprocess_batch, which now takes an already preprocessed batch as input. Seems to be mostly about running reference models now.Open questions:
use_loss_masking_spanstoTrue?