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

Offsite-tuning model generation #676

Open
wants to merge 21 commits into
base: dev/llm
Choose a base branch
from
Open

Conversation

HarliWu
Copy link

@HarliWu HarliWu commented Aug 8, 2023

There are two main updates:

  1. fschat.py: The users can call next_model() to switch to the next model when multiple checkpoints are available.
  2. utils.py: We can add new functions to support new offsite-tuning strategies (Note: you are required to add the new function to generate_adap_model() accordingly)

@HarliWu HarliWu changed the title Dev/llm Offsite-tuning model generation Aug 8, 2023
Copy link
Collaborator

@rayrayraykk rayrayraykk left a comment

Choose a reason for hiding this comment

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

Please see the inline comments. Thx!

else:
try:
ckpt = torch.load(config.federate.save_to, map_location='cpu')
self.prefix = ['']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should prefix be passed by the config?

@@ -54,7 +45,11 @@ def __init__(self,
os._exit(0)
# No need for this attr
if hasattr(adap_model, 'teacher'):
import gc
import torch
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about move line 48-49 to top:

try:
    import gc
    import torch
except ImportError:
    gc=None
    torch=None

new_model = set_layers(new_model, emulator_and_adapter)

if emulator_alignment:
new_model.student = layers
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please merge the latest commits in which bugs are fixed. (layers should be detached from new_model)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants