Last active
February 20, 2023 14:24
-
-
Save erikbern/6d3ed976917977f9b62c1aeb37628a2a to your computer and use it in GitHub Desktop.
Run Notebook inside Modal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: this assumes you have a notebook locally named my_notebook.ipynb | |
import modal | |
stub = modal.Stub( | |
image=modal.DebianSlim().pip_install(["papermill", "ipykernel"]), | |
mounts=[modal.Mount(local_file="my_notebook.ipynb", remote_dir="/root")], | |
) | |
@stub.function | |
def run(): | |
import papermill | |
papermill.execute_notebook( | |
"/root/my_notebook.ipynb", | |
"/root/my_notebook_outout.ipynb", | |
) | |
if __name__ == "__main__": | |
with stub.run(): | |
run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, could you write an updated working examples of a notebook used into modal please ?