mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Update calc_model_size_by_data(...) to handle all expected model types, and to log an error if an unexpected model type is received.
This commit is contained in:
@ -77,6 +77,14 @@ class TextualInversionModelRaw(RawModel):
|
||||
if emb is not None:
|
||||
emb.to(device=device, dtype=dtype, non_blocking=non_blocking)
|
||||
|
||||
def calc_size(self) -> int:
|
||||
"""Get the size of this model in bytes."""
|
||||
embedding_size = self.embedding.element_size() * self.embedding.nelement()
|
||||
embedding_2_size = 0
|
||||
if self.embedding_2 is not None:
|
||||
embedding_2_size = self.embedding_2.element_size() * self.embedding_2.nelement()
|
||||
return embedding_size + embedding_2_size
|
||||
|
||||
|
||||
class TextualInversionManager(BaseTextualInversionManager):
|
||||
"""TextualInversionManager implements the BaseTextualInversionManager ABC from the compel library."""
|
||||
|
Reference in New Issue
Block a user