Connecting to HuggingFace
HuggingFace Hub uses token-based authentication to enable access to its API. The API provides access to machine learning models, datasets, spaces, papers, and other resources on the HuggingFace Hub platform.
Using API Key Authentication
To authenticate to HuggingFace Hub, you will need to provide an API Key (Access Token). To obtain your access token:
- Log in to your HuggingFace account at https://huggingface.co
- Navigate to Settings > Access Tokens
- Click "New token" to create a new access token
- Select the appropriate permissions (read or write)
- Copy the token value
After obtaining your access token, set the following connection properties:
- AuthScheme: Set this to APIKey.
- APIKey: Set this to your HuggingFace access token.
Example connection string
Profile=C:\profiles\HuggingFace.apip;ProfileSettings='APIKey=hf_xxxxxxxxxxxxxxxxxxxx';
Available Tables
The HuggingFace profile provides access to the following tables:
- Models: Machine learning models hosted on HuggingFace Hub
- Datasets: Datasets for machine learning hosted on HuggingFace Hub
- Spaces: Web applications (demos) hosted on HuggingFace Hub
- Collections: User-curated collections of models, datasets, and spaces
- DailyPapers: Daily ArXiv paper submissions featured on HuggingFace
- Papers: Individual ArXiv paper details
- WhoAmI: Authenticated user profile information
- Metrics: Evaluation metrics available on HuggingFace Hub
- Trending: Trending repositories (models, datasets, spaces)
- Notifications: User notifications from HuggingFace Hub
Notes
- Access tokens with 'read' permission can access public repositories and private repositories you have access to.
- Some endpoints like WhoAmI and Notifications require authentication.
- Public endpoints (Models, Datasets, Spaces listing) can be accessed without authentication but may have rate limits.
Usage Examples
Collections:
SELECT * FROM Collections
DailyPapers:
SELECT * FROM DailyPapers
Datasets:
SELECT * FROM Datasets
Metrics:
SELECT * FROM Metrics
Models:
SELECT * FROM Models
Notifications:
SELECT * FROM Notifications
Papers:
SELECT * FROM Papers WHERE Id = '2301.07041'
Spaces:
SELECT * FROM Spaces
Trending:
SELECT * FROM Trending
WhoAmI:
SELECT * FROM WhoAmI
Connection Properties
The connection string properties are the various options that can be used to establish a connection. This section provides a complete list of the options you can configure in the connection string for this provider.
| Property | Description |
| APIKey | The API key (access token) used to authenticate to the HuggingFace Hub API. |
| AuthScheme | The scheme used for authentication. Accepted entries are APIKey or None. Allowed values are: BASIC, NONE, NTLM, OAUTH, APIKEY, OAUTH_CLIENT |