Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to import data #1

Open
xiaowangfeng opened this issue May 7, 2024 · 1 comment
Open

how to import data #1

xiaowangfeng opened this issue May 7, 2024 · 1 comment

Comments

@xiaowangfeng
Copy link

I want to run the demo,but i can;t find where to import data

parser = argparse.ArgumentParser(
description='Crystal Graph Convolutional Neural Networks')
parser.add_argument('data_options', metavar='OPTIONS', nargs='+',
help='dataset options, started with the path to root dir, '
'then other options')
parser.add_argument('--disable-cuda', action='store_true',
help='Disable CUDA')
parser.add_argument('-j', '--workers', default=1, type=int, metavar='N',
help='number of data loading workers (default: 0)')
parser.add_argument('--epochs', default=30, type=int, metavar='N',
help='number of total epochs to run (default: 30)')
parser.add_argument('--start-epoch', default=20, type=int, metavar='N',
help='manual epoch number (useful on restarts)')
parser.add_argument('-b', '--batch-size', default=10, type=int,
metavar='N', help='mini-batch size (default: 256)')
parser.add_argument('--lr', '--learning-rate', default=0.01, type=float,
metavar='LR', help='initial learning rate (default: '
'0.01)')
parser.add_argument('--lr-milestones', default=[100], nargs='+', type=int,
metavar='N', help='milestones for scheduler (default: '
'[100])')
parser.add_argument('--momentum', default=0.9, type=float, metavar='M',
help='momentum')
parser.add_argument('--weight_decay', '--wd', default=5e-4, type=float,
metavar='W', help='weight decay (default: 0)')
parser.add_argument('--print-freq', '-p', default=10, type=int,
metavar='N', help='print frequency (default: 10)')
parser.add_argument('--resume', default='', type=str, metavar='PATH',
help='path to latest checkpoint (default: none)')
train_group = parser.add_mutually_exclusive_group()
train_group.add_argument('--train-ratio', default=0.8, type=float, metavar='N',
help='number of training data to be loaded (default none)')
train_group.add_argument('--train-size', default=None, type=int, metavar='N',
help='number of training data to be loaded (default none)')
valid_group = parser.add_mutually_exclusive_group()
valid_group.add_argument('--val-ratio', default=0.1, type=float, metavar='N',
help='percentage of validation data to be loaded (default '
'0.1)')
valid_group.add_argument('--val-size', default=None, type=int, metavar='N',
help='number of validation data to be loaded (default '
'1000)')
test_group = parser.add_mutually_exclusive_group()
test_group.add_argument('--test-ratio', default=0.1, type=float, metavar='N',
help='percentage of test data to be loaded (default 0.1)')
test_group.add_argument('--test-size', default=None, type=int, metavar='N',
help='number of test data to be loaded (default 1000)')

parser.add_argument('--optim', default='SGD', type=str, metavar='SGD',
help='choose an optimizer, SGD or Adam, (default: SGD)')
parser.add_argument('--atom-fea-len', default=64, type=int, metavar='N',
help='number of hidden atom features in conv layers')
parser.add_argument('--h-fea-len', default=128, type=int, metavar='N',
help='number of hidden features after pooling')
parser.add_argument('--disable-save-torch', action='store_true',
help='Do not save CIF PyTorch data as .pkl files')
parser.add_argument('--clean-torch', action='store_true',
help='Clean CIF PyTorch data .pkl files')

args = parser.parse_args(sys.argv[1:])

args.cuda = not args.disable_cuda and torch.cuda.is_available()

print(torch.cuda.is_available())

print('args.cuda', args.cuda)

best_mae_error = 1e10

def main():
global args, best_mae_error

# load data
dataset = CIFData(*args.data_options,
                  disable_save_torch=args.disable_save_torch)
collate_fn = collate_pool
train_loader, val_loader, test_loader = get_train_val_test_loader(
    dataset=dataset,
    collate_fn=collate_fn,
    batch_size=args.batch_size,
    train_ratio=args.train_ratio,
    num_workers=args.workers,
    val_ratio=args.val_ratio,
    test_ratio=args.test_ratio,
    pin_memory=args.cuda,
    train_size=args.train_size,
    val_size=args.val_size,
    test_size=args.test_size,
    return_test=True)

thanks

@xiaowangfeng
Copy link
Author

when I try it in cmd ,it will happen
(DL) E:\GANN-main\GANN-main\demo>python main.py --batch-size 10 --train-ratio 0.8 --val-ratio 0.1 --test-ratio 0.1 --workers 1 --epochs 20 --print-freq 1 data > log.out
Traceback (most recent call last):
File "E:\GANN-main\GANN-main\demo\main.py", line 416, in
main()
File "E:\GANN-main\GANN-main\demo\main.py", line 94, in main
dataset = CIFData(*args.data_options,
AttributeError: 'Namespace' object has no attribute 'data_options'

how to solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant