Skip to main content

graphsense is a library to train and infer graph embedding based code completion models

Project description

Requirements

  • Python 3.8 or greater

installation:

pip install graphsense

Training example:

from graphsense import GraphSense

g = GraphSense()

g.line_completion(input_path="code_files", output_path="output")

Inference example:

from graphsense import GraphSense

g = GraphSense()

g.load_model("output/graph_embeddings.model")
next = g.infer("def factorial(n):")

print("next item predicted: ", next)

Performance Comparison with gpt2_medium finetuned model

Dataset used to train models: https://github.com/TheAlgorithms/Python

gpt2_medium finetuned model

input: def factorial(n)  
output: return 1 if n == 1 else n * factorial(n - 1)   
model size: 1.44GB   
avg inference time: 10.3302 seconds  
CPU Usage: 8.3%  
Memory Usage: 68.54 MB  

graph embedding model

input: def factorial(n)  
output: return 1 if n == 1 else n * factorial(n - 1)   
model size: 13.2MB
avg inference time: 2.1870 seconds  
CPU Usage: 0.2%
Memory Usage: 4.54 MB  

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphsense-0.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphsense-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file graphsense-0.0.1.tar.gz.

File metadata

  • Download URL: graphsense-0.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.8

File hashes

Hashes for graphsense-0.0.1.tar.gz
Algorithm Hash digest
SHA256 85c01066106056c7a7b0aca35451cf356d1bb567e9ad71c36b61861c9f332d55
MD5 d8582da1ede3faa948284fc5d9b5a423
BLAKE2b-256 e7f775c8519cd3bc2baff5260e9403200ce263291717eadd6d2a6a43706cac01

See more details on using hashes here.

File details

Details for the file graphsense-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: graphsense-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.8

File hashes

Hashes for graphsense-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f18490406593b6ce6a65119d36eddbbbcf17f37aec2627cfcbdb1e96b2ec626d
MD5 622f3398f2675ba97b8b014913049886
BLAKE2b-256 108dd5b87b3264d0c53338aa9afd15b5a6678e92304ea0a35a8ad23cf0237a27

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page