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

guidance on launching xmanager from colab #14

Open
proppy opened this issue Mar 30, 2022 · 4 comments
Open

guidance on launching xmanager from colab #14

proppy opened this issue Mar 30, 2022 · 4 comments

Comments

@proppy
Copy link

proppy commented Mar 30, 2022

The current codelab gives a good overview of orchestrating xmanager using its Python API directly from jupyter cells:
https://github.com/deepmind/xmanager/blob/main/codelab.ipynb

I'm curious if you have any guidance on how to achieve similar result in https://colab.research.google.com/ given it's limited support for async, await googlecolab/colabtools#1553.

@andrewluchen
Copy link
Collaborator

It isn't required to use async, at least in pure Python. Does it work if you remove it?

@proppy
Copy link
Author

proppy commented May 6, 2022

also filed #21 about installation issue in the current colab environment (18.06)

@proppy
Copy link
Author

proppy commented May 6, 2022

@andrewluchen if I remove it I get the following error:

with xm_local.create_experiment(experiment_title='my-first-experiment') as experiment:
    print(f'Local Experiment created with experiment_id={experiment.experiment_id}')
RuntimeError                              Traceback (most recent call last)
[<ipython-input-4-d5d140cdb440>](https://localhost:8080/#) in <module>()
      2 from xmanager import xm_local
      3 
----> 4 with xm_local.create_experiment(experiment_title='my-first-experiment') as experiment:
      5     print(f'Local Experiment created with experiment_id={experiment.experiment_id}')

[/usr/local/lib/python3.7/dist-packages/xmanager/xm/core.py](https://localhost:8080/#) in __enter__(self)
    528   def __enter__(self):
    529     if asyncio.get_event_loop().is_running():
--> 530       raise RuntimeError('When using Experiment from a coroutine please use '
    531                          '`async with` syntax')
    532 

RuntimeError: When using Experiment from a coroutine please use `async with` syntax

See the following colab:
https://colab.research.google.com/gist/proppy/9f4c8b65c4eda51c08a763a751a50db9/xmanager-playground.ipynb

@thesstefan
Copy link
Contributor

A Colab notebook exemplifying how an experiment can be launched is available here. Due to Colab's limited async and await support, this is currently done by running all launch instructions in one cell. Further improvements to the notebook may be made in the future.

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

3 participants