MCPcopy Index your code
hub / github.com/JinYuanLi0012/PGIM

github.com/JinYuanLi0012/PGIM @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
518 symbols 1,822 edges 100 files 268 documented · 52%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Prompting ChatGPT in MNER: Enhanced Multimodal Named Entity Recognition with Auxiliary Refined Knowledge

PWC PWC

Image

Here are code and dataset for our Findings of EMNLP 2023 paper: Prompting ChatGPT in MNER: Enhanced Multimodal Named Entity Recognition with Auxiliary Refined Knowledge

News🔥

  • 📆 [Aug. 2024] Twitter-SMNER dataset has been released.
  • 📆 [Jun. 2024] A new research has been released. We propose a new Segmented Multimodal Named Entity Recognition (SMNER) task and construct the corresponding Twitter-SMNER dataset. Code and Twitter-SMNER dataset coming soon~
  • 📆 [May. 2024] RiVEG (the sequel to PGIM about GMNER) has been accepted to ACL 2024 Findings.
  • 📆 [Oct. 2023] PGIM has been accepted to EMNLP 2023 Findings.

Dataset

To ease the code running, you can find our pre-processed datasets at here. And the predefined artificial samples are here.

Requirement

python == 3.7
torch == 1.13.1
transformers == 4.30.2
modelscope == 1.7.1

Usage

PGIM is based on AdaSeq, AdaSeq project is based on Python version >= 3.7 and PyTorch version >= 1.8.

Step 1: Installation

git clone https://github.com/modelscope/adaseq.git
cd adaseq
pip install -r requirements.txt -f https://modelscope.oss-cn-beijing.aliyuncs.com/releases/repo.html

Step 2: Copy PGIM folder into .../adaseq/examples/

-adaseq
---|examples
-----|PGIM
-------|twitter-15-txt.yaml
-------|twitter-17-txt.yaml

Step 3: Replace the original adaseq folder with our adaseq folder

-adaseq
---|.git
---|.github
---|adaseq   <-- (Use our adaseq replace it)  
---|docs
---|examples
---|scripts
---|tests
---|tools

Step 4: Training Model

-For Baseline:

    python -m scripts.train -c examples/PGIM/twitter-15.yaml
    python -m scripts.train -c examples/PGIM/twitter-17.yaml

-For PGIM:

    python -m scripts.train -c examples/PGIM/twitter-15-PGIM.yaml
    python -m scripts.train -c examples/PGIM/twitter-17-PGIM.yaml

Citation

If you find PGIM useful in your research, please consider citing:

@inproceedings{li2023prompting,
  title={Prompting ChatGPT in MNER: Enhanced Multimodal Named Entity Recognition with Auxiliary Refined Knowledge},
  author={Li, Jinyuan and Li, Han and Pan, Zhuo and Sun, Di and Wang, Jiahao and Zhang, Wenkun and Pan, Gang},
  booktitle={Findings of the Association for Computational Linguistics (EMNLP), 2023},
  year={2023}
}

@inproceedings{li2024llms,
  title={LLMs as Bridges: Reformulating Grounded Multimodal Named Entity Recognition},
  author={Li, Jinyuan and Li, Han and Sun, Di and Wang, Jiahao and Zhang, Wenkun and Wang, Zan and Pan, Gang},
  booktitle={Findings of the Association for Computational Linguistics (ACL), 2024},
  year={2024}
}

@article{li2024advancing,
  title={Advancing Grounded Multimodal Named Entity Recognition via LLM-Based Reformulation and Box-Based Segmentation},
  author={Li, Jinyuan and Li, Ziyan and Li, Han and Yu, Jianfei and Xia, Rui and Sun, Di and Pan, Gang},
  journal={arXiv preprint arXiv:2406.07268},
  year={2024}
}

Acknowledgement

Our code is built upon the open-sourced AdaSeq and MoRe, Thanks for their great work!

Core symbols most depended-on inside this repo

get_output_dim
called by 20
adaseq/modules/encoders/base.py
from_config
called by 16
adaseq/models/base.py
update
called by 14
adaseq/metrics/typing_metric.py
from_pretrained
called by 10
adaseq/models/base.py
add
called by 8
adaseq/metrics/typing_metric.py
dump
called by 8
adaseq/data/dataset_dumpers/base.py
get_tokens_mask
called by 7
adaseq/modules/util.py
to
called by 6
adaseq/data/batch.py

Shape

Method 357
Class 105
Function 56

Languages

Python100%

Modules by API surface

adaseq/modules/decoders/crf.py28 symbols
adaseq/models/multilabel_typing_model.py24 symbols
adaseq/metrics/typing_metric.py19 symbols
adaseq/modules/losses.py15 symbols
adaseq/metainfo.py15 symbols
adaseq/models/global_pointer_model.py13 symbols
adaseq/metrics/pretraining_metric.py13 symbols
adaseq/training/default_trainer.py12 symbols
adaseq/modules/decoders/pairwise_crf.py12 symbols
adaseq/models/twostage_ner_model.py12 symbols
adaseq/data/dataset_builders/relation_extraction_dataset_builder.py12 symbols
adaseq/data/dataset_builders/named_entity_recognition_dataset_builder.py12 symbols

For agents

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

⬇ download graph artifact