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.post210118-cp311-cp311-win_amd64.whl (97.7 kB view details)

Uploaded CPython 3.11 Windows x86-64

cudacanvas-1.0.1.post210118-cp310-cp310-win_amd64.whl (96.3 kB view details)

Uploaded CPython 3.10 Windows x86-64

cudacanvas-1.0.1.post210118-cp39-cp39-win_amd64.whl (98.3 kB view details)

Uploaded CPython 3.9 Windows x86-64

cudacanvas-1.0.1.post210118-cp38-cp38-win_amd64.whl (98.8 kB view details)

Uploaded CPython 3.8 Windows x86-64

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210118-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 c02c645f3a1471750b82a825a10db6be98cd7f64a3bcdb9aeb9ca86514387f04
MD5 2f2d926da729768e83ffdb2108799da1
BLAKE2b-256 0f4ecaab4186e8d349a11b8c0e376e22055a64a62bc7a9d04f5aa6f4851ff8eb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210118-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2e29744f7344007968a0f9a7aba58aa84d738e00e8d1ebd9359ca3f909d37211
MD5 79fb4317d2eb37938ef0c5de78ed8cb7
BLAKE2b-256 dbcda5f7a16b1fe14336f2bf86d17a5340f1df58e9ea5c4859c85d11ad09e537

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210118-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 aa4126ac9d78218c980af775aa8c58eadf3ea3f1cfde7bbae7d61df034624b39
MD5 f49a2a747ac8bf840cb013f6ae9a1028
BLAKE2b-256 c9f9c58088a62d210f159a27f444da23c696d51b3009b3e199bd2b3ba58dd7a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210118-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 feff6509900f3d294dc9bb307371dd92f06e7775edfb24cc2d041ff8da111f5f
MD5 3364642f565b6177e56936b4a77bfefd
BLAKE2b-256 27163f5467a6d554abbeb02a9f21b62be8f86fd055551133989ce6713a26727c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210118-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 10c1d7e20f9eed8e86d4c9a3ec0cfaf6c0531569b09e8ad1f0490c01723d5425
MD5 6f6ee2f69acd71a001fcec4247f2c337
BLAKE2b-256 370eda864abed4983b0f40083952e462adacc25c5cdee02547f884e5a503e890

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210118-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0917807ce9d21ec5cbf55739915cb191667f67657107bce6a6d087ad09e9d75c
MD5 551a73cafd92b4aac576bfae99e0725b
BLAKE2b-256 1c68b898186316f934f0a048bd613e11d831b559ae426c23fbaeb945ca8580cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210118-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 233a72fdf266a53ed1f6ae8872abd9fa9d15963d237c43f7af488fb24649dc5e
MD5 d68d9cb01d849dc94155004a8245cc5f
BLAKE2b-256 ffb20f37e7d6816011bdd4311e34d075adcdebb569e18ca1c58280bc630c439c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210118-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 79de19907cea2e95e0c481ca1f3ddf4ea8c403cab6bfb4cdee014a8d7a5acbc5
MD5 82874e49376dc3cc3d9eaac0098bb66c
BLAKE2b-256 fef90cceaeb1f8d129c863bb22cbd304cb3a54af596e325e4536e239a6900f9b

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