Argos_translate no longer works offline?

Traceback (most recent call last):
  File "/home/pj/git/argos-translate/env/bin/argos-translate", line 7, in <module>
    sys.exit(main())
  File "/home/pj/git/argos-translate/argostranslate/cli.py", line 63, in main
    print(translation.translate(text_to_translate))
  File "/home/pj/git/argos-translate/argostranslate/translate.py", line 64, in translate
    return self.hypotheses(input_text, num_hypotheses=1)[0].value
  File "/home/pj/git/argos-translate/argostranslate/translate.py", line 328, in hypotheses
    translated_paragraph = self.underlying.hypotheses(
  File "/home/pj/git/argos-translate/argostranslate/translate.py", line 201, in hypotheses
    apply_packaged_translation(
  File "/home/pj/git/argos-translate/argostranslate/translate.py", line 451, in apply_packaged_translation
    sentences = sentencizer.split_sentences(input_text)
  File "/home/pj/git/argos-translate/argostranslate/sbd.py", line 170, in split_sentences
    doc = self.lazy_pipeline()(text)
  File "/home/pj/git/argos-translate/argostranslate/sbd.py", line 159, in lazy_pipeline
    self.stanza_pipeline = stanza.Pipeline(
  File "/home/pj/git/argos-translate/env/lib/python3.10/site-packages/stanza/pipeline/core.py", line 208, in __init__
    download_resources_json(self.dir,
  File "/home/pj/git/argos-translate/env/lib/python3.10/site-packages/stanza/resources/common.py", line 459, in download_resources_json
    request_file(
  File "/home/pj/git/argos-translate/env/lib/python3.10/site-packages/stanza/resources/common.py", line 157, in request_file
    download_file(url, temppath, proxies, raise_for_status)
  File "/home/pj/git/argos-translate/env/lib/python3.10/site-packages/stanza/resources/common.py", line 119, in download_file
    r = requests.get(url, stream=True, proxies=proxies)
  File "/home/pj/git/argos-translate/env/lib/python3.10/site-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/home/pj/git/argos-translate/env/lib/python3.10/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pj/git/argos-translate/env/lib/python3.10/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pj/git/argos-translate/env/lib/python3.10/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/home/pj/git/argos-translate/env/lib/python3.10/site-packages/requests/adapters.py", line 677, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /stanfordnlp/stanza-resources/main/resources_1.10.0.json (Caused by NameResolutionError("HTTPSConnection(host='raw.githubusercontent.com', port=443): Failed to resolve 'raw.githubusercontent.com' ([Errno -3] Temporary failure in name resolution)"))

I could open a PR for argos-translate that phases out Stanza in favor of MiniSBD; then once language models are packaged with .onnx models from MiniSBD, offline use should be restored (or by pre-downloading the MiniSBD models that would also work right away, without needing changes to the language models).

I’ve looked into the Stanza problem of offline use a few weeks ago and they changed logic in newer versions where it’s pretty difficult to avoid the logic that triggers download of files.

That makes sense. I bet this issue is caused by this commit. I had been trying to not change the Stanza version and didn’t notice that he had in this commit.

I may want to wait to do a major version change before doing something like this. At least for now I want to keep supporting Stanza.

I could maybe make it easier to install Argos Translate without Stanza.

1 Like