Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add models and md5 #783

Merged
merged 6 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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 server/clip_server/executors/clip_torch.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
class CLIPEncoder(Executor):
def __init__(
self,
name: str = 'ViT-B-32-quickgelu::openai',
name: str = 'ViT-B-32::openai',
device: Optional[str] = None,
jit: bool = False,
num_worker_preprocess: int = 4,
Expand Down
28 changes: 28 additions & 0 deletions server/clip_server/model/clip_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@
)
_S3_BUCKET_V2 = 'https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/'
_MODELS = {
'RN50::openai': ('RN50.pt', '9140964eaaf9f68c95aa8df6ca13777c'),
'RN50::yfcc15m': (),
'RN50::cc12m': (),
'RN50-quickgelu::openai': (),
'RN50-quickgelu::yfcc15m': (),
'RN50-quickgelu::cc12m': (),
'RN101::openai': ('RN101.pt', 'fa9d5f64ebf152bc56a18db245071014'),
'RN101::yfcc15m': (),
'RN101-quickgelu::openai': (),
'RN101-quickgelu::yfcc15m': (),
'RN50x4::openai': ('RN50x4.pt', '03830990bc768e82f7fb684cde7e5654'),
'RN50x16::openai': ('RN50x16.pt', '83d63878a818c65d0fb417e5fab1e8fe'),
'RN50x64::openai': ('RN50x64.pt', 'a6631a0de003c4075d286140fc6dd637'),
'ViT-B-32::openai': ('ViT-B-32.pt', '3ba34e387b24dfe590eeb1ae6a8a122b'),
'ViT-B-32::laion2b_e16': (),
'ViT-B-32::laion400m_e31': (),
'ViT-B-32::laion400m_e32': (),
'ViT-B-32-quickgelu::openai': (),
'ViT-B-32-quickgelu::laion400m_e31': (),
'ViT-B-32-quickgelu::laion400m_e32': (),
'ViT-B-16::openai': ('ViT-B-16.pt', '44c3d804ecac03d9545ac1a3adbca3a6'),
'ViT-B-16::laion400m_e31': (),
'ViT-B-16::laion400m_e32': (),
'ViT-B-16-plus-240::laion400m_e31': (),
'ViT-B-16-plus-240::laion400m_e32': (),
'ViT-L-14::openai': ('ViT-L-14.pt', '096db1af569b284eb76b3881534822d9'),
'ViT-L-14-336::openai': ('ViT-L-14-336px.pt', 'b311058cae50cb10fbfa2a44231c9473'),
# older version name format
'RN50': (
('RN50/textual.onnx', '722418bfe47a1f5c79d1f44884bb3103'),
('RN50/visual.onnx', '5761475db01c3abb68a5a805662dcd10'),
Expand Down
2 changes: 1 addition & 1 deletion server/clip_server/model/openclip_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def __init__(self, name: str, device: str = 'cpu', jit: bool = False, **kwargs):
if model_url:
model_path = download_model(model_url, md5sum=md5sum)
self._model = load_openai_model(model_path, device=device, jit=jit)
self._model_name = name
self._model_name = name.split('::')[0]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@numb3r3 Check this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@numb3r3 Check this

should be split[0], I had fixed it in my pr

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem caused here can be addressed by another PR. So let's revert this change in this PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need this to pass ci

else:
model_name, pretrained = name.split('::')
self._model = open_clip.create_model(
Expand Down
57 changes: 39 additions & 18 deletions server/clip_server/model/pretrained_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,52 @@
_OPENCLIP_S3_BUCKET = 'https://clip-as-service.s3.us-east-2.amazonaws.com/models/torch'
_OPENCLIP_MODELS = {
'RN50::openai': ('RN50.pt', '9140964eaaf9f68c95aa8df6ca13777c'),
'RN50::yfcc15m': (),
'RN50::cc12m': (),
'RN50-quickgelu::openai': (),
'RN50-quickgelu::yfcc15m': (),
'RN50-quickgelu::cc12m': (),
'RN50::yfcc15m': ('RN50-yfcc15m.pt', 'e9c564f91ae7dc754d9043fdcd2a9f22'),
'RN50::cc12m': ('RN50-cc12m.pt', '37cb01eb52bb6efe7666b1ff2d7311b5'),
'RN101::openai': ('RN101.pt', 'fa9d5f64ebf152bc56a18db245071014'),
'RN101::yfcc15m': (),
'RN101-quickgelu::openai': (),
'RN101-quickgelu::yfcc15m': (),
'RN101::yfcc15m': ('RN101-yfcc15m.pt', '48f7448879ce25e355804f6bb7928cb8'),
'RN50x4::openai': ('RN50x4.pt', '03830990bc768e82f7fb684cde7e5654'),
'RN50x16::openai': ('RN50x16.pt', '83d63878a818c65d0fb417e5fab1e8fe'),
'RN50x64::openai': ('RN50x64.pt', 'a6631a0de003c4075d286140fc6dd637'),
'ViT-B-32::openai': ('ViT-B-32.pt', '3ba34e387b24dfe590eeb1ae6a8a122b'),
'ViT-B-32::laion2b_e16': (),
'ViT-B-32::laion400m_e31': (),
'ViT-B-32::laion400m_e32': (),
'ViT-B-32-quickgelu::openai': (),
'ViT-B-32-quickgelu::laion400m_e31': (),
'ViT-B-32-quickgelu::laion400m_e32': (),
'ViT-B-32::laion2b_e16': (
'ViT-B-32-laion2b_e16.pt',
'df08de3d9f2dc53c71ea26e184633902',
),
'ViT-B-32::laion400m_e31': (
'ViT-B-32-laion400m_e31.pt',
'ca8015f98ab0f8780510710681d7b73e',
),
'ViT-B-32::laion400m_e32': (
'ViT-B-32-laion400m_e32.pt',
'359e0dba4a419f175599ee0c63a110d8',
),
'ViT-B-16::openai': ('ViT-B-16.pt', '44c3d804ecac03d9545ac1a3adbca3a6'),
'ViT-B-16::laion400m_e31': (),
'ViT-B-16::laion400m_e32': (),
'ViT-B-16-plus-240::laion400m_e31': (),
'ViT-B-16-plus-240::laion400m_e32': (),
'ViT-B-16::laion400m_e31': (
'ViT-B-16-laion400m_e31.pt',
'31306a44224cc46fec1bc3b82fd0c4e6',
),
'ViT-B-16::laion400m_e32': (
'ViT-B-16-laion400m_e32.pt',
'07283adc5c17899f2ed22d82b563c54b',
),
'ViT-B-16-plus-240::laion400m_e31': (
'ViT-B-16-plus-240-laion400m_e31.pt',
'c88f453644a998ecb094d878a2f0738d',
),
'ViT-B-16-plus-240::laion400m_e32': (
'ViT-B-16-plus-240-laion400m_e32.pt',
'e573af3cef888441241e35022f30cc95',
),
'ViT-L-14::openai': ('ViT-L-14.pt', '096db1af569b284eb76b3881534822d9'),
'ViT-L-14::laion400m_e31': (
'ViT-L-14-laion400m_e31.pt',
'09d223a6d41d2c5c201a9da618d833aa',
),
'ViT-L-14::laion400m_e32': (
'ViT-L-14-laion400m_e32.pt',
'a76cde1bc744ca38c6036b920c847a89',
),
'ViT-L-14-336::openai': ('ViT-L-14-336px.pt', 'b311058cae50cb10fbfa2a44231c9473'),
# older version name format
'RN50': ('RN50.pt', '9140964eaaf9f68c95aa8df6ca13777c'),
Expand Down