Refine lib -> xautodl
This commit is contained in:
		| @@ -6,21 +6,22 @@ | |||||||
| import sys, time, copy, torch, random, argparse | import sys, time, copy, torch, random, argparse | ||||||
| from tqdm import tqdm | from tqdm import tqdm | ||||||
| from copy import deepcopy | from copy import deepcopy | ||||||
| from pathlib import Path |  | ||||||
|  |  | ||||||
| lib_dir = (Path(__file__).parent / ".." / ".." / "lib").resolve() | from xautodl.procedures import ( | ||||||
| if str(lib_dir) not in sys.path: |     prepare_seed, | ||||||
|     sys.path.insert(0, str(lib_dir)) |     prepare_logger, | ||||||
| from procedures import prepare_seed, prepare_logger, save_checkpoint, copy_checkpoint |     save_checkpoint, | ||||||
| from log_utils import time_string |     copy_checkpoint, | ||||||
| from log_utils import AverageMeter, convert_secs2time | ) | ||||||
|  | from xautodl.log_utils import time_string | ||||||
|  | from xautodl.log_utils import AverageMeter, convert_secs2time | ||||||
|  |  | ||||||
| from utils import split_str2indexes | from xautodl.utils import split_str2indexes | ||||||
|  |  | ||||||
| from procedures.advanced_main import basic_train_fn, basic_eval_fn | from xautodl.procedures.advanced_main import basic_train_fn, basic_eval_fn | ||||||
| from procedures.metric_utils import SaveMetric, MSEMetric, ComposeMetric | from xautodl.procedures.metric_utils import SaveMetric, MSEMetric, ComposeMetric | ||||||
| from datasets.synthetic_core import get_synthetic_env | from xautodl.datasets.synthetic_core import get_synthetic_env | ||||||
| from models.xcore import get_model | from xautodl.models.xcore import get_model | ||||||
|  |  | ||||||
|  |  | ||||||
| from lfna_utils import lfna_setup | from lfna_utils import lfna_setup | ||||||
|   | |||||||
| @@ -9,19 +9,21 @@ from tqdm import tqdm | |||||||
| from copy import deepcopy | from copy import deepcopy | ||||||
| from pathlib import Path | from pathlib import Path | ||||||
|  |  | ||||||
| lib_dir = (Path(__file__).parent / ".." / ".." / "lib").resolve() | from xautodl.procedures import ( | ||||||
| if str(lib_dir) not in sys.path: |     prepare_seed, | ||||||
|     sys.path.insert(0, str(lib_dir)) |     prepare_logger, | ||||||
| from procedures import prepare_seed, prepare_logger, save_checkpoint, copy_checkpoint |     save_checkpoint, | ||||||
| from log_utils import time_string |     copy_checkpoint, | ||||||
| from log_utils import AverageMeter, convert_secs2time | ) | ||||||
|  | from xautodl.log_utils import time_string | ||||||
|  | from xautodl.log_utils import AverageMeter, convert_secs2time | ||||||
|  |  | ||||||
| from utils import split_str2indexes | from xautodl.utils import split_str2indexes | ||||||
|  |  | ||||||
| from procedures.advanced_main import basic_train_fn, basic_eval_fn | from xautodl.procedures.advanced_main import basic_train_fn, basic_eval_fn | ||||||
| from procedures.metric_utils import SaveMetric, MSEMetric, ComposeMetric | from xautodl.procedures.metric_utils import SaveMetric, MSEMetric, ComposeMetric | ||||||
| from datasets.synthetic_core import get_synthetic_env | from xautodl.datasets.synthetic_core import get_synthetic_env | ||||||
| from models.xcore import get_model | from xautodl.models.xcore import get_model | ||||||
|  |  | ||||||
| from lfna_utils import lfna_setup | from lfna_utils import lfna_setup | ||||||
|  |  | ||||||
|   | |||||||
| @@ -9,19 +9,21 @@ from tqdm import tqdm | |||||||
| from copy import deepcopy | from copy import deepcopy | ||||||
| from pathlib import Path | from pathlib import Path | ||||||
|  |  | ||||||
| lib_dir = (Path(__file__).parent / ".." / ".." / "lib").resolve() | from xautodl.procedures import ( | ||||||
| if str(lib_dir) not in sys.path: |     prepare_seed, | ||||||
|     sys.path.insert(0, str(lib_dir)) |     prepare_logger, | ||||||
| from procedures import prepare_seed, prepare_logger, save_checkpoint, copy_checkpoint |     save_checkpoint, | ||||||
| from log_utils import time_string |     copy_checkpoint, | ||||||
| from log_utils import AverageMeter, convert_secs2time | ) | ||||||
|  | from xautodl.log_utils import time_string | ||||||
|  | from xautodl.log_utils import AverageMeter, convert_secs2time | ||||||
|  |  | ||||||
| from utils import split_str2indexes | from xautodl.utils import split_str2indexes | ||||||
|  |  | ||||||
| from procedures.advanced_main import basic_train_fn, basic_eval_fn | from xautodl.procedures.advanced_main import basic_train_fn, basic_eval_fn | ||||||
| from procedures.metric_utils import SaveMetric, MSEMetric, ComposeMetric | from xautodl.procedures.metric_utils import SaveMetric, MSEMetric, ComposeMetric | ||||||
| from datasets.synthetic_core import get_synthetic_env | from xautodl.datasets.synthetic_core import get_synthetic_env | ||||||
| from models.xcore import get_model | from xautodl.models.xcore import get_model | ||||||
|  |  | ||||||
| from lfna_utils import lfna_setup | from lfna_utils import lfna_setup | ||||||
|  |  | ||||||
|   | |||||||
| @@ -10,7 +10,12 @@ from pathlib import Path | |||||||
|  |  | ||||||
| from xautodl.datasets import get_datasets | from xautodl.datasets import get_datasets | ||||||
| from xautodl.config_utils import load_config, obtain_basic_args as obtain_args | from xautodl.config_utils import load_config, obtain_basic_args as obtain_args | ||||||
| from xautodl.procedures import prepare_seed, prepare_logger, save_checkpoint, copy_checkpoint | from xautodl.procedures import ( | ||||||
|  |     prepare_seed, | ||||||
|  |     prepare_logger, | ||||||
|  |     save_checkpoint, | ||||||
|  |     copy_checkpoint, | ||||||
|  | ) | ||||||
| from xautodl.procedures import get_optim_scheduler, get_procedures | from xautodl.procedures import get_optim_scheduler, get_procedures | ||||||
| from xautodl.models import obtain_model | from xautodl.models import obtain_model | ||||||
| from xautodl.nas_infer_model import obtain_nas_infer_model | from xautodl.nas_infer_model import obtain_nas_infer_model | ||||||
|   | |||||||
| @@ -15,7 +15,12 @@ from xautodl.config_utils import ( | |||||||
|     configure2str, |     configure2str, | ||||||
|     obtain_search_single_args as obtain_args, |     obtain_search_single_args as obtain_args, | ||||||
| ) | ) | ||||||
| from xautodl.procedures import prepare_seed, prepare_logger, save_checkpoint, copy_checkpoint | from xautodl.procedures import ( | ||||||
|  |     prepare_seed, | ||||||
|  |     prepare_logger, | ||||||
|  |     save_checkpoint, | ||||||
|  |     copy_checkpoint, | ||||||
|  | ) | ||||||
| from xautodl.procedures import get_optim_scheduler, get_procedures | from xautodl.procedures import get_optim_scheduler, get_procedures | ||||||
| from xautodl.datasets import get_datasets, SearchDataset | from xautodl.datasets import get_datasets, SearchDataset | ||||||
| from xautodl.models import obtain_search_model, obtain_model, change_key | from xautodl.models import obtain_search_model, obtain_model, change_key | ||||||
|   | |||||||
| @@ -24,18 +24,13 @@ import copy | |||||||
| from datetime import datetime | from datetime import datetime | ||||||
| import argparse | import argparse | ||||||
| from collections import OrderedDict | from collections import OrderedDict | ||||||
| from pathlib import Path |  | ||||||
| from pprint import pprint | from pprint import pprint | ||||||
| import ruamel.yaml as yaml | import ruamel.yaml as yaml | ||||||
|  |  | ||||||
| lib_dir = (Path(__file__).parent / ".." / ".." / "lib").resolve() | from xautodl.config_utils import arg_str2bool | ||||||
| if str(lib_dir) not in sys.path: | from xautodl.procedures.q_exps import update_gpu | ||||||
|     sys.path.insert(0, str(lib_dir)) | from xautodl.procedures.q_exps import update_market | ||||||
|  | from xautodl.procedures.q_exps import run_exp | ||||||
| from config_utils import arg_str2bool |  | ||||||
| from procedures.q_exps import update_gpu |  | ||||||
| from procedures.q_exps import update_market |  | ||||||
| from procedures.q_exps import run_exp |  | ||||||
|  |  | ||||||
| import qlib | import qlib | ||||||
| from qlib.utils import init_instance_by_config | from qlib.utils import init_instance_by_config | ||||||
|   | |||||||
| @@ -7,15 +7,11 @@ import os, re, sys, argparse | |||||||
| import numpy as np | import numpy as np | ||||||
| from typing import List, Text | from typing import List, Text | ||||||
| from collections import defaultdict, OrderedDict | from collections import defaultdict, OrderedDict | ||||||
| from pathlib import Path |  | ||||||
| from pprint import pprint | from pprint import pprint | ||||||
| import ruamel.yaml as yaml | import ruamel.yaml as yaml | ||||||
|  |  | ||||||
| lib_dir = (Path(__file__).parent / ".." / ".." / "lib").resolve() | from xautodl.config_utils import arg_str2bool | ||||||
| if str(lib_dir) not in sys.path: |  | ||||||
|     sys.path.insert(0, str(lib_dir)) |  | ||||||
|  |  | ||||||
| from config_utils import arg_str2bool |  | ||||||
| import qlib | import qlib | ||||||
| from qlib.config import REG_CN | from qlib.config import REG_CN | ||||||
| from qlib.workflow import R | from qlib.workflow import R | ||||||
|   | |||||||
| @@ -6,16 +6,11 @@ | |||||||
| # - https://github.com/microsoft/qlib/blob/main/examples/workflow_by_code.py | # - https://github.com/microsoft/qlib/blob/main/examples/workflow_by_code.py | ||||||
| # python exps/trading/workflow_tt.py --gpu 1 --market csi300 | # python exps/trading/workflow_tt.py --gpu 1 --market csi300 | ||||||
| ##################################################### | ##################################################### | ||||||
| import sys, argparse | import argparse | ||||||
| from pathlib import Path |  | ||||||
|  |  | ||||||
| lib_dir = (Path(__file__).parent / ".." / ".." / "lib").resolve() | from xautodl.procedures.q_exps import update_gpu | ||||||
| if str(lib_dir) not in sys.path: | from xautodl.procedures.q_exps import update_market | ||||||
|     sys.path.insert(0, str(lib_dir)) | from xautodl.procedures.q_exps import run_exp | ||||||
|  |  | ||||||
| from procedures.q_exps import update_gpu |  | ||||||
| from procedures.q_exps import update_market |  | ||||||
| from procedures.q_exps import run_exp |  | ||||||
|  |  | ||||||
| import qlib | import qlib | ||||||
| from qlib.config import C | from qlib.config import C | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user