chengchingwen / Transformers.jl

Julia Implementation of Transformer models
MIT License
523 stars 74 forks source link

Downloading BERT yields a 404 #139

Closed PGimenez closed 1 year ago

PGimenez commented 1 year ago

When trying the example from the README, I can't download the model as I get A 404 not found. I'm on [21ca0261] Transformers v0.2.4

julia> textencoder, bert_model = hgf"bert-base-uncased"
ERROR: request status HTTP/2 404
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] status_error(resp::Downloads.Response, log::Nothing)
    @ HuggingFaceApi ~/.julia/packages/HuggingFaceApi/oDbYr/src/utils.jl:17
  [3] status_error_w_ecode(resp::Downloads.Response)
    @ HuggingFaceApi ~/.julia/packages/HuggingFaceApi/oDbYr/src/utils.jl:36
  [4] _info(type::String, repo_id::String, revision::Nothing, token::Nothing)
    @ HuggingFaceApi ~/.julia/packages/HuggingFaceApi/oDbYr/src/api.jl:90
  [5] list_repo_files(type::String, repo_id::String, revision::Nothing, token::Nothing)
    @ HuggingFaceApi ~/.julia/packages/HuggingFaceApi/oDbYr/src/api.jl:97
  [6] list_model_files
    @ ~/.julia/packages/HuggingFaceApi/oDbYr/src/api.jl:126 [inlined]
  [7] #list_model_files#32
    @ ~/.julia/packages/HuggingFaceApi/oDbYr/src/api.jl:128 [inlined]
  [8] list_model_files
    @ ~/.julia/packages/HuggingFaceApi/oDbYr/src/api.jl:128 [inlined]
  [9] #_ensure#3
    @ ~/.julia/packages/Transformers/zms6Y/src/huggingface/utils.jl:11 [inlined]
 [10] _ensure
    @ ~/.julia/packages/Transformers/zms6Y/src/huggingface/utils.jl:11 [inlined]
 [11] #ensure_possible_files#4
    @ ~/.julia/packages/Transformers/zms6Y/src/huggingface/utils.jl:13 [inlined]
 [12] ensure_possible_files
    @ ~/.julia/packages/Transformers/zms6Y/src/huggingface/utils.jl:13 [inlined]
 [13] load_tokenizer(model_name::String; possible_files::Nothing, config::Transformers.HuggingFace.HGFConfig{:bert, JSON3.Object{Vector{UInt8}, Vector{UInt64}}, Nothing}, kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Transformers.HuggingFace ~/.julia/packages/Transformers/zms6Y/src/huggingface/tokenizer/tokenizer.jl:11
 [14] load_hgf_pretrained(name::String; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Transformers.HuggingFace ~/.julia/packages/Transformers/zms6Y/src/huggingface/HuggingFace.jl:51
 [15] load_hgf_pretrained(name::String)
    @ Transformers.HuggingFace ~/.julia/packages/Transformers/zms6Y/src/huggingface/HuggingFace.jl:38
 [16] top-level scope
    @ REPL[27]:1
chengchingwen commented 1 year ago

I could not reproduce the error, can you check if you can access url like https://huggingface.co/bert-base-uncased/resolve/main/config.json on that machine?

PGimenez commented 1 year ago

@chengchingwen thanks for checking. It fixed itself somehow, working fine now. I was making a new Genie demo with Transformers.jl :) https://github.com/GenieFramework/GenieFrameworkDemos/tree/main/BERTEmbeddings