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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

cudacanvas-1.0.1.post211118-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.post211118-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211118-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 524f6a01c9b72dbf34c380844fe708619e397af017535ab7e6b0e49cdfc691d4
MD5 9698ca7312ad063273f31cef6c8d9e96
BLAKE2b-256 855cf27cb40070fe20e9c7e2eeb4d8d8581fdcc80d9f51d92fa4c6c382a6941b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211118-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c444b27bea875c9901e8948fa72a973b99fd0793156111a14dd4c96f4a466f96
MD5 5515aa0c93ec0974005a3117d9f748c0
BLAKE2b-256 a73dd0f73abc23ec99173a02cbf34d6c24add1b24199b079bb812fdaa5c68015

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211118-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a08bc14f3237ffdfc8a248f50a6d0be665f3f28fa6c1cb1b123fd5de0465f345
MD5 cc0a66e6c3b541deed1aa2291bf49746
BLAKE2b-256 a4aa3f223a79e020de2c9c140cd49b6ec094ff10da03098f4d335e6514f2b6c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211118-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 379e9547b635d6c7ab826757abd8ee2fb7d75dc3a9f52850f68f008f45de72d2
MD5 0c3482659074f7f4bd2dc16d398b6885
BLAKE2b-256 2438ac377c653176c552f19c2b921809c3dc3ccf3997f32b3d5a20303623ffc5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211118-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 444459530f5fa9ee4d8cdc20e1872da7d72570ade65e906e55bf1125d54bad74
MD5 9654ac511d485eb6cf3745be06ee4c40
BLAKE2b-256 3fc2c3ec695064ad1b9ff74cdc154cbeeaa40115f41f9104d437da6145b93218

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211118-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 199c736628789075e3a41e00bac08fe128ec3a12b899b34dc4690adb5169bcf2
MD5 fd0b243dbfb197d34a21755b21019df3
BLAKE2b-256 54929fa0c0816834fac3713d595a47f9af4479cd79a4871b2fcb403106c58371

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211118-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 71388130b1f5194f8aa3ce3ffbc5ec45536969a1a0d2779dede9161018500ef5
MD5 c627dfcdd6fd5c387bb303e9e5a3b240
BLAKE2b-256 3bf6db8f140b97155ce55171ad863cc80ad9b3587c2a155561d106cf72a8b8c8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211118-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6b5c19e2f675cde45288958cf66d5987c01d1b2285c53a2e615c6db4090ad33a
MD5 4264e2f93cac9c974cabf93bae12fb7a
BLAKE2b-256 826a28fa282f31aa5a3020394a6cdfd69e6000b4f5407e888157ee6542e0ffa5

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