2

理论上可以通过 Python 下载一节的模型,如下所示镜像):

import stanza
stanza.download('en')       # This downloads the English models for the neural pipeline

但是,我的计算机无法访问斯坦福服务器:

(neural-parser2) dernoncourt@ilcompn0:~/temp/stanza$ python
Python 3.6.7 (default, Oct 25 2018, 09:16:13)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import stanza
>>> stanza.download('en')
Downloading https://raw.githubusercontent.com/stanfordnlp/stanza-resources/master/resources_1.0.0.json: 115kB [00:00, 24.5MB/s]
2020-07-07 21:08:34 INFO: Downloading default packages for language: en (English)...
Traceback (most recent call last):
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/urllib3/util/connection.py", line 84, in create_connection
    raise err
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/urllib3/util/connection.py", line 74, in create_connection
    sock.connect(sa)
TimeoutError: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.6/http/client.py", line 1239, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
    self.send(msg)
  File "/usr/lib/python3.6/http/client.py", line 964, in send
    self.connect()
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/urllib3/connection.py", line 187, in connect
    conn = self._new_conn()
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/urllib3/connection.py", line 172, in _new_conn
    self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fa28f172438>: Failed to establish a new connection: [Errno 110] Connection timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/urllib3/connectionpool.py", line 725, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/urllib3/util/retry.py", line 439, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='nlp.stanford.edu', port=80): Max retries exceeded with url: /software/stanza/1.0.0/en/default.zip (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa28f172438>: Failed to establish a new connection: [Errno 110] Connection timed out',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/stanza/utils/resources.py", line 236, in download
    request_file(f'{url}/{__resources_version__}/{lang}/default.zip', os.path.join(dir, lang, f'default.zip'), md5=resources[lang]['default_md5'])
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/stanza/utils/resources.py", line 83, in request_file
    download_file(url, path)
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/stanza/utils/resources.py", line 66, in download_file
    r = requests.get(url, stream=True)
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/requests/api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/requests/sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/requests/sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "/mnt/ilcodisk1/user/dernoncourt/pyenv/neural-parser2/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='nlp.stanford.edu', port=80): Max retries exceeded with url: /software/stanza/1.0.0/en/default.zip (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fa28f172438>: Failed to establish a new connection: [Errno 110] Connection timed out',))

如何手动下载节的模型?我希望节的模型存储在多个服务器中。

我用stanza==1.0.1.

4

1 回答 1

2

我在 Twitter 上与斯坦福 NLP 小组进行了核实,他们确认斯坦福 NLP 网站(https://nlp.stanford.edu/)今天(7 月 8 日)由于斯坦福级数据中心的重组而关闭。他们明天(7 月 9 日)会回来,然后您的脚本应该会再次运行。

他们现在也在推特上发布了这个:

https://twitter.com/stanfordnlp/status/1280917602718461952?s=20

于 2020-07-08T18:00:10.510 回答