ximinng / PyTorch-SVGRender

SVG Differentiable Rendering: Generating vector graphics using neural networks. Support: text-to-SVG, Image-to-SVG, SVG Editing.
https://ximinng.github.io/PyTorch-SVGRender-project/
Mozilla Public License 2.0
111 stars 7 forks source link

[Error] RuntimeError: main thread is not in main loop (`self.tk.call('image', 'delete', self.name)` in `svg_brush.py`. #20

Open atljoseph opened 2 months ago

atljoseph commented 2 months ago

[Error] RuntimeError: main thread is not in main loop (self.tk.call('image', 'delete', self.name) in svg_brush.py.

Installed ok, after realizing, "oh yeah, gotta activate the conda env after running the install script". :)

Generates some output, with an initial image, but not much more than that (error below).

$ sh script/install.sh
...
$ conda activate svgrender
...
$ python svg_render.py x=clipdraw prompt='Horse eating a cupcake'
==> system args: 
{'target': None, 'prompt': 'Horse eating a cupcake', 'neg_prompt': 'nsfw, lowres, (bad), text, error, fewer, extra, missing, worst quality, jpeg artifacts, low quality, watermark, unfinished, displeasing, oldest, early, chromatic aberration, signature, extra digits, artistic error, username, scan', 'state': {'cpu': False, 'mprec': 'no'}, 'diffuser': {'download': False, 'force_download': False, 'resume_download': False}, 'diffvg': {'print_timing': False}, 'seed': 951222, 'multirun': False, 'srange': None, 'result_path': './workspace', 'save_step': 10, 'eval_step': 10, 'mv': False, 'framefreq': 5, 'framerate': 24, 'output_dir': '/home/joseph/ai/PyTorch-SVGRender/workspace/clipdraw-2024-07-21-02-54'}
==> yaml config args: 
{'method': 'clipdraw', 'image_size': 224, 'path_svg': None, 'num_iter': 1000, 'num_stages': 1, 'lr_schedule': True, 'lr': 1, 'width_lr': 0.1, 'color_lr': 0.01, 'num_paths': 512, 'max_width': 50, 'black_stroke_color': False, 'num_aug': 4}

***** Model State *****
-> Mixed Precision: no, AMP: False
-> Weight dtype:  torch.float32
-> Working Space: '/home/joseph/ai/PyTorch-SVGRender/workspace/clipdraw-2024-07-21-02-54/sd951222-im224-P512'
Process 0 using device: cuda
-> state initialization complete 

prompt: Horse eating a cupcake
init_image shape:  torch.Size([1, 3, 224, 224])
  0%|                                                                                  | 0/1000 [00:00<?, ?it/s]/home/joseph/.local/lib/python3.10/site-packages/torchvision/transforms/functional.py:1603: UserWarning: The default value of the antialias parameter of all the resizing transforms (Resize(), RandomResizedCrop(), etc.) will change from None to True in v0.17, in order to be consistent across the PIL and Tensor backends. To suppress this warning, directly pass antialias=True (recommended, future default), antialias=None (current default, which means False for Tensors and True for PIL), or antialias=False (only works on Tensors - PIL will still use antialiasing). This also applies if you are using the inference transforms from the models weights: update the call to weights.transforms(antialias=True).
  warnings.warn(
lr: 1.000, L_train: -0.5856:   0%|                                                     | 0/1000 [00:00<?, ?it/s]Exception ignored in: <function Image.__del__ at 0x73f5307b2f80>
Traceback (most recent call last):
  File "/home/joseph/anaconda3/envs/svgrender/lib/python3.10/tkinter/__init__.py", line 4056, in __del__
    self.tk.call('image', 'delete', self.name)
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x73f54f4ff7f0>
Traceback (most recent call last):
  File "/home/joseph/anaconda3/envs/svgrender/lib/python3.10/tkinter/__init__.py", line 388, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x73f54f4ff7f0>
Traceback (most recent call last):
  File "/home/joseph/anaconda3/envs/svgrender/lib/python3.10/tkinter/__init__.py", line 388, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x73f54f4ff7f0>
Traceback (most recent call last):
  File "/home/joseph/anaconda3/envs/svgrender/lib/python3.10/tkinter/__init__.py", line 388, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
RuntimeError: main thread is not in main loop
Exception ignored in: <function Variable.__del__ at 0x73f54f4ff7f0>
Traceback (most recent call last):
  File "/home/joseph/anaconda3/envs/svgrender/lib/python3.10/tkinter/__init__.py", line 388, in __del__
    if self._tk.getboolean(self._tk.call("info", "exists", self._name)):
RuntimeError: main thread is not in main loop
Tcl_AsyncDelete: async handler deleted by the wrong thread
Aborted

Thanks!