Skip to main content

Real-time PyTorch Tensor Visualisation in CUDA, Eliminating CPU Transfer

Project description

Buy Me A Coffee Twitter Twitter PyPI version Downloads

cudacanvas

CudaCanvas: Real-time PyTorch Tensor Image Visualisation in CUDA, Eliminating CPU Transfer

CudaCanvas is a simple Python module that eliminates CPU transfer for Pytorch tensors for displaying and rendering images in the training or evaluation phase, ideal for machine learning scientists and engineers.

Simplified version that directly displays the image without explicit window creation (cudacanvas >= v1.0.1)

import torch
import cudacanvas


#REPLACE THIS with you training loop
while (True):

    #REPLACE THIS with you training code and generation of data
    noise_image = torch.rand((4, 500, 500), device="cuda")

    #Visualise your data in real-time
    cudacanvas.im_show(noise_image)

    #OPTIONAL: Terminate training when the window is closed
    if cudacanvas.should_close():
        #end process if the window is closed
        break

And with explicit window creation

import torch
import cudacanvas

noise_image = torch.rand((4, 500, 500), device="cuda")

cudacanvas.set_image(noise_image)
cudacanvas.create_window()

#replace this with you training loop
while (True):

    cudacanvas.render()

    if cudacanvas.should_close():
        #end process if the window is closed
        break

Installation

Before instllation make sure you have torch with cuda support already installed on your machine

We aligned pytorch and cuda version with our package the supporting packages are torch (2.0.1, 2.1.2 and 2.2.2) and (11.8 and 12.1)

Identify your current torch and cuda version

import torch
torch.__version__

Depending on your torch and cuda you can install the relevant cudacanvas package, for the latest 2.2.2+cu121 you can simply download the latest package

pip install cudacanvas

For other torch and cuda packages put the torch and cuda version after that cudacanvas version for example for 2.1.2+cu118 the Cudacanvas package you require is 1.0.1.post212118

pip install cudacanvas==1.0.1.post212118 --force-reinstall

Support

Also support my channel ☕ ☕ : https://www.buymeacoffee.com/outofai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

cudacanvas-1.0.1.post221118-cp312-cp312-win_amd64.whl (97.1 kB view details)

Uploaded CPython 3.12 Windows x86-64

cudacanvas-1.0.1.post221118-cp311-cp311-win_amd64.whl (97.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

cudacanvas-1.0.1.post221118-cp310-cp310-win_amd64.whl (96.4 kB view details)

Uploaded CPython 3.10 Windows x86-64

cudacanvas-1.0.1.post221118-cp39-cp39-win_amd64.whl (98.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

cudacanvas-1.0.1.post221118-cp38-cp38-win_amd64.whl (98.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

File details

Details for the file cudacanvas-1.0.1.post221118-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post221118-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 8a9e82fecc4711435e793b4f0b73a8ef4af9cbf55e1fb468483b249fc257b84f
MD5 e5da26696d259bd448551f2173b028d9
BLAKE2b-256 6235a760e448539c8a0a70d27fe5dcc58fdfb84f05a72b71baecb712745fb71c

See more details on using hashes here.

File details

Details for the file cudacanvas-1.0.1.post221118-cp312-cp312-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post221118-cp312-cp312-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 18a7d9b02c7a003a632654ba4b405f15dbecb2d386eefae562c344952553a856
MD5 bdc04b8c70fdce0879a9f76880042737
BLAKE2b-256 be01eb099912638f172234cde7b18141e3e932e342ce4f14c15ffdf49ef2b0f6

See more details on using hashes here.

File details

Details for the file cudacanvas-1.0.1.post221118-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post221118-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 35456d511139b78a73536f6a9501d3ba517be6ed812384c3ea0adec1009f054a
MD5 d9d9e70d94483c21b28bb443f19c43f3
BLAKE2b-256 d883b4335bb49bd681177fa58e7b43dcce8b3d54eeb4b6a6bf1343889e346af9

See more details on using hashes here.

File details

Details for the file cudacanvas-1.0.1.post221118-cp311-cp311-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post221118-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ffbfba281437714a70fab15e1e6bde54c62eee5ec02433f4e2d02803d35315b
MD5 fe3975372642d7ecb3e618f6825d9c06
BLAKE2b-256 262a9ea9e8fe4e2e74eb94a3470847d216546256ed53bd7fab2f3f0bd7e78a29

See more details on using hashes here.

File details

Details for the file cudacanvas-1.0.1.post221118-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post221118-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 930fdd3dead56993db3c6d5995bdc7bc65c0d734b1ed90e34f06b812ba430fc9
MD5 f0aeeb70622a2c81f81f87e92533c9d7
BLAKE2b-256 f40fccebf358024bdd0b2a6ba183baad413e899771a4f38cda954d5ca49a71ca

See more details on using hashes here.

File details

Details for the file cudacanvas-1.0.1.post221118-cp310-cp310-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post221118-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d2a1e1b3149a344e4ff539266fc3a4ab90ec593d37b0b0430335d972ca02572b
MD5 bb58471143b7520f70622a71c86cd38a
BLAKE2b-256 80d56c9170ac8a027c5140e4a80f93123107fdbd6c9c196e7e7640fd764fb0f5

See more details on using hashes here.

File details

Details for the file cudacanvas-1.0.1.post221118-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post221118-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 392298ab35bb330ca7b2f3a44f14415765454803e5683b0006e39167be24a909
MD5 e81966976cb4197fa9933b3326dc416a
BLAKE2b-256 015439ce3e8dbbb9f6570a26b4aad9ffcad7fd602f506111b83a02fcbeae4506

See more details on using hashes here.

File details

Details for the file cudacanvas-1.0.1.post221118-cp39-cp39-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post221118-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 48812372c2f0d5f73a49d60f350cbb6fa393ce089e90083bc0d14d7c17298895
MD5 46cd7dfbfdb89e3e44a36cf130b7da8c
BLAKE2b-256 55a9ac7a1451cf6d34c53bfce4c30d7c3ffa354ac3fc7396a8c810a3c06b3521

See more details on using hashes here.

File details

Details for the file cudacanvas-1.0.1.post221118-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post221118-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 00fe3178e03afd569150d0d253163a373e26fc72e105d48c6fb71a89da9dbc53
MD5 65d2dc16f5293c30f806339a0c4e496f
BLAKE2b-256 14324859938e6e47b726bde828c87c78e24c69e149f9bd57a8f07e191ad8fcb4

See more details on using hashes here.

File details

Details for the file cudacanvas-1.0.1.post221118-cp38-cp38-manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post221118-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef4ed53e8a003a23c943cf78054fdb8da1d254af51921461349686a7d5b31545
MD5 92673aa200e71a29f970725a9ca50df3
BLAKE2b-256 75f022af9dd4b1de05abb2e42c508dd6561b2069e5d6bbfe2f5f3339854736b4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page