-
Notifications
You must be signed in to change notification settings - Fork 45
/
likelihood.jl
46 lines (40 loc) · 1 KB
/
likelihood.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
push!(LOAD_PATH, "./src/")
using AdaGram
using AdaGram.ArgParse
using Distributed
s = ArgParseSettings()
@add_arg_table s begin
"model"
help = "path to serialized model"
arg_type = AbstractString
required = true
"text"
help = "text to measure likelihood"
arg_type = AbstractString
required = true
"--window"
help = "window size"
arg_type = Int
default = 5
"--workers"
help = "number of workers"
arg_type = Int
default = 1
"--minprob"
help = "minimum probability of a prototype"
arg_type = Float64
default = 0.005
"--batch"
help = "size of buffer read into memory"
arg_type = Int
default = 16777216
"--log"
help = "save intermediate averages to the file"
arg_type = AbstractString
end
args = parse_args(ARGS, s)
addprocs(args["workers"])
@everywhere using AdaGram
vm, dict = load_model(args["model"])
println(parallel_likelihood(vm, dict, args["text"], args["window"], args["minprob"];
batch=args["batch"], log=args["log"]))