Giter Club home page Giter Club logo

Comments (19)

tdslaine avatar tdslaine commented on June 12, 2024 4

I've done the fork -> spawn thing, but that still gives me an error

(venv) Q:\PhotoMaker>python gradio_demo/app.py Traceback (most recent call last): File "gradio_demo/app.py", line 17, in from photomaker.pipeline import PhotoMakerStableDiffusionXLPipeline ModuleNotFoundError: No module named 'photomaker.pipeline'

Will try moving the folder...

I had to put all files from photomaker folder into the root where app.py is located @, removing the subfolder photomaker completly and adjusting the app.py as well as the pipeline.py to not look inside photomaker. folder for the modules

so it looks like:

  • gradio_demo:

    app.py
    model.py
    pipeline.py
    sytle_template.py

I also had to change:

line 22 in pipeline.py
original: from photomaker.model import PhotoMakerIDEncoder
altered: from model import PhotoMakerIDEncoder

and
line 14 in app.py
original: from photomaker.pipeline import PhotoMakerStableDiffusionXLPipeline
altered: from pipeline import PhotoMakerStableDiffusionXLPipeline

EDIT: the issure with not finding the req files/modules in the subfolder might be caused by a missing init.py file inside that folder (can be an empty file)

from photomaker.

NolenBrolen avatar NolenBrolen commented on June 12, 2024 3

I've done the fork -> spawn thing, but that still gives me an error
(venv) Q:\PhotoMaker>python gradio_demo/app.py Traceback (most recent call last): File "gradio_demo/app.py", line 17, in from photomaker.pipeline import PhotoMakerStableDiffusionXLPipeline ModuleNotFoundError: No module named 'photomaker.pipeline'
Will try moving the folder...

I had to put all files from photomaker folder into the root where app.py is located @, removing the subfolder photomaker completly and adjusting the app.py as well as the pipeline.py to not look inside photomaker. folder for the modules

so it looks like:

  • gradio_demo:

    app.py
    model.py
    pipeline.py
    sytle_template.py

I also had to change:

line 22 in pipeline.py original: from photomaker.model import PhotoMakerIDEncoder altered: from model import PhotoMakerIDEncoder

and line 14 in app.py original: from photomaker.pipeline import PhotoMakerStableDiffusionXLPipeline altered: from pipeline import PhotoMakerStableDiffusionXLPipeline

This worked! Thank you so much!

from photomaker.

nitrosocke avatar nitrosocke commented on June 12, 2024 2

This seems to be an issue with spaces on windows. Somewhat related to this: Issue #129
I solved it by editing line 42 in venv\Lib\site-packages\spaces\zero\wrappers.py from:
Process = multiprocessing.get_context('fork').Process to
Process = multiprocessing.get_context('spawn').Process

Also needed to drag the photomaker directory containing the pipeline into the gradio_demo folder.
Not sure if this is the ideal solution but a workaround on windows.

from photomaker.

justinjohn0306 avatar justinjohn0306 commented on June 12, 2024 2

Process = multiprocessing.get_context('fork').Process

Use python 3.10 or add these line in app.py :

add this line at the top ---> from typing import Tuple

find this line ---> def apply_style(style_name: str, positive: str, negative: str = "") -> tuple[str, str]:

and replace with this one ---> def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:

it works for me :)

image

from photomaker.

tdslaine avatar tdslaine commented on June 12, 2024 2

Process = multiprocessing.get_context('fork').Process

Use python 3.10 or add these line in app.py :

add this line at the top ---> from typing import Tuple

find this line ---> def apply_style(style_name: str, positive: str, negative: str = "") -> tuple[str, str]:

and replace with this one ---> def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str, str]:

it works for me :)
image

yes, bad entry in readme - shoudl state required python 3.9 - this Tulpe error been the last error - now onto the stylized version :D

from photomaker.

Paper99 avatar Paper99 commented on June 12, 2024 2

Hello everyone, first of all, thank you for your discussions, which helped us fix many known issues in environment construction (in the latest version).

Now, you could update the environment building through:

conda create --name photomaker python=3.10
pip install -U pip

# Install requirements
pip install -r requirements.txt

# Install photomaker
pip install git+https://github.com/TencentARC/PhotoMaker.git

Then you can run the following command to use our PhotoMaker:

from photomaker import PhotoMakerStableDiffusionXLPipeline

The previous line can also be used outside the repo.

from photomaker.

dancemanUK avatar dancemanUK commented on June 12, 2024 1

Built Distributions
photomaker-1.0.1-py3-none-any.whl (4.1 kB view hashes)
Uploaded Nov 18, 2022 py3

photomaker-1.0.1-1-py3-none-any.whl (3.1 MB view hashes)
Uploaded Nov 18, 2022 py3

wechat_20240117181712 wechat_20240117181733 wechat_20240117181806

from photomaker.

Kallamamran avatar Kallamamran commented on June 12, 2024

I've done the fork -> spawn thing, but that still gives me an error

(venv) Q:\PhotoMaker>python gradio_demo/app.py
Traceback (most recent call last):
File "gradio_demo/app.py", line 17, in
from photomaker.pipeline import PhotoMakerStableDiffusionXLPipeline
ModuleNotFoundError: No module named 'photomaker.pipeline'

Will try moving the folder...

from photomaker.

NolenBrolen avatar NolenBrolen commented on June 12, 2024

Also changed the line of code from 'fork' to 'spawn' but I still get a similar ModuleNotFoundError
(venv-photomaker) C:\Users\USER\PhotoMaker>python gradio_demo/app.py Traceback (most recent call last): File "C:\Users\USER\PhotoMaker\gradio_demo\app.py", line 13, in <module> from photomaker.pipeline import PhotoMakerStableDiffusionXLPipeline ModuleNotFoundError: No module named 'photomaker'

from photomaker.

Kallamamran avatar Kallamamran commented on June 12, 2024

I had to install photomaker by "pip install photomaker" to get past that error, but I still have error I just posted about ๐Ÿค”

from photomaker.

NolenBrolen avatar NolenBrolen commented on June 12, 2024

I had to install photomaker by "pip install photomaker" to get past that error, but I still have error I just posted about ๐Ÿค”

This won't work cuz it's another library you're installing, which is used to make funny pictures https://pypi.org/project/photomaker/

I just tried the following:

  • in terminal type "Python" or "Python3"
  • then paste the code to download the models from huggingface: from huggingface_hub import hf_hub_download
    photomaker_path = hf_hub_download(repo_id="TencentARC/PhotoMaker", filename="photomaker-v1.bin", repo_type="model")
  • It's currently downloading so hope this fixes it

Edit: installing the models did not fix the ModuleNotFoundError: No Module named 'photomaker'

from photomaker.

tdslaine avatar tdslaine commented on June 12, 2024

I had to install photomaker by "pip install photomaker" to get past that error, but I still have error I just posted about ๐Ÿค”

This won't work cuz it's another library you're installing, which is used to make funny pictures https://pypi.org/project/photomaker/

I just tried the following:

* in terminal type "Python" or "Python3"

* then paste the code to download the models from huggingface: from huggingface_hub import hf_hub_download
  photomaker_path = hf_hub_download(repo_id="TencentARC/PhotoMaker", filename="photomaker-v1.bin", repo_type="model")

* It's currently downloading so hope this fixes it

Edit: installing the models did not fix the ModuleNotFoundError: No Module named 'photomaker'

try my solution -with all files into the gradient_demo folder, and adjusting the two .py files to not look into the photomaker studio as described above. it works for me until now - gotta wait for the download to finish

grafik

from photomaker.

Syndulla avatar Syndulla commented on June 12, 2024

Let us know if you get reasonable outputs. I followed the approach above and got Gradio running, but my outputs are a blobby brown noise.

from photomaker.

Kallamamran avatar Kallamamran commented on June 12, 2024

Allmost worked...

  1. Change line 42 in venv\Lib\site-packages\spaces\zero\wrappers.py from Process = multiprocessing.get_context('fork').Process to Process = multiprocessing.get_context('spawn').Process

  2. move the files in photomaker-dir to gradio_demo

  3. remove original photomaker-dir

  4. Change line 22 in pipeline.py from from photomaker.model import PhotoMakerIDEncoder to from model import PhotoMakerIDEncoder

  5. Change line 14 in app.py from from photomaker.pipeline import PhotoMakerStableDiffusionXLPipeline to from pipeline import PhotoMakerStableDiffusionXLPipeline

image

from photomaker.

xhoxye avatar xhoxye commented on June 12, 2024

E:\AI\Fooocus\PhotoMaker>.\python_embeded\python.exe -s PhotoMaker/app.py Traceback (most recent call last): File "E:\AI\Fooocus\PhotoMaker\PhotoMaker\app.py", line 10, in <module> import spaces File "E:\AI\Fooocus\PhotoMaker\python_embeded\lib\site-packages\spaces\__init__.py", line 10, in <module> from .zero.decorator import GPU File "E:\AI\Fooocus\PhotoMaker\python_embeded\lib\site-packages\spaces\zero\decorator.py", line 17, in <module> from . import client File "E:\AI\Fooocus\PhotoMaker\python_embeded\lib\site-packages\spaces\zero\client.py", line 17, in <module> from .gradio import get_event File "E:\AI\Fooocus\PhotoMaker\python_embeded\lib\site-packages\spaces\zero\gradio.py", line 8, in <module> from gradio.context import LocalContext ImportError: cannot import name 'LocalContext' from 'gradio.context' (E:\AI\Fooocus\PhotoMaker\python_embeded\lib\site-packages\gradio\context.py)
QQๆˆชๅ›พ20240117093636

from photomaker.

xhoxye avatar xhoxye commented on June 12, 2024

@dancemanUK
Please ask, why I downloaded the file according to your screenshot, and there is no response after it can be run, why is this?

from photomaker.

seoeaa avatar seoeaa commented on June 12, 2024

Guys, you donโ€™t need to be tricky, just put the file in the root and thatโ€™s it, change the extension to .py
app1.txt

from photomaker.

seoeaa avatar seoeaa commented on June 12, 2024

and put the style file in the root too

from photomaker.

sitzbrau avatar sitzbrau commented on June 12, 2024

Guys, you donโ€™t need to be tricky, just put the file in the root and thatโ€™s it, change the extension to .py app1.txt

running on sagemaker i've got this

(photomaker) studio-lab-user@default:~/PhotoMaker$ python app1.py
Loading pipeline components...: 100%|โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ| 7/7 [00:40<00:00,  5.81s/it]
Loading PhotoMaker components [1] id_encoder from [/home/studio-lab-user/.cache/huggingface/hub/models--TencentARC--PhotoMaker/snapshots/3602d02ba7cc99ce8886e24063ed10e4f2510c84]...
Loading PhotoMaker components [2] lora_weights from [/home/studio-lab-user/.cache/huggingface/hub/models--TencentARC--PhotoMaker/snapshots/3602d02ba7cc99ce8886e24063ed10e4f2510c84]
Running on local URL:  http://127.0.0.1:7860
2024/02/19 18:15:34 [W] [service.go:132] login to server failed: dial tcp 44.237.78.176:7000: i/o timeout

Could not create share link. Please check your internet connection or our status page: https://status.gradio.app.

from photomaker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.