siyuhuang / QuantArt

Official PyTorch implementation of QuantArt (CVPR2023)
MIT License
92 stars 6 forks source link

It seems that it was not found α parameter in the inference code? #8

Open Mr-Jin2 opened 9 months ago

Mr-Jin2 commented 9 months ago

hi, I'm trying to use bash test.sh to reproduce the results of a paper. But I can't find any declaration about α ,in this function. https://github.com/siyuhuang/QuantArt/blob/84d3c83032c03053577159f0af6a137c7a6dae3d/taming/models/vqgan_ref.py#L137

 def transfer(self, x, ref, quantize=True):
        with torch.no_grad():  
            quant_x, _, _ = self.encode(x, quantize=True) 
            quant_x = quant_x.detach()
            quant_ref, _, info_ref = self.encode_real(ref, quantize=True)
            indices_ref = info_ref[2]
            quant_ref = quant_ref.detach()

        h_x = self.model_x2y(quant_x, quant_ref)
        if not quantize:
            return quant_x, h_x, quant_ref, torch.zeros(1).to(self.device), [0,0,0], indices_ref
        quant_y, diff_x2y, info_y = self.quantize_dec(h_x)
        indices_y = info_y[2]
        return quant_x, quant_y, quant_ref, diff_x2y, indices_y, indices_ref

Any advice is super appreciated.

siyuhuang commented 3 months ago

We did not provide the α-controlled inference code. You can achieve it in a simple way by interpolating between the quantized and continuous latent representations then decoding it into an image.