zjunlp / DeepKE

[EMNLP 2022] An Open Toolkit for Knowledge Graph Extraction and Construction
http://deepke.zjukg.cn/
MIT License
3.51k stars 681 forks source link

整个项目似乎对macOs兼容不好 #422

Closed iris-qq closed 7 months ago

iris-qq commented 7 months ago

Describe the bug

A clear and concise description of what the bug is.

安装requirements.txt的依赖包,不能正常安装

Ignoring numpy: markers 'python_version == "3.6" and platform_machine != "aarch64" and platform_system != "AIX" and platform_python_implementation == "CPython"' don't match your environment

这个gif的动图跟当前的项目结构也不对应了,包括example里的ner也是,没有demo.py 和run.py这些文件,麻烦可以更新一下

Environment (please complete the following information):

Screenshots

If applicable, add screenshots to help explain your problem.

image

image

Additional context

Add any other context about the problem here.

zxlzr commented 7 months ago

抱歉,我们会尽快安排开发人员处理上述问题,我们默认测试环境是linux下的gpu和cpu,不同操作系统可能存在python库的兼容性问题

xxupiano commented 7 months ago

请新建conda环境再安装

zxlzr commented 7 months ago

请您按照readme使用虚拟环境conda 安装,您问题解决了吗

iris-qq commented 7 months ago

我就是 conda 的虚拟环境

生如夏花之绚丽,死如秋叶之静美。 ---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2024年03月08日 13:31 | | 收件人 | zjunlp/DeepKE @.> | | 抄送人 | iris @.>, Author @.> | | 主题 | Re: [zjunlp/DeepKE] 整个项目似乎对macOs兼容不好 (Issue #422) |

请您按照readme使用虚拟环境conda 安装,您问题解决了吗

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

zxlzr commented 7 months ago

您好,我们会尽快找台mac复现下您的情况

guihonghao commented 7 months ago

您好,根据您说述“example里的ner也是,没有demo.py 和run.py这些文件”,这个对应的环境应该是DeepKE下面这个环境,不是DeepKE-LLM环境,这可能造成冲突,请您重新试试DeepKE环境。

image
iris-qq commented 7 months ago

OK,我一会再试一下

生如夏花之绚丽,死如秋叶之静美。 ---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2024年03月08日 13:51 | | 收件人 | zjunlp/DeepKE @.> | | 抄送人 | iris @.>, Author @.> | | 主题 | Re: [zjunlp/DeepKE] 整个项目似乎对macOs兼容不好 (Issue #422) |

您好,根据您说述“example里的ner也是,没有demo.py 和run.py这些文件”,这个对应的环境应该是DeepKE下面这个环境,不是DeepKE-LLM环境,这可能造成冲突,请您重新试试DeepKE环境。 image.png (view on web)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

zxlzr commented 7 months ago

请问您问题解决了吗

iris-qq commented 7 months ago

周一在看吧

生如夏花之绚丽,死如秋叶之静美。 ---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2024年03月09日 19:58 | | 收件人 | zjunlp/DeepKE @.> | | 抄送人 | iris @.>, Author @.> | | 主题 | Re: [zjunlp/DeepKE] 整个项目似乎对macOs兼容不好 (Issue #422) |

请问您问题解决了吗

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

iris-qq commented 7 months ago

其实我就想用llm+rag+prompt template来试试实体和关系的抽取,不知道我应该怎么执行这个脚本

zxlzr commented 7 months ago

您想执行哪个脚本?

使用deepke-llm您只需要按说明安装依赖包,如果有问题请联系我们 https://github.com/zjunlp/DeepKE/tree/main/example/llm

deepke-llm (只有上述目录下的文件是大模型的)和deepke (传统非大模型)在同一个git 里但安装不同的依赖包

iris-qq commented 7 months ago

我在使用DeepKE/example/llm/LLMICL目录下的requirements安装包的时候出现了如下问题,环境使用的是conda python=3.9跟readme.md里的环境一致 image

iris-qq commented 7 months ago

直接安装llm下的requirements会有如下问题 image

然后这个包也会有别的冲突

The conflict is caused by:
    transformers 4.31.0 depends on huggingface-hub<1.0 and >=0.14.1
    datasets 1.9.0 depends on huggingface-hub<0.1.0

我把所有的包的版本号都去掉了,可以正产安装,如下是我用pip导出的安装包的版本,供参考

absl-py==2.1.0
accelerate==0.27.2
aiohttp==3.9.3
aiosignal==1.3.1
annotated-types==0.6.0
anthropic==0.19.1
anyio==4.3.0
async-timeout==4.0.3
attrs==23.2.0
backoff==2.2.1
beautifulsoup4==4.11.2
bitsandbytes==0.42.0
bs4==0.0.1
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
cohere==4.52
contourpy==1.2.0
cycler==0.12.1
datasets==2.18.0
dill==0.3.8
distro==1.9.0
easyinstruct==0.1.2
exceptiongroup==1.2.0
fastavro==1.9.4
filelock==3.13.1
fonttools==4.49.0
frozenlist==1.4.1
fsspec==2024.2.0
h11==0.14.0
hanlp==2.1.0b56
hanlp_common==0.0.19
hanlp_downloader==0.0.25
hanlp_trie==0.0.5
httpcore==1.0.4
httpx==0.27.0
huggingface-hub==0.21.4
idna==3.6
importlib-metadata==6.11.0
importlib_resources==6.1.3
jieba==0.42.1
Jinja2==3.1.3
joblib==1.3.2
kiwisolver==1.4.5
lexicalrichness==0.5.1
lxml==4.9.2
MarkupSafe==2.1.5
matplotlib==3.8.3
mpmath==1.3.0
multidict==6.0.5
multiprocess==0.70.16
networkx==3.2.1
nltk==3.8.1
numpy==1.26.4
openai==1.9.0
packaging==23.2
pandarallel==1.6.5
pandas==2.2.1
peft==0.9.0
phrasetree==0.0.8
pillow==10.2.0
protobuf==4.25.3
psutil==5.9.8
pyarrow==15.0.1
pyarrow-hotfix==0.6
pydantic==2.6.3
pydantic_core==2.16.3
pynvml==11.5.0
pyparsing==3.1.2
python-dateutil==2.9.0.post0
pytz==2024.1
PyYAML==6.0.1
regex==2023.12.25
requests==2.31.0
rouge-chinese==1.0.3
rouge_score==0.1.2
safetensors==0.4.2
scikit-learn==1.4.1.post1
scipy==1.12.0
sentencepiece==0.2.0
six==1.16.0
sniffio==1.3.1
soupsieve==2.5
sqlitedict==2.1.0
sympy==1.12
termcolor==2.4.0
textblob==0.18.0.post0
threadpoolctl==3.3.0
tiktoken==0.6.0
tokenizers==0.15.2
toposort==1.5
torch==2.2.1
torchvision==0.17.1
tqdm==4.66.2
transformers==4.38.2
typing_extensions==4.10.0
tzdata==2024.1
urllib3==2.2.1
xxhash==3.4.1
yarl==1.9.4
zhconv==1.4.3
zipp==3.17.0

明天有空我再试一下gpu上直接最推理看下能否正常执行,现在手头没有gpu,兄弟辛苦了

guihonghao commented 7 months ago

如果您想调用ChatGPT之类的模型做few-shot抽取,请安装https://github.com/zjunlp/DeepKE/blob/main/example/llm/LLMICL/requirement.txt这个环境,不需要安装deepke-llm。如果您想使用Baichuan2、Llama2之类的指令微调后的模型做抽取,请安装deepke-llm,并参考https://github.com/zjunlp/DeepKE/tree/main/example/llm/InstructKGC改目录下的教程。至于RAG功能,本项目未涉及这方面的技术。

zxlzr commented 7 months ago

您好,我估计问题可能是您系统内一些python库的版本和requirement.txt的冲突所致,建议您建一个虚拟环境,检查python库版本是否为requirement.txt内的版本号。如果您检查库的版本安装都正确的仍无法运行,请您联系我们。

iris-qq commented 7 months ago

是按照readme.md创建的虚拟环境, image

ERROR: Could not build wheels for hydra, which is required to install pyproject.toml-based projects 包可以安装,但是执行 DeepKE/example/llm/run.py会报错 企业微信截图_b2f88f3d-de56-4d9b-8427-c8fbc97aa862

guihonghao commented 7 months ago

pip install hydra-core --upgrade试试这个命令

iris-qq commented 7 months ago

pip install hydra-core --upgrade试试这个命令

这个命令有效果,我跑下百川的13b看下

iris-qq commented 7 months ago

ok,我这边已经在centos8+Tesla A-100的卡上跑了一下基于百川的inference,总体的问题如下: 1、包的冲突,首先我是遵从了conda +python3.9的环境

我这里用的是DeepKE/example/llm/InstructKGC/infer_scripts/infer_baichuan.bash这个启动命令

执行命令:

CUDA_VISIBLE_DEVICES=0 python src/inference.py \
    --stage sft \
    --model_name_or_path 'baichuan-inc/Baichuan2-13B-Chat' \
    --checkpoint_dir 'zjunlp/baichuan2-13b-iepile-lora' \
    --model_name 'baichuan' \
    --template 'baichuan2' \
    --do_predict \
    --input_file 'data/NER/test.json' \
    --output_file 'results/baichuan2-13b-lora.json' \
    --finetuning_type lora \
    --output_dir 'lora/test' \
    --predict_with_generate \
    --cutoff_len 512 \
    --fp16 \
    --max_new_tokens 300 \
    --bits 4

经过上述修改之后,可以正常执行 截图如下:

image
guihonghao commented 7 months ago

感谢你的建议,我们已经对版本依赖做出了修改。--model_name_or_path、--checkpoint_dir需要在本地创建两个目录models和lora并把模型权重和lora权重下载放在相应目录下。你所使用的方法是根据huggingface标识符自动下载,本质没有区别。iepile系列使用的半精度是--bf16而非--fp16,详细信息可参考:https://github.com/zjunlp/IEPile

iris-qq commented 7 months ago

ok,那我就把这个issue关掉了,后续有别的问题我再过来发