avoid euler a for flux (+4 squashed commit)

Squashed commit:

[5a4b72385] fix cuda build

[5f969a645] add vulkan information

[6849e7398] fixed flux

[740e80419] update readme
This commit is contained in:
Concedo 2024-11-04 23:36:25 +08:00
parent 5b90eeaf17
commit 3cfc4dc581
4 changed files with 71 additions and 13 deletions

View file

@ -28,6 +28,7 @@ Finally, obtain and load a GGUF model. See [here](#Obtaining-a-GGUF-model)
## MacOS (Precompiled Binary)
- PyInstaller binaries for Modern ARM64 MacOS (M1, M2, M3) are now available! **[Simply download the MacOS binary](https://github.com/LostRuins/koboldcpp/releases/latest)**
- In a MacOS terminal window, set the file to executable `chmod +x koboldcpp-mac-arm64` and run it with `./koboldcpp-mac-arm64`.
- In newer MacOS you may also have to whitelist it in security settings if it's blocked. [Here's a video guide](https://youtube.com/watch?v=NOW5dyA_JgY).
- Alternatively, or for older x86 MacOS computers, you can clone the repo and compile from source code, see Compiling for MacOS below.
- Finally, obtain and load a GGUF model. See [here](#Obtaining-a-GGUF-model)
@ -120,7 +121,8 @@ when you can't use the precompiled binary directly, we provide an automated buil
- GPU acceleration for Termux may be possible but I have not explored it. If you find a good cross-device solution, do share or PR it.
## AMD Users
- Please check out https://github.com/YellowRoseCx/koboldcpp-rocm
- For most users, you can get very decent speeds by selecting the **Vulkan** option instead, which supports both Nvidia and AMD GPUs.
- Alternatively, you can try the ROCM fork at https://github.com/YellowRoseCx/koboldcpp-rocm
## Third Party Resources
- These unofficial resources have been contributed by the community, and may be outdated or unmaintained. No official support will be provided for them!

View file

@ -4300,6 +4300,7 @@ Current version indicated by LITEVER below.
const default_openrouter_base = "https://openrouter.ai/api/v1";
const default_mistralai_base = "https://api.mistral.ai/v1";
const default_featherless_base = "https://api.featherless.ai/v1";
const default_grok_base = "https://api.x.ai/v1";
const default_oai_base = "https://api.openai.com";
const default_claude_base = "https://api.anthropic.com";
const default_palm_base = "https://generativelanguage.googleapis.com/v1beta2/models/text-bison-001:generateText?key=";
@ -4446,6 +4447,7 @@ Current version indicated by LITEVER below.
saved_openrouter_key: "",
saved_mistralai_key: "",
saved_featherless_key: "",
saved_grok_key:"",
saved_claude_key: "", //do not ever share this in save files!
saved_claude_addr: default_claude_base, //do not ever share this in save files!
saved_palm_key: "", //do not ever share this in save files!
@ -4513,7 +4515,7 @@ Current version indicated by LITEVER below.
img_img2imgstr: 0.6,
img_steps: 20,
img_sampler: "Euler a",
img_aspect:0, //0=square,1=portrait,2=landscape
img_aspect:0, //0=square,1=portrait,2=landscape,3=bigsquare
save_images: true,
save_remote_images: false,
prompt_for_savename: false,
@ -6387,6 +6389,7 @@ Current version indicated by LITEVER below.
new_save_storyobj.savedsettings.saved_openrouter_key = "";
new_save_storyobj.savedsettings.saved_mistralai_key = "";
new_save_storyobj.savedsettings.saved_featherless_key = "";
new_save_storyobj.savedsettings.saved_grok_key = "";
new_save_storyobj.savedsettings.saved_palm_key = "";
new_save_storyobj.savedsettings.saved_cohere_key = "";
@ -6730,6 +6733,7 @@ Current version indicated by LITEVER below.
let tmp_or1 = localsettings.saved_openrouter_key;
let tmp_mai = localsettings.saved_mistralai_key;
let tmp_fai = localsettings.saved_featherless_key;
let tmp_grok = localsettings.saved_grok_key;
let tmp_claude1 = localsettings.saved_claude_key;
let tmp_claude2 = localsettings.saved_claude_addr;
let tmp_palm1 = localsettings.saved_palm_key;
@ -6770,6 +6774,7 @@ Current version indicated by LITEVER below.
localsettings.saved_openrouter_key = tmp_or1;
localsettings.saved_mistralai_key = tmp_mai;
localsettings.saved_featherless_key = tmp_fai;
localsettings.saved_grok_key = tmp_grok;
localsettings.saved_claude_key = tmp_claude1;
localsettings.saved_claude_addr = tmp_claude2;
localsettings.saved_palm_key = tmp_palm1;
@ -8782,6 +8787,8 @@ Current version indicated by LITEVER below.
return document.getElementById("custom_mistralai_model");
case "8":
return document.getElementById("custom_featherless_model");
case "9":
return document.getElementById("custom_grok_model");
default:
return document.getElementById("custom_oai_model");
}
@ -8887,7 +8894,12 @@ Current version indicated by LITEVER below.
}
else
{
msgbox(JSON.stringify(data.error.message),"Error Encountered",false,false);
let errmsg = data.error.message;
if(!errmsg)
{
errmsg = data.error;
}
msgbox(JSON.stringify(errmsg),"Error Encountered",false,false);
}
})
.catch(error => {
@ -8944,6 +8956,7 @@ Current version indicated by LITEVER below.
document.getElementById("custom_openrouter_model").classList.add("hidden");
document.getElementById("custom_mistralai_model").classList.add("hidden");
document.getElementById("custom_featherless_model").classList.add("hidden");
document.getElementById("custom_grok_model").classList.add("hidden");
document.getElementById("hordeloadmodelcontainer").classList.add("hidden");
document.getElementById("coherecustom").classList.add("hidden");
@ -8961,12 +8974,13 @@ Current version indicated by LITEVER below.
document.getElementById("customkoboldkey").value = localsettings.saved_kai_key;
}
}
else if(epchoice==2 || epchoice==3 || epchoice==7 || epchoice==8)
else if(epchoice==2 || epchoice==3 || epchoice==7 || epchoice==8 || epchoice==9)
{
document.getElementById("oaicustom").classList.remove("hidden");
document.getElementById("openrouterdesc").classList.add("hidden");
document.getElementById("mistralaidesc").classList.add("hidden");
document.getElementById("featherlessdesc").classList.add("hidden");
document.getElementById("grokdesc").classList.add("hidden");
document.getElementById("oaidesc").classList.add("hidden");
if(epchoice==2)
{
@ -8998,6 +9012,14 @@ Current version indicated by LITEVER below.
document.getElementById("custom_oai_endpoint").value = default_featherless_base;
try_fetch_oai_models_auto();
}
else if(epchoice==9)
{
document.getElementById("custom_grok_model").classList.remove("hidden");
document.getElementById("grokdesc").classList.remove("hidden");
document.getElementById("custom_oai_endpoint").classList.add("hidden");
document.getElementById("custom_oai_key").value = localsettings.saved_grok_key;
document.getElementById("custom_oai_endpoint").value = default_grok_base;
}
else //openrouter supports autofetch
{
document.getElementById("openrouterdesc").classList.remove("hidden");
@ -9408,7 +9430,7 @@ Current version indicated by LITEVER below.
});
}
}
else if(epchoice==2 || epchoice==3 || epchoice==7 || epchoice==8) //connect to OAI / OpenRouter / MistralAI / Featherless Endpoint
else if(epchoice==2 || epchoice==3 || epchoice==7 || epchoice==8 || epchoice==9) //connect to OAI / OpenRouter / MistralAI / Featherless / Grok Endpoint
{
let desired_oai_key = document.getElementById("custom_oai_key").value.trim();
let desired_oai_ep = document.getElementById("custom_oai_endpoint").value.trim();
@ -9444,6 +9466,10 @@ Current version indicated by LITEVER below.
{
localsettings.saved_featherless_key = custom_oai_key;
}
else if(epchoice==9)
{
localsettings.saved_grok_key = custom_oai_key;
}
else
{
localsettings.saved_openrouter_key = custom_oai_key;
@ -13117,13 +13143,13 @@ Current version indicated by LITEVER below.
"temperature": submit_payload.params.temperature,
"top_p": submit_payload.params.top_p,
}
if(localsettings.request_logprobs && !targetep.toLowerCase().includes("api.mistral.ai"))
if(localsettings.request_logprobs && !targetep.toLowerCase().includes("api.x.ai") && !targetep.toLowerCase().includes("api.mistral.ai"))
{
if(document.getElementById("useoaichatcompl").checked)
if(document.getElementById("useoaichatcompl").checked || targetep.toLowerCase().includes("api.x.ai"))
{
oai_payload.logprobs = true;
oai_payload.top_logprobs = 5;
}else{
} else {
oai_payload.logprobs = 5;
}
}
@ -13781,6 +13807,11 @@ Current version indicated by LITEVER below.
{
iwidth = 768;
}
else if(localsettings.img_aspect==3)
{
iwidth = 768;
iheight = 768;
}
let genimg_payload = {
"prompt": (sentence + negprompt),
@ -16911,6 +16942,9 @@ Current version indicated by LITEVER below.
}else if(custom_oai_endpoint.toLowerCase().includes("featherless.ai"))
{
localsettings.prev_custom_endpoint_type = 8;
}else if(custom_oai_endpoint.toLowerCase().includes("api.x.ai"))
{
localsettings.prev_custom_endpoint_type = 9;
}
}
else if(custom_claude_key!="")
@ -18239,7 +18273,7 @@ Current version indicated by LITEVER below.
<li class="nav-item hidden" id="topbtn_save_load">
<a id="tempfile" href="#" style="display:none;"></a>
<input type="file" id="loadfileinput" accept="text/json,application/json,image/png,image/webp,text/plain,*/*" onchange="load_file(event)" style="display:none;">
<input type="file" id="loadfileinput" accept="*" onchange="load_file(event)" style="display:none;">
<a class="nav-link mainnav" href="#" onclick="closeTopNav();display_saveloadcontainer()">Save / Load</a>
</li>
<li class="nav-item hidden" id="topbtn_settings">
@ -18492,6 +18526,7 @@ Current version indicated by LITEVER below.
<option value="6">Cohere API</option>
<option value="7">MistralAI API</option>
<option value="8">Featherless API</option>
<option value="9">Grok API</option>
</select>
</div>
@ -18566,6 +18601,11 @@ Current version indicated by LITEVER below.
Note that KoboldAI Lite takes no responsibility for your usage or consequences of this feature. Your API key is used directly with the Featherless API and is not transmitted to us.<br>Only Temperature, Top-P, Top-K, Min-P and Repetition Penalty samplers are used.<br><br>
<span class="color_green" style="font-weight: bold;">Please input Featherless Key.</span><br><br>
</span>
<span id="grokdesc" class="hidden">
Entering your Grok API key will allow you to use KoboldAI Lite with their API.<br><br>
Note that KoboldAI Lite takes no responsibility for your usage or consequences of this feature. Your API key is used directly with the Grok API and is not transmitted to us.<br>Only Temperature, Top-P, Top-K, Min-P and Repetition Penalty samplers are used.<br><br>
<span class="color_green" style="font-weight: bold;">Please input Grok Key.</span><br><br>
</span>
<input class="form-control" type="text" id="custom_oai_endpoint" placeholder="OpenAI API URL" value="" onblur="try_fetch_oai_models_auto()">
<input class="form-control" type="password" id="custom_oai_key" placeholder="API Key (Required)" value="" onfocus="focus_api_keys()" onblur="blur_api_keys()"><br>
@ -18617,6 +18657,10 @@ Current version indicated by LITEVER below.
<option value="meta-llama/Meta-Llama-3.1-405B-Instruct">meta-llama/Meta-Llama-3.1-405B-Instruct</option>
<option style="display:none;" class="custom_model_option" value="custom">[Custom]</option>
</select>
<select style="padding:4px;display:inline;width:calc(100% - 220px)" class="form-control hidden" id="custom_grok_model" onchange="oai_model_change(true)">
<option value="grok-beta">grok-beta</option>
<option style="display:none;" class="custom_model_option" value="custom">[Custom]</option>
</select>
<button type="button" class="btn btn-primary" style="display:inline;width:105px;" id="oaifetchlist" onclick="oai_fetch_models()">Fetch List</button>
<button type="button" class="btn btn-primary" style="display:inline;width:105px;" id="oaiusecustom" onclick="select_custom_oai_model()">Use Custom</button>
<div style="display:inline-flex">
@ -18687,6 +18731,7 @@ Current version indicated by LITEVER below.
<option value="claude-3-5-sonnet-20240620">claude-3-5-sonnet-20240620</option>
<option value="claude-3-5-sonnet-20241022">claude-3-5-sonnet-20241022</option>
<option value="claude-3-5-sonnet-latest">claude-3-5-sonnet-latest</option>
<option value="claude-3-5-haiku-20241022">claude-3-5-haiku-20241022</option>
</select>
<input type="checkbox" id="claudeaddversion" onchange="" checked>
<div class="box-label" title="Add endpoint version">Add Endpoint Version</div>
@ -19470,6 +19515,7 @@ Current version indicated by LITEVER below.
<option value="0">Square</option>
<option value="1">Portrait</option>
<option value="2">Landscape</option>
<option value="3">BigSquare</option>
</select>
</div>
<div class="inlinelabel">
@ -19621,7 +19667,7 @@ Current version indicated by LITEVER below.
<input title="Inverted Colors" type="checkbox" id="invert_colors" style="margin:0px 0px 0px auto;">
</div>
<div class="settinglabel">
<input type="file" id="loadbgimg" accept="image/png,image/webp,.webp,.jpg,.jpeg,.png,*.*,*" onchange="load_bg_img(event)" style="display:none;">
<input type="file" id="loadbgimg" accept="image/*" onchange="load_bg_img(event)" style="display:none;">
<div class="justifyleft settingsmall">Background Img</div>
<button title="Set Background Image" type="button" class="btn btn-primary bg_green" style="padding:2px 2px;margin:0px 0px 0px auto;font-size:10px;" onclick="load_bgimg_button()">Set</button>
<button title="Remove Background Image" type="button" class="btn btn-primary bg_red" style="padding:2px 2px;margin:0px 0px 0px 1px;font-size:10px;" onclick="clear_bg_img()">Clear</button>

View file

@ -213,7 +213,7 @@ bool sdtype_load_model(const sd_load_model_inputs inputs) {
sd_params = new SDParams();
sd_params->model_path = inputs.model_filename;
sd_params->wtype = (inputs.quant==0?SD_TYPE_F16:SD_TYPE_Q4_0);
sd_params->wtype = (inputs.quant==0?SD_TYPE_COUNT:SD_TYPE_Q4_0);
sd_params->n_threads = inputs.threads; //if -1 use physical cores
sd_params->input_path = ""; //unused
sd_params->batch_count = 1;
@ -320,6 +320,7 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
std::string cleanprompt = clean_input_prompt(inputs.prompt);
std::string cleannegprompt = clean_input_prompt(inputs.negative_prompt);
std::string img2img_data = std::string(inputs.init_images);
std::string sampler = inputs.sample_method;
sd_params->prompt = cleanprompt;
sd_params->negative_prompt = cleannegprompt;
@ -333,8 +334,16 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
sd_params->mode = (img2img_data==""?SDMode::TXT2IMG:SDMode::IMG2IMG);
//ensure unsupported dimensions are fixed
int biggestdim = std::max(sd_params->width,sd_params->height);
int biggestdim = (sd_params->width>sd_params->height?sd_params->width:sd_params->height);
auto loadedsdver = get_loaded_sd_version(sd_ctx);
if(loadedsdver==SDVersion::VERSION_FLUX_DEV || loadedsdver==SDVersion::VERSION_FLUX_SCHNELL)
{
sd_params->cfg_scale = 1;
if(sampler=="euler a"||sampler=="k_euler_a"||sampler=="euler_a")
{
sampler = "euler"; //euler a broken on flux
}
}
int reslimit = (loadedsdver==SDVersion::VERSION_SD1 || loadedsdver==SDVersion::VERSION_SD2)?832:1024;
if(biggestdim > reslimit)
{
@ -366,7 +375,6 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
}
fflush(stdout);
std::string sampler = inputs.sample_method;
if(sampler=="euler a"||sampler=="k_euler_a"||sampler=="euler_a") //all lowercase
{

View file

@ -93,6 +93,8 @@ enum sd_type_t {
SD_TYPE_Q4_0_4_4 = 31,
SD_TYPE_Q4_0_4_8 = 32,
SD_TYPE_Q4_0_8_8 = 33,
SD_TYPE_TQ1_0 = 34,
SD_TYPE_TQ2_0 = 35,
SD_TYPE_COUNT,
};