Vowpal Wabbit
vw_validate.cc
Go to the documentation of this file.
1 /*
2 Copyright (c) by respective owners including Yahoo!, Microsoft, and
3 individual contributors. All rights reserved. Released under a BSD (revised)
4 license as described in the file LICENSE.
5 */
6 #include "global_data.h"
7 #include "vw_validate.h"
8 #include "vw_versions.h"
9 
10 namespace VW
11 {
12 void validate_version(vw& all)
13 {
15  THROW("Model has possibly incompatible version! " << all.model_file_ver.to_string());
16  if (all.model_file_ver > PACKAGE_VERSION)
17  std::cerr << "Warning: model version is more recent than VW version. This may not work." << std::endl;
18 }
19 
21 {
22  if (all.sd->max_label < all.sd->min_label)
23  THROW("Max label cannot be less than min label.");
24 }
25 
26 void validate_default_bits(vw& all, uint32_t local_num_bits)
27 {
28  if (all.default_bits != true && all.num_bits != local_num_bits)
29  THROW("-b bits mismatch: command-line " << all.num_bits << " != " << local_num_bits << " stored in model");
30 }
31 
33 {
34  if (all.num_bits > sizeof(size_t) * 8 - 3)
35  THROW("Only " << sizeof(size_t) * 8 - 3 << " or fewer bits allowed. If this is a serious limit, speak up.");
36 }
37 } // namespace VW
void validate_min_max_label(vw &all)
Definition: vw_validate.cc:20
void validate_version(vw &all)
Definition: vw_validate.cc:12
uint32_t num_bits
Definition: global_data.h:398
shared_data * sd
Definition: global_data.h:375
VW::version_struct model_file_ver
Definition: global_data.h:419
#define LAST_COMPATIBLE_VERSION
Definition: vw_versions.h:10
std::string to_string() const
Definition: version.cc:97
bool default_bits
Definition: global_data.h:399
float min_label
Definition: global_data.h:150
Definition: autolink.cc:11
float max_label
Definition: global_data.h:151
void validate_num_bits(vw &all)
Definition: vw_validate.cc:32
#define THROW(args)
Definition: vw_exception.h:181
void validate_default_bits(vw &all, uint32_t local_num_bits)
Definition: vw_validate.cc:26