如何获取已加载的omegaconf配置的文件路径

发布于 2025-01-17 22:04:50 字数 576 浏览 5 评论 0原文

我正在使用omegaconf读取.YAML配置文件(文件路径是通过HYDRA给出的)。 编辑后,我想再次保存文件。 Possibly using:

OmegaConf.save(conf, filepath, resolve=True)

However, I cannot figure out how to get the file path back in order to save it again.

有可能从omegaconf以某种方式从Omegaconf获得它吗? omegaconf document> documentation 关于serialialization yaml sersialization dy sernialization not sernialization yaml down yaml down yaml by返回同一文件路径为我。

I am using OmegaConf to read a .yaml configuration file (file path is given through hydra).
After I edit it, I want to save the file again. Possibly using:

OmegaConf.save(conf, filepath, resolve=True)

However, I cannot figure out how to get the file path back in order to save it again.

Is it possible to get it from OmegaConf somehow? The OmegaConf documentation about serializing YAML does not return the same file path for me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苍风燃霜 2025-01-24 22:04:50

这是不支持的。 Hydra将其加载的配置文件抽象。实际上 - 这些配置文件可能存在于Python软件包,文件系统或由专用插件支持的任意位置。

This is not supported. Hydra abstracts away the config files it loads. In fact - those config files may exist inside Python packages, the file system or arbitrary locations backed by specialized plugins.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文