moboehle / B-cos

B-cos Networks: Alignment is All we Need for Interpretability
Other
103 stars 11 forks source link

Code Running Erro #5

Closed scutfrank closed 1 year ago

scutfrank commented 1 year ago

By following the README of Training,an error happens when run the code as below. Could you help to check it ,thanks !

Traceback (most recent call last): File "D:/1.Study/PycharmProjects/Reproduce/B-cos-main/experiments/Imagenet/bcos/model.py", line 93, in start_training(cmd_args, get_model, get_optimizer) File "D:\1.Study\PycharmProjects\Reproduce\B-cos-main\training\training_utils.py", line 17, in start_training training_loop(params, get_model, get_optimizer) File "D:\1.Study\PycharmProjects\Reproduce\B-cos-main\training\training_utils.py", line 83, in training_loop data_handler = Data(params.dataset_name, rank=ddp_rank, File "D:\1.Study\PycharmProjects\Reproduce\B-cos-main\data\data_handler.py", line 82, in init self.train_data_loader = self.init_data_loader(train=True, File "D:\1.Study\PycharmProjects\Reproduce\B-cos-main\data\data_handler.py", line 105, in init_data_loader data = Data.datasets[self.dataset_name](self.data_path, train=train, download=False, File "D:\1.Study\PycharmProjects\Reproduce\B-cos-main\data\datasets.py", line 34, in init path = os.path.join(root, self.base_folder, "train" if train else "val") File "D:\Software\anaconda3\lib\ntpath.py", line 78, in join path = os.fspath(path) TypeError: expected str, bytes or os.PathLike object, not NoneType image

moboehle commented 1 year ago

Hi,

please make sure that you correctly set the DATA_ROOT variable in the project config. I.e., either directly set it there or make sure that the environment variable "DATA_ROOT_PATH" is correctly set.

scutfrank commented 1 year ago

@moboehle Hi moboehele,Thanks for your reply ! 1.Since i didn't download any dataset ,does it mean that i need to download them first ? If yes, need I also do some adjustment on the structure of the dataset folder or just simply unzip them and copy the path ? 2.And notice your comand is for resnet_34 & Imagenet ,and what should I do to do experiments on CIFAR10 and other network ?Seems simply just replace the dataset_name=CIFAR10 and experiment_name int the command didn't work.