mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-06-21 07:19:42 +08:00
ops: put meta-tensors in place to allow custom nodes to check geo
This commit is contained in:
parent
3be6735ca2
commit
1120bccc23
@ -578,7 +578,12 @@ class disable_weight_init:
|
|||||||
self.norm_type = norm_type
|
self.norm_type = norm_type
|
||||||
self.scale_grad_by_freq = scale_grad_by_freq
|
self.scale_grad_by_freq = scale_grad_by_freq
|
||||||
self.sparse = sparse
|
self.sparse = sparse
|
||||||
self.weight = None
|
# Keep shape/dtype visible for module introspection without reserving storage.
|
||||||
|
embedding_dtype = dtype if dtype is not None else torch.get_default_dtype()
|
||||||
|
self.weight = torch.nn.Parameter(
|
||||||
|
torch.empty((num_embeddings, embedding_dim), device="meta", dtype=embedding_dtype),
|
||||||
|
requires_grad=False,
|
||||||
|
)
|
||||||
self.bias = None
|
self.bias = None
|
||||||
self.weight_comfy_model_dtype = dtype
|
self.weight_comfy_model_dtype = dtype
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user