notebooks
notebooks copied to clipboard
Keep Getting This Error 'AutoencoderKL' object has no attribute 'sample_size'

Any idea on how i can fix?
Getting the same exact error, appears someone broke something?
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮ │ in <cell line: 1>:4 │ │ │ │ /usr/local/lib/python3.9/dist-packages/torch/nn/modules/module.py:1614 in getattr │ │ │ │ 1611 │ │ │ modules = self.dict['_modules'] │ │ 1612 │ │ │ if name in modules: │ │ 1613 │ │ │ │ return modules[name] │ │ ❱ 1614 │ │ raise AttributeError("'{}' object has no attribute '{}'".format( │ │ 1615 │ │ │ type(self).name, name)) │ │ 1616 │ │ │ 1617 │ def setattr(self, name: str, value: Union[Tensor, 'Module']) -> None: │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ AttributeError: 'AutoencoderKL' object has no attribute 'sample_size'
Hey guys, i was able to fix my notebook by changing vae.sample_size to vae.config.sample_size
train_dataset = TextualInversionDataset(
data_root=save_path,
tokenizer=tokenizer,
size=vae.config.sample_size, # <---- This line
placeholder_token=placeholder_token,
repeats=100,
learnable_property=what_to_teach, #Option selected above between object and style
center_crop=False,
set="train",
)
I am also going to be honest 😅 and say that i still need to consult the documentation if any on the difference between the two and why the attribute was dropped for later versions.