Slackbot
10/08/2023, 9:26 AMChaoyu
10/09/2023, 8:28 AMChaoyu
10/09/2023, 8:29 AMBoris Nadion
10/09/2023, 8:29 AMJian Shen Yap
10/09/2023, 10:29 AMBoris Nadion
10/10/2023, 6:32 AMJian Shen Yap
10/10/2023, 6:37 AMBoris Nadion
10/10/2023, 6:38 AMJian Shen Yap
10/10/2023, 6:39 AMbentofile.yaml , i'm running some test to make sure it worksBoris Nadion
10/10/2023, 6:50 AMJian Shen Yap
10/10/2023, 7:20 AMpip version or from the source?Boris Nadion
10/10/2023, 7:21 AM❯ pip --version
pip 23.2.1 from /Users/bnadion/.pyenv/versions/3.11.4/lib/python3.11/site-packages/pip (python 3.11)Boris Nadion
10/10/2023, 7:21 AMBoris Nadion
10/10/2023, 7:24 AMJian Shen Yap
10/10/2023, 7:24 AMclip-api-service installed from pip or from the github sourceJian Shen Yap
10/10/2023, 7:25 AMBoris Nadion
10/10/2023, 7:41 AMJian Shen Yap
10/10/2023, 7:44 AMBoris Nadion
10/10/2023, 8:18 AMJian Shen Yap
10/10/2023, 10:05 AM0.1.11 version tonight or tomorrow.
if you wanted to test it out, you can either build it from source or use the wheel here https://github.com/bentoml/CLIP-API-service/releases/tag/v0.1.1Jian Shen Yap
10/10/2023, 10:05 AMBoris Nadion
10/10/2023, 10:28 AMBoris Nadion
10/10/2023, 1:35 PMclip-api-service serve --model-name=ViT-B-32:laion2b_s34b_b79k
I get a correct 512 dim array response
when I build
clip-api-service build --model-name=ViT-B-32:laion2b_s34b_b79k
then run locally
bentoml serve clip-api-service:432ybmdhnccxcar6
or deploy (push) I get a wrong 768 dim array response, something is still not right
Thanks!Boris Nadion
10/10/2023, 1:36 PMJian Shen Yap
10/10/2023, 1:41 PMBoris Nadion
10/10/2023, 1:42 PMBoris Nadion
10/10/2023, 1:42 PMJian Shen Yap
10/10/2023, 1:54 PMbentoml get <tag>Boris Nadion
10/10/2023, 1:57 PMservice: clip_api_service.service:svc
name: clip-api-service
version: 432ybmdhnccxcar6
bentoml_version: 1.1.6
creation_time: '2023-10-10T12:31:31.386566+00:00'
labels: {}
models:
- tag: openclip:vit-b-32.laion2b_s34b_b79k
module: bentoml.pytorch
creation_time: '2023-10-08T06:29:39.416708+00:00'
runners:
- name: clip_model_runner
runnable_type: OpenClipRunnable
embedded: false
models:
- openclip:vit-b-32.laion2b_s34b_b79k
resource_config: null
apis:
- name: encode
input_type: JSON
output_type: JSON
- name: rank
input_type: JSON
output_type: JSON
docker:
distro: debian
python_version: '3.11'
cuda_version: null
env: null
system_packages: null
setup_script: null
base_image: null
dockerfile_template: null
python:
requirements_txt: null
packages:
- bentoml
- transformers
- accelerate
- optimum
- pydantic
- Pillow
lock_packages: true
index_url: null
no_index: null
trusted_host: null
find_links: null
extra_index_url: null
pip_args: null
wheels: null
conda:
environment_yml: null
channels: null
dependencies: null
pip: nullBoris Nadion
10/10/2023, 1:57 PMBoris Nadion
10/10/2023, 2:00 PMbentoml serve clip-api-service:d7yav6thow54car6 it still shows wrong number of dimensions which means it’s built with wrong model, or being served with a wrong model, because I see both models in the models folderBoris Nadion
10/10/2023, 2:01 PMbentoml serve clip-api-service:d7yav6thow54car6
`text_config_dict` is provided which will be used to initialize `CLIPTextConfig`. The value `text_config["id2label"]` will be overriden.
`text_config_dict` is provided which will be used to initialize `CLIPTextConfig`. The value `text_config["bos_token_id"]` will be overriden.
`text_config_dict` is provided which will be used to initialize `CLIPTextConfig`. The value `text_config["eos_token_id"]` will be overriden.
2023-10-10T17:00:52+0300 [INFO] [cli] Using the default model signature for Transformers ({'__call__': ModelSignature(batchable=False, batch_dim=(0, 0), input_spec=None, output_spec=None), 'forward': ModelSignature(batchable=False, batch_dim=(0, 0), input_spec=None, output_spec=None), 'generate': ModelSignature(batchable=False, batch_dim=(0, 0), input_spec=None, output_spec=None), 'contrastive_search': ModelSignature(batchable=False, batch_dim=(0, 0), input_spec=None, output_spec=None), 'greedy_search': ModelSignature(batchable=False, batch_dim=(0, 0), input_spec=None, output_spec=None), 'sample': ModelSignature(batchable=False, batch_dim=(0, 0), input_spec=None, output_spec=None), 'beam_search': ModelSignature(batchable=False, batch_dim=(0, 0), input_spec=None, output_spec=None), 'beam_sample': ModelSignature(batchable=False, batch_dim=(0, 0), input_spec=None, output_spec=None), 'group_beam_search': ModelSignature(batchable=False, batch_dim=(0, 0), input_spec=None, output_spec=None), 'constrained_beam_search': ModelSignature(batchable=False, batch_dim=(0, 0), input_spec=None, output_spec=None)}) for model "openai-clip:vit-large-patch14".
2023-10-10T17:00:58+0300 [INFO] [cli] Environ for worker 0: set CPU thread count to 10
2023-10-10T17:00:58+0300 [INFO] [cli] Prometheus metrics for HTTP BentoServer from "clip-api-service:d7yav6thow54car6" can be accessed at <http://localhost:3000/metrics>.
2023-10-10T17:00:59+0300 [INFO] [cli] Starting production HTTP BentoServer from "clip-api-service:d7yav6thow54car6" listening on <http://0.0.0.0:3000> (Press CTRL+C to quit)
Using the default model signature for Transformersand then wrong model is downloaded and served
Boris Nadion
10/10/2023, 2:25 PMFile "/Users/bnadion/.pyenv/versions/3.11.4/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/bnadion/bentoml/bentos/clip-api-service/d7yav6thow54car6/src/clip_api_service/service.py", line 49, in <module>
logit_scale = np.exp(bento_model.info.metadata.get("logit_scale", 4.60517))
File "/Users/bnadion/bentoml/bentos/clip-api-service/d7yav6thow54car6/src/clip_api_service/runners.py", line 14, in get_clip_runner
runner = bentoml.Runner(
as you can see in init_model doesn’t get default param from yaml, it takes it from env var or uses default, env var doesn’t set here because we just run it as isBoris Nadion
10/10/2023, 2:25 PMJian Shen Yap
10/10/2023, 2:30 PMJian Shen Yap
10/10/2023, 2:30 PMBoris Nadion
10/10/2023, 3:09 PM2023-10-10 18:08:07.319
ModuleNotFoundError: No module named 'open_clip'
2023-10-10 18:08:07.319
2023-10-10T15:08:07+0000 [ERROR] [runner:clip_model_runner:1] Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 705, in lifespan
async with self.lifespan_context(app) as maybe_state:
File "/usr/local/lib/python3.11/contextlib.py", line 204, in __aenter__
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/bentoml/_internal/server/base_app.py", line 75, in lifespan
on_startup()
File "/usr/local/lib/python3.11/site-packages/bentoml/_internal/runner/runner.py", line 317, in init_local
raise e
File "/usr/local/lib/python3.11/site-packages/bentoml/_internal/runner/runner.py", line 307, in init_local
self._set_handle(LocalRunnerRef)
File "/usr/local/lib/python3.11/site-packages/bentoml/_internal/runner/runner.py", line 150, in _set_handle
runner_handle = handle_class(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/bentoml/_internal/runner/runner_handle/local.py", line 27, in __init__
self._runnable = runner.runnable_class(**runner.runnable_init_params) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/bentoml/bento/src/clip_api_service/models/openclip.py", line 160, in __init__
self.model = bento_model.load_model().to(self.device).eval()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/bentoml/_internal/models/model.py", line 379, in load_model
self._model = self.info.imported_module.load_model(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/bentoml/_internal/frameworks/pytorch.py", line 79, in load_model
model: "torch.nn.Module" = torch.load(file, map_location=device_id)Boris Nadion
10/11/2023, 10:10 AMJian Shen Yap
10/11/2023, 10:14 AMBoris Nadion
10/11/2023, 10:15 AMBoris Nadion
10/11/2023, 3:25 PMJian Shen Yap
10/11/2023, 6:43 PMJian Shen Yap
10/11/2023, 6:43 PMJian Shen Yap
10/11/2023, 6:45 PMJian Shen Yap
10/11/2023, 6:46 PMservice.py fileJian Shen Yap
10/11/2023, 7:38 PMv0.1.2 in pypi, please give it a try!Boris Nadion
10/12/2023, 10:04 AMJian Shen Yap
10/12/2023, 10:48 AMJian Shen Yap
10/12/2023, 10:49 AMBoris Nadion
10/13/2023, 1:13 PM