-
Notifications
You must be signed in to change notification settings - Fork 50
/
__init__.py
126 lines (112 loc) · 3.56 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
from binaryninja import PluginCommand
from binaryninja.settings import Settings
from .reverser_ai.binary_ninja import (
plugin_wrapper_context_enriched_function_naming_bg,
plugin_wrapper_rename_all_functions_bg,
plugin_wrapper_rename_function_bg,
)
'''
Plugin Commands
'''
PluginCommand.register_for_function(
"ReverserAI\\Rename Current Function",
"Renames the selected function with an AI-generated suggestion.",
plugin_wrapper_rename_function_bg
)
PluginCommand.register(
"ReverserAI\\Rename All Functions",
"Renames all functions using AI-generated suggestions.",
plugin_wrapper_rename_all_functions_bg
)
PluginCommand.register(
"ReverserAI\\Enhance Function Naming with Context",
"Enhances function names using context-aware AI-generated suggestions for better accuracy and relevance.",
plugin_wrapper_context_enriched_function_naming_bg
)
'''
Plugin Settings
'''
Settings().register_group(
"reverser_ai",
"ReverserAI"
)
Settings().register_setting(
"reverser_ai.use_mmap",
'''
{
"description" : "Optimize performance by using memory mapping, which loads parts of the model on-demand instead of the entire model into memory. This can reduce memory usage and improve loading times (requires ~5GB RAM for the default model).",
"title" : "Use Memory Mapping",
"default" : true,
"type" : "boolean",
"requiresRestart": true
}
'''
)
Settings().register_setting(
"reverser_ai.n_threads",
'''
{
"description" : "Utilize CPU threads; set to 0 to disable CPU. For full CPU load, set to maximum number of available threads.",
"title" : "Number of CPU Threads",
"default" : 0,
"type" : "number",
"requiresRestart": true
}
'''
)
Settings().register_setting(
"reverser_ai.n_gpu_layers",
'''
{
"description" : "Utilize GPU layers for faster processing with a strong GPU.",
"title" : "Number of GPU Layers",
"default" : 99,
"type" : "number",
"requiresRestart": true
}
'''
)
Settings().register_setting(
"reverser_ai.seed",
'''
{
"description" : "Ensure deterministic model outputs by specifying a seed.",
"title" : "Seed for Determinism",
"default" : 0,
"type" : "number",
"requiresRestart": true
}
'''
)
Settings().register_setting(
"reverser_ai.verbose",
'''
{
"description" : "Toggle verbose logging of model configurations.",
"title" : "Verbose Model Logging",
"default" : false,
"type" : "boolean",
"requiresRestart": true
}
'''
)
Settings().register_setting(
"reverser_ai.model_identifier",
'''
{
"description": "Select the model to use for inference. Each model has distinct capabilities and resource requirements.",
"title": "Model Identifier",
"type": "string",
"enum": [
"mistral-7b-instruct",
"mixtral-8x7b-instruct"
],
"enumDescriptions": [
"A small, fast model, requiring ~5GB RAM. Ideal for quick processing and generating function names, although it has a reduced quality in outputs compared to larger models.",
"A larger model, requiring ~25GB RAM. Offers enhanced reasoning capabilities and accuracy at the cost of higher resource usage. Disabling memory mapping might be necessary on machines not capable of supporting the required RAM level."
],
"default": "mistral-7b-instruct",
"requiresRestart": true
}
'''
)