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 use it in jupyter notebook? #27

Open
Ethan-Chen-plus opened this issue Aug 2, 2023 · 0 comments
Open

How to use it in jupyter notebook? #27

Ethan-Chen-plus opened this issue Aug 2, 2023 · 0 comments

Comments

@Ethan-Chen-plus
Copy link

notebook code:

from ml_collections import config_flags
_CONFIG = config_flags.DEFINE_config_file('config')
mp.set_start_method('spawn')

params = _CONFIG.value

get an error:

---------------------------------------------------------------------------
UnparsedFlagAccessError                   Traceback (most recent call last)
Cell In[2], line 5
      2 _CONFIG = config_flags.DEFINE_config_file('config')
      3 mp.set_start_method('spawn')
----> 5 params = _CONFIG.value

File ~/anaconda3/envs/LLM/lib/python3.11/site-packages/absl/flags/_flagvalues.py:1376, in FlagHolder.value(self)
   1365 @property
   1366 def value(self):
   1367   """Returns the value of the flag.
   1368 
   1369   If ``_ensure_non_none_value`` is ``True``, then return value is not
   (...)
   1374     IllegalFlagValueError: if value is None unexpectedly.
   1375   """
-> 1376   val = getattr(self._flagvalues, self._name)
   1377   if self._ensure_non_none_value and val is None:
   1378     raise _exceptions.IllegalFlagValueError(
   1379         'Unexpected None value for flag %s' % self._name)

File ~/anaconda3/envs/LLM/lib/python3.11/site-packages/absl/flags/_flagvalues.py:481, in FlagValues.__getattr__(self, name)
    479   return fl[name].value
    480 else:
--> 481   raise _exceptions.UnparsedFlagAccessError(
    482       'Trying to access flag --%s before flags were parsed.' % name)

UnparsedFlagAccessError: Trying to access flag --config before flags were parsed.
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