File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ private extension HubApi {
52
52
)
53
53
}
54
54
} ,
55
+ { try ? String ( contentsOf: . homeDirectory. appendingPathComponent ( " .cache/huggingface/token " ) , encoding: . utf8) } ,
55
56
{ try ? String ( contentsOf: . homeDirectory. appendingPathComponent ( " .huggingface/token " ) , encoding: . utf8) }
56
57
]
57
58
return possibleTokens
Original file line number Diff line number Diff line change @@ -140,6 +140,23 @@ class LlamaPostProcessorOverrideTests: XCTestCase {
140
140
}
141
141
}
142
142
143
+ class LocalFromPretrainedTests : XCTestCase {
144
+ func testLocalTokenizerFromPretrained( ) async throws {
145
+ let downloadDestination : URL = {
146
+ let base = FileManager . default. urls ( for: . cachesDirectory, in: . userDomainMask) . first!
147
+ return base. appending ( component: " hf-local-pretrained-tests-downloads " )
148
+ } ( )
149
+
150
+ let hubApi = HubApi ( downloadBase: downloadDestination)
151
+ let downloadedTo = try await hubApi. snapshot ( from: " pcuenq/gemma-tokenizer " )
152
+
153
+ let tokenizer = try await AutoTokenizer . from ( modelFolder: downloadedTo) as? PreTrainedTokenizer
154
+ XCTAssertNotNil ( tokenizer)
155
+
156
+ try FileManager . default. removeItem ( at: downloadDestination)
157
+ }
158
+ }
159
+
143
160
class BertDiacriticsTests : XCTestCase {
144
161
func testBertCased( ) async throws {
145
162
guard let tokenizer = try await AutoTokenizer . from ( pretrained: " distilbert/distilbert-base-multilingual-cased " ) as? PreTrainedTokenizer else {
You can’t perform that action at this time.
0 commit comments