Gengzigang
commited on
Commit
·
088b1e4
1
Parent(s):
9e2e7d2
fix
Browse files
README.md
CHANGED
|
@@ -87,10 +87,10 @@ image_path = "CLIP.png"
|
|
| 87 |
|
| 88 |
image = Image.open(image_path)
|
| 89 |
input_pixels = processor(images=image, return_tensors="pt").pixel_values.to('cuda')
|
|
|
|
| 90 |
|
| 91 |
with torch.no_grad(), torch.cuda.amp.autocast():
|
| 92 |
image_features = model.get_image_features(input_pixels)
|
| 93 |
-
text_features = l2v.encode(captions, convert_to_tensor=True).to('cuda')
|
| 94 |
text_features = model.get_text_features(text_features)
|
| 95 |
|
| 96 |
image_features /= image_features.norm(dim=-1, keepdim=True)
|
|
|
|
| 87 |
|
| 88 |
image = Image.open(image_path)
|
| 89 |
input_pixels = processor(images=image, return_tensors="pt").pixel_values.to('cuda')
|
| 90 |
+
text_features = l2v.encode(captions, convert_to_tensor=True).to('cuda')
|
| 91 |
|
| 92 |
with torch.no_grad(), torch.cuda.amp.autocast():
|
| 93 |
image_features = model.get_image_features(input_pixels)
|
|
|
|
| 94 |
text_features = model.get_text_features(text_features)
|
| 95 |
|
| 96 |
image_features /= image_features.norm(dim=-1, keepdim=True)
|