if not args.cuda: args.gpu = -1 if torch.cuda.is_available() and args.cuda: print("Note: You are using GPU for training") torch.cuda.set_device(args.gpu) torch.cuda.manual_seed(args.seed) if torch.cuda.is_available() and not args.cuda: print( "Warning: You have Cuda but not use it. You are using CPU for training." ) TEXT = data.Field(lower=True) RELATION = data.Field(sequential=False) train, dev, test = SQdataset.splits(TEXT, RELATION) TEXT.build_vocab(train, dev, test) RELATION.build_vocab(train, dev) train_iter = data.Iterator(train, batch_size=args.batch_size, device=args.gpu, train=True, repeat=False, sort=False, shuffle=True) dev_iter = data.Iterator(dev, batch_size=args.batch_size, device=args.gpu, train=False, repeat=False,
if not args.cuda: args.gpu = -1 if torch.cuda.is_available() and args.cuda: print("Note: You are using GPU for training") torch.cuda.set_device(args.gpu) torch.cuda.manual_seed(args.seed) if torch.cuda.is_available() and not args.cuda: print( "Warning: You have Cuda but not use it. You are using CPU for training." ) TEXT = data.Field(lower=True) RELATION = data.Field(sequential=False) train, dev, test = SQdataset.splits(TEXT, RELATION, args.data_dir) TEXT.build_vocab(train, dev, test) RELATION.build_vocab(train, dev) train_iter = data.Iterator(train, batch_size=args.batch_size, device="cuda", train=True, repeat=False, sort=False, shuffle=True) dev_iter = data.Iterator(dev, batch_size=args.batch_size, device="cuda", train=False, repeat=False,