chore: vendor selva_core from jnwnlee/selva@d7d40a9
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>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import torch
|
||||
|
||||
|
||||
def distribute_into_histogram(loss: torch.Tensor,
|
||||
t: torch.Tensor,
|
||||
num_bins: int = 25) -> tuple[torch.Tensor, torch.Tensor]:
|
||||
loss = loss.detach().flatten()
|
||||
t = t.detach().flatten()
|
||||
t = (t * num_bins).long()
|
||||
hist = torch.zeros(num_bins, device=loss.device)
|
||||
count = torch.zeros(num_bins, device=loss.device)
|
||||
hist.scatter_add_(0, t, loss)
|
||||
count.scatter_add_(0, t, torch.ones_like(loss))
|
||||
return hist, count
|
||||
Reference in New Issue
Block a user