MCPcopy Index your code
hub / github.com/RowitZou/DC-Match

github.com/RowitZou/DC-Match @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
23 symbols 96 edges 9 files 2 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

DC-Match

Pytorch implementation of the ACL-2022 (findings) paper: Divide and Conquer: Text Semantic Matching with Disentangled Keywords and Intents.

Environments

  • Python 3.9.7

  • pytorch 1.10.2

  • transformers 4.17.0

  • datasets 2.0.0

  • RTX 3090 GPU & Titan RTX

  • CUDA 11.4

Data

All the processed datastes used in our work are available at Google Drive or Baidu Pan (extract code: w2op), including QQP, MRPC, and Medical-SM.

Usage

  • Download raw datasets from the above data links and put them into the directory raw_data like this:

    --- raw_data | |--- medical | |--- mrpc | |--- qqp

  • We have tried various pre-trained models. The following models work fine with our code:

    • model names for QQP and MRPC:

      • roberta-base
      • roberta-large
      • bert-base-uncased
      • bert-large-uncased
      • albert-base-v2
      • albert-large-v2
      • microsoft/deberta-large
      • microsoft/deberta-base
      • funnel-transformer/medium
    • model names for Medical:

      • hfl/chinese-macbert-base
      • hfl/chinese-macbert-large
      • hfl/chinese-roberta-wwm-ext
      • hfl/chinese-roberta-wwm-ext-large
  • Pre-process datasets.

    PYTHONPATH=. python ./src/preprocess.py -raw_path raw_data/mrpc PYTHONPATH=. python ./src/preprocess.py -raw_path raw_data/qqp PYTHONPATH=. python ./src/preprocess.py -raw_path raw_data/medical

  • Training and Evaluation (Baseline)

    • MRPC PYTHONPATH=. python -u src/main.py \ -baseline \ -task mrpc \ -model roberta-large \ -num_labels 2 \ -batch_size 16 \ -accum_count 1 \ -test_batch_size 128 \ >> logs/mrpc.roberta_large.baseline.log

    • QQP PYTHONPATH=. python -u src/main.py \ -baseline \ -task qqp \ -model roberta-large \ -num_labels 2 \ -batch_size 16 \ -accum_count 4 \ -test_batch_size 128 \ >> logs/qqp.roberta_large.baseline.log

    • Medical PYTHONPATH=. python -u src/main.py \ -baseline \ -task medical \ -model hfl/chinese-roberta-wwm-ext-large \ -num_labels 3 \ -batch_size 16 \ -accum_count 4 \ -test_batch_size 128 \ >> logs/medical.roberta_large.baseline.log

  • Training and Evaluation (DC-Match)

    • MRPC PYTHONPATH=. python -u src/main.py \ -task mrpc \ -model roberta-large \ -num_labels 2 \ -batch_size 16 \ -accum_count 1 \ -test_batch_size 128 \ >> logs/mrpc.roberta_large.log

    • QQP PYTHONPATH=. python -u src/main.py \ -task qqp \ -model roberta-large \ -num_labels 2 \ -batch_size 16 \ -accum_count 4 \ -test_batch_size 128 \ >> logs/qqp.roberta_large.log

    • Medical PYTHONPATH=. python -u src/main.py \ -task medical \ -model hfl/chinese-roberta-wwm-ext-large \ -num_labels 3 \ -batch_size 16 \ -accum_count 4 \ -test_batch_size 128 \ >> logs/medical.roberta_large.log

Citation

@article{zou2022divide,
         title={Divide and Conquer: Text Semantic Matching with Disentangled Keywords and Intents},
         author={Zou, Yicheng and Liu, Hongwei and Gui, Tao and Wang, Junzhe and Zhang, Qi and Tang, Meng and Li, Haixiang and Wang, Daniel},
         journal={arXiv preprint arXiv:2203.02898},
         year={2022}
}

Core symbols most depended-on inside this repo

_pad
called by 4
src/others/data_collator.py
handle_special_token
called by 2
src/prepro/json_to_data.py
train
called by 1
src/train.py
init_logger
called by 1
src/others/logging.py
apply
called by 1
src/models/sm_model.py
str2bool
called by 0
src/preprocess.py
str2bool
called by 0
src/main.py
compute_metrics_f1
called by 0
src/others/metrics.py

Shape

Method 13
Function 6
Class 4

Languages

Python100%

Modules by API surface

src/prepro/json_to_data.py5 symbols
src/models/sm_model.py5 symbols
src/others/metrics.py4 symbols
src/others/data_collator.py4 symbols
src/train.py1 symbols
src/test.py1 symbols
src/preprocess.py1 symbols
src/others/logging.py1 symbols
src/main.py1 symbols

For agents

$ claude mcp add DC-Match \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact