Add remaining files: web folder, scripts, and dependencies

This commit is contained in:
fabien 2025-08-17 17:13:24 +02:00
parent 7e78177f5e
commit 7e597d6eff
5 changed files with 66 additions and 0 deletions

12
start.bat Normal file
View File

@ -0,0 +1,12 @@
@echo off
REM Aller dans le dossier du projet
cd /d "C:\Users\benja\Documents\GitHub\ComfyUI triton sageAttention\ComfyUI"
REM Activer l'environnement virtuel
call venv\Scripts\activate.bat
REM Afficher un message de confirmation
echo [OK] Environnement virtuel activé.
REM Lancer ton script Python (change "main.py" si besoin)
python main.py

3
start.ps1 Normal file
View File

@ -0,0 +1,3 @@
$venvPath = Scripts/Activate.ps1"
. $venvPath
python main.py

27
test.py Normal file
View File

@ -0,0 +1,27 @@
import torch
import triton
import triton.language as tl
@triton.jit
def add_kernel(x_ptr, y_ptr, output_ptr, n_elements, BLOCK_SIZE: tl.constexpr):
pid = tl.program_id(axis=0)
block_start = pid * BLOCK_SIZE
offsets = block_start + tl.arange(0, BLOCK_SIZE)
mask = offsets < n_elements
x = tl.load(x_ptr + offsets, mask=mask)
y = tl.load(y_ptr + offsets, mask=mask)
output = x + y
tl.store(output_ptr + offsets, output, mask=mask)
def add(x: torch.Tensor, y: torch.Tensor):
output = torch.empty_like(x)
n_elements = output.numel()
grid = lambda meta: (triton.cdiv(n_elements, meta["BLOCK_SIZE"]),)
add_kernel[grid](x, y, output, n_elements, BLOCK_SIZE=1024)
return output
a = torch.rand(3, device="cuda")
b = a + a
b_compiled = add(a, a)
print(b_compiled - b)
print("If you see tensor([0., 0., 0.], device='cuda:0'), then it works")

View File

@ -0,0 +1,24 @@
import { app } from "/scripts/app.js";
app.registerExtension({
name: "SendToLoadImage",
async nodeCreated(node) {
if (node.comfyClass === "SaveImage") {
node.onExecuted = (output) => {
if (!output?.images) return;
// Crée un bouton une seule fois
if (!node.sendBtn) {
const btn = document.createElement("button");
btn.innerText = "Send To...";
btn.style.margin = "5px";
btn.onclick = () => {
alert("Ici tu pourras choisir vers quel TaggedLoadImage envoyer limage");
};
node.addDOMElement(btn);
node.sendBtn = btn;
}
};
}
}
});