Skip to content
Snippets Groups Projects

Add interface for using generic CoreML LLMs

Merged Abhinav Jain requested to merge compile_cmd_line_generic_model_broken into main
2 files
+ 8
3
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -34,14 +34,18 @@ import CoreML
@@ -34,14 +34,18 @@ import CoreML
class CoreMLEncoder<Scalar: BinaryFloatingPoint & Codable>: SNLPEncoder {
class CoreMLEncoder<Scalar: BinaryFloatingPoint & Codable>: SNLPEncoder {
var zeroes: [Scalar]
var zeroes: [Scalar]
func encodeToken(_ token: String) -> [Scalar] {
func encodeToken(_ token: String) -> [Scalar] {
fatalError("CoreMLEncoder not implemented yet. Get on it.")
let tokenization = MiniLMEmbeddings().tokenizer.tokenizeToIds(text: token) as! [Scalar]
 
return tokenization
}
}
func encodeSentence(_ sentence: String) -> [Scalar] {
func encodeSentence(_ sentence: String) -> [Scalar] {
fatalError("CoreMLEncoder not implemented yet. Get on it.")
let encoding = Task {
 
await MiniLMEmbeddings().encode(sentence: sentence)
 
} as! [Scalar]
 
return encoding
}
}
}
}
Loading