env.ipynb @master — view markup · raw · history · blame
In [1]:
!/home/jovyan/.virtualenvs/basenv/bin/pip install -r requirement.txt -i https://pypi.doubanio.com/simple/
Looking in indexes: https://pypi.doubanio.com/simple/
Collecting timm==0.4.12
Downloading https://pypi.doubanio.com/packages/90/fc/606bc5cf46acac3aa9bd179b3954433c026aaf88ea98d6b19f5d14c336da/timm-0.4.12-py3-none-any.whl (376 kB)
|████████████████████████████████| 376 kB 1.4 MB/s eta 0:00:01
Collecting transformers==4.15.0
Downloading https://pypi.doubanio.com/packages/4a/7f/f1c28621af0d74794b18cbe5534ec7565ee782ba48257d08ec264bc4aacb/transformers-4.15.0-py3-none-any.whl (3.4 MB)
|████████████████████████████████| 3.4 MB 1.6 MB/s eta 0:00:01
Collecting fairscale==0.4.4
Downloading https://pypi.doubanio.com/packages/9f/51/9b8406605333f7d0a2e6f6a4af29ff64cf6c597b056411c1ed43c35e32b8/fairscale-0.4.4.tar.gz (235 kB)
|████████████████████████████████| 235 kB 436 kB/s eta 0:00:01
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing wheel metadata ... done
Collecting pycocoevalcap
Downloading https://pypi.doubanio.com/packages/08/f9/466f289f1628296b5e368940f89e3cfcfb066d15ddc02ff536dc532b1c93/pycocoevalcap-1.2-py3-none-any.whl (104.3 MB)
|████████████████████████████████| 104.3 MB 83 kB/s s eta 0:00:019 MB 55.9 MB/s eta 0:00:02███▏ | 46.2 MB 32.0 MB/s eta 0:00:02B 32.0 MB/s eta 0:00:01�▏ | 75.4 MB 32.0 MB/s eta 0:00:01��████████████████▌ | 79.9 MB 32.0 MB/s eta 0:00:01��█████████ | 91.1 MB 95.7 MB/s eta 0:00:01100.0 MB 95.7 MB/s eta 0:00:01
Requirement already satisfied: torch>=1.4 in /home/jovyan/.virtualenvs/basenv/lib/python3.7/site-packages (from timm==0.4.12->-r requirement.txt (line 1)) (1.4.0+cpu)
Requirement already satisfied: torchvision in /home/jovyan/.virtualenvs/basenv/lib/python3.7/site-packages (from timm==0.4.12->-r requirement.txt (line 1)) (0.5.0+cpu)
Collecting huggingface-hub<1.0,>=0.1.0
Downloading https://pypi.doubanio.com/packages/d8/2c/9af8451ab780598e3b26a84d4f0e3844841456657401eb6843fdb622bb41/huggingface_hub-0.8.1-py3-none-any.whl (101 kB)
|████████████████████████████████| 101 kB 24.8 MB/s ta 0:00:01
Requirement already satisfied: packaging>=20.0 in /home/jovyan/.virtualenvs/basenv/lib/python3.7/site-packages (from transformers==4.15.0->-r requirement.txt (line 2)) (21.3)
Requirement already satisfied: filelock in /usr/local/lib/python3.7/dist-packages (from transformers==4.15.0->-r requirement.txt (line 2)) (3.6.0)
Requirement already satisfied: requests in /usr/local/lib/python3.7/dist-packages (from transformers==4.15.0->-r requirement.txt (line 2)) (2.27.1)
Requirement already satisfied: pyyaml>=5.1 in /home/jovyan/.virtualenvs/basenv/lib/python3.7/site-packages (from transformers==4.15.0->-r requirement.txt (line 2)) (6.0)
Requirement already satisfied: regex!=2019.12.17 in /home/jovyan/.virtualenvs/basenv/lib/python3.7/site-packages (from transformers==4.15.0->-r requirement.txt (line 2)) (2022.1.18)
Collecting tokenizers<0.11,>=0.10.1
Downloading https://pypi.doubanio.com/packages/d4/e2/df3543e8ffdab68f5acc73f613de9c2b155ac47f162e725dcac87c521c11/tokenizers-0.10.3-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (3.3 MB)
|████████████████████████████████| 3.3 MB 55.3 MB/s eta 0:00:01 | 737 kB 55.3 MB/s eta 0:00:01
Requirement already satisfied: tqdm>=4.27 in /home/jovyan/.virtualenvs/basenv/lib/python3.7/site-packages (from transformers==4.15.0->-r requirement.txt (line 2)) (4.46.1)
Requirement already satisfied: importlib-metadata in /usr/local/lib/python3.7/dist-packages (from transformers==4.15.0->-r requirement.txt (line 2)) (4.11.1)
Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.7/dist-packages (from transformers==4.15.0->-r requirement.txt (line 2)) (1.18.5)
Requirement already satisfied: sacremoses in /home/jovyan/.virtualenvs/basenv/lib/python3.7/site-packages (from transformers==4.15.0->-r requirement.txt (line 2)) (0.0.47)
Collecting torch>=1.4
Downloading https://pypi.doubanio.com/packages/b9/af/23c13cd340cd333f42de225ba3da3b64e1a70425546d1a59bfa42d465a5d/torch-1.12.1-cp37-cp37m-manylinux1_x86_64.whl (776.3 MB)
|████████████████████████████████| 776.3 MB 8.1 kB/s eta 0:00:01 |▊ | 18.6 MB 6.0 MB/s eta 0:02:07 | 32.8 MB 5.9 MB/s eta 0:02:06 | 35.3 MB 5.9 MB/s eta 0:02:05 | 47.5 MB 6.0 MB/s eta 0:02:0252.1 MB 6.0 MB/s eta 0:02:01 | 59.5 MB 65.4 MB/s eta 0:00:11 | 62.2 MB 65.4 MB/s eta 0:00:11 | 67.8 MB 65.4 MB/s eta 0:00:11 | 70.6 MB 65.4 MB/s eta 0:00:11 MB 90.7 MB/s eta 0:00:08 MB 90.7 MB/s eta 0:00:08 MB 90.7 MB/s eta 0:00:08 |████▍ | 107.2 MB 8.7 MB/s eta 0:01:18 |█████ | 120.3 MB 6.0 MB/s eta 0:01:49 | 134.9 MB 4.7 MB/s eta 0:02:16 | 137.6 MB 4.7 MB/s eta 0:02:15 | 142.2 MB 4.7 MB/s eta 0:02:1432166 |███████ | 171.0 MB 8.0 MB/s eta 0:01:16 | 186.9 MB 5.7 MB/s eta 0:01:44 | 192.5 MB 5.7 MB/s eta 0:01:4343420706050505 | 224.6 MB 6.1 MB/s eta 0:01:31 | 225.7 MB 6.1 MB/s eta 0:01:31 | 231.4 MB 6.1 MB/s eta 0:01:30 | 236.6 MB 6.1 MB/s eta 0:01:29 | 239.3 MB 4.7 MB/s eta 0:01:54 | 240.3 MB 4.7 MB/s eta 0:01:53 |██████████▌ | 254.0 MB 4.7 MB/s eta 0:01:51 |██████████▌ | 255.0 MB 4.7 MB/s eta 0:01:50 | 272.2 MB 8.0 MB/s eta 0:01:03 | 276.8 MB 5.8 MB/s eta 0:01:26 | 282.3 MB 5.8 MB/s eta 0:01:25 | 288.1 MB 5.8 MB/s eta 0:01:24 | 290.7 MB 5.8 MB/s eta 0:01:24��████████▏ | 296.4 MB 8.9 MB/s eta 0:00:55��████████▎ | 299.1 MB 8.9 MB/s eta 0:00:54��████████▋ | 304.8 MB 8.9 MB/s eta 0:00:54��████████▊ | 307.5 MB 8.9 MB/s eta 0:00:53��█████████ | 314.8 MB 6.3 MB/s eta 0:01:146.3 MB/s eta 0:01:13 | 334.8 MB 93.9 MB/s eta 0:00:05 | 339.4 MB 93.9 MB/s eta 0:00:05 | 340.4 MB 93.9 MB/s eta 0:00:05███▎ | 347.7 MB 8.2 MB/s eta 0:00:53 |███████████████▌ | 375.6 MB 5.5 MB/s eta 0:01:14 |███████████████▉ | 383.0 MB 8.7 MB/s eta 0:00:46████████████████ | 387.8 MB 8.7 MB/s eta 0:00:45 | 402.3 MB 6.0 MB/s eta 0:01:03 | 403.3 MB 6.0 MB/s eta 0:01:02 | 406.0 MB 6.0 MB/s eta 0:01:02��███████▍ | 420.7 MB 5.6 MB/s eta 0:01:04��███████▊ | 429.9 MB 5.6 MB/s eta 0:01:02��████████ | 435.4 MB 5.6 MB/s eta 0:01:01[K |██████████████████▏ | 441.0 MB 8.2 MB/s eta 0:00:42 |██████████████████▎ | 442.9 MB 8.2 MB/s eta 0:00:41[K |██████████████████▎ | 443.7 MB 8.2 MB/s eta 0:00:41[K |██████████████████▌ | 448.5 MB 8.2 MB/s eta 0:00:41 |██████████████████▋ | 450.2 MB 8.2 MB/s eta 0:00:40[K |██████████████████▉ | 456.4 MB 5.9 MB/s eta 0:00:55[K |███████████████████ | 462.0 MB 5.9 MB/s eta 0:00:54 | 464.7 MB 5.9 MB/s eta 0:00:54 | 469.4 MB 5.9 MB/s eta 0:00:53 | 470.4 MB 5.9 MB/s eta 0:00:53 | 473.1 MB 4.6 MB/s eta 0:01:06 | 478.8 MB 4.6 MB/s eta 0:01:05 | 481.5 MB 4.6 MB/s eta 0:01:04 | 487.2 MB 4.6 MB/s eta 0:01:03�████████▏ | 488.8 MB 4.6 MB/s eta 0:01:02�████████▏ | 489.9 MB 4.6 MB/s eta 0:01:02�████████▌ | 497.2 MB 8.8 MB/s eta 0:00:32�████████▊ | 502.9 MB 8.8 MB/s eta 0:00:31�████████▊ | 503.9 MB 8.8 MB/s eta 0:00:31��████████████████████▌ | 520.4 MB 5.5 MB/s eta 0:00:47��████████████████████▊ | 526.6 MB 5.5 MB/s eta 0:00:46MB 4.7 MB/s eta 0:00:51MB 4.7 MB/s eta 0:00:50MB 6.0 MB/s eta 0:00:38MB 6.0 MB/s eta 0:00:38MB 6.0 MB/s eta 0:00:38MB 6.0 MB/s eta 0:00:37█████▎ | 564.7 MB 4.7 MB/s eta 0:00:46█████▋ | 571.7 MB 4.7 MB/s eta 0:00:44��███▊ | 576.3 MB 4.7 MB/s eta 0:00:43█████▉ | 577.3 MB 4.7 MB/s eta 0:00:43██████ | 580.0 MB 4.7 MB/s eta 0:00:42██████ | 584.7 MB 6.3 MB/s eta 0:00:31��████████████████▏ | 585.7 MB 6.3 MB/s eta 0:00:31██████▏ | 587.6 MB 6.3 MB/s eta 0:00:30��████████████████▎ | 588.4 MB 6.3 MB/s eta 0:00:30��████████████████▌ | 593.1 MB 6.3 MB/s eta 0:00:30��████████████████▌ | 594.1 MB 6.3 MB/s eta 0:00:29MB/s eta 0:00:09��██████████████████▏ | 634.7 MB 18.0 MB/s eta 0:00:08 | 640.2 MB 6.2 MB/s eta 0:00:22 | 641.9 MB 6.2 MB/s eta 0:00:22 | 652.1 MB 6.2 MB/s eta 0:00:21 | 655.0 MB 5.6 MB/s eta 0:00:22��████████▎ | 662.3 MB 5.6 MB/s eta 0:00:21��████████▍ | 665.0 MB 5.6 MB/s eta 0:00:20��████████▋ | 670.7 MB 5.6 MB/s eta 0:00:19��████████▊ | 671.7 MB 5.6 MB/s eta 0:00:19��████████▉ | 674.4 MB 8.1 MB/s eta 0:00:13��█████████ | 679.0 MB 8.1 MB/s eta 0:00:13��█████████ | 680.1 MB 8.1 MB/s eta 0:00:12��███████████████████▏ | 682.8 MB 8.1 MB/s eta 0:00:12��███████████████████▍ | 688.5 MB 8.1 MB/s eta 0:00:11██████████████████▌ | 690.3 MB 19.7 MB/s eta 0:00:05��████████████████████████▉ | 700.4 MB 19.7 MB/s eta 0:00:04��█████████████████████████ | 703.2 MB 19.7 MB/s eta 0:00:04��█████████████████████████ | 705.9 MB 19.7 MB/s eta 0:00:048.2 MB/s eta 0:00:03ta 0:00:02ta 0:00:02��███████████▏| 757.0 MB 25.4 MB/s eta 0:00:01��███████████▍| 761.4 MB 83.4 MB/s eta 0:00:01��███████████▉| 771.7 MB 83.4 MB/s eta 0:00:01
Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.7/dist-packages (from huggingface-hub<1.0,>=0.1.0->transformers==4.15.0->-r requirement.txt (line 2)) (4.1.1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in /usr/local/lib/python3.7/dist-packages (from packaging>=20.0->transformers==4.15.0->-r requirement.txt (line 2)) (3.0.7)
Collecting pycocotools>=2.0.2
Downloading https://pypi.doubanio.com/packages/75/5c/ac61ea715d7a89ecc31c090753bde28810238225ca8b71778dfe3e6a68bc/pycocotools-2.0.4.tar.gz (106 kB)
|████████████████████████████████| 106 kB 95.2 MB/s eta 0:00:01
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Requirement already satisfied: matplotlib>=2.1.0 in /usr/local/lib/python3.7/dist-packages (from pycocotools>=2.0.2->pycocoevalcap->-r requirement.txt (line 4)) (3.0.3)
Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib>=2.1.0->pycocotools>=2.0.2->pycocoevalcap->-r requirement.txt (line 4)) (1.3.2)
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib>=2.1.0->pycocotools>=2.0.2->pycocoevalcap->-r requirement.txt (line 4)) (2.8.2)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib>=2.1.0->pycocotools>=2.0.2->pycocoevalcap->-r requirement.txt (line 4)) (0.11.0)
Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.1->matplotlib>=2.1.0->pycocotools>=2.0.2->pycocoevalcap->-r requirement.txt (line 4)) (1.16.0)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata->transformers==4.15.0->-r requirement.txt (line 2)) (3.7.0)
Requirement already satisfied: charset-normalizer~=2.0.0 in /usr/local/lib/python3.7/dist-packages (from requests->transformers==4.15.0->-r requirement.txt (line 2)) (2.0.12)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.7/dist-packages (from requests->transformers==4.15.0->-r requirement.txt (line 2)) (2021.10.8)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.7/dist-packages (from requests->transformers==4.15.0->-r requirement.txt (line 2)) (1.26.8)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.7/dist-packages (from requests->transformers==4.15.0->-r requirement.txt (line 2)) (3.3)
Requirement already satisfied: joblib in /home/jovyan/.virtualenvs/basenv/lib/python3.7/site-packages (from sacremoses->transformers==4.15.0->-r requirement.txt (line 2)) (1.1.0)
Requirement already satisfied: click in /home/jovyan/.virtualenvs/basenv/lib/python3.7/site-packages (from sacremoses->transformers==4.15.0->-r requirement.txt (line 2)) (8.0.4)
Requirement already satisfied: pillow>=4.1.1 in /home/jovyan/.virtualenvs/basenv/lib/python3.7/site-packages (from torchvision->timm==0.4.12->-r requirement.txt (line 1)) (8.1.0)
Collecting torchvision
Downloading https://pypi.doubanio.com/packages/b3/32/afee55c60af3d4229e445eda9b8f77bc7fb3fb1efac3fab73cfcab671023/torchvision-0.13.1-cp37-cp37m-manylinux1_x86_64.whl (19.1 MB)
|████████████████████████████████| 19.1 MB 3.7 MB/s eta 0:00:01 |███████████▊ | 7.0 MB 3.6 MB/s eta 0:00:04��██▍ | 12.2 MB 3.6 MB/s eta 0:00:02 |██████████████████████████████▏ | 18.1 MB 3.7 MB/s eta 0:00:01�██▍| 18.8 MB 3.7 MB/s eta 0:00:01
Building wheels for collected packages: fairscale, pycocotools
Building wheel for fairscale (PEP 517) ... done
Created wheel for fairscale: filename=fairscale-0.4.4-py3-none-any.whl size=292864 sha256=f0ed0cfd6b4cedafdbba519551f80949aabb9bd7b7ff47c4f8411f8d1fe56ca8
Stored in directory: /home/jovyan/.cache/pip/wheels/88/27/5a/046dd50d60ab3aac5b16392e29c216a160268e09e03ec3a598
Building wheel for pycocotools (PEP 517) ... done
Created wheel for pycocotools: filename=pycocotools-2.0.4-cp37-cp37m-linux_x86_64.whl size=265218 sha256=55afd37122081aa8fb7a8ea1ce3184d6dd69abc4388970032416d14e4dd972b0
Stored in directory: /home/jovyan/.cache/pip/wheels/84/a2/01/c56ec9c809432ac11fb4ff58c9b80e1182f2a649828984ad87
Successfully built fairscale pycocotools
Installing collected packages: torch, torchvision, tokenizers, pycocotools, huggingface-hub, transformers, timm, pycocoevalcap, fairscale
Attempting uninstall: torch
Found existing installation: torch 1.4.0+cpu
Uninstalling torch-1.4.0+cpu:
Successfully uninstalled torch-1.4.0+cpu
Attempting uninstall: torchvision
Found existing installation: torchvision 0.5.0+cpu
Uninstalling torchvision-0.5.0+cpu:
Successfully uninstalled torchvision-0.5.0+cpu
Attempting uninstall: tokenizers
Found existing installation: tokenizers 0.9.4
Uninstalling tokenizers-0.9.4:
Successfully uninstalled tokenizers-0.9.4
Attempting uninstall: transformers
Found existing installation: transformers 4.1.1
Uninstalling transformers-4.1.1:
Successfully uninstalled transformers-4.1.1
Attempting uninstall: timm
Found existing installation: timm 0.5.4
Not uninstalling timm at /home/jovyan/work/.localenv/lib/python3.7/site-packages, outside environment /home/jovyan/.virtualenvs/basenv
Can't uninstall 'timm'. No files were found to uninstall.
Successfully installed fairscale-0.4.4 huggingface-hub-0.8.1 pycocoevalcap-1.2 pycocotools-2.0.4 timm-0.4.12 tokenizers-0.10.3 torch-1.12.1 torchvision-0.13.1 transformers-4.15.0
WARNING: You are using pip version 21.1.3; however, version 22.2.2 is available.
You should consider upgrading via the '/home/jovyan/.virtualenvs/basenv/bin/python -m pip install --upgrade pip' command.
In [3]:
! pip list
Package Version
----------------------------- ------------
absl-py 0.9.0
alembic 1.7.6
argon2-cffi 21.3.0
argon2-cffi-bindings 21.2.0
astor 0.8.1
asttokens 2.0.5
astunparse 1.6.3
async-generator 1.10
attrs 19.3.0
Augmentor 0.2.8
backcall 0.2.0
baytune 0.3.12
bleach 4.1.0
blis 0.4.1
boto3 1.16.25
botocore 1.19.25
cachetools 3.1.1
cairocffi 1.3.0
CairoSVG 2.5.2
calysto 1.0.6
catalogue 1.0.0
certifi 2021.10.8
certipy 0.1.3
cffi 1.15.0
charset-normalizer 2.0.12
click 8.0.4
cloudpickle 1.2.2
cmake 3.21.1
configparser 5.2.0
copulas 0.3.3
cryptography 36.0.1
cssselect2 0.4.1
cycler 0.11.0
cymem 2.0.6
Cython 0.29.20
debugpy 1.5.1
decorator 5.1.1
defusedxml 0.7.1
distlib 0.3.4
dlib 19.22.0
dm-tree 0.1.6
easydict 1.9
en-core-web-sm 2.3.0
entrypoints 0.4
et-xmlfile 1.1.0
fairscale 0.4.4
filelock 3.6.0
func-timeout 4.3.5
future 0.18.2
gast 0.3.3
gensim 3.8.3
google-auth 2.6.0
google-auth-oauthlib 0.4.6
google-pasta 0.2.0
graphviz 0.14
greenlet 1.1.2
grpcio 1.29.0
gym 0.15.7
h5py 2.10.0
huggingface-hub 0.8.1
idna 3.3
imageio 2.8.0
imbalanced-learn 0.6.2
imgaug 0.4.0
importlib-metadata 4.11.1
importlib-resources 5.4.0
install 1.3.5
ipdb 0.13.2
ipykernel 6.9.1
ipython 7.31.1
ipython-genutils 0.2.0
ipywidgets 7.4.0
jdcal 1.4.1
jedi 0.18.1
jieba 0.42.1
Jinja2 3.0.3
jmespath 0.10.0
joblib 1.1.0
jsonschema 4.4.0
jupyter-client 7.1.2
jupyter-core 4.9.2
jupyter-telemetry 0.1.0
jupyterhub 1.4.2
jupyterlab 1.0.0a1
jupyterlab-server 0.2.0
kanren 0.2.3
Keras 2.4.3
Keras-Preprocessing 1.1.2
kiwisolver 1.3.2
Mako 1.1.6
Markdown 3.3.6
MarkupSafe 2.1.0
matplotlib 3.0.3
matplotlib-inline 0.1.3
metakernel 0.28.2
mindspore 1.0.0
minepy 1.2.4
minio 5.0.10
mistune 0.8.4
mpmath 1.2.1
multipledispatch 0.6.0
murmurhash 1.0.6
nbconvert 5.6.1
nbformat 5.1.3
nest-asyncio 1.5.4
networkx 2.6.3
nltk 3.5
notebook 6.2.0
numpy 1.18.5
numpyencoder 0.3.0
oauthlib 3.2.0
opencv-python 4.5.1.48
openpyxl 2.6.4
opt-einsum 3.3.0
packaging 21.3
paddlepaddle 2.0.1
pamela 1.0.0
pandas 0.24.2
pandocfilters 1.5.0
parso 0.8.3
pbr 5.8.1
pexpect 4.8.0
pickleshare 0.7.5
Pillow 8.1.0
pip 21.1.3
plac 1.1.3
platformdirs 2.5.1
plotly 4.8.1
portpicker 1.3.9
preshed 3.0.6
prometheus-client 0.13.1
prompt-toolkit 3.0.28
protobuf 3.19.4
ptyprocess 0.7.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
PyAudio 0.2.11
pycocoevalcap 1.2
pycocotools 2.0.4
pycparser 2.21
pydot 1.4.1
pygame 2.0.1
pyglet 1.5.0
Pygments 2.11.2
pyOpenSSL 22.0.0
pyparsing 3.0.7
pyrsistent 0.18.1
python-dateutil 2.8.2
python-json-logger 2.0.2
pytorch-pretrained-bert 0.6.2
pytorch-transformers 1.2.0
pytz 2021.3
PyWavelets 1.2.0
PyYAML 6.0
pyzmq 22.3.0
regex 2022.1.18
requests 2.27.1
requests-oauthlib 1.3.1
retrying 1.3.3
rouge 1.0.0
rsa 4.8
ruamel.yaml 0.17.21
ruamel.yaml.clib 0.2.6
s3transfer 0.3.3
sacremoses 0.0.47
scikit-image 0.15.0
scikit-learn 0.22.2.post1
scipy 1.3.3
seaborn 0.10.1
semantic-version 2.8.5
Send2Trash 1.8.0
sentencepiece 0.1.91
setuptools 57.1.0
Shapely 1.7.0
six 1.16.0
smart-open 5.2.1
spacy 2.3.2
SQLAlchemy 1.4.31
srsly 1.0.5
stevedore 3.5.0
svgwrite 1.4.1
sympy 1.6.2
tensorboard 2.8.0
tensorboard-data-server 0.6.1
tensorboard-plugin-wit 1.8.1
tensorboardX 2.0
tensorflow 2.3.1
tensorflow-addons 0.11.2
tensorflow-estimator 2.3.0
tensorflow-federated 0.17.0
tensorflow-model-optimization 0.4.1
tensorflow-privacy 0.5.2
termcolor 1.1.0
terminado 0.13.1
testpath 0.5.0
tf-slim 1.1.0
thinc 7.4.1
timm 0.4.12
tinycss2 1.1.1
tokenizers 0.10.3
toolz 0.11.2
torch 1.11.0
torchtext 0.6.0
torchvision 0.12.0
tornado 6.1
tqdm 4.46.1
traitlets 5.1.1
transformers 4.15.0
typeguard 2.13.3
typing-extensions 4.1.1
unification 0.2.2
urllib3 1.26.8
virtualenv 20.13.1
virtualenv-clone 0.5.7
virtualenvwrapper 4.7.0
wasabi 0.9.0
wcwidth 0.2.5
webencodings 0.5.1
Werkzeug 2.0.3
wheel 0.36.2
widgetsnbextension 3.4.2
word2vec 0.11.1
wrapt 1.13.3
xlrd 1.2.0
XlsxWriter 1.4.3
yellowbrick 1.1
zipp 3.7.0
WARNING: You are using pip version 21.1.3; however, version 22.1.2 is available.
You should consider upgrading via the '/home/jovyan/work/.localenv/bin/python -m pip install --upgrade pip' command.
In [1]:
import requests
# 先将文件上传至文件存储(此存储为临时用,一小时后文件即会被删除)
upload_url = 'https://mo.zju.edu.cn/pyapi/file/temp_api_file'
Photo_file = {'file': open('./img/demo.jpg', 'rb')}
Photo_file_name = requests.post(upload_url, files=Photo_file).json().get('temp_file_name')
--------------------------------------------------------------------------- TimeoutError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/urllib3/connection.py in _new_conn(self) 174 conn = connection.create_connection( --> 175 (self._dns_host, self.port), self.timeout, **extra_kw 176 ) /usr/local/lib/python3.7/dist-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options) 94 if err is not None: ---> 95 raise err 96 /usr/local/lib/python3.7/dist-packages/urllib3/util/connection.py in create_connection(address, timeout, source_address, socket_options) 84 sock.bind(source_address) ---> 85 sock.connect(sa) 86 return sock TimeoutError: [Errno 110] Connection timed out During handling of the above exception, another exception occurred: NewConnectionError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 709 headers=headers, --> 710 chunked=chunked, 711 ) /usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw) 385 try: --> 386 self._validate_conn(conn) 387 except (SocketTimeout, BaseSSLError) as e: /usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py in _validate_conn(self, conn) 1039 if not getattr(conn, "sock", None): # AppEngine might not have `.sock` -> 1040 conn.connect() 1041 /usr/local/lib/python3.7/dist-packages/urllib3/connection.py in connect(self) 357 # Add certificate verification --> 358 conn = self._new_conn() 359 hostname = self.host /usr/local/lib/python3.7/dist-packages/urllib3/connection.py in _new_conn(self) 186 raise NewConnectionError( --> 187 self, "Failed to establish a new connection: %s" % e 188 ) NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f7d07fedf50>: Failed to establish a new connection: [Errno 110] Connection timed out During handling of the above exception, another exception occurred: MaxRetryError Traceback (most recent call last) /usr/local/lib/python3.7/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 449 retries=self.max_retries, --> 450 timeout=timeout 451 ) /usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw) 785 retries = retries.increment( --> 786 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2] 787 ) /usr/local/lib/python3.7/dist-packages/urllib3/util/retry.py in increment(self, method, url, response, error, _pool, _stacktrace) 591 if new_retry.is_exhausted(): --> 592 raise MaxRetryError(_pool, url, error or ResponseError(cause)) 593 MaxRetryError: HTTPSConnectionPool(host='mo.zju.edu.cn', port=443): Max retries exceeded with url: /pyapi/file/temp_api_file (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7d07fedf50>: Failed to establish a new connection: [Errno 110] Connection timed out')) During handling of the above exception, another exception occurred: ConnectionError Traceback (most recent call last) /tmp/ipykernel_374/4271832855.py in <module> 4 upload_url = 'https://mo.zju.edu.cn/pyapi/file/temp_api_file' 5 Photo_file = {'file': open('./img/demo.jpg', 'rb')} ----> 6 Photo_file_name = requests.post(upload_url, files=Photo_file).json().get('temp_file_name') 7 /usr/local/lib/python3.7/dist-packages/requests/api.py in post(url, data, json, **kwargs) 115 """ 116 --> 117 return request('post', url, data=data, json=json, **kwargs) 118 119 /usr/local/lib/python3.7/dist-packages/requests/api.py in request(method, url, **kwargs) 59 # cases, and look like a memory leak in others. 60 with sessions.Session() as session: ---> 61 return session.request(method=method, url=url, **kwargs) 62 63 /usr/local/lib/python3.7/dist-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json) 527 } 528 send_kwargs.update(settings) --> 529 resp = self.send(prep, **send_kwargs) 530 531 return resp /usr/local/lib/python3.7/dist-packages/requests/sessions.py in send(self, request, **kwargs) 643 644 # Send the request --> 645 r = adapter.send(request, **kwargs) 646 647 # Total elapsed time of the request (approximately) /usr/local/lib/python3.7/dist-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies) 517 raise SSLError(e, request=request) 518 --> 519 raise ConnectionError(e, request=request) 520 521 except ClosedPoolError as e: ConnectionError: HTTPSConnectionPool(host='mo.zju.edu.cn', port=443): Max retries exceeded with url: /pyapi/file/temp_api_file (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7d07fedf50>: Failed to establish a new connection: [Errno 110] Connection timed out'))
In [ ]:
base_url = "https://mo.zju.edu.cn/pyapi/apps/run/"
app_id = "62b12fde34514bed5c29038b"
input_dic = {"Photo": {"val": Photo_file_name, "type": "img"}, "Question": {"val": "<fill_with_str>", "type": "str"}}
output_dic = {"Answer": {"type": "str"}}
app_version = "0-3-0"
payload = {"app": {"input": input_dic, "output": output_dic}, "version": app_version}
response = requests.post(base_url + app_id, json=payload)
print(response.json())