Mila
Deep Neural Network Library
Loading...
Searching...
No Matches
Mila::Distribution::HuggingFaceHub Class Referenceexport

The HuggingFace hub. More...

Inheritance diagram for Mila::Distribution::HuggingFaceHub:
Mila::Distribution::IModelHub

Public Member Functions

 HuggingFaceHub (std::shared_ptr< const IHttpTransport > transport, std::string token=discoverHuggingFaceToken(), ProgressCallback progress={})
FetchReport fetchFile (const ModelCoordinate &coordinate, const std::string &path, uint64_t resume_from, const std::function< bool(const char *, size_t)> &sink) const override
 Stream one repository file, resuming from an offset.
std::string fetchManifest (const ModelCoordinate &coordinate) const override
 The raw mila.json text for a coordinate.
std::vector< HubModellistModels (const std::string &owner) const override
 Every repository an owner publishes.
std::string name () const override
 Stable identifier recorded in a store record, e.g. "huggingface".

Detailed Description

The HuggingFace hub.

The only class in the library that names a huggingface.co URL. It composes an HttpClient rather than a transport: redirects, the cross-host token rule and the Range protocol are the client's business, and this class should no more reimplement them than it should open a socket.

Member Function Documentation

◆ fetchFile()

FetchReport Mila::Distribution::HuggingFaceHub::fetchFile ( const ModelCoordinate & coordinate,
const std::string & path,
uint64_t resume_from,
const std::function< bool(const char *, size_t)> & sink ) const
inlineoverridevirtual

Stream one repository file, resuming from an offset.

Implements Mila::Distribution::IModelHub.

◆ fetchManifest()

std::string Mila::Distribution::HuggingFaceHub::fetchManifest ( const ModelCoordinate & coordinate) const
inlineoverridevirtual

The raw mila.json text for a coordinate.

Implements Mila::Distribution::IModelHub.

◆ listModels()

std::vector< HubModel > Mila::Distribution::HuggingFaceHub::listModels ( const std::string & owner) const
inlineoverridevirtual

Every repository an owner publishes.

The result is untrusted remote text authored by whoever owns the repository. It is data: rendered, never interpreted as markup and never as instructions.

Implements Mila::Distribution::IModelHub.

◆ name()

std::string Mila::Distribution::HuggingFaceHub::name ( ) const
inlineoverridevirtual

Stable identifier recorded in a store record, e.g. "huggingface".

Implements Mila::Distribution::IModelHub.


The documentation for this class was generated from the following file: