TsingZ0 / PFLlib

37 traditional FL (tFL) or personalized FL (pFL) algorithms, 3 scenarios, and 20 datasets.
GNU General Public License v2.0
1.44k stars 298 forks source link

关于AG_News数据的生成问题 #137

Closed like-hopeful closed 11 months ago

like-hopeful commented 1 year ago

您好,在您的PFL-Non-IID的项目代码中,运行python generate_agnews.py noniid - dir生成数据,出现以下报错,希望您指点一下问题:

Traceback (most recent call last): File "C:\Users\like.conda\envs\pytorch\lib\site-packages\urllib3\connection.py", line 174, in _new_conn
conn = connection.create_connection(
File "C:\Users\like.conda\envs\pytorch\lib\site-packages\urllib3\util\connection.py", line 95, in create_connection raise err
File "C:\Users\like.conda\envs\pytorch\lib\site-packages\urllib3\util\connection.py", line 85, in create_connection sock.connect(sa)
TimeoutError: [WinError 10060] 由于连接方在一段时间后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\like.conda\envs\pytorch\lib\site-packages\urllib3\connectionpool.py", line 714, in urlopen
httplib_response = self._make_request(
File "C:\Users\like.conda\envs\pytorch\lib\site-packages\urllib3\connectionpool.py", line 403, in _make_request
self._validate_conn(conn)
File "C:\Users\like.conda\envs\pytorch\lib\site-packages\urllib3\connectionpool.py", line 1053, in _validate_conn
conn.connect() File "C:\Users\like.conda\envs\pytorch\lib\site-packages\urllib3\connection.py", line 363, in connect self.sock = conn = self._new_conn() File "C:\Users\like.conda\envs\pytorch\lib\site-packages\urllib3\connection.py", line 186, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x0000028978125D60>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间 后没有正确答复或连接的主机没有反应,连接尝试失败。

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\like.conda\envs\pytorch\lib\site-packages\requests\adapters.py", line 487, in send resp = conn.urlopen( File "C:\Users\like.conda\envs\pytorch\lib\site-packages\urllib3\connectionpool.py", line 798, in urlopen retries = retries.increment( File "C:\Users\like.conda\envs\pytorch\lib\site-packages\urllib3\util\retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='drive.google.com', port=443): Max retries exceeded with url: /uc?export=download&id=0Bz8a_Dbh9QhbUDNpeUdjb0wxRms (Caused b y NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000028978125D60>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复或连 接的主机没有反应,连接尝试失败。'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "L:\Model\PFL-Non-IID-master -test\dataset\generate_agnews.py", line 92, in generate_agnews(dir_path, num_clients, num_classes, niid, balance, partition) File "L:\Model\PFL-Non-IID-master -test\dataset\generate_agnews.py", line 33, in generate_agnews trainset, testset = torchtext.datasets.AG_NEWS(root=dir_path+"rawdata") File "C:\Users\like.conda\envs\pytorch\lib\site-packages\torchtext\datasets\text_classification.py", line 170, in AG_NEWS return _setup_datasets(*(("AG_NEWS",) + args), kwargs) File "C:\Users\like.conda\envs\pytorch\lib\site-packages\torchtext\datasets\text_classification.py", line 117, in _setup_datasets dataset_tar = download_from_url(URLS[dataset_name], root=root) File "C:\Users\like.conda\envs\pytorch\lib\site-packages\torchtext\utils.py", line 96, in download_from_url response = session.get(url, stream=True) File "C:\Users\like.conda\envs\pytorch\lib\site-packages\requests\sessions.py", line 600, in get return self.request("GET", url, kwargs) File "C:\Users\like.conda\envs\pytorch\lib\site-packages\requests\sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "C:\Users\like.conda\envs\pytorch\lib\site-packages\requests\sessions.py", line 701, in send r = adapter.send(request, kwargs) File "C:\Users\like.conda\envs\pytorch\lib\site-packages\requests\adapters.py", line 520, in send raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='drive.google.com', port=443): Max retries exceeded with url: /uc?export=download&id=0Bz8a_Dbh9QhbUDNpeUdjb0wxRms (Cause d by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000028978125D60>: Failed to establish a new connection: [WinError 10060] 由于连接方在一段时间后没有正确答复 或连接的主机没有反应,连接尝试失败。'))

TsingZ0 commented 1 year ago

可能是网络问题?或者是PyTorch在维护?我偶尔也会出现这种情况,过一阵子就好了。不过你也可以手动下载数据集,然后再进行数据处理。

like-hopeful commented 1 year ago

可能是网络问题?或者是PyTorch在维护?我偶尔也会出现这种情况,过一阵子就好了。

目前还是不行,请问如果手动下载,就是把数据放在rawdata文件夹下然后再使用python generate_agnews.py noniid - dir划分吗?

TsingZ0 commented 1 year ago

如果手动下载的话,数据放在rawdata文件夹下就可以了