forked from huggingface/text-generation-inference
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(server): Rework model loading (huggingface#344)
# What does this PR do? Reworked the loading logic. Idea is to use cleaner loading code: - Remove need for `no_init_weights` - Remove all weird `bnb_linear` and `load_weights` and `post_load_weights`. New code layout: - New class `Weights` in charge of handling loading the weights from multiple files into appropiate tensors (potentially sharded) - TP layers now are "shells", they contain the code to know what kind of sharding we need + eventual `all_reduce`. They do not inherit from linear, but they contain some kind of Linear instead - the contained linear can be either FastLinear, BnbLinear or GPTq Linear next. - All modeling code is explictly made for sharding, process group is just no-ops for non sharded code (removes a lot of test cases) ![Screenshot from 2023-05-19 23-19-59](https://github.com/huggingface/text-generation-inference/assets/204321/9a802654-74a3-488c-87a8-073743a6143f) --------- Co-authored-by: Ubuntu <[email protected]> Co-authored-by: Ubuntu <[email protected]> Co-authored-by: OlivierDehaene <[email protected]> Co-authored-by: OlivierDehaene <[email protected]>
- Loading branch information
1 parent
19c4182
commit abd58ff
Showing
43 changed files
with
6,794 additions
and
2,781 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
target | ||
router/tokenizer.json | ||
*__pycache__* |
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
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
113 changes: 113 additions & 0 deletions
113
integration-tests/models/__snapshots__/test_neox/test_neox.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
{ | ||
"details": { | ||
"best_of_sequences": null, | ||
"finish_reason": "length", | ||
"generated_tokens": 10, | ||
"prefill": [ | ||
{ | ||
"id": 50278, | ||
"logprob": null, | ||
"text": "<|USER|>" | ||
}, | ||
{ | ||
"id": 1276, | ||
"logprob": -4.5546875, | ||
"text": "What" | ||
}, | ||
{ | ||
"id": 434, | ||
"logprob": -4.1992188, | ||
"text": "'s" | ||
}, | ||
{ | ||
"id": 634, | ||
"logprob": -5.125, | ||
"text": " your" | ||
}, | ||
{ | ||
"id": 12315, | ||
"logprob": -9.8984375, | ||
"text": " mood" | ||
}, | ||
{ | ||
"id": 3063, | ||
"logprob": -4.0976562, | ||
"text": " today" | ||
}, | ||
{ | ||
"id": 32, | ||
"logprob": -0.14562988, | ||
"text": "?" | ||
}, | ||
{ | ||
"id": 50279, | ||
"logprob": -0.26733398, | ||
"text": "<|ASSISTANT|>" | ||
} | ||
], | ||
"seed": null, | ||
"tokens": [ | ||
{ | ||
"id": 42, | ||
"logprob": -0.86279297, | ||
"special": false, | ||
"text": "I" | ||
}, | ||
{ | ||
"id": 1353, | ||
"logprob": -0.94921875, | ||
"special": false, | ||
"text": "'m" | ||
}, | ||
{ | ||
"id": 7016, | ||
"logprob": -2.1835938, | ||
"special": false, | ||
"text": " sorry" | ||
}, | ||
{ | ||
"id": 13, | ||
"logprob": -0.074035645, | ||
"special": false, | ||
"text": "," | ||
}, | ||
{ | ||
"id": 1394, | ||
"logprob": -0.86376953, | ||
"special": false, | ||
"text": "You" | ||
}, | ||
{ | ||
"id": 452, | ||
"logprob": -1.2070312, | ||
"special": false, | ||
"text": " have" | ||
}, | ||
{ | ||
"id": 247, | ||
"logprob": -1.4365234, | ||
"special": false, | ||
"text": " a" | ||
}, | ||
{ | ||
"id": 4327, | ||
"logprob": -1.109375, | ||
"special": false, | ||
"text": " choice" | ||
}, | ||
{ | ||
"id": 273, | ||
"logprob": -0.93408203, | ||
"special": false, | ||
"text": " of" | ||
}, | ||
{ | ||
"id": 752, | ||
"logprob": -1.8808594, | ||
"special": false, | ||
"text": " what" | ||
} | ||
] | ||
}, | ||
"generated_text": "I'm sorry,You have a choice of what" | ||
} |
Oops, something went wrong.