Merge branch 'master' into speculative-tree

This commit is contained in:
Georgi Gerganov 2023-10-17 19:31:40 +03:00 committed by GitHub
commit bd9451ca2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 385 additions and 90 deletions

View file

@ -217,7 +217,7 @@ llama_print_timings(context)
private func tokenize(text: String, add_bos: Bool) -> [llama_token] {
let n_tokens = text.count + (add_bos ? 1 : 0)
let tokens = UnsafeMutablePointer<llama_token>.allocate(capacity: n_tokens)
let tokenCount = llama_tokenize(model, text, Int32(text.count), tokens, Int32(n_tokens), add_bos)
let tokenCount = llama_tokenize(model, text, Int32(text.count), tokens, Int32(n_tokens), add_bos, /*special tokens*/ false)
var swiftTokens: [llama_token] = []
for i in 0 ..< tokenCount {
swiftTokens.append(tokens[Int(i)])