Skip to content

Commit

Permalink
Resnet18 and AllMiniLML6V2 vectorizers
Browse files Browse the repository at this point in the history
  • Loading branch information
slorello89 committed Nov 27, 2023
1 parent d33e935 commit a79689c
Show file tree
Hide file tree
Showing 23 changed files with 31,239 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.onnx filter=lfs diff=lfs merge=lfs -text
src/Redis.OM.Vectorizers.AllMiniLML6V2/Resources/vocab.txt filter=lfs diff=lfs merge=lfs -text
44 changes: 44 additions & 0 deletions Redis.OM.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Redis.OM.Vectorizers", "src
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Vectorizers", "Vectorizers", "{452DC80B-8195-44E8-A376-C246619492A8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Redis.OM.Vectorizers.AllMiniLML6V2", "src\Redis.OM.Vectorizers.AllMiniLML6V2\Redis.OM.Vectorizers.AllMiniLML6V2.csproj", "{081DEE32-9B26-44C6-B377-456E862D3813}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Redis.OM.Vectorizer.Tests", "test\Redis.OM.Vectorizer.Tests\Redis.OM.Vectorizer.Tests.csproj", "{7C3E1D79-408C-45E9-931C-12195DFA268D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Redis.OM.Vectorizers.Resnet18", "src\Redis.OM.Vectorizers.Resnet18\Redis.OM.Vectorizers.Resnet18.csproj", "{FE22706B-9A28-4045-9581-2058F32C4193}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -72,6 +78,42 @@ Global
{4B9F4623-3126-48B7-B690-F28F702A4717}.Release|x64.Build.0 = Release|Any CPU
{4B9F4623-3126-48B7-B690-F28F702A4717}.Release|x86.ActiveCfg = Release|Any CPU
{4B9F4623-3126-48B7-B690-F28F702A4717}.Release|x86.Build.0 = Release|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Debug|Any CPU.Build.0 = Debug|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Debug|x64.ActiveCfg = Debug|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Debug|x64.Build.0 = Debug|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Debug|x86.ActiveCfg = Debug|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Debug|x86.Build.0 = Debug|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Release|Any CPU.ActiveCfg = Release|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Release|Any CPU.Build.0 = Release|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Release|x64.ActiveCfg = Release|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Release|x64.Build.0 = Release|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Release|x86.ActiveCfg = Release|Any CPU
{081DEE32-9B26-44C6-B377-456E862D3813}.Release|x86.Build.0 = Release|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Debug|x64.ActiveCfg = Debug|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Debug|x64.Build.0 = Debug|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Debug|x86.ActiveCfg = Debug|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Debug|x86.Build.0 = Debug|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Release|Any CPU.Build.0 = Release|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Release|x64.ActiveCfg = Release|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Release|x64.Build.0 = Release|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Release|x86.ActiveCfg = Release|Any CPU
{7C3E1D79-408C-45E9-931C-12195DFA268D}.Release|x86.Build.0 = Release|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Debug|x64.ActiveCfg = Debug|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Debug|x64.Build.0 = Debug|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Debug|x86.ActiveCfg = Debug|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Debug|x86.Build.0 = Debug|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Release|Any CPU.Build.0 = Release|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Release|x64.ActiveCfg = Release|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Release|x64.Build.0 = Release|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Release|x86.ActiveCfg = Release|Any CPU
{FE22706B-9A28-4045-9581-2058F32C4193}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -81,6 +123,8 @@ Global
{E3A31119-E4F1-4793-B5C2-ED2D51502B01} = {8D9ECCFF-E022-4B68-BB43-228CEA248DEC}
{452DC80B-8195-44E8-A376-C246619492A8} = {8D9ECCFF-E022-4B68-BB43-228CEA248DEC}
{4B9F4623-3126-48B7-B690-F28F702A4717} = {452DC80B-8195-44E8-A376-C246619492A8}
{081DEE32-9B26-44C6-B377-456E862D3813} = {452DC80B-8195-44E8-A376-C246619492A8}
{FE22706B-9A28-4045-9581-2058F32C4193} = {452DC80B-8195-44E8-A376-C246619492A8}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E5752441-184B-4F17-BAD0-93823AC68607}
Expand Down
37 changes: 37 additions & 0 deletions src/Redis.OM.Vectorizers.AllMiniLML6V2/AllMiniLML6V2Tokenizer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using System.Reflection;
using Redis.OM.Vectorizers.AllMiniLML6V2.Tokenizers;

namespace Redis.OM.Vectorizers.AllMiniLML6V2;

internal class AllMiniLML6V2Tokenizer : UncasedTokenizer
{
private AllMiniLML6V2Tokenizer(string[] vocabulary) : base(vocabulary)
{
}

internal static AllMiniLML6V2Tokenizer Create()
{
var assembly = Assembly.GetExecutingAssembly();
const string fileName = "Redis.OM.Vectorizers.AllMiniLML6V2.Resources.vocab.txt";
using var stream = assembly.GetManifestResourceStream(fileName);
if (stream is null)
{
throw new FileNotFoundException("Could not find embedded resource file Resources.vocab.txt");
}
using var reader = new StreamReader(stream);

if (stream is null)
{
throw new Exception("Could not open stream reader.");
}

var vocab = new List<string>();
string? line;
while ((line = reader.ReadLine()) is not null)
{
vocab.Add(line);
}

return new AllMiniLML6V2Tokenizer(vocab.ToArray());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ML" Version="1.6.0" />
<PackageReference Include="Microsoft.ML.OnnxTransformer" Version="1.6.0" />
</ItemGroup>

<ItemGroup>
<None Remove="Resources\model.onnx" />
<EmbeddedResource Include="Resources\model.onnx" />
<None Remove="Resources\vocab.txt" />
<EmbeddedResource Include="Resources\vocab.txt" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Redis.OM\Redis.OM.csproj" />
</ItemGroup>

</Project>
Binary file not shown.
Loading

0 comments on commit a79689c

Please sign in to comment.