我使用以下命令创建了一个 AWS Lambda 层:
aws lambda publish-layer-version --layer-name TensorflowLambdaLayer --compatible-runtimes go1.x --zip-file fileb://tensorflowLayer.zip
这是生成的 ARN:`arn:aws:lambda:us-east-1:757767972066:layer:TensorflowLambdaLayer:1
当我尝试通过 AWS SAM 运行使用Tesnroflow库的 Lambda 函数时,它卡在“安装”步骤:
2019-07-18 15:51:29 Mounting /tmp/tmpgz8cb80s as /var/task:ro,delegated inside runtime container
一旦我终止它,Ctrl + C
我会收到以下消息:
^C/var/task/bin/inference: error while loading shared libraries: libtensorflow.so: cannot open shared object file: No such file or directory
Makefile:82: recipe for target 'run-inference' failed
这是我的template.yml的关键部分:
Parameters:
LambdaTensorflowLayerArn:
Type: String
Default: 'arn:aws:lambda:us-east-1:757767972066:layer:TensorflowLambdaLayer:1'
LambdaFFMPEGLayerArn:
Type: String
Default: 'arn:aws:lambda:us-east-1:757767972066:layer:ffmpeg:1'
Inference:
Type: 'AWS::Serverless::Function'
Properties:
Handler: bin/inference
Runtime: go1.x
Timeout: 300
CodeUri: ./bin/inference.zip
Layers:
- Ref: LambdaFFMPEGLayerArn
- Ref: LambdaTensorflowLayerArn
我不确定是什么原因造成的