Cause:
Originally, there was a saved_model folder under the two folders sort_change_nlp and sort_nlp, but the names were different, one was saved_model and the other was saved_model_copy. Using saved_model in http_sever clock, the following error occurred:
model = YesOrNoModel.from_pretrained(model_name)
def is_model_answer(query):
for rule in base_data.q_v_model_list:
result1 = re.compile(rule).findall(query)
if len(result1):
return "saved_model"
return ""
model_name = is_model_answer(query)
print(f"model_name={model_name},answer={answer}")
if len(model_name):
model = YesOrNoModel.from_pretrained(model_name)
Error:
ssh://[email protected]:22/usr/bin/python -u /opt/program_files/python/local_map_python_work/judge/sort_proj/test.py 404 Client Error: Not Found for url: https://huggingface.co/saved_model/resolve/main/config.json Traceback (most recent call last): File "/root/.local/lib/python3.6/site-packages/transformers/configuration_utils.py", line 520, in get_config_dict user_agent=user_agent, File "/root/.local/lib/python3.6/site-packages/transformers/file_utils.py", line 1371, in cached_path local_files_only=local_files_only, File "/root/.local/lib/python3.6/site-packages/transformers/file_utils.py", line 1534, in get_from_cache r.raise_for_status() File "/usr/local/python3/lib/python3.6/site-packages/requests/models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/saved_model/resolve/main/config.json During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/program_files/python/local_map_python_work/judge/sort_proj/test.py", line 22, in <module> model = YesOrNoModel.from_pretrained("saved_model") File "/root/.local/lib/python3.6/site-packages/transformers/modeling_utils.py", line 1196, in from_pretrained **kwargs, File "/root/.local/lib/python3.6/site-packages/transformers/configuration_utils.py", line 455, in from_pretrained config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs) File "/root/.local/lib/python3.6/site-packages/transformers/configuration_utils.py", line 532, in get_config_dict raise EnvironmentError(msg) OSError: Can't load config for 'saved_model'. Make sure that: - 'saved_model' is a correct model identifier listed on 'https://huggingface.co/models' - or 'saved_model' is the correct path to a directory containing a config.json file
Solution:
The reason is that http.server is a level folder with sort_change_nlp and sort_nlp, so the path passed in when calling the model should be: sort_change_nlp/saved_model or sort_nlp, saved_model_copy
Read More:
- Python error: urllib.error.HTTPError : http Error 404: not found
- `Model.XXX` is not supported when the `Model` instance was constructed with eager mode enabled
- Using Python error urlopen error unknown URL type: the solution of HTTPS
- [Solved] Connection Error: couldn‘t reach http://raw.githubusercontent.com/huggingface/…
- Pytorch Loading model error: RuntimeError: Error(s) in loading state_dict for Model: Missing key(s) in state_dict
- pytorch model.load_state_dict Error [How to Solve]
- Using postman Test Django Interface error: RuntimeError:You called this URL via POST,but the URL doesn‘t end in a slash
- pytorch RuntimeError: Error(s) in loading state_ Dict for dataparall… Import model error solution
- urllib.error.HTTPError: HTTP Error 403: Forbidden [How to Solve]
- Python asynchronous co process crawler error: [aiohttp. Client]_ Exceptions: serverdisconnected error: Server Disconnected]
- [Solved] PyTorch Load Model Error: Missing key(s) RuntimeError: Error(s) in loading state_dict for
- import statsmodels.api as sm Error: ImportError: DLL load failed while importing _arpack: The specified program could not be found.
- [Mac Pro M1] Python3.9 import cv2 Error: Reason: image not found
- [Solved] Request.url is not modifiable, use Request.replace() instead
- [Solved] pyhive error: Could not start SASL: b’Error in sasl_client_start (-4) SASL(-4)
- [Solved] Pdfplumber Read PDF Sheet Error: AttributeError: function/symbol ‘ARC4_stream_init‘ not found in library
- How to Solve keras load_model() Error
- Import win32API; importerror: DLL load failed: the specified program was not found
- urllib.error.HTTPError http error 403 forbidden
- [ONNXRuntimeError] : 10 : INVALID_Graph loading model error