Module: Wandb
- Includes:
- PyCall::Import
- Defined in:
- lib/wandb.rb,
lib/wandb/version.rb,
lib/wandb/xgboost_callback.rb
Defined Under Namespace
Classes: Api, Artifact, Plot, Project, Run, Table, XGBoostCallback
Constant Summary collapse
- VERSION =
"0.1.13"
Class Attribute Summary collapse
-
.current_run ⇒ Object
readonly
Get the current run.
Class Method Summary collapse
-
.__pyptr__ ⇒ Object
Lazy-load the wandb Python module.
-
.api ⇒ Object
Access the Wandb API.
-
.artifact(*args, **kwargs) ⇒ Object
Expose wandb.Artifact.
-
.define_metric(metric_name, **kwargs) ⇒ Object
Expose define_metric.
- .error ⇒ Object
-
.finish ⇒ Object
Finish the current run.
-
.init(**kwargs) ⇒ Object
Initialize a new run.
- .latest_run ⇒ Object
- .latest_run=(run) ⇒ Object
-
.log(metrics = {}) ⇒ Object
Log metrics to the current run.
-
.login(api_key: nil, **kwargs) ⇒ Object
Login to Wandb.
- .plot ⇒ Object
- .run_url ⇒ Object
Class Attribute Details
.current_run ⇒ Object (readonly)
Get the current run
59 60 61 |
# File 'lib/wandb.rb', line 59 def current_run @current_run end |
Class Method Details
.__pyptr__ ⇒ Object
Lazy-load the wandb Python module
14 15 16 |
# File 'lib/wandb.rb', line 14 def __pyptr__ @wandb ||= PyCall.import_module("wandb") end |
.api ⇒ Object
Access the Wandb API
76 77 78 |
# File 'lib/wandb.rb', line 76 def api @api ||= Api.new(__pyptr__.Api.new) end |
.artifact(*args, **kwargs) ⇒ Object
Expose wandb.Artifact
28 29 30 31 |
# File 'lib/wandb.rb', line 28 def artifact(*args, **kwargs) py_artifact = __pyptr__.Artifact.new(*args, **kwargs) Artifact.new(py_artifact) end |
.define_metric(metric_name, **kwargs) ⇒ Object
Expose define_metric
23 24 25 |
# File 'lib/wandb.rb', line 23 def define_metric(metric_name, **kwargs) __pyptr__.define_metric(name: metric_name.force_encoding("UTF-8"), **kwargs) end |
.error ⇒ Object
33 34 35 |
# File 'lib/wandb.rb', line 33 def error __pyptr__.Error end |
.finish ⇒ Object
Finish the current run
69 70 71 72 73 |
# File 'lib/wandb.rb', line 69 def finish @current_run.finish if @current_run @current_run = nil __pyptr__.finish end |
.init(**kwargs) ⇒ Object
Initialize a new run
45 46 47 48 |
# File 'lib/wandb.rb', line 45 def init(**kwargs) run = __pyptr__.init(**kwargs) @current_run = Run.new(run) end |
.latest_run ⇒ Object
54 55 56 |
# File 'lib/wandb.rb', line 54 def latest_run @latest_run end |
.latest_run=(run) ⇒ Object
50 51 52 |
# File 'lib/wandb.rb', line 50 def latest_run=(run) @latest_run = run end |
.log(metrics = {}) ⇒ Object
Log metrics to the current run
62 63 64 65 66 |
# File 'lib/wandb.rb', line 62 def log(metrics = {}) raise "No active run. Call Wandb.init() first." unless @current_run @current_run.log(metrics.symbolize_keys) end |
.login(api_key: nil, **kwargs) ⇒ Object
Login to Wandb
38 39 40 41 42 |
# File 'lib/wandb.rb', line 38 def login(api_key: nil, **kwargs) kwargs = kwargs.to_h kwargs[:key] = api_key if api_key __pyptr__.login(**kwargs) end |
.plot ⇒ Object
18 19 20 |
# File 'lib/wandb.rb', line 18 def plot(*args, **kwargs) __pyptr__.plot(*args, **kwargs) end |
.run_url ⇒ Object
84 85 86 87 88 |
# File 'lib/wandb.rb', line 84 def run_url raise "No active run. Call Wandb.init() first." unless @current_run @current_run.url end |