6bc3fd6443
Pure PyTorch SelVA source for SelvaModelLoader/FeatureExtractor/Sampler nodes. Imports rewritten from selva.* to selva_core.*. mel_converter.py: replaced librosa.filters.mel with pure-numpy implementation to avoid librosa→numba→NumPy version incompatibility in some ComfyUI environments. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
18 lines
487 B
Python
18 lines
487 B
Python
import os
|
|
from logging import Logger
|
|
|
|
from selva_core.utils.logger import TensorboardLogger
|
|
|
|
local_rank = int(os.environ['LOCAL_RANK']) if 'LOCAL_RANK' in os.environ else 0
|
|
world_size = int(os.environ['WORLD_SIZE']) if 'WORLD_SIZE' in os.environ else 1
|
|
|
|
|
|
def info_if_rank_zero(logger: Logger, msg: str):
|
|
if local_rank == 0:
|
|
logger.info(msg)
|
|
|
|
|
|
def string_if_rank_zero(logger: TensorboardLogger, tag: str, msg: str):
|
|
if local_rank == 0:
|
|
logger.log_string(tag, msg)
|