Closed dankasak closed 1 year ago
Hello, is this a clean instance, or this instance had been successfully using the search mechanism before?
Please try to remove the volume for model-cache
and try again
Hi! Thanks for responding.
Hello, is this a clean instance
Yes - all I've done so far is a batch import via the cli, and had a quick play.
or this instance had been successfully using the search mechanism before?
No, it's never worked.
Please try to remove the volume for model-cache and try again
I backed up the model-cache directory, then created a fresh one, and restarted everything. It still fails, however I see the HTTP error code has changed from:
<HTTPError 416: 'Requested Range Not Satisfiable'>
... to:
<HTTPError 403: 'Forbidden'>
I've tried with curl, and I can see that curl now concurs - I'm now not able to download this file manually. I still have the one I previously downloaded.
I also tried commenting out the model-cache volume stuff - same error as above.
hey there! same problem here with 403
RuntimeError: Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-B-32/textual.onnx within retry limit 3 Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d536572 76696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 0th attempt Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d536572 76696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 1th
sadly, same problem for me.
open the link https://[clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-B-32/textual.onnx](https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-B-32/textual.onnx) in the Edge. It responds that:
I tested in the mainland of China. The problem may be relevant to the GFW or it is simply because amazonaws blocks all Chinese IPs.
I have exactly the same problem on a new install
imho this is not an immich issue, looks like there is a problem with clip-as-service https://github.com/jina-ai/clip-as-service/issues/931
Having this issue as well, does not appear to be geographic.
Unfortunately same issue for me with smart search. Metadata search (i.e., prefix with 'm:' still works as expected).
Relevant immich-machinelearning logs (not to look like a broken record):
[09/19/23 11:41:40] INFO Downloading clip model 'ViT-B-32::openai'. This may take a while.
Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 0th attempt
Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 1th attempt
Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 2th attempt
textual.onnx 0.0% • 0/100 bytes • ? • -:--:--
As this issue still exists and seems to affect more and more people, because new installs can't download the clip model, there should be implemented some sort of fallback to counter such situations in the future.
Maybe a fallback model could be distributed which would spring into action if no new (/updated) model can be downloaded?
Because I think there is no sense in a (local and) aspecially vital function like a search to fail, because of some external service not being available or something.
@mertalev do you have any thought ok this issue?
Hi there, with a new Install of immich v1.78.1 I run in the same issue with smart search. Metadata search, i.e., prefix with 'm:' ,still works as expected. The <HTTPError 403: 'Forbidden'> is present in the logs.
Hmm, it might be better to use the models provided by Marqo instead since they're hosted in HF. This would have faster download speeds as well.
@mertalev can we change that to make the model as default?
I can look at it later today. Marqo uses a different naming scheme, so I'd need to map it to the same cache folder names we use to avoid duplicating models, and also migrate the model name in the system config. It shouldn't be too much work outside of that.
Is there any workaround for those who don't have the file in cache?
Thank you for the quick response - but I had tried using the Marqo models, but loading the model causes an error in the ML component. Not sure if it's a different bug?
Sep 20 19:25:33 nixi systemd[1]: Started docker-immich-machine-learning.service.
Sep 20 19:25:34 nixi docker-immich-machine-learning-start[2567551]: [09/20/23 19:25:34] INFO Starting gunicorn 21.2.0
Sep 20 19:25:34 nixi docker-immich-machine-learning-start[2567551]: [09/20/23 19:25:34] INFO Listening at: http://0.0.0.0:3003 (9)
Sep 20 19:25:34 nixi docker-immich-machine-learning-start[2567551]: [09/20/23 19:25:34] INFO Using worker: uvicorn.workers.UvicornWorker
Sep 20 19:25:34 nixi docker-immich-machine-learning-start[2567551]: [09/20/23 19:25:34] INFO Booting worker with pid: 10
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: [09/20/23 19:25:43] INFO Created in-memory cache with unloading disabled.
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: [09/20/23 19:25:43] INFO Initialized request thread pool with 8 threads.
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: [09/20/23 19:25:43] INFO Loading clip model 'ViT-B-32::openai'
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: Exception in ASGI application
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: Traceback (most recent call last):
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: result = await app( # type: ignore[func-returns-value]
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: return await self.app(scope, receive, send)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/fastapi/applications.py", line 276, in __call__
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: await super().__call__(scope, receive, send)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: await self.middleware_stack(scope, receive, send)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: raise exc
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: await self.app(scope, receive, _send)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: raise exc
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: await self.app(scope, receive, sender)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: raise e
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: await self.app(scope, receive, send)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: await route.handle(scope, receive, send)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: await self.app(scope, receive, send)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: response = await func(request)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ^^^^^^^^^^^^^^^^^^^
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/fastapi/routing.py", line 237, in app
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: raw_response = await run_endpoint_function(
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: return await dependant.call(**values)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/usr/src/app/main.py", line 77, in predict
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: outputs = await run(model, inputs)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ^^^^^^^^^^^^^^^^^^^^^^^^
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/usr/src/app/main.py", line 85, in run
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: return await asyncio.get_running_loop().run_in_executor(app.state.thread_pool, model.predict, inputs)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: result = self.fn(*self.args, **self.kwargs)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/usr/src/app/models/base.py", line 72, in predict
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: return self._predict(inputs)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ^^^^^^^^^^^^^^^^^^^^^
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/usr/src/app/models/clip.py", line 101, in _predict
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: outputs = self.text_model.run(self.text_outputs, inputs)
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 213, in run
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: self._validate_input(list(input_feed.keys()))
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: File "/opt/venv/lib/python3.11/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 195, in _validate_input
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: raise ValueError(
Sep 20 19:25:43 nixi docker-immich-machine-learning-start[2567551]: ValueError: Required inputs (['input']) are missing from input feed (['input_ids', 'attention_mask']).
Oh, that's interesting. Looking at the text model's graph, I think it expects the attention mask to be pre-applied so there's only one input. Looks like I'll need to change the preprocessing.
Jina:
Marqo:
For the use-case of Immich app packages (in our case for Cloudron), would it make sense to fetch and include those files during package/image building? If so, is there some pre-fetch command available somewhere to do this or a common place to check the URLs and versions for the models which should be fetched?
PSA - the Jina AI textual.onnx bucket is working again, as is smart search on Immich.
Suspect there will still be good enhancements that come out of this - thank you community!
Sorry, what is the final fix for these issue?
I tried to copy this files now I got this error.
Since the S3 bucket now works, we haven't needed to make any changes for the time-being.
I'm assuming you came to this issue because you're having problems downloading the CLIP model. Can you delete your model-cache
docker volume, restart the ML container, and start a CLIP job in the Jobs panel? If this doesn't work, could you share the error logs you get?
Thank you @mertalev, after deleting the volume the search now works.
I guess I have to run the "ENCODE CLIP" job again?
You can run a "missing" job for Encode CLIP, but no need to run it on all images.
Thank you @mertalev. It works :)
Hello! Is the bucket down again? I get that "Failed to download"..
Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-H-14-laion2b-s32b-b79k/textual.onnx with <HTTPError 403: 'Forbidden'> at the 0th attempt Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-H-14-laion2b-s32b-b79k/textual.onnx with <HTTPError 403: 'Forbidden'> at the 1th attempt Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-H-14-laion2b-s32b-b79k/textual.onnx with <HTTPError 403: 'Forbidden'> at the 2th attempt
Here we go again...
Same here:
RuntimeError: Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-B-32/textual.onnx within retry limit 3
same here also:
RuntimeError: Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-H-14-laion2b-s32b-b79k/textual.onnx within retry limi
One more data point here:
immich_microservices | [Nest] 7 - 10/19/2023, 11:37:51 PM ERROR [JobService] Unable to run job handler (clipEncoding/clip-encode): Error: Request for clip failed with status 500: Internal Server Error immich_microservices | [Nest] 7 - 10/19/2023, 11:37:51 PM ERROR [JobService] Error: Request for clip failed with status 500: Internal Server Error immich_microservices | at MachineLearningRepository.post (/usr/src/app/dist/infra/repositories/machine-learning.repository.js:29:19) immich_microservices | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich_microservices | at async SmartInfoService.handleEncodeClip (/usr/src/app/dist/domain/smart-info/smart-info.service.js:118:31) immich_microservices | at async /usr/src/app/dist/domain/job/job.service.js:108:37 immich_microservices | at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:350:28) immich_microservices | at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:535:24) immich_microservices | [Nest] 7 - 10/19/2023, 11:37:51 PM ERROR [JobService] Object: immich_microservices | { immich_microservices | "id": "47f7f10a-ae75-40ca-8afc-b1478f76a619" immich_machine_learning | [10/19/23 23:37:51] INFO Downloading clip model 'ViT-B-32::openai'.This may immich_machine_learning | take a while. immich_microservices | } immich_microservices | immich_microservices | immich_machine_learning | Exception in ASGI application immich_machine_learning | Traceback (most recent call last): immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi immich_machine_learning | result = await app( # type: ignore[func-returns-value] immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ immich_machine_learning | return await self.app(scope, receive, send) immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/fastapi/applications.py", line 276, in __call__ immich_machine_learning | await super().__call__(scope, receive, send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__ immich_machine_learning | await self.middleware_stack(scope, receive, send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__ immich_machine_learning | raise exc immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__ immich_machine_learning | await self.app(scope, receive, _send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__ immich_machine_learning | raise exc immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__ immich_machine_learning | await self.app(scope, receive, sender) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__ immich_machine_learning | raise e immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__ immich_machine_learning | await self.app(scope, receive, send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__ immich_machine_learning | await route.handle(scope, receive, send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle immich_machine_learning | await self.app(scope, receive, send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 66, in app immich_machine_learning | response = await func(request) immich_machine_learning | ^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/fastapi/routing.py", line 237, in app immich_machine_learning | raw_response = await run_endpoint_function( immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/fastapi/routing.py", line 163, in run_endpoint_function immich_machine_learning | return await dependant.call(**values) immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/usr/src/app/main.py", line 75, in predict immich_machine_learning | model = await load(await app.state.model_cache.get(model_name, model_type, **kwargs)) immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/usr/src/app/main.py", line 101, in load immich_machine_learning | await loop.run_in_executor(app.state.thread_pool, _load) immich_machine_learning | File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run immich_machine_learning | result = self.fn(*self.args, **self.kwargs) immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/usr/src/app/main.py", line 94, in _load immich_machine_learning | model.load() immich_machine_learning | File "/usr/src/app/models/base.py", line 63, in load immich_machine_learning | self.download() immich_machine_learning | File "/usr/src/app/models/base.py", line 58, in download immich_machine_learning | self._download() immich_machine_learning | File "/usr/src/app/models/clip.py", line 43, in _download immich_machine_learning | self._download_model(*models[0]) immich_machine_learning | File "/usr/src/app/models/clip.py", line 101, in _download_model immich_machine_learning | download_model( immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/clip_server/model/pretrained_models.py", line 239, in download_model immich_machine_learning | raise RuntimeError( immich_machine_learning | RuntimeError: Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-B-32/textual.onnx within retry limit 3 immich_machine_learning | Failed to download immich_machine_learning | https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d536572 immich_machine_learning | 76696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 0th immich_machine_learning | attempt immich_machine_learning | Failed to download immich_machine_learning | https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d536572 immich_machine_learning | 76696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 1th immich_machine_learning | attempt immich_machine_learning | Failed to download immich_machine_learning | https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d536572 immich_machine_learning | 76696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 2th immich_machine_learning | attempt immich_machine_learning | textual.onnx 0.0% • 0/100 bytes • ? • -:--:-- immich_machine_learning | immich_machine_learning | [10/19/23 23:38:08] INFO Downloading clip model 'ViT-B-32::openai'.This may immich_microservices | [Nest] 7 - 10/19/2023, 11:38:08 PM ERROR [JobService] Unable to run job handler (clipEncoding/clip-encode): Error: Request for clip failed with status 500: Internal Server Error immich_microservices | [Nest] 7 - 10/19/2023, 11:38:08 PM ERROR [JobService] Error: Request for clip failed with status 500: Internal Server Error immich_microservices | at MachineLearningRepository.post (/usr/src/app/dist/infra/repositories/machine-learning.repository.js:29:19) immich_microservices | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich_microservices | at async SmartInfoService.handleEncodeClip (/usr/src/app/dist/domain/smart-info/smart-info.service.js:118:31) immich_microservices | at async /usr/src/app/dist/domain/job/job.service.js:108:37 immich_microservices | at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:350:28) immich_microservices | at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:535:24) immich_microservices | [Nest] 7 - 10/19/2023, 11:38:08 PM ERROR [JobService] Object: immich_microservices | { immich_microservices | "id": "0246bb95-43fe-407c-ac52-7b3181269b20" immich_microservices | } immich_microservices | immich_microservices | immich_machine_learning | take a while. immich_machine_learning | Exception in ASGI application immich_machine_learning | Traceback (most recent call last): immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi immich_machine_learning | result = await app( # type: ignore[func-returns-value] immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__ immich_machine_learning | return await self.app(scope, receive, send) immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/fastapi/applications.py", line 276, in __call__ immich_machine_learning | await super().__call__(scope, receive, send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__ immich_machine_learning | await self.middleware_stack(scope, receive, send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__ immich_machine_learning | raise exc immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__ immich_machine_learning | await self.app(scope, receive, _send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__ immich_machine_learning | raise exc immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__ immich_machine_learning | await self.app(scope, receive, sender) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__ immich_machine_learning | raise e immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__ immich_machine_learning | await self.app(scope, receive, send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__ immich_machine_learning | await route.handle(scope, receive, send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle immich_machine_learning | await self.app(scope, receive, send) immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 66, in app immich_machine_learning | response = await func(request) immich_machine_learning | ^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/fastapi/routing.py", line 237, in app immich_machine_learning | raw_response = await run_endpoint_function( immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/fastapi/routing.py", line 163, in run_endpoint_function immich_machine_learning | return await dependant.call(**values) immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/usr/src/app/main.py", line 75, in predict immich_machine_learning | model = await load(await app.state.model_cache.get(model_name, model_type, **kwargs)) immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/usr/src/app/main.py", line 101, in load immich_machine_learning | await loop.run_in_executor(app.state.thread_pool, _load) immich_machine_learning | File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run immich_machine_learning | result = self.fn(*self.args, **self.kwargs) immich_machine_learning | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ immich_machine_learning | File "/usr/src/app/main.py", line 94, in _load immich_machine_learning | model.load() immich_machine_learning | File "/usr/src/app/models/base.py", line 63, in load immich_machine_learning | self.download() immich_machine_learning | File "/usr/src/app/models/base.py", line 58, in download immich_machine_learning | self._download() immich_machine_learning | File "/usr/src/app/models/clip.py", line 43, in _download immich_machine_learning | self._download_model(*models[0]) immich_machine_learning | File "/usr/src/app/models/clip.py", line 101, in _download_model immich_machine_learning | download_model( immich_machine_learning | File "/opt/venv/lib/python3.11/site-packages/clip_server/model/pretrained_models.py", line 239, in download_model immich_machine_learning | raise RuntimeError( immich_machine_learning | RuntimeError: Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-B-32/textual.onnx within retry limit 3
Same issue here
Another data point here of failed downloads:
[10/20/23 08:11:52] INFO Starting gunicorn 21.2.0
[10/20/23 08:11:52] INFO Listening at: http://0.0.0.0:3003 (9)
[10/20/23 08:11:52] INFO Using worker: uvicorn.workers.UvicornWorker
[10/20/23 08:11:52] INFO Booting worker with pid: 10
[10/20/23 08:11:58] INFO Created in-memory cache with unloading disabled.
[10/20/23 08:11:58] INFO Initialized request thread pool with 20 threads.
[10/20/23 12:04:41] INFO Downloading clip model 'ViT-B-32::openai'.This may
take a while.
Failed to download
https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d536572
76696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 0th
attempt
Failed to download
https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d536572
76696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 1th
attempt
Failed to download
https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d536572
76696365/onnx/ViT-B-32/textual.onnx with <HTTPError 403: 'Forbidden'> at the 2th
attempt
textual.onnx 0.0% • 0/100 bytes • ? • -:--:--
Exception in ASGI application
Traceback (most recent call last):
File "/opt/venv/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.11/site-packages/fastapi/applications.py", line 276, in __call__
await super().__call__(scope, receive, send)
File "/opt/venv/lib/python3.11/site-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/opt/venv/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/opt/venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "/opt/venv/lib/python3.11/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/opt/venv/lib/python3.11/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.11/site-packages/fastapi/routing.py", line 237, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/venv/lib/python3.11/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/main.py", line 75, in predict
model = await load(await app.state.model_cache.get(model_name, model_type, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/main.py", line 101, in load
await loop.run_in_executor(app.state.thread_pool, _load)
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/app/main.py", line 94, in _load
model.load()
File "/usr/src/app/models/base.py", line 63, in load
self.download()
File "/usr/src/app/models/base.py", line 58, in download
self._download()
File "/usr/src/app/models/clip.py", line 43, in _download
self._download_model(*models[0])
File "/usr/src/app/models/clip.py", line 101, in _download_model
download_model(
File "/opt/venv/lib/python3.11/site-packages/clip_server/model/pretrained_models.py", line 239, in download_model
raise RuntimeError(
RuntimeError: Failed to download https://clip-as-service.s3.us-east-2.amazonaws.com/models-436c69702d61732d53657276696365/onnx/ViT-B-32/textual.onnx within retry limit 3
I've uploaded my local default models for clip
, facial-recognition
and image-classification
to Google Drive, you can download it from here
After extracting the zip file, you will need to copy these files to the location of your model-cache volume, can typically be found in /var/lib/docker/volumes/<volume-name>/_data
Or you can find that information with
docker volume inspect <model-cache-volume-name>
I did the manual download, added them to the docker and can see them from the Docker Desktop (windows) but it still tries to download the files and fails, and ignores the files i did add to docker.
For me the ENCODE CLIP
job was spamming the log with the same messages as mentioned here (unable to download file), and searching did the same.
I downloaded the archive provided by Alex and only copied the clip
directory into my immich_model-cache
, as this was the requested model that I was missing.
Now I get no more errors in the log, and searching works :+1: Thanks!
Confirming here that the cached models from above also solved the issue for me.
@alextran1502 thanks for files, it fix my problem too.
I searched a bit around the CLIP-as-a-service docs and couldn't locate any documentation about where these models are supposed to be accessible from (obviously from the URL that has been posted here multiple times, and surely I'm just missing the right place where this is documented). Is there supposed to be any kind of guarantee that this download URL will be available in the long run?
Would it make sense to set up a mirror for these models (and maybe allow Immich to check multiple locations for fallback)? 👀 Happy to help here.
For anyone looking for a direct download link of the models provided by @alextran1502 via Google Drive:
~http://95.216.206.130/clip/ViT-B-32__openai/ ; But I won't guarantee for now how long it will be available.~
I'm hosting a copy of the models here:
Edit 2024-10-31: Updated links to models
Firstly, just want to say, I installed Immich for the first time this weekend and, wow. The software is amazing and the community is even better! So much support and documentation.
I was also having the issue of not being able to download the models.
What solved it for me was:
sudo su
cd /var/lib/docker/volumes/immich_model-cache/_data/clip/ViT-B-32__openai
wget http://95.216.206.130/clip/ViT-B-32__openai/textual.onnx
wget http://95.216.206.130/clip/ViT-B-32__openai/visual.onnx
The manual fix also worked for me! thank you very much.
I would just like to point out that this functionality is still broken on the Immich demo page.
@dylangovender
thanks for that! am i right in assuming that i need to re-run "ENCODE CLIP" and "TAG OBJECTS" in the jobs page?
Hi @FelixBuehler,
Yes, I re-ran "ENCODE CLIP" and search started working for me again.
In my case, it was a new instance of Immich, so that was the first time ENCODE CLIP actually ran at all.
@KjeldsenDK I am on windows + docker desktop as well.
The way I added it to my docker volume model cache:
\\wsl$
4.22.0 (117440)
my model cache was located at \\wsl.localhost\docker-desktop-data\version-pack-data\community\docker\volumes\docker_model-cache\_data
All links have been fixed and working again
@NiklasRosenstein hello Does this model have it microsoft/resnet-50
@alextran1502 hi microsoft/resnet-50 model Do you have resources
@alextran1502 hi microsoft/resnet-50 model Do you have resources
Can't download this model?
I've uploaded my local default models for
clip
,facial-recognition
andimage-classification
to Google Drive, you can download it from hereAfter extracting the zip file, you will need to copy these files to the location of your model-cache volume, can typically be found in
/var/lib/docker/volumes/<volume-name>/_data
Or you can find that information with
docker volume inspect <model-cache-volume-name>
It seems that the download link is down. Due to network issue I have to download every model manually. But I don't know the file structure of model-cache foldr and naming rule of model in the folder. Would anyone offer a file structure of model-cache folder? I would appreciate it very much.
I've uploaded my local default models for
clip
,facial-recognition
andimage-classification
to Google Drive, you can download it from hereAfter extracting the zip file, you will need to copy these files to the location of your model-cache volume, can typically be found in
/var/lib/docker/volumes/<volume-name>/_data
Or you can find that information with
docker volume inspect <model-cache-volume-name>
It seems that the download link is down. Due to network issue I have to download every model manually. But I don't know the file structure of model-cache foldr and naming rule of model in the folder. Would anyone offer a file structure of model-cache folder? I would appreciate it very much.
If you are having network issues while downloading I would recommend you to use a free VPN like Proton to bypass the limit temporarily
If that not work for you I can send you the file structure later...
I've uploaded my local default models for
clip
,facial-recognition
andimage-classification
to Google Drive, you can download it from hereAfter extracting the zip file, you will need to copy these files to the location of your model-cache volume, can typically be found in
/var/lib/docker/volumes/<volume-name>/_data
Or you can find that information with
docker volume inspect <model-cache-volume-name>
i've searched multiple issues and coomments and this seems to be a feasable fix for my problem, but the link is down. Could someone help to upload another version or privide a file structure for us to manually download these files? Thanks
The bug
When I search for anything in immich, I get generic errors in the UI. In docker logs, I can see that something is trying to download Downloading clip model 'ViT-B-32::openai' ... and "This may take a while". However it fails within about 3 seconds. I've downloaded this on the host using curl. Can I persist this somewhere for whatever needs it ... and if so, where? Why is it failing so quickly?
This seems to be triggered from: https://github.com/jina-ai/clip-as-service/blob/main/server/clip_server/model/clip_onnx.py
The OS that Immich Server is running on
Docker
Version of Immich Server
v1.78.0
Version of Immich Mobile App
v1.78.0
Platform with the issue
Your docker-compose.yml content
Your .env content
Reproduction steps
Additional information
A search in the UI will trigger a download of https://github.com/jina-ai/clip-as-service/blob/main/server/clip_server/model/clip_onnx.py which will fail almost immediately