最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Unable to download the exported Azure CLU trained model to expose it to the docker container - Stack Overflow

programmeradmin0浏览0评论

I have a Conversational Language Understanding (CLU) project on Azure Language Studio which i want to run as a Docker container on Windows. I am following this recently updated doc for achieving this.

However, after exporting the trained model, neither did i get any response, nor is anything downloaded. There is just an empty response without any error. The downloading of the model is essential in the next step here where i have to provide the {LOCAL_MODEL_DIRECTORY} variable pointing to the local path of the downloaded model which is supposed to be mounted in the container.

I tried with the normal curl request and I also tried doing this with Invoke-WebRequest instead of curl where i get the StatusCode : 202 and StatusDescription : Accepted, which i think indicates the request is in process. I further tried to send a GET request to the operation-location in the above response to get more info but I did not get anything to point out where i can get the exported model. Also, this mentions the status as succeeded, but nothing else.

(base) PS C:\Users\username> $response = Invoke-WebRequest -Uri $operationLocation -Headers $headers -Method GET
(base) PS C:\Users\username> $response.Content
{"jobId":"37cf73c4-6575-4b0f-a3b9-ec2daff4b0f2_638765568000000000","createdDateTime":"2025-03-03T11:34:05Z","lastUpdatedDateTime":"2025-03-03T11:34:07Z","expirationDateTime":"2025-03-10T11:34:05Z","status":"succeeded"}

Any help would be appreciated, Thanks!

Edit:

This is the output from the verbose curl command:

zoddobbe@AJG9L74 ~ % curl -v  --location --request PUT '' --header 'Ocp-Apim-Subscription-Key: xxxxxxxxxxxxxxxxxxxxxxxxx' --header 'Content-Type: application/json' --data-raw '{ "TrainedModelLabel": "clu-15" }'
* Host resourcename.cognitiveservices.azure:443 was resolved.
* IPv6: (none)
* IPv4: 20.61.99.32
*   Trying 20.61.99.32:443...
* Connected to resourcename.cognitiveservices.azure (20.61.99.32) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384 / [blank] / UNDEF
* ALPN: server accepted h2
* Server certificate:
*  subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; CN=westeurope.api.cognitive.microsoft
*  start date: Jan 23 09:19:16 2025 GMT
*  expire date: Jul 22 09:19:16 2025 GMT
*  subjectAltName: host "resourcename.cognitiveservices.azure" matched cert's "*.cognitiveservices.azure"
*  issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure RSA TLS Issuing CA 04
*  SSL certificate verify ok.
* using HTTP/2
* [HTTP/2] [1] OPENED stream for 
* [HTTP/2] [1] [:method: PUT]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: resourcename.cognitiveservices.azure]
* [HTTP/2] [1] [:path: /language/authoring/analyze-conversations/projects/project_name/exported-models/test_export?api-version=2024-11-15-preview]
* [HTTP/2] [1] [user-agent: curl/8.7.1]
* [HTTP/2] [1] [accept: */*]
* [HTTP/2] [1] [ocp-apim-subscription-key: xxxxxxxxxxxxxxxxxxxxxxxx]
* [HTTP/2] [1] [content-type: application/json]
* [HTTP/2] [1] [content-length: 33]
> PUT /language/authoring/analyze-conversations/projects/project_name/exported-models/test_export?api-version=2024-11-15-preview HTTP/2
> Host: resourcename.cognitiveservices.azure
> User-Agent: curl/8.7.1
> Accept: */*
> Ocp-Apim-Subscription-Key: xxxxxxxxxxxxxxxxxxxxxxxx
> Content-Type: application/json
> Content-Length: 33
>
* upload completely sent off: 33 bytes
< HTTP/2 202
< content-length: 0
< access-control-expose-headers: *
< request-id: 7762b3e2-994c-4be5-8f84-7ad3a91e08a0
< apim-request-id: 7762b3e2-994c-4be5-8f84-7ad3a91e08a0
< operation-location: 
< x-envoy-upstream-service-time: 176
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
< x-ms-region: West Europe
< date: Mon, 03 Mar 2025 16:49:16 GMT
<
* Connection #0 to host resourcename.cognitiveservices.azure left intact

I have a Conversational Language Understanding (CLU) project on Azure Language Studio which i want to run as a Docker container on Windows. I am following this recently updated doc for achieving this.

However, after exporting the trained model, neither did i get any response, nor is anything downloaded. There is just an empty response without any error. The downloading of the model is essential in the next step here where i have to provide the {LOCAL_MODEL_DIRECTORY} variable pointing to the local path of the downloaded model which is supposed to be mounted in the container.

I tried with the normal curl request and I also tried doing this with Invoke-WebRequest instead of curl where i get the StatusCode : 202 and StatusDescription : Accepted, which i think indicates the request is in process. I further tried to send a GET request to the operation-location in the above response to get more info but I did not get anything to point out where i can get the exported model. Also, this mentions the status as succeeded, but nothing else.

(base) PS C:\Users\username> $response = Invoke-WebRequest -Uri $operationLocation -Headers $headers -Method GET
(base) PS C:\Users\username> $response.Content
{"jobId":"37cf73c4-6575-4b0f-a3b9-ec2daff4b0f2_638765568000000000","createdDateTime":"2025-03-03T11:34:05Z","lastUpdatedDateTime":"2025-03-03T11:34:07Z","expirationDateTime":"2025-03-10T11:34:05Z","status":"succeeded"}

Any help would be appreciated, Thanks!

Edit:

This is the output from the verbose curl command:

zoddobbe@AJG9L74 ~ % curl -v  --location --request PUT 'https://resourcename.cognitiveservices.azure/language/authoring/analyze-conversations/projects/project_name/exported-models/test_export?api-version=2024-11-15-preview' --header 'Ocp-Apim-Subscription-Key: xxxxxxxxxxxxxxxxxxxxxxxxx' --header 'Content-Type: application/json' --data-raw '{ "TrainedModelLabel": "clu-15" }'
* Host resourcename.cognitiveservices.azure:443 was resolved.
* IPv6: (none)
* IPv4: 20.61.99.32
*   Trying 20.61.99.32:443...
* Connected to resourcename.cognitiveservices.azure (20.61.99.32) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES256-GCM-SHA384 / [blank] / UNDEF
* ALPN: server accepted h2
* Server certificate:
*  subject: C=US; ST=WA; L=Redmond; O=Microsoft Corporation; CN=westeurope.api.cognitive.microsoft
*  start date: Jan 23 09:19:16 2025 GMT
*  expire date: Jul 22 09:19:16 2025 GMT
*  subjectAltName: host "resourcename.cognitiveservices.azure" matched cert's "*.cognitiveservices.azure"
*  issuer: C=US; O=Microsoft Corporation; CN=Microsoft Azure RSA TLS Issuing CA 04
*  SSL certificate verify ok.
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://resourcename.cognitiveservices.azure/language/authoring/analyze-conversations/projects/project_name/exported-models/test_export?api-version=2024-11-15-preview
* [HTTP/2] [1] [:method: PUT]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: resourcename.cognitiveservices.azure]
* [HTTP/2] [1] [:path: /language/authoring/analyze-conversations/projects/project_name/exported-models/test_export?api-version=2024-11-15-preview]
* [HTTP/2] [1] [user-agent: curl/8.7.1]
* [HTTP/2] [1] [accept: */*]
* [HTTP/2] [1] [ocp-apim-subscription-key: xxxxxxxxxxxxxxxxxxxxxxxx]
* [HTTP/2] [1] [content-type: application/json]
* [HTTP/2] [1] [content-length: 33]
> PUT /language/authoring/analyze-conversations/projects/project_name/exported-models/test_export?api-version=2024-11-15-preview HTTP/2
> Host: resourcename.cognitiveservices.azure
> User-Agent: curl/8.7.1
> Accept: */*
> Ocp-Apim-Subscription-Key: xxxxxxxxxxxxxxxxxxxxxxxx
> Content-Type: application/json
> Content-Length: 33
>
* upload completely sent off: 33 bytes
< HTTP/2 202
< content-length: 0
< access-control-expose-headers: *
< request-id: 7762b3e2-994c-4be5-8f84-7ad3a91e08a0
< apim-request-id: 7762b3e2-994c-4be5-8f84-7ad3a91e08a0
< operation-location: https://resourcename.cognitiveservices.azure/language/authoring/analyze-conversations/projects/project_name/exported-models/test_export/jobs/2e4a4b41-ee12-4ae9-a290-160cc0850638_638765568000000000?api-version=2024-11-15-preview
< x-envoy-upstream-service-time: 176
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< x-content-type-options: nosniff
< x-ms-region: West Europe
< date: Mon, 03 Mar 2025 16:49:16 GMT
<
* Connection #0 to host resourcename.cognitiveservices.azure left intact
Share Improve this question edited Mar 3 at 17:18 ATH asked Mar 3 at 12:13 ATHATH 12 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The right steps to set up docker containers for CLU are not properly explained on the documentation page. But here's what I figured out.

The curl command is not for downloading the CLU model, but merely for requesting to export the model within the azure resource. Hence, the response here is correct since it is not supposed to download anything.

The download actually happens later in the "Run the container in download model mode" step. This was a bit confusing since the docker run command here requires this parameter:

LOCAL_MODEL_DIRECTORY: Absolute directory in host machine where exported models are saved in.

The path here specifies where the models will be saved after running this command, they should not be already present here (as I previously thought).

Furthermore, the docker run command in Run the container in download model mode should have a different order of arguments with the volume mount option before any other arguments like this:

docker run --rm -it -v {LOCAL_MODEL_DIRECTORY}:/DeploymentPackage \ 
-p {LOCAL_CLU_PORT}:80 \ 
mcr.microsoft/azure-cognitive-services/language/clu:{IMAGE_TAG} \   
Billing={ENDPOINT_URI} \   
ApiKey={API_KEY} \ 
downloadmodel \ 
projectName={PROJECT_NAME} \ 
exportedModelName={EXPORTED_MODEL_NAME}

Then finally, you need to run the docker container again as mentioned in Run the container with docker run, but with some modifications to the command. When running the docker run command as is, it cannot find the /DeploymentPackage/Models directory. You need to actually mount the directory in the container. This should be the LOCAL_MODEL_DIRECTORY from the previous step. Also, you need to accept the Responsible AI terms. Here is the modified docker run command which worked for me:

docker run --rm -it -v {LOCAL_MODEL_DIRECTORY}:/DeploymentPackage \
-p 5000:5000 --memory 8g --cpus 1 \
mcr.microsoft/azure-cognitive-services/language/clu:{IMAGE_TAG} \
Eula=accept \
RAI_TERMS=accept \
Billing={ENDPOINT_URI} \
ApiKey={API_KEY} \

However, a different problem now arises where the localhost:5000 landing page is not accessible. When trying to curl to the page, this error is thrown:curl: (56) Recv failure: Connection reset by peer. Same error is also thrown when trying to send simple GET or POST requests. The docker logs do not suggest any problem and the ports are also correctly configured.

After inspecting the logs and the container_startup.sh script, I found that some ports are hardcoded. 5001, 5002 and 80 ports in the docker container have some services running. And weirdly, I can send a POST request with a text query to the port 5001 and get the correct response, irrespective of which port is provided in the docker run command. These ports (5001, 5002, and 80) however, have no landing pages but the API requests work at least for 5001.

发布评论

评论列表(0)

  1. 暂无评论