Downloads · 30 days
15
8% of all-time downloads
FractalGPT/SbertDistilAIFr
SbertDistilAIFr is a feature extraction model from FractalGPT. Use it when you need embeddings to search or compare text. It is set up for transformers. The card lists the license as apache-2.0.
Downloads · 30 days
15
8% of all-time downloads
All-time downloads
196
Public
Repo size
47.2 MB
Likes
0
Public
Click a slice to open those files.
.onnx47.2 MB · 97%
From the Hugging Face model README
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