jina: Failed to set TCP_USER_TIMEOUT

Describe your proposal/problem I ran the demo of translate_executor and got this problem. I do some search and realize it’s a TCP bind problem. But I can not find the solution.


Environment ubuntu 18.04 (jina) user@ubuntu:~/project/cv$ python deployment.py

translate_executor.py

from docarray import DocumentArray
from jina import Executor, requests
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM


class Translator(Executor):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.tokenizer = AutoTokenizer.from_pretrained(
            "facebook/mbart-large-50-many-to-many-mmt", src_lang="fr_XX"
        )
        self.model = AutoModelForSeq2SeqLM.from_pretrained(
            "facebook/mbart-large-50-many-to-many-mmt"
        )

    @requests
    def translate(self, docs: DocumentArray, **kwargs):
        for doc in docs:
            doc.text = self._translate(doc.text)

    def _translate(self, text):
        encoded_en = self.tokenizer(text, return_tensors="pt")
        generated_tokens = self.model.generate(
            **encoded_en, forced_bos_token_id=self.tokenizer.lang_code_to_id["en_XX"]
        )
        return self.tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)[
            0
        ]

deployment.py

from jina import Deployment
from translate_executor import Translator

with Deployment(uses=Translator, timeout_ready=-1) as dep:
    dep.block()

Screenshots 1682047974518

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 24 (12 by maintainers)

Most upvoted comments

I guess thay may have a different default option for this IPPROTO_TCP socket option,

They seem to accept the PR, however there is an issue on grpc blocking us from updating grpc version. However, it seems confirmed that it is not an error or missbehavior

Hello, it feels like just a WARNING, can you still process Documents?