Amazon web services AWS肋骨实体识别:错误的ARN端点
我尝试使用刚刚在AmazonWebService(AWS)上培训的自定义实体识别。 迄今为止,培训取得了成效: 但是,如果我试图识别具有给定ARN端点的AWS Lambda(下面的代码)实体,我会得到以下错误(即使AWS应该使用最新版本的botocore/boto3框架“EntpointArn”也不可用): 我用代码中的前4行修复了此错误:Amazon web services AWS肋骨实体识别:错误的ARN端点,amazon-web-services,boto3,ner,amazon-comprehend,Amazon Web Services,Boto3,Ner,Amazon Comprehend,我尝试使用刚刚在AmazonWebService(AWS)上培训的自定义实体识别。 迄今为止,培训取得了成效: 但是,如果我试图识别具有给定ARN端点的AWS Lambda(下面的代码)实体,我会得到以下错误(即使AWS应该使用最新版本的botocore/boto3框架“EntpointArn”也不可用): 我用代码中的前4行修复了此错误: ——我在stackoverflow上发现的黑客---- 导入系统 来自pip.\u内部导入总管 main(['install'、'-I'、'-q'、'bo
——我在stackoverflow上发现的黑客----
导入系统
来自pip.\u内部导入总管
main(['install'、'-I'、'-q'、'boto3'、'-target'、'/tmp/'、'-no cache dir'、'-disable pip version check']))
sys.path.insert(0,“/tmp/”)
#----------------------------------------
导入json
进口boto3
client=bot3.客户(“理解”,地区名称='us-east-1')
text=“这是我用不同实体编写的漂亮文本!”
entities=client.detect\u实体(
Text=Text,
LanguageCode=“de”#如果指定端点,Amazon Understand将使用自定义模型的语言,并忽略您在请求中提供的任何语言代码。
EndpointArn=“arn:aws:consude:us-east-1:215057830319:实体识别器/MyFirstRecognizer”
)
但是,我仍然遇到一个无法修复的错误:
Response:
{
"errorMessage": "An error occurred (ValidationException) when calling the DetectEntities operation: 1 validation error detected: Value 'arn:aws:comprehend:us-east-1:XXXXXXXXXXXX:entity-recognizer/MyFirstRecognizer' at 'endpointArn' failed to satisfy constraint: Member must satisfy regular expression pattern: arn:aws(-[^:]+)?:comprehend:[a-zA-Z0-9-]*:[0-9]{12}:entity-recognizer-endpoint/[a-zA-Z0-9](-*[a-zA-Z0-9])*",
"errorType": "ClientError",
"stackTrace": [
" File \"/var/task/lambda_function.py\", line 25, in lambda_handler\n entities = client.detect_entities(\n",
" File \"/tmp/botocore/client.py\", line 316, in _api_call\n return self._make_api_call(operation_name, kwargs)\n",
" File \"/tmp/botocore/client.py\", line 635, in _make_api_call\n raise error_class(parsed_response, operation_name)\n"
]
}
如果对给定端点使用NodeJS框架,也会发生此错误。有趣的是,我应该提到的是,我(在教程中)找到的每个ARN端点都与我的端点完全相同,并且与作为错误返回的正则表达式模式不匹配
我不太确定我是否在这里做错了什么,或者这是AWS云(或SDK)上的一个bug。。也许有人可以重现这个错误和/或找到解决这个问题的方法(甚至是黑客)
与模型ARN相比,端点ARN是不同的AWS资源。模型ARN指的是一个自定义模型,而端点承载该模型。在代码中,您正在传递的代码是modelARN而不是endpointARN,这会导致引发错误 您可以根据前缀来区分这两个ARN 端点arn-arn:aws:CONTRUSE:us-east-1:XXXXXXXXXXXXX:实体识别器端点/XXXXXXXXX 型号arn-arn:aws:CONTRUSE:us-east-1:XXXXXXXXXXXXX:实体识别器/MyFirstRecognitor 您可以在文档页面上阅读有关了解自定义端点及其定价的更多信息。
Response:
{
"errorMessage": "An error occurred (ValidationException) when calling the DetectEntities operation: 1 validation error detected: Value 'arn:aws:comprehend:us-east-1:XXXXXXXXXXXX:entity-recognizer/MyFirstRecognizer' at 'endpointArn' failed to satisfy constraint: Member must satisfy regular expression pattern: arn:aws(-[^:]+)?:comprehend:[a-zA-Z0-9-]*:[0-9]{12}:entity-recognizer-endpoint/[a-zA-Z0-9](-*[a-zA-Z0-9])*",
"errorType": "ClientError",
"stackTrace": [
" File \"/var/task/lambda_function.py\", line 25, in lambda_handler\n entities = client.detect_entities(\n",
" File \"/tmp/botocore/client.py\", line 316, in _api_call\n return self._make_api_call(operation_name, kwargs)\n",
" File \"/tmp/botocore/client.py\", line 635, in _make_api_call\n raise error_class(parsed_response, operation_name)\n"
]
}