ONNX Model Zoo

FractalGPT/SbertDistilAIFr

By FractalGPT · ↓ 1 · ♥ 0 · Updated 2024-01-16

What's in this repo

This page lists the files in FractalGPT/SbertDistilAIFr, including model.onnx.

  • 1 ONNX models (.onnx files)
  • 7 files, including 2 .json, 1 .aifr, 1 .md, 1 .onnx, 1 .txt
  • Last updated 2024-01-16

ONNX files

File Size Download
model.onnx — Download

How to use

These ONNX files can be loaded with ONNX Runtime. To inspect a model graph, upload the file to the Netron viewer. Download links point to the original files on Hugging Face.

README

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

Model info

feature-extraction transformers
transformers onnx bert feature-extraction AIFramework 2.2 Open .net sbert C# ru en dataset:wikimedia/wikipedia dataset:SiberiaSoft/SiberianPersonaChat-2
↓ 1 ♥ 0

Created: 2024-01-15

Updated: 2024-01-16

View on Hugging Face

Files (7)

.gitattributes
1_Linear/model.aifr
README.md
config.json
model.onnx ONNX
tokenizer_config.json
vocab.txt

Related models