From 28dbb3e078f09bdea9f982b26141f103da81a160 Mon Sep 17 00:00:00 2001 From: Eamon Date: Tue, 14 Jul 2026 15:20:27 +0530 Subject: [PATCH 1/6] Remove LibTorch C++ inference implementation --- train_test/test.cpp | 96 --------------------------------------------- 1 file changed, 96 deletions(-) delete mode 100644 train_test/test.cpp diff --git a/train_test/test.cpp b/train_test/test.cpp deleted file mode 100644 index 41e25e7..0000000 --- a/train_test/test.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -bool running = true; -void handle_sigint(int) -{ - std::cout << "\n\n[Stopped by user]\n"; - running = false; -} - -std::map build_vocab(const std::string &path) -{ - std::ifstream file(path); - if (!file.is_open()) - { - std::cerr << "[Error] Cannot open: " << path << "\n"; - exit(1); - } - std::string text((std::istreambuf_iterator(file)), std::istreambuf_iterator()); - - std::set char_set(text.begin(), text.end()); - std::vector chars(char_set.begin(), char_set.end()); - std::sort(chars.begin(), chars.end()); - - std::map it; - for (int i = 0; i < (int)chars.size(); i++) - it[i] = chars[i]; - - return it; -} - -int main() -{ - signal(SIGINT, handle_sigint); - - std::string model_path = "../best_model_script.pt"; - std::string cleaned_path = "../cleaned.txt"; - - std::cout << "--- Loading Pre-trained Model ---\n"; - torch::jit::script::Module model; - try - { - model = torch::jit::load(model_path, torch::kCPU); - } - catch (const c10::Error &e) - { - std::cerr << "[Error] Could not load model: " << e.what() << "\n"; - return 1; - } - model.eval(); - - auto it = build_vocab(cleaned_path); - std::cout << "[INFO] Vocab size : " << it.size() << "\n"; - std::cout << "[INFO] Device : CPU\n"; - std::cout << "Model loaded. Generating text (Ctrl+C to stop)...\n\n"; - std::cout << std::string(50, '-') << "\n"; - - const int block_size = 128; - auto context = torch::zeros({1, 1}, torch::kLong); - - torch::NoGradGuard no_grad; - - while (running) - { - auto idx_cond = context; - if (context.size(1) > block_size) - idx_cond = context.slice(1, context.size(1) - block_size); - - std::vector inputs = {idx_cond}; - auto output = model.forward(inputs).toTuple(); - auto logits = output->elements()[0].toTensor(); - - logits = logits.select(1, logits.size(1) - 1); - auto probs = torch::softmax(logits, -1); - auto idx_next = torch::multinomial(probs, 1); - - context = torch::cat({context, idx_next}, 1); - if (context.size(1) > block_size) - context = context.slice(1, context.size(1) - block_size); - - int token = idx_next[0][0].item(); - if (it.count(token)) - std::cout << it[token] << std::flush; - else - std::cout << '?' << std::flush; - } - - return 0; -} \ No newline at end of file From 13342890171dbdf78e2479990d859e1169ed709c Mon Sep 17 00:00:00 2001 From: Eamon Date: Tue, 14 Jul 2026 15:24:44 +0530 Subject: [PATCH 2/6] Delete .env.example --- frontend/.env.example | 1 - 1 file changed, 1 deletion(-) delete mode 100644 frontend/.env.example diff --git a/frontend/.env.example b/frontend/.env.example deleted file mode 100644 index 4558365..0000000 --- a/frontend/.env.example +++ /dev/null @@ -1 +0,0 @@ -VITE_API_BASE_URL=http://localhost:3001 From afb931d9a055c51c0492e51ecd292705ad18090f Mon Sep 17 00:00:00 2001 From: Eamon Date: Tue, 14 Jul 2026 15:25:14 +0530 Subject: [PATCH 3/6] Delete index.html --- frontend/index.html | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 frontend/index.html diff --git a/frontend/index.html b/frontend/index.html deleted file mode 100644 index c694ea2..0000000 --- a/frontend/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - Quadtrix.cpp Chat - - -
- - - From 145f7894851560bafff0a765e068778dfd0dad0d Mon Sep 17 00:00:00 2001 From: Eamon Date: Tue, 14 Jul 2026 15:25:32 +0530 Subject: [PATCH 4/6] Delete manifest.webmanifest --- frontend/manifest.webmanifest | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 frontend/manifest.webmanifest diff --git a/frontend/manifest.webmanifest b/frontend/manifest.webmanifest deleted file mode 100644 index 882922b..0000000 --- a/frontend/manifest.webmanifest +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "Quadtrix.cpp Chat", - "short_name": "Quadtrix", - "description": "Installable local chat interface for Quadtrix C++ and PyTorch model backends.", - "start_url": "/", - "scope": "/", - "display": "standalone", - "background_color": "#0a0a0a", - "theme_color": "#0a0a0a", - "orientation": "any", - "categories": ["developer", "productivity", "utilities"], - "icons": [ - { - "src": "/icon.svg", - "sizes": "any", - "type": "image/svg+xml", - "purpose": "any maskable" - } - ] -} From 9a3bc9dbada8c527f7b280ce02f30419adc7ed54 Mon Sep 17 00:00:00 2001 From: Eamon Date: Tue, 14 Jul 2026 15:25:39 +0530 Subject: [PATCH 5/6] Delete postcss.config.js --- frontend/postcss.config.js | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 frontend/postcss.config.js diff --git a/frontend/postcss.config.js b/frontend/postcss.config.js deleted file mode 100644 index 2aa7205..0000000 --- a/frontend/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -export default { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -}; From 9b3e2b7cc14916a287643bfe6c715173bdc9c2ce Mon Sep 17 00:00:00 2001 From: Eamon Date: Tue, 14 Jul 2026 15:25:46 +0530 Subject: [PATCH 6/6] Delete icon.svg --- frontend/public/icon.svg | 53 ---------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 frontend/public/icon.svg diff --git a/frontend/public/icon.svg b/frontend/public/icon.svg deleted file mode 100644 index fe615d0..0000000 --- a/frontend/public/icon.svg +++ /dev/null @@ -1,53 +0,0 @@ - - LLM logo icon - A dark rounded-square icon with a smooth rainbow-gradient LLM wordmark, inspired by Apple TV aesthetic - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LLM - - - - - - - \ No newline at end of file