elliesleightholm
commited on
Commit
•
6513dfd
1
Parent(s):
c418b29
Update README.md
Browse files
README.md
CHANGED
@@ -53,6 +53,7 @@ with torch.no_grad(), torch.cuda.amp.autocast():
|
|
53 |
text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)
|
54 |
|
55 |
print("Label probs:", text_probs)
|
|
|
56 |
```
|
57 |
|
58 |
### Transformers.js
|
@@ -86,12 +87,6 @@ const text_inputs = tokenizer(texts, { padding: 'max_length', truncation: true }
|
|
86 |
|
87 |
// Compute text embeddings
|
88 |
const { text_embeds } = await text_model(text_inputs);
|
89 |
-
// Tensor {
|
90 |
-
// dims: [ 2, 512 ],
|
91 |
-
// type: 'float32',
|
92 |
-
// data: Float32Array(1024) [ ... ],
|
93 |
-
// size: 1024
|
94 |
-
// }
|
95 |
|
96 |
// Read image and run processor
|
97 |
const image = await RawImage.read('https://raw.githubusercontent.com/marqo-ai/marqo-FashionCLIP/main/docs/fashion-hippo.png');
|
@@ -99,13 +94,6 @@ const image_inputs = await processor(image);
|
|
99 |
|
100 |
// Compute vision embeddings
|
101 |
const { image_embeds } = await vision_model(image_inputs);
|
102 |
-
// Tensor {
|
103 |
-
// dims: [ 1, 512 ],
|
104 |
-
// type: 'float32',
|
105 |
-
// data: Float32Array(512) [ ... ],
|
106 |
-
// size: 512
|
107 |
-
// }
|
108 |
-
|
109 |
|
110 |
// Compute similarity scores
|
111 |
const normalized_text_embeds = text_embeds.normalize().tolist();
|
|
|
53 |
text_probs = (100.0 * image_features @ text_features.T).softmax(dim=-1)
|
54 |
|
55 |
print("Label probs:", text_probs)
|
56 |
+
# [0.9998498302475922, 0.000119267522939106, 0.000030902229468640687]
|
57 |
```
|
58 |
|
59 |
### Transformers.js
|
|
|
87 |
|
88 |
// Compute text embeddings
|
89 |
const { text_embeds } = await text_model(text_inputs);
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
// Read image and run processor
|
92 |
const image = await RawImage.read('https://raw.githubusercontent.com/marqo-ai/marqo-FashionCLIP/main/docs/fashion-hippo.png');
|
|
|
94 |
|
95 |
// Compute vision embeddings
|
96 |
const { image_embeds } = await vision_model(image_inputs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
// Compute similarity scores
|
99 |
const normalized_text_embeds = text_embeds.normalize().tolist();
|