rom1504 / clip-retrieval

Easily compute clip embeddings and build a clip retrieval system with them
https://rom1504.github.io/clip-retrieval/
MIT License
2.42k stars 213 forks source link

504 Gateway Time-out #267

Closed m3lionas closed 1 year ago

m3lionas commented 1 year ago

Hi, seems that the 504 gateway time-out issue is happening again.

504 Gateway Time-out nginx/1.18.0 (Ubuntu)

NielsRogge commented 1 year ago

Yup confirmed, client doesn't work for now. Here's the full trace:

! pip install clip-retrieval
from clip_retrieval.clip_client import ClipClient, Modality

clip_client = ClipClient(
        url="https://knn.laion.ai/knn-service",
        indice_name="laion5B-L-14",
        num_images=2, 
        aesthetic_score=9,
        aesthetic_weight=0.5,
        modality=Modality.IMAGE,
    )
results = clip_client.query(text="comfortable bathroom, art deco interior design")
results

Results in

---------------------------------------------------------------------------
JSONDecodeError                           Traceback (most recent call last)
[/usr/local/lib/python3.10/dist-packages/requests/models.py](https://localhost:8080/#) in json(self, **kwargs)
    909         try:
--> 910             return complexjson.loads(self.text, **kwargs)
    911         except JSONDecodeError as e:

6 frames
[/usr/lib/python3.10/json/__init__.py](https://localhost:8080/#) in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    345             parse_constant is None and object_pairs_hook is None and not kw):
--> 346         return _default_decoder.decode(s)
    347     if cls is None:

[/usr/lib/python3.10/json/decoder.py](https://localhost:8080/#) in decode(self, s, _w)
    336         """
--> 337         obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    338         end = _w(s, end).end()

[/usr/lib/python3.10/json/decoder.py](https://localhost:8080/#) in raw_decode(self, s, idx)
    354         except StopIteration as err:
--> 355             raise JSONDecodeError("Expecting value", s, err.value) from None
    356         return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

JSONDecodeError                           Traceback (most recent call last)
[<ipython-input-4-3c84059e3b0b>](https://localhost:8080/#) in <cell line: 1>()
----> 1 results = clip_client.query(text="comfortable bathroom, art deco interior design")
      2 results

[/usr/local/lib/python3.10/dist-packages/clip_retrieval/clip_client.py](https://localhost:8080/#) in query(self, text, image, embedding_input)
     82             raise ValueError("Only one of text or image can be provided.")
     83         if text:
---> 84             return self.__search_knn_api__(text=text)
     85         elif image:
     86             if image.startswith("http"):

[/usr/local/lib/python3.10/dist-packages/clip_retrieval/clip_client.py](https://localhost:8080/#) in __search_knn_api__(self, text, image, image_url, embedding_input)
    150                 }
    151             ),
--> 152         ).json()

[/usr/local/lib/python3.10/dist-packages/requests/models.py](https://localhost:8080/#) in json(self, **kwargs)
    915                 raise RequestsJSONDecodeError(e.message)
    916             else:
--> 917                 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    918 
    919     @property

JSONDecodeError: [Errno Expecting value] <html>
<head><title>504 Gateway Time-out</title></head>
<body>
<center><h1>504 Gateway Time-out</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
: 0

Gently pinging @rom1504

rom1504 commented 1 year ago

back

someone doing too many requests

reminder to please follow https://github.com/rom1504/clip-retrieval/blob/main/docs/laion5B_h14_back.md if you want to do more than a request every 10 seconds