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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210121-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 53990402191e5b3b8d9f09ecb13d4768a65aa49dffddea177b24a53e1f74fa28
MD5 9d835f1b08e91ee51028c1e3b047a61d
BLAKE2b-256 f18b74a9339787223ce5c1c89f117d7b3e2f079cc1f059ebe11de64d00d12156

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210121-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1508aa7ed4d95f9ee415f7ea159a90c9ba66715a87de9c6d1b60a6f63f56cf20
MD5 4842e7c4feb6ce98a0b56b7b79eca826
BLAKE2b-256 22a8975f5e08c1787d9dfdb8e74c8b90dd37659255880fc867605d430cf70f17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210121-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 1b6a9ca8288514f268444df59cfe582cd41ef3e2c4817c8dc1576b7842940531
MD5 d8815ea9155055195b3740753c3d371a
BLAKE2b-256 7dc0a35aaa6a2041cd0d2403b8cced6f7ee588cc68abdc203cec8b17887e3586

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210121-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1a2b1c68553794a9f6a16074c9fd67c35ac28ef7b93a6a1e82890b34e0f2f638
MD5 9d99fa2b91355462a9b0940516f25978
BLAKE2b-256 bdabe9b4d6dbbb25824064ec0fded65b754205ce0beee47f7965565d6d798092

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210121-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9b5a55b6da1402c79cf0d0591516b37531c20af1c8338241b77681d6a5fd8657
MD5 d41f385999d8c03442545d4d9d536e03
BLAKE2b-256 0fa07d69ab9f672d403c9aa7f945b665b3f0398719e6077d510d33a8862721e6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210121-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4ce517824c4d0e25395d66a746e961d5680850beb099926bfe34f3cd25d25b9d
MD5 8e572dc2786e7c264a3241dd9f6b358e
BLAKE2b-256 2317bbff5f6a68ed1800e3aa8fc37903acd69d6964c6bf216efba053a8b49b06

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210121-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 cb20d2588088bc277086819d5c67ee87130e8e7d578e71de0aa51b53121e7713
MD5 b6a802668dcd55c275a13f03a9b9e5c4
BLAKE2b-256 c20dc936ec1a73239b411816cdb75942c10b7593b0b456d4713f170c2b30e5e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post210121-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9d5d22dd031f009616830501d67ec3db09ec0d6381dd22ae8983fd427f2a2f97
MD5 825682e33ddb39a25d43bf184d51556b
BLAKE2b-256 e6225f667fed632c5f11a940c10bb7e216e993fc6f671e2a6a61f192a04efa54

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