6 Commits
Author SHA1 Message Date
bemoregtandClaude Sonnet 4.6 14a3637beb docs: add workflow screenshot to README
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 17:30:28 +09:00
Gromit Park 22ff9353af Add files via upload 2026-03-16 17:28:51 +09:00
bemoregtandClaude Sonnet 4.6 440ef159c3 Fix: load model in new thread to avoid inference_mode parameter taint
Model parameters created inside torch.inference_mode() are permanently
tainted — even in a new thread, forward() produces inference tensors.
LoadResNet18 now loads the model via _run_in_new_thread so parameters
are normal autograd-compatible tensors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 17:00:47 +09:00
bemoregtandClaude Sonnet 4.6 b4f1621e2e Fix: escape torch.inference_mode() via new thread for autograd
ComfyUI Desktop App wraps node execution in torch.inference_mode(),
which permanently taints tensors — torch.enable_grad() cannot override it.
Solution: run FGSM/PGD gradient computation in a fresh OS thread where
PyTorch's thread-local grad mode starts clean (no inference_mode active).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 16:57:08 +09:00
bemoregtandClaude Sonnet 4.6 197c557115 Fix RuntimeError: wrap gradient computation in torch.enable_grad()
ComfyUI runs node execution inside torch.no_grad(), which prevents
loss.backward() from building a computation graph. Wrapping the
FGSM and PGD gradient steps with torch.enable_grad() resolves this.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 16:27:20 +09:00
bemoregtandClaude Sonnet 4.6 a97ca0f3ab Initial release: ComfyUI AdversarialAttack custom nodes
Adds three ComfyUI nodes for adversarial example generation using ResNet18:
- LoadResNet18: loads pretrained ImageNet weights
- AdversarialAttack: FGSM and PGD untargeted/targeted attacks
- ClassifyImage: Top-K inference helper node

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-16 16:18:23 +09:00