mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2026-09-19 17:25:07 +02:00
str splitter
This commit is contained in:
@@ -542,4 +542,21 @@ kcpp_embd_batch::kcpp_embd_batch(std::vector<llama_token> & tokens, int32_t npas
|
||||
}
|
||||
}
|
||||
batch.logits[n_tokens - 1] = true;
|
||||
}
|
||||
|
||||
std::vector<std::string> split_string(const std::string& input, const std::string& separator) {
|
||||
std::vector<std::string> result;
|
||||
size_t start = 0;
|
||||
size_t end = input.find(separator);
|
||||
|
||||
while (end != std::string::npos) {
|
||||
result.push_back(input.substr(start, end - start));
|
||||
start = end + separator.length();
|
||||
end = input.find(separator, start);
|
||||
}
|
||||
|
||||
// Add the remaining part after the last separator
|
||||
result.push_back(input.substr(start));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -65,6 +65,8 @@ std::vector<float> resample_wav(const std::vector<float>& input, uint32_t input_
|
||||
|
||||
int32_t kcpp_quick_sample(float * logits, const int n_logits, const std::vector<int32_t> & last_n_tokens, float rep_pen, float top_p, int top_k, float temp, std::mt19937 & rng);
|
||||
|
||||
std::vector<std::string> split_string(const std::string& input, const std::string& separator);
|
||||
|
||||
struct kcpp_embd_batch { //duplcated from llava_embd_batch
|
||||
std::vector<int32_t> pos;
|
||||
std::vector<int32_t> n_seq_id;
|
||||
|
||||
Reference in New Issue
Block a user