chengchingwen / Transformers.jl

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

Download fails with pretrain macro on Linux #87

Closed stefanjwojcik closed 2 years ago

stefanjwojcik commented 2 years ago

Thank you for this awesome package, I'm excited to use it. I can't figure out why I'm unable to download any pretrained models. I'm running the following very basic example on Pop! OS 21.XXX.

using Transformers
using Transformers.Basic
using Transformers.Pretrain

ENV["DATADEPS_ALWAYS_ACCEPT"] = true

bert_model, wordpiece, tokenizer = pretrain"bert-uncased_L-12_H-768_A-12"

I keep getting an error related to 'gcode', but I can't figure out what's going on - it seems like it's looking for a cookie and can't find it. Error is this:

[ Info: retrying...
┌ Warning: gcode not found.
│   rq =
│    HTTP.Messages.Response:
│    """
│    HTTP/1.1 200 OK
│    Content-Type: text/html; charset=utf-8
│    Cache-Control: no-cache, no-store, max-age=0, must-revalidate
│    Pragma: no-cache
│    Expires: Mon, 01 Jan 1990 00:00:00 GMT
│    Date: Sun, 06 Mar 2022 19:57:54 GMT
│    Content-Length: 2219
│    Strict-Transport-Security: max-age=31536000
│    Report-To: {"group":"DriveUntrustedContentHttp","max_age":2592000,"endpoints":[{"url":"https://csp.withgoogle.com/csp/report-to/DriveUntrustedContentHttp/external"}]}
│    Content-Security-Policy: require-trusted-types-for 'script';report-uri /_/DriveUntrustedContentHttp/cspreport, script-src 'report-sample' 'nonce-z+pwOrMQK8lSU6CRZfoQOw' 'unsafe-inline';object-src 'none';base-uri 'self';report-uri /_/DriveUntrustedContentHttp/cspreport;worker-src 'self'
│    Cross-Origin-Opener-Policy: same-origin; report-to="DriveUntrustedContentHttp"
│    Server: ESF
│    X-XSS-Protection: 0
│    X-Frame-Options: SAMEORIGIN
│    X-Content-Type-Options: nosniff
│    Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
│    
│    """
└ @ Transformers.Datasets ~/.julia/packages/Transformers/ko7g9/src/datasets/download_utils.jl:67
ERROR: download failed
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] download_gdrive(::String, ::String; retry::Bool, retries::Int64) at /home/swojcik/.julia/packages/Transformers/ko7g9/src/datasets/download_utils.jl:73
 [3] download_gdrive at /home/swojcik/.julia/packages/Transformers/ko7g9/src/datasets/download_utils.jl:55 [inlined]
 [4] run_fetch at /home/swojcik/.julia/packages/DataDeps/ooWXe/src/resolution_automatic.jl:99 [inlined]
 [5] download(::DataDeps.DataDep{String,String,typeof(Transformers.Datasets.download_gdrive),typeof(identity)}, ::String; remotepath::String, i_accept_the_terms_of_use::Nothing, skip_checksum::Bool) at /home/swojcik/.julia/packages/DataDeps/ooWXe/src/resolution_automatic.jl:78
 [6] download at /home/swojcik/.julia/packages/DataDeps/ooWXe/src/resolution_automatic.jl:70 [inlined]
 [7] handle_missing at /home/swojcik/.julia/packages/DataDeps/ooWXe/src/resolution_automatic.jl:10 [inlined]
 [8] _resolve(::DataDeps.DataDep{String,String,typeof(Transformers.Datasets.download_gdrive),typeof(identity)}, ::String) at /home/swojcik/.julia/packages/DataDeps/ooWXe/src/resolution.jl:83
 [9] resolve(::DataDeps.DataDep{String,String,typeof(Transformers.Datasets.download_gdrive),typeof(identity)}, ::String, ::String) at /home/swojcik/.julia/packages/DataDeps/ooWXe/src/resolution.jl:29
 [10] resolve(::String, ::String, ::String) at /home/swojcik/.julia/packages/DataDeps/ooWXe/src/resolution.jl:54
 [11] resolve at /home/swojcik/.julia/packages/DataDeps/ooWXe/src/resolution.jl:73 [inlined]
 [12] load_pretrain(::String; kw::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at /home/swojcik/.julia/packages/Transformers/ko7g9/src/pretrain/Pretrain.jl:59
 [13] load_pretrain(::String) at /home/swojcik/.julia/packages/Transformers/ko7g9/src/pretrain/Pretrain.jl:57
 [14] top-level scope at REPL[12]:1
chengchingwen commented 2 years ago

Which version of Transformers.jl are you using? The gcode was some protocol relative stuff we need when downloading data from google drive, but that has changed recently. With the new Transformers.jl v0.1.15 (which use Fetch.jl v0.1.3 for downloading) that problem should be fixed.

stefanjwojcik commented 2 years ago

Thank you for your reply. I used the package manager to install on Julia 1.5, so I will update my Julia version and try out the latest version of Transformers. I'll let you know if it doesn't work.