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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230118-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 4d6d527bb803bbbe70e8153f601ac4532d272fdd53f6acc79af7a891a53bed08
MD5 ecccc80e157f5a5e5af0874ff367bf4c
BLAKE2b-256 21c74fca161e1b85c977f042f539d54b6212d6798254887d1ce0584209b13bb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230118-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9b775e2192b7c57d13fa3ba2f97b82942d7fc14a2e13d1839bbed5da43fb409a
MD5 ef5560b2d0132a4c3c0f4b11beea740f
BLAKE2b-256 35013e6a692421283b5db3cb9ff275ad7b9cb16a380abad6bae9241aaac897c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230118-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 4b9f31ca2bd6e581ac7abac5d7013ffbd01a12bd19738bc34c45d687f572e9f5
MD5 746e6b380c0945a0924c465a6597f9b7
BLAKE2b-256 880cb53193310fadb196aa4db1338f00e0bef9e3e3e243b0a9b90d4bd2ad0174

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230118-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b0ea4ecfbdd7aba618307aea8ff40edecd6c08367cdd1af4459b77a5785bd63f
MD5 c73e94d4a55377bf0fdc5fec574aa244
BLAKE2b-256 e60610f6d863bef20000800b952fd8d7ed89bcc35760028a7559fe053bb91f14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230118-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 fd5f9cdff922d1dec7e778f1ce64f7534054c0223115fd0e2a344b15a14e7041
MD5 25e3c0dde0531410fc7f22274ad3b30e
BLAKE2b-256 4ce8d82d84944220bc9ada2f950eaab1a828ded0920603ce387f6557714a9e86

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230118-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 beb80154d8379e0a58cd7905ab711fd866afaded34e19270ed88dbb789def872
MD5 a1186e2d375e83d8bcd5093422b8080d
BLAKE2b-256 c8608b92803b2d76d15ca3e1c16ef029798b3a39135504af06c2377501a038c5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230118-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b67d50bf0a83096d815174b80e9160795798f3a9c7640c4bf16dbbe3ccaa7dd3
MD5 a4196a0ebb4316b52d2ba4161bcdf9a3
BLAKE2b-256 97c2e3576b15410d2fec332147ff325e790cbdf99989d73c03a86b85ed8cceb8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post230118-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 09aea358a524bdef5c2d14c0e0873c4210c9e593326d7c1a07bb62643aebdf8a
MD5 9c4080af43113ae2ed634f82cebfb12e
BLAKE2b-256 b17be90ebcc0a29f209dbc6fe733e5c17593e1eade83673e8d0c41f45d319d6e

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