Update README.md
Browse files
README.md
CHANGED
@@ -55,12 +55,19 @@ from transformers import AutoModel, CLIPImageProcessor
|
|
55 |
from transformers import AutoTokenizer
|
56 |
|
57 |
path = "OpenGVLab/InternVL-Chat-Chinese-V1-1"
|
|
|
58 |
model = AutoModel.from_pretrained(
|
59 |
path,
|
60 |
torch_dtype=torch.bfloat16,
|
61 |
low_cpu_mem_usage=True,
|
62 |
-
trust_remote_code=True
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
tokenizer = AutoTokenizer.from_pretrained(path)
|
66 |
image = Image.open('./examples/image2.jpg').convert('RGB')
|
|
|
55 |
from transformers import AutoTokenizer
|
56 |
|
57 |
path = "OpenGVLab/InternVL-Chat-Chinese-V1-1"
|
58 |
+
# If your GPU has more than 40G memory, you can put the entire model on a single GPU.
|
59 |
model = AutoModel.from_pretrained(
|
60 |
path,
|
61 |
torch_dtype=torch.bfloat16,
|
62 |
low_cpu_mem_usage=True,
|
63 |
+
trust_remote_code=True).eval().cuda()
|
64 |
+
# Otherwise, you need to set device_map='auto' to use multiple GPUs for inference.
|
65 |
+
# model = AutoModel.from_pretrained(
|
66 |
+
# path,
|
67 |
+
# torch_dtype=torch.bfloat16,
|
68 |
+
# low_cpu_mem_usage=True,
|
69 |
+
# trust_remote_code=True,
|
70 |
+
# device_map='auto').eval()
|
71 |
|
72 |
tokenizer = AutoTokenizer.from_pretrained(path)
|
73 |
image = Image.open('./examples/image2.jpg').convert('RGB')
|