knowgl large

ibm

Introduction

The KnowGL-Large model, developed by IBM, is designed for text-to-text generation, specifically focusing on relation extraction, triple generation, and entity linking. It utilizes a seq2seq architecture and is implemented using PyTorch and Safetensors. The model is trained on an extended version of the Babelscape REBEL dataset and achieves state-of-the-art performance in generating knowledge graphs from text.

Architecture

KnowGL-Large is built on a seq2seq architecture, utilizing transformers to process input sentences and output knowledge triples. The model generates triples in the format:
[(subject mention # subject label # subject type) | relation label | (object mention # object label # object type)].
Multiple triples are separated by a $ symbol. The generated labels and types can be mapped to corresponding Wikidata IDs.

Training

The model is trained by integrating data from Wikidata with the Babelscape REBEL dataset. It has been optimized to achieve high performance in relation extraction tasks, as demonstrated in the REBEL dataset evaluation. The model's training and evaluation results are detailed in studies by Rossiello et al. (AAAI 2023) and Mihindukulasooriya et al. (ISWC 2022).

Guide: Running Locally

  1. Install Dependencies:
    Ensure you have Python and PyTorch installed. Use pip to install necessary libraries:

    pip install transformers safetensors
    
  2. Download the Model:
    Access the model from the Hugging Face model hub:

    from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
    
    tokenizer = AutoTokenizer.from_pretrained("ibm/knowgl-large")
    model = AutoModelForSeq2SeqLM.from_pretrained("ibm/knowgl-large")
    
  3. Run Inference:
    Prepare your input text and generate predictions:

    input_text = "Your input text here"
    inputs = tokenizer(input_text, return_tensors="pt")
    outputs = model.generate(**inputs)
    print(tokenizer.decode(outputs[0]))
    
  4. Cloud GPUs:
    For efficient performance, particularly with large datasets, consider using cloud GPUs from providers like AWS, Google Cloud, or Azure.

License

KnowGL-Large is released under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (cc-by-nc-sa-4.0), allowing for sharing and adaptation under similar terms, with a non-commercial restriction.

More Related APIs in Text2text Generation