AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1179143
Accepted
Franck Dernoncourt
Franck Dernoncourt
Asked: 2025-04-15 15:45:26 +0800 CST2025-04-15 15:45:26 +0800 CST 2025-04-15 15:45:26 +0800 CST

出现“此模型在所选 Azure OpenAI 服务资源上不可用”的错误,但我认为它可用。为什么我漏掉了?

  • 772

我在 Azure 区域部署了一个经过精细调整的 GPT 4o 迷你模型northcentralus。

当我尝试编辑它时,我在 Azure 门户中收到此错误(我想更改最大命中率):

此模型在所选的 Azure OpenAI 服务资源上不可用。详细了解模型可用性。

在此处输入图片描述

我在 Azure 门户中选择的资源位于northcentralus:

在此处输入图片描述

但是,https ://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models ?tabs=global-standard%2Cstandard-chat-c​​ompletions#fine-tuning-models 指出,经过微调的 GPT 4o 迷你模型可在 Azure 区域使用northcentralus:

在此处输入图片描述

我错过了什么?为什么我收到“此模型在所选 Azure OpenAI 服务资源上不可用”的错误?


我按照 Azure 的GPT 微调教程部署了经过微调的 GPT 4o mini 模型。部署阶段的代码如下:

# Deploy fine-tuned model

import json
import requests

token = '[redacted]'
subscription = '[redacted]'
resource_group = "[redacted]"
resource_name = "[redacted]"
model_deployment_name = "gpt-4o-mini-2024-07-18-ft" # Custom deployment name you chose for your fine-tuning model

deploy_params = {'api-version': "2023-05-01"}
deploy_headers = {'Authorization': 'Bearer {}'.format(token), 'Content-Type': 'application/json'}

deploy_data = {
    "sku": {"name": "standard", "capacity": 1},
    "properties": {
        "model": {
            "format": "OpenAI",
            "name": "gpt-4o-mini-2024-07-18.ft-[redacted]", #retrieve this value from the previous call, it will look like gpt-4o-mini-2024-07-18.ft-[redacted]
            "version": "1"
        }
    }
}
deploy_data = json.dumps(deploy_data)

request_url = f'https://management.azure.com/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.CognitiveServices/accounts/{resource_name}/deployments/{model_deployment_name}'

print('Creating a new deployment...')

r = requests.put(request_url, params=deploy_params, headers=deploy_headers, data=deploy_data)

print(r)
print(r.reason)
print(r.json())

令牌是通过生成的az account get-access-token。

azure
  • 1 1 个回答
  • 65 Views

1 个回答

  • Voted
  1. Best Answer
    Franck Dernoncourt
    2025-04-19T06:05:28+08:002025-04-19T06:05:28+08:00

    我已经放弃了那个 Azure UI,这是实现它的 Python 代码。它需要通过 生成的令牌 az account get-access-token。

    import json
    import requests
    
    new_capacity = 3 # Change this number to your desired capacity. 3 means 3000 tokens/minute.
    
    # Authentication and resource identification
    token = "YOUR_BEARER_TOKEN"  # Replace with your actual token
    subscription = ''
    resource_group = ""
    resource_name = ""
    model_deployment_name = ""
    
    # API parameters and headers
    update_params = {'api-version': "2023-05-01"}
    update_headers = {'Authorization': 'Bearer {}'.format(token), 'Content-Type': 'application/json'}
    
    # First, get the current deployment to preserve its configuration
    request_url = f'https://management.azure.com/subscriptions/{subscription}/resourceGroups/{resource_group}/providers/Microsoft.CognitiveServices/accounts/{resource_name}/deployments/{model_deployment_name}'
    r = requests.get(request_url, params=update_params, headers=update_headers)
    
    if r.status_code != 200:
        print(f"Failed to get current deployment: {r.status_code}")
        print(r.reason)
        if hasattr(r, 'json'):
            print(r.json())
        exit(1)
    
    # Get the current deployment configuration
    current_deployment = r.json()
    
    # Update only the capacity in the configuration
    update_data = {
        "sku": {
            "name": current_deployment["sku"]["name"],
            "capacity": new_capacity  
        },
        "properties": current_deployment["properties"]
    }
    
    update_data = json.dumps(update_data)
    
    print('Updating deployment capacity...')
    
    # Use PUT to update the deployment
    r = requests.put(request_url, params=update_params, headers=update_headers, data=update_data)
    
    print(f"Status code: {r.status_code}")
    print(f"Reason: {r.reason}")
    if hasattr(r, 'json'):
        print(r.json())
    

    需要几秒钟才能更新。

    • 0

相关问题

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve