MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / prepare_tensor

Method prepare_tensor

lightx2v/utils/service_utils.py:121–125  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

119 return data
120
121 def prepare_tensor(self, data) -> bytes:
122 self.buffer.seek(0)
123 self.buffer.truncate()
124 torch.save(self.to_device(data, "cpu"), self.buffer)
125 return base64.b64encode(self.buffer.getvalue()).decode("utf-8")
126
127 def load_tensor(self, tensor_base64: str, device="cuda") -> torch.Tensor:
128 tensor_bytes = base64.b64decode(tensor_base64)

Callers

nothing calls this directly

Calls 2

to_deviceMethod · 0.95
decodeMethod · 0.45

Tested by

no test coverage detected