huangyangyi / TeCH

[3DV 2024] Official repo of "TeCH: Text-guided Reconstruction of Lifelike Clothed Humans"
https://huangyangyi.github.io/TeCH/
MIT License
391 stars 25 forks source link

OSError: image file is truncated #20

Closed denghu333 closed 10 months ago

denghu333 commented 10 months ago

In the Step Finetune Dreambooth model, I always get this error, Anyone met the same problem? Traceback (most recent call last): File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/call.py", line 38, in _call_and_handle_interrupt return trainer_fn(*args, kwargs) File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 650, in _fit_impl self._run(model, ckpt_path=self.ckpt_path) File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1112, in _run results = self._run_stage() File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1191, in _run_stage self._run_train() File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1214, in _run_train self.fit_loop.run() File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/loops/loop.py", line 199, in run self.advance(*args, *kwargs) File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/loops/fit_loop.py", line 267, in advance self._outputs = self.epoch_loop.run(self._data_fetcher) File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/loops/loop.py", line 199, in run self.advance(args, kwargs) File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/loops/epoch/training_epoch_loop.py", line 187, in advance batch = next(data_fetcher) File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/utilities/fetching.py", line 184, in next return self.fetching_function() File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/utilities/fetching.py", line 265, in fetching_function self._fetch_next_batch(self.dataloader_iter) File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/utilities/fetching.py", line 280, in _fetch_next_batch batch = next(iterator) File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/supporters.py", line 569, in next return self.request_next_batch(self.loader_iters) File "/root/miniconda3/lib/python3.8/site-packages/pytorch_lightning/trainer/supporters.py", line 581, in request_next_batch return apply_to_collection(loader_iters, Iterator, next) File "/root/miniconda3/lib/python3.8/site-packages/lightning_utilities/core/apply_func.py", line 64, in apply_to_collection return function(data, *args, **kwargs) File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 634, in next data = self._next_data() File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1346, in _next_data return self._process_data(data) File "/root/miniconda3/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1372, in _process_data data.reraise() File "/root/miniconda3/lib/python3.8/site-packages/torch/_utils.py", line 644, in reraise raise exception OSError: Caught OSError in DataLoader worker process 0. Original Traceback (most recent call last): File "/root/autodl-tmp/TeCH/utils/ldm_utils/ldm/data/personalized.py", line 294, in getitem img = np.array(image).astype(np.uint8) File "/root/miniconda3/lib/python3.8/site-packages/PIL/Image.py", line 701, in __array_interface__ new["data"] = self.tobytes() File "/root/miniconda3/lib/python3.8/site-packages/PIL/Image.py", line 758, in tobytes self.load() File "/root/miniconda3/lib/python3.8/site-packages/PIL/ImageFile.py", line 266, in load raise OSError(msg) OSError: image file is truncated (65 bytes not processed)

denghu333 commented 10 months ago

I fixed it use this: from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True