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
4 files
+ 54
1
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -43,6 +43,11 @@ public macro MODEL_MAKE_PREDICTION(_ input_name: Any, _ attention_ids: Any, _ ou
module: "SwiftNLPGenericLLMMacros",
type: "LLMModelPredictionCases")
@freestanding(expression)
public macro MODEL_VALIDATE_NAME() = #externalMacro(
module: "SwiftNLPGenericLLMMacros",
type: "LLMModelNameValidation")
class CoreMLEncoder<Scalar: BinaryFloatingPoint & Codable>: SNLPEncoder {
@@ -77,6 +82,8 @@ public class MiniLMEmbeddings {
self.model = model_type;
self.tokenizer = BertTokenizer(maxLen: self.inputDimention)
#MODEL_VALIDATE_NAME()
}
// MARK: - Dense Embeddings
Loading