1 Star 0 Fork 0

Bytedance Inc./dplm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
train.py 1.95 KB
一键复制 编辑 原始数据 按行查看 历史
wangxinyou.203 提交于 2025-05-15 18:47 +08:00 . formatted codes
# Copyright (c) 2024 Bytedance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
#!python
import pyrootutils
# ------------------------------------------------------------------------------------ #
# `pyrootutils.setup_root(...)` is recommended at the top of each start file
# to make the environment more robust and consistent
#
# the line above searches for ".git" or "pyproject.toml" in present and parent dirs
# to determine the project root dir
#
# adds root dir to the PYTHONPATH (if `pythonpath=True`)
# so this file can be run from any place without installing project as a package
#
# sets PROJECT_ROOT environment variable which is used in "configs/paths/default.yaml"
# this makes all paths relative to the project root
#
# additionally loads environment variables from ".env" file (if `dotenv=True`)
#
# you can get away without using `pyrootutils.setup_root(...)` if you:
# 1. move this file to the project root dir or install project as a package
# 2. modify paths in "configs/paths/default.yaml" to not use PROJECT_ROOT
# 3. always run this file from the project root dir
#
# https://github.com/ashleve/pyrootutils
# -------------------
root = pyrootutils.setup_root(
search_from=__file__,
indicator=[".git", "pyproject.toml"],
pythonpath=True,
# load environment variables from `.env` file if it exists
# recursively searches for `.env` in all folders starting from work dir
dotenv=True,
)
import hydra
from omegaconf import DictConfig
@hydra.main(
version_base="1.1",
config_path=f"{root}/configs",
config_name="config.yaml",
)
def main(config: DictConfig):
# Imports can be nested inside @hydra.main to optimize tab completion
# https://github.com/facebookresearch/hydra/issues/934
from byprot import utils
from byprot.training_pipeline import train
# Applies optional utilities
config = utils.extras(config)
# Train model
return train(config)
if __name__ == "__main__":
main()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ByteDance/dplm.git
git@gitee.com:ByteDance/dplm.git
ByteDance
dplm
dplm
main

搜索帮助