wandb 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wandb/version.rb +1 -1
- data/lib/wandb/xgboost_callback.rb +24 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 310ede46ccba30aa00bfbb81fbb8ffdefd818528c7ae09523e7dca9629258892
|
4
|
+
data.tar.gz: 07643a463e807e99db1a4e874bd85b749f6d65b644f15e0423505ead63ec7749
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00e7a6fe5e888d931c1abbc6047207859a46b024c83a05a6e87feeea8d20576f2f3da1d6a5c851c9dd945e7bd564ecfc56b5c4707ed3b54284aea97ecb4dac46
|
7
|
+
data.tar.gz: d4b2c592d6a4a5e079024d48cb7a97834a883f1e5e12dbe1c856255d4beed84c90f54f629d818cad14513f4778b08657e6781c958ff977fe607d1a74c0a2deec
|
data/lib/wandb/version.rb
CHANGED
@@ -19,7 +19,7 @@ module Wandb
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
attr_accessor :project_name, :api_key
|
22
|
+
attr_accessor :project_name, :api_key, :custom_loggers
|
23
23
|
|
24
24
|
def initialize(options = {})
|
25
25
|
options = Opts.new(options)
|
@@ -29,22 +29,21 @@ module Wandb
|
|
29
29
|
@define_metric = options.default(:define_metric, true)
|
30
30
|
@api_key = options.default(:api_key, ENV["WANDB_API_KEY"])
|
31
31
|
@project_name = options.default(:project_name, nil)
|
32
|
-
|
33
|
-
raise "WANDB_API_KEY required" unless api_key
|
34
|
-
raise "project_name required" unless project_name
|
35
|
-
|
36
|
-
Wandb.login(api_key: api_key)
|
37
|
-
Wandb.init(project: project_name)
|
38
|
-
|
39
|
-
return if Wandb.current_run
|
40
|
-
|
41
|
-
raise "You must call wandb.init() before WandbCallback()"
|
32
|
+
@custom_loggers = options.default(:custom_loggers, [])
|
42
33
|
end
|
43
34
|
|
44
35
|
def before_training(model)
|
45
|
-
|
46
|
-
Wandb.
|
47
|
-
|
36
|
+
Wandb.login(api_key: api_key)
|
37
|
+
Wandb.init(project: project_name)
|
38
|
+
config = JSON.parse(model.save_config)
|
39
|
+
log_conf = {
|
40
|
+
learning_rate: config.dig("learner", "gradient_booster", "tree_train_param", "learning_rate").to_f,
|
41
|
+
max_depth: config.dig("learner", "gradient_booster", "tree_train_param", "max_depth").to_f,
|
42
|
+
n_estimators: model.num_boosted_rounds
|
43
|
+
}
|
44
|
+
Wandb.current_run.config = log_conf
|
45
|
+
|
46
|
+
Wandb.log(log_conf)
|
48
47
|
model
|
49
48
|
end
|
50
49
|
|
@@ -57,7 +56,7 @@ module Wandb
|
|
57
56
|
|
58
57
|
# Log best score and best iteration
|
59
58
|
unless model.best_score
|
60
|
-
|
59
|
+
finish
|
61
60
|
return model
|
62
61
|
end
|
63
62
|
|
@@ -65,18 +64,21 @@ module Wandb
|
|
65
64
|
"best_score" => model.best_score.to_f,
|
66
65
|
"best_iteration" => model.best_iteration.to_i
|
67
66
|
)
|
68
|
-
|
69
|
-
Wandb.finish
|
70
|
-
FileUtils.rm_rf(Rails.root.join("wandb"))
|
67
|
+
finish
|
71
68
|
|
72
69
|
model
|
73
70
|
end
|
74
71
|
|
72
|
+
def finish
|
73
|
+
Wandb.finish
|
74
|
+
FileUtils.rm_rf(File.join(Dir.pwd, "wandb"))
|
75
|
+
end
|
76
|
+
|
75
77
|
def before_iteration(_model, _epoch, _history)
|
76
78
|
false
|
77
79
|
end
|
78
80
|
|
79
|
-
def after_iteration(
|
81
|
+
def after_iteration(model, epoch, history)
|
80
82
|
history.each do |split, metric_scores|
|
81
83
|
metric = metric_scores.keys.first
|
82
84
|
values = metric_scores.values.last
|
@@ -86,6 +88,9 @@ module Wandb
|
|
86
88
|
full_metric_name = "#{split}-#{metric}"
|
87
89
|
Wandb.log({ full_metric_name => epoch_value })
|
88
90
|
end
|
91
|
+
@custom_loggers.each do |logger|
|
92
|
+
logger.call(model, epoch, history)
|
93
|
+
end
|
89
94
|
Wandb.log("epoch" => epoch)
|
90
95
|
false
|
91
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wandb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Shollenberger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pycall
|