Deploying DeepSeek-R1 on Azure

Deploying DeepSeek-R1 on Azure

DeepSeek-R1 is a powerful reasoning model designed for complex tasks like language processing, scientific reasoning, and coding. Microsoft provides it through Azure AI Foundry, allowing users to deploy it as a serverless API. This guide walks you through deploying DeepSeek-R1 on Azure, setting up an endpoint, and interacting with the model.

Step 1: Accessing the Azure AI Model Catalog

Visit the Azure AI Model Catalog to explore available AI models. Locate DeepSeek-R1, which is highlighted as a new model in the catalog.

Screenshot:


Click "Check out model" to proceed.

Step 2: Viewing Model Details and Deploying

On the DeepSeek-R1 model page, you will find its specifications, including:

  • 671B parameters
  • 37B active parameters
  • 128k context length
  • Support for English (en) and Chinese (zh)

Screenshot:


Click "Deploy" to start the deployment process.

Screenshot:


Step 3: Selecting or Creating a Project

Azure AI Foundry requires a project to manage model deployments. You can either:

  1. Select an existing project.
  2. Create a new project.

For this guide, we selected "deepseek" as the project.

Screenshot:


Step 4: Configuring Deployment Settings

On the deployment page, configure the following:

  • Deployment Name: Give it a unique name (e.g., DeepSeek-R1-Rany).
  • Content Filtering: Enabled by default for safety.
  • Supported Regions: Choose an appropriate Azure region.

Screenshot:


Click "Deploy" to launch the model.

Step 5: Using the Model Playground

Once the deployment is complete, you can interact with the model in the Azure AI Playground. Click "Open in playground" to start testing.

Screenshot:


Here, you can send messages to the model and analyze its responses.

Step 6: Interacting with the Model via Python

To integrate DeepSeek-R1 into your applications, install the necessary library:

!pip install azure-ai-inference
        




Then, use Python to send chat completion requests:

import os
from azure.ai.inference import ChatCompletionsClient
from azure.core.credentials import AzureKeyCredential

api_key = os.getenv("AZURE_INFERENCE_CREDENTIAL", '')
if not api_key:
  raise Exception("A key should be provided to invoke the endpoint")

client = ChatCompletionsClient(
    endpoint='https://DeepSeek-R1-Rany.ai.azure.com',
    credential=AzureKeyCredential(api_key)
)

payload = {
  "messages": [
    {"role": "user", "content": "I am going to Paris, what should I see?"}
  ],
  "max_tokens": 2048
}

response = client.complete(payload)
print("Response:", response.choices[0].message.content)
        

Step 7: Understanding Model Responses

DeepSeek-R1 provides thoughtful and structured responses. For example, when asked about the best places to visit in Paris, it generates a detailed guide, emphasizing historical significance, architecture, and local tips.

Chat Response Example:

Model name: deepseek-r1
Model type: chat-completion
Model provider name: DeepSeek
Response: <think>
Okay, the user just asked, "What is so great about #1?" referring to the Eiffel Tower from my previous answer. I need to explain why the Eiffel Tower is so special. Let me start by recalling what I mentioned earlier. I pointed out that it's iconic and offers great views. Now they want more depth.

First, I should consider the history. Built for the 1889 World's Fair, right? Initially controversial but now a beloved symbol. Maybe mention Gustave Eiffel. Then, the engineering aspect—how tall it is, the materials used, the design. People might not know it was only supposed to stand for 20 years. 

The views from the tower are a big draw. Different levels, the summit. Maybe talk about the experience of dining there, like the Michelin-starred restaurant. That adds a luxurious touch. 

Cultural significance is important too. It's a symbol of Paris and France. Featured in many films and artworks, which connects emotionally with people. The light show at night is another highlight—sparkling lights every hour. 

Also, the tower's role in events, like New Year's Eve or proposals. It's a romantic spot, which ties into Paris's image. Maybe mention that it's one of the most visited monuments globally, with millions of visitors each year. 

Wait, the user might be planning a trip and wants to know if it's worth visiting. They might be looking for reasons beyond the obvious. Maybe address practical aspects like the best times to visit, tips for avoiding crowds, or unique experiences like the glass floor on the first level. 

But the user specifically asked what's great about it, so focus on the positives. However, they might be wondering if it's overrated. Maybe subtly counter that by explaining its enduring appeal. 

I should structure the answer clearly: historical significance, engineering marvel, views, cultural impact, and unique experiences. Keep it engaging with some interesting facts. Avoid jargon, make it conversational. Check for any inaccuracies, like the height figures, and ensure the history is correct. 

Also, remember the user might not know much about its history or technical aspects, so explain in simple terms. Use examples like the number of visitors or the number of steps to add context. Emphasize the emotional aspects too—why people love it, the romance, the inspiration it provides. 

Okay, that should cover the main points. Let me put it all together in a coherent way.
</think>

The **Eiffel Tower** is a marvel of engineering, history, and cultural symbolism, and here’s why it’s so iconic and beloved:

### 1. **Historical Significance**  
   - Built for the **1889 World’s Fair** to celebrate the 100th anniversary of the French Revolution, it was initially controversial (many Parisians hated its modern design!). However, it became a symbol of innovation and France’s industrial prowess.  
   - Designed by **Gustave Eiffel**, it was the world’s tallest man-made structure until 1930 (324 meters/1,063 feet tall).  

### 2. **Engineering Genius**  
   - A feat of 19th-century engineering, it’s constructed from **18,038 iron pieces** held together by 2.5 million rivets. Despite its height, it’s remarkably lightweight and sways only slightly in strong winds.  
   - It was meant to be dismantled after 20 years but was saved by its usefulness as a radio transmission tower.

### 3. **Breathtaking Views**  
   - The panoramic views of Paris from its three levels are unmatched. On a clear day, you can see up to **72 km (45 miles)** from the top. The evening view, as the city lights up, is pure magic.  
   - The **glass-floor balcony** on the first level (57 meters up) offers a thrilling perspective of the Champ de Mars below.

### 4. **Cultural Symbol**  
   - It embodies the romantic essence of Paris and has starred in countless films, books, and artworks (*Amélie*, *Midnight in Paris*, etc.).  
   - A universal symbol of love, it’s a hotspot for marriage proposals and New Year’s celebrations.  

### 5. **Dazzling Light Shows**  
   - Every night, the tower sparkles with **20,000 golden lights** for 5 minutes each hour until 1 a.m. The beacon at its peak also rotates, casting light across Paris.  

### 6. **Unique Experiences**  
   - Dine at **Le Jules Verne**, a Michelin-starred restaurant on the second level, or sip champagne at the summit.  
   - Climb the stairs (1,665 steps to the top!) for a more immersive (and affordable) experience than the elevator.  

### Why People Love It:  
Beyond its physical grandeur, the Eiffel Tower evokes an emotional connection. It’s a place where history, art, and human ambition converge, offering visitors a tangible link to Paris’s past and present. Even locals admit its charm—there’s something surreal about glimpsing its silhouette while strolling through the city.  

**Pro Tip:** Visit at sunset to see the city transition from day to night, and bring a picnic to the Champ de Mars for a postcard-perfect experience!
Model: deepseek-r1
Usage:
	Prompt tokens: 200
	Total tokens: 1323
	Completion tokens: 1123


========        

Conclusion

Deploying DeepSeek-R1 on Azure is straightforward, allowing you to harness its powerful reasoning capabilities in a scalable manner. Whether you use it for chat applications, coding assistance, or research, Azure AI Foundry makes it accessible and easy to integrate into your workflows.


Additional Reading:


要查看或添加评论,请登录

Rany ElHousieny, PhD???的更多文章

社区洞察

其他会员也浏览了