HuggingfaceHub 0.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package HuggingfaceHub --version 0.1.2                
NuGet\Install-Package HuggingfaceHub -Version 0.1.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HuggingfaceHub" Version="0.1.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add HuggingfaceHub --version 0.1.2                
#r "nuget: HuggingfaceHub, 0.1.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install HuggingfaceHub as a Cake Addin
#addin nuget:?package=HuggingfaceHub&version=0.1.2

// Install HuggingfaceHub as a Cake Tool
#tool nuget:?package=HuggingfaceHub&version=0.1.2                

A library to download models & files from HuggingFace with C#.

This library is under development. Some features have been completed but hey haven't been well tested. If you have any problem when running it from source, please open an issue to tell us.

Key features

  • Download single file.
  • Get information of file and repo.
  • Download snapshot (repo).
  • Resume download.
  • Parallel download multiple files (only in .NET 6 or higher).
  • Upload files.
  • Support repo types other than model.

Usage

Download single file

using Huggingface;
var path = await HFDownloader.DownloadFileAsync("<RepoId>", "<Filename>");

Download repo

using Huggingface;
var res = await HFDownloader.DownloadSnapshotAsync("<RepoId>");

Get repo information

Currently, only model-type repo is supported.

using Huggingface;
var info = await HFDownloader.GetModelInfoAsync("<RepoId>");

Download the repo with progress handler

using Huggingface;
var res = await HFDownloader.DownloadSnapshotAsync("<RepoId>", progress: new MyConsoleProgress());

class MyConsoleProgress: IGroupedProgress
{
    public void Report(string filename, int progress)
    {
        // Do your work here. 
        // `progress` is in range [0, 100].
    }
}

Customize the endpoint

using Huggingface;
HFGlobalConfig.EndPoint = "<Endpoint Url>";

Please check the definition of HFGlobalConfig to see all the configuration you could set.

Acknowledgement

This library is mainly adopts from huggingface_hub, which is the official implementation written in Python.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on HuggingfaceHub:

Repository Stars
SciSharp/LLamaSharp
A C#/.NET library to run LLM (🦙LLaMA/LLaVA) on your local device efficiently.
Version Downloads Last updated
0.1.3 4,336 4/24/2024
0.1.2 128 4/23/2024
0.1.1 108 4/22/2024
0.1.0 119 4/21/2024