Delete original.py
Browse files- original.py +0 -24
original.py
DELETED
@@ -1,24 +0,0 @@
|
|
1 |
-
|
2 |
-
model_name_or_path = "/home/yerong2/models/internlm-xcomposer2d5-7b"
|
3 |
-
|
4 |
-
import torch
|
5 |
-
from transformers import AutoModel, AutoTokenizer
|
6 |
-
|
7 |
-
|
8 |
-
model = AutoModel.from_pretrained(model_name_or_path, trust_remote_code=True).eval().cuda().half()
|
9 |
-
|
10 |
-
|
11 |
-
from flash_attn import flash_attn_qkvpacked_func, flash_attn_func
|
12 |
-
|
13 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True)
|
14 |
-
tokenizer = tokenizer
|
15 |
-
model.tokenizer = tokenizer
|
16 |
-
|
17 |
-
query = 'Image1 <ImageHere>; Image2 <ImageHere>; Image3 <ImageHere>; I want to buy a car from the three given cars, analyze their advantages and weaknesses one by one'
|
18 |
-
image = ['./examples/cars1.jpg',
|
19 |
-
'./examples/cars2.jpg',
|
20 |
-
'./examples/cars3.jpg',]
|
21 |
-
with torch.autocast(device_type='cuda', dtype=torch.bfloat16):
|
22 |
-
response, his = model.chat(tokenizer, query, image, do_sample=False, num_beams=3, use_meta=True)
|
23 |
-
print(response)
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|