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

Fix for prompt table restore error #5393

Merged
merged 6 commits into from
Nov 14, 2022
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 @@ -436,6 +436,12 @@ def save_checkpoint_as_nemo_file(self):
self.virtual_prompt_style = current_virtual_prompt_style
self.virtual_prompt_source = current_virtual_prompt_source

# Revert prompt table back to previous state
if self.virtual_prompt_style == VirtualPromptStyle.P_TUNING and self.first_stage_of_pipeline():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we would want to move any mentions of a specific prompt type outside of the base class. ok for now.

for taskname in current_new_tasks:
if taskname in self.prompt_table.prompt_table:
del self.prompt_table.prompt_table[taskname]

with open_dict(self.cfg):
self.cfg.existing_tasks = current_existing_tasks
self.cfg.new_tasks = current_new_tasks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,12 @@ def save_checkpoint_as_nemo_file(self):
self.virtual_prompt_style = current_virtual_prompt_style
self.virtual_prompt_source = current_virtual_prompt_source

# Revert prompt table back to previous state
if self.virtual_prompt_style == VirtualPromptStyle.P_TUNING and self.frozen_model.model.pre_process:
for taskname in current_new_tasks:
if taskname in self.prompt_table.prompt_table:
del self.prompt_table.prompt_table[taskname]

with open_dict(self.cfg):
self.cfg.existing_tasks = current_existing_tasks
self.cfg.new_tasks = current_new_tasks
Expand Down