Skip to content

Commit d31d080

Browse files
committed
some more detailed comments
Signed-off-by: nigel brown <[email protected]>
1 parent 8e1bde5 commit d31d080

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

poetry.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/codegate/pipeline/suspicious_commands/suspicious_commands.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
"""
22
A module for spotting suspicious commands using the embeddings
33
from our local LLM and a futher ANN categorisier.
4+
5+
The code in here is used for inference. The training code is in
6+
SuspiciousCommandsTrainer. The split is because we don't want to
7+
install torch on a docker, it is too big. So we train the model on
8+
a local machine and then use the generated onnx file for inference.
49
"""
510

611
import os

src/codegate/pipeline/suspicious_commands/suspicious_commands_trainer.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
"""
22
A module for spotting suspicious commands using the embeddings
33
from our local LLM and a futher ANN categorisier.
4+
5+
The classes in here are not used for inference. The split is
6+
because we don't want to install torch on a docker, it is too
7+
big. So we train the model on a local machine and then use the
8+
generated onnx file for inference on the docker.
49
"""
510

611
import os
@@ -51,11 +56,12 @@ def forward(self, x):
5156

5257
class SuspiciousCommandsTrainer(SuspiciousCommands):
5358
"""
54-
Class to handle suspicious command detection using a neural network.
59+
Class to train suspicious command detection using a neural network.
5560
5661
Attributes:
5762
model_path (str): Path to the model.
58-
inference_engine (LlamaCppInferenceEngine): Inference engine for embedding.
63+
inference_engine (LlamaCppInferenceEngine): Inference engine for
64+
embedding.
5965
simple_nn (SimpleNN): Neural network model.
6066
"""
6167

tests/test_suspicious_commands.py

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ def test_initialization(sc):
8989
async def test_train_and_save():
9090
"""
9191
Test the training process of the SuspiciousCommands instance.
92+
This test is skipped if the model file is there. Also, the
93+
training code will need torch installed to run. This is not
94+
included in the default toml file.
9295
"""
9396
if os.path.exists(MODEL_FILE):
9497
return

0 commit comments

Comments
 (0)