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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211121-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 43d027555664688c52c231c0b63fd44d19e432bfb7d4280f986bd3c8d1bd1af4
MD5 4d6c6422820780226e83a697b064e37b
BLAKE2b-256 c4c034b8c89f235e08699c34cf74cfb855f6bc0ff8848188854280e5381f11d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211121-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ff3ce76087420c487b4f5dacd9b690f13b1650430612f84e1aa0b977fc59ecd5
MD5 82cc1951ae3aab3998471ddfab8a5871
BLAKE2b-256 2d23597aa11d63094ad62b5f52809dbbd0d68c143cac0da140f361541db047b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211121-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a5b44362126479437463d26d93dee5c006aa54830cd211c787748d2f791b0819
MD5 4444bb2759f644b792a0873431a1abce
BLAKE2b-256 27507a514e0c6f625b8815c6e61fcf48eb2e144c914ffbb9771d8c92e8c0d2e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211121-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 49566534d318914fd36af201180dadaf81c77286abe1b925773fd0fe4c7b7f89
MD5 589c53f148aa3d68f5f7b20b762b45c3
BLAKE2b-256 d151487fa612b06ba837683baf085e8ee650f45ab14c599263b414a0cefc6e65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211121-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 107b3a467dfa0c0880d76aa55282b4b3bb6c361dd24a84696b8b3775683823e2
MD5 e6ff8ef2cadd54e6bf4cf1518869ad38
BLAKE2b-256 22f58374f15261f670432ea06d00f809aa7bd21889c2e9f2d79cc034ebb137d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211121-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd99c937371cf52344411ef8cb63950ae3cc1765b5a944bb2ce5491a8ed03792
MD5 80ee825e743e131069ef90e28fe817e2
BLAKE2b-256 a855379bec50926d9d2bcb828d82e30a12ebd116e645f4aaea2c518f3dcb30ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211121-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 bfa1fba8c7559fcc8cb3ec35e41a124cc4d43d38887b4ee209ad469b1e8caf6e
MD5 df3a3a488d61482efd7056880b9fbeb3
BLAKE2b-256 d0e3c857299b9954c61ed2c61ebf136826ecffeb9dd1b885be9891165583e9f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post211121-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c2c69beb77b5c7ed9412ea6b2c99140bceac0d65bc2366f37c9001bce2980207
MD5 2e5ed6f67af0a7a37696504288fd05a2
BLAKE2b-256 a39bbf60e4481652a4678966f7c04c5bcfb88764db064dfc63ce25d00b9c3693

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