Model Export & Serving

Exports BrainAI models to TorchScript/ONNX and deploys them via APIs or containers.

Updated Feb 28, 2026
One-click install
npx skills add https://github.com/sovr610/refffiy --skill model-export-serving
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Model Export & Serving
Source: https://github.com/sovr610/refffiy/tree/main/brain-ai-dev/skills/model-export-serving
Command: npx skills add https://github.com/sovr610/refffiy --skill model-export-serving

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, onnx, onnxruntime, pytest, and includes scripts (resource) and assets (resource) components.

What problem does it solve?

BrainAI models often require efficient export and robust serving to move from research to production. This skill provides end-to-end guidance for exporting models to TorchScript or ONNX, quantizing for deployment, and deploying a scalable API server.

Core Features & Use Cases

  • ONNX and TorchScript export workflows for cross-platform deployment
  • Dynamic and static quantization strategies with validation and testing
  • Serving architecture using APIs (e.g., FastAPI) and containerized pipelines
  • Real-world deployment scenarios: from research prototyping to production-grade inference

Quick Start

Install dependencies, export a BrainAI model with TorchScript or ONNX, quantize for deployment, and deploy a FastAPI endpoint to serve predictions.

Frequently Asked Questions about Model Export & Serving

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I export a model to ONNX or TorchScript for production inference?

Export models to ONNX or TorchScript by tracing the architecture and validating the resulting graph. This skill provides workflows to ensure the exported model is production-ready and numerically equivalent to the original.

What's the best way to serve ONNX or TorchScript models via an API?

Serve ONNX or TorchScript models using a FastAPI application deployed within containers. This approach provides a scalable API server capable of handling inference requests across CPU and GPU environments.

How do I apply quantization to a model before deployment?

Apply dynamic or static quantization to reduce model size and increase inference speed. This skill includes validation and testing steps to verify numerical equivalence after applying quantization strategies.

Does this export pipeline validate numerical equivalence after converting to ONNX?

Yes, the export pipeline validates ONNX and TorchScript graphs and tests numerical equivalence. This ensures the exported and quantized models maintain reliable inference outputs before production deployment.

Can I deploy TorchScript or ONNX models on both CPU and GPU environments?

Yes, the serving architecture supports deployment across both CPU and GPU environments. Containerized pipelines and FastAPI endpoints allow flexible execution regardless of the underlying hardware.

What dependencies do I need to run model export and serving workflows?

You need PyTorch, ONNX, ONNX Runtime, and Pytest installed. These dependencies support the export, quantization, numerical validation, and serving infrastructure required for the deployment pipeline.