Start devloping vulkan

This commit is contained in:
2026-04-29 21:08:19 +07:00
parent c02a886327
commit 1a05d3a6d9
10 changed files with 70 additions and 37 deletions
+14 -23
View File
@@ -6,16 +6,15 @@
#include <sstream>
#include <fstream>
#include <algorithm>
#include "Xenith/core.h"
#include "Xenith/token/token.h"
#include <windows.h>
#include "Xenith/core.hpp"
#include "Xenith/token/token.hpp"
#include <chrono>
std::string currentSystemPrompt = "";
LayerStructure_t layers[] = {
{MAX_CONTEXT * EMBED_DIM, SIGMOID},
{16, SIGMOID},
{256, SIGMOID},
{MAX_VOCAB, SIGMOID}
};
@@ -71,8 +70,7 @@ void trainOnSequence(NeuralNetwork& nn, Tokenizer& tok, Embedder& emb, const std
std::cout << "Training logic: Next Token Prediction..." << std::endl;
std::cout << "\033[s\033[999;1H" << "\033[2K" << "\033[1;30m" << "\033[F" << "\r"
<< "DATA: " << (sequenceStr.length() > 100 ? sequenceStr.substr(0, 200) : sequenceStr) << "\033[0m\033[u";
std::cout << "\033[s\n\n";
for (int e = 1; e <= epochs; e++) {
double totalLoss = 0;
@@ -84,26 +82,22 @@ void trainOnSequence(NeuralNetwork& nn, Tokenizer& tok, Embedder& emb, const std
trainSteps++;
auto currentTime = std::chrono::high_resolution_clock::now();
if (std::chrono::duration<double>(currentTime - startTime).count() >= 1.0) {
if (std::chrono::duration<double>(currentTime - startTime).count() >= 0.1) {
stepsPerSec = trainSteps / std::chrono::duration<double>(currentTime - startTime).count();
trainSteps = 0;
startTime = currentTime;
}
std::cout << "\rEpoch " << std::setw(4) << e << "/" << epochs
<< " | Token: " << std::setw(3) << i << "/" << allTokens.size()
<< " | Loss: " << std::fixed << std::setprecision(6) << totalLoss
<< " | Max Loss: " << std::fixed << std::setprecision(6) << maxLoss << " \033[s";
std::cout << "\033[u";
std::cout << "\033[999;1H" << "\r";
std::cout << "Epoch " << std::setw(4) << e << "/" << epochs
<< " | Token: " << std::setw(4) << i << "/" << allTokens.size()
<< " | Loss: " << std::fixed << std::setprecision(6) << totalLoss
<< " | Max Loss: " << maxLoss << "\033[K\n";
std::cout << "SPEED: " << std::setw(6) << std::fixed << std::setprecision(1) << stepsPerSec << " st/s"
<< " | MODEL: " << std::setw(7) << modelSizeStr
<< " | CURRENT: [" << std::left << std::setw(15) << tok.getWord(allTokens[i]) << "] ("
<< std::right << std::setw(4) << allTokens[i] << ") ";
std::cout << "\033[K" << "\033[0m";
std::cout << "\033[997;1H" << "\r" << std::flush << "\033[u";
std::cout << "SPEED: " << std::setw(6) << std::fixed << std::setprecision(1) << stepsPerSec
<< " st/s | MODEL: " << std::setw(7) << modelSizeStr
<< " | CURRENT: [" << std::left << std::setw(15) << tok.getWord(allTokens[i]) << "]"
<< "\033[K" << std::flush;
}
maxLoss = totalLoss;
@@ -114,9 +108,6 @@ void trainOnSequence(NeuralNetwork& nn, Tokenizer& tok, Embedder& emb, const std
int main() {
SetConsoleOutputCP(CP_UTF8);
SetConsoleCP(CP_UTF8);
Tokenizer tok;
Embedder emb(MAX_VOCAB, EMBED_DIM);