For simplicity, we assume each line from shakespeare_text is appended, ignoring them.
| 58 | |
| 59 | // For simplicity, we assume each line from shakespeare_text is appended, ignoring them. |
| 60 | std::vector<int> char_based_tokenize(const std::string& text) |
| 61 | { |
| 62 | std::vector<int> tokens; |
| 63 | tokens.reserve(text.size()); |
| 64 | for (const int c : text) |
| 65 | { |
| 66 | tokens.push_back(std::min(c, MAX_TOKEN_ID)); |
| 67 | } |
| 68 | return tokens; |
| 69 | } |
| 70 | |
| 71 | // Function to shuffle samples and labels in sync |
| 72 | void shuffle_samples_and_labels(std::vector<matrix<int, 0, 1>>& samples, std::vector<unsigned long>& labels) { |