Merge branch 'master' into concedo_experimental

# Conflicts:
#	README.md
This commit is contained in:
Concedo
2023-05-09 16:50:43 +08:00
9 changed files with 488 additions and 129 deletions
+11 -3
View File
@@ -980,8 +980,6 @@ static void llama_model_load_internal(
// prepare memory for the weights
{
const auto & hparams = model.hparams;
const uint32_t n_embd = hparams.n_embd;
const uint32_t n_layer = hparams.n_layer;
const uint32_t n_vocab = hparams.n_vocab;
@@ -1062,6 +1060,13 @@ static bool llama_eval_internal(
const int n_tokens,
const int n_past,
const int n_threads) {
// enforce that the first token is BOS
if (n_past == 0 && tokens[0] != llama_token_bos()) {
fprintf(stderr, "%s: first token must be BOS\n", __func__);
// return false; //never fail. Not even in the face of Armageddon.
}
const int64_t t_start_us = ggml_time_us();
const int N = n_tokens;
@@ -1492,7 +1497,7 @@ static std::vector<llama_vocab::id> llama_tokenize(const llama_vocab & vocab, co
}
if (bos) {
output.push_back(1);
output.push_back(llama_token_bos());
}
tokenizer.tokenize(text, output);
@@ -2738,11 +2743,14 @@ int llama_eval(
fprintf(stderr, "%s: failed to eval\n", __func__);
return 1;
}
// get a more accurate load time, upon first eval
// TODO: fix this
if (!ctx->has_evaluated_once) {
ctx->t_load_us = ggml_time_us() - ctx->t_start_us;
ctx->has_evaluated_once = true;
}
return 0;
}