Hugging Face使用笔记

1. HuggingFace简介

Hugging Face Hub和 Github 类似,都是Hub(社区)。Hugging Face可以说的上是机器学习界的Github。Hugging Face为用户提供了以下主要功能:

  • 模型仓库(Model Repository):Git仓库可以让你管理代码版本、开源代码。而模型仓库可以让你管理模型版本、开源模型等。使用方式与Github类似。
  • 模型(Models):Hugging Face为不同的机器学习任务提供了许多预训练好的机器学习模型供大家使用,这些模型就存储在模型仓库中。
  • 数据集(Dataset):Hugging Face上有许多公开数据集。

hugging face在NLP领域最出名,其提供的模型大多都是基于Transformer的。为了易用性,Hugging Face还为用户提供了以下几个项目:

  • Transformers(github, 官方文档):Transformers提供了上千个预训练好的模型可以用于不同的任务,例如文本领域、音频领域和CV领域。该项目是HuggingFace的核心,可以说学习HuggingFace就是在学习该项目如何使用。
  • Datasets(github, 官方文档):一个轻量级的数据集框架,主要有两个功能:①一行代码下载和预处理常用的公开数据集; ② 快速、易用的数据预处理类库。
  • Accelerate(github, 官方文档):帮助Pytorch用户很方便的实现 multi-GPU/TPU/fp16。
  • Space(链接):Space提供了许多好玩的深度学习应用,可以尝试玩一下。

2. 注册与登陆

这里不用多说,使用邮箱注册,邮箱验证,然后登陆

3. 配置token

 

关于这个类型的定义,有如下说明:

  • fine-grained: tokens with this role can be used to provide fine-grained access to specific resources, such as a specific model or models in a specific organization. This type of token is useful in production environments, as you can use your own token without sharing access to all your resources.
  • read: tokens with this role can only be used to provide read access to repositories you could read. That includes public and private repositories that you, or an organization you’re a member of, own. Use this role if you only need to read content from the Hugging Face Hub (e.g. when downloading private models or doing inference).
  • write: tokens with this role additionally grant write access to the repositories you have write access to. Use this token if you need to create or push content to a repository (e.g., when training a model or modifying a model card).

4. 下载数据

这里会给你命令,按命令执行即可

 

注意:有时下载时间可能很久(多达几十小时),而且没有进度条。

5. 下载预训练模型

注意:有时下载时间可能很久(多达几十小时),而且没有进度条。  

参考文献

Hugging Face快速入门(重点讲解模型(Transformers)和数据集部分(Datasets))_huggingface-CSDN博客

相关推荐

  1. huggingface使用与环境移植

    2024-07-10 17:16:02       45 阅读
  2. Huggingface T5模型代码笔记

    2024-07-10 17:16:02       44 阅读
  3. pip/huggingface/conda常用命令笔记

    2024-07-10 17:16:02       30 阅读
  4. HuggingFace学习笔记--利用API实现简单的NLP任务

    2024-07-10 17:16:02       38 阅读
  5. git lfs使用huggingface下载大模型文件)

    2024-07-10 17:16:02       24 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-10 17:16:02       5 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-10 17:16:02       5 阅读
  3. 在Django里面运行非项目文件

    2024-07-10 17:16:02       4 阅读
  4. Python语言-面向对象

    2024-07-10 17:16:02       5 阅读

热门阅读

  1. Leetcode101 判断二叉树是否对称

    2024-07-10 17:16:02       7 阅读
  2. 【深入剖析】Kylin架构全景及其组件详解

    2024-07-10 17:16:02       9 阅读
  3. poi导出值班excel

    2024-07-10 17:16:02       9 阅读
  4. MP公共字段填充

    2024-07-10 17:16:02       10 阅读
  5. 配置 VSCode C++ 调试时, 常见错误教程

    2024-07-10 17:16:02       10 阅读