Skip to main content

ModelStudio

ModelStudio is an early-stage AI tensor framework. Version 0.2.0 provides a CPU tensor/autograd MVP with neural-network modules, optimizers, serialization, basic data loading, and small LLM-oriented building blocks.

It is not a PyTorch or TensorFlow replacement. CPU is the only working backend. CUDA, ROCm, and oneAPI remain explicit scaffolds until real kernels are built and tested.

Installation

From PyPI:

python -m pip install modelstudio

For development:

python -m pip install -e ".[dev]"

Feature Table

Area Status
CPU tensors Working MVP
Autograd Reverse-mode for core CPU ops
Reductions sum, mean, max with axis and keepdims; max is value-only
Activations ReLU, GELU, exp, log, tanh, sigmoid, SiLU, softmax, log-softmax
Losses MSE and cross entropy
Modules Parameters, buffers, state dicts, save/load
Layers Linear, Embedding, LayerNorm, RMSNorm, TransformerBlock
Data Dataset, TensorDataset, DataLoader
Compiler Placeholder IR and passes

Backend Status

Backend Status
CPU working MVP
CUDA scaffold only
ROCm scaffold only
oneAPI scaffold only

Unsupported accelerator devices fail with ModelStudioBackendUnavailable.

Tensor Example

import modelstudio as ms

x = ms.randn((32, 784), requires_grad=True)
w = ms.randn((784, 10), requires_grad=True)
loss = (x @ w).mean()
loss.backward()
print(w.grad)

MLP Example

import modelstudio as ms
from modelstudio import nn


class MLP(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear(784, 256)
        self.fc2 = nn.Linear(256, 10)

    def forward(self, x):
        return self.fc2(ms.gelu(self.fc1(x)))


model = MLP()
optimizer = ms.optim.AdamW(model.parameters(), lr=3e-4)
x = ms.randn((16, 784))
target = ms.randn((16, 10))
loss = ms.mse_loss(model(x), target)
optimizer.zero_grad()
loss.backward()
optimizer.step()

State Dict and Save/Load

model = nn.Linear(4, 2)
ms.save(model.state_dict(), "model.ms")
state = ms.load("model.ms")
model.load_state_dict(state)

DataLoader

from modelstudio import data

dataset = data.TensorDataset(ms.randn((8, 4)), ms.arange(8))
loader = data.DataLoader(dataset, batch_size=2, shuffle=False)
for xb, yb in loader:
    print(xb.shape, yb.shape)

Embedding

emb = nn.Embedding(num_embeddings=100, embedding_dim=32)
tokens = ms.tensor([[1, 2, 3]], dtype=ms.int64)
print(emb(tokens).shape)

Cross Entropy

logits = ms.randn((4, 10), requires_grad=True)
targets = ms.tensor([1, 2, 3, 4], dtype=ms.int64)
loss = ms.cross_entropy(logits, targets)
loss.backward()

TransformerBlock

block = nn.TransformerBlock(embed_dim=16, num_heads=4)
x = ms.randn((2, 8, 16), requires_grad=True)
y = block(x)
print(y.shape)

Commands

python -m pytest
python scripts/smoke_test.py
python examples/train_mlp.py
python examples/train_classifier.py
python examples/tiny_transformer.py
python examples/save_load.py
python benchmarks/bench_matmul.py
python benchmarks/bench_mlp.py
python benchmarks/bench_attention.py
python benchmarks/bench_dataloader.py

Documentation

Roadmap

  • Expand tensor and autograd coverage.
  • Wire native CPU kernels into Python bindings.
  • Add tested CUDA, ROCm, and oneAPI packages when hardware-backed CI exists.
  • Improve compiler graph capture and lowering.

Release files for modelstudio 0.2.0

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

Source distribution (sdist)

Source distribution for modelstudio 0.2.0
File Size Uploaded
modelstudio-0.2.0.tar.gz 42.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for modelstudio 0.2.0
File Interpreter ABI Platform
modelstudio-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 75.3 kB

Release files / modelstudio-0.2.0.tar.gz

Download URL modelstudio-0.2.0.tar.gz
Size 42.2 kB
Tags Source
SHA-256 checksum
How to use checksums
77e914a97ea9821b3b66aa0019e7ce0fb4ee0419725f7dc7e9990a9aeb786e58
BLAKE2b-256 checksum
How to use checksums
8981dbe9c02534d3445101d3db355694270942a0a0c387f6e28c2360d3c814a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Release files / modelstudio-0.2.0-py3-none-any.whl

Download URL modelstudio-0.2.0-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
972290b56f665cca36a458d78b9c829a76b1225704a20b311c15b5c008ba19ee
BLAKE2b-256 checksum
How to use checksums
d3c3ba99b79a47f2f03281a443cba91daa2908630864a4837c2738a28f442744
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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