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

TypeError: Remover.__init__() got an unexpected keyword argument 'fast' #121

Closed
ryuan opened this issue Oct 6, 2023 · 5 comments · Fixed by #122
Closed

TypeError: Remover.__init__() got an unexpected keyword argument 'fast' #121

ryuan opened this issue Oct 6, 2023 · 5 comments · Fixed by #122

Comments

@ryuan
Copy link
Contributor

ryuan commented Oct 6, 2023

I'm getting the following error when generating stage 1. This issue could be related to the fact that I'm on a Apple Silicon machine. Could also be that the fast argument has been deprecated in the most recent (Sep. 25th) commit of transparent_background module. Instead, Remover object initiation should pass the required mode argument.

TypeError: Remover.__init__() got an unexpected keyword argument 'fast'

After generating, I only get image frames in the video_frame folder, while the video_mask folder remains empty.

The problem is related to the create_mask_transparent_background function stage1.py struggling to initiate the Remover object in line 151.

remover = Remover(fast=tb_use_fast_mode, jit=tb_use_jit, device=devices.get_optimal_device_name())

@ryuan
Copy link
Contributor Author

ryuan commented Oct 6, 2023

After some digging around, I believe I found the issue. For whatever reason (likely related to some particular setup with Apple Silicon Macs but could also be relevant to Windows devices), the extension isn't able to update the installed transparent_background dependency module to the required version during installation.

The update process fails because transparent_background itself requires the pyvirtualcam module, but pip struggles to install this package into Automatic's virtual environment. Actually, even attempting a regular pip install of pyvirtualcam on my Mac fails, giving ERROR: Could not find a version that satisfies the requirement pyvirtualcam.

The result of all of this is that transparent_background remains in an improper version and cannot initiate the Remover object (i.e., the outdated version of transparent_background does not have a fast argument for initiating Remover).

I would greatly appreciate if any of the contributors can help debug this issue so that this extension works on M1/M2 devices out-of-the-box. Perhaps future versions of this extension can find an alternative module to transparent_background, since it appears to only be used in stage1.py for creating the masks and there are other ways to accomplish this.

@s9roll7
Copy link
Owner

s9roll7 commented Oct 7, 2023

I haven't tried it, but can you install it with this?
pip install git+https://github.com/letmaik/pyvirtualcam

@ryuan
Copy link
Contributor Author

ryuan commented Oct 7, 2023

Yes, I can "forcibly" install pyvirtualcam by either passing the git repo URL to pip3 or downloading the ZIP and installing locally. Regular call of pip3 install pyvirtualcam doesn't work though.

The issue is that Automatic's venv still does not install pyvirtualcam as a dependency when installing the extension. I checked Automatic's site-packages directory and pyvirtualcam does not exist. As expected, because it doesn't exist, transparent_background module remains in an outdated version with a Remover package that doesn't have the fast argument.

Perhaps, in this extension's install.py script, it can check and install pyvirtualcam before installing transparent_background? But I worry that there is a deeper reason why pyvirtualcam doesn't install along with transparent_background as a dependency in the first place...

@s9roll7
Copy link
Owner

s9roll7 commented Oct 8, 2023

https://github.com/letmaik/pyvirtualcam/issues/97
Perhaps this is the problem.
Shouldn't be a problem except for the MAC.

@ryuan
Copy link
Contributor Author

ryuan commented Oct 8, 2023

Yes, this is exactly the issue I'm referring to. Seems they have no intension of addressing the issue though.

Regardless, I edited the extension code and now stage 1 successfully completes (masks are generated). I will provide manual resolution below, but hope something similar is implemented in future updates to the extension so that the below manual fix does not need to be applied with every update.

  1. Make sure to quit A1111 (just to be safe just exit Terminal as well).
  2. Go into /stable-diffusion-webui/extensions/ebsynth_utility and open install.py.
  3. Add the following block of code on line 11 and save the file. It should go below the first function update_transparent_background.
if not launch.is_installed("pyvirtualcam"):
    launch.run_pip("install git+https://github.com/letmaik/pyvirtualcam", "requirements for Ebsynth Utility")
  1. Launch A1111. Stage 1 for this extension should now work for you.

@ryuan ryuan closed this as completed Oct 8, 2023
@ryuan ryuan reopened this Oct 8, 2023
ryuan added a commit to ryuan/ebsynth_utility that referenced this issue Oct 10, 2023
s9roll7 added a commit that referenced this issue Oct 10, 2023
closes #121 regarding dependency installations on M1/M2 Macs
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

Successfully merging a pull request may close this issue.

2 participants