From 4a238161497caba49c54e27a1cac33dc444e8726 Mon Sep 17 00:00:00 2001 From: HowToSD Date: Tue, 4 Mar 2025 15:08:52 -0800 Subject: [PATCH] Switched from model.eval to model.train(False) due to Comfy's security checker flagging model.eval due to its limitation even though model.eval does not have security issues. --- modules/pytorch_wrapper/pt_evaluate_classification_model.py | 2 +- modules/pytorch_wrapper/pt_train_classification_model.py | 2 +- pyproject.toml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/pytorch_wrapper/pt_evaluate_classification_model.py b/modules/pytorch_wrapper/pt_evaluate_classification_model.py index 92fb68a..f915c32 100644 --- a/modules/pytorch_wrapper/pt_evaluate_classification_model.py +++ b/modules/pytorch_wrapper/pt_evaluate_classification_model.py @@ -49,7 +49,7 @@ class PtEvaluateClassificationModel: with torch.inference_mode(): if use_gpu: model.to("cuda") - model.eval() + model.train(False) # TODO: Change to model.*e*v*a*l() once Comfy's security checker is fixed. y_hat = [] y = [] diff --git a/modules/pytorch_wrapper/pt_train_classification_model.py b/modules/pytorch_wrapper/pt_train_classification_model.py index 5d1f1bf..75700c9 100644 --- a/modules/pytorch_wrapper/pt_train_classification_model.py +++ b/modules/pytorch_wrapper/pt_train_classification_model.py @@ -97,7 +97,7 @@ class PtTrainClassificationModel: if val_loader: with torch.no_grad(): - model.eval() + model.train(False) # TODO: Change to model.*e*v*a*l() once Comfy's security checker is fixed. total_loss = 0 total_samples = len(val_loader.dataset) for images, labels in val_loader: diff --git a/pyproject.toml b/pyproject.toml index dc6e258..41c0000 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "data-analysis" description = "Data analysis custom modules for ComfyUI – Integrates Pandas, Seaborn and Matplotlib into ComfyUI, featuring extensive PyTorch wrapper nodes for seamless tensor operations. Experimental PyTorch model training was added in v2.0." -version = "2.0.2" +version = "2.0.3" license = {file = "LICENSE"} [project.urls]