Skip to main content

solveit-modal

SolveIt doesn’t come with GPU access. But the platform is too good to ignore. This library allows you to give SolveIt free GPU access, with the free monthly US$30 credits Modal provides

Contributions are greatly appreciated to make this library even better.

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 !modal setup to authenticate your Modal account to SolveIt.

You will also need a SSH_PUBKEY enivronment variable. Run !ssh-keygen -f ~/.ssh/id_ed25519 -y to check if you already have one available. If you don’t, run !ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N '' -q to generate one. Run !ssh-keygen -f ~/.ssh/id_ed25519 -y once more to copy your newly generated public key and save it as an environment variable in SolveIt 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-19 06:55:13,138
INFO - ✔ sandbox ready | 2026-06-19 06:55:13,677
INFO - ✔ gotten tunnel: r449.modal.host:34889 | 2026-06-19 06:55:28,772
INFO - ✔ public key injected | 2026-06-19 06:55:29,744
INFO - ✔ started ssh service | 2026-06-19 06:55:31,831
INFO - ∞ starting kernel | 2026-06-19 06:55:33,421

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-19 06:55:38,413

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-19 06:55:40,457
WARNING - ! remote kernel environment has a different set of libraries installed | 2026-06-19 06:55:40,458

Success: connected to remote kernel via r449.modal.host:34889

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'

Of course, since the goal is run code in the GPU enabled environment, we can skip ssh and directly take advantage of IPython with the %remote line magic or %%remote cell magic!

#%%remote <-- cell magic (remove # when actually using)
!hostname
modal
#%%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, and when manually turning the GPU off. 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 copies all secrets on SolveIt to the Modal Sandbox by default. If you don’t want to, set gpu_on(..., secrets={}).

?get_secrets
def get_secrets(
    
)->dict:
Secrets from solveit_settings.json.

File: ~/库/solveit-modal/solveit_modal/core.py

Type: function

You can also explore GPUs on Modal with solveit_modal. These rates are valid as of 22 May, 2026.

from solveit_modal.gpu import *
gpu = GPU(); gpu
T4 · $0.59/hr · 16GB
L4 · $0.80/hr · 24GB
A10 · $1.10/hr · 24GB
L40S · $1.95/hr · 48GB
A100-40GB · $2.10/hr · 40GB
A100-80GB · $2.50/hr · 80GB
RTX-PRO-6000 · $3.03/hr · 96GB
H100 · $3.95/hr · 80GB
H200 · $4.54/hr · 141GB
B200 · $6.25/hr · 180GB
gpu.by_vram(min_gb=36)
L40S · $1.95/hr · 48GB
A100-40GB · $2.10/hr · 40GB
A100-80GB · $2.50/hr · 80GB
RTX-PRO-6000 · $3.03/hr · 96GB
H100 · $3.95/hr · 80GB
H200 · $4.54/hr · 141GB
B200 · $6.25/hr · 180GB
gpu.cheapest()
T4 · $0.59/hr · 16GB

Note that these are only 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 SolveIt and other machines.

This library also uses the Modal API.

Metadata

Release files for solveit-modal 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solveit-modal 0.1.1
File Size Uploaded Provenance Actions
solveit_modal-0.1.1.tar.gz 19.3 kB Without provenance Details for solveit_modal-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for solveit-modal 0.1.1
File Interpreter ABI Platform Actions
solveit_modal-0.1.1-py3-none-any.whl Python 3 none any Details for solveit_modal-0.1.1-py3-none-any.whl

Total release size: 37.5 kB

Release files / solveit_modal-0.1.1.tar.gz

Download URL solveit_modal-0.1.1.tar.gz
Size 19.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3f0c0f1e5e2c92b121fb3a3dbec354a3bdb2497934a671cc2324e548269dcdb1
BLAKE2b-256 checksum
How to use checksums
f333e647850e842c73db4abdcc0304376d68a847484bc5b72ce06ecdf1347820
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / solveit_modal-0.1.1-py3-none-any.whl

Download URL solveit_modal-0.1.1-py3-none-any.whl
Size 18.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
10679b4ec4725fca62cf32c8f4db49231ed99e8189e4d4995b3d0f5c0ee17c62
BLAKE2b-256 checksum
How to use checksums
c1ed316759351097ed1d200e1d2a2ba47829876cd4cd3bef59fb050aa556584e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for solveit-modal 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page