We use modal as a GPU provider, phosphobot can train and run inference on several robotics models by running the scripts in this folder through modal.
Login to modal and click on phospho/your_own_space in the webpage that opens in your browser.
cd modal
make installSince modal is cloud only, you might run into issues if multiple people want to work in the test environment.
Check the current environments available with:
uv run modal environment list
To avoid this, create your own modal environment that start with test-:
uv run modal environment create YOUR_ENV_NAME
Then, you can switch to your environment with:
uv run modal config set-environment PaliGemma
Create the nescessary volumes:
uv run modal volume create PaliGemma uv run modal volume create act uv run modal volume create gr00t-n1
Create the necessary secrets:
uv run modal secret create huggingface HF_TOKEN=YOUR_TOKEN uv run modal secret create supabase SUPABASE_KEY=YOUR_SUPABASE_KEY SUPABASE_SERVICE_ROLE_KEY=YOUR_SUPABASE_SERVICE_ROLE_KEY SUPABASE_URL=YOUR_SUPABASE_URL uv run modal secret create stripe STRIPE_API_KEY=YOUR_STRIPE_API_KEY STRIPE_WEBHOOK_SECRET=YOUR_STRIPE_WEBHOOK_SECRET
You can now deploy all apps to your environment:
make deploy_all
You are all set!
cd modal
make deploy_admincd modal
make deploy_gr00tadmin: FastAPI server used byphosphobotto spin up gpus and modelsfastapi_app: a fastapi app to expose endpoints
gr00t: gr00t-n1 model imagespawn: a modal function to launch the gr00t inference server and serve it over a tunneltrain: a modal function to train a gr00t model
act: ACT model imagetrain: a modal function to train an ACT model
paligemma: paligemma model imagewarmup_model: a modal function to load the modeldetect_object: a modal function to use the model
We have 2 environments we use in Modal:
test: the test environmentproduction: the production environment
Feel free to mess with the test env (deploy stuff,...). Apps and functions of the production env are deployed by the CI/CD.
Make sure you deploy from the right environment in the CLI. See the Modal docs for more details.
Trigger the function serve with the following command (replace PLB/GR00T-N1-lego-pickup-mono-2 with the model you want to use):
modal run gr00t/app.py::serve --model-id "PLB/GR00T-N1-lego-pickup-mono-2"To reduce cold start of the serve() function, we can save the model weights in a modal volume. TODO: add push to modal volume in Replicate pipeline.
The volume is called gr00t-n1.
The volume structure is the following:
models/
- hf_username/
- repo_name/
So if you have a huggingface model_id like hf_username/repo_name, you can add it to the modal volume with the following command:
modal volume put gr00t-n1 local/path/to/model models/hf_username/repo_name
So if you have the huggingface model_id, you can easily check if we have it in the volume.