Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'PosixPath' object has no attribute 'with_stem' #13

Closed
ngys321 opened this issue Aug 23, 2022 · 1 comment
Closed

AttributeError: 'PosixPath' object has no attribute 'with_stem' #13

ngys321 opened this issue Aug 23, 2022 · 1 comment

Comments

@ngys321
Copy link

ngys321 commented Aug 23, 2022

Thanks for opening your code. I really appreciated that.

I tried to run your code in the Google Colab with GPU Runtime.

I got an error. And I couldn't find any solution despite of googling...

The error message is as follows :
AttributeError: 'PosixPath' object has no attribute 'with_stem'

I think it's kinda related to "pathlib" module. maybe it's due to the fact that pathlib doesn't work well with latest python 3.x version which I'm using.

I hope this error will be solved soon QQ

-----detail description-------

I run the terminal argument like this as follows :
python main.py -p "rock" -i "input_example/img.png" --mask "input_example/mask.png" --output_path "output" --batch_size 1

And, I got this whole bunch of error messages as follow :
Using device: cuda:0
tcmalloc: large alloc 2209964032 bytes == 0x89ebe000 @ 0x7fbdefa2cb6b 0x7fbdefa4c379 0x7fbd30b1026e 0x7fbd30b119e2 0x7fbd334aeee1 0x7fbdd598e236 0x7fbdd541ef98 0x593784 0x594731 0x548cc1 0x51566f 0x549e0e 0x593fce 0x5118f8 0x549e0e 0x4bcb19 0x59582d 0x595b69 0x62026d 0x55de15 0x59af67 0x515655 0x549e0e 0x4bca8a 0x5134a6 0x549576 0x593fce 0x548ae9 0x5127f1 0x4bc98a 0x532b86
Setting up [LPIPS] perceptual loss: trunk [vgg], v[0.1], spatial [off]
Loading model from: /usr/local/lib/python3.7/dist-packages/lpips/weights/v0.1/vgg.pth
Start iterations 0
0% 0/75 [00:00<?, ?it/s]clip_loss - 867.99
range_loss - 0.00

Traceback (most recent call last):
File "main.py", line 8, in <module>
image_editor.edit_image_by_prompt()

File "/content/drive/MyDrive/ws/blended-diffusion/optimization/image_editor.py", line 266, in edit_image_by_prompt
visualization_path = visualization_path.with_stem(

AttributeError: 'PosixPath' object has no attribute 'with_stem'
0% 0/75 [00:01<?, ?it/s]

The codes below are the ones that error comes in. Those are from blended-diffusion/optimization/image_editor.py python file.


line 1 - from pathlib import Path
...
line 261 - for b in range(self.args.batch_size):
line 262 - pred_image = sample["pred_xstart"][b]
line 263 - visualization_path = Path(
line 264 - os.path.join(self.args.output_path, self.args.output_file)
line 265 - )
line 266 - visualization_path = visualization_path.with_stem(

@ngys321
Copy link
Author

ngys321 commented Aug 24, 2022

I solved it!! It was a python version problem!

I think the code works well when "python version >= 3.9" setting!

@omriav omriav closed this as completed Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants