📃 Paper (KDD 2023) • 🌐 中文 README
This is the official implementation of WebGLM. If you find our open-sourced efforts useful, please 🌟 the repo to encourage our following developement!
demo.mp4
Read this in 中文.
WebGLM aspires to provide an efficient and cost-effective web-enhanced question-answering system using the 10-billion-parameter General Language Model (GLM). It aims to improve real-world application deployment by integrating web search and retrieval capabilities into the pre-trained language model.
- LLM-augmented Retriever: Enhances the retrieval of relevant web content to better aid in answering questions accurately.
- Bootstrapped Generator: Generates human-like responses to questions, leveraging the power of the GLM to provide refined answers.
- Human Preference-aware Scorer: Estimates the quality of generated responses by prioritizing human preferences, ensuring the system produces useful and engaging content.
Clone this repo, and install python requirements.
pip install -r requirements.txt
Install Nodejs.
apt install nodejs # If you use Ubuntu
Install playwright dependencies.
playwright install
If browsing environments are not installed in your host, you need to install them. Do not worry, playwright will give you instructions when you first execute it if so.
In search process, we use SerpAPI to get search results. You need to get a SerpAPI key from here.
Then, set the environment variable SERPAPI_KEY
to your key.
export SERPAPI_KEY="YOUR KEY"
Download the checkpoint on Tsinghua Cloud by running the command line below.
You can manually specify the path to save the checkpoint by --save SAVE_PATH
.
python download.py retriever-pretrained-checkpoint
Before you run the code, make sure that the space of your device is enough.
Export the environment variable WEBGLM_RETRIEVER_CKPT
to the path of the retriever checkpoint. If you have downloaded the retriever checkpoint in the default path, you can simply run the command line below.
export WEBGLM_RETRIEVER_CKPT=./download/retriever-pretrained-checkpoint
You can try WebGLM-2B model by:
python cli_demo.py -w THUDM/WebGLM-2B
Or directly for WebGLM-10B model:
python cli_demo.py