Give SolveIt Modal GPU access
Project description
solveit-modal
SolveIt doesn’t come with GPU access. But the platform is too good to ignore. This library allows you to use your monthly free US$30 Modal credits to give SolveIt access to a GPU for free.
Installation
Install latest from the GitHub repository:
$ pip install git+https://github.com/ForBo7/solveit-modal.git
or from pypi
$ pip install solveit_modal
Documentation
Documentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on pypi.
How to use
After installing, if you haven’t already, run python -m modal setup.
The process will probably require you to set up a SSH key pair. You can
use the same public key generated, for use with this library. Ensure the
public key is saved as an environment variable called SSH_PUBKEY.
Then, it should be as simple as ABC.
#| hide
from solveit_modal.core import *
sb, ssh = gpu_on()
INFO - ∞ creating sandbox; this may take 5-10 minutes if you are creating this sandbox for the first time... | 2026-06-17 07:03:06,256
INFO - ✔ sandbox ready | 2026-06-17 07:03:06,692
INFO - ✔ gotten tunnel: r446.modal.host:33257 | 2026-06-17 07:03:20,802
INFO - ✔ public key injected | 2026-06-17 07:03:21,048
INFO - ✔ started ssh service | 2026-06-17 07:03:21,566
INFO - ∞ starting kernel | 2026-06-17 07:03:23,210
System: Linux
Hostname: modal
User: root
Kernel: 4.4.0
Architecture: x86_64
OS Type: GNU/Linux
GPU: Tesla T4
INFO - ✔ remote kernel ready: /root/.local/share/jupyter/runtime/kernel-ipyf.json | 2026-06-17 07:03:26,614
ipyf_remote_kernel is already a registered kernel
/app/data/.ssh/config file updated.
Successfully created connection file and forwarded ports!
INFO - ✔ connected to remote kernel | 2026-06-17 07:03:28,537
WARNING - ! remote kernel environment has a different set of libraries installed | 2026-06-17 07:03:28,538
Success: connected to remote kernel via r446.modal.host:33257
You are provided with a Modal sandbox object, sb, and also an SSH
function, ssh, allowing you to directly interact with your Modal
sandbox with bash commands.
ssh('hostname')
'modal'
To run code in this GPU enabled environment, use the %remote line
magic or the %%remote cell magic.
#%%remote <-- cell magic (remove # when actually using)
!nvidia-smi
Wed Jun 17 07:03:35 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.95.05 Driver Version: 580.95.05 CUDA Version: 13.0 |
+-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 Tesla T4 On | 00000000:18:00.0 Off | 0 |
| N/A 28C P8 10W / 70W | 0MiB / 15360MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+
If you want to avoid having to use magics, do gpu_on(sticky=True). If
you have set sticky, you will have to use the %local line magic or
%%local cell magic to run code locally. However, setting sticky will
prevent SolveIt’s
dialoghelper tools from
working.
Note that the Python libraries preinstalled in this Modal sandbox are different from those preinstalled in SolveIt.
default_pips
['ipykernel',
'fastai',
'transformers',
'diffusers',
'accelerate',
'datasets',
'huggingface_hub',
'peft',
'safetensors',
'sentence-transformers',
'xformers',
'bitsandbytes',
'ninja',
'einops',
'wandb',
'gradio',
'python-fasthtml',
'plotly',
'ipywidgets',
'fsspec',
's3fs',
'gcsfs',
'librosa',
'imageio',
'imageio-ffmpeg']
fastai includes PyTorch, Numpy, Matplotib, Pandas, and SciPy, amongst amother libraries. See here for more info.
By default, the sandbox switches off after 30 minutes if there is no
activity. To turn off the sandbox manually, pass the sb object to
gpu_off.
gpu_off(sb)
INFO - ✔ unlinked from remote kernel | 2026-06-17 07:05:19,170
INFO - ✔ terminated sandbox | 2026-06-17 07:05:19,304
Code cells will now run locally.
Code cells will now run locally.
Shutting down remote kernel
Every sandbox is stored under an app on Modal. You will see on your Modal dashboard that the app created to run this sandbox will still be running. AFAIK, you will not be charged for the app being open.
gpu_on allows you to customize the following sandbox parameters out of
the box. By default, secrets in your SolveIt instance are also passed
along. If you don’t want to, set secrets={}.
?gpu_on
Signature:
gpu_on(
app_name: 'str' = 'solveit-modal',
pips: 'list' = ['ipykernel', 'fastai', 'transformers', 'diffusers', 'accelerate', 'datasets', 'huggingface_hub', 'peft', 'safetensors', 'sentence-transformers', 'xformers', 'bitsandbytes', 'ninja', 'einops', 'wandb', 'gradio', 'python-fasthtml', 'plotly', 'ipywidgets', 'fsspec', 's3fs', 'gcsfs', 'librosa', 'imageio', 'imageio-ffmpeg'],
apts: 'list' = ['openssh-server'],
vol_name: 'str' = 'solveit-volume',
timeout: 'int' = 1800,
gpu: 'str' = 'T4',
secrets: 'dict' = None,
sticky: 'bool' = False,
) -> 'tuple'
Docstring: Provision a GPU sandbox, wire up SSH, and hijack cells onto a remote kernel.
File: Dynamically generated function. No source code available.
Type: function
solveit_modal also lets you explore the GPUs available on Modal. These
rates are valid as of 22 May, 2026.
from solveit_modal.gpu import *
gpu = GPU(); gpu
gpu.by_vram(min_gb=36)
gpu.cheapest()
Note that these are only the GPU charges. Modal charges additionally for storage, RAM, and CPU. See Modal’s full pricing breakdown here.
Developer Guide
This library is built using nbdev, a way to create delightful software with Jupyter Notebooks. Learn how to get started with nbdev here.
Install solveit_modal in Development mode
# make sure solveit_modal package is installed in development mode
$ pip install -e .
# make changes under nbs/ directory
# ...
# compile to have changes apply to solveit_modal
$ nbdev_prepare
After cloning, run nbdev-install-hooks in your terminal to install
Jupyter and git hooks that clean, trust, and fix merge conflicts in
notebooks.
Anytime you make changes in the repo, run nbdev-prepare.
Credit
This library is built using nbdev on SolveIt, both by Answer.AI. If you are using SolveIt to explore this library, use the provided CONTROLLER dialog to get started.
Also thanks to Dr. Scott Hawley for his super easy to use ipyfernel library, which allows you straightfowardly swap IPython kernels between different machines.
This library also uses the Modal API.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file solveit_modal-0.0.2.tar.gz.
File metadata
- Download URL: solveit_modal-0.0.2.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e887a2e27f2b10ce2c0c4668a5bde16930d16379962c5e4e4dae8642a96eac6
|
|
| MD5 |
8cf5e7db684b6e25b66f21a8dbdc8ec7
|
|
| BLAKE2b-256 |
dc03d51d38164d6f58a07bc28a0d8a73022d74909710b7f54bf94299d7b19503
|
File details
Details for the file solveit_modal-0.0.2-py3-none-any.whl.
File metadata
- Download URL: solveit_modal-0.0.2-py3-none-any.whl
- Upload date:
- Size: 17.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecbdc798cb9b375c02d2cb52b6ed42f97138b83afbb8a6cec20301c18da7be71
|
|
| MD5 |
15c18c1e38023a70438521ac63be4059
|
|
| BLAKE2b-256 |
57394156a151bdf672df964116c186e33b3a19e812339aadba4d895ab00f0726
|