小编Azi*_*bro的帖子

如何在诗歌和 pyproject.toml 中添加库的可选依赖项作为“额外”?

我正在使用pyproject和构建一个 Python 包poetry。我的pyproject.toml看起来像这样:

[tool.poetry]
authors = ["test"]
description = ""
name = "test"
version = "0.1.0"

[tool.poetry.dependencies]
spacy = {extras = ["cuda113"], version = "^3.2.3"}
faiss-gpu = {version = "1.7.2", optional = true}

[tool.poetry.extras]
gpu = ["faiss-gpu"]
Run Code Online (Sandbox Code Playgroud)

这将faiss-gpu作为额外使用成功安装poetry install -E gpu

但是,我想仅在提供spacy[cuda113]时安装(GPU 版本) 。poetry install -E gpu正常poetry install的应该只安装spacy(CPU版本)。

我尝试过使用以下配置,但这使得所有配置都是spacy可选的并且不会安装它。只有spacy[cuda113](GPU 版本)必须是可选的。

[tool.poetry]
authors = ["test"]
description = ""
name …
Run Code Online (Sandbox Code Playgroud)

python pip spacy python-poetry pyproject.toml

9
推荐指数
1
解决办法
4926
查看次数

如何检查 Athena 查询在 Python 中是否成功运行?

我想使用boto3 athena 客户端函数start_query_execution从 Python 运行查询。此处的函数文档:https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/athena.html#Athena.Client.start_query_execution

用法如下:

query = "SELECT * FROM TABLE"
athena_client = boto3.client("athena")
start_response = athena_client.start_query_execution(
    QueryString=query,
    QueryExecutionContext={"Database": ATHENA.database_name},
    ResultConfiguration={
        "OutputLocation": s3_output,
    },
)
Run Code Online (Sandbox Code Playgroud)

我正在寻找一个函数/包装器,以确保此查询成功运行,并且仅在运行完成后才返回。从我的搜索中找不到 aws 包装器。

python sql amazon-web-services boto3 amazon-athena

4
推荐指数
1
解决办法
3892
查看次数

如何在出现以下 CUDA 错误“Cuda 断言失败:设备端断言触发”后重置 Colab?

我在 Google Colab 上使用 Pytorch 运行我的 Jupyter Notebook。在我收到“Cuda 断言失败:设备端断言触发”之后,我无法运行任何其他使用我的 pytorch 模块的代码。有谁知道如何重置我的代码,以便我之前工作的 Pytorch 函数仍然可以运行?

我已经尝试实现,CUDA_LAUNCH_BLOCKING=1但我的代码仍然无法工作,因为断言仍然被触发!

python pytorch tensor google-colaboratory

3
推荐指数
1
解决办法
9329
查看次数

配置 Terraform AWS Provider 时的 Github Actions 错误

尝试运行时,我使用 Terraform AWS Provider 收到以下错误terraform plan。仅当在 GitHub Actions 上运行时才会发生这种情况(在本地工作正常)

配置 Terraform AWS Provider 时出错:无法获取共享配置文件

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.22"
    }
  }
  required_version = ">= 1.1.7"
}
Run Code Online (Sandbox Code Playgroud)

如果我降级到version = "~> 3.0"它就可以解决问题。但我想升级到最新版本。

有没有办法让它在 CI 上运行?

terraform terraform-provider-aws github-actions

2
推荐指数
1
解决办法
7648
查看次数