From 608f4498802d80d11e5d5f6ac05f4e23f49a747b Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Fri, 23 Feb 2024 19:02:09 +0200 Subject: [PATCH] swift : fix build ggml-ci --- examples/batched.swift/Sources/main.swift | 6 +++--- examples/llama.swiftui/llama.cpp.swift/LibLlama.swift | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/batched.swift/Sources/main.swift b/examples/batched.swift/Sources/main.swift index 2e1671ca0..a761a1ba3 100644 --- a/examples/batched.swift/Sources/main.swift +++ b/examples/batched.swift/Sources/main.swift @@ -79,7 +79,7 @@ batch.n_tokens = Int32(tokens.count) for (i, token) in tokens.enumerated() { batch.token[i] = token - batch.pos[i] = Float(i) + batch.pos[i] = llama_pos(i) batch.n_seq_id[i] = 1 // batch.seq_id[i][0] = 0 // TODO: is this the proper way to do this? @@ -98,7 +98,7 @@ if llama_decode(context, batch) != 0 { } for i in 1 ..< n_parallel { - llama_kv_cache_seq_cp(context, 0, Int32(i), 0, Float(batch.n_tokens)) + llama_kv_cache_seq_cp(context, 0, Int32(i), 0, llama_pos(batch.n_tokens)) } if n_parallel > 1 { @@ -173,7 +173,7 @@ while n_cur <= n_len { // push this new token for next evaluation batch.token[Int(batch.n_tokens)] = new_token_id - batch.pos[Int(batch.n_tokens)] = Float(n_cur) + batch.pos[Int(batch.n_tokens)] = llama_pos(n_cur) batch.n_seq_id[Int(batch.n_tokens)] = 1 if let seq_id = batch.seq_id[Int(batch.n_tokens)] { seq_id[0] = Int32(i) diff --git a/examples/llama.swiftui/llama.cpp.swift/LibLlama.swift b/examples/llama.swiftui/llama.cpp.swift/LibLlama.swift index 58fcf40c6..e59d642dd 100644 --- a/examples/llama.swiftui/llama.cpp.swift/LibLlama.swift +++ b/examples/llama.swiftui/llama.cpp.swift/LibLlama.swift @@ -129,7 +129,7 @@ actor LlamaContext { for i1 in 0..