Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion keras_cv/models/feature_extractor/clip/clip_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(
vision_patch_size=32,
context_length=77,
vocab_size=49408,
transformer_width=768,
transformer_width=512,
transformer_heads=8,
transformer_layers=12,
**kwargs,
Expand Down
10 changes: 5 additions & 5 deletions keras_cv/models/feature_extractor/clip/clip_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def test_clip_model_golden_values(self):
processed_image, processed_text, attention_mask
)
print(image_logits)
self.assertAllClose(image_logits, [[2.932678, 2.932678, 2.932675]])
self.assertAllClose(image_logits, [[1.896713, 1.896713, 1.896713]])
self.assertAllClose(
text_logits, ops.transpose([[2.932678, 2.932678, 2.932675]])
text_logits, ops.transpose([[1.896713, 1.896713, 1.896713]])
)

def test_clip_preprocessor(self):
Expand All @@ -77,8 +77,8 @@ def test_clip_preprocessor_tf_data(self):

@pytest.mark.large
def test_presets(self):
self.skipTest("TODO: Enable after Kaggle model is public")
model = CLIP.from_preset("clip-vit-base-patch32")
# self.skipTest("TODO: Enable after Kaggle model is public")
model = CLIP.from_preset("clip-vit-base-patch16")
processed_image = np.ones(shape=[1, 224, 224, 3])
processed_text = np.ones(shape=[3, 77])
attention_mask = np.ones(shape=[3, 77])
Expand Down Expand Up @@ -109,7 +109,7 @@ def test_text_encoder_golden_values(self):
print(model.text_embeddings)
self.assertAllClose(
model.text_embeddings[0, :3],
[-0.018502, 0.000906, 0.020372],
[0.007531, -0.038361, -0.035686],
)

@pytest.mark.large # Saving is slow, so mark these large.
Expand Down
8 changes: 4 additions & 4 deletions keras_cv/models/feature_extractor/clip/clip_presets.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"official_name": "CLIP",
"path": "clip",
},
"kaggle_handle": "kaggle://keras/clip/keras/clip-vit-base-patch16/2",
"kaggle_handle": "kaggle://keras/clip/keras/clip-vit-base-patch16/4",
},
"clip-vit-base-patch32": {
"metadata": {
Expand All @@ -44,7 +44,7 @@
"official_name": "CLIP",
"path": "clip",
},
"kaggle_handle": "kaggle://keras/clip/keras/clip-vit-base-patch32/2",
"kaggle_handle": "kaggle://keras/clip/keras/clip-vit-base-patch32/4",
},
"clip-vit-large-patch14": {
"metadata": {
Expand All @@ -60,7 +60,7 @@
"official_name": "CLIP",
"path": "clip",
},
"kaggle_handle": "kaggle://keras/clip/keras/clip-vit-large-patch14/2",
"kaggle_handle": "kaggle://keras/clip/keras/clip-vit-large-patch14/4",
},
"clip-vit-large-patch14-336": {
"metadata": {
Expand All @@ -76,6 +76,6 @@
"official_name": "CLIP",
"path": "clip",
},
"kaggle_handle": "kaggle://keras/clip/keras/clip-vit-large-patch14-336/2", # noqa: E501
"kaggle_handle": "kaggle://keras/clip/keras/clip-vit-large-patch14-336/4", # noqa: E501
},
}
Loading