Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
d91fd7c
fixed issue: crashed on deleting chat
rifkybujana Jan 15, 2025
e5975a2
- Added persistence KV Cache method\
rifkybujana Jan 22, 2025
4728dbf
added qwen 2.5 code 0.5b - 14b, and added qwen 2.5 14b models
rifkybujana Jan 22, 2025
6a78b30
Merge branch 'main' into dev
rifkybujana Jan 22, 2025
74a586f
merge with main
rifkybujana Jan 22, 2025
8daed41
fix model won't generate if we switch the model on a non empty chat
rifkybujana Jan 22, 2025
ba9446c
added deepseek r1
rifkybujana Jan 23, 2025
535bd81
removed deepseek unsupported
rifkybujana Jan 23, 2025
812cd45
Revert "added deepseek r0"
rifkybujana Jan 23, 2025
ccfc310
Revert "removed deepseek unsupported"
rifkybujana Jan 23, 2025
69268ad
added deepseek r1 support
rifkybujana Jan 23, 2025
517bd1f
added base markdown rendering
rifkybujana Jan 26, 2025
4135ddf
added ImGuiColorTextEdit for handling code rendering on markdown
rifkybujana Jan 26, 2025
847c726
added markdown renderer
rifkybujana Jan 28, 2025
e9e827a
added modified imgui_md
rifkybujana Jan 28, 2025
66c18f2
added cancel button and fix the model card duplication issue
rifkybujana Feb 1, 2025
e8bde60
fix last selected model issue
rifkybujana Feb 1, 2025
60b686e
added tps
rifkybujana Feb 1, 2025
c1ba124
don't show empty thought
rifkybujana Feb 1, 2025
899a8c2
add automation to detect number of thread to use
rifkybujana Feb 1, 2025
67c2a3a
add fallback to failed model loading
rifkybujana Feb 1, 2025
c813e6b
Merge branch 'main' into dev
rifkybujana Feb 1, 2025
42fb04a
fix model loaded syncronization on start and code rendering block glitch
rifkybujana Feb 1, 2025
d73ab5e
remove text debugging
rifkybujana Feb 1, 2025
dbfb365
refactored history sidebar
rifkybujana Feb 5, 2025
65f45b2
refactored preset sidebar
rifkybujana Feb 5, 2025
5d53b90
fix preset selection
rifkybujana Feb 7, 2025
0ea6802
re-refactor chat history sidebar
rifkybujana Feb 7, 2025
c00e99f
refactor model manager
rifkybujana Feb 7, 2025
83c12cd
rename constant namespace
rifkybujana Feb 7, 2025
4a25059
refactor chat history render
rifkybujana Feb 7, 2025
c00d90a
refactor chat_section
rifkybujana Feb 7, 2025
b58f1db
refactor main code and fixed preset selection duplication bug
rifkybujana Feb 8, 2025
90ebc27
fixed kv cache deletion and renaming
rifkybujana Feb 8, 2025
090a986
moved tab manager to ui/tab_manager.hpp
rifkybujana Feb 8, 2025
36af3a1
added stop generation button
rifkybujana Feb 10, 2025
ea59aaa
refactor input field rendering
rifkybujana Feb 10, 2025
73d2e71
added regenerate button
rifkybujana Feb 10, 2025
141aaf6
added regenerate functionality
rifkybujana Feb 10, 2025
88f0b90
stop all jobs on exit
rifkybujana Feb 10, 2025
8a20091
track job ids within model manager
rifkybujana Feb 10, 2025
d564491
restyle loading bar
rifkybujana Feb 10, 2025
9a5bfa8
[workaround] fixed the delete model button didn't work
rifkybujana Feb 10, 2025
19d35c1
handle model loading asynchronously
rifkybujana Feb 11, 2025
d1b6d30
refactored progress bar widget
rifkybujana Feb 11, 2025
8d31c98
fixed can't find IndeterminedProgressBar error, and progress bar pos…
rifkybujana Feb 11, 2025
abeda36
add unload model functionality
rifkybujana Feb 12, 2025
c1d4967
fixed chat code block ui glitch
rifkybujana Feb 12, 2025
88f38f5
fixed bug model trying to regenerate even if no model loaded, and add…
rifkybujana Feb 12, 2025
7c9c368
added context shifting on the engine
rifkybujana Feb 13, 2025
67bcfc7
if max_new_token set to be 0, don't stop until eos (infinitely generate)
rifkybujana Feb 13, 2025
8df4d2c
update engine
rifkybujana Feb 13, 2025
626967e
update the kv cache loading for context shifting
rifkybujana Feb 13, 2025
ac70696
Merge branch 'main' into dev
rifkybujana Feb 13, 2025
c09aa85
fix delete chat doesn't have to pass model name and variant name
rifkybujana Feb 13, 2025
9b6f5f0
Merge branch 'dev' of https://github.com/genta-technology/kolosal int…
rifkybujana Feb 13, 2025
bdd81f3
fixed merge with main branch
rifkybujana Feb 13, 2025
9139b34
Merge branch 'main' into dev
rifkybujana Feb 13, 2025
5eb446d
refactor model generation callback
rifkybujana Mar 2, 2025
959fcd1
added kolosal server library
rifkybujana Mar 3, 2025
6456ce7
model server tab
rifkybujana Mar 5, 2025
c49bb59
added server logs, model selection, tab selection buttons, and loadin…
rifkybujana Mar 6, 2025
f975644
added server functionality
rifkybujana Mar 7, 2025
96ce0d4
added reload model buttons
rifkybujana Mar 7, 2025
0b6eb1c
update installer version
rifkybujana Mar 7, 2025
806d6dd
fixed kv cache sequence id
rifkybujana Mar 8, 2025
8e5d4c4
merge with main
rifkybujana Mar 8, 2025
f59c89e
fixed seq id pass for server
rifkybujana Mar 9, 2025
4a0b385
acrylic window
rifkybujana Mar 13, 2025
05f57d0
refactor ai model config
rifkybujana Mar 13, 2025
37cc8df
added section of downloaded models
rifkybujana Mar 13, 2025
cc15d63
sort model based on alphabet
rifkybujana Mar 13, 2025
6ecc1e8
added search in model manager modal
rifkybujana Mar 13, 2025
d1ac4e2
fixed pasted a very long text into system prompt, crashed the applica…
rifkybujana Mar 14, 2025
36179e8
fixed chat name can't contain some symbols
rifkybujana Mar 14, 2025
55706e0
allowing to rename duplicate chat name
rifkybujana Mar 14, 2025
4b082d7
automatically adjust value for n_batch and n_keep to be within the n_…
rifkybujana Mar 14, 2025
928b35b
update installer script
rifkybujana Mar 15, 2025
05d3167
merge with main
rifkybujana Mar 15, 2025
f340e9a
added fallback if the windows' transperancy effect is disabled in the…
rifkybujana Mar 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified external/genta-personal/bin/InferenceEngineLib.dll
Binary file not shown.
Binary file modified external/genta-personal/bin/InferenceEngineLibVulkan.dll
Binary file not shown.
1 change: 1 addition & 0 deletions external/genta-personal/include/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ struct LoadingParameters
bool warmup = false;
int n_parallel = 1;
int n_gpu_layers = 100;
int n_batch = 4096;
};

#endif // TYPES_H
Binary file modified external/genta-personal/lib/InferenceEngineLib.lib
Binary file not shown.
Binary file modified external/genta-personal/lib/InferenceEngineLibVulkan.lib
Binary file not shown.
40 changes: 21 additions & 19 deletions include/chat/chat_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,53 +92,57 @@ namespace Chat
std::future<bool> renameCurrentChat(const std::string& newName)
{
return std::async(std::launch::async, [this, newName]() {
if (!validateChatName(newName))
if (!validateChatName(newName))
{
std::cerr << "[ChatManager] [ERROR] " << newName << " is not valid" << std::endl;
std::cerr << "[ChatManager] [ERROR] " << newName << " is not valid" << std::endl;
return false;
}

std::unique_lock<std::shared_mutex> lock(m_mutex);

if (!m_currentChatName)
if (!m_currentChatName)
{
std::cerr << "[ChatManager] No current chat selected.\n";
std::cerr << "[ChatManager] No current chat selected.\n";
return false;
}

if (m_chatNameToIndex.find(newName) != m_chatNameToIndex.end())
// Generate a unique name if the requested name already exists
std::string uniqueName = newName;
int counter = 1;

while (m_chatNameToIndex.find(uniqueName) != m_chatNameToIndex.end())
{
std::cerr << "[ChatManager] Chat with name " << newName << " already exists.\n";
return false;
uniqueName = newName + " (" + std::to_string(counter) + ")";
counter++;
}

size_t currentIdx = m_currentChatIndex;
if (currentIdx >= m_chats.size())
if (currentIdx >= m_chats.size())
{
std::cerr << "[ChatManager] Invalid chat index: " << currentIdx << std::endl;
std::cerr << "[ChatManager] Invalid chat index: " << currentIdx << std::endl;
return false;
}

std::string oldName = m_chats[currentIdx].name;
m_chats[currentIdx].name = newName;
m_chats[currentIdx].name = uniqueName;
m_chats[currentIdx].lastModified = static_cast<int>(std::time(nullptr));

// Update indices
m_chatNameToIndex.erase(oldName);
m_chatNameToIndex[newName] = currentIdx;
m_currentChatName = newName;
m_chatNameToIndex[uniqueName] = currentIdx;
m_currentChatName = uniqueName;

// Save changes
auto chat = m_chats[currentIdx];
auto saveResult = m_persistence->saveChat(chat).get();
if (saveResult)
if (saveResult)
{
m_persistence->deleteChat(oldName).get();
m_persistence->renameKvChat(oldName, newName).get();
m_persistence->renameKvChat(oldName, uniqueName).get();
}

return saveResult;
});
});
}

std::future<bool> clearCurrentChat()
Expand Down Expand Up @@ -649,9 +653,7 @@ namespace Chat
// Validation helpers
static bool validateChatName(const std::string& name)
{
if (name.empty() || name.length() > 256) return false;
const std::string invalidChars = R"(<>:"/\|?*)";
return name.find_first_of(invalidChars) == std::string::npos;
return !(name.empty() || name.length() > 256);
}

void updateChatTimestamp(size_t chatIndex, int newTimestamp)
Expand Down
10 changes: 10 additions & 0 deletions include/chat/chat_persistence.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,22 @@ namespace Chat

std::filesystem::path getChatPath(const std::string& chatName) const override
{
// remove characters that are not allowed in file names
std::string chatNameFiltered = chatName;
std::replace_if(chatNameFiltered.begin(), chatNameFiltered.end(),
[](char c) { return !std::isalnum(c); }, '_');

return std::filesystem::absolute(
std::filesystem::path(m_basePath) / (chatName + ".chat"));
}

std::filesystem::path getKvChatPath(const std::string& chatName) const override
{
// remove characters that are not allowed in file names
std::string chatNameFiltered = chatName;
std::replace_if(chatNameFiltered.begin(), chatNameFiltered.end(),
[](char c) { return !std::isalnum(c); }, '_');

return std::filesystem::absolute(
std::filesystem::path(m_basePath) / (chatName + ".bin"));
}
Expand Down
1 change: 1 addition & 0 deletions include/common.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <imgui.h>
#include <chrono>
#include <string>
#include <sstream>
Expand Down
3 changes: 2 additions & 1 deletion include/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ namespace Config

namespace InputField
{
constexpr size_t TEXT_SIZE = 81920;
// max 64kb of text
constexpr size_t TEXT_SIZE = 64 * 1024;

constexpr float CHILD_ROUNDING = 10.0F;
constexpr float FRAME_ROUNDING = 12.0F;
Expand Down
70 changes: 42 additions & 28 deletions include/model/model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
#include <string>
#include <json.hpp>
#include <filesystem>
#include <map>
#include <atomic>

using json = nlohmann::json;

namespace Model
{
// In model.hpp or the appropriate header:
// ModelVariant structure remains mostly the same
struct ModelVariant {
std::string type;
std::string path;
Expand Down Expand Up @@ -48,18 +50,18 @@ namespace Model
}
};

inline void to_json(nlohmann::json &j, const ModelVariant &v)
inline void to_json(nlohmann::json& j, const ModelVariant& v)
{
j = nlohmann::json{
{"type", v.type},
{"path", v.path},
{"downloadLink", v.downloadLink},
{"isDownloaded", v.isDownloaded},
{"downloadProgress", v.downloadProgress},
{"lastSelected", v.lastSelected}};
{"lastSelected", v.lastSelected} };
}

inline void from_json(const nlohmann::json &j, ModelVariant &v)
inline void from_json(const nlohmann::json& j, ModelVariant& v)
{
j.at("type").get_to(v.type);
j.at("path").get_to(v.path);
Expand All @@ -69,42 +71,54 @@ namespace Model
j.at("lastSelected").get_to(v.lastSelected);
}

// Refactored ModelData to use a map of variants
struct ModelData
{
std::string name;
std::string author;
ModelVariant fullPrecision;
ModelVariant quantized8Bit;
ModelVariant quantized4Bit;

ModelData(const std::string &name = "",
const std::string& author = "",
const ModelVariant &fullPrecision = ModelVariant(),
const ModelVariant &quantized8Bit = ModelVariant(),
const ModelVariant &quantized4Bit = ModelVariant())
: name(name)
, author(author)
, fullPrecision(fullPrecision)
, quantized8Bit(quantized8Bit)
, quantized4Bit(quantized4Bit) {}
std::map<std::string, ModelVariant> variants;

// Constructor with no variants
ModelData(const std::string& name = "", const std::string& author = "")
: name(name), author(author) {
}

// Add a variant to the model
void addVariant(const std::string& variantType, const ModelVariant& variant) {
variants[variantType] = variant;
}

// Check if a variant exists
bool hasVariant(const std::string& variantType) const {
return variants.find(variantType) != variants.end();
}

// Get a variant (const version)
const ModelVariant* getVariant(const std::string& variantType) const {
auto it = variants.find(variantType);
return (it != variants.end()) ? &(it->second) : nullptr;
}

// Get a variant (non-const version)
ModelVariant* getVariant(const std::string& variantType) {
auto it = variants.find(variantType);
return (it != variants.end()) ? &(it->second) : nullptr;
}
};

inline void to_json(nlohmann::json &j, const ModelData &m)
inline void to_json(nlohmann::json& j, const ModelData& m)
{
j = nlohmann::json{
{"name", m.name},
{"author", m.author},
{"fullPrecision", m.fullPrecision},
{"quantized8Bit", m.quantized8Bit},
{"quantized4Bit", m.quantized4Bit}};
{"author", m.author},
{"variants", m.variants}
};
}

inline void from_json(const nlohmann::json &j, ModelData &m)
inline void from_json(const nlohmann::json& j, ModelData& m)
{
j.at("name").get_to(m.name);
j.at("author").get_to(m.author);
j.at("fullPrecision").get_to(m.fullPrecision);
j.at("quantized8Bit").get_to(m.quantized8Bit);
j.at("quantized4Bit").get_to(m.quantized4Bit);
j.at("author").get_to(m.author);
j.at("variants").get_to(m.variants);
}
} // namespace Model
2 changes: 2 additions & 0 deletions include/model/model_loader_config_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace Model
bool getContinuousBatching() const { return config_.cont_batching; }
bool getWarmup() const { return config_.warmup; }
int getParallelCount() const { return config_.n_parallel; }
int getBatchSize() const { return config_.n_batch; }
int getGpuLayers() const { return config_.n_gpu_layers; }

// Setters
Expand All @@ -88,6 +89,7 @@ namespace Model
void setContinuousBatching(bool enable) { config_.cont_batching = enable; }
void setWarmup(bool enable) { config_.warmup = enable; }
void setParallelCount(int count) { config_.n_parallel = count; }
void setBatchSize(int size) { config_.n_batch = size; }
void setGpuLayers(int layers) { config_.n_gpu_layers = layers; }

private:
Expand Down
Loading
Loading