• Stars
    star
    111
  • Rank 305,256 (Top 7 %)
  • Language
    Python
  • License
    MIT License
  • Created about 6 years ago
  • Updated almost 6 years ago

Reviews

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

Repository Details

CAIL2018

该项目为 CAIL2018 的代码和模型提交说明。

数据集论文

数据集论文 CAIL2018: A Large-Scale Legal Dataset for Judgment Prediction 已公布。

选手交流群

QQ群:237633234

提交的文件格式及组织形式

你可以在 python_sample 中找到最简单的提交代码的格式。你需要将你所有的代码压缩为一个 zip 文件进行提交,该 zip 文件内部形式可以参看 python_smaple/predictor.zip。该 zip 文件内部顶层应该只包含一个叫做 predictor 的文件夹,在该文件夹下需要有你的所有代码、模型及其他相关的东西。

在压缩包内的 predictor 文件夹内,你需要保证 __init__.pypredictor.py 这两个文件一定存在。这两个文件的内容我们将在下文提及。

我们在 python_sample 的文件夹中提供了 main.py,该代码的逻辑与我们实际运行时的代码逻辑相同,你只需要在 python_example 的文件夹下运行 main.py 即可测试你的代码。如有需要,请自行修改该代码。

代码的内容

你需要保证 __init__.py 在文件夹 predictor 内存在并且内容为:

from .predictor import Predictor

你需要保证 predictor.py 在文件夹 predictor 内存在,并且其中实现了 Predictor 这个类。Predictor 类需要实现如下几个函数:

  • __init__:你需要在该函数类中完成你模型的各种初始化,并且为该类声明变量 batch_size,该变量代表评测器每次需要给你多少个数据同时进行预测。batch_size 需要是一个大于等于 $1$ 的整数,如果该参数对你来说没有意义,请直接使用 self.batch_size=1 将该变量设为 $1$
  • predict(content):在该函数内你需要实现自动判决的预测。参数 content 为一个长度不超过 batch_size 的数组,其中每个元素为一个字符串,对应下载的数据中的事实即 fact 字段,你需要对每一个数组中的元素进行预测,并返回预测的结果 resultresult的类型应该为数组,且其元素个数应与 content 的元素个数相同,并且 result 中预测的结果顺序应与 content 中的事实顺序相同。对于每个预测结果,其类型应为 dict 类型,且包含以下字段:
    • accusation:该字段的类型为一个数组,数组中包含若干个整数,代表预测相关罪名的结果。如 $[1,2,3]$ 表示和第 $1,2,3$ 条罪名都相关,罪名的编号与下发的 accu.txt 中的顺序一致,从 $1$ 开始编号。
    • articles:该字段的类型为一个数组,数组中包含若干个整数,代表预测相关法条的结果。如 $[1,2,3]$ 表示和第 $1,2,3$ 条法条都相关,法条的编号与下发的 law.txt 中的顺序一致,从 $1$ 开始编号。注意这里的数字并不是代表你预测的结果为法条的第几条,你预测的结果为 $1$ 代表的是 law.txt 中的第一条法条。
    • imprisonment:该字段类型为一个整数,代表预测的刑期,单位为月。如果预测结果为无期徒刑,请将该字段的值设为 $-1$;如果预测结果为死刑,请将该字段的值设为 $-2$

以上为 predictor.py 中你需要实现的内容,你可以利用 python_example/predictor 下的文件进行进一步参考。请注意,代码运行的目录并不是在predictor目录下,而是在predictor的上一级目录,所以请在加载模型的时候尽量使用关于predictor.py的相对路径。

其他语言的支持

如上文所述,我们现阶段只支持 python 语言的提交,但是这并不代表你不能够使用其他语言进行预测。我们在 c++_sample/predictor 下提供了一种可能的 c++ 的实现方法。我们现在仍然需要实现上文所述的 predictor.py 的各种接口,但是我们在预测的时候利用 os.system 调用系统命令运行你编译好的可执行文件,或者其他运行你代码的命令。如果你担心可执行文件没有权限,可以像给出的例子在初始化的过程中加上权限。

评测脚本

我们在 judger 文件夹中提供了一个 Judger 的类可以帮助你计算你三个任务的得分,你可以参考该代码实现你自己的Judger。该Judger所使用的读入格式仅用于我们的评测,如果你需要使用该代码,请根据你的需求自行进行修改。

现有python3.5系统环境

Package             Version               
------------------- ----------------------
absl-py             0.2.0                 
astor               0.6.2                 
bleach              1.5.0                 
boto                2.48.0                
boto3               1.7.19                
botocore            1.10.19               
bz2file             0.98                  
certifi             2018.4.16             
chardet             3.0.4                 
cycler              0.10.0                
Cython              0.28.2                
docutils            0.14                  
fasttext            0.8.3                 
future              0.16.0                
gast                0.2.0                 
gensim              3.4.0                 
grpcio              1.11.0                
h5py                2.7.1                 
html5lib            0.9999999             
idna                2.6                   
jieba               0.39                  
jmespath            0.9.3                 
JPype1              0.6.3                 
Keras               2.1.6                 
kiwisolver          1.0.1                 
lightgbm            2.1.1                 
Mako                1.0.7                 
Markdown            2.6.11                
MarkupSafe          1.0                   
matplotlib          2.2.2                 
numpy               1.14.3                
pandas              0.22.0                
Pillow              5.1.0                 
pip                 10.0.1                
protobuf            3.5.2.post1           
pycurl              7.43.0                
pygobject           3.20.0                
pygpu               0.7.6                 
pyhanlp             0.1.41                
pyltp               0.2.1                 
pyparsing           2.2.0                 
python-apt          1.1.0b1+ubuntu0.16.4.1        
pytz                2018.4                
PyYAML              3.12                  
requests            2.18.4                
s3transfer          0.1.13                
scikit-learn        0.19.1                
scikit-multilearn   0.0.5                 
scipy               1.1.0                 
seq2seq             0.1.5                 
setuptools          39.0.1                
six                 1.11.0                
sklearn             0.0                   
smart-open          1.5.7                 
tensorboard         1.7.0                 
tensorflow-gpu      1.7.0                 
termcolor           1.1.0                 
tflearn             0.3.2                 
Theano              1.0.1                 
thulac              0.1.2                 
torch               0.3.1                 
torchtext           0.2.3                 
torchvision         0.2.0                 
tqdm                4.23.3                
unattended-upgrades 0.1                   
urllib3             1.22                  
Werkzeug            0.14.1                
wheel               0.31.0                
xgboost             0.71

等待补全中

如果你有需要的环境,请联系比赛管理员进行安装。

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

OpenNRE

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

OpenPrompt

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

PromptPapers

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

OpenKE

An Open-Source Package for Knowledge Embedding (KE)
Python
3,725
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,520
star
9

UltraChat

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

THULAC-Python

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

OpenNE

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

KRLPapers

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

TAADpapers

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

ERNIE

Source code and dataset for ACL 2019 paper "ERNIE: Enhanced Language Representation with Informative Entities"
Python
1,403
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,023
star
17

OpenCLaP

Open Chinese Language Pre-trained Model Zoo
971
star
18

WebCPM

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

OpenDelta

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

RCPapers

Must-read papers on Machine Reading Comprehension
890
star
21

NRE

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

ToolLearningPapers

777
star
23

THULAC

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

FewRel

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

THUOCL

THUOCL(THU Open Chinese Lexicon)中文词库
697
star
26

Chinese_Rumor_Dataset

中文谣言数据
672
star
27

OpenAttack

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

DocRED

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

OpenHowNet

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

TensorFlow-TransX

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

LegalPapers

Must-read Papers on Legal Intelligence
450
star
32

OpenMatch

An Open-Source Package for Information Retrieval.
Python
444
star
33

CAIL

Chinese AI & Law Challenge
439
star
34

BERT-KPE

Python
437
star
35

Fast-TransX

An Efficient implementation of TransE and its extended models for Knowledge Representation Learning
C++
396
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
376
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

NSC

Neural Sentiment Classification
Python
287
star
41

BMCourse

The repo for Tsinghua summer course: Interdisciplinary Seminar on Big Models
Python
269
star
42

Chinese_NRE

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

DeltaPapers

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

PL-Marker

Source code for "Packed Levitated Marker for Entity and Relation Extraction"
Python
252
star
45

SE-WRL

Improved Word Representation Learning with Sememes
C
197
star
46

THUCTC

An Efficient Chinese Text Classifier
Java
196
star
47

InfLLM

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

SCPapers

Must-read Papers on Sememe Computation
193
star
49

KnowledgeablePromptTuning

kpt code
Python
192
star
50

CANE

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

JointNRE

Joint Neural Relation Extraction with Text and KGs
Python
185
star
52

HATT-Proto

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

LLaVA-UHD

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

NLP-THU

NLP Course Material & QA
164
star
55

KernelGAT

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

LegalPLMs

Source code and checkpoints for legal pre-trained language models.
Python
158
star
57

EntityDuetNeuralRanking

Entity-Duet Neural Ranking Model
Python
153
star
58

PTR

Prompt Tuning with Rules
Python
151
star
59

OOP-THU

OOP Course Material & QA
149
star
60

Auto_CLIWC

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

OpenBackdoor

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

attribute_charge

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

ConceptFlow

Python
119
star
64

THUCKE

THU Chinese Keyphrase Extraction Toolkit
C++
118
star
65

KR-EAR

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

Neural-Snowball

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

ChatEval

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

MultiRD

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

TransNet

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

RE-Context-or-Names

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

AGE

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

GEAR

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

HNRE

Hierarchical Neural Relation Extraction
Python
95
star
74

LEVEN

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

TopJudge

Python
93
star
76

Prompt-Transferability

On Transferability of Prompt Tuning for Natural Language Processing
Python
85
star
77

SememePSO-Attack

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

XQA

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

HMEAE

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

ERICA

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

CLAIM

77
star
82

TKRL

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

TLNN

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

MMDW

Max-margin DeepWalk
Java
71
star
85

KV-PLM

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

KNET

Neural Entity Typing with Knowledge Attention
Python
69
star
87

SelectiveMasking

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

NeuIRPapers

Must-read Papers on Neural Information Retrieval
68
star
89

MoEfication

Python
66
star
90

Adv-ED

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

CorefBERT

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

ConversationQueryRewriter

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

MuGNN

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

sememe_prediction

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

DIAG-NRE

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

topical_word_embeddings

Topical Word Embeddings
Python
57
star
97

QuoteR

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

paragraph2vec

Paragraph Vector Implementation
Python
56
star
99

DKRL

Representation Learning of Knowledge Graphs with Entity Descriptions (AAAI-2016)
C++
54
star
100

Ouroboros

Ouroboros: Speculative Decoding with Large Model Enhanced Drafting
Python
51
star