Google Cloud Speech:配额组的令牌不足
Google Cloud Speech: Insufficient tokens for quota group
当我尝试处理一个 10 分钟的音频文件时出现以下错误。我刚刚开始使用 Google 云产品,所以我是唯一访问此资源的人。我怎么会超过配额?配额设置为默认值,我认为我没有接近限制。这还有其他原因吗?
我正在使用 transcribe_async.py
演示代码。音频文件 (22MB) 存储在存储桶中并通过 uri
音频源访问,否则演示代码不变。
Waiting for server processing...
Traceback (most recent call last):
File "/Users/kevin/Downloads/python-docs-samples-master/speech/api-client/transcribe_async.py", line 116, in <module>
main(args.speech_file)
File "/Users/kevin/Downloads/python-docs-samples-master/speech/api-client/transcribe_async.py", line 93, in main
response = service_request.execute()
File "/Users/kevin/anaconda2/lib/python2.7/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Users/kevin/anaconda2/lib/python2.7/site-packages/googleapiclient/http.py", line 840, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 429 when requesting https://speech.googleapis.com/v1beta1/operations/596739883637256586?alt=json returned "Insufficient tokens for quota group and limit 'Default_GroupCLIENT_PROJECT-100s' of service 'speech.googleapis.com', using the limit by ID '764086051850'.">
我认为您收到错误是因为使用了命令 "gcloud auth application-default login" 指定的应用程序默认凭据。尝试为您的项目创建一个服务帐户。将 JSON 密钥保存在私人文件夹中。然后指定密钥的路径,如下所示:
var speech = require('@google-cloud/speech')({
keyFilename: '/path/to/keyfile.json'
});
重要的是,您的项目应该启用计费。要启用计费,您可以激活免费试用期
我也遇到过这个问题。我仍在尝试更多地了解 GCP 凭据的一般情况,但与此同时,我认为我已经了解了足够多的信息来完成这项工作。我也在使用示例 Python 脚本。我按照 this page.
中的说明进行操作
它的要点是:
- 使用 Google 云控制台的凭据页面创建 "private key"。它实际上不仅仅是一个 "key",它是一个 (JSON) 配置文件,其中包含许多值,例如 'type'、'project_id' 等等。
- 下载该文件并将其保存在某处。我将我的放在
~/.config/gcloud/
文件夹中,该文件夹似乎也有很多相关的配置文件。
- 设置环境变量
GOOGLE_APPLICATION_CREDENTIALS
指向那个文件,即export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
还有一种方法可以从该页面上显示的代码中执行此操作,但环境变量路由对我来说更有意义。
上面的过程似乎设置了 "default" 凭据,在示例代码中,这些凭据是在 line 39.
上获取的
Google 站点上有其他文档,我发现 Google Cloud Storage authentication 上的文档是迄今为止最有用的。
当我尝试处理一个 10 分钟的音频文件时出现以下错误。我刚刚开始使用 Google 云产品,所以我是唯一访问此资源的人。我怎么会超过配额?配额设置为默认值,我认为我没有接近限制。这还有其他原因吗?
我正在使用 transcribe_async.py
演示代码。音频文件 (22MB) 存储在存储桶中并通过 uri
音频源访问,否则演示代码不变。
Waiting for server processing...
Traceback (most recent call last):
File "/Users/kevin/Downloads/python-docs-samples-master/speech/api-client/transcribe_async.py", line 116, in <module>
main(args.speech_file)
File "/Users/kevin/Downloads/python-docs-samples-master/speech/api-client/transcribe_async.py", line 93, in main
response = service_request.execute()
File "/Users/kevin/anaconda2/lib/python2.7/site-packages/oauth2client/_helpers.py", line 133, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Users/kevin/anaconda2/lib/python2.7/site-packages/googleapiclient/http.py", line 840, in execute
raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 429 when requesting https://speech.googleapis.com/v1beta1/operations/596739883637256586?alt=json returned "Insufficient tokens for quota group and limit 'Default_GroupCLIENT_PROJECT-100s' of service 'speech.googleapis.com', using the limit by ID '764086051850'.">
我认为您收到错误是因为使用了命令 "gcloud auth application-default login" 指定的应用程序默认凭据。尝试为您的项目创建一个服务帐户。将 JSON 密钥保存在私人文件夹中。然后指定密钥的路径,如下所示:
var speech = require('@google-cloud/speech')({ keyFilename: '/path/to/keyfile.json' });
重要的是,您的项目应该启用计费。要启用计费,您可以激活免费试用期
我也遇到过这个问题。我仍在尝试更多地了解 GCP 凭据的一般情况,但与此同时,我认为我已经了解了足够多的信息来完成这项工作。我也在使用示例 Python 脚本。我按照 this page.
中的说明进行操作它的要点是:
- 使用 Google 云控制台的凭据页面创建 "private key"。它实际上不仅仅是一个 "key",它是一个 (JSON) 配置文件,其中包含许多值,例如 'type'、'project_id' 等等。
- 下载该文件并将其保存在某处。我将我的放在
~/.config/gcloud/
文件夹中,该文件夹似乎也有很多相关的配置文件。 - 设置环境变量
GOOGLE_APPLICATION_CREDENTIALS
指向那个文件,即export GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json
还有一种方法可以从该页面上显示的代码中执行此操作,但环境变量路由对我来说更有意义。
上面的过程似乎设置了 "default" 凭据,在示例代码中,这些凭据是在 line 39.
上获取的Google 站点上有其他文档,我发现 Google Cloud Storage authentication 上的文档是迄今为止最有用的。