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

image

cudacanvas : PyTorch Tensor Image Display in CUDA

(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():
        cudacanvas.clean_up()
        #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():
        cudacanvas.clean_up()
        #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.post230121-cp311-cp311-win_amd64.whl (98.0 kB view details)

Uploaded CPython 3.11 Windows x86-64

cudacanvas-1.0.1.post230121-cp310-cp310-win_amd64.whl (97.0 kB view details)

Uploaded CPython 3.10 Windows x86-64

cudacanvas-1.0.1.post230121-cp39-cp39-win_amd64.whl (98.7 kB view details)

Uploaded CPython 3.9 Windows x86-64

cudacanvas-1.0.1.post230121-cp38-cp38-win_amd64.whl (99.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230121-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 3035e16aa6eca2906fd0dc0c3942eb2518aee7fd748e8c03654cf70f88d64782
MD5 c93847d7ebb3084345f97984b445f7f2
BLAKE2b-256 ab58209292a9cfc034c9f62442ef93f5a7bf8aa08028ad4ccd674ffae0bcd3ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230121-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c20640022c6e687c33804a139d01678ea4ba7e64a3835988d975b5fd77f6e408
MD5 a040407a13c21a5cef1ea397d745ee28
BLAKE2b-256 88a1dda61a80d1c660b191a5d3edb890f3f60cf9f2ed3830cd717e211ac4d78b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230121-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ad6cb2e0816f1b444ade14ca9998e323396b2d308af838bb4bab840ea2025485
MD5 773a6c92486045fc5675479b700ba79e
BLAKE2b-256 25803cb0c233b9ae976fde113b6032bf1d7b8bb5267abc7315db3bb633a3eb70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230121-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e8a33eea441db6bde5aaad6a257cd134855953e79e5c4368b35bcc1e2445bc79
MD5 62a216f779a06d323a99768ba0b41920
BLAKE2b-256 b1359f847901848b75e617fda15d1831958c40cb5843ad301803ccc8c0d4117a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230121-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 1221af830da030374ca1959d12f171167c0b887cd5c5db3aae771ee2b4ccfae1
MD5 7a7578af1615438021d45499232fdb4b
BLAKE2b-256 b425f245905ba27bba69bb50ba6dffe143ab377f7fab42e948ef3f7670a877ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230121-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3a596b9c01e3294723cf3a9e5403af0ee797dd3b3755d6d9feeb2a8504dfb4ff
MD5 61338cadbcf5094f425dc05d02caf811
BLAKE2b-256 3ffacaa73299a981f3d5223d6df7fe9fa848ae29e8f15f3d2e27860e379de082

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230121-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f2027bd8ada78d8e8577ffce876348fbc5d2383117faf94543b217c4ee12b663
MD5 b9e7c8832cc6c3c07a90156751e252b5
BLAKE2b-256 c793005ab2464dfbefe812be7a596f278022a47b640ffe3b900fb46f64591073

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230121-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9d53ec911d6eea6a8daf2aceef6e63278c1c940a57dfac6abea4cbf9e083d1bc
MD5 75170c2ac8bc1138917127ac52cfc5f1
BLAKE2b-256 ef0e25d6472ecc0e968e9346117a18fde0669d32ed6cc4efecd27481394869cb

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