Browse Source

新的测试数据和老的测试代码更新

master
zzysz@qq.com 2 months ago
parent
commit
b4c73c7661
1 changed files with 47 additions and 0 deletions
  1. +47
    -0
      test/train_helloworld.py

+ 47
- 0
test/train_helloworld.py View File

@@ -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()

Loading…
Cancel
Save