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

Can't install the model with HuggingFace #2

Open
AlexisPister opened this issue Mar 22, 2022 · 2 comments
Open

Can't install the model with HuggingFace #2

AlexisPister opened this issue Mar 22, 2022 · 2 comments

Comments

@AlexisPister
Copy link

Hi,

When I am trying to import the model with HuggingFace like this :

tokenizer = AutoTokenizer.from_pretrained("af1tang/personaGPT")
model = AutoModelForCausalLM.from_pretrained("af1tang/personaGPT")

I get the following error :

Traceback (most recent call last):
  File "/home/alexis/Documents/Projets/StudioArtScience/main.py", line 7, in <module>
    tokenizer = AutoTokenizer.from_pretrained("af1tang/personaGPT")
  File "/home/alexis/anaconda3/envs/StudioArtScience/lib/python3.10/site-packages/transformers/models/auto/tokenization_auto.py", line 531, in from_pretrained
    return tokenizer_class.from_pretrained(pretrained_model_name_or_path, *inputs, **kwargs)
  File "/home/alexis/anaconda3/envs/StudioArtScience/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 1744, in from_pretrained
    return cls._from_pretrained(
  File "/home/alexis/anaconda3/envs/StudioArtScience/lib/python3.10/site-packages/transformers/tokenization_utils_base.py", line 1879, in _from_pretrained
    tokenizer = cls(*init_inputs, **init_kwargs)
  File "/home/alexis/anaconda3/envs/StudioArtScience/lib/python3.10/site-packages/transformers/models/gpt2/tokenization_gpt2_fast.py", line 137, in __init__
    super().__init__(
  File "/home/alexis/anaconda3/envs/StudioArtScience/lib/python3.10/site-packages/transformers/tokenization_utils_fast.py", line 108, in __init__
    fast_tokenizer = TokenizerFast.from_file(fast_tokenizer_file)
Exception: No such file or directory (os error 2)

Is there a way around this ?

@mrzjy
Copy link

mrzjy commented Apr 6, 2022

It seems that the tokenizer path (field "tokenizer_file" and "name_or_path") in tokenizer_config.json is inappropriate.

Manually changing the path in tokenizer_config.json to your correct local path (whether it's the huggingface cache dir or any specified dir where you downloaded your model by git lfs clone https://huggingface.co/af1tang/personaGPT) should solve the problem

@drusepth
Copy link

drusepth commented Jan 6, 2023

You can also bypass this issue by setting use_fast=False in the AutoTokenizer.from_pretrained initialization.

tokenizer = AutoTokenizer.from_pretrained("af1tang/personaGPT", use_fast=False)

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

3 participants