Update README.md
Browse files
README.md
CHANGED
@@ -54,13 +54,19 @@ import torch
|
|
54 |
tokenizer = AutoTokenizer.from_pretrained("biomap-research/xtrimopglm-100b-int4", trust_remote_code=True, use_fast=True)
|
55 |
config = AutoConfig.from_pretrained("biomap-research/xtrimopglm-100b-int4", trust_remote_code=True, torch_dtype=torch.half)
|
56 |
config.is_causal=False
|
57 |
-
model = AutoModelForMaskedLM.
|
|
|
|
|
|
|
58 |
# # if you don't have the single gpu with 80G memory, try the dispatch load.
|
|
|
|
|
|
|
|
|
59 |
# model = load_checkpoint_and_dispatch(
|
60 |
-
# model, "
|
61 |
# )
|
62 |
-
|
63 |
-
model = model.cuda()
|
64 |
model.eval()
|
65 |
|
66 |
seq = 'MILMCQHFSGQFSKYFLAVSSDFCHFVFPIILVSHVNFKQMKRKGFALWNDRAVPFTQGIFTTVMILLQYLHGTG'
|
@@ -86,13 +92,18 @@ import torch
|
|
86 |
tokenizer = AutoTokenizer.from_pretrained("biomap-research/xtrimopglm-100b-int4", trust_remote_code=True, use_fast=True)
|
87 |
config = AutoConfig.from_pretrained("biomap-research/xtrimopglm-100b-int4", trust_remote_code=True, torch_dtype=torch.half)
|
88 |
config.is_causal=True
|
89 |
-
model = AutoModelForCausalLM.
|
|
|
|
|
|
|
90 |
# # if you don't have the single gpu with 80G memory, try the dispatch load.
|
|
|
|
|
|
|
|
|
91 |
# model = load_checkpoint_and_dispatch(
|
92 |
-
# model, "
|
93 |
# )
|
94 |
-
if torch.cuda.is_available():
|
95 |
-
model = model.cuda()
|
96 |
model.eval()
|
97 |
|
98 |
gen_kwargs = {'max_length': 256, 'top_p': 0.8, 'temperature':0.9, "num_beams": 1}
|
|
|
54 |
tokenizer = AutoTokenizer.from_pretrained("biomap-research/xtrimopglm-100b-int4", trust_remote_code=True, use_fast=True)
|
55 |
config = AutoConfig.from_pretrained("biomap-research/xtrimopglm-100b-int4", trust_remote_code=True, torch_dtype=torch.half)
|
56 |
config.is_causal=False
|
57 |
+
model = AutoModelForMaskedLM.from_pretrained("biomap-research/xtrimopglm-100b-int4", config = config, torch_dtype=torch.half,trust_remote_code=True)
|
58 |
+
if torch.cuda.is_available():
|
59 |
+
model = model.cuda()
|
60 |
+
|
61 |
# # if you don't have the single gpu with 80G memory, try the dispatch load.
|
62 |
+
# from accelerate import load_checkpoint_and_dispatch, init_empty_weights
|
63 |
+
# with init_empty_weights():
|
64 |
+
# model = AutoModelForMaskedLM.from_config(config, trust_remote_code=True)
|
65 |
+
#
|
66 |
# model = load_checkpoint_and_dispatch(
|
67 |
+
# model, "<your model cached dir>", device_map="auto", no_split_module_classes=["xTrimoPGLMBlock"], strict=True, dtype=dtype
|
68 |
# )
|
69 |
+
|
|
|
70 |
model.eval()
|
71 |
|
72 |
seq = 'MILMCQHFSGQFSKYFLAVSSDFCHFVFPIILVSHVNFKQMKRKGFALWNDRAVPFTQGIFTTVMILLQYLHGTG'
|
|
|
92 |
tokenizer = AutoTokenizer.from_pretrained("biomap-research/xtrimopglm-100b-int4", trust_remote_code=True, use_fast=True)
|
93 |
config = AutoConfig.from_pretrained("biomap-research/xtrimopglm-100b-int4", trust_remote_code=True, torch_dtype=torch.half)
|
94 |
config.is_causal=True
|
95 |
+
model = AutoModelForCausalLM.from_pretrained("biomap-research/xtrimopglm-100b-int4", config = config, torch_dtype=torch.half,trust_remote_code=True)
|
96 |
+
if torch.cuda.is_available():
|
97 |
+
model = model.cuda()
|
98 |
+
|
99 |
# # if you don't have the single gpu with 80G memory, try the dispatch load.
|
100 |
+
# from accelerate import load_checkpoint_and_dispatch, init_empty_weights
|
101 |
+
# with init_empty_weights():
|
102 |
+
# model = AutoModelForMaskedLM.from_config(config, trust_remote_code=True)
|
103 |
+
#
|
104 |
# model = load_checkpoint_and_dispatch(
|
105 |
+
# model, "<your model cached dir>", device_map="auto", no_split_module_classes=["xTrimoPGLMBlock"], strict=True, dtype=dtype
|
106 |
# )
|
|
|
|
|
107 |
model.eval()
|
108 |
|
109 |
gen_kwargs = {'max_length': 256, 'top_p': 0.8, 'temperature':0.9, "num_beams": 1}
|