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.2.2 or 2.1.2) and (11.8 or 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+cu181 the Cudacanvas package you require is 1.0.1.post212181

pip install cudacanvas==1.0.1.post212181

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212121-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 efd0a7089f3ba584b2795c15c2b6b18947e47704b7a066951fa08b02500b50e4
MD5 53b3b5cfb7a92fd9d3077459a62bd906
BLAKE2b-256 d083bcd993cf6c15e71a146d299fa9a6258d7dd29dd7fdc6918e78c98bdbd1f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212121-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6a9b63f37d94480addf0a1ddc1baa5936ff546d4b95949e60ec9bd842bca80c9
MD5 2262064e151158142d7cb0540d29b1b9
BLAKE2b-256 79dbb7f2b42b25c26e4fcb5ec810094c6482b0815ff02e54257863c3ebab5a56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212121-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 60fdb90fad57e0635cc2c6c1d6cbd00279c7b3b68b1ed57667897e9e5029b3c4
MD5 95ded5d5a97c37f0ccdfd90740e9d1c4
BLAKE2b-256 16f854e90d10454c65de89ffefcf006bc933204d00f0a3c19b0146957b0dfe3e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212121-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 843ae1ba7a6b62c94016051476a1fc387344a760bd0e7a0811f99346be644b71
MD5 eaf616c68ceb7e09e3719f9b7428e444
BLAKE2b-256 5f37eb4a9308e74290e4329534cca21c0a263527f8f05be2d094cae7b42b2442

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212121-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f0e4f2c235dc34860d427b33f253ec3bbda426e27f0633de76f2470d5ef3b1f2
MD5 ca8baff952764a73d0981922f8f34b70
BLAKE2b-256 d792c2c9dcc601eddb6fc842b79ce5139eb442ae18b0144aa09a6abe450f0f36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212121-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 82a756903074bf9b0a968f85b73a7cc35f0520f1496bcf0370e8d9f9dd22fae8
MD5 360cde24c3335085c2fd54b9af7fd77b
BLAKE2b-256 e372a96a0ab2ddd1341ddae4f21876da5951d5bc04491568668e612ee36830ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212121-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 812dd0ee588d5c7e85e47c915d4f2f1b40e82451ccda27b4d34aabc62268f4bf
MD5 b331361c2c768f46d15164b0915ff01c
BLAKE2b-256 f295a99165e9c5281a6380d69d2e8e3f989fe6397cdf2215ba84054615806c5a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212121-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e41f87d5e3565dc3be157263cbedcba84fe627ad575420e9ea28561cddec8c1d
MD5 a08cf17ad716cd0ae3d05623c7bf7cbf
BLAKE2b-256 52f327f0a5d88ec684cc5ff392fbfedd352348bad56d6ac82ae718ba7953c69f

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