Closed lazarusA closed 3 years ago
What do you mean? It works fine for me.
if do: (I'm also testing attention is all you need)
using ArgParse
using Flux, CUDA
using Flux: onecold, gradient, onehot
import Flux.Optimise: update!
using WordTokenizers
using Transformers
using Transformers.Basic
using Random
Random.seed!(0)
using Transformers.Datasets
using Transformers.Datasets: WMT, IWSLT
function parse_commandline()
s = ArgParseSettings()
@add_arg_table s begin
"--gpu", "-g"
help = "use gpu"
action = :store_true
"task"
help = "task name"
required = true
range_tester = x-> x ∈ ["wmt14", "iwslt2016", "copy"]
end
return parse_args(ARGS, s)
end
const args = parse_commandline()
then this errors:
ERROR: ArgParseError("required argument task was not provided")
Stacktrace:
[1] argparse_error(x::Any)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:9
[2] test_required_args(settings::ArgParseSettings, found_args::Set{AbstractString})
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:44
[3] parse_args_unhandled(args_list::Vector{T} where T, settings::ArgParseSettings, truncated_shopts::Bool)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:639
[4] parse_args_unhandled(args_list::Vector{T} where T, settings::ArgParseSettings)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:595
[5] parse_args(args_list::Vector{T} where T, settings::ArgParseSettings; as_symbols::Bool)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:469
[6] parse_args(args_list::Vector{T} where T, settings::ArgParseSettings)
@ ArgParse ~/.julia/packages/ArgParse/bylyV/src/parsing.jl:466
[7] parse_commandline()
@ Main ~/transformersApproach/0-data.jl:30
[8] top-level scope
@ REPL[3]:1
this is the output from ArgParseSettings(), if that helps.
ArgParseSettings()
ArgParseSettings(
prog=
description=
epilog=
usage=
version=Unspecified version
add_help=true
add_version=false
fromfile_prefix_chars=Set{Char}()
autofix_names=false
error_on_conflict=true
suppress_warnings=false
allow_ambiguous_opts=false
commands_are_required=true
default_group=
exc_handler=default_handler
preformatted_description=false
preformatted_epilog=false
exit_after_help=false
>> usage: <PROGRAM>
)
You need to run the code with the task argument. For example: $ julia --proj -i 1-model.jl copy
and here, yes of course, now I see it. However, using things like this just works with a final product [which is what you have here], however for debugging I find it a little bit cumbersome. For instance, here I also got the onehot error in this line
Another comment: I noticed that you have 2 train!() functions in the 0-data.jl file, and when running the code I believe the second one is used. I suppose both are ok. Plus, there is not a test section
or test example
which will be nice to have :D
Things seems to work. Now to the real problem. Thanks.
Hi, I had exactly the same issue just now :) I'll add a README if that's ok!
Another comment: I noticed that you have 2 train!() functions in the 0-data.jl file, and when running the code I believe the second one is used. I suppose both are ok.
the 2 train!
function are used for different task depend on the task you choose.
Plus, there is not a test section or test example which will be nice to have :D
There is a translate
function you could use to play with your model. The code is only meant to be run in the REPL to do some simple test, but you should be able to easily modified it for your own task if you are familiar with Flux
Also, this line not longer works.
https://github.com/chengchingwen/Transformers.jl/blob/5478c020dffcb06f9eebf79859a79937a91c30da/example/AttentionIsAllYouNeed/0-data.jl#L23
with the following env