• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Python
  • License
    MIT License
  • Created over 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ConceptFlow

This is the implementation of ConceptFlow described in ACL 2020 paper Grounded Conversation Generation as Guided Traverses in Commonsense Knowledge Graphs.

Prerequisites

The recommended way to install the required packages is using pip and the provided requirements.txt file. Create the environment by running the following command:

  • Mac OS: pip install -r requirements.txt

Download Dataset

  • Due to the policy of Reddit, we are not able to release the data in a public repo. Please send email to [email protected] to request data.
  • By default, we expect the data to be stored in ./data.

Train and inference

For training, edit config.yml and set is_train: True. Run python train.py. Training result will be output to ./training_output.

For inference, edit config.yml, set is_train: False and test_model_path: 'Your Model Path'. Run python inference.py. Generated responses will be output to ./inference_output.

Concept Selection

For concept selection, edit config.yml set is_train: False, test_model_path: 'Your Selector Path' and is_select: True. Run python sort.py. The sorted two-hop concepts will be output to selected_concept.txt with ascending order.

Evaluation

To evaluate the generated response, we use the metrics and the scripts of DSTC7. Also, we use this implementation to calculate ROUGE.

Overall Results

  • Relevance Between Generated and Golden Responses. The PPL results of GPT-2 is not directly comparable because of its different tokenization.
Model Bleu-4 Nist-4 Rouge-1 Rouge-2 Rouge-L Meteor PPL
Seq2seq 0.0098 1.1069 0.1441 0.0189 0.1146 0.0611 48.79
MemNet 0.0112 1.1977 0.1523 0.0215 0.1213 0.0632 47.38
CopyNet 0.0106 1.0788 0.1472 0.0211 0.1153 0.0610 43.28
CCM 0.0084 0.9095 0.1538 0.0211 0.1245 0.0630 42.91
GPT-2 (lang) 0.0162 1.0844 0.1321 0.0117 0.1046 0.0637 29.08
GPT-2 (conv) 0.0124 1.1763 0.1514 0.0222 0.1212 0.0629 24.55
ConceptFlow 0.0246 1.8329 0.2280 0.0469 0.1888 0.0942 29.90
  • Diversity of Generated Response.
Model Dist-1 Dist-2 Ent-4
Seq2seq 0.0123 0.0525 7.665
MemNet 0.0211 0.0931 8.418
CopyNet 0.0223 0.0988 8.422
CCM 0.0146 0.0643 7.847
GPT-2 (lang) 0.0325 0.2461 11.65
GPT-2 (conv) 0.0266 0.1218 8.546
ConceptFlow 0.0223 0.1228 10.27

Citation

@inproceedings{zhang-etal-2020-grounded,
    title = "Grounded Conversation Generation as Guided Traverses in Commonsense Knowledge Graphs",
    author = "Zhang, Houyu  and
      Liu, Zhenghao  and
      Xiong, Chenyan  and
      Liu, Zhiyuan",
    booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
    month = jul,
    year = "2020",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://www.aclweb.org/anthology/2020.acl-main.184",
    pages = "2031--2043",
    abstract = "Human conversations naturally evolve around related concepts and hop to distant concepts. This paper presents a new conversation generation model, ConceptFlow, which leverages commonsense knowledge graphs to explicitly model conversation flows. By grounding conversations to the concept space, ConceptFlow represents the potential conversation flow as traverses in the concept space along commonsense relations. The traverse is guided by graph attentions in the concept graph, moving towards more meaningful directions in the concept space, in order to generate more semantic and informative responses. Experiments on Reddit conversations demonstrate ConceptFlow{'}s effectiveness over previous knowledge-aware conversation models and GPT-2 based models while using 70{\%} fewer parameters, confirming the advantage of explicit modeling conversation structures. All source codes of this work are available at https://github.com/thunlp/ConceptFlow.",
}

Aceknowledgements

This code was based in part on the source code of CCM and GraftNet.

Contact

If you have any question or suggestion, please send email to:

[email protected]

More Repositories

1

GNNPapers

Must-read papers on graph neural networks (GNN)
15,490
star
2

WantWords

An open-source online reverse dictionary.
JavaScript
6,933
star
3

OpenPrompt

An Open-Source Framework for Prompt-Learning.
Python
4,323
star
4

OpenNRE

An Open-Source Package for Neural Relation Extraction (NRE)
Python
4,322
star
5

PromptPapers

Must-read papers on prompt-based tuning for pre-trained language models.
4,059
star
6

OpenKE

An Open-Source Package for Knowledge Embedding (KE)
Python
3,813
star
7

PLMpapers

Must-read Papers on pre-trained language models.
3,161
star
8

NRLPapers

Must-read papers on network representation learning (NRL) / network embedding (NE)
TeX
2,524
star
9

UltraChat

Large-scale, Informative, and Diverse Multi-round Chat Data (and Models)
Python
2,225
star
10

THULAC-Python

An Efficient Lexical Analyzer for Chinese
Python
1,997
star
11

OpenNE

An Open-Source Package for Network Embedding (NE)
Python
1,683
star
12

KRLPapers

Must-read papers on knowledge representation learning (KRL) / knowledge embedding (KE)
TeX
1,532
star
13

TAADpapers

Must-read Papers on Textual Adversarial Attack and Defense
Python
1,505
star
14

ERNIE

Source code and dataset for ACL 2019 paper "ERNIE: Enhanced Language Representation with Informative Entities"
Python
1,408
star
15

KB2E

Knowledge Graph Embeddings including TransE, TransH, TransR and PTransE
C++
1,360
star
16

NREPapers

Must-read papers on neural relation extraction (NRE)
TeX
1,028
star
17

OpenDelta

A plug-and-play library for parameter-efficient-tuning (Delta Tuning)
Python
991
star
18

WebCPM

Official codes for ACL 2023 paper "WebCPM: Interactive Web Search for Chinese Long-form Question Answering"
HTML
977
star
19

OpenCLaP

Open Chinese Language Pre-trained Model Zoo
977
star
20

RCPapers

Must-read papers on Machine Reading Comprehension
890
star
21

ToolLearningPapers

865
star
22

NRE

Neural Relation Extraction, including CNN, PCNN, CNN+ATT, PCNN+ATT
C++
812
star
23

THULAC

An Efficient Lexical Analyzer for Chinese
C++
790
star
24

FewRel

A Large-Scale Few-Shot Relation Extraction Dataset
Python
727
star
25

THUOCL

THUOCL๏ผˆTHU Open Chinese Lexicon๏ผ‰ไธญๆ–‡่ฏๅบ“
697
star
26

Chinese_Rumor_Dataset

ไธญๆ–‡่ฐฃ่จ€ๆ•ฐๆฎ
693
star
27

OpenAttack

An Open-Source Package for Textual Adversarial Attack.
Python
682
star
28

DocRED

Dataset and codes for ACL 2019 DocRED: A Large-Scale Document-Level Relation Extraction Dataset.
Python
609
star
29

OpenHowNet

Core Data of HowNet and OpenHowNet Python API
Python
608
star
30

TensorFlow-TransX

An implementation of TransE and its extended models for Knowledge Representation Learning on TensorFlow
Python
514
star
31

LegalPapers

Must-read Papers on Legal Intelligence
465
star
32

CAIL

Chinese AI & Law Challenge
449
star
33

OpenMatch

An Open-Source Package for Information Retrieval.
Python
447
star
34

BERT-KPE

Python
443
star
35

Fast-TransX

An Efficient implementation of TransE and its extended models for Knowledge Representation Learning
C++
401
star
36

TensorFlow-Summarization

Python
390
star
37

Few-NERD

Code and data of ACL 2021 paper "Few-NERD: A Few-shot Named Entity Recognition Dataset"
Python
385
star
38

SOS4NLP

Survey of Surveys for Natural Language Processing (SOS4NLP)
327
star
39

THULAC-Java

An Efficient Lexical Analyzer for Chinese
Java
325
star
40

BMCourse

The repo for Tsinghua summer course: Interdisciplinary Seminar on Big Models
Python
321
star
41

InfLLM

The code of our paper "InfLLM: Unveiling the Intrinsic Capacity of LLMs for Understanding Extremely Long Sequences with Training-Free Memory"
Python
287
star
42

NSC

Neural Sentiment Classification
Python
286
star
43

LLaVA-UHD

LLaVA-UHD: an LMM Perceiving Any Aspect Ratio and High-Resolution Images
Python
276
star
44

DeltaPapers

Must-read Papers of Parameter-Efficient Tuning (Delta Tuning) Methods on Pre-trained Models.
273
star
45

Chinese_NRE

Source code for ACL 2019 paper "Chinese Relation Extraction with Multi-Grained Information and External Linguistic Knowledge"
Python
268
star
46

PL-Marker

Source code for "Packed Levitated Marker for Entity and Relation Extraction"
Python
255
star
47

LEGENT

Open Platform for Embodied Agents
Python
250
star
48

SE-WRL

Improved Word Representation Learning with Sememes
C
197
star
49

SCPapers

Must-read Papers on Sememe Computation
196
star
50

THUCTC

An Efficient Chinese Text Classifier
Java
196
star
51

KnowledgeablePromptTuning

kpt code
Python
192
star
52

CANE

Source code and datasets of "CANE: Context-Aware Network Embedding for Relation Modeling"
Python
191
star
53

JointNRE

Joint Neural Relation Extraction with Text and KGs
Python
187
star
54

HATT-Proto

Code and dataset of AAAI2019 paper Hybrid Attention-Based Prototypical Networks for Noisy Few-Shot Relation Classification
Python
185
star
55

LegalPLMs

Source code and checkpoints for legal pre-trained language models.
Python
169
star
56

NLP-THU

NLP Course Material & QA
168
star
57

KernelGAT

The source codes for Fine-grained Fact Verification with Kernel Graph Attention Network.
Python
161
star
58

PTR

Prompt Tuning with Rules
Python
155
star
59

EntityDuetNeuralRanking

Entity-Duet Neural Ranking Model
Python
153
star
60

OOP-THU

OOP Course Material & QA
149
star
61

OpenBackdoor

An open-source toolkit for textual backdoor attack and defense (NeurIPS 2022 D&B, Spotlight)
Python
148
star
62

Auto_CLIWC

Code for Chinese LIWC Lexicon Expansion via Hierarchical Classification of Word Embeddings with Sememe Attention (AAAI18)
Python
142
star
63

attribute_charge

The source code of our COLING'18 paper "Few-Shot Charge Prediction with Discriminative Legal Attributes".
Python
128
star
64

THUCKE

THU Chinese Keyphrase Extraction Toolkit
C++
118
star
65

CAIL2018

Python
112
star
66

Neural-Snowball

Code and dataset of AAAI2020 Paper Neural Snowball for Few-Shot Relation Learning
Python
112
star
67

KR-EAR

Knowledge Representation Learning with Entities, Attributes and Relations
C++
111
star
68

ChatEval

Codes for our paper "ChatEval: Towards Better LLM-based Evaluators through Multi-Agent Debate"
Python
109
star
69

MultiRD

Code and data of the AAAI-20 paper "Multi-channel Reverse Dictionary Model"
Python
106
star
70

TransNet

Source code and datasets of IJCAI2017 paper "TransNet: Translation-Based Network Representation Learning for Social Relation Extraction".
Jupyter Notebook
103
star
71

RE-Context-or-Names

Bert-based models(BERT, MTB, CP) for relation extraction.
Python
101
star
72

AGE

Source code and dataset for KDD 2020 paper "Adaptive Graph Encoder for Attributed Graph Embedding"
Python
99
star
73

TopJudge

Python
97
star
74

Prompt-Transferability

On Transferability of Prompt Tuning for Natural Language Processing
Python
97
star
75

GEAR

Source code for ACL 2019 paper "GEAR: Graph-based Evidence Aggregating and Reasoning for Fact Verification"
Python
95
star
76

HNRE

Hierarchical Neural Relation Extraction
Python
95
star
77

LEVEN

Source code and dataset for ACL2022 Findings Paper "LEVEN: A Large-Scale Chinese Legal Event Detection dataset"
Python
94
star
78

SememePSO-Attack

Code and data of the ACL 2020 paper "Word-level Textual Adversarial Attacking as Combinatorial Optimization"
Python
86
star
79

HMEAE

Source code for EMNLP-IJCNLP 2019 paper "HMEAE: Hierarchical Modular Event Argument Extraction".
Python
85
star
80

XQA

Dataset and baseline for ACL 2019 paper "XQA: A Cross-lingual Open-domain Question Answering Dataset"
Python
84
star
81

ERICA

Source code for ACL 2021 paper "ERICA: Improving Entity and Relation Understanding for Pre-trained Language Models via Contrastive Learning"
Python
83
star
82

CLAIM

78
star
83

TKRL

Representation Learning of Knowledge Graphs with Hierarchical Types (IJCAI-2016)
C++
76
star
84

TLNN

Source code for EMNLP-IJCNLP 2019 paper "Event Detection with Trigger-Aware Lattice Neural Network".
Python
75
star
85

NeuIRPapers

Must-read Papers on Neural Information Retrieval
72
star
86

MMDW

Max-margin DeepWalk
Java
71
star
87

KV-PLM

Source code for "A Deep-learning System Bridging Molecule Structure and Biomedical Text with Comprehension Comparable to Human Professionals"
Python
71
star
88

KNET

Neural Entity Typing with Knowledge Attention
Python
69
star
89

SelectiveMasking

Source code for "Train No Evil: Selective Masking for Task-Guided Pre-Training"
Python
68
star
90

MoEfication

Python
66
star
91

Adv-ED

Source code and dataset for NAACL 2019 paper "Adversarial Training for Weakly Supervised Event Detection".
Python
66
star
92

CorefBERT

Source code for EMNLP 2020 paper "Coreferential Reasoning Learning for Language Representation"
Python
65
star
93

ConversationQueryRewriter

Code and Data for SIGIR 2020 Paper "Few-Shot Generative Conversational Query Rewriting"
Roff
63
star
94

Ouroboros

Ouroboros: Speculative Decoding with Large Model Enhanced Drafting (EMNLP 2024 main)
Python
62
star
95

MuGNN

Source code for ACL2019 paper "Multi-Channel Graph Neural Network for Entity Alignment".
Python
61
star
96

sememe_prediction

Codes for Lexical Sememe Prediction via Word Embeddings and Matrix Factorization (IJCAI 2017).
Python
60
star
97

DIAG-NRE

Source code for ACL 2019 paper "DIAG-NRE: A Neural Pattern Diagnosis Framework for Distantly Supervised Neural Relation Extraction".
Python
59
star
98

topical_word_embeddings

Topical Word Embeddings
Python
57
star
99

QuoteR

Official code and data of the ACL 2022 paper "QuoteR: A Benchmark of Quote Recommendation for Writing"
Python
57
star
100

paragraph2vec

Paragraph Vector Implementation
Python
56
star