MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / from_weights

Method from_weights

src/fused_mm_sampling/core.py:670–677  ·  view source on GitHub ↗
(
        cls,
        weights: torch.Tensor,  # [V, D]
        epsilon: float = 0.2,
    )

Source from the content-addressed store, hash-verified

668
669 @classmethod
670 def from_weights(
671 cls,
672 weights: torch.Tensor, # [V, D]
673 epsilon: float = 0.2,
674 ) -> "JLSampler":
675 k = optimal_k(n=weights.shape[0], epsilon=epsilon)
676 print(f"JLSampler optimal k={k}")
677 return cls(weights, k=k)
678
679 def prepare(self) -> "JLSampler":
680 D = self.weights.shape[1] # noqa: N806

Callers 2

get_samplerFunction · 0.80

Calls 1

optimal_kFunction · 0.85

Tested by 1