Giter Club home page Giter Club logo

llm_ner's Introduction

LLM_NER

introduction

本项目使用提示工程,经过多轮询问得到输入文本的事件关系

WechatIMG976.jpg

usage

环境配置

首先需要下载本仓库:

git clone https://github.com/Andrew82106/LLM_NER.git
cd LLM_NER

然后使用 pip 安装依赖:

pip install -r requirements.txt

其中 transformers 库版本推荐为 4.30.2torch 推荐使用 2.0 及以上的版本,以获得最佳的推理性能。

本项目默认使用ChatGLM2-6B模型,因此此时下ChatGLM2-6B模型权重文件

从 Hugging Face Hub 下载模型需要先安装Git LFS,然后运行

git clone https://huggingface.co/THUDM/chatglm2-6b

如果你从 Hugging Face Hub 上下载 checkpoint 的速度较慢,可以只下载模型实现

GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/THUDM/chatglm2-6b

将下载好的模型实现(chatglm2-6b文件夹)中的内容放到本项目的THUDM/chatglm2-6b文件夹下

然后从这里手动下载模型参数文件,并将下载的文件替换到本项目的THUDM/chatglm2-6b文件夹下

单文本处理

将文本放到项目ChatGLM2-6B/workspace/input/single.txt中,然后运行:

python main.py --task single --savepath ./single_ana_res.json

即可在文件single_ana_res.json中找到处理结果

文本批量处理

将文本放到项目ChatGLM2-6B/workspace/input/batches.txt中,以换行分割样本,然后运行:

python main.py --task batches --savepath ./batches_ana_res.json

即可在文件batches_ana_res.json中找到处理结果

evaluate

ChatGLM2-6B

本项目基于ChatGLM2-6Brepo link进行开发,主要代码在workspace文件下

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.