| 96 | } |
| 97 | |
| 98 | void smiles_data_reader::load() |
| 99 | { |
| 100 | if (get_comm()->am_world_master()) { |
| 101 | std::cout << "starting load for role: " << get_role() << std::endl; |
| 102 | } |
| 103 | |
| 104 | double tm1 = get_time(); |
| 105 | auto& arg_parser = global_argument_parser(); |
| 106 | |
| 107 | // for now, only implemented for data store with preloading |
| 108 | set_use_data_store(true); |
| 109 | |
| 110 | if (m_sequence_length == 0) { |
| 111 | if (arg_parser.get<int>(LBANN_OPTION_SEQUENCE_LENGTH) == -1) { |
| 112 | LBANN_ERROR("you must pass --sequence_length=<int> on the cmd line or " |
| 113 | "call set_sequence_length()"); |
| 114 | } |
| 115 | m_sequence_length = arg_parser.get<int>(LBANN_OPTION_SEQUENCE_LENGTH); |
| 116 | } |
| 117 | m_linearized_data_size = m_sequence_length + 2; |
| 118 | |
| 119 | // load the vocabulary; this is a map: string -> short |
| 120 | if (m_vocab.size() == 0) { |
| 121 | if (arg_parser.get<std::string>(LBANN_OPTION_VOCAB) == "") { |
| 122 | LBANN_ERROR("you must either pass --vocab=<string> on the command line " |
| 123 | "or call load_vocab(...)"); |
| 124 | } |
| 125 | const std::string fn = arg_parser.get<std::string>(LBANN_OPTION_VOCAB); |
| 126 | load_vocab(fn); |
| 127 | } |
| 128 | else { |
| 129 | LBANN_ERROR("you passed --vocab=<string>, but it looks like load_vocab() " |
| 130 | "was previously called. You must use one or the other."); |
| 131 | } |
| 132 | |
| 133 | // Load the sample list(s) |
| 134 | data_reader_sample_list::load(); |
| 135 | if (get_comm()->am_world_master()) { |
| 136 | std::cout << "time to load sample list: " << get_time() - tm1 << std::endl; |
| 137 | } |
| 138 | |
| 139 | // do what we almost always do (TODO: this should be refactored as a method |
| 140 | m_shuffled_indices.clear(); |
| 141 | m_shuffled_indices.resize(m_sample_list.size()); |
| 142 | std::iota(m_shuffled_indices.begin(), m_shuffled_indices.end(), 0); |
| 143 | resize_shuffled_indices(); |
| 144 | instantiate_data_store(); |
| 145 | select_subset_of_data(); |
| 146 | |
| 147 | // load various metadata |
| 148 | build_some_maps(); |
| 149 | load_offsets_and_lengths(); |
| 150 | print_statistics(); |
| 151 | } |
| 152 | |
| 153 | void smiles_data_reader::do_preload_data_store() |
| 154 | { |
nothing calls this directly
no test coverage detected