Hugging Face
Key Concepts
Introduction
Hugging Face is a leading company in natural language processing (NLP), providing powerful tools and pre-trained models that can significantly enhance your trading algorithms on QuantConnect. By integrating Hugging Face's models, you can easily leverage advanced NLP capabilities for tasks such as sentiment analysis, news classification, and market forecasting without defining and training the model yourself. Hugging Face provides an easy way to leverage the research of community members to increase the sophistication of your trading algorithms.
Supported Models
Hundreds of thousands of Hugging Face models are publicly available and ready to use. To view all of them, see the Model Hub on the Hugging Face website. The Model card tab of each model repository explains an overview of how the model works, its requirements, and a quick start guide.
QuantConnect Cloud caches some of the most popular models to speed up your development workflow. The following table shows the cached models:
To see the commit hash of the cached models, run the following algorithm in QC Cloud and then view the logs:
# Scan and log all cached Hugging Face model revisions from the cache directory. from huggingface_hub import scan_cache_dir class HuggingFaceModelHashAlgorithm(QCAlgorithm): def initialize(self): cache_info = scan_cache_dir() cached_models_log = [] for entry in cache_info.repos: revisions = [revision.commit_hash for revision in entry.revisions] cached_models_log.append(f'Repo: {entry.repo_id}. Revisions {str(revisions)}') self.quit('\n'.join(sorted(cached_models_log)))