MCPcopy Create free account
hub / github.com/AlmondGod/tinyworlds / get_codebook_usage

Method get_codebook_usage

models/fsq.py:43–45  ·  view source on GitHub ↗
(self, quantized_z)

Source from the content-addressed store, hash-verified

41 return quantized_z
42
43 def get_codebook_usage(self, quantized_z):
44 unique_bins = torch.unique(quantized_z).shape[0]
45 return unique_bins / self.num_bins
46
47 def get_indices_from_latents(self, latents, dim=-1):
48 # to get fsq indices, for each dimension, we get the index and add it (so multiply by L then sum)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected