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

Unable to download models because of this issue! #2972

Open
abenezerman opened this issue Jan 2, 2025 · 1 comment
Open

Unable to download models because of this issue! #2972

abenezerman opened this issue Jan 2, 2025 · 1 comment

Comments

@abenezerman
Copy link


HTTPError Traceback (most recent call last)
Cell In[3], line 22
16 Temporary_Storage = False
18 # Download the model to a temporary storage, bigger capacity but will be removed at session shutdown.
19
20
21 #--------------------
---> 22 model=mdls(Original_Model_Version, Path_to_MODEL, MODEL_LINK, Temporary_Storage)

File /notebooks/mainpaperspaceA1111.py:185, in mdls(Original_Model_Version, Path_to_MODEL, MODEL_LINK, Temporary_Storage)
183 model=f'/notebooks/sd/stable-diffusion-webui/models/Stable-diffusion/{modelname}'
184 if not os.path.exists(model):
--> 185 dwn(MODEL_LINK, model, 'Downloading the custom model')
186 clear_output()
187 else:

File /notebooks/mainpaperspaceA1111.py:91, in dwn(url, dst, msg)
89 file_size = None
90 req = Request(url, headers={"User-Agent": "torch.hub"})
---> 91 u = urlopen(req)
92 meta = u.info()
93 if hasattr(meta, 'getheaders'):

File /usr/lib/python3.11/urllib/request.py:216, in urlopen(url, data, timeout, cafile, capath, cadefault, context)
214 else:
215 opener = _opener
--> 216 return opener.open(url, data, timeout)

File /usr/lib/python3.11/urllib/request.py:525, in OpenerDirector.open(self, fullurl, data, timeout)
523 for processor in self.process_response.get(protocol, []):
524 meth = getattr(processor, meth_name)
--> 525 response = meth(req, response)
527 return response

File /usr/lib/python3.11/urllib/request.py:634, in HTTPErrorProcessor.http_response(self, request, response)
631 # According to RFC 2616, "2xx" code indicates that the client's
632 # request was successfully received, understood, and accepted.
633 if not (200 <= code < 300):
--> 634 response = self.parent.error(
635 'http', request, response, code, msg, hdrs)
637 return response

File /usr/lib/python3.11/urllib/request.py:563, in OpenerDirector.error(self, proto, *args)
561 if http_err:
562 args = (dict, 'default', 'http_error_default') + orig_args
--> 563 return self._call_chain(*args)

File /usr/lib/python3.11/urllib/request.py:496, in OpenerDirector._call_chain(self, chain, kind, meth_name, *args)
494 for handler in handlers:
495 func = getattr(handler, meth_name)
--> 496 result = func(*args)
497 if result is not None:
498 return result

File /usr/lib/python3.11/urllib/request.py:643, in HTTPDefaultErrorHandler.http_error_default(self, req, fp, code, msg, hdrs)
642 def http_error_default(self, req, fp, code, msg, hdrs):
--> 643 raise HTTPError(req.full_url, code, msg, hdrs, fp)

HTTPError: HTTP Error 401: Unauthorized

@SRagy
Copy link

SRagy commented Jan 3, 2025

Sounds like you're trying to download a model from somewhere you do not have permission to download from. If you're trying to download from civitai, note that sometimes you need an API key / token.

https://education.civitai.com/civitais-guide-to-downloading-via-api/

Once you obtain your token which will look something like A5f7MBpqO8Ez, the easiest way to use it is to append &token=A5f7MBpqO8Ez to the end of the download URL you currently have for download.

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