首页 科技周边 人工智能 在Databricks上部署DeepSeek R1:逐步指南

在Databricks上部署DeepSeek R1:逐步指南

Feb 28, 2025 pm 04:33 PM

>在Databricks上部署DeepSeek R1模型:逐步指南

流行的数据工程平台 databricks越来越多地用于AI和机器学习任务。 该教程通过在Databricks上部署分布式DeepSeek R1模型来指导您,这是一种强大的大型语言模型,通常是本地部署的优先使用。 这避免将数据发送到外部服务器。 要深入了解DeepSeek R1的功能和比较,请参见DeepSeek-R1:功能,比较,蒸馏模型和更多博客。

本指南涵盖了帐户设置,使用UI的模型注册以及通过操场和本地卷曲命令访问。 Databricks的新手? Databricks课程简介提供了Databricks Lakehouse平台及其数据管理功能的全面概述。 要更深入地了解Databricks中的数据管理,请考虑Databricks课程中的数据管理。

注册DeepSeek R1模型>

    >
  1. >启动笔记本:创建您的数据链球工作空间后,单击“ new”,然后选择笔记本。

Deploying DeepSeek R1 on Databricks: A Step-by-Step Guide

    >
  1. >安装软件包:安装必要的python库:
%%capture
!pip install torch transformers mlflow accelerate torchvision
%restart_python
登录后复制
登录后复制
  1. 负载模型和代币器:从拥抱面上加载DeepSeek R1型号和令牌,>
import pandas as pd
import mlflow
import mlflow.transformers
import torch
from mlflow.models.signature import infer_signature
from transformers import AutoModelForCausalLM, AutoTokenizer, AutoConfig, pipeline

model_name = "deepseek-ai/DeepSeek-R1-Distill-Llama-8B"
tokenizer = AutoTokenizer.from_pretrained(model_name)
config = AutoConfig.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, config=config, torch_dtype=torch.float16)
登录后复制

Deploying DeepSeek R1 on Databricks: A Step-by-Step Guide

    >>>测试模型:
  1. 使用样本提示进行测试,并生成用于模型注册的签名:
预期输出(可能会稍有变化):
text_generator = pipeline("text-generation", model=model, tokenizer=tokenizer)
example_prompt = "How does a computer work?"
example_inputs = pd.DataFrame({"inputs": [example_prompt]})
example_outputs = text_generator(example_prompt, max_length=200)
signature = infer_signature(example_inputs, example_outputs)
print(example_outputs)
登录后复制

<code>[{'generated_text': "How does a computer work? What is the computer? What is the computer used for? What is the computer used for in real life?\n\nI need to answer this question, but I need to do it step by step. I need to start with the very basic level and build up from there. I need to make sure I understand each concept before moving on. I need to use a lot of examples to explain each idea. I need to write my thoughts as if I'm explaining them to someone else, but I need to make sure I understand how to structure the answer properly.\n\nOkay, let's start with the basic level. What is a computer? It's an electronic device, right? And it has a central processing unit (CPU) that does the processing. But I think the central processing unit is more efficient, so maybe it's the CPU. Then, it has memory and storage. I remember that memory is like RAM and storage is like ROM. But wait, I think"}]</code>
登录后复制
    conda环境:
  1. 定义一个conda环境:
conda_env = {
    "name": "mlflow-env",
    "channels": ["defaults", "conda-forge"],
    "dependencies": [
        "python=3.11",
        "pip",
        {"pip": ["mlflow", "transformers", "accelerate", "torch", "torchvision"]}
    ]
}
登录后复制
    注册模型:
  1. 使用注册模型: mlflow.transformers.log_model
with mlflow.start_run() as run:
    mlflow.transformers.log_model(
        transformers_model=text_generator,
        artifact_path="deepseek_model",
        signature=signature,
        input_example=example_inputs,
        registered_model_name="deepseek_r1_llama_8b",
        conda_env=conda_env
    )
登录后复制

Deploying DeepSeek R1 on Databricks: A Step-by-Step Guide

部署DeepSeek R1

    >
  1. >导航到模型:

    在databricks仪表板中,转到“模型”选项卡。

    >
  2. 使用模型:
  3. 选择您的模型,然后单击“使用此模型”。

    1. 配置端点:命名您的端点,选择计算选项,设置并发性,然后单击“创建”。

    Deploying DeepSeek R1 on Databricks: A Step-by-Step Guide

    Deploying DeepSeek R1 on Databricks: A Step-by-Step Guide

    有关自定义数据集上的微调,请参阅微调DeepSeek R1教程。

    >访问已部署的模型

    >

      > databricks Playground:
    1. 直接在Databricks Playground中进行测试。

    Deploying DeepSeek R1 on Databricks: A Step-by-Step Guide

      curl命令:生成数据链球api键(设置&gt; developer),将其设置为环境变量(
    1. ),然后使用curl:> $DATABRICKS_TOKEN
    %%capture
    !pip install torch transformers mlflow accelerate torchvision
    %restart_python
    登录后复制
    登录后复制

    Deploying DeepSeek R1 on Databricks: A Step-by-Step Guide

    有关DeepSeek R1 vs. V3的信息,请参见DeepSeek R1 vs V3博客。 LLM的新手? Python课程中LLMS的介绍是一个很棒的起点。 请记住,尽管CPU部署是可能的,但可能会慢。

    >

    以上是在Databricks上部署DeepSeek R1:逐步指南的详细内容。更多信息请关注PHP中文网其他相关文章!

本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热工具

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

最佳AI艺术生成器(免费付款)创意项目 最佳AI艺术生成器(免费付款)创意项目 Apr 02, 2025 pm 06:10 PM

本文回顾了AI最高的艺术生成器,讨论了他们的功能,对创意项目的适用性和价值。它重点介绍了Midjourney是专业人士的最佳价值,并建议使用Dall-E 2进行高质量的可定制艺术。

开始使用Meta Llama 3.2 -Analytics Vidhya 开始使用Meta Llama 3.2 -Analytics Vidhya Apr 11, 2025 pm 12:04 PM

Meta的Llama 3.2:多模式和移动AI的飞跃 Meta最近公布了Llama 3.2,这是AI的重大进步,具有强大的视觉功能和针对移动设备优化的轻量级文本模型。 以成功为基础

最佳AI聊天机器人比较(Chatgpt,Gemini,Claude&amp;更多) 最佳AI聊天机器人比较(Chatgpt,Gemini,Claude&amp;更多) Apr 02, 2025 pm 06:09 PM

本文比较了诸如Chatgpt,Gemini和Claude之类的顶级AI聊天机器人,重点介绍了其独特功能,自定义选项以及自然语言处理和可靠性的性能。

10个生成AI编码扩展,在VS代码中,您必须探索 10个生成AI编码扩展,在VS代码中,您必须探索 Apr 13, 2025 am 01:14 AM

嘿,编码忍者!您当天计划哪些与编码有关的任务?在您进一步研究此博客之前,我希望您考虑所有与编码相关的困境,这是将其列出的。 完毕? - 让&#8217

顶级AI写作助理来增强您的内容创建 顶级AI写作助理来增强您的内容创建 Apr 02, 2025 pm 06:11 PM

文章讨论了Grammarly,Jasper,Copy.ai,Writesonic和Rytr等AI最高的写作助手,重点介绍了其独特的内容创建功能。它认为Jasper在SEO优化方面表现出色,而AI工具有助于保持音调的组成

AV字节:Meta&#039; llama 3.2,Google的双子座1.5等 AV字节:Meta&#039; llama 3.2,Google的双子座1.5等 Apr 11, 2025 pm 12:01 PM

本周的AI景观:进步,道德考虑和监管辩论的旋风。 OpenAI,Google,Meta和Microsoft等主要参与者已经释放了一系列更新,从开创性的新车型到LE的关键转变

向员工出售AI策略:Shopify首席执行官的宣言 向员工出售AI策略:Shopify首席执行官的宣言 Apr 10, 2025 am 11:19 AM

Shopify首席执行官TobiLütke最近的备忘录大胆地宣布AI对每位员工的基本期望是公司内部的重大文化转变。 这不是短暂的趋势。这是整合到P中的新操作范式

选择最佳的AI语音生成器:评论的顶级选项 选择最佳的AI语音生成器:评论的顶级选项 Apr 02, 2025 pm 06:12 PM

本文评论了Google Cloud,Amazon Polly,Microsoft Azure,IBM Watson和Discript等高级AI语音生成器,重点介绍其功能,语音质量和满足不同需求的适用性。

See all articles