shap-e
shap-e copied to clipboard
SSL issue when I tried to use the library in command line
I have an SSL issue it seems due to when it trys to download the .pt files for the model from azure. I can download them manually using the browser but from a sample python command line program that I wrote I get an SSL issue from the request library
**C:\projects\sample1\fastapiasdproject>python text23d.py Token will not been saved to git credential helper. Pass add_to_git_credential=True if you want to set the git credential as well. Token is valid. Your token has been saved to C:\Users\iqbal.cache\huggingface\tokenQ Login successful Traceback (most recent call last): File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 1042, in validate_conn conn.connect() File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 414, in connect self.sock = ssl_wrap_socket( ^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = ssl_wrap_socket_impl( ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 517, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1075, in _create self.do_handshake() File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1346, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\adapters.py", line 489, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\retry.py", line 550, in increment raise six.reraise(type(error), error, _stacktrace) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\packages\six.py", line 769, in reraise raise value.with_traceback(tb) File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request self._validate_conn(conn) File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 1042, in validate_conn conn.connect() File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 414, in connect self.sock = ssl_wrap_socket( ^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = ssl_wrap_socket_impl( ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 517, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1075, in _create self.do_handshake() File "C:\Users\iqbal\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1346, in do_handshake self._sslobj.do_handshake() urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\projects\sample1\fastapiasdproject\text23d.py", line 139, in
I found a potential fix by manually changing download.py , the fetch_file_cached method, however I don't think that disabling SSL and adding a user agent is a permanent fix. Is there a better way to do it? Thank you!
`
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
}
response = requests.get(url, stream=True, verify=False, headers=headers)
`
my suggestion is just create a cache folder and save the manually downloaded .pt files there. then pass folder's address to load_model function as cache_dir.
load_model('transmitter', device=device, cache_dir=address)