modelstudio 0.4.0__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {modelstudio-0.4.0/python/modelstudio.egg-info → modelstudio-0.5.0}/PKG-INFO +79 -103
- {modelstudio-0.4.0 → modelstudio-0.5.0}/README.md +78 -102
- modelstudio-0.5.0/benchmarks/bench_elementwise.py +44 -0
- modelstudio-0.5.0/benchmarks/bench_trace.py +47 -0
- modelstudio-0.5.0/docs/backend-status.md +21 -0
- modelstudio-0.5.0/docs/comparison-ops.md +23 -0
- modelstudio-0.5.0/docs/functional-api.md +22 -0
- modelstudio-0.5.0/docs/linalg.md +23 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/native-backend-roadmap.md +12 -1
- modelstudio-0.5.0/docs/random.md +26 -0
- modelstudio-0.5.0/docs/serialization.md +34 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/tensor-api.md +1 -1
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/tensor-creation.md +1 -2
- modelstudio-0.5.0/docs/tracing.md +21 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/training.md +1 -1
- modelstudio-0.5.0/examples/backend_status.py +16 -0
- modelstudio-0.5.0/examples/functional_training.py +35 -0
- modelstudio-0.5.0/examples/random_linalg_demo.py +20 -0
- modelstudio-0.5.0/examples/tracing_demo.py +20 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/pyproject.toml +1 -1
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/__init__.py +21 -14
- modelstudio-0.5.0/python/modelstudio/_version.py +1 -0
- modelstudio-0.5.0/python/modelstudio/backends/__init__.py +4 -0
- modelstudio-0.5.0/python/modelstudio/backends/status.py +62 -0
- modelstudio-0.5.0/python/modelstudio/compile/graph_capture.py +83 -0
- modelstudio-0.5.0/python/modelstudio/compile/ir.py +62 -0
- modelstudio-0.5.0/python/modelstudio/linalg.py +32 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/__init__.py +2 -1
- modelstudio-0.5.0/python/modelstudio/nn/functional.py +162 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/module.py +6 -1
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/ops/__init__.py +6 -0
- modelstudio-0.5.0/python/modelstudio/ops/comparison.py +77 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/ops/linalg.py +5 -1
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/ops/math.py +10 -2
- modelstudio-0.5.0/python/modelstudio/random.py +120 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/serialization.py +40 -12
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/tensor.py +51 -1
- {modelstudio-0.4.0 → modelstudio-0.5.0/python/modelstudio.egg-info}/PKG-INFO +79 -103
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio.egg-info/SOURCES.txt +28 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/scripts/smoke_test.py +18 -0
- modelstudio-0.5.0/tests/test_backend_status.py +39 -0
- modelstudio-0.5.0/tests/test_clone_copy.py +42 -0
- modelstudio-0.5.0/tests/test_comparison_ops.py +55 -0
- modelstudio-0.5.0/tests/test_functional.py +113 -0
- modelstudio-0.5.0/tests/test_linalg.py +36 -0
- modelstudio-0.5.0/tests/test_native_cpu_mode.py +35 -0
- modelstudio-0.5.0/tests/test_public_exports.py +27 -0
- modelstudio-0.5.0/tests/test_random_namespace.py +45 -0
- modelstudio-0.5.0/tests/test_scalar_behavior.py +41 -0
- modelstudio-0.5.0/tests/test_serialization_hardening.py +77 -0
- modelstudio-0.5.0/tests/test_trace.py +60 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_version.py +1 -1
- modelstudio-0.4.0/docs/serialization.md +0 -25
- modelstudio-0.4.0/python/modelstudio/_version.py +0 -1
- modelstudio-0.4.0/python/modelstudio/compile/graph_capture.py +0 -12
- modelstudio-0.4.0/python/modelstudio/compile/ir.py +0 -37
- modelstudio-0.4.0/python/modelstudio/random.py +0 -20
- {modelstudio-0.4.0 → modelstudio-0.5.0}/CMakeLists.txt +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/LICENSE +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/MANIFEST.in +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/benchmarks/bench_attention.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/benchmarks/bench_conv.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/benchmarks/bench_creation.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/benchmarks/bench_dataloader.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/benchmarks/bench_dropout.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/benchmarks/bench_manipulation.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/benchmarks/bench_matmul.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/benchmarks/bench_mlp.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/CMakeLists.txt +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/cpu/cpu_backend.cpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/cpu/cpu_backend.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/cpu/kernels/add.cpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/cpu/kernels/matmul.cpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/cpu/kernels/mul.cpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/cpu/kernels/relu.cpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/cuda/README.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/cuda/cuda_backend.cu +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/cuda/cuda_backend.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/cuda/cuda_memory.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/oneapi/README.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/oneapi/oneapi_backend.cpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/oneapi/oneapi_backend.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/oneapi/sycl_memory.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/rocm/README.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/rocm/hip_memory.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/rocm/rocm_backend.cpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/backends/rocm/rocm_backend.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/bindings/python_bindings.cpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/core/device.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/core/dtype.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/core/error.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/core/shape.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/core/storage.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/core/tensor.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/dispatcher/backend.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/dispatcher/dispatcher.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/csrc/dispatcher/operator_registry.hpp +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/autograd.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/backend-architecture.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/checkpointing.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/data.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/metrics.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/modules.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/nn.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/numpy-interop.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/optimizers.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/randomness.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/releasing.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/docs/tensor-manipulation.md +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/checkpoint_resume.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/checkpoint_training.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/dropout_batchnorm.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/metrics_demo.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/numpy_interop.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/save_load.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/scheduler_training.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/tiny_transformer.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/train_classifier.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/train_cnn_toy.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/examples/train_mlp.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/autograd/__init__.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/autograd/engine.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/autograd/function.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/autograd/grad_mode.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/compile/__init__.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/compile/passes.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/data/__init__.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/data/dataloader.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/data/dataset.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/device.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/dtypes.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/errors.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/interop.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/metrics/__init__.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/metrics/classification.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/activations.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/convolution.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/embedding.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/init.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/linear.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/losses.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/normalization.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/parameter.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/pooling.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/transformer.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/nn/utils.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/ops/creation.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/ops/movement.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/ops/reductions.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/optim/__init__.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/optim/adamw.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/optim/lr_scheduler.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/optim/optimizer.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/optim/sgd.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/py.typed +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/runtime/__init__.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/runtime/backend.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/runtime/dispatcher.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/storage.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/testing/__init__.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio/testing/gradcheck.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio.egg-info/dependency_links.txt +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio.egg-info/requires.txt +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/python/modelstudio.egg-info/top_level.txt +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/setup.cfg +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_activations_more.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_attention.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_autograd.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_batchnorm.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_buffers.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_checkpoint_helpers.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_concat_stack.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_conv.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_creation_more.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_data.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_data_split.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_dataloader_seed.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_dispatcher.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_dropout.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_dtype_conversion.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_embedding.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_grad_clip.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_gradcheck.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_indexing.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_indexing_assignment.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_init.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_loss_reductions.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_losses.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_lr_scheduler.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_manipulation_ops.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_metrics.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_module_ergonomics.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_nn.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_norms.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_numpy_interop.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_ops.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_optim.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_optimizer_param_groups.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_optimizer_state.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_pooling.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_random.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_reductions_axis.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_serialization.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_shape_ops.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_state_dict.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_tensor.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_transformer.py +0 -0
- {modelstudio-0.4.0 → modelstudio-0.5.0}/tests/test_unary_ops.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: modelstudio
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: An early-stage AI tensor framework with CPU tensors, autograd, and backend extension scaffolding.
|
|
5
5
|
Author: ModelStudio Contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -31,9 +31,10 @@ Dynamic: license-file
|
|
|
31
31
|
|
|
32
32
|
# ModelStudio
|
|
33
33
|
|
|
34
|
-
ModelStudio is an early-stage AI tensor framework. Version `0.
|
|
34
|
+
ModelStudio is an early-stage AI tensor framework. Version `0.5.0` provides a
|
|
35
35
|
CPU tensor/autograd MVP with neural-network modules, optimizers, serialization,
|
|
36
|
-
|
|
36
|
+
data loading, graph tracing metadata, backend status inspection, and small
|
|
37
|
+
LLM-oriented building blocks.
|
|
37
38
|
|
|
38
39
|
It is not a PyTorch or TensorFlow replacement. CPU is the only working backend.
|
|
39
40
|
CUDA, ROCm, and oneAPI remain explicit scaffolds until real kernels are built
|
|
@@ -59,28 +60,45 @@ python -m pip install -e ".[dev]"
|
|
|
59
60
|
| --- | --- |
|
|
60
61
|
| CPU tensors | Working MVP |
|
|
61
62
|
| Autograd | Reverse-mode for core CPU ops |
|
|
62
|
-
| Reductions | `sum`, `mean`, `max`
|
|
63
|
+
| Reductions | `sum`, `mean`, `max`, `all`, and `any`; `max` is value-only |
|
|
64
|
+
| Comparisons | Elementwise comparisons, `equal`, `isclose`, and `allclose` |
|
|
63
65
|
| Activations | ReLU, GELU, LeakyReLU, ELU, Softplus, exp, log, tanh, sigmoid, SiLU, softmax, log-softmax |
|
|
64
66
|
| Losses | MSE and cross entropy with `none`, `mean`, and `sum` reductions |
|
|
67
|
+
| Functional API | `modelstudio.nn.functional` wrappers for common NN operations |
|
|
65
68
|
| Modules | Parameters, buffers, child traversal, state dicts, save/load |
|
|
66
69
|
| Layers | Linear, Embedding, LayerNorm, RMSNorm, BatchNorm1d, Dropout, Conv1d, Conv2d, pooling, TransformerBlock |
|
|
67
70
|
| Optimizers | SGD and AdamW with state serialization, parameter groups, and LR schedulers |
|
|
68
71
|
| Data | Dataset, TensorDataset, random_split, DataLoader with deterministic seeded shuffle |
|
|
69
|
-
| Randomness | `manual_seed`, RNG-backed
|
|
72
|
+
| Randomness | `manual_seed`, `ms.random`, RNG-backed creation, dropout, and init helpers |
|
|
73
|
+
| Linalg | `ms.linalg.matmul`, `norm`, `vector_norm`, and `transpose` |
|
|
70
74
|
| Interop | `asarray`, `from_numpy`, `to_numpy`, and `ms.numpy` |
|
|
71
75
|
| Metrics | accuracy and top-k accuracy |
|
|
72
|
-
| Compiler |
|
|
76
|
+
| Compiler | Metadata-only tracing plus placeholder IR and passes |
|
|
73
77
|
|
|
74
78
|
## Backend Status
|
|
75
79
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
| CPU | working MVP |
|
|
79
|
-
| CUDA | scaffold only |
|
|
80
|
-
| ROCm | scaffold only |
|
|
81
|
-
| oneAPI | scaffold only |
|
|
80
|
+
```python
|
|
81
|
+
import modelstudio as ms
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
print(ms.backends.status())
|
|
84
|
+
print(ms.backends.native_cpu_available())
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Expected shape:
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
{
|
|
91
|
+
"cpu": {"available": True, "native": False},
|
|
92
|
+
"cuda": {"available": False, "reason": "..."},
|
|
93
|
+
"rocm": {"available": False, "reason": "..."},
|
|
94
|
+
"oneapi": {"available": False, "reason": "..."},
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The production CPU path is the NumPy backend. `ms.backends.use_native_cpu(True)`
|
|
99
|
+
raises `ModelStudioBackendUnavailable` unless a future optional native extension
|
|
100
|
+
is actually installed. Unsupported accelerator devices fail with
|
|
101
|
+
`ModelStudioBackendUnavailable`.
|
|
84
102
|
|
|
85
103
|
## Tensor Example
|
|
86
104
|
|
|
@@ -94,121 +112,68 @@ loss.backward()
|
|
|
94
112
|
print(w.grad)
|
|
95
113
|
```
|
|
96
114
|
|
|
97
|
-
##
|
|
115
|
+
## Functional API
|
|
98
116
|
|
|
99
117
|
```python
|
|
100
118
|
import modelstudio as ms
|
|
101
119
|
from modelstudio import nn
|
|
120
|
+
from modelstudio.nn import functional as F
|
|
102
121
|
|
|
103
|
-
|
|
104
|
-
class MLP(nn.Module):
|
|
105
|
-
def __init__(self):
|
|
106
|
-
super().__init__()
|
|
107
|
-
self.fc1 = nn.Linear(784, 256)
|
|
108
|
-
self.fc2 = nn.Linear(256, 10)
|
|
109
|
-
|
|
110
|
-
def forward(self, x):
|
|
111
|
-
return self.fc2(ms.gelu(self.fc1(x)))
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
model = MLP()
|
|
115
|
-
optimizer = ms.optim.AdamW(model.parameters(), lr=3e-4)
|
|
116
|
-
x = ms.randn((16, 784))
|
|
117
|
-
target = ms.randn((16, 10))
|
|
118
|
-
loss = ms.mse_loss(model(x), target)
|
|
119
|
-
optimizer.zero_grad()
|
|
120
|
-
loss.backward()
|
|
121
|
-
optimizer.step()
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## State Dict and Save/Load
|
|
125
|
-
|
|
126
|
-
```python
|
|
127
122
|
model = nn.Linear(4, 2)
|
|
128
|
-
ms.
|
|
129
|
-
|
|
130
|
-
model.
|
|
123
|
+
x = ms.random.randn((8, 4))
|
|
124
|
+
target = ms.random.randn((8, 2))
|
|
125
|
+
loss = F.mse_loss(F.relu(F.linear(x, model.weight, model.bias)), target)
|
|
131
126
|
```
|
|
132
127
|
|
|
133
|
-
##
|
|
128
|
+
## Tracing
|
|
134
129
|
|
|
135
130
|
```python
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
dataset = data.TensorDataset(ms.randn((8, 4)), ms.arange(8))
|
|
139
|
-
loader = data.DataLoader(dataset, batch_size=2, shuffle=False)
|
|
140
|
-
for xb, yb in loader:
|
|
141
|
-
print(xb.shape, yb.shape)
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Embedding
|
|
145
|
-
|
|
146
|
-
```python
|
|
147
|
-
emb = nn.Embedding(num_embeddings=100, embedding_dim=32)
|
|
148
|
-
tokens = ms.tensor([[1, 2, 3]], dtype=ms.int64)
|
|
149
|
-
print(emb(tokens).shape)
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Cross Entropy
|
|
131
|
+
import modelstudio as ms
|
|
132
|
+
from modelstudio.nn import functional as F
|
|
153
133
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
loss.backward()
|
|
134
|
+
x = ms.random.randn((4, 3))
|
|
135
|
+
w = ms.random.randn((3, 2))
|
|
136
|
+
graph = ms.trace(lambda a, b: F.relu(a @ b), x, w)
|
|
137
|
+
print(graph)
|
|
159
138
|
```
|
|
160
139
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
block = nn.TransformerBlock(embed_dim=16, num_heads=4)
|
|
165
|
-
x = ms.randn((2, 8, 16), requires_grad=True)
|
|
166
|
-
y = block(x)
|
|
167
|
-
print(y.shape)
|
|
168
|
-
```
|
|
140
|
+
Tracing captures operation names and tensor metadata. It does not optimize or
|
|
141
|
+
execute graphs yet. `ms.compile(fn)` remains a documented no-op that returns the
|
|
142
|
+
original callable.
|
|
169
143
|
|
|
170
|
-
##
|
|
144
|
+
## Random And Linalg
|
|
171
145
|
|
|
172
146
|
```python
|
|
173
|
-
ms.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
ms.
|
|
147
|
+
ms.random.seed(123)
|
|
148
|
+
x = ms.random.normal((4, 3), mean=0.0, std=1.0)
|
|
149
|
+
w = ms.random.uniform((3, 2), low=-0.1, high=0.1)
|
|
150
|
+
y = ms.linalg.matmul(x, w)
|
|
151
|
+
print(ms.linalg.norm(y).item())
|
|
178
152
|
```
|
|
179
153
|
|
|
180
|
-
|
|
181
|
-
`Tensor.squeeze`, `Tensor.unsqueeze`, `nn.init`, `nn.Dropout`,
|
|
182
|
-
`nn.BatchNorm1d`, `nn.Conv1d`, `nn.Conv2d`, `nn.AvgPool2d`, `nn.MaxPool2d`,
|
|
183
|
-
and `nn.utils` gradient clipping.
|
|
184
|
-
|
|
185
|
-
## NumPy Interop
|
|
154
|
+
## Comparisons
|
|
186
155
|
|
|
187
156
|
```python
|
|
188
|
-
x = ms.
|
|
189
|
-
|
|
190
|
-
y =
|
|
157
|
+
x = ms.tensor([1.0, 2.0, 3.0])
|
|
158
|
+
y = ms.tensor([1.0, 2.1, 3.0])
|
|
159
|
+
print(ms.isclose(x, y, atol=0.05))
|
|
160
|
+
print(ms.allclose(x, y, atol=0.05))
|
|
161
|
+
print((x > 1.5).any().item())
|
|
191
162
|
```
|
|
192
163
|
|
|
193
|
-
|
|
194
|
-
is exposed for advanced users who explicitly want NumPy access.
|
|
164
|
+
Comparison and logical outputs are bool tensors and do not track gradients.
|
|
195
165
|
|
|
196
|
-
##
|
|
166
|
+
## Checkpointing
|
|
197
167
|
|
|
198
168
|
```python
|
|
169
|
+
model = nn.Linear(4, 2)
|
|
199
170
|
optimizer = ms.optim.AdamW(model.parameters(), lr=1e-3)
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
acc = ms.metrics.accuracy(logits, targets)
|
|
171
|
+
ms.save_checkpoint("checkpoint.ms", model=model, optimizer=optimizer, extra={"epoch": 1})
|
|
172
|
+
checkpoint = ms.load_checkpoint("checkpoint.ms", model=model, optimizer=optimizer, map_location="cpu")
|
|
204
173
|
```
|
|
205
174
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
```python
|
|
209
|
-
ms.save_checkpoint("checkpoint.ms", model=model, optimizer=optimizer, scheduler=scheduler, extra={"epoch": 1})
|
|
210
|
-
checkpoint = ms.load_checkpoint("checkpoint.ms", model=model, optimizer=optimizer, scheduler=scheduler)
|
|
211
|
-
```
|
|
175
|
+
Checkpoint loading validates structure and model state. CPU is the only accepted
|
|
176
|
+
`map_location` in the current release.
|
|
212
177
|
|
|
213
178
|
## Commands
|
|
214
179
|
|
|
@@ -226,6 +191,10 @@ python examples/numpy_interop.py
|
|
|
226
191
|
python examples/scheduler_training.py
|
|
227
192
|
python examples/checkpoint_resume.py
|
|
228
193
|
python examples/metrics_demo.py
|
|
194
|
+
python examples/backend_status.py
|
|
195
|
+
python examples/tracing_demo.py
|
|
196
|
+
python examples/functional_training.py
|
|
197
|
+
python examples/random_linalg_demo.py
|
|
229
198
|
python benchmarks/bench_matmul.py
|
|
230
199
|
python benchmarks/bench_mlp.py
|
|
231
200
|
python benchmarks/bench_attention.py
|
|
@@ -234,17 +203,24 @@ python benchmarks/bench_conv.py
|
|
|
234
203
|
python benchmarks/bench_dropout.py
|
|
235
204
|
python benchmarks/bench_creation.py
|
|
236
205
|
python benchmarks/bench_manipulation.py
|
|
206
|
+
python benchmarks/bench_elementwise.py
|
|
207
|
+
python benchmarks/bench_trace.py
|
|
237
208
|
```
|
|
238
209
|
|
|
239
210
|
## Documentation
|
|
240
211
|
|
|
212
|
+
- [Backend status](docs/backend-status.md)
|
|
213
|
+
- [Tracing](docs/tracing.md)
|
|
214
|
+
- [Functional API](docs/functional-api.md)
|
|
215
|
+
- [Random namespace](docs/random.md)
|
|
216
|
+
- [Linalg namespace](docs/linalg.md)
|
|
217
|
+
- [Comparison ops](docs/comparison-ops.md)
|
|
241
218
|
- [Tensor API](docs/tensor-api.md)
|
|
242
219
|
- [Neural network API](docs/nn.md)
|
|
243
220
|
- [Data utilities](docs/data.md)
|
|
244
221
|
- [Training](docs/training.md)
|
|
245
222
|
- [Modules](docs/modules.md)
|
|
246
223
|
- [Serialization](docs/serialization.md)
|
|
247
|
-
- [Randomness](docs/randomness.md)
|
|
248
224
|
- [Native backend roadmap](docs/native-backend-roadmap.md)
|
|
249
225
|
- [NumPy interop](docs/numpy-interop.md)
|
|
250
226
|
- [Tensor creation](docs/tensor-creation.md)
|
|
@@ -260,6 +236,6 @@ python benchmarks/bench_manipulation.py
|
|
|
260
236
|
## Roadmap
|
|
261
237
|
|
|
262
238
|
- Expand tensor and autograd coverage.
|
|
263
|
-
- Wire native CPU kernels
|
|
239
|
+
- Wire optional native CPU kernels only after a safe Python extension exists.
|
|
264
240
|
- Add tested CUDA, ROCm, and oneAPI packages when hardware-backed CI exists.
|
|
265
|
-
- Improve compiler graph capture and lowering.
|
|
241
|
+
- Improve compiler graph capture, analysis passes, and lowering.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# ModelStudio
|
|
2
2
|
|
|
3
|
-
ModelStudio is an early-stage AI tensor framework. Version `0.
|
|
3
|
+
ModelStudio is an early-stage AI tensor framework. Version `0.5.0` provides a
|
|
4
4
|
CPU tensor/autograd MVP with neural-network modules, optimizers, serialization,
|
|
5
|
-
|
|
5
|
+
data loading, graph tracing metadata, backend status inspection, and small
|
|
6
|
+
LLM-oriented building blocks.
|
|
6
7
|
|
|
7
8
|
It is not a PyTorch or TensorFlow replacement. CPU is the only working backend.
|
|
8
9
|
CUDA, ROCm, and oneAPI remain explicit scaffolds until real kernels are built
|
|
@@ -28,28 +29,45 @@ python -m pip install -e ".[dev]"
|
|
|
28
29
|
| --- | --- |
|
|
29
30
|
| CPU tensors | Working MVP |
|
|
30
31
|
| Autograd | Reverse-mode for core CPU ops |
|
|
31
|
-
| Reductions | `sum`, `mean`, `max`
|
|
32
|
+
| Reductions | `sum`, `mean`, `max`, `all`, and `any`; `max` is value-only |
|
|
33
|
+
| Comparisons | Elementwise comparisons, `equal`, `isclose`, and `allclose` |
|
|
32
34
|
| Activations | ReLU, GELU, LeakyReLU, ELU, Softplus, exp, log, tanh, sigmoid, SiLU, softmax, log-softmax |
|
|
33
35
|
| Losses | MSE and cross entropy with `none`, `mean`, and `sum` reductions |
|
|
36
|
+
| Functional API | `modelstudio.nn.functional` wrappers for common NN operations |
|
|
34
37
|
| Modules | Parameters, buffers, child traversal, state dicts, save/load |
|
|
35
38
|
| Layers | Linear, Embedding, LayerNorm, RMSNorm, BatchNorm1d, Dropout, Conv1d, Conv2d, pooling, TransformerBlock |
|
|
36
39
|
| Optimizers | SGD and AdamW with state serialization, parameter groups, and LR schedulers |
|
|
37
40
|
| Data | Dataset, TensorDataset, random_split, DataLoader with deterministic seeded shuffle |
|
|
38
|
-
| Randomness | `manual_seed`, RNG-backed
|
|
41
|
+
| Randomness | `manual_seed`, `ms.random`, RNG-backed creation, dropout, and init helpers |
|
|
42
|
+
| Linalg | `ms.linalg.matmul`, `norm`, `vector_norm`, and `transpose` |
|
|
39
43
|
| Interop | `asarray`, `from_numpy`, `to_numpy`, and `ms.numpy` |
|
|
40
44
|
| Metrics | accuracy and top-k accuracy |
|
|
41
|
-
| Compiler |
|
|
45
|
+
| Compiler | Metadata-only tracing plus placeholder IR and passes |
|
|
42
46
|
|
|
43
47
|
## Backend Status
|
|
44
48
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
| CPU | working MVP |
|
|
48
|
-
| CUDA | scaffold only |
|
|
49
|
-
| ROCm | scaffold only |
|
|
50
|
-
| oneAPI | scaffold only |
|
|
49
|
+
```python
|
|
50
|
+
import modelstudio as ms
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
print(ms.backends.status())
|
|
53
|
+
print(ms.backends.native_cpu_available())
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Expected shape:
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
{
|
|
60
|
+
"cpu": {"available": True, "native": False},
|
|
61
|
+
"cuda": {"available": False, "reason": "..."},
|
|
62
|
+
"rocm": {"available": False, "reason": "..."},
|
|
63
|
+
"oneapi": {"available": False, "reason": "..."},
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The production CPU path is the NumPy backend. `ms.backends.use_native_cpu(True)`
|
|
68
|
+
raises `ModelStudioBackendUnavailable` unless a future optional native extension
|
|
69
|
+
is actually installed. Unsupported accelerator devices fail with
|
|
70
|
+
`ModelStudioBackendUnavailable`.
|
|
53
71
|
|
|
54
72
|
## Tensor Example
|
|
55
73
|
|
|
@@ -63,121 +81,68 @@ loss.backward()
|
|
|
63
81
|
print(w.grad)
|
|
64
82
|
```
|
|
65
83
|
|
|
66
|
-
##
|
|
84
|
+
## Functional API
|
|
67
85
|
|
|
68
86
|
```python
|
|
69
87
|
import modelstudio as ms
|
|
70
88
|
from modelstudio import nn
|
|
89
|
+
from modelstudio.nn import functional as F
|
|
71
90
|
|
|
72
|
-
|
|
73
|
-
class MLP(nn.Module):
|
|
74
|
-
def __init__(self):
|
|
75
|
-
super().__init__()
|
|
76
|
-
self.fc1 = nn.Linear(784, 256)
|
|
77
|
-
self.fc2 = nn.Linear(256, 10)
|
|
78
|
-
|
|
79
|
-
def forward(self, x):
|
|
80
|
-
return self.fc2(ms.gelu(self.fc1(x)))
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
model = MLP()
|
|
84
|
-
optimizer = ms.optim.AdamW(model.parameters(), lr=3e-4)
|
|
85
|
-
x = ms.randn((16, 784))
|
|
86
|
-
target = ms.randn((16, 10))
|
|
87
|
-
loss = ms.mse_loss(model(x), target)
|
|
88
|
-
optimizer.zero_grad()
|
|
89
|
-
loss.backward()
|
|
90
|
-
optimizer.step()
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## State Dict and Save/Load
|
|
94
|
-
|
|
95
|
-
```python
|
|
96
91
|
model = nn.Linear(4, 2)
|
|
97
|
-
ms.
|
|
98
|
-
|
|
99
|
-
model.
|
|
92
|
+
x = ms.random.randn((8, 4))
|
|
93
|
+
target = ms.random.randn((8, 2))
|
|
94
|
+
loss = F.mse_loss(F.relu(F.linear(x, model.weight, model.bias)), target)
|
|
100
95
|
```
|
|
101
96
|
|
|
102
|
-
##
|
|
97
|
+
## Tracing
|
|
103
98
|
|
|
104
99
|
```python
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
dataset = data.TensorDataset(ms.randn((8, 4)), ms.arange(8))
|
|
108
|
-
loader = data.DataLoader(dataset, batch_size=2, shuffle=False)
|
|
109
|
-
for xb, yb in loader:
|
|
110
|
-
print(xb.shape, yb.shape)
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Embedding
|
|
114
|
-
|
|
115
|
-
```python
|
|
116
|
-
emb = nn.Embedding(num_embeddings=100, embedding_dim=32)
|
|
117
|
-
tokens = ms.tensor([[1, 2, 3]], dtype=ms.int64)
|
|
118
|
-
print(emb(tokens).shape)
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Cross Entropy
|
|
100
|
+
import modelstudio as ms
|
|
101
|
+
from modelstudio.nn import functional as F
|
|
122
102
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
loss.backward()
|
|
103
|
+
x = ms.random.randn((4, 3))
|
|
104
|
+
w = ms.random.randn((3, 2))
|
|
105
|
+
graph = ms.trace(lambda a, b: F.relu(a @ b), x, w)
|
|
106
|
+
print(graph)
|
|
128
107
|
```
|
|
129
108
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
block = nn.TransformerBlock(embed_dim=16, num_heads=4)
|
|
134
|
-
x = ms.randn((2, 8, 16), requires_grad=True)
|
|
135
|
-
y = block(x)
|
|
136
|
-
print(y.shape)
|
|
137
|
-
```
|
|
109
|
+
Tracing captures operation names and tensor metadata. It does not optimize or
|
|
110
|
+
execute graphs yet. `ms.compile(fn)` remains a documented no-op that returns the
|
|
111
|
+
original callable.
|
|
138
112
|
|
|
139
|
-
##
|
|
113
|
+
## Random And Linalg
|
|
140
114
|
|
|
141
115
|
```python
|
|
142
|
-
ms.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
ms.
|
|
116
|
+
ms.random.seed(123)
|
|
117
|
+
x = ms.random.normal((4, 3), mean=0.0, std=1.0)
|
|
118
|
+
w = ms.random.uniform((3, 2), low=-0.1, high=0.1)
|
|
119
|
+
y = ms.linalg.matmul(x, w)
|
|
120
|
+
print(ms.linalg.norm(y).item())
|
|
147
121
|
```
|
|
148
122
|
|
|
149
|
-
|
|
150
|
-
`Tensor.squeeze`, `Tensor.unsqueeze`, `nn.init`, `nn.Dropout`,
|
|
151
|
-
`nn.BatchNorm1d`, `nn.Conv1d`, `nn.Conv2d`, `nn.AvgPool2d`, `nn.MaxPool2d`,
|
|
152
|
-
and `nn.utils` gradient clipping.
|
|
153
|
-
|
|
154
|
-
## NumPy Interop
|
|
123
|
+
## Comparisons
|
|
155
124
|
|
|
156
125
|
```python
|
|
157
|
-
x = ms.
|
|
158
|
-
|
|
159
|
-
y =
|
|
126
|
+
x = ms.tensor([1.0, 2.0, 3.0])
|
|
127
|
+
y = ms.tensor([1.0, 2.1, 3.0])
|
|
128
|
+
print(ms.isclose(x, y, atol=0.05))
|
|
129
|
+
print(ms.allclose(x, y, atol=0.05))
|
|
130
|
+
print((x > 1.5).any().item())
|
|
160
131
|
```
|
|
161
132
|
|
|
162
|
-
|
|
163
|
-
is exposed for advanced users who explicitly want NumPy access.
|
|
133
|
+
Comparison and logical outputs are bool tensors and do not track gradients.
|
|
164
134
|
|
|
165
|
-
##
|
|
135
|
+
## Checkpointing
|
|
166
136
|
|
|
167
137
|
```python
|
|
138
|
+
model = nn.Linear(4, 2)
|
|
168
139
|
optimizer = ms.optim.AdamW(model.parameters(), lr=1e-3)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
acc = ms.metrics.accuracy(logits, targets)
|
|
140
|
+
ms.save_checkpoint("checkpoint.ms", model=model, optimizer=optimizer, extra={"epoch": 1})
|
|
141
|
+
checkpoint = ms.load_checkpoint("checkpoint.ms", model=model, optimizer=optimizer, map_location="cpu")
|
|
173
142
|
```
|
|
174
143
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
```python
|
|
178
|
-
ms.save_checkpoint("checkpoint.ms", model=model, optimizer=optimizer, scheduler=scheduler, extra={"epoch": 1})
|
|
179
|
-
checkpoint = ms.load_checkpoint("checkpoint.ms", model=model, optimizer=optimizer, scheduler=scheduler)
|
|
180
|
-
```
|
|
144
|
+
Checkpoint loading validates structure and model state. CPU is the only accepted
|
|
145
|
+
`map_location` in the current release.
|
|
181
146
|
|
|
182
147
|
## Commands
|
|
183
148
|
|
|
@@ -195,6 +160,10 @@ python examples/numpy_interop.py
|
|
|
195
160
|
python examples/scheduler_training.py
|
|
196
161
|
python examples/checkpoint_resume.py
|
|
197
162
|
python examples/metrics_demo.py
|
|
163
|
+
python examples/backend_status.py
|
|
164
|
+
python examples/tracing_demo.py
|
|
165
|
+
python examples/functional_training.py
|
|
166
|
+
python examples/random_linalg_demo.py
|
|
198
167
|
python benchmarks/bench_matmul.py
|
|
199
168
|
python benchmarks/bench_mlp.py
|
|
200
169
|
python benchmarks/bench_attention.py
|
|
@@ -203,17 +172,24 @@ python benchmarks/bench_conv.py
|
|
|
203
172
|
python benchmarks/bench_dropout.py
|
|
204
173
|
python benchmarks/bench_creation.py
|
|
205
174
|
python benchmarks/bench_manipulation.py
|
|
175
|
+
python benchmarks/bench_elementwise.py
|
|
176
|
+
python benchmarks/bench_trace.py
|
|
206
177
|
```
|
|
207
178
|
|
|
208
179
|
## Documentation
|
|
209
180
|
|
|
181
|
+
- [Backend status](docs/backend-status.md)
|
|
182
|
+
- [Tracing](docs/tracing.md)
|
|
183
|
+
- [Functional API](docs/functional-api.md)
|
|
184
|
+
- [Random namespace](docs/random.md)
|
|
185
|
+
- [Linalg namespace](docs/linalg.md)
|
|
186
|
+
- [Comparison ops](docs/comparison-ops.md)
|
|
210
187
|
- [Tensor API](docs/tensor-api.md)
|
|
211
188
|
- [Neural network API](docs/nn.md)
|
|
212
189
|
- [Data utilities](docs/data.md)
|
|
213
190
|
- [Training](docs/training.md)
|
|
214
191
|
- [Modules](docs/modules.md)
|
|
215
192
|
- [Serialization](docs/serialization.md)
|
|
216
|
-
- [Randomness](docs/randomness.md)
|
|
217
193
|
- [Native backend roadmap](docs/native-backend-roadmap.md)
|
|
218
194
|
- [NumPy interop](docs/numpy-interop.md)
|
|
219
195
|
- [Tensor creation](docs/tensor-creation.md)
|
|
@@ -229,6 +205,6 @@ python benchmarks/bench_manipulation.py
|
|
|
229
205
|
## Roadmap
|
|
230
206
|
|
|
231
207
|
- Expand tensor and autograd coverage.
|
|
232
|
-
- Wire native CPU kernels
|
|
208
|
+
- Wire optional native CPU kernels only after a safe Python extension exists.
|
|
233
209
|
- Add tested CUDA, ROCm, and oneAPI packages when hardware-backed CI exists.
|
|
234
|
-
- Improve compiler graph capture and lowering.
|
|
210
|
+
- Improve compiler graph capture, analysis passes, and lowering.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import platform
|
|
4
|
+
import time
|
|
5
|
+
|
|
6
|
+
import modelstudio as ms
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def _time_ms(fn, warmup: int, iterations: int) -> float:
|
|
10
|
+
for _ in range(warmup):
|
|
11
|
+
fn()
|
|
12
|
+
start = time.perf_counter()
|
|
13
|
+
for _ in range(iterations):
|
|
14
|
+
fn()
|
|
15
|
+
return (time.perf_counter() - start) * 1000.0 / iterations
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def main() -> None:
|
|
19
|
+
shape = (1024, 1024)
|
|
20
|
+
warmup = 5
|
|
21
|
+
iterations = 50
|
|
22
|
+
ms.random.seed(123)
|
|
23
|
+
x = ms.random.randn(shape)
|
|
24
|
+
y = ms.random.randn(shape)
|
|
25
|
+
|
|
26
|
+
add_ms = _time_ms(lambda: x + y, warmup, iterations)
|
|
27
|
+
relu_ms = _time_ms(lambda: ms.relu(x), warmup, iterations)
|
|
28
|
+
cmp_ms = _time_ms(lambda: x > y, warmup, iterations)
|
|
29
|
+
|
|
30
|
+
print(f"Python: {platform.python_version()}")
|
|
31
|
+
print(f"NumPy: {ms.numpy.__version__}")
|
|
32
|
+
print(f"ModelStudio: {ms.__version__}")
|
|
33
|
+
print(f"Shape: {shape}")
|
|
34
|
+
print(f"Warmup: {warmup}")
|
|
35
|
+
print(f"Iterations: {iterations}")
|
|
36
|
+
print(f"Backend: {ms.backends.status()}")
|
|
37
|
+
print(f"add avg: {add_ms:.3f} ms")
|
|
38
|
+
print(f"relu avg: {relu_ms:.3f} ms")
|
|
39
|
+
print(f"compare avg: {cmp_ms:.3f} ms")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
if __name__ == "__main__":
|
|
43
|
+
main()
|
|
44
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import platform
|
|
4
|
+
import time
|
|
5
|
+
|
|
6
|
+
import modelstudio as ms
|
|
7
|
+
from modelstudio.nn import functional as F
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _time_ms(fn, warmup: int, iterations: int) -> float:
|
|
11
|
+
for _ in range(warmup):
|
|
12
|
+
fn()
|
|
13
|
+
start = time.perf_counter()
|
|
14
|
+
for _ in range(iterations):
|
|
15
|
+
fn()
|
|
16
|
+
return (time.perf_counter() - start) * 1000.0 / iterations
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def main() -> None:
|
|
20
|
+
shape = (64, 128)
|
|
21
|
+
weight_shape = (128, 32)
|
|
22
|
+
warmup = 5
|
|
23
|
+
iterations = 100
|
|
24
|
+
x = ms.random.randn(shape)
|
|
25
|
+
w = ms.random.randn(weight_shape)
|
|
26
|
+
|
|
27
|
+
def forward(a: ms.Tensor, b: ms.Tensor) -> ms.Tensor:
|
|
28
|
+
return F.relu(a @ b)
|
|
29
|
+
|
|
30
|
+
trace_ms = _time_ms(lambda: ms.trace(forward, x, w), warmup, iterations)
|
|
31
|
+
graph = ms.trace(forward, x, w)
|
|
32
|
+
|
|
33
|
+
print(f"Python: {platform.python_version()}")
|
|
34
|
+
print(f"NumPy: {ms.numpy.__version__}")
|
|
35
|
+
print(f"ModelStudio: {ms.__version__}")
|
|
36
|
+
print(f"Input: {shape}")
|
|
37
|
+
print(f"Weight: {weight_shape}")
|
|
38
|
+
print(f"Warmup: {warmup}")
|
|
39
|
+
print(f"Iterations: {iterations}")
|
|
40
|
+
print(f"Backend: {ms.backends.status()}")
|
|
41
|
+
print(f"Trace avg: {trace_ms:.3f} ms")
|
|
42
|
+
print(f"Nodes: {[node.op for node in graph.nodes]}")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
if __name__ == "__main__":
|
|
46
|
+
main()
|
|
47
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Backend Status
|
|
2
|
+
|
|
3
|
+
ModelStudio 0.5.0 keeps CPU as the only available runtime backend.
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
import modelstudio as ms
|
|
7
|
+
|
|
8
|
+
status = ms.backends.status()
|
|
9
|
+
print(status["cpu"])
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`ms.backends.status()` returns a mapping for `cpu`, `cuda`, `rocm`, and
|
|
13
|
+
`oneapi`. CPU is always available through the NumPy backend. Accelerator
|
|
14
|
+
backends remain explicit unavailable scaffolds and include a human-readable
|
|
15
|
+
reason.
|
|
16
|
+
|
|
17
|
+
`ms.backends.native_cpu_available()` checks for the optional future native CPU
|
|
18
|
+
extension. `ms.backends.use_native_cpu(True)` raises
|
|
19
|
+
`ModelStudioBackendUnavailable` unless that extension is installed. The NumPy
|
|
20
|
+
CPU backend remains the production path.
|
|
21
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Comparison Ops
|
|
2
|
+
|
|
3
|
+
ModelStudio 0.5.0 adds elementwise tensor comparisons:
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
x = ms.tensor([1.0, 2.0, 3.0])
|
|
7
|
+
y = ms.tensor([1.0, 2.1, 3.0])
|
|
8
|
+
|
|
9
|
+
print(x == y)
|
|
10
|
+
print(x > 1.5)
|
|
11
|
+
print(ms.isclose(x, y, atol=0.05))
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Available helpers:
|
|
15
|
+
|
|
16
|
+
- `ms.equal(x, y)` for exact shape and value equality
|
|
17
|
+
- `ms.allclose(x, y, rtol=1e-5, atol=1e-8)`
|
|
18
|
+
- `ms.isclose(x, y, rtol=1e-5, atol=1e-8)`
|
|
19
|
+
- `x.all(axis=None, keepdims=False)` and `x.any(...)`
|
|
20
|
+
- `ms.all(x, axis=None, keepdims=False)` and `ms.any(...)`
|
|
21
|
+
|
|
22
|
+
Comparison and logical outputs are bool tensors and do not track gradients.
|
|
23
|
+
|