Porting this model for use in C#

  • Example of use in C#:

    using AI.DataPrepaire.DataLoader.NNWBlockLoader;
    using AI.DataStructs.Algebraic;
    using AI.ONNX.NLP.Bert;
    
    
    string path = "SbertDistilAIFr";
    // Загрузка модели Bert
    BertEmbedder embedder = BertEmbedder.FromPretrained(path);
    // Добавление последнего(линейного) слоя
    LinearLayerLoader linearLayer = LinearLayerLoader.LoadFromBinary(@$"{path}\1_Linear\model.aifr");
    embedder.V2VBlocks.Add(linearLayer);
    
    // Векторизация предложений
    Vector vects1 = embedder.ForwardSBert("Kittens love milk");
    Vector vects2 = embedder.ForwardSBert("Visual Studio Code (VS Code) — текстовый редактор, разработанный Microsoft для Windows, Linux и macOS.");
    Vector vects3 = embedder.ForwardSBert("Visual Studio Code, also commonly referred to as VS Code,[12] is a source-code editor developed by Microsoft for Windows, Linux and macOS.");
    Vector vects1_rus = embedder.ForwardSBert("Котята любят молоко");
    
    // Рассчет близости между текстами
    Console.WriteLine(vects1.Cos(vects1_rus));
    Console.WriteLine(vects1.Cos(vects2));
    Console.WriteLine(vects2.Cos(vects3));
    Console.WriteLine(vects1.Cos(vects3));
    Console.ReadKey();
    
  • Network output

0.8312274467817271
0.18402859300814606
0.9556528309990797
0.14738954582438052
Downloads last month
13
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.

Datasets used to train FractalGPT/SbertDistilAIFr