Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Deploying a machine-learning model on Modal requires three pieces: a Python-defined image containing your framework and dependencies, a function assigned to an appropriate GPU, and a deployment command. Install the Modal SDK, authenticate with modal setup, define the image and GPU in a modal.App, load the model inside the remote GPU container, test with modal run, then publish a persistent service with modal deploy. For production HTTP inference, use a Modal Server or web-server function, and use Volumes when model artifacts should persist outside the container image.

What Modal changes about GPU model deployment

Modal is code-defined serverless infrastructure. Instead of manually provisioning a virtual machine, installing CUDA libraries, configuring a container registry and operating an autoscaling group, you describe the image, dependencies, GPU type and application functions in Python. Modal builds and runs that environment when the function is invoked.

The practical result is that the deployment unit is your Python application rather than a long-lived server. Modal manages the underlying containers and GPU capacity, and charges for active resource usage by the second. There is no separate infrastructure configuration file for the basic case: the container environment and GPU specification are declared in application code.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A GPU-backed function is suitable for batch jobs, experiments and simple remote calls. A persistent HTTP inference service needs a server or web-server function designed for request handling. Those services can use GPUs, mount Volumes and Secrets, and be clustered across multiple GPU nodes when one GPU is not enough for the model or traffic.

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.

Prerequisites, account setup and billing

Create an account and install the SDK

  1. Create a Modal account and add a valid payment method before requesting GPU resources. GPU execution requires billing to be enabled.
  2. Install the Python SDK in the environment from which you will deploy:
    pip install modal
  3. Authenticate the local CLI:
    modal setup

The setup command associates your local credentials with your Modal account. Keep those credentials out of source control. In CI, use the platform’s supported secret or token mechanism rather than committing a local credential file.

Understand what you pay for

Serverless billing is based on active CPU, memory and GPU time. A request that causes a cold container to start can consume more wall-clock time than a warm request, and model initialization is part of that active execution. Prices, GPU availability and regional capacity change, so check the current Modal pricing documentation before choosing a production configuration. The figures in this guide are not a price quote.

Build a minimal GPU model application

Declare the image and application

The official minimal pattern uses a Debian-based image and installs the Transformers framework with its PyTorch extra. The image declaration is evaluated when Modal builds the environment; the model itself should be initialized inside the GPU-backed function.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import modal

image = modal.Image.debian_slim().uv_pip_install('transformers[torch]')
app = modal.App('gpu-inference')

@app.function(gpu='h100', image=image)
def classify(text: str):
    from transformers import pipeline

    classifier = pipeline(
        'sentiment-analysis',
        model='distilbert-base-uncased-finetuned-sst-2-english',
        device_map='cuda',
    )
    return classifier(text)

This example illustrates the important boundaries. modal.Image.debian_slim() defines the base operating system, uv_pip_install('transformers[torch]') installs the Python dependencies, and @app.function(gpu='h100', image=image) assigns the execution unit an H100 GPU and the image that contains the framework. device_map='cuda' tells the Transformers pipeline to initialize on the GPU inside the remote container.

Use a model identifier and framework version that your application has tested. Larger models may require a different GPU, quantization, a custom runtime or multiple GPUs. The code above is a deployment pattern, not a guarantee that every model fits on an H100.

Keep GPU-dependent initialization remote

Do not load a CUDA-dependent model while the local CLI is importing the file. Imports that require a GPU should occur inside the function or in a lifecycle hook that Modal runs in the GPU container. This prevents local machines without CUDA from failing before the remote job is scheduled and makes the runtime’s device visible to the framework.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth

For a real service, avoid constructing a new pipeline for every request. Initialize once per warm container, then reuse it for subsequent calls. The exact lifecycle hook depends on the server primitive and framework you choose, but the principle is the same: separate one-time weight loading from per-request preprocessing and inference.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run, deploy and choose the right lifecycle

Use modal run while developing

Run the file directly through the Modal CLI:

modal run path/to/file.py

This is the quickest validation loop. It checks that the image can be built, dependencies can be imported, the selected GPU is available, weights can be downloaded or mounted, and the function returns the expected output. Start with a small input and log model-loading time, device placement and output shape.

A run is an invocation-oriented workflow. It is useful for experiments, one-off predictions and smoke tests, but it should not be treated as a permanent public endpoint. Containers can stop when the invocation completes, and the command is not a substitute for an HTTP service.

Use modal deploy for a persistent application

Publish the application with:

modal deploy your_file.py

Deployment registers the application and its functions so they can be invoked persistently according to the service configuration. Official Modal examples show deployment producing a URL and interactive Swagger documentation for HTTP routes. Treat the generated URL as an environment-specific endpoint: record it in your service configuration, protect it with the appropriate authentication, and do not paste secrets into source code.

Use separate Modal applications or deployment environments for development, staging and production. That keeps an experimental model revision from replacing the endpoint used by customers and makes rollback to a known image and model artifact possible.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Expose the model as an HTTP API

When to use a Modal Server

Use a Modal Server when the model process speaks HTTP and low-latency request handling is central. Servers are designed for HTTP traffic, support GPU-backed execution, can mount Volumes and Secrets, and can be clustered across multiple GPU nodes. Deploy them through the same modal deploy workflow as other Modal applications.

Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.

A server should define a stable request and response contract. For example, document the input text or tensor shape, maximum payload size, accepted content type, output schema, timeout behavior and error format. Validate requests before they reach the model so malformed payloads do not occupy a GPU.

Functions versus servers

Concern GPU function Modal Server or web-server function
Best fit Batch work, experiments and remote calls Persistent HTTP inference and interactive clients
Lifecycle Invoked for a job or command Deployed service with HTTP routing
Latency behavior Cold starts can dominate short jobs Designed to keep request handling and warm capacity predictable
Storage integration Can use the application’s configured resources Can mount Volumes and Secrets and can span multiple GPU nodes
Scaling decision Match parallel jobs and bursty workloads Match request concurrency, throughput and latency targets

Neither primitive is universally better. A server can keep capacity warm for interactive traffic, while a function can be more economical for infrequent batch inference because it does not require a continuously warm process. Measure cold-start impact and request volume rather than choosing from the name alone.

Package dependencies and model weights correctly

Put reproducible dependencies in the image

Declare every runtime dependency in the Modal image instead of relying on whatever happens to be installed on the deployment laptop. Pin framework versions when reproducibility matters, and include system packages required by tokenizers, image decoders or custom operators. Rebuild the image when dependencies change, then run a smoke test that imports the model stack before sending production traffic.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The minimal example installs transformers[torch]. A production image may also need a specific PyTorch build, tokenizer library, audio or vision codecs, an inference server and observability packages. Keep build-only tools out of the runtime layer where possible to reduce image size and cold-start time.

Choose how to store weights

There are two common patterns:

  • Image-baked weights: download weights during image construction. This makes startup independent of an external model download, but creates a large image and requires rebuilding for every weight revision.
  • Volume-backed weights: store artifacts on a Modal Volume and mount it when the function or server starts. This avoids repeating downloads across containers and allows model files to be updated independently of the base image.

Use a Volume when artifacts are large, shared by several replicas or updated more often than the software environment. Ensure the startup code verifies that the expected model revision exists and fails clearly if the mount is empty. Cache tokenizer files and compiled kernels in a location that survives for the lifetime of the container or Volume.

Use MLflow when the model is already packaged there

Modal’s MLflow plugin provides an integrated path for MLflow models. It can extract model artifacts and dependencies, upload the files to a Modal Volume, generate FastAPI endpoints, build the container, deploy it and return an HTTPS endpoint. The generated routes include /invocations and /predict_stream.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

This path is useful when the MLflow artifact is the source of truth for the model rather than a hand-written Transformers function. Review the generated image and endpoint contract before production use: confirm the Python and framework versions, input schema, authentication, request limits and the artifact revision mounted in the Volume.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Select a GPU based on the model and traffic

GPU selection is an engineering decision, not merely a setting to maximize. Compare the following dimensions:

Dimension Questions to answer Why it matters
Model memory fit Do weights, tokenizer state, runtime buffers and the model’s KV cache fit simultaneously? Out-of-memory failures occur before throughput can be evaluated.
Latency What are cold-start, model-load and warm-request times at the target input size? Interactive applications usually have a response-time objective, not only a throughput objective.
Throughput How many requests or output tokens per second are required? A GPU that is inexpensive per second may cost more per request if it processes traffic slowly.
Concurrency Will requests be serialized, dynamically batched or handled by several replicas? Concurrency changes memory pressure and queueing behavior.
Scaling Is demand bursty, continuously warm or too large for one device? Functions, servers and multi-GPU clusters have different operating trade-offs.
Cost What are the current per-second GPU, CPU and memory rates for the chosen configuration? Rates and availability are volatile and must be checked before deployment.

Modal notebook documentation describes configurations using up to eight A100s or H100s in a notebook kernel. That capability is not a promise that every region, account or server configuration has immediate capacity. Verify current availability and limits for your deployment.

As a reference point, a Modal Labs TensorRT-LLM example reports more than 25,000 output tokens per second on a single NVIDIA H100. That is a configuration-specific benchmark, not a universal performance guarantee. Your model architecture, quantization, sequence lengths, batching and server implementation can produce very different results.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Design for cold starts, warm traffic and scaling

Measure the complete request path

Record at least four timings separately:

  1. Container scheduling and image startup.
  2. Weight and tokenizer loading.
  3. Input preprocessing and queue time.
  4. GPU inference and response serialization.

Reporting only kernel execution hides the delays users experience. Test cold and warm requests, the smallest and largest expected inputs, and the concurrency levels your clients will generate. Include failure tests for timeouts, malformed payloads and out-of-memory conditions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Match the primitive to traffic shape

  • Infrequent batch jobs: use a GPU function and let containers scale from zero between jobs.
  • Interactive but moderate traffic: use a server with enough warm capacity to avoid repeated model initialization.
  • Spiky traffic: validate autoscaling behavior, queue limits and the maximum number of simultaneous GPU containers.
  • Large models or high throughput: evaluate multi-GPU clustering and whether the model runtime supports sharding across nodes.

Keep concurrency bounded by GPU memory. More simultaneous requests can increase throughput until batching or memory pressure causes queueing, swapping or failures. A lower concurrency limit with predictable latency is often preferable to an unbounded queue.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

Security and production safeguards

  • Store API keys, private model credentials and database passwords in Modal Secrets, not in the image or source file.
  • Restrict the HTTP endpoint to authenticated callers and validate content types, payload sizes and model-specific limits.
  • Log request identifiers, model revision, status, latency and error class, but do not log sensitive prompts or personal data by default.
  • Pin or record the image dependency set and model artifact revision so an incident can be reproduced.
  • Set explicit timeouts and return a controlled error when the GPU is unavailable, the model cannot load or the request exceeds limits.
  • Use a separate Volume or artifact revision for each production release when rollback matters.

Troubleshooting common deployment failures

Authentication or billing errors

Run modal setup again and confirm that the CLI is using the intended account. A GPU function also requires a valid payment method. If CPU-only code works but GPU scheduling fails, check billing status and current GPU availability before changing application code.

Import or dependency errors

Confirm that the missing package is installed in the declared image, not only in the local virtual environment. Rebuild after changing the image definition. If a native library is required, add its system package to the image and test the import inside a remote modal run invocation.

CUDA or device-placement errors

Verify that the function has a GPU assignment and that the framework is configured for CUDA. Keep model initialization inside the remote function. Check that the selected model runtime supports the GPU architecture and that the image contains compatible framework binaries.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Out-of-memory errors

Reduce batch size or sequence length, use a smaller or quantized model, or select a GPU with more memory. Account for weights, activations, tokenizer buffers and KV cache; a model that barely fits at load time may fail under concurrent requests.

Slow first requests

Separate image build time, container startup, artifact download and model initialization in logs. Move large, stable artifacts to a Volume, reduce unnecessary image layers and keep the model loaded for the lifetime of a warm server process. Do not claim low latency until cold-start and warm-request measurements meet your target.

The deployed endpoint does not match the local test

Compare the image dependency versions, environment variables, model revision and input serialization used by modal run and modal deploy. A local test may have used cached weights or a different tokenizer. Make the model revision explicit and add a deployment smoke test that calls the actual HTTP route.

An end-to-end deployment checklist

  1. Create the account, add a payment method and run modal setup.
  2. Define a modal.App and a reproducible modal.Image with the model framework and system dependencies.
  3. Choose a GPU after checking memory fit, latency, throughput, concurrency and current availability.
  4. Load the model inside the GPU-backed function or server process, not on the local machine.
  5. Decide whether weights belong in the image or a Modal Volume; record the exact artifact revision.
  6. Run modal run path/to/file.py with representative inputs and capture cold-start, load and inference timings.
  7. Choose a GPU function for jobs or a Modal Server/web-server function for persistent HTTP inference.
  8. Add Secrets, request validation, timeouts, authentication and structured logging before exposing the endpoint.
  9. Deploy with modal deploy your_file.py, verify the generated URL and exercise the documented HTTP route.
  10. Load-test at expected concurrency, monitor GPU memory and queueing, and recheck prices and availability before committing to a production capacity plan.

When Modal is the right deployment choice

Modal is a strong fit when you want Python-defined infrastructure, on-demand GPUs and platform-managed containers without operating your own GPU VM or Kubernetes cluster. It is especially convenient for teams that need to move from a notebook or script to a callable service while keeping the runtime definition beside the application code.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A self-managed VM or cluster can be preferable when you require fixed hardware reservations, specialized networking, long-lived state, extensive control over the host operating system or a cost model optimized for continuously saturated GPUs. Make that comparison using your measured utilization and operational requirements, not a generic serverless-versus-VM assumption.

The Bottom Line

Define the image, GPU and model function in Python; authenticate with modal setup; validate with modal run; and publish an HTTP-capable application with modal deploy. Use Volumes or the MLflow plugin for durable model artifacts, and select GPU capacity from measured memory, latency, throughput, concurrency and cost requirements.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.