Skip to main content

SynNLI

Description

  • this repo uses allennlp as base repo

AllenNlp

  • a quick guide of mine can be found at the same folder
  • for insight, please visit allennlp document and github

Custom Classes and Operations

  • GraphPair2VecEncoder
    • 'gen', 'gmn'
  • Graph2GraphEncoder
    • known as graph convolution layer in pytorch_geometric
  • GraphPair2GraphPairEncoder
    • for graph matching in sparse batch
    • tf.dynamic_partition + normal attention
  • NodeUpdater
    • A wrapper over RNNs
  • Graph2VecEncoder
    • known as global pooling layer in pytorch_geometric
    • 'global_attention'
  • SynNLIModel(base=Model)
    • use Embedder to embed input
    • use GraphPair2VecEncoder to get compare vector for classifier to make final decision
  • tensor_op.py
    • batch conversion between normal model and graph model
      • sparse2dense
      • dense2sparse
  • SparseAdjacencyField
    • cooperate with pytorch_geometric to get sparce graph batch
    • see batch_tensors() and as_tensor() for the key of implementation
  • NLIGraphReader
    • read graph input (parsed by Stanza)
  • preprocess.py
    • see the Preprocess section for detail
  • configs
    • can be found in src/training
    • for allennlp train

Usage (Cur)

  • ./install_dependencies.sh
  • download NLI style data set to data
    • and specify path in jsonne
  • parse data (see Parse Data section)
    • and specify path in jsonnet
  • train model (see Training Area)
    • with jsonnet

Parse Data with Stanza

  • Stanza will be loaded in preprocess.py
    • the parser version is the one @ 2020/8/22
  • use preprocess.py
python preprocess.py -i <raw_data_path> \
 -o <target_path> \
 --files <file_names> \
 --force(if activated, force execution when <target_path exists>) \
 -m 10(if provided, maximum instances to process is set, this is mainly for testing)
# example
python preprocess.py -i ../data/anli_v1.0/R2/ \
 -o ../data/anli_v1.0_preprocessed/R2/ \
 --files dev.jsonl test.jsonl train.jsonl \
 --force \
 -m 10
  • if want to use allennlp (less recommended)
    • download allennlp dependency parser and SRL labeler from path

Training

  • refer to "the config.jsonnet"
allennlp train "./src_gmn/training_config.jsonnet" -s "./param/testv1"   --include-package "package_v1" --force

Future Supported Usage

  • pip install -r requirements
    • add configs folder for various config
  • note that should take lemmatized as node attr if use word level embedding(or + char embedding to ease)
  • root to spetial token
  • use MLP prjection

Metadata

Release files for syn-nli 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for syn-nli 0.0.4
File Size Uploaded
syn_nli-0.0.4.tar.gz 42.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for syn-nli 0.0.4
File Interpreter ABI Platform
syn_nli-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 108.7 kB

Release files / syn_nli-0.0.4.tar.gz

Download URL syn_nli-0.0.4.tar.gz
Size 42.2 kB
Tags Source
SHA-256 checksum
How to use checksums
2706b84eb84b31ebce5d4058a2a62becb522a04932942a38c29ea8abce10fb83
BLAKE2b-256 checksum
How to use checksums
29cba39f99ade1f15786321fd8584c46687e24292ed1eff089a0a66bb41bf408
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release files / syn_nli-0.0.4-py3-none-any.whl

Download URL syn_nli-0.0.4-py3-none-any.whl
Size 66.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4fd1f9aa54c82f5e14a257634b100d9eee7608f3f785879da14be22b5504c69
BLAKE2b-256 checksum
How to use checksums
cfc6ceda3e4cd6f6dbf5686f7427c41ad8281a19974d2b81df1bb2ccd3f4793b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page