MCPcopy
hub / github.com/zai-org/CogView / DecodeIds

Method DecodeIds

data_utils/vqvae_tokenizer.py:61–70  ·  view source on GitHub ↗
(self, code, shape=None)

Source from the content-addressed store, hash-verified

59 return img2code(self.model, img)
60
61 def DecodeIds(self, code, shape=None):
62 if shape is None:
63 if isinstance(code, list):
64 code = torch.tensor(code, device=self.device)
65 s = sqrt_int(len(code.view(-1)))
66 assert s * s == len(code.view(-1))
67 shape = (1, s, s)
68 code = code.view(shape)
69 out = code2img(self.model, code)
70 return out
71
72 def read_img(self, path, img_size=256):
73 tr = transforms.Compose([

Callers 4

test_lmdb.pyFile · 0.45
generate_images_onceFunction · 0.45
super_resolutionFunction · 0.45
decodeMethod · 0.45

Calls 2

code2imgFunction · 0.90
sqrt_intFunction · 0.85

Tested by

no test coverage detected