HazyResearch/metal

KeyError: 'METALHOME' error from MMTL_Basics tutorial

Peter-Devine opened this issue · 1 comments

When running the 11th cell of the MMTL_Basics tutorial (metal/tutorials/MMTL_Basics.ipynb), I get the following error:

KeyError                                  Traceback (most recent call last)
<ipython-input-11-0b22f6272cd1> in <module>
----> 1 from metal.mmtl.trainer import MultitaskTrainer
      2 
      3 trainer = MultitaskTrainer()

~\Anaconda3\lib\site-packages\metal\mmtl\trainer.py in <module>
    109     "writer": None,  # [None, "json", "tensorboard"]
    110     "writer_config": {  # Log (or event) file stored at log_dir/run_dir/run_name
--> 111         "log_dir": f"{os.environ['METALHOME']}/logs",
    112         "run_dir": None,
    113         "run_name": None,

~\Anaconda3\lib\os.py in __getitem__(self, key)
    667         except KeyError:
    668             # raise KeyError with the original key value
--> 669             raise KeyError(key) from None
    670         return self.decodevalue(value)
    671 

KeyError: 'METALHOME'

I can solve this by inserting the following code as a cell above it:

import os

os.environ['METALHOME'] = "PATH/WHERE/I/WANT/LOGS/TO/GO"

This approach makes the tutorial code run fine. Just wondering if there will be any complications later/ why this is happening in the first place.

Anyway, awesome bit of software, thanks!

Thanks for reporting the issue! Previously we set that environment variable so the various subpackages of metal could find each other without too many ".." calls. But we no longer require that variable to be set. Fixed in 6d557e0. Thanks!