11 篇文章带有标签 “HuggingFace”

LeRobot:通过端到端学习让机器人人工智能更易实现

🤗 LeRobot 致力于在 PyTorch 中为真实世界的机器人提供模型、数据集和工具。其目标是降低机器人技术的入门门槛,让每个人都能通过共享数据集和预训练模型来做出贡献并从中受益。

🤗 LeRobot 包含已被证明可应用于真实世界的尖端方法,重点关注模仿学习和强化学习:github.com/huggingface/lerobot

🤗 LeRobot 已提供一系列预训练模型、包含人类收集演示的数据集以及模拟环境,让每个人都能轻松上手。在未来几周,该项目计划为市面上最经济实惠且功能强大的机器人添加越来越多的真实世界机器人支持。

🤗 LeRobot 在 HuggingFace 社区页面上托管预训练模型和数据集:huggingface.co/lerobot

Open-source DeepResearch – Freeing our search agents

Yesterday, OpenAI released Deep Research, a system that browses the web to summarize content and answer questions based on the summary. The system is impressive and blew our minds when we tried it for the first time.

昨天,OpenAI 发布了 Deep Research,这是一个浏览网页以总结内容并根据总结回答问题的系统。当我们第一次尝试时,这个系统给我们留下了深刻的印象。

One of the main results in the blog post is a strong improvement of performances on the General AI Assistants benchmark (GAIA), a benchmark we’ve been playing with recently as well, where they successfully reached near 67% correct answers on 1-shot on average, and 47.

部署 LLM 多 LoRA 适配器的推理服务

conda create -n text-generation-inference python=3.9
conda activate text-generation-inference

git clone https://github.com/huggingface/text-generation-inference.git && cd text-generation-inference
BUILD_EXTENSIONS=True make install
conda create -n vllm python=3.10 -y
conda activate vllm
pip install vllm
cd ~/HuggingFace/mistralai/Mistral-7B-v0.1
git clone https://huggingface.co/predibase/magicoder adapters/magicoder

vllm - Using LoRA adapters mistralai/Mistral-7B-v0.

Open Source Models with Hugging Face

安装依赖库

pip install transformers
from transformers.utils import logging
logging.set_verbosity_error()

from transformers import pipeline
chatbot = pipeline(task="conversational", model="facebook/blenderbot-400M-distill")

from transformers import Conversation
user_message = "What are some fun activities I can do in the winter?"
conversation = Conversation(user_message)
conversation = chatbot(conversation)
print(conversation)

# 继续对话:要在 LLM 上下文中包含之前的对话,您可以添加一条“消息”以包含之前的聊天历史记录。
conversation.add_message(
    {
// ...

Hugging Face NLP Course

以下是常见 NLP 任务的列表:

  • 对整个句子进行分类:
    • 获取评论的情绪
    • 检测电子邮件是否为垃圾邮件
    • 确定句子在语法上是否正确
    • 确定两个句子在逻辑上是否相关
  • 对句子中的每个词进行分类:
    • 识别句子的语法成分(名词、动词、形容词)
    • 识别句子的命名实体(人、地点、组织)
  • 生成文本内容:
    • 用自动生成的文本完成提示
    • 用屏蔽词填充文本中的空白
  • 从文本中提取答案:
    • 给定问题和上下文,根据上下文中提供的信息提取问题的答案
  • 从输入文本生成新句子:
    • 将文本翻译成另一种语言
    • 总结文本
  • 语音识别:
    • 生成音频样本的转录
  • 计算机视觉:
    • 生成图像描述
    • 目标检测
from transformers import pipeline

classifier = pipeline("sentiment-analysis")
classifier("I've been waiting for a HuggingFace course my whole life.")
[{'label': 'POSITIVE', 'score': 0.9598047137260437}]

将一些文本传递到 pipeline 时涉及三个主要步骤:

文本被预处理为模型可以理解的格式。 预处理的输入被传递给模型。

在 MLX 上使用 LoRA / QLoRA 微调 Text2SQL(三):分享微调后的模型到 HuggingFace Hub

pip install mlx-lm
  1. 加入 MLX Community 组织
  1. 在 MLX Community 组织中创建一个新的模型 mlx-community/Mistral-7B-v0.1-LoRA-Text2SQL
  1. 克隆仓库 mlx-community/Mistral-7B-v0.1-LoRA-Text2SQL
git clone https://huggingface.co/mlx-community/Mistral-7B-v0.1-LoRA-Text2SQL
  1. 将生成的模型文件(lora_fused_model 目录下的所有文件)复制到仓库目录下
  1. 上传模型到 HuggingFace Hub
git add .
git commit -m "Fine tuning Text2SQL based on Mistral-7B using LoRA on MLX" 
git push
  1. 不能 push

错误信息:

Hugging Face 快速入门

机器学习的成功取决于为用例找到最佳架构、微调模型并将它们部署到生产环境中。 所有这些都需要经验和技能的正确结合。 我们的专家加速计划提供必要的技术专长,以实施最先进的技术、做出更好的决策并更快地进入市场。

  • 如何为我的用例微调(fine-tune)模型? 哪些基础架构(base architectures)?多少训练数据?
  • 如何优化我的模型以获得最小延迟(latency)? 蒸馏(Distillation)。汇编(Compilation)。量化(Quantization)。修剪(Pruning)。 我们可以指导您完成每一步。
  • 如何优化我的生产环境? 调整您的 CPU、GPU 或 AI 加速器配置以获得最大性能。
  • 如何在 SageMaker 中使用 Transformers? 模型并行性(model parallelism)、数据并行性(data parallelism)、部署(deployment)等。
  • 我如何检测和减轻数据集和模型中的偏见(bias)? 我们可以帮助您让人工智能更负责任。

硬件专用加速工具

  1. 量化(Quantize)

利用英特尔® Neural Compressor 的训练后量化、量化感知训练和动态量化,在对准确性影响最小的情况下更快地建立模型。

  1. 修剪(Prune)

使模型更小,对准确性的影响最小,通过英特尔® Neural Compressor 使用简单易用的配置来消除模型权

在 Hugging Face 上搭建 ChatGPT 聊天机器人

import openai
import tiktoken


class Conversation:
    def __init__(self, prompt, model="gpt-3.5-turbo", temperature=0.8, max_tokens=250):
        self.prompt = prompt
        self.model = model
        self.temperature = temperature
        self.max_tokens = max_tokens

        self._init_messages()

    def _init_messages(self):
        self.messages = [{"role": "system", "content": self.prompt}]
// ...