GraphSense is a powerful library enabling the training and inference of graph embedding-based code suggestion models with minimal preprocessing. Utilizing Node2Vec and optimized for performance, this framework supports seamless integration for code completion tasks, making it a go-to tool for developers looking to enhance their coding efficiency.
GraphSense is a powerful library designed to facilitate the training and inference of code suggestion models based on graph embeddings. By leveraging the Node2Vec algorithm, GraphSense minimizes the need for extensive data preprocessing while delivering efficient resource consumption. It seamlessly integrates FAISS for vector indexing and uses RocksDB to manage mappings between code lines and their corresponding indices.
Training a model with GraphSense is straightforward. Below is a simple example:
from graphsense import GraphTrain
g = GraphTrain()
# train the model
g.line_completion(directory_path="code_files", language="Python")
To generate code suggestions, the inference process is also easy to implement:
from graphsense import GraphInfer
g = GraphInfer()
g.load_artifacts() # load the artifacts to memory
suggestions = g.infer("def factorial(n):")
g.unload_artifacts() # clean memory
print("top 10 suggestions: ", suggestions)
GraphSense demonstrates impressive performance metrics compared to traditional models like the fine-tuned gpt2-medium:
GraphSense achieves high accuracy, with a top-10 accuracy of 89.58% when trained on the TheAlgorithms Python dataset.
GraphSense displays exceptional scalability, as reflected in the average memory usage and execution time across varying vocabulary sizes:
GraphSense empowers developers and data scientists to enhance code completion systems effectively, combining efficiency, performance, and scalability.
No comments yet.
Sign in to be the first to comment.