13 Commits
Author SHA1 Message Date
AI Lab 594cda88a7 Add files via upload 2026-09-30 12:43:27 -07:00
AI Lab d5ee9818ac Add files via upload 2026-09-30 12:40:42 -07:00
Marcel Hoferand@goodguy1963 58f1947a11 Fix RMBG batch tensor size mismatch (#202)
Co-authored-by: @goodguy1963
2026-08-21 15:56:10 -07:00
Mohamed Firas 83ae073127 Fix device selection on Apple Silicon (MPS) (#205)
Several nodes selected their device with a module-level
`device = "cuda" if torch.cuda.is_available() else "cpu"`. On Apple Silicon
`torch.cuda.is_available()` is False, so they silently ran on CPU even when
ComfyUI had selected MPS. The model still runs, just far slower, so there is no
error -- only a job that sits at 0% for minutes (reads as a hang). A single
BiRefNet image took ~18 min on CPU; on MPS a 21s video processed in ~9 min
(~1s/frame).

Defer to ComfyUI's own device management via a shared helper
`get_device()` in AILab_utils (wraps `comfy.model_management.get_torch_device()`),
so nodes follow whatever backend ComfyUI chose -- matching what the SAM2/SAM3/
Florence2/Segment/SDMatte nodes already do. Centralizing it keeps the check from
drifting again.

Applied to BiRefNet, RMBG, ClothSegment, BodySegment, FashionSegment,
FaceSegment, and SegmentV2. LamaRemover already uses get_torch_device() and is
left unchanged.

Fixes #200. Related to #91, #135.
2026-08-21 15:51:39 -07:00
AI Lab bb0531a1ae Simplify image crop logic and remove unused variables
Refactor image cropping logic to simplify handling of split cases and improve clarity.
2026-08-21 14:40:22 -07:00
AI Lab 8d1f14ae67 Add files via upload 2026-07-21 15:31:24 -07:00
AI Lab d7402513f2 Improve image download method with redirect handling
Refactor image downloading logic to handle redirects and ensure image loading.
2026-02-03 09:58:20 -08:00
AI Lab 07ecb7a06f Add files via upload 2026-01-17 10:57:33 -08:00
AI Lab edd18618cf Add files via upload 2026-01-16 23:39:36 -08:00
AI Lab 112fd6141d Update AILab_SAM3Segment.py 2026-01-06 01:24:40 -08:00
AI Lab 7178f940fb Add files via upload 2026-01-01 19:29:24 -08:00
AI Lab d6fe942a1e Add files via upload 2026-01-01 19:18:04 -08:00
AI Lab 95d5e5c94f Add image processing utility functions
This file contains utility functions for image processing, including conversions between PIL images and tensors, resizing, blending, and color formatting.
2026-01-01 19:10:49 -08:00