File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ function Booster(cache::AbstractVector{<:DMatrix};
108
108
model_file:: AbstractString = " " ,
109
109
tree_method:: Union{Nothing,AbstractString} = nothing ,
110
110
validate_parameters:: Bool = true ,
111
+ nthread= Threads. nthreads (),
111
112
kw...
112
113
)
113
114
o = Ref {BoosterHandle} ()
@@ -124,7 +125,7 @@ function Booster(cache::AbstractVector{<:DMatrix};
124
125
else
125
126
(tree_method= tree_method,)
126
127
end
127
- setparams! (b; validate_parameters, tm... , kw... )
128
+ setparams! (b; validate_parameters, nthread, tm... , kw... )
128
129
b
129
130
end
130
131
Booster (dm:: DMatrix ; kw... ) = Booster ([dm]; kw... )
Original file line number Diff line number Diff line change @@ -581,13 +581,13 @@ function _unsafe_dataiter_reset(ptr::Ptr)
581
581
end
582
582
583
583
function _dmatrix_caching_config_json (;cache_prefix:: AbstractString ,
584
- nthreads:: Union{Integer,Nothing} ,
584
+ nthreads:: Union{Integer, Nothing} ,
585
585
missing_value:: Float32 = NaN32 ,
586
586
)
587
587
d = Dict (" missing" => " __NAN_STR__" ,
588
588
" cache_prefix" => cache_prefix,
589
589
)
590
- isnothing (nthreads) || (d[" nthreads" ] = nthreads)
590
+ isnothing (nthreads) || (d[" nthreads" ] = string ( nthreads) )
591
591
# this is to strip out the special Float32 values to representations it'll accept
592
592
nanstr = if isnan (missing_value)
593
593
" NaN"
603
603
function DMatrix (itr:: DataIterator ;
604
604
missing_value:: Float32 = NaN32 ,
605
605
cache_prefix:: AbstractString = joinpath (tempdir ()," xgb-cache" ),
606
- nthreads:: Union{Integer,Nothing} = nothing ,
606
+ nthreads:: Union{Integer, Nothing} = Threads . nthreads () ,
607
607
kw...
608
608
)
609
609
o = Ref {DMatrixHandle} ()
You can’t perform that action at this time.
0 commit comments