OSError: Can't load config for 'prithivida/grammar_error_correcter'
Nomiluks opened this issue · comments
Hi, I have been using your code for the last few days. Suddenly, it started to crash.
Have a look at the code and error given below:
Code (Link: https://huggingface.co/prithivida/grammar_error_correcter_v1):
from gramformer import Gramformer
import torch
def set_seed(seed):
torch.manual_seed(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed_all(seed)
set_seed(1212)
gf = Gramformer(models = 2, use_gpu=False) # 0=detector, 1=highlighter, 2=corrector, 3=all
influent_sentences = [
"Matt like fish",
"the collection of letters was original used by the ancient Romans",
"We enjoys horror movies",
"Anna and Mike is going skiing",
"I walk to the store and I bought milk",
"We all eat the fish and then made dessert",
"I will eat fish for dinner and drank milk",
"what be the reason for everyone leave the company",
]
for influent_sentence in influent_sentences:
corrected_sentence = gf.correct(influent_sentence)
print("[Input] ", influent_sentence)
print("[Correction] ",corrected_sentence[0])
print("-" *100)
Error
404 Client Error: Not Found for url: https://huggingface.co/prithivida/grammar_error_correcter/resolve/main/config.json
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/transformers/configuration_utils.py in get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
491 use_auth_token=use_auth_token,
--> 492 user_agent=user_agent,
493 )
7 frames
/usr/local/lib/python3.7/dist-packages/transformers/file_utils.py in cached_path(url_or_filename, cache_dir, force_download, proxies, resume_download, user_agent, extract_compressed_file, force_extract, use_auth_token, local_files_only)
1278 use_auth_token=use_auth_token,
-> 1279 local_files_only=local_files_only,
1280 )
/usr/local/lib/python3.7/dist-packages/transformers/file_utils.py in get_from_cache(url, cache_dir, force_download, proxies, etag_timeout, resume_download, user_agent, use_auth_token, local_files_only)
1441 r = requests.head(url, headers=headers, allow_redirects=False, proxies=proxies, timeout=etag_timeout)
-> 1442 r.raise_for_status()
1443 etag = r.headers.get("X-Linked-Etag") or r.headers.get("ETag")
/usr/local/lib/python3.7/dist-packages/requests/models.py in raise_for_status(self)
942 if http_error_msg:
--> 943 raise HTTPError(http_error_msg, response=self)
944
HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/prithivida/grammar_error_correcter/resolve/main/config.json
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
<ipython-input-10-0f43e537fe87> in <module>
10
11
---> 12 gf = Gramformer(models = 2, use_gpu=False) # 0=detector, 1=highlighter, 2=corrector, 3=all
13
14 influent_sentences = [
/usr/local/lib/python3.7/dist-packages/gramformer/gramformer.py in __init__(self, models, use_gpu)
14
15 if models == 2:
---> 16 self.correction_tokenizer = AutoTokenizer.from_pretrained(correction_model_tag)
17 self.correction_model = AutoModelForSeq2SeqLM.from_pretrained(correction_model_tag)
18 self.correction_model = self.correction_model.to(device)
/usr/local/lib/python3.7/dist-packages/transformers/models/auto/tokenization_auto.py in from_pretrained(cls, pretrained_model_name_or_path, *inputs, **kwargs)
400 kwargs["_from_auto"] = True
401 if not isinstance(config, PretrainedConfig):
--> 402 config = AutoConfig.from_pretrained(pretrained_model_name_or_path, **kwargs)
403
404 use_fast = kwargs.pop("use_fast", True)
/usr/local/lib/python3.7/dist-packages/transformers/models/auto/configuration_auto.py in from_pretrained(cls, pretrained_model_name_or_path, **kwargs)
428 """
429 kwargs["_from_auto"] = True
--> 430 config_dict, _ = PretrainedConfig.get_config_dict(pretrained_model_name_or_path, **kwargs)
431 if "model_type" in config_dict:
432 config_class = CONFIG_MAPPING[config_dict["model_type"]]
/usr/local/lib/python3.7/dist-packages/transformers/configuration_utils.py in get_config_dict(cls, pretrained_model_name_or_path, **kwargs)
502 f"- or '{pretrained_model_name_or_path}' is the correct path to a directory containing a {CONFIG_NAME} file\n\n"
503 )
--> 504 raise EnvironmentError(msg)
505
506 except json.JSONDecodeError:
OSError: Can't load config for 'prithivida/grammar_error_correcter'. Make sure that:
- 'prithivida/grammar_error_correcter' is a correct model identifier listed on 'https://huggingface.co/models'
- or 'prithivida/grammar_error_correcter' is the correct path to a directory containing a config.json file
![Screenshot from 2021-07-01 18-36-07](https://user-images.githubusercontent.com/4704211/124133526-5a9da900-da9b-11eb-9733-61df46ab01e1.png)
Possible Solution:
Rename this link from: https://huggingface.co/prithivida/grammar_error_correcter/
to: https://huggingface.co/prithivida/grammar_error_correcter_v1/
Please help me fix this. thank you
That's by design
'prithivida/grammar_error_correcter' is not available anymore. Check the read me.
You can do the following either manually change the model tag to
'prithivida/grammar_error_correcter_v1'
Or do a brand new install of the Gramformer in a new virtual environment or conda env.