train_all: move laya import after phase_env sys.path injection
This commit is contained in:
parent
c4430a5456
commit
bb36f38aa0
11
train_all.py
11
train_all.py
@ -139,11 +139,6 @@ def build_model(dev, tiny=False):
|
||||
|
||||
def run(args):
|
||||
global DATA_DIR, MMBERT_DIR, OUT_DIR
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from torch.utils.data import Dataset, DataLoader
|
||||
from transformers import get_cosine_schedule_with_warmup
|
||||
from laya.common import build_sequence
|
||||
|
||||
if args.data:
|
||||
DATA_DIR = args.data
|
||||
@ -159,6 +154,12 @@ def run(args):
|
||||
if not (args.tiny or phase_mmbert()):
|
||||
sys.exit(1)
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from torch.utils.data import Dataset, DataLoader
|
||||
from transformers import get_cosine_schedule_with_warmup
|
||||
from laya.common import build_sequence
|
||||
|
||||
dev = "cuda" if torch.cuda.is_available() else "cpu"
|
||||
log(f"device={dev} tiny={args.tiny}")
|
||||
dm, tok = build_model(dev, tiny=args.tiny)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user