From b4c73c766129d585c589fa4ad767b752895b9421 Mon Sep 17 00:00:00 2001 From: "zzysz@qq.com" Date: Fri, 5 Sep 2025 09:03:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E7=9A=84=E6=B5=8B=E8=AF=95=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=92=8C=E8=80=81=E7=9A=84=E6=B5=8B=E8=AF=95=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/train_helloworld.py | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 test/train_helloworld.py diff --git a/test/train_helloworld.py b/test/train_helloworld.py new file mode 100644 index 0000000..75979ad --- /dev/null +++ b/test/train_helloworld.py @@ -0,0 +1,47 @@ +import logging +import os +import subprocess +import sys + +logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s") +logger = logging.getLogger(__name__) +logging.Logger.Error = logging.Logger.error + + +def install_packages(): + packages = [ + "jcweaver==0.1.3", + ] + for pkg in packages: + logger.info(f"正在安装 {pkg} ...") + subprocess.check_call([ + sys.executable, "-m", "pip", "install", pkg, + "-i", "https://pypi.tuna.tsinghua.edu.cn/simple" + ]) + + +try: + from jcweaver.api import input_prepare, output_prepare, lifecycle + from jcweaver.core.const import DataType +except ImportError: + install_packages() + from jcweaver.api import input_prepare, output_prepare, lifecycle + from jcweaver.core.const import DataType + +input_file_path = input_prepare(DataType.DATASET, '') +output_file_path = output_prepare(DataType.DATASET, 'train_output.txt') + + +@lifecycle() +def run(): + paths = os.listdir(input_file_path) + print("输入文件路径:", input_file_path) + print(paths) + + with open(output_file_path, "w", encoding="utf-8") as f: + f.write("dataset path: ") + f.write(str(paths)) + + +if __name__ == '__main__': + run()