|
import os |
|
import resource |
|
|
|
from helpers import * |
|
from Trainer import Trainer |
|
|
|
rlimit = resource.getrlimit(resource.RLIMIT_NOFILE) |
|
resource.setrlimit( |
|
resource.RLIMIT_NOFILE, (65536, rlimit[1]) |
|
) |
|
|
|
if __name__ == '__main__': |
|
opt = __import__('options') |
|
os.environ['CUDA_VISIBLE_DEVICES'] = opt.gpu |
|
else: |
|
import options as opt |
|
|
|
|
|
if __name__ == '__main__': |
|
print("Loading options...") |
|
trainer = Trainer() |
|
|
|
if hasattr(opt, 'weights'): |
|
trainer.load_weights(opt.weights) |
|
|
|
torch.manual_seed(opt.random_seed) |
|
torch.cuda.manual_seed_all(opt.random_seed) |
|
trainer.train() |
|
|