twodgirl / vqvae-preview

huggingface.co
Total runs: 0
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: May 06 2025
text-to-image

Introduction of vqvae-preview

Model Details of vqvae-preview

VQ-VAE Preview

The decoder provides a preview image from a predicted series of tokens (int values).

Compatible with the Gemma/LLama/Qwen models and the Trainer class.

Inference
from diffusers import VQModel
from PIL import Image
from tea_model import AdaLayerNorm
from torchvision import transforms

def image_to_indices(image, vq):
    normalize = transforms.Compose([
        transforms.ToTensor(),
        transforms.Normalize([0.5], [0.5])
    ])
    norm = normalize(image).unsqueeze(0).to(vq.device)
    assert image.width == image.height
    latent = vq.encoder(norm)
    y = vq.quant_conv(latent)
  
    y = y.permute(0, 2, 3, 1).contiguous()
    indices = torch.argmin(
        torch.cdist(y.view(-1, vq.quantize.vq_embed_dim), vq.quantize.embedding.weight),
        dim=1
    )
    indices = indices.unsqueeze(0)
    assert indices.shape[0] == norm.shape[0]
  
    return indices, norm

def indices_to_tensor(indices, vq, ada: AdaLayerNorm):
    b = indices.shape[0]
    w = int(indices.shape[-1] ** 0.5)
    v = vq.quantize.embedding(indices)
    v = ada.forward(v)
    v = v.view((b, w, w, vq.config.latent_channels))
    v = v.permute(0, 3, 1, 2).contiguous()
    x = vq.post_quant_conv(v)
    y = vq.decoder(x, None)

    return y

if __name__ == '__main__':
    vq = VQModel.from_pretrained('MeissonFlow/Meissonic', subfolder='vqvae')
    vq.to('cuda')
    vq.eval()
    image = Image.open('path/to/image.png')
    # Encode image.
    ids, _ = image_to_indices(image, vq)
    # Decode by integer ids.
    pixel_values = indices_to_tensor(ids, vq, ada) / 2.0 + 0.5
    preview = transforms.functional.to_pil_image(pixel_values.detach().squeeze(0).to('cpu'))
Datasets
  • Chars/pixiv_rank_daily_2018_2023
  • jordandavis/fashion_num_people
  • mattmdjaga/human_parsing_dataset

Runs of twodgirl vqvae-preview on huggingface.co

0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About vqvae-preview huggingface.co Model

More vqvae-preview license Visit here:

https://choosealicense.com/licenses/apache-2.0

vqvae-preview huggingface.co

vqvae-preview huggingface.co is an AI model on huggingface.co that provides vqvae-preview's model effect (), which can be used instantly with this twodgirl vqvae-preview model. huggingface.co supports a free trial of the vqvae-preview model, and also provides paid use of the vqvae-preview. Support call vqvae-preview model through api, including Node.js, Python, http.

vqvae-preview huggingface.co Url

https://huggingface.co/twodgirl/vqvae-preview

twodgirl vqvae-preview online free

vqvae-preview huggingface.co is an online trial and call api platform, which integrates vqvae-preview's modeling effects, including api services, and provides a free online trial of vqvae-preview, you can try vqvae-preview online for free by clicking the link below.

twodgirl vqvae-preview online free url in huggingface.co:

https://huggingface.co/twodgirl/vqvae-preview

vqvae-preview install

vqvae-preview is an open source model from GitHub that offers a free installation service, and any user can find vqvae-preview on GitHub to install. At the same time, huggingface.co provides the effect of vqvae-preview install, users can directly use vqvae-preview installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

vqvae-preview install url in huggingface.co:

https://huggingface.co/twodgirl/vqvae-preview

Url of vqvae-preview

vqvae-preview huggingface.co Url

Provider of vqvae-preview huggingface.co

twodgirl
ORGANIZATIONS

Other API from twodgirl

huggingface.co

Total runs: 7
Run Growth: 0
Growth Rate: 0.00%
Updated:September 27 2024
huggingface.co

Total runs: 1
Run Growth: 0
Growth Rate: 0.00%
Updated:August 18 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:December 13 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:October 07 2023
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated:April 21 2024