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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.9 Windows x86-64

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212118-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 87aaee46df8d80c9da02058182a527e1c4abb5412949c0d476f3a4a42a4a1eb4
MD5 e2249381c86af2ea0b446f52445f893a
BLAKE2b-256 64fac22cc7621071a20e39970e5a817fa7218d90752a85752e5046863fe31c65

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212118-cp311-cp311-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3ccb26ca0e3890079cc665cbe0120388cf7e17d69a4f639ea46acfdd7b0f6434
MD5 0d2471b6c20208b7c6fa67b7560a99b4
BLAKE2b-256 5a73116211b059464662810603b754e697147c673b595e4eedc43d1e3c8c196f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212118-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 d43f7a2206d0e79695150c7ee8e917f2972aeafff35acde42ef7ee995a8b17a7
MD5 c8143441a95469500fd33f7d77e4e33e
BLAKE2b-256 e62aa2543a3fb3dc7ccf896baaa4b3ba8e33b8cb4b9cbe987ae3863bac5470f8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212118-cp310-cp310-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d53abb4b1a9823c8cde7ee996ae39f6026b4bdd4df6f40481e6bc4a8fdaff49e
MD5 e12065174f1902c98072a1807c48c3be
BLAKE2b-256 6876a90ad16efc66bfc78582e23fd82ecbdc388e30177d4f0394fd111e2aa80f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212118-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f9778791f48e8649ac53a63c45b3fe1268fdf44dc18ba3c309ad060803583f8b
MD5 198f06f6c1867083dc136e75780a3ab6
BLAKE2b-256 1a58c2c18db8b5d84c7e9ada5592e04edaac65dad259c54032fc5d1c0c527b69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212118-cp39-cp39-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 782ca7f28407a19d03061e90b476c5b83e5c42af9b4886d1f7ad6777bdb17036
MD5 5c3bc41baef537d4fd6d9ff48b63d592
BLAKE2b-256 95bc32c655297d10524156cd454251434bf82f1e4d08185bd13bb92ccf45e473

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212118-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 40e191cf737e52fd02328f009dbd2aed45e7720face32ae30207ddfe38f306d1
MD5 95e788660e1e17040c35e1a38afe63d9
BLAKE2b-256 f480e2c67f7636ea611c9c5b688466766ff1973f21ad2c7287d6941e5f5dfed8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cudacanvas-1.0.1.post212118-cp38-cp38-manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 943114801f847ee9b839570dbe0c24153af670ef6093ae2b6482f744ab37c361
MD5 9126712d9326e7edd75259f1cf946899
BLAKE2b-256 03bf1f3da1266eb76fb4bcd929b1283f964aa55e5a2a1d0f77da29d4c1ae0e99

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