-
Notifications
You must be signed in to change notification settings - Fork 230
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
Integrate distributed inference with chat/server #1381
Merged
Jack-Khuu
merged 20 commits into
pytorch:main
from
mreso:refactor/distributed_inference_without_abstraction
Dec 19, 2024
Merged
Changes from 3 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
7b4d5c5
Integrate distributed inference without introducing abstraction
mreso e7670c3
Cleanup old distributed inference integration
mreso 08a8e03
Merge branch 'main' into refactor/distributed_inference_without_abstr…
mreso d5bca9b
Read distribution from model_config
mreso 76895cc
Declare distribution_path if args.model is not given
mreso 3ef1296
Address some nits from PR review
mreso 04cdfd0
Merge branch 'main' into refactor/distributed_inference_without_abstr…
mreso 924a096
Merge branch 'main' into refactor/distributed_inference_without_abstr…
mreso 99c33e8
Merge branch 'main' into refactor/distributed_inference_without_abstr…
Jack-Khuu 773894f
Merge remote-tracking branch 'origin/main' into refactor/distributed_…
mreso 7cb98c9
Added comment on model size all reduce + type hint
mreso 10fb55a
Apply suggestions from code review
mreso 28d7836
Make sure speculative decoding is disable for pp >1 and remark this i…
mreso 68eec0b
Refactor conditions in pp
mreso 3ad31e8
Rename and alter signature of setup_env to reflect that it also runs …
mreso e07b03d
Rename setup_env in server + fix condition
mreso daf902c
Merge branch 'main' into refactor/distributed_inference_without_abstr…
Jack-Khuu db5fd1b
Merge branch 'main' into refactor/distributed_inference_without_abstr…
Jack-Khuu 7ac16f9
Update generate.py
Jack-Khuu 7650153
Add default value to add_generation_prompt to preserve bc
mreso File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the gap to using the models described in
model_config/models.json
. (as implied by TODO comment)Definitely should not be part of the present PR, but I think as a north star, it would be desirable to grab the same models (and download and mgmt infra etc) for non-distributed and distributed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the comment @mikekgfb. The gap wasn't that big, the args.model just wasn't accessible at that point and I wanted to take a deeper look to fix it right. Removed the cruel hack and I now save the distribution_path when creating the builder_arg. Still not sure if this is the intended way of locating the checkpoint though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you're trying to do. If it's just that the dict/json data structure describing the mapping isn't in scope, maybe what you want is some methods that give you the relevant info?
Also, these seem to be mapping of short names to HF network paths - should we not have a way to [ick them from the local filesystem (since the torchchat cli already manages download and all that). Oh, and if the answer is "we have bigger fish to fry, hooking this up is not highest priority" I will wholeheartedly agree. This is more about understanding the context of this PR.
Where I'm lacking the context is how you go from all the weights being available locally on a node to reading those weights on another node? And maybe that's why you prefer to straight up pick the files from HF? (Although local distribution from an already downloaded set of weights probs has higher bandwidth?) Again, there's much bigger fish to fry, and I think this PR is a good step in the direction of frying those fish ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, let me try to fill in some context for this PR. Previously, the distributed inference solution lived completely separate in its own script (within the torchchat repo but) separate from torchchat.py. Distributed provides its own utils to load either hf or torchchat weights (where the torchchat part is currently broken IIRC). In a previous PR (#1327), I enabled the usage of
torchchat.py generate
with a distributed model. This PR only progresses the integration into the cli by enabling chat/server but stops short from replacing the weight loading mechanics which are still custom to distributed.So, yes, for this PR I was only looking for a quick and dirty way to map arg.model_name -> "huggingface distribution str" (without actually having model_name at hand) to load the weights from the hf cache. I now modified the PR to use the information provided in the model_config/models.json as you suggested. In a next PR we should then alter
torchchat/distributed/checkpoint_utils.py
to leverage torchchat infra like (e.g. builder_args) to locate and access the files.