Code Monkey home page Code Monkey logo

Comments (6)

brycedrennan avatar brycedrennan commented on July 3, 2024

Can I see the full stack trace?

from imaginairy.

whab avatar whab commented on July 3, 2024

For Face Enhancement, I figured out that the detection_Resnet50_Final.pth and parsing_parsenet.pth weight files were not showing in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/facexlib/weights/. Downloading them manually and moving them there solved the issue for the --fix-faces option. However I could find figure out the issue for Automated Replacement.

Here is the full stack trace when running the command: imagine "a couple smiling" --fix-faces

🤖🧠 imaginAIry received 1 prompt(s) and will repeat them 1 times to create 1 images.
Loading model onto mps:0 backend...
Generating 🖼 : "a couple smiling" 512x512px seed:573948737 prompt-strength:7.5 steps:40 sampler-type:plms
PLMS Sampler: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 40/40 [01:17<00:00, 1.93s/it]
Fixing 😊 's in 🖼 using CodeFormer...
Downloading: "https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth" to /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/facexlib/weights/detection_Resnet50_Final.pth

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1328, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1037, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 975, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1454, in connect
self.sock = self._context.wrap_socket(self.sock,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 513, in wrap_socket
return self.sslsocket_class._create(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1071, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1342, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/bin/imagine", line 8, in
sys.exit(imagine_cmd())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/cmds.py", line 207, in imagine_cmd
imagine_image_files(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/api.py", line 132, in imagine_image_files
for result in imagine(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/api.py", line 334, in imagine
img = enhance_faces(img, fidelity=0.2)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/enhancers/face_restoration_codeformer.py", line 37, in enhance_faces
face_helper = FaceRestoreHelper(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/facexlib/utils/face_restoration_helper.py", line 99, in init
self.face_det = init_detection_model(det_model, half=False, device=self.device, model_rootpath=model_rootpath)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/facexlib/detection/init.py", line 18, in init_detection_model
model_path = load_file_from_url(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/facexlib/utils/misc.py", line 77, in load_file_from_url
download_url_to_file(url, cached_file, hash_prefix=None, progress=progress)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/torch/hub.py", line 593, in download_url_to_file
u = urlopen(req)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

Here is the full stack trace when running the command: imagine --init-image pearl000.jpg --mask-prompt face --mask-mode keep --init-image-strength .4 "a female doctor"

🤖🧠 imaginAIry received 1 prompt(s) and will repeat them 1 times to create 1 images.
Sampler type switched to ddim for img2img
Loading model onto mps:0 backend...
Generating 🖼 : "a female doctor" 512x512px seed:855732311 prompt-strength:7.5 steps:40 sampler-type:ddim
Loaded input 🖼 of size (384, 512) from pearl000.jpg
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1328, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1037, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 975, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/http/client.py", line 1454, in connect
self.sock = self._context.wrap_socket(self.sock,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 513, in wrap_socket
return self.sslsocket_class._create(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1071, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1342, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/bin/imagine", line 8, in
sys.exit(imagine_cmd())
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/cmds.py", line 207, in imagine_cmd
imagine_image_files(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/api.py", line 132, in imagine_image_files
for result in imagine(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/api.py", line 232, in imagine
mask_image = get_img_mask(init_image, prompt.mask_prompt)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/enhancers/clip_masking.py", line 31, in get_img_mask
return get_img_masks(img, descriptions, combine=True)[0]
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/enhancers/clip_masking.py", line 49, in get_img_masks
preds = clip_mask_model()(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/enhancers/clip_masking.py", line 16, in clip_mask_model
model = CLIPDensePredT(version="ViT-B/16", reduce_dim=64)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/vendored/clipseg/init.py", line 428, in init
super().init(version, reduce_cond, reduce_dim, prompt, n_tokens)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/vendored/clipseg/init.py", line 148, in init
self.clip_model, _ = clip.load(version, device="cpu", jit=False)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/vendored/clip/clip.py", line 147, in load
model_path = _download(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/imaginairy/vendored/clip/clip.py", line 65, in _download
with urllib.request.urlopen(url) as source, open(download_target, "wb") as output:
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 216, in urlopen
return opener.open(url, data, timeout)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 519, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 496, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/urllib/request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)>

from imaginairy.

brycedrennan avatar brycedrennan commented on July 3, 2024

This seems unrelated to the imaginairy library. https://stackoverflow.com/questions/70977935/why-do-i-receive-unable-to-get-local-issuer-certificate-ssl-c997

if you just write a python script that does this, does it work or have the same error?

requests.get("https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth")

from imaginairy.

whab avatar whab commented on July 3, 2024

No error produced when running the command: requests.get("https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth")

from imaginairy.

brycedrennan avatar brycedrennan commented on July 3, 2024

okay 🤷‍♂️ well I don't know then. let me know if you figure it out.

As I believe this is an issue with your environment, I'm closing the issue for now. Happy to reopen if we learn more about the problem.

from imaginairy.

whab avatar whab commented on July 3, 2024

Thanks a lot! Seems to be an issue specific to the Python installation on newest macOS. I followed the macOS solution from the stackoverflow link you provided above: went to the Applications/Python 3.10 folder and clicked on the "install certificate.command" to fix the CERTIFICATE_VERIFY_FAILED issue. Then no more issue with the imagine options to perform automated replacement or face enhancement.

from imaginairy.

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.