🔷
Knowledge Graph Embedding | DSG IITR
  • Directions to use KGE | DSG
  • Upgrading from Vectors to Graphs: Knowledge Graph Embeddings and Graph-RAG.
  • Traditional Vector Embeddings
  • The Traditional Embeddings Problem
  • Knowledge Graph Generation
  • Knowledge Graph Embeddings
  • KGE & TVE RAG for LLMs
Powered by GitBook
On this page
  • Access the KGE-CLIP GitHub Repo Here! | DSG, IITR
  • Getting Started

Directions to use KGE | DSG

NextUpgrading from Vectors to Graphs: Knowledge Graph Embeddings and Graph-RAG.

Last updated 9 months ago

Access the KGE-CLIP GitHub Repo Here! | DSG, IITR

The usable apps are:

  1. Text-Knowledge Graph Generation.

  2. Image-Knowledge Graph Generation

  3. Text & Image Vector Embedding & Knowledge Graph Embedding with TensorBoard

The guide on using the Text-Based Knowledge Graph Visualization App! The app is built using Flask, Python libraries, and the REBEL model, it efficiently extracts knowledge from text and visualizes it as interactive graphs. Let's dive into how you can make the most of this tool.

Getting Started

Prerequisites

Before you begin, make sure your environment is ready:

  • Python 3.7 or higher

  • pip (Python package installer)

  • Graphviz for advanced graph visualization

Installation Steps

  1. Clone the Repository: Fork the project repository and clone it to your local machine:

git clone https://github.com/dsgiitr/kge-clip.git
cd your-repo-name
  1. Set Up a Virtual Environment: Activate a virtual environment to manage dependencies:

    • On Windows:

      python -m venv venv
      venv\Scripts\activate
    • On macOS/Linux:

      python3 -m venv venv
      source venv/bin/activate
  2. Install Dependencies: Install the required Python packages:

pip install flask transformers torch pandas networkx matplotlib plotly graphviz
  1. Install Graphviz: Ensure Graphviz is installed and added to your system path:

    • Windows: Download from the Graphviz website.

    • macOS/Linux: Use Homebrew or your package manager:

      brew install graphviz

Running the Flask App

Once installed, follow these steps to run the app:

  1. Activate Virtual Environment and set the Flask app environment variable:

    • On Windows:

      set FLASK_APP=app.py
    • On macOS/Linux:

      export FLASK_APP=app.py
  2. Start the Flask Server:

    flask run
  3. Access the App: Open http://127.0.0.1:5000/ in your browser to start using the app.

How to Use the App

  1. Input Text: Paste the text you want to analyze on the homepage.

  1. Generate the Knowledge Graph: Click "Generate Knowledge Graph" to process the text and generate visualizations.

  1. View the Results: Explore the generated knowledge graph on the result page.

How It Works

  • Text Processing: The app extracts triplets (subject-predicate-object) from the text using the REBEL model.

  • Graph Construction: These triplets are used to build a knowledge graph with NetworkX.

  • Visualization: The graph can be visualized in several ways:

    • Static Graph: Created with Matplotlib and NetworkX.

    • Interactive Graph: Built using Plotly, offering dynamic exploration.

    • Hierarchical Layout: Structured using Graphviz.

Troubleshooting Tips

Having trouble? Here are some quick fixes:

  1. Python Compatibility: Ensure you're using Python 3.7+.

  2. Virtual Environment: Verify your virtual environment is active.

  3. Graphviz Installation: Make sure Graphviz is installed correctly and added to your PATH.

  4. Memory Issues: For large texts, consider using a machine with more RAM.

Moving on in the Gitbook, the project is explained in detailed from Problems in Traditional Vector Embeddings to Knowledge Graph Embeddings and its use in RAG-LLMs.

💙
Page cover image
Flask Text-KG app
Enter the text to begin
Knowledge graph using Plotly