首頁 科技週邊 人工智慧 在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

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

<🎜>:泡泡膠模擬器無窮大 - 如何獲取和使用皇家鑰匙
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
北端:融合系統,解釋
3 週前 By 尊渡假赌尊渡假赌尊渡假赌
Mandragora:巫婆樹的耳語 - 如何解鎖抓鉤
3 週前 By 尊渡假赌尊渡假赌尊渡假赌

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

熱門話題

Java教學
1666
14
CakePHP 教程
1425
52
Laravel 教程
1328
25
PHP教程
1273
29
C# 教程
1253
24
10個生成AI編碼擴展,在VS代碼中,您必須探索 10個生成AI編碼擴展,在VS代碼中,您必須探索 Apr 13, 2025 am 01:14 AM

嘿,編碼忍者!您當天計劃哪些與編碼有關的任務?在您進一步研究此博客之前,我希望您考慮所有與編碼相關的困境,這是將其列出的。 完畢? - 讓&#8217

GPT-4O vs OpenAI O1:新的Openai模型值得炒作嗎? GPT-4O vs OpenAI O1:新的Openai模型值得炒作嗎? Apr 13, 2025 am 10:18 AM

介紹 Openai已根據備受期待的“草莓”建築發布了其新模型。這種稱為O1的創新模型增強了推理能力,使其可以通過問題進行思考

如何在SQL中添加列? - 分析Vidhya 如何在SQL中添加列? - 分析Vidhya Apr 17, 2025 am 11:43 AM

SQL的Alter表語句:動態地將列添加到數據庫 在數據管理中,SQL的適應性至關重要。 需要即時調整數據庫結構嗎? Alter表語句是您的解決方案。本指南的詳細信息添加了Colu

pixtral -12b:Mistral AI&#039;第一個多模型模型 - 分析Vidhya pixtral -12b:Mistral AI&#039;第一個多模型模型 - 分析Vidhya Apr 13, 2025 am 11:20 AM

介紹 Mistral發布了其第一個多模式模型,即Pixtral-12b-2409。該模型建立在Mistral的120億參數Nemo 12B之上。是什麼設置了該模型?現在可以拍攝圖像和Tex

如何使用AGNO框架構建多模式AI代理? 如何使用AGNO框架構建多模式AI代理? Apr 23, 2025 am 11:30 AM

在從事代理AI時,開發人員經常發現自己在速度,靈活性和資源效率之間進行權衡。我一直在探索代理AI框架,並遇到了Agno(以前是Phi-

超越駱駝戲:大型語言模型的4個新基準 超越駱駝戲:大型語言模型的4個新基準 Apr 14, 2025 am 11:09 AM

陷入困境的基準:駱駝案例研究 2025年4月上旬,梅塔(Meta)揭開了其Llama 4套件的模特,擁有令人印象深刻的性能指標,使他們對GPT-4O和Claude 3.5 Sonnet等競爭對手的良好定位。倫斯的中心

多動症遊戲,健康工具和AI聊天機器人如何改變全球健康 多動症遊戲,健康工具和AI聊天機器人如何改變全球健康 Apr 14, 2025 am 11:27 AM

視頻遊戲可以緩解焦慮,建立焦點或支持多動症的孩子嗎? 隨著醫療保健在全球範圍內挑戰,尤其是在青年中的挑戰,創新者正在轉向一種不太可能的工具:視頻遊戲。現在是世界上最大的娛樂印度河之一

Andrew Ng的新簡短課程 Andrew Ng的新簡短課程 Apr 15, 2025 am 11:32 AM

解鎖嵌入模型的力量:深入研究安德魯·NG的新課程 想像一個未來,機器可以完全準確地理解和回答您的問題。 這不是科幻小說;多虧了AI的進步,它已成為R

See all articles