Coder Social home page Coder Social logo

hhy-huang / graphvisionllm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from minnesotanlp/graphllm

0.0 0.0 0.0 158.82 MB

Code for Das et al.'s paper "Which Modality should I use -- Text, Motif, or Image? : Understanding Graphs with Large Language Models"

Home Page: https://minnesotanlp.github.io/GraphLLM/

JavaScript 12.99% Python 38.59% CSS 0.35% HTML 3.41% Jupyter Notebook 44.66%

graphvisionllm's Introduction

Which Modality should I use -- Text, Motif, or Image? : Understanding Graphs with Large Language Models

This repository provides code of the following paper:

Which Modality should I use -- Text, Motif, or Image? : Understanding Graphs with Large Language Models
Debarati Das, Ishaan Gupta, Jaideep Srivasta, Dongyeop Kang

Environment Setup

conda create --name graphllm python==3.10.12
conda activate graphllm
pip install torch
pip install openai
pip install torch_geometric
pip install pyg_lib torch_scatter torch_sparse torch_cluster torch_spline_conv -f https://data.pyg.org/whl/torch-2.0.0+cu117.html
pip install numpy pandas matplotlib seaborn scipy

Generating Graph samples and associated information

  1. Sample the appropriate datasets with the graph sampling method, chooses N graphs and writes out the groundtruth, node with question mark, associated edgelist and y labels. These are used to generate the text and motif modality.
code/generate_graph_edgelist_ylabel.py 
  1. Read the edgelists, and y labels from the previous step and generate the graph images. These are used to generate the image modality.
code/generate_graph_images.py (old)
code/graphviz_image_generation.py (new)

Graph Modality Prompting Scripts

Each script is run through the appropriate config.json file (present in config/ and associated python file). Running every script will produce a csv which calculates the avg and std of metrics across all runs, for all settings. We also log the specific prompts, responses and other associated outputs for each graph.

  1. Text Encoder
code/run_prompting_text_encoder.py
Associated config - config/config_textencoder.json

  1. Image Encoder
code/run_prompting_image_encoder.py
Associated config - config/config_image_encoder.json

  1. Motif Encoder
code/run_prompting_motif_encoder.py
Associated config - config/config_motif_encoder.json

  1. Extending multiple modalities (combining 2 or more together)
code/run_prompting_textmotif_encoder.py
code/run_prompting_textimage_encoder.py
code/run_prompting_motifimage_encoder.py
code/run_prompting_allmodalities_encoder.py
  1. Specific Modality experiments (depth first experiments)
code/all_text_modality_variations.py
code/all_motif_modality_variations.py
code/all_image_modality_variations.py
  1. Some additional experiments :
  • Experiments with few-shot and few-shot + rationale
code/run_few_shot_prompting.py
  • Majority voting baseline (predict node based on the majority of immediate neighbor labels)
code/majority_voting_baseline.py

Citation

If you find this work useful for your research, please cite our paper:

@misc{das2023modality,
      title={Which Modality should I use -- Text, Motif, or Image? : Understanding Graphs with Large Language Models}, 
      author={Debarati Das and Ishaan Gupta and Jaideep Srivastava and Dongyeop Kang},
      year={2023},
      eprint={2311.09862},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

graphvisionllm's People

Contributors

debaratidas94 avatar ishaang-1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.