python webshop安装步骤出错 princeton-nlp/WebShop - /setup
引言:
WebShop是一个模拟的电子商务网站环境,包含118万种真实产品和12,087条众包文本指令。在这个环境中,代理需要浏览多种类型的网页,并执行多种操作,以根据指令查找、定制和购买产品。WebShop提供了几个挑战,包括理解组合指令、查询(重新)表述、处理网页中的噪声文本以及进行探索。
安装步骤
1、下载webshop
git clone https://github.com/princeton-nlp/webshop.git webshop
2、创建conda环境
conda create -n webshop python=3.8.13
3、激活conda环境
conda activate webshop
4、安装环境所需依赖和下载数据
cd webshop
./setup.sh [-d small|all]
./setup.sh -d all会下载全部的商品 ./setup.sh -d small会下载1000条商品 5、更新包(有些包过期了)
pip install Werkzeug==2.2.2
pip install pydantic==1.10.11
pip install --force-reinstall typing-extensions==4.5.0 beautifulsoup4
conda install mkl=2021
python -m spacy download en_core_web_lg
6、进入web_agent_site文件夹,修改utils.py
# DEFAULT_ATTR_PATH = join(BASE_DIR, '../data/items_ins_v2_1000.json')
# DEFAULT_FILE_PATH = join(BASE_DIR, '../data/items_shuffle_1000.json')
DEFAULT_ATTR_PATH = join(BASE_DIR, '../data/items_ins_v2.json')
DEFAULT_FILE_PATH = join(BASE_DIR, '../data/items_shuffle.json')
7、启动
./run_dev.sh
安装过程中可能出现的问题
1、没有显示商品 排查以下几种状况: (1)您使用的服务器访问不了google网站,导致data下的数据缺失。
解决办法:浏览器访问以下链接,自动下载数据,将下载的数据放入到webshop/data目录下。 small版本:
https://drive.google.com/uc?id=1EgHdxQ_YxqIQlvvq5iKlCrkEKR6-j0Ib;
https://drive.google.com/uc?id=1IduG0xl544V_A_jv3tHXC0kyFi7PnyBu;
https://drive.google.com/uc?id=14Kb5SPBk_jfdLZ_CDBNitW98QLDlKR5O
all版本:
https://drive.google.com/uc?id=1A2whVgOO0euk5O13n2iYDM0bQRkkRduB;
https://drive.google.com/uc?id=1s2j6NgHljiZzQNL3veZaAiyW_qDEgBNi;
https://drive.google.com/uc?id=14Kb5SPBk_jfdLZ_CDBNitW98QLDlKR5O
(2)进入webshop/search_engine查看有没有生成indexes文件
如果没有,需要在此目录下挨个运行以下指令:
python -m pyserini.index.lucene --collection JsonCollection --input resources_100 --index indexes_100 --generator DefaultLuceneDocumentGenerator --threads 1 --storePositions --storeDocvectors --storeRaw
python -m pyserini.index.lucene --collection JsonCollection --input resources --index indexes --generator DefaultLuceneDocumentGenerator --threads 1 --storePositions --storeDocvectors --storeRaw
python -m pyserini.index.lucene --collection JsonCollection --input resources_1k --index indexes_1k --generator DefaultLuceneDocumentGenerator --threads 1 --storePositions --storeDocvectors --storeRaw
python -m pyserini.index.lucene --collection JsonCollection --input resources_100k --index indexes_100k --generator DefaultLuceneDocumentGenerator --threads 1 --storePositions --storeDocvectors --storeRaw
(3)查看webshop/user_session_logs有没有all_trajs文件夹,并且all_trajs文件夹下有没有jsonl文件 :
如果没有,则需要在浏览器访问以下链接,并将下载的内容放在webshop/user_session_logs目录下。
https://drive.google.com/drive/u/1/folders/16H7LZe2otq4qGnKw_Ic1dkt-o3U9Zsto
(4)在使用./setup.sh后,需要访问运行的链接,比如webshop运行在127.0.0.1:3000 需要访问:127.0.0.1:3000/abc来加载商品。 拼多多帮助力入口
当出现
Products loaded.
Keys Cleaned.
Attributes Loaded.
100%|██████████████████| n/n
后即加载完毕。
如果还有其他问题,请留言咨询,一起探讨。
python webshop安装步骤出错 princeton-nlp/WebShop
精彩内容