You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<ahref="https://arxiv.org/abs/2305.05065">This paper</a> out of Google Deepmind claims that residual vector quantization can induce hierarchical semantic ids for building a recommender system. In their scheme, they use increasing number of codes across depth for it to work. This repository supports that scheme as so
105
+
106
+
```python
107
+
import torch
108
+
from vector_quantize_pytorch import ResidualVQ
109
+
110
+
residual_vq = ResidualVQ(
111
+
dim=2,
112
+
codebook_size= (5, 128, 256), # from top most hierarchy to lowest, 5 codes, 128 codes, then 256 codes
The SoundStream paper proposes that the codebook should be initialized by the kmeans centroids of the first batch. You can easily turn on this feature with one flag `kmeans_init = True`, for either `VectorQuantize` or `ResidualVQ` class
title = {Recommender Systems with Generative Retrieval},
744
+
author = {Shashank Rajput and Nikhil Mehta and Anima Singh and Raghunandan H. Keshavan and Trung Hieu Vu and Lukasz Heldt and Lichan Hong and Yi Tay and Vinh Q. Tran and Jonah Samost and Maciej Kula and Ed H. Chi and Maheswaran Sathiamoorthy},
quantized_out=residual_vq.get_output_from_indices(indices) # pass your indices into here, but the indices must come during .eval(), as during training some of the indices are dropped out (-1)
0 commit comments