DeepGrail Total
This repository contains a Python implementation of a Neural Proof Net using TLGbank data.
This code was designed to work with the DeepGrail Tagger and DeepGrail Linker.
In this version the tagger is not retrained with the linker.
Usage
Installation
Python 3.9.10 (Warning don't use Python 3.10+) Clone the project locally.
Libraries installation
Run the init.sh script or install the Tagger project under SuperTagger name and the Linker project under Linker name.
Upload the tagger.pt in models. (You may need to modify 'model_tagger' in train.py.)
Dataset format
The sentences should be in a column "X", the links with '_x' postfix should be in a column "Y" and the categories in a column "Z". For the links each atom_x goes with the one and only other atom_x in the sentence.
Training
Launch train.py, if you look at it you can give another dataset file and another tagging model.
In train, if you use checkpoint=True
, the model is automatically saved in a folder: Training_XX-XX_XX-XX. It saves
after each epoch. Use tensorboard=True
for log in same folder. (tensorboard --logdir=logs
for see logs)
Predicting
For predict on your data you need to load a model (save with this code).
linker = neuralproofnet.linker
links = linker.predict_without_categories(["le chat est noir"])
print(links)
The file postprocessing.py
will allow you to draw the prediction. (limited sentence length otherwise it will be confusing)
You can also use the function predict_without_categories
which only needs the sentence.