From dfff2d86c05844ae5b190d694ecfa11430872cec Mon Sep 17 00:00:00 2001 From: moritzlaurer Date: Thu, 6 Jun 2024 11:04:13 +0200 Subject: [PATCH 1/6] add recipe for jupyterlab dev spaces --- notebooks/en/_toctree.yml | 2 + .../en/enterprise_cookbook_dev_spaces.md | 88 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 notebooks/en/enterprise_cookbook_dev_spaces.md diff --git a/notebooks/en/_toctree.yml b/notebooks/en/_toctree.yml index ff302fd4..630cee72 100644 --- a/notebooks/en/_toctree.yml +++ b/notebooks/en/_toctree.yml @@ -75,5 +75,7 @@ sections: - local: enterprise_cookbook_overview title: Overview + - local: enterprise_cookbook_dev_spaces + title: Interactive Development In HF Spaces - local: enterprise_cookbook_argilla title: Data annotation with Argilla Spaces \ No newline at end of file diff --git a/notebooks/en/enterprise_cookbook_dev_spaces.md b/notebooks/en/enterprise_cookbook_dev_spaces.md new file mode 100644 index 00000000..3fd3824a --- /dev/null +++ b/notebooks/en/enterprise_cookbook_dev_spaces.md @@ -0,0 +1,88 @@ + +# Interactive Development In HF Spaces + +Services like Google Colab or Kaggle Notebooks have made it dramatically easier for people to access compute in easy-to-use Jupyter notebooks in the browser. Unfortunately these services also have several limitations: GPUs are not stable and a training job can just be cancelled right before it finishes; the choice of GPUs is limited to just a few single GPUs; and there is no native support for connecting to the cloud GPU via your preferred local IDE like VS Code. + +HF JupyterLab Spaces overcome these limitations. With a HF JupyterLab Space, you can do all of your development work in JupyterLab in your browser; you can dynamically switch between CPUs and a wide range of GPUs that never stop unless you want them to; and you can connect to these cloud compute resources with your preferred local IDE like VS Code via SSH for full remote development. + +This recipe guides you though the setup of your own JupyterLab Space. + + +## 1. Interactive Development in HF JupyterLab Spaces + +### Creating your JupyterLab Space +To create your own HF JupyterLab Space, navigate to the [Space creation page](https://huggingface.co/new-space?template=SpacesExamples%2Fjupyterlab) and click on `Docker` > `JupyterLab`. A HF JupyterLab Space is essentially a Docker container with a pre-configured copy of JupyterLab that runs on Hugging Face's cloud infrastructure. Here is some advice on figuring your JupyterLab Space: + +- **Choosing the correct owner**: If you are using the JupyterLab Space as part of your work for an Enterprise Hub Organization, select the organization's name under the `Owner` dropdown (e.g. the dummy "enterprise-explorers" in the image below). Any compute costs will then be billed on the account of this Enterprise Organization. +- **Access control**: If you want only selected members of your team to access the JupyterLab Space, you can click on `Everyone` right next to `Access Control` and limit access to the JupyterLab Space to a predefined Resource Group. Resource Groups are an Enterprise Hub feature that enables you to limit access to selected repositories (models, datasets, Spaces) to a smaller group of team members. See the [docs](https://huggingface.co/docs/hub/en/security-resource-groups) on how to create your first Resource Group. + + + +- **Choosing your hardware**: You can choose from a wide range of hardware from free CPUs to A100 GPUs. When setting up the Space, we recommend you choose the free basic CPU. You can switch to better paid hardware once you need it (see available hardware and prices [here](https://huggingface.co/pricing)). +- **Persistent storage**: It is important to attach persistent storage to the Space, so that all the files you create (code, models, data) is also saved when the Space is paused or reset. You can always increase the disk space in the settings later when necessary. All persistet data is stored in the `/data` directory ([docs](https://huggingface.co/docs/hub/en/spaces-storage)). +- **Set your password**: Once the Space is created, it will require a password for logging into JupyterLab. This password is defined with the `JUPYTER_TOKEN` Space secret. If you do not define a password here, the default password is "huggingface". +- **Dev Mode**: Dev Mode is a feature for Enterprise Hub subscribers which enables you to SSH into any HF Space. Activate this to be able to connect your local VS Code for remote development on the Space's cloud hardware (this can also be switched on/off later). See the preview docs [here](https://huggingface.co/dev-mode-explorers). +- **Private Spaces**: As an additional layer of security, we recommend setting the Space to private, so that only members of your Enterprise Organization (and of specific Resource Groups) can see it. + + + + +Once you have configured the JupyterLab Space, you can click on `Create Space`. The Space will be built and after a few seconds you will see the JupyterLab login screen. You can now login with the password you defined before. + + + + +### Using your JupyterLab Space + +You can now work in your own JupyterLab Space in the browser! You can create your own directory structure with .ipynb notebooks or any other files and datasets in the File Browser on the left. If you have activated persistent storage, all files are permanently stored in the default `/data` directory of the Space. + + + + +### Dynamically switching between CPUs and GPUs + +Similar to services like Google Colab, you can change the hardware the Space is running on-the-fly. We recommend doing initial setup work on the upgraded or free CPU, for example data cleaning, setting up Endpoints, or testing APIs. Once your code is set up, you can simply click on `Settings` at the top right of the Space and change to a wide selection of hardware that might be required for more compute intensive inference or training jobs. When you change hardware, the Space will restart itself and all environment variables will be lost (like with Google Colab) and you will have a new clean environment on the new hardware after some seconds. Your stored and saved files (code, data etc.) will of course also be available on the new hardware. The image below shows the available hardware at the time of writing (June 2024) and this will be updated in the future. + +In the bottom left of the image, you can also see the `Sleep time settings` where you can define how long you want the hardware to run in case of inactivity. This is a major advantage over Google Colab: if you want to save money, you can make the Space sleep after 15 minutes of inactivity, but if you need the hardware to be available for a 48 hour training run or longer, you can just prevent the Space from falling asleep and let it run for as long as you want. You can also manually `Pause` the Space and you will no longer be charged for the Space Hardware. + + + +If you scroll down in the settings, you will see additional options, like expanding storage, resetting the space etc. In case you have not set a password during Space creation, you can also create a secret called `JUPYTER_TOKEN` here later, which will replace the default "huggingface" password. + +> [!TIP] +> When you actively work with the space over several days or weeks, files will start accumulating in the storage cache. When you get a warning that the storage is full and you think that the storage quote should not be reached yet, it might be helpful to factory reset the Space to empty the cache. + + +### Customizing your JupyterLab Space + +Remember that your JupyterLab Space is just a pre-configured Docker container, so if you are familiar with Docker, you can also customize it to your needs. For example, you can go to the `Files` section of your Space and add new requirements to the `requirements.txt` file or you can change from the default container image to another image in the `Dockerfile` e.g. if you need a specific CUDA and PyTorch version preinstalled. + + + + + + + + +## 2. Dev Mode, or: Develop on 4 GPUs from your local VS Code + +What if you don't like working in JupyterLab in the browser? Enter `Dev Mode`. `Dev Mode` enables you to SSH into any Space's hardware from their local IDE like VS Code. [HF Pro/Enterprise](https://huggingface.co/pricing) subscribers can activate `Dev Mode` for any Space in the Space's settings. + +Once `Dev Mode` is activated, you will see a pop-up at the bottom left of your JupyterLab Space's window. To SSH into your local VS Code, you first need to install the [VS Code Remote - SSH extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) locally and add your SSH key to your [HF Profile](https://huggingface.co/settings/keys). Clicking on `Connect with VS Code` should then open your local VS Code window and establish the remote connection to your space. A similar process should be possible with any IDE that supports remote development with SSH. + + + +When connecting to your Space with SSH, your default directory will be an empty `/app` directory. You then need to change to the `/data` directory, where all your persistent files (code, data, models etc.) are stored. The `/data` directory is the only directory with guaranteed file persistance across sessions. You can find the files of your Docker container in the `HOME/user/app` directory, in case you want to modify the underlying Docker container. + +> [!TIP] +> Persisted files in the `/data` directory are currently not automatically backed up. We therefore recommend making backups of your most important files on a regular basis to avoid accidental data loss. + +> [!TIP] +> To make sure that your work is secure, we recommend setting JupyterLab Spaces to private, use a strong password, and if you work in a larger organization enable it only for specific [Resource Groups](https://huggingface.co/docs/hub/en/security-resource-groups). + + +## Now write some code! + +That's it, you can now run a JupyterLab Space in your browser, switch between one or multiple powerful GPUs on-the-fly, and connect to the hardware from your local IDE. + +This entire recipe was written in a JupyterLab Space on a free CPU and we invite you to follow all other recipes of the Enterprise Hub Cookbook in your own JupyterLab Space. From 41f3c782fb040986d620b3997c054381b8917ed2 Mon Sep 17 00:00:00 2001 From: moritzlaurer Date: Thu, 6 Jun 2024 12:33:17 +0200 Subject: [PATCH 2/6] remove "(coming soon)" in overview.md and try adding hyperlink in title --- notebooks/en/enterprise_cookbook_overview.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebooks/en/enterprise_cookbook_overview.md b/notebooks/en/enterprise_cookbook_overview.md index a90daa13..d0258d6c 100644 --- a/notebooks/en/enterprise_cookbook_overview.md +++ b/notebooks/en/enterprise_cookbook_overview.md @@ -5,7 +5,7 @@ The Enterprise Hub Cookbook is designed for power users and enterprises who want -## Interactive Development in HF Spaces (coming soon) +## [Interactive Development in HF Spaces](enterprise_cookbook_dev_spaces.md) With JupyterLab Spaces you can spin up your personal Jupyter Notebook like in Google Colab, only with a wider selection of more reliable CPUs and GPUs (e.g. H100 or 4xA10G) that you can select and switch on the fly. Moreover, by activating Spaces Dev Mode you can also use this cloud hardware from your local IDE (e.g. VS Code). Read this recipe to learn how to spin up a GPU and connect to it via your local IDE. For more details, read also the [JupyterLab Spaces](https://huggingface.co/docs/hub/spaces-sdks-docker-jupyter) and the [Dev Mode](https://huggingface.co/dev-mode-explorers) documentation. From 6d747e4621b2a13f5c2efd14337cbb9d7b4ad9bf Mon Sep 17 00:00:00 2001 From: moritzlaurer Date: Fri, 7 Jun 2024 10:25:42 +0200 Subject: [PATCH 3/6] implemented suggestions from steven and merve --- .../en/enterprise_cookbook_dev_spaces.md | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/notebooks/en/enterprise_cookbook_dev_spaces.md b/notebooks/en/enterprise_cookbook_dev_spaces.md index 3fd3824a..518bf0fb 100644 --- a/notebooks/en/enterprise_cookbook_dev_spaces.md +++ b/notebooks/en/enterprise_cookbook_dev_spaces.md @@ -1,17 +1,23 @@ # Interactive Development In HF Spaces -Services like Google Colab or Kaggle Notebooks have made it dramatically easier for people to access compute in easy-to-use Jupyter notebooks in the browser. Unfortunately these services also have several limitations: GPUs are not stable and a training job can just be cancelled right before it finishes; the choice of GPUs is limited to just a few single GPUs; and there is no native support for connecting to the cloud GPU via your preferred local IDE like VS Code. +Services like Google Colab or Kaggle Notebooks have made it dramatically easier for people to access compute in easy-to-use Jupyter notebooks in the browser. Unfortunately, these services also have several limitations: +- GPUs are unstable, and a training job can be canceled right before it finishes. +- The choice of GPUs is limited to just a few single GPUs. +- There is no native support for connecting to the cloud GPU via your preferred local IDE like VS Code. -HF JupyterLab Spaces overcome these limitations. With a HF JupyterLab Space, you can do all of your development work in JupyterLab in your browser; you can dynamically switch between CPUs and a wide range of GPUs that never stop unless you want them to; and you can connect to these cloud compute resources with your preferred local IDE like VS Code via SSH for full remote development. +HF JupyterLab Spaces overcome these limitations. With a HF JupyterLab Space, you can: +- Do all of your development work in JupyterLab in your browser. +- Dynamically switch between CPUs and a wide range of GPUs that never stop unless you want them to. +- Connect to cloud compute resources with your preferred local IDE like VS Code via SSH for full remote development. This recipe guides you though the setup of your own JupyterLab Space. -## 1. Interactive Development in HF JupyterLab Spaces +## Interactive Development in HF JupyterLab Spaces ### Creating your JupyterLab Space -To create your own HF JupyterLab Space, navigate to the [Space creation page](https://huggingface.co/new-space?template=SpacesExamples%2Fjupyterlab) and click on `Docker` > `JupyterLab`. A HF JupyterLab Space is essentially a Docker container with a pre-configured copy of JupyterLab that runs on Hugging Face's cloud infrastructure. Here is some advice on figuring your JupyterLab Space: +To create your own HF JupyterLab Space, navigate to the [Space creation page](https://huggingface.co/new-space?template=SpacesExamples%2Fjupyterlab) and click on `Docker` > `JupyterLab`. A HF JupyterLab Space is essentially a Docker container with a pre-configured copy of JupyterLab that runs on Hugging Face's cloud infrastructure. Here is some advice on configuring your JupyterLab Space: - **Choosing the correct owner**: If you are using the JupyterLab Space as part of your work for an Enterprise Hub Organization, select the organization's name under the `Owner` dropdown (e.g. the dummy "enterprise-explorers" in the image below). Any compute costs will then be billed on the account of this Enterprise Organization. - **Access control**: If you want only selected members of your team to access the JupyterLab Space, you can click on `Everyone` right next to `Access Control` and limit access to the JupyterLab Space to a predefined Resource Group. Resource Groups are an Enterprise Hub feature that enables you to limit access to selected repositories (models, datasets, Spaces) to a smaller group of team members. See the [docs](https://huggingface.co/docs/hub/en/security-resource-groups) on how to create your first Resource Group. @@ -19,10 +25,10 @@ To create your own HF JupyterLab Space, navigate to the [Space creation page](ht - **Choosing your hardware**: You can choose from a wide range of hardware from free CPUs to A100 GPUs. When setting up the Space, we recommend you choose the free basic CPU. You can switch to better paid hardware once you need it (see available hardware and prices [here](https://huggingface.co/pricing)). -- **Persistent storage**: It is important to attach persistent storage to the Space, so that all the files you create (code, models, data) is also saved when the Space is paused or reset. You can always increase the disk space in the settings later when necessary. All persistet data is stored in the `/data` directory ([docs](https://huggingface.co/docs/hub/en/spaces-storage)). -- **Set your password**: Once the Space is created, it will require a password for logging into JupyterLab. This password is defined with the `JUPYTER_TOKEN` Space secret. If you do not define a password here, the default password is "huggingface". -- **Dev Mode**: Dev Mode is a feature for Enterprise Hub subscribers which enables you to SSH into any HF Space. Activate this to be able to connect your local VS Code for remote development on the Space's cloud hardware (this can also be switched on/off later). See the preview docs [here](https://huggingface.co/dev-mode-explorers). -- **Private Spaces**: As an additional layer of security, we recommend setting the Space to private, so that only members of your Enterprise Organization (and of specific Resource Groups) can see it. +- **Persistent storage**: It is important to attach persistent storage to the Space, so that all the files you create (code, models, data) are also saved when the Space is paused or reset. You can always increase the disk space in the settings later when necessary. All persistent data is stored in the `/data` directory ([docs](https://huggingface.co/docs/hub/en/spaces-storage)). +- **Set your password**: Once the Space is created, it will require a password for logging into JupyterLab. This password is defined with the `JUPYTER_TOKEN` Space secret. If you do not define a password here, the default password is "huggingface". We recommend setting a strong password. +- **Dev Mode**: Dev Mode is a feature for Enterprise Hub subscribers that enables you to SSH into any HF Space. Activate this to connect your local VS Code for remote development on the Space's cloud hardware (this can also be switched on/off later). See the preview docs [here](https://huggingface.co/dev-mode-explorers). +- **Private Spaces**: As an additional layer of security, we recommend setting the Space to private, so that only members of your Enterprise Organization (and of specific Resource Groups) can see it. @@ -43,19 +49,19 @@ You can now work in your own JupyterLab Space in the browser! You can create you Similar to services like Google Colab, you can change the hardware the Space is running on-the-fly. We recommend doing initial setup work on the upgraded or free CPU, for example data cleaning, setting up Endpoints, or testing APIs. Once your code is set up, you can simply click on `Settings` at the top right of the Space and change to a wide selection of hardware that might be required for more compute intensive inference or training jobs. When you change hardware, the Space will restart itself and all environment variables will be lost (like with Google Colab) and you will have a new clean environment on the new hardware after some seconds. Your stored and saved files (code, data etc.) will of course also be available on the new hardware. The image below shows the available hardware at the time of writing (June 2024) and this will be updated in the future. -In the bottom left of the image, you can also see the `Sleep time settings` where you can define how long you want the hardware to run in case of inactivity. This is a major advantage over Google Colab: if you want to save money, you can make the Space sleep after 15 minutes of inactivity, but if you need the hardware to be available for a 48 hour training run or longer, you can just prevent the Space from falling asleep and let it run for as long as you want. You can also manually `Pause` the Space and you will no longer be charged for the Space Hardware. +In the bottom left of the image, you can also see the `Sleep time settings` where you can define how long you want the hardware to run in case of inactivity. This is a major advantage over Google Colab. if you want to save money, you can make the Space sleep after 15 minutes of inactivity, but if you need the hardware to be available for a 48 hour training run or longer, you can just prevent the Space from falling asleep and let it run for as long as you want. You can also manually `Pause` the Space and you will no longer be charged for the Space Hardware. -If you scroll down in the settings, you will see additional options, like expanding storage, resetting the space etc. In case you have not set a password during Space creation, you can also create a secret called `JUPYTER_TOKEN` here later, which will replace the default "huggingface" password. +If you scroll down in the settings, you will see additional options, like expanding storage, resetting the Space, etc. In case you have not set a password during Space creation, you can also create a secret called `JUPYTER_TOKEN` here later, which will replace the default "huggingface" password. > [!TIP] -> When you actively work with the space over several days or weeks, files will start accumulating in the storage cache. When you get a warning that the storage is full and you think that the storage quote should not be reached yet, it might be helpful to factory reset the Space to empty the cache. +> When you actively work with the Space over several days or weeks, files can accumulate in the storage cache. When you get a warning that the persistent storage is full and you think that the storage quota should not be reached yet, it might be helpful to factory reset the Space to empty the cache. ### Customizing your JupyterLab Space -Remember that your JupyterLab Space is just a pre-configured Docker container, so if you are familiar with Docker, you can also customize it to your needs. For example, you can go to the `Files` section of your Space and add new requirements to the `requirements.txt` file or you can change from the default container image to another image in the `Dockerfile` e.g. if you need a specific CUDA and PyTorch version preinstalled. +Remember that your JupyterLab Space is just a pre-configured Docker container, so if you are familiar with Docker, you can also customize it to your needs. For example, you can go to the `Files` section of your Space and add new requirements to the `requirements.txt` file or you can change from the default container image to another image in the `Dockerfile`, e.g. if you need a specific CUDA and PyTorch version preinstalled. @@ -64,11 +70,11 @@ Remember that your JupyterLab Space is just a pre-configured Docker container, s -## 2. Dev Mode, or: Develop on 4 GPUs from your local VS Code +## Dev Mode: Develop on HF Spaces from your local VS Code -What if you don't like working in JupyterLab in the browser? Enter `Dev Mode`. `Dev Mode` enables you to SSH into any Space's hardware from their local IDE like VS Code. [HF Pro/Enterprise](https://huggingface.co/pricing) subscribers can activate `Dev Mode` for any Space in the Space's settings. +What if you don't like working in JupyterLab in the browser? Enter `Dev Mode`. `Dev Mode` enables you to SSH into any Space's hardware from a local IDE like VS Code. [HF Pro/Enterprise](https://huggingface.co/pricing) subscribers can activate `Dev Mode` for any Space in the Space's settings. -Once `Dev Mode` is activated, you will see a pop-up at the bottom left of your JupyterLab Space's window. To SSH into your local VS Code, you first need to install the [VS Code Remote - SSH extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) locally and add your SSH key to your [HF Profile](https://huggingface.co/settings/keys). Clicking on `Connect with VS Code` should then open your local VS Code window and establish the remote connection to your space. A similar process should be possible with any IDE that supports remote development with SSH. +Once `Dev Mode` is activated, you will see a pop-up at the bottom left of your JupyterLab Space's window. To SSH into your local VS Code, you first need to install the [VS Code Remote - SSH extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) locally and add your SSH key to your [HF Profile](https://huggingface.co/settings/keys). Clicking on `Connect with VS Code` should then open your local VS Code window and establish the remote connection to your Space. A similar process should be possible with any IDE that supports remote development with SSH. @@ -77,9 +83,6 @@ When connecting to your Space with SSH, your default directory will be an empty > [!TIP] > Persisted files in the `/data` directory are currently not automatically backed up. We therefore recommend making backups of your most important files on a regular basis to avoid accidental data loss. -> [!TIP] -> To make sure that your work is secure, we recommend setting JupyterLab Spaces to private, use a strong password, and if you work in a larger organization enable it only for specific [Resource Groups](https://huggingface.co/docs/hub/en/security-resource-groups). - ## Now write some code! From 10e59428500508d8fce15952330753f812160f6a Mon Sep 17 00:00:00 2001 From: moritzlaurer Date: Fri, 7 Jun 2024 10:27:57 +0200 Subject: [PATCH 4/6] removed hyperlink attempt in titles of overview.md --- notebooks/en/enterprise_cookbook_overview.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/en/enterprise_cookbook_overview.md b/notebooks/en/enterprise_cookbook_overview.md index d0258d6c..3a1b6e8e 100644 --- a/notebooks/en/enterprise_cookbook_overview.md +++ b/notebooks/en/enterprise_cookbook_overview.md @@ -5,7 +5,7 @@ The Enterprise Hub Cookbook is designed for power users and enterprises who want -## [Interactive Development in HF Spaces](enterprise_cookbook_dev_spaces.md) +## Interactive Development in HF Spaces With JupyterLab Spaces you can spin up your personal Jupyter Notebook like in Google Colab, only with a wider selection of more reliable CPUs and GPUs (e.g. H100 or 4xA10G) that you can select and switch on the fly. Moreover, by activating Spaces Dev Mode you can also use this cloud hardware from your local IDE (e.g. VS Code). Read this recipe to learn how to spin up a GPU and connect to it via your local IDE. For more details, read also the [JupyterLab Spaces](https://huggingface.co/docs/hub/spaces-sdks-docker-jupyter) and the [Dev Mode](https://huggingface.co/dev-mode-explorers) documentation. @@ -24,7 +24,7 @@ With our dedicated Inference Endpoints, you can easily deploy any model on a wid For more details, read also the [dedicated Endpoint](https://huggingface.co/docs/inference-endpoints/index) documentation. -## [Data Annotation with Argilla Spaces](enterprise_cookbook_argilla) +## Data Annotation with Argilla Spaces Whether you're zero-shot testing an LLM or training your own model, creating good test or train data is maybe the highest-value investment you can make at the beginning of your machine learning journey. Argilla is a free, open-source data annotation tool that enables you to create high-quality data for text, image, or audio tasks. Read this recipe to learn how to create a data annotation workflow (alone or in a larger team) in your browser. From 20d64e18066be40d2bf33efa9ac2f40111ed9962 Mon Sep 17 00:00:00 2001 From: moritzlaurer Date: Fri, 7 Jun 2024 10:32:34 +0200 Subject: [PATCH 5/6] centered images --- .../en/enterprise_cookbook_dev_spaces.md | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/notebooks/en/enterprise_cookbook_dev_spaces.md b/notebooks/en/enterprise_cookbook_dev_spaces.md index 518bf0fb..eece8107 100644 --- a/notebooks/en/enterprise_cookbook_dev_spaces.md +++ b/notebooks/en/enterprise_cookbook_dev_spaces.md @@ -22,7 +22,9 @@ To create your own HF JupyterLab Space, navigate to the [Space creation page](ht - **Choosing the correct owner**: If you are using the JupyterLab Space as part of your work for an Enterprise Hub Organization, select the organization's name under the `Owner` dropdown (e.g. the dummy "enterprise-explorers" in the image below). Any compute costs will then be billed on the account of this Enterprise Organization. - **Access control**: If you want only selected members of your team to access the JupyterLab Space, you can click on `Everyone` right next to `Access Control` and limit access to the JupyterLab Space to a predefined Resource Group. Resource Groups are an Enterprise Hub feature that enables you to limit access to selected repositories (models, datasets, Spaces) to a smaller group of team members. See the [docs](https://huggingface.co/docs/hub/en/security-resource-groups) on how to create your first Resource Group. - +
+ +
- **Choosing your hardware**: You can choose from a wide range of hardware from free CPUs to A100 GPUs. When setting up the Space, we recommend you choose the free basic CPU. You can switch to better paid hardware once you need it (see available hardware and prices [here](https://huggingface.co/pricing)). - **Persistent storage**: It is important to attach persistent storage to the Space, so that all the files you create (code, models, data) are also saved when the Space is paused or reset. You can always increase the disk space in the settings later when necessary. All persistent data is stored in the `/data` directory ([docs](https://huggingface.co/docs/hub/en/spaces-storage)). @@ -30,19 +32,24 @@ To create your own HF JupyterLab Space, navigate to the [Space creation page](ht - **Dev Mode**: Dev Mode is a feature for Enterprise Hub subscribers that enables you to SSH into any HF Space. Activate this to connect your local VS Code for remote development on the Space's cloud hardware (this can also be switched on/off later). See the preview docs [here](https://huggingface.co/dev-mode-explorers). - **Private Spaces**: As an additional layer of security, we recommend setting the Space to private, so that only members of your Enterprise Organization (and of specific Resource Groups) can see it. - - +
+ +
Once you have configured the JupyterLab Space, you can click on `Create Space`. The Space will be built and after a few seconds you will see the JupyterLab login screen. You can now login with the password you defined before. - +
+ +
### Using your JupyterLab Space You can now work in your own JupyterLab Space in the browser! You can create your own directory structure with .ipynb notebooks or any other files and datasets in the File Browser on the left. If you have activated persistent storage, all files are permanently stored in the default `/data` directory of the Space. - +
+ +
### Dynamically switching between CPUs and GPUs @@ -51,7 +58,9 @@ Similar to services like Google Colab, you can change the hardware the Space is In the bottom left of the image, you can also see the `Sleep time settings` where you can define how long you want the hardware to run in case of inactivity. This is a major advantage over Google Colab. if you want to save money, you can make the Space sleep after 15 minutes of inactivity, but if you need the hardware to be available for a 48 hour training run or longer, you can just prevent the Space from falling asleep and let it run for as long as you want. You can also manually `Pause` the Space and you will no longer be charged for the Space Hardware. - +
+ +
If you scroll down in the settings, you will see additional options, like expanding storage, resetting the Space, etc. In case you have not set a password during Space creation, you can also create a secret called `JUPYTER_TOKEN` here later, which will replace the default "huggingface" password. @@ -63,9 +72,9 @@ If you scroll down in the settings, you will see additional options, like expand Remember that your JupyterLab Space is just a pre-configured Docker container, so if you are familiar with Docker, you can also customize it to your needs. For example, you can go to the `Files` section of your Space and add new requirements to the `requirements.txt` file or you can change from the default container image to another image in the `Dockerfile`, e.g. if you need a specific CUDA and PyTorch version preinstalled. - - - +
+ +
@@ -76,7 +85,10 @@ What if you don't like working in JupyterLab in the browser? Enter `Dev Mode`. ` Once `Dev Mode` is activated, you will see a pop-up at the bottom left of your JupyterLab Space's window. To SSH into your local VS Code, you first need to install the [VS Code Remote - SSH extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh) locally and add your SSH key to your [HF Profile](https://huggingface.co/settings/keys). Clicking on `Connect with VS Code` should then open your local VS Code window and establish the remote connection to your Space. A similar process should be possible with any IDE that supports remote development with SSH. - +
+ +
+ When connecting to your Space with SSH, your default directory will be an empty `/app` directory. You then need to change to the `/data` directory, where all your persistent files (code, data, models etc.) are stored. The `/data` directory is the only directory with guaranteed file persistance across sessions. You can find the files of your Docker container in the `HOME/user/app` directory, in case you want to modify the underlying Docker container. From 453b810e5304834d1b0253cde94f6d310deed207 Mon Sep 17 00:00:00 2001 From: moritzlaurer Date: Fri, 7 Jun 2024 10:41:08 +0200 Subject: [PATCH 6/6] typo fixes --- notebooks/en/enterprise_cookbook_dev_spaces.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/notebooks/en/enterprise_cookbook_dev_spaces.md b/notebooks/en/enterprise_cookbook_dev_spaces.md index eece8107..865a2638 100644 --- a/notebooks/en/enterprise_cookbook_dev_spaces.md +++ b/notebooks/en/enterprise_cookbook_dev_spaces.md @@ -11,7 +11,7 @@ HF JupyterLab Spaces overcome these limitations. With a HF JupyterLab Space, you - Dynamically switch between CPUs and a wide range of GPUs that never stop unless you want them to. - Connect to cloud compute resources with your preferred local IDE like VS Code via SSH for full remote development. -This recipe guides you though the setup of your own JupyterLab Space. +This recipe guides you through the setup of your own JupyterLab Space. ## Interactive Development in HF JupyterLab Spaces @@ -56,7 +56,7 @@ You can now work in your own JupyterLab Space in the browser! You can create you Similar to services like Google Colab, you can change the hardware the Space is running on-the-fly. We recommend doing initial setup work on the upgraded or free CPU, for example data cleaning, setting up Endpoints, or testing APIs. Once your code is set up, you can simply click on `Settings` at the top right of the Space and change to a wide selection of hardware that might be required for more compute intensive inference or training jobs. When you change hardware, the Space will restart itself and all environment variables will be lost (like with Google Colab) and you will have a new clean environment on the new hardware after some seconds. Your stored and saved files (code, data etc.) will of course also be available on the new hardware. The image below shows the available hardware at the time of writing (June 2024) and this will be updated in the future. -In the bottom left of the image, you can also see the `Sleep time settings` where you can define how long you want the hardware to run in case of inactivity. This is a major advantage over Google Colab. if you want to save money, you can make the Space sleep after 15 minutes of inactivity, but if you need the hardware to be available for a 48 hour training run or longer, you can just prevent the Space from falling asleep and let it run for as long as you want. You can also manually `Pause` the Space and you will no longer be charged for the Space Hardware. +In the bottom left of the image, you can also see the `Sleep time settings` where you can define how long you want the hardware to run in case of inactivity. This is a major advantage over Google Colab. If you want to save money, you can make the Space sleep after 15 minutes of inactivity, but if you need the hardware to be available for a 48 hour training run or longer, you can just prevent the Space from falling asleep and let it run for as long as you want. You can also manually `Pause` the Space and you will no longer be charged for the Space Hardware.