Skip to content

Commit

Permalink
change the initializer's parameter label and order
Browse files Browse the repository at this point in the history
  • Loading branch information
eastriverlee committed Jan 30, 2024
1 parent 6a466c6 commit 94bcc54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Sources/LLM/LLM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ public struct HuggingFaceModel {
self.filterRegexPattern = filterRegexPattern
}

public init(_ name: String, template: Template, with quantization: Quantization = .Q4_K_M) {
public init(_ name: String, _ quantization: Quantization = .Q4_K_M, template: Template) {
self.name = name
self.template = template
self.filterRegexPattern = "(?i)\(quantization.rawValue)"
Expand Down Expand Up @@ -622,8 +622,8 @@ public struct HuggingFaceModel {
return destination
}

public static func tinyLLaMA(_ systemPrompt: String, with quantization: Quantization = .Q4_K_M) -> HuggingFaceModel {
HuggingFaceModel("TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF", template: .chatML(systemPrompt), with: quantization)
public static func tinyLLaMA(_ quantization: Quantization = .Q4_K_M, _ systemPrompt: String) -> HuggingFaceModel {
HuggingFaceModel("TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF", quantization, template: .chatML(systemPrompt))
}
}

Expand Down
4 changes: 2 additions & 2 deletions Tests/LLMTests/LLMTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ final class LLMTests: XCTestCase {
}

//MARK: HuggingFaceModel tests
lazy var model = HuggingFaceModel("TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF", template: .chatML(systemPrompt), with: .Q2_K)
lazy var model = HuggingFaceModel("TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF", .Q2_K, template: .chatML(systemPrompt))
let urlString = "https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/tinyllama-1.1b-chat-v1.0.Q2_K.gguf?download=true"

func testRegexMatchCaseInsensitivity() async throws {
Expand Down Expand Up @@ -207,7 +207,7 @@ final class LLMTests: XCTestCase {
}

func testInferenceFromHuggingFaceModel() async throws {
let bot = try await LLM(from: model)
var bot = try await LLM(from: model)
let input = "have you heard of this so-called LLM.swift library?"
await bot.respond(to: input)
#assert(!bot.output.isEmpty)
Expand Down

0 comments on commit 94bcc54

Please sign in to comment.