Trained on the
JLB-JLB/android-ransomware-fcg-baseline
dataset (715 APKs: 502 benign, 213 ransomware).
README.md # This model card
model.py # Model class definitions with PyTorchModelHubMixin
GIN/
internal_only/
model.safetensors # Trained weights
config.json # Model __init__ kwargs (auto-saved by mixin)
test_results.json # Full test metrics
training_log.json # Per-epoch training history
full_fcg/
...
GCN/
internal_only/
...
full_fcg/
...
GAT/
internal_only/
...
full_fcg/
...
1 # Get the model class definition
2 from huggingface_hub import hf_hub_download
3 import importlib . util
4
5 mod_path = hf_hub_download ( "JLB-JLB/android-ransomware-gnn-baseline" , "model.py" )
6 spec = importlib . util . spec_from_file_location ( "model" , mod_path )
7 model_module = importlib . util . module_from_spec ( spec )
8 spec . loader . exec_module ( model_module )
9
10 # Download model weights to a local directory, then load
11 import tempfile
12 from pathlib import Path
13
14 with tempfile . TemporaryDirectory ( ) as tmpdir :
15 for fname in [ "config.json" , "model.safetensors" ] :
16 hf_hub_download (
17 "JLB-JLB/android-ransomware-gnn-baseline" , fname ,
18 subfolder = "GIN/internal_only" ,
19 local_dir = tmpdir ,
20 )
21 model = model_module . GINClassifier . from_pretrained (
22 str ( Path ( tmpdir ) / "GIN" / "internal_only" )
23 )
24 model . eval ( )
25
26 # Download and load dataset
27 import torch
28 ds_path = hf_hub_download (
29 "JLB-JLB/android-ransomware-fcg-baseline" , "internal_only/fcg_dataset.pt" , repo_type = "dataset"
30 )
31 dataset = torch . load ( ds_path , weights_only = False )
32
33 # Run inference
34 from torch_geometric . loader import DataLoader
35 batch = next ( iter ( DataLoader ( [ dataset [ 0 ] ] , batch_size = 1 ) ) )
36 with torch . no_grad ( ) :
37 pred = model ( batch . x , batch . edge_index , batch . batch ) . argmax ( 1 ) . item ( )
38 print ( f"Prediction: { 'benign' if pred == 0 else 'malware' } " )
torch>=2.0
torch-geometric>=2.4
If you use this model, please cite the associated thesis work.