-
{{ configKey }}
+
{{ label || configKey }}
{{ configInfo[configKey] || '(no help message available)' }}
@@ -282,6 +286,7 @@
apiKey: '',
systemMessage: 'You are a helpful assistant.',
// make sure these default values are in sync with `common.h`
+ samplers: 'dkypmxt',
temperature: 0.8,
dynatemp_range: 0.0,
dynatemp_exponent: 1.0,
@@ -305,6 +310,7 @@
const CONFIG_INFO = {
apiKey: 'Set the API Key if you are using --api-key option for the server.',
systemMessage: 'The starting message that defines how model should behave.',
+ samplers: 'The order at which samplers are applied, in simplified way. Default is "dkypmxt": dry->top_k->typ_p->top_p->min_p->xtc->temperature',
temperature: 'Controls the randomness of the generated text by affecting the probability distribution of the output tokens. Higher = more random, lower = more focused.',
dynatemp_range: 'Addon for the temperature sampler. The added value to the range of dynamic temperature, which adjusts probabilities by entropy of tokens.',
dynatemp_exponent: 'Addon for the temperature sampler. Smoothes out the probability redistribution based on the most probable token.',
@@ -352,10 +358,16 @@
{ props: ["source"] }
);
- // inout field to be used by settings modal
+ // input field to be used by settings modal
const SettingsModalShortInput = defineComponent({
template: document.getElementById('settings-modal-short-input').innerHTML,
- props: ['configKey', 'configDefault', 'configInfo', 'modelValue'],
+ props: {
+ label: { type: String, required: false },
+ configKey: String,
+ configDefault: Object,
+ configInfo: Object,
+ modelValue: [Object, String, Number],
+ },
});
// coversations is stored in localStorage
@@ -546,6 +558,7 @@
],
stream: true,
cache_prompt: true,
+ samplers: this.config.samplers,
temperature: this.config.temperature,
dynatemp_range: this.config.dynatemp_range,
dynatemp_exponent: this.config.dynatemp_exponent,
diff --git a/examples/server/server.cpp b/examples/server/server.cpp
index 00f9031dc..b8e003be9 100644
--- a/examples/server/server.cpp
+++ b/examples/server/server.cpp
@@ -927,14 +927,22 @@ struct server_context {
{
const auto & samplers = data.find("samplers");
- if (samplers != data.end() && samplers->is_array()) {
- std::vector
sampler_names;
- for (const auto & name : *samplers) {
- if (name.is_string()) {
- sampler_names.emplace_back(name);
+ if (samplers != data.end()) {
+ if (samplers->is_array()) {
+ std::vector sampler_names;
+ for (const auto & name : *samplers) {
+ if (name.is_string()) {
+ sampler_names.emplace_back(name);
+ }
}
+ slot.sparams.samplers = common_sampler_types_from_names(sampler_names, false);
+ } else if (samplers->is_string()){
+ std::string sampler_string;
+ for (const auto & name : *samplers) {
+ sampler_string += name;
+ }
+ slot.sparams.samplers = common_sampler_types_from_chars(sampler_string);
}
- slot.sparams.samplers = common_sampler_types_from_names(sampler_names, false);
} else {
slot.sparams.samplers = default_sparams.samplers;
}