MolecularAI / ReinventCommunity

MIT License
150 stars 56 forks source link

Error When running transfer learning demo #31

Closed yrq3027 closed 2 years ago

yrq3027 commented 2 years ago

Hi, Sir or Madam! When running the notebook transfer_learning_demo.ipynb, I met some problem. Firstly, after changing the path of files and python env, it threw the error as follow:

                          Traceback (most recent call last):
                            File "/home/data/aidd/Reinvent//input.py", line 20, in <module>
                              manager = Manager(configuration)
                            File "/home/data/aidd/Reinvent/running_modes/manager.py", line 13, in __init__
                              self._load_environmental_variables()
                            File "/home/data/aidd/Reinvent/running_modes/manager.py", line 29, in _load_environmental_variables
                              raise ex
                            File "/home/data/aidd/Reinvent/running_modes/manager.py", line 24, in _load_environmental_variables
                              environmental_variables = config["ENVIRONMENTAL_VARIABLES"]
                          KeyError: 'ENVIRONMENTAL_VARIABLES'

I am not very clear what should be set in config.json. I just note some code in manager.py like these:

                          import json
                          import os

                          from running_modes.configurations import GeneralConfigurationEnvelope
                          from running_modes.enums.running_mode_enum import RunningModeEnum
                          from running_modes.constructors.running_mode import RunningMode

                          class Manager:

                              def __init__(self, configuration):
                                  self.running_mode_enum = RunningModeEnum()
                                  self.configuration = GeneralConfigurationEnvelope(**configuration)
                                  self._load_environmental_variables()

                              def run(self):
                                  runner = RunningMode(self.configuration)
                                  runner.run()

                              def _load_environmental_variables(self):
                                  try:
                                      project_root = os.path.dirname(__file__)
                                      with open(os.path.join(project_root, '../configs/config.json'), 'r') as f:
                                          config = json.load(f)
                                      #environmental_variables = config["ENVIRONMENTAL_VARIABLES"]
                                      #for key, value in environmental_variables.items():
                                          #os.environ[key] = value

                                  except KeyError as ex:
                                      raise ex

Then, it run successfully. However, it run only by CPU, GPU cannot accelerate. Could you tell me how to set the config.json in Reinvent folder? Thank you very much!

yrq3027 commented 2 years ago

It my miss. I install several pytorch