-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resnet18 and AllMiniLML6V2 vectorizers
- Loading branch information
1 parent
d33e935
commit a79689c
Showing
23 changed files
with
31,239 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/Redis.OM.Vectorizers.AllMiniLML6V2/AllMiniLML6V2Tokenizer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Redis.OM.Vectorizers.AllMiniLML6V2/Redis.OM.Vectorizers.AllMiniLML6V2.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.