繁体   English   中英

“resourceGroupName”与预期模式“^[-\w\._\(\)]+$”不匹配

[英]'resourceGroupName' does not match expected pattern '^[-\w\._\(\)]+$'

使用 GitHub 项目 AzViz。 我正在尝试运行 PowerShell 命令以从 CSV 文件中提取多个资源组的列表。 它似乎拉入了组,但出现以下错误:

Get-AzResourceGroup : 'resourceGroupName' does not match expected pattern '^[-\w\._\(\)]+$'.

我在这里创建 function:

$rsglist = Import-Csv C:\temp\azureinventory.csv

并运行以下命令:

Export-AzViz -ResourceGroup $rsglist -Theme dark -OutputFormat png -Show

您可以在此图像中看到它似乎正在导入这些资源组:

在此处输入图像描述

结果如下:

在此处输入图像描述

我怀疑它告诉我其中一个组名称是错误的,但是遍历所有名称,我没有看到任何不匹配该模式的名称; 我没有看到任何不允许的字符。

我也知道这是一个项目,他们的代码中可能存在问题,只是寻求任何帮助。 谢谢!

Export-AzViz-ResourceGroup参数需要一个字符串数组,而您传递的是[pscustomobject]实例(它变成无用的字符串表示形式),如Import-Csv的 output 。

使用 CSV 文件中的适当列(属性)名称,仅将资源组名称作为字符串传递; 例如,如果名称信息在Name列中:

Export-AzViz -ResourceGroup $rsglist.Name -Theme dark -OutputFormat png -Show

注意:访问$rsglist中存储的对象集合(数组)的.Name属性以获取该集合元素.Name属性值是一个方便的 PowerShell 功能,称为成员访问枚举

获取输入 object 的`dtype 与预期的 dtype 不匹配<u0` when invoking mlflow-deployed nlp model in sagemaker< div><div id="text_translate"><p> 我使用 MLflow 的sagemaker.deploy()在 SageMaker 中部署了一个 Huggingface Transformer model。</p><p> 在记录 model 时,我使用infer_signature(np.array(test_example), loaded_model.predict(test_example))来推断输入和 output 签名。</p><p> Model部署成功。 当尝试查询 model 时,我得到了ModelError (下面的完整回溯)。</p><p> 要查询test_example ,我使用的 test_example 与用于infer_signature()的完全相同:</p><p> test_example = [['This is the subject', 'This is the body']]</p><p> 唯一的区别是,在查询已部署的 model 时,我没有将测试示例包装在np.array()中,因为它不是json可序列化的。</p><p> 为了查询 model,我尝试了两种不同的方法:</p><pre class="lang-py prettyprint-override"> import boto3 SAGEMAKER_REGION = 'us-west-2' MODEL_NAME = '...' client = boto3.client("sagemaker-runtime", region_name=SAGEMAKER_REGION) # Approach 1 client.invoke_endpoint( EndpointName=MODEL_NAME, Body=json.dumps(test_example), ContentType="application/json", ) # Approach 2 client.invoke_endpoint( EndpointName=MODEL_NAME, Body=pd.DataFrame(test_example).to_json(orient="split"), ContentType="application/json; format=pandas-split", )</pre><p> 但它们会导致相同的错误。</p><p> 将不胜感激您的建议。</p><p> 谢谢!</p><p> 注意:我使用的是 Python 3 并且所有<strong>字符串都是 unicode</strong> 。</p><pre class="lang-py prettyprint-override"> --------------------------------------------------------------------------- ModelError Traceback (most recent call last) <ipython-input-89-d09862a5f494> in <module> 2 EndpointName=MODEL_NAME, 3 Body=test_example, ----> 4 ContentType="application/json; format=pandas-split", 5 ) ~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/botocore/client.py in _api_call(self, *args, **kwargs) 393 "%s() only accepts keyword arguments." % py_operation_name) 394 # The "self" in this scope is referring to the BaseClient. --> 395 return self._make_api_call(operation_name, kwargs) 396 397 _api_call.__name__ = str(py_operation_name) ~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/botocore/client.py in _make_api_call(self, operation_name, api_params) 723 error_code = parsed_response.get("Error", {}).get("Code") 724 error_class = self.exceptions.from_code(error_code) --> 725 raise error_class(parsed_response, operation_name) 726 else: 727 return parsed_response ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received client error (400) from primary with message "{"error_code": "BAD_REQUEST", "message": "dtype of input object does not match expected dtype <U0"}". See https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#logEventViewer:group=/aws/sagemaker/Endpoints/bec-sagemaker-model-test-app in account 543052680787 for more information.</pre><p> 环境信息:</p><pre class="lang-py prettyprint-override"> {'channels': ['defaults', 'conda-forge', 'pytorch'], 'dependencies': ['python=3.6.10', 'pip==21.3.1', 'pytorch=1.10.2', 'cudatoolkit=10.2', {'pip': ['mlflow==1.22.0', 'transformers==4.17.0', 'datasets==1.18.4', 'cloudpickle==1.3.0']}], 'name': 'bert_bec_test_env'}</pre></div></u0`>

[英]Getting `dtype of input object does not match expected dtype <U0` when invoking MLflow-deployed NLP model in SageMaker

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取输入 object 的`dtype 与预期的 dtype 不匹配<u0` when invoking mlflow-deployed nlp model in sagemaker< div><div id="text_translate"><p> 我使用 MLflow 的sagemaker.deploy()在 SageMaker 中部署了一个 Huggingface Transformer model。</p><p> 在记录 model 时,我使用infer_signature(np.array(test_example), loaded_model.predict(test_example))来推断输入和 output 签名。</p><p> Model部署成功。 当尝试查询 model 时,我得到了ModelError (下面的完整回溯)。</p><p> 要查询test_example ,我使用的 test_example 与用于infer_signature()的完全相同:</p><p> test_example = [['This is the subject', 'This is the body']]</p><p> 唯一的区别是,在查询已部署的 model 时,我没有将测试示例包装在np.array()中,因为它不是json可序列化的。</p><p> 为了查询 model,我尝试了两种不同的方法:</p><pre class="lang-py prettyprint-override"> import boto3 SAGEMAKER_REGION = 'us-west-2' MODEL_NAME = '...' client = boto3.client("sagemaker-runtime", region_name=SAGEMAKER_REGION) # Approach 1 client.invoke_endpoint( EndpointName=MODEL_NAME, Body=json.dumps(test_example), ContentType="application/json", ) # Approach 2 client.invoke_endpoint( EndpointName=MODEL_NAME, Body=pd.DataFrame(test_example).to_json(orient="split"), ContentType="application/json; format=pandas-split", )</pre><p> 但它们会导致相同的错误。</p><p> 将不胜感激您的建议。</p><p> 谢谢!</p><p> 注意:我使用的是 Python 3 并且所有<strong>字符串都是 unicode</strong> 。</p><pre class="lang-py prettyprint-override"> --------------------------------------------------------------------------- ModelError Traceback (most recent call last) <ipython-input-89-d09862a5f494> in <module> 2 EndpointName=MODEL_NAME, 3 Body=test_example, ----> 4 ContentType="application/json; format=pandas-split", 5 ) ~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/botocore/client.py in _api_call(self, *args, **kwargs) 393 "%s() only accepts keyword arguments." % py_operation_name) 394 # The "self" in this scope is referring to the BaseClient. --> 395 return self._make_api_call(operation_name, kwargs) 396 397 _api_call.__name__ = str(py_operation_name) ~/anaconda3/envs/amazonei_tensorflow_p36/lib/python3.6/site-packages/botocore/client.py in _make_api_call(self, operation_name, api_params) 723 error_code = parsed_response.get("Error", {}).get("Code") 724 error_class = self.exceptions.from_code(error_code) --> 725 raise error_class(parsed_response, operation_name) 726 else: 727 return parsed_response ModelError: An error occurred (ModelError) when calling the InvokeEndpoint operation: Received client error (400) from primary with message "{"error_code": "BAD_REQUEST", "message": "dtype of input object does not match expected dtype <U0"}". See https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#logEventViewer:group=/aws/sagemaker/Endpoints/bec-sagemaker-model-test-app in account 543052680787 for more information.</pre><p> 环境信息:</p><pre class="lang-py prettyprint-override"> {'channels': ['defaults', 'conda-forge', 'pytorch'], 'dependencies': ['python=3.6.10', 'pip==21.3.1', 'pytorch=1.10.2', 'cudatoolkit=10.2', {'pip': ['mlflow==1.22.0', 'transformers==4.17.0', 'datasets==1.18.4', 'cloudpickle==1.3.0']}], 'name': 'bert_bec_test_env'}</pre></div></u0`> Pulumi azure-native 缺少必需的属性“resourceGroupName” REGEX_MATCH 模式适用于除 Google Data Studio 以外的任何地方 与 Amazon EventBridge 中的 boolean 值匹配的事件模式 Firebase 日期不匹配 DynamoDB:提供的键元素与架构不匹配 正则表达式 golang 最后匹配大括号内的模式 从 s3 存储桶中读取与 python 中的模式匹配的文件 预签名 S3 URL 签名不匹配 重定向 URL 与 azure 不匹配
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM