https://github.com/zjunlp/oneedit
OneEdit: A Neural-Symbolic Collaboratively Knowledge Editing System.
https://github.com/zjunlp/oneedit
allspark artificial-intelligence collaborative-editing knowledge-editing knowledge-graph large-language-models model-editing natural-language-processing neural-symbolic system
Last synced: 4 months ago
JSON representation
OneEdit: A Neural-Symbolic Collaboratively Knowledge Editing System.
- Host: GitHub
- URL: https://github.com/zjunlp/oneedit
- Owner: zjunlp
- Created: 2024-02-25T11:13:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-16T08:54:46.000Z (about 1 year ago)
- Last Synced: 2024-09-17T02:37:02.700Z (about 1 year ago)
- Topics: allspark, artificial-intelligence, collaborative-editing, knowledge-editing, knowledge-graph, large-language-models, model-editing, natural-language-processing, neural-symbolic, system
- Language: Python
- Homepage:
- Size: 826 KB
- Stars: 14
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
OneEdit
OneEdit: A Neural-Symbolic Collaboratively Knowledge Editing System
$\color{red}{It\'s\ unfortunate\ that\ due\ to\ limited\ computational\ resources,\ we\ have\ suspended\ the\ online\ demo.}$
$\color{red}{If\ you\'d\ like\ to\ try\ the\ demo,\ please\ contact\ xizekun2023 \@zju.edu.cn\ or\ zhangningyu \@zju.edu.cn}$[](video.mp4)
Click the photo above to watch the video[](https://github.com/zjunlp/KnowledgeCircuits)
[](https://opensource.org/licenses/MIT)
## Table of Contents
- 🌟[Overview](#overview)
- 🔧[Installation](#installation)
- 📚[Quick Start](#Quick-Start)
- 📉[Hparam](#Choose-Your-Hparam)
- 🧐[Demo](#demo)---
## 🌟Overview
Since the inception of artificial intelligence, knowledge representation has always been one of its core objectives. This work primarily focuses on integrating the parametric knowledge of large language models with symbolic knowledge, enabling more precise modifications to the model's parametric knowledge.
## 🔧Installation
### Prerequisites
- Python 3.10
- Conda
- Neo4j Enterprise Edition 3.5.35
- Node.js and Yarn (for the web interface)### Conda Environment
To get started, please install conda run the following code to build the environment.
```
conda create -n oneedit python=3.10
pip install -r requirements.txt
```## 📚Quick Start
### Start neo4j
First, you need to start the Neo4j service and ensure that local ports 7474 and 7687 are available.
When you enter the command
```
neo4j start
```
see the message
"Neo4j is already running,"
it indicates that Neo4j is successfully running on your machine.### Run code
Then, you can load the data according to the path specified in the project and run the code by entering the following command.
```
python exp.py \
--datapath data_path \
--harampath haram_path
```
### Web
First, you need to start our service on the backend.
```
python server.py
```
> We will use port 2001 on your local machine to provide backend services.Then, you can extract the downloaded web page into the project directory, run the web code to test the model outputs, input through the visual interface, and observe changes in the knowledge graph in real time.
```
cd web
yarn dev start
```
You can view in real-time on the backend which knowledge has been edited and which has been rolled back.## 📉Choose Your Hparam
All our experimental parameters are stored in the `hparams.yaml` file, which you can easily modify to run experiments with various models and methods.
### Set Editor Hparam
You need to set the name of the model you want to run and the knowledge editing method in the edit_method and model_name fields of the hparam file.>Currently, we only support `GRACE` and `MEMIT`, with partial support for `ROME`.
### Set Noo4j Hparam
You need to specify your Neo4j URL, username, and password in the hyperparameters.> By default, your Neo4j account and password are usually both set to neo4j.
### Set Interpreter Hparam
Finally, you need to specify the path for the interpreter. We provide a LoRA-trained MiniCPM 2B model for you to use. You can download it from the project's [Google Drive](https://drive.google.com/drive/folders/1hQQV6AtgaDxLJ7OW2oCBtNFlLEUMITYw?usp=sharing) and then set the path accordingly.## 🧐Demo
We provide a user-friendly web interface for ease of use.
Due to the large size of the web page, we have stored it on [Google Drive](https://drive.google.com/drive/folders/1hQQV6AtgaDxLJ7OW2oCBtNFlLEUMITYw?usp=sharing).
You need to download and extract it, then store it in the project directory.