From 32b2bdb3381d2c75e6e94d2d71b928c7ee855fb5 Mon Sep 17 00:00:00 2001 From: Andrey Leonov Date: Thu, 19 Sep 2024 21:32:05 -0400 Subject: [PATCH] Replace usage of Bundle.module to build outside SPM context --- Sources/Hub/Hub.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/Hub/Hub.swift b/Sources/Hub/Hub.swift index 613cdd9..e17e84c 100644 --- a/Sources/Hub/Hub.swift +++ b/Sources/Hub/Hub.swift @@ -202,7 +202,8 @@ public class LanguageModelConfigurationFromHub { } static func fallbackTokenizerConfig(for modelType: String) -> Config? { - guard let url = Bundle.module.url(forResource: "\(modelType)_tokenizer_config", withExtension: "json") else { return nil } + let bundle = Bundle(for: self) + guard let url = bundle.url(forResource: "\(modelType)_tokenizer_config", withExtension: "json") else { return nil } do { let data = try Data(contentsOf: url) let parsed = try JSONSerialization.jsonObject(with: data, options: [])