From 87c4d7311294ed1b7792f2fe65633382aa7b2417 Mon Sep 17 00:00:00 2001 From: Oleg Tarasov Date: Mon, 30 Sep 2024 14:46:00 +0300 Subject: [PATCH] Updated native libraries --- .github/workflows/BuildAndPublish.yml | 14 ++++----- ConsoleTest/ConsoleTest.csproj | 4 +-- .../FastText.NetWrapper.csproj | 6 ++-- .../FastText.NetWrapper.nuspec | 6 ++-- README.md | 30 +++++++++++-------- UnitTests/UnitTests.csproj | 2 +- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/.github/workflows/BuildAndPublish.yml b/.github/workflows/BuildAndPublish.yml index e43865a..a06a3f3 100644 --- a/.github/workflows/BuildAndPublish.yml +++ b/.github/workflows/BuildAndPublish.yml @@ -3,7 +3,7 @@ name: Build and publish on: push: tags: - - '*' + - "*" jobs: test: @@ -13,12 +13,12 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.100 + dotnet-version: 8.0.402 - name: Run tests run: dotnet test @@ -27,14 +27,14 @@ jobs: if: ${{ startsWith(github.ref, 'refs/tags/') && !contains(github.event.head_commit.message, 'skip ci') }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: olegtarasov/get-tag@v2.1 + - uses: actions/checkout@v4 + - uses: olegtarasov/get-tag@v2.1.3 - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: - dotnet-version: 6.0.100 - + dotnet-version: 8.0.402 + - name: Create the package run: dotnet pack FastText.NetWrapper --configuration Release -p:PackageVersion=$GIT_TAG_NAME -o . diff --git a/ConsoleTest/ConsoleTest.csproj b/ConsoleTest/ConsoleTest.csproj index a3a4930..d71a6d4 100644 --- a/ConsoleTest/ConsoleTest.csproj +++ b/ConsoleTest/ConsoleTest.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 latest true @@ -28,5 +28,5 @@ - + diff --git a/FastText.NetWrapper/FastText.NetWrapper.csproj b/FastText.NetWrapper/FastText.NetWrapper.csproj index 45186cd..5fadc90 100644 --- a/FastText.NetWrapper/FastText.NetWrapper.csproj +++ b/FastText.NetWrapper/FastText.NetWrapper.csproj @@ -14,9 +14,9 @@ - - - + + + diff --git a/FastText.NetWrapper/FastText.NetWrapper.nuspec b/FastText.NetWrapper/FastText.NetWrapper.nuspec index 1cb1d4b..9b04b20 100644 --- a/FastText.NetWrapper/FastText.NetWrapper.nuspec +++ b/FastText.NetWrapper/FastText.NetWrapper.nuspec @@ -14,9 +14,9 @@ - - - + + + diff --git a/README.md b/README.md index 5ac3f14..5accefa 100644 --- a/README.md +++ b/README.md @@ -4,15 +4,15 @@ # FastText.NetWrapper -This is a cross-platform .NET Standard wrapper for Facebook's [FastText](https://github.com/facebookresearch/fastText) library. +This is a cross-platform .NET Standard wrapper for Facebook's [FastText](https://github.com/facebookresearch/fastText) library. The wrapper comes with bundled precompiled native binaries for all three platforms: Windows, Linux and MacOs. -Just add it to your project and start using it! No additional setup required. This library will unpack and call appropriate native +Just add it to your project and start using it! No additional setup required. This library will unpack and call appropriate native binary depending on target platform. ## Is this project dead or abandoned? -Of course not! It's just complete :) There are no major updates for fastText, and most bugs in this repository are fixed. All the features +Of course not! It's just complete :) There are no major updates for fastText, and most bugs in this repository are fixed. All features should work and if something doesn't — just ping me with an issue and I will try to get back to you. ## Usage @@ -34,7 +34,7 @@ Note the arguments: https://dl.fbaipublicfiles.com/fasttext/data/cooking.stackexchange.tar.gz. You can find extracted files split into training and validation sets in `UnitTests` directory in this repository. 2. Your model will be saved to `cooking.bin` and `cooking.vec` with pretrained vectors will be placed if the same directory. -3. Here we use `Supervised()` overload with 2 arguments. This means that training will be done with default parameters. +3. Here we use `Supervised()` overload with 2 arguments. This means that training will be done with default parameters. It's a good starting point and is the same as calling fastText this way: ```bash @@ -60,7 +60,7 @@ the dimension 0. ```c# var fastText = new FastTextWrapper(); - + var args = new SupervisedArgs { PretrainedVectors = "cooking.unsup.300.vec", @@ -113,7 +113,7 @@ var plotModel = new PlotModel using (var stream = new FileStream("precision-recall.svg", FileMode.Create, FileAccess.Write)) { - SvgExporter.Export(plotModel, stream, 600, 600, false); + SvgExporter.Export(plotModel, stream, 600, 600, false); } ``` @@ -163,7 +163,7 @@ var autotuneArgs = new AutotuneArgs Duration = 30, // in seconds Metric = "precisionAtRecall:30", // supports custom metrics Predictions = 2, // Supports @k predictions - ModelSize = "10M", // Set this to train a quantized model and do an + ModelSize = "10M", // Set this to train a quantized model and do an // additional quantization hyperparameter search. Requires QuantizedSupervisedArgs. ValidationFile = "cooking.valid.txt" // REQUIRED: path to a validation file }; @@ -212,7 +212,7 @@ You can also inject your standard `IloggerFactory` through .NET Core DI. ```c# // Add the following Nuget packages to your project: // * Serilog.Sinks.Console -// * Serilog.Extensions.Logging +// * Serilog.Extensions.Logging Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() @@ -229,9 +229,9 @@ In version `1.1` I've added much better native error handling. Now in case of mo ## Windows Requirements -Since this wrapper uses native C++ binaries under the hood, you will need to have Visual C++ Runtime Version 140 installed when -running under Windows. Visit the MS Downloads page (https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) -and select the appropriate redistributable. +Since this wrapper uses native C++ binaries under the hood, you will need to have Visual C++ Runtime Version 140 installed when +running under Windows. Visit the MS Downloads page (https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) +and select the appropriate redistributable. ## FastText C-style API @@ -239,9 +239,13 @@ If you are interested in using FastText with C-style API, here is my fork of the ## Changelog +### `1.3.1` + +* Updated fastText binaries with latest improvements from the Facebook repo. + ### `1.3.0` -* Native libraries are now explicitly included in target project and copied to output directory. Hopefully, +* Native libraries are now explicitly included in target project and copied to output directory. Hopefully, this solves a couple of problems with the previous approach of dynamically extracting libraries from resources. @@ -294,4 +298,4 @@ Version 1.2.0 introduces a few breaking changes to library API. If you are not r ## Version `1.2.0` migration guide * Instead of old `Train()` methods use `Supervised()` and `Unsupervised()` methods. -* Instead of `FastTextArgs.SupervisedDefaults()` use `SupervisedArgs` or `Supervised()` overload with 2 arguments. \ No newline at end of file +* Instead of `FastTextArgs.SupervisedDefaults()` use `SupervisedArgs` or `Supervised()` overload with 2 arguments. diff --git a/UnitTests/UnitTests.csproj b/UnitTests/UnitTests.csproj index 39bb4b1..07a4bdf 100644 --- a/UnitTests/UnitTests.csproj +++ b/UnitTests/UnitTests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 false latest true