Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user selected max_seq_len should be less than model's max_seq_len #6333

Merged
merged 4 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pipeline_model_parallel_size: 1
gpt_model_file: null # GPT nemo file path
virtual_prompt_model_file: ??? # path to a MegatronGPTPromptLearningModel model if you want to use soft prompts
pred_file_path: ??? # Path will model predictions will be written
max_seq_length: 8192 # this will filter out inputs whose length is longer than the set value form the generation process.
data_paths: # paths to .jsonl files you want to perform inference on
num_workers: 8

Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,13 @@ def placeholder():
"compute_logprob": cfg.inference.compute_logprob,
}

max_input_length = model.frozen_model.cfg.encoder_seq_length - length_params["max_length"]
max_seq_length = model.frozen_model.cfg.encoder_seq_length - length_params["max_length"]
max_seq_length = min(max_seq_length, cfg.get("max_seq_length", 8192))

_, dataloader = model.build_virtual_prompt_dataset(
data=cfg.data_paths,
batch_size=cfg.inference.get('batch_size', 1),
max_seq_length=max_input_length,
max_seq_length=max_seq_length,
min_seq_length=model.cfg.data.get('min_seq_length', 1),
add_bos=sampling_params["add_BOS"],
add_eos=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ def setup_training_data(self, training_data_config=None):
if self.cfg.data.get('train_ds', None):
max_seq_length = self.frozen_model.cfg.encoder_seq_length
if "max_seq_length" in self.cfg.data and self.cfg.data.max_seq_length:
max_seq_length = self.cfg.data.max_seq_length
max_seq_length = min(max_seq_length, self.cfg.data.max_seq_length)
self._train_ds, self._train_dl = self.build_virtual_prompt_dataset(
data=self.cfg.data.train_ds,
batch_size=self.cfg.global_batch_size,
Expand All @@ -426,7 +426,7 @@ def setup_validation_data(self, validation_data_config=None):
if self.cfg.data.get('validation_ds', None):
max_seq_length = self.frozen_model.cfg.encoder_seq_length
if "max_seq_length" in self.cfg.data and self.cfg.data.max_seq_length:
max_seq_length = self.cfg.data.max_seq_length
max_seq_length = min(max_seq_length, self.cfg.data.max_seq_length)
self._validation_ds, self._validation_dl = self.build_virtual_prompt_dataset(
data=self.cfg.data.validation_ds,
batch_size=self.cfg.get('validation_global_batch_size', self.cfg.global_batch_size),
Expand Down