-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwandbcpp.hpp
83 lines (56 loc) · 2.19 KB
/
wandbcpp.hpp
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#ifndef WANDBCPP_HPP_
#define WANDBCPP_HPP_
#include <Python.h>
#include <string>
#include <vector>
#include "src/py_object.hpp"
#include "src/py_util.hpp"
#include "src/utils.hpp"
#include "src/wandb_object.hpp"
namespace wandbcpp {
class wandb {
internal::object::SharedPyObjectPtr wandb_module_; // wandb module
internal::object::SharedPyObjectPtr run_; // run object
internal::object::SharedPyObjectPtr init_; // init function
internal::object::SharedPyObjectPtr log_; // log function
internal::object::SharedPyObjectPtr config_; // config object
internal::object::SharedPyObjectPtr config_update_; // config.update function
internal::object::SharedPyObjectPtr summary_; // summary object
internal::object::SharedPyObjectPtr
summary_update_; // summary.update function
internal::object::SharedPyObjectPtr save_; // save function
internal::object::SharedPyObjectPtr finish_; // finish function
public:
wandb();
~wandb() {}
struct init_args {
std::string project;
std::string entity = "";
std::string name = "";
std::vector<std::string> tags = {};
std::string group = "";
};
void init(const init_args& ia);
void log(const internal::object::PyDict& logs);
// void log(internal::object::PyDict&& logs);
void save(const std::string& file_path);
void update_config(const internal::object::PyDict& conf);
void update_summary(const internal::object::PyDict& summ);
void finish();
enum class wandb_mode { online, offline, disabled };
static wandb_mode get_mode();
};
using log_dict = internal::object::PyDict;
using py_list = internal::object::PyList;
using py_dict = internal::object::PyDict;
void init(const wandb::init_args& ia, bool wait_initialized = true);
void log(const internal::object::PyDict& logs);
void log(internal::object::PyDict&& logs);
void save(const std::string& file_path);
void update_config(const internal::object::PyDict& confs);
void update_config(internal::object::PyDict&& confs);
void update_summary(const internal::object::PyDict& summs);
void update_summary(internal::object::PyDict&& summs);
void finish();
} // namespace wandbcpp
#endif