Skip to content

Commit 96740dc

Browse files
author
NavodSporoDev
committed
initial
0 parents  commit 96740dc

15 files changed

Lines changed: 931 additions & 0 deletions

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
venv
2+
build
3+
dist
4+
*.egg-info
5+
.env
6+
7+
*.swp
8+
*.swo
9+
10+
# By default do not include these files for version control
11+
# Override this by using 'git add -f'
12+
*.wav
13+
*.mp3

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Navod Peiris
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<p align="center">
2+
<img src="graphsense.png" />
3+
</p>
4+
5+
<p align="center">
6+
<a href="./LICENSE"><img src="https://img.shields.io/github/license/NavodPeiris/graphsense"></a>
7+
<a href="https://github.com/NavodPeiris/graphsense/releases"><img src="https://img.shields.io/github/v/release/NavodPeiris/graphsense?color=ffa"></a>
8+
<a href="support os"><img src="https://img.shields.io/badge/os-linux%2C%20win%2C%20mac-pink.svg"></a>
9+
<a href=""><img src="https://img.shields.io/badge/python-3.8+-aff.svg"></a>
10+
<a href="https://github.com/NavodPeiris/graphsense/issues"><img src="https://img.shields.io/github/issues/NavodPeiris/graphsense?color=9cc"></a>
11+
<a href="https://github.com/NavodPeiris/graphsense/stargazers"><img src="https://img.shields.io/github/stars/NavodPeiris/graphsense?color=ccf"></a>
12+
<a href="https://pypi.org/project/graphsense/"><img src="https://static.pepy.tech/badge/graphsense"></a>
13+
14+
</p>
15+
16+
17+
### Requirements
18+
19+
* Python 3.8 or greater
20+
21+
22+
### installation:
23+
```
24+
pip install graphsense
25+
```
26+
27+
28+
### Training example:
29+
30+
```
31+
from graphsense import GraphSense
32+
33+
g = GraphSense()
34+
35+
g.line_completion(input_path="code_files", output_path="output")
36+
37+
```
38+
39+
### Inference example:
40+
41+
```
42+
from graphsense import GraphSense
43+
44+
g = GraphSense()
45+
46+
g.load_model("output/graph_embeddings.model")
47+
next = g.infer("def factorial(n):")
48+
49+
print("next item predicted: ", next)
50+
```
51+
52+
### Performance Comparison with gpt2_medium finetuned model
53+
Dataset used to train models: https://github.com/TheAlgorithms/Python
54+
#### gpt2_medium finetuned model
55+
```
56+
input: def factorial(n)
57+
output: return 1 if n == 1 else n * factorial(n - 1)
58+
model size: 1.44GB
59+
avg inference time: 10.3302 seconds
60+
CPU Usage: 8.3%
61+
Memory Usage: 68.54 MB
62+
```
63+
64+
#### graph embedding model
65+
```
66+
input: def factorial(n)
67+
output: return 1 if n == 1 else n * factorial(n - 1)
68+
model size: 13.2MB
69+
avg inference time: 2.1870 seconds
70+
CPU Usage: 0.2%
71+
Memory Usage: 4.54 MB
72+
```

0 commit comments

Comments
 (0)