-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
example: make chatglm6b model small (#2271)
- Loading branch information
Showing
2 changed files
with
16 additions
and
3 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,8 +1,15 @@ | ||
from pathlib import Path | ||
|
||
from transformers import AutoModel, AutoTokenizer | ||
|
||
ROOTDIR = Path(__file__).parent | ||
print(str(ROOTDIR / "models")) | ||
tokenizer = AutoTokenizer.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True) | ||
model = ( | ||
AutoModel.from_pretrained("THUDM/chatglm-6b", trust_remote_code=True).half().cuda() | ||
) | ||
tokenizer.save_pretrained("./models") | ||
model.save_pretrained("./models") | ||
print(str(ROOTDIR / "models")) | ||
tokenizer.save_pretrained(str(ROOTDIR / "models")) | ||
model.save_pretrained(str(ROOTDIR / "models")) | ||
del model | ||
del tokenizer |
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