yongqiang
commited on
Commit
·
5a3d81c
1
Parent(s):
6fb90cb
init
Browse files- embeds/SmolVLMVisionEmbeddings.pkl +3 -0
- infer_axmodel.py +6 -6
embeds/SmolVLMVisionEmbeddings.pkl
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cab5d95b958d2cd6173c887bd98cab7accda22e8d321f7c348464e428b59f675
|
3 |
+
size 2758065
|
infer_axmodel.py
CHANGED
@@ -12,10 +12,10 @@ from ml_dtypes import bfloat16
|
|
12 |
|
13 |
|
14 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
15 |
-
embeddings = torch.load("SmolVLMVisionEmbeddings.pkl", map_location=device, weights_only=False)
|
16 |
-
embeds = np.load(os.path.join("./
|
17 |
# connector = torch.load("SmolVLMConnector.pkl", map_location=device, weights_only=False)
|
18 |
-
encoder = ort.InferenceSession(f'./
|
19 |
|
20 |
|
21 |
def run_vision_model(
|
@@ -164,8 +164,8 @@ def post_process(data, topk=1, topp=0.9, temperature=0.6):
|
|
164 |
|
165 |
if __name__ == "__main__":
|
166 |
|
167 |
-
hf_model_path = "./
|
168 |
-
axmodel_path = "./
|
169 |
prompt = 'Can you describe this image?'
|
170 |
|
171 |
processor = AutoProcessor.from_pretrained(hf_model_path)
|
@@ -176,7 +176,7 @@ if __name__ == "__main__":
|
|
176 |
{
|
177 |
"role": "user",
|
178 |
"content": [
|
179 |
-
{"type": "image", "url": "./bee.jpg"},
|
180 |
{"type": "text", "text": prompt},
|
181 |
]
|
182 |
},
|
|
|
12 |
|
13 |
|
14 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
15 |
+
embeddings = torch.load("./embeds/SmolVLMVisionEmbeddings.pkl", map_location=device, weights_only=False)
|
16 |
+
embeds = np.load(os.path.join("./smolvlm2_axmodel", "model.embed_tokens.weight.npy"))
|
17 |
# connector = torch.load("SmolVLMConnector.pkl", map_location=device, weights_only=False)
|
18 |
+
encoder = ort.InferenceSession(f'./vit_mdoel/vision_model.onnx', providers=["CPUExecutionProvider"])
|
19 |
|
20 |
|
21 |
def run_vision_model(
|
|
|
164 |
|
165 |
if __name__ == "__main__":
|
166 |
|
167 |
+
hf_model_path = "./smolvlm2_tokenizer/"
|
168 |
+
axmodel_path = "./smolvlm2_axmodel"
|
169 |
prompt = 'Can you describe this image?'
|
170 |
|
171 |
processor = AutoProcessor.from_pretrained(hf_model_path)
|
|
|
176 |
{
|
177 |
"role": "user",
|
178 |
"content": [
|
179 |
+
{"type": "image", "url": "./assets/bee.jpg"},
|
180 |
{"type": "text", "text": prompt},
|
181 |
]
|
182 |
},
|