myownskyW7
commited on
Commit
•
d7ab428
1
Parent(s):
eb081b5
Update README.md
Browse files
README.md
CHANGED
@@ -35,8 +35,9 @@ from PIL import Image
|
|
35 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
36 |
ckpt_path = "internlm/internlm-xcomposer2-7b"
|
37 |
tokenizer = AutoTokenizer.from_pretrained(ckpt_path, trust_remote_code=True)
|
|
|
38 |
# Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
|
39 |
-
model = AutoModelForCausalLM.from_pretrained(ckpt_path, torch_dtype=torch.float16, trust_remote_code=True).cuda()
|
40 |
model = model.eval()
|
41 |
img_path_list = [
|
42 |
'./panda.jpg',
|
@@ -72,8 +73,9 @@ from PIL import Image
|
|
72 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
73 |
ckpt_path = "internlm/internlm-xcomposer2-7b"
|
74 |
tokenizer = AutoTokenizer.from_pretrained(ckpt_path, trust_remote_code=True)
|
|
|
75 |
# `torch_dtype=torch.float16` 可以令模型以 float16 精度加载,否则 transformers 会将模型加载为 float32,导致显存不足
|
76 |
-
model = AutoModelForCausalLM.from_pretrained(ckpt_path, torch_dtype=torch.float16, trust_remote_code=True).cuda()
|
77 |
model = model.eval()
|
78 |
img_path_list = [
|
79 |
'./panda.jpg',
|
|
|
35 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
36 |
ckpt_path = "internlm/internlm-xcomposer2-7b"
|
37 |
tokenizer = AutoTokenizer.from_pretrained(ckpt_path, trust_remote_code=True)
|
38 |
+
model = AutoModelForCausalLM.from_pretrained(ckpt_path, torch_dtype=torch.float32, trust_remote_code=True).cuda()
|
39 |
# Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
|
40 |
+
# model = AutoModelForCausalLM.from_pretrained(ckpt_path, torch_dtype=torch.float16, trust_remote_code=True).cuda()
|
41 |
model = model.eval()
|
42 |
img_path_list = [
|
43 |
'./panda.jpg',
|
|
|
73 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
74 |
ckpt_path = "internlm/internlm-xcomposer2-7b"
|
75 |
tokenizer = AutoTokenizer.from_pretrained(ckpt_path, trust_remote_code=True)
|
76 |
+
model = AutoModelForCausalLM.from_pretrained(ckpt_path, torch_dtype=torch.float32, trust_remote_code=True).cuda()
|
77 |
# `torch_dtype=torch.float16` 可以令模型以 float16 精度加载,否则 transformers 会将模型加载为 float32,导致显存不足
|
78 |
+
# model = AutoModelForCausalLM.from_pretrained(ckpt_path, torch_dtype=torch.float16, trust_remote_code=True).cuda()
|
79 |
model = model.eval()
|
80 |
img_path_list = [
|
81 |
'./panda.jpg',
|