Skip to main content

Device Picker

Description

Device Picker is a Python package designed to automatically select the appropriate computational device for machine learning tasks. It supports various frameworks like PyTorch, TensorFlow, and JAX. This tool is particularly useful in environments where multiple computational backends are available, as it simplifies the process of device selection based on the user's preferences and system capabilities.

Installation

To install Device Picker, use the following pip command:

pip install device-picker

For users on macOS with Apple Silicon (M1, M2 chips), to enable Metal support:

# for jax
pip install device-picker[jax_metal_support] 
# for tensorflow
pip install device-picker[tensorflow_metal_support] 

Usage

To use the Device Picker in your project, import the DevicePicker class and create an instance of it. The class methods pytorch_device, tensorflow_device, and jax_device can optionally take a device name as an argument. If a device name is given, the Device Picker will attempt to use the specified device if it is available. If no device name is provided or if the specified device is not available, the Device Picker will automatically select a suitable default device.

from device_picker import DevicePicker

# Create an instance of DevicePicker
device_picker = DevicePicker()

# Select a specific device for PyTorch, or let the picker choose automatically
pytorch_device = device_picker.pytorch_device('cuda') # You can specify 'cuda', 'mps', or leave it empty

# Select a specific device for TensorFlow
tensorflow_device = device_picker.tensorflow_device('GPU') # Options could be 'GPU', 'CPU', etc.

# Select a specific device for JAX
jax_device = device_picker.jax_device('gpu') # Choose 'gpu', 'tpu', or others

Running Tests

To run the unit tests for Device Picker, execute the following command in the root directory of the project:

make test

Contributing

Contributions to Device Picker are welcome! Please feel free to submit pull requests, open issues, or suggest improvements.

License

Device Picker is released under the MIT License. See the LICENSE file for more details.

Metadata

Release files for device-picker 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for device-picker 0.1.2
File Size Uploaded
device_picker-0.1.2.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for device-picker 0.1.2
File Interpreter ABI Platform
device_picker-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / device_picker-0.1.2.tar.gz

Download URL device_picker-0.1.2.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
dcc20fb90f7b7e8775e5cdab9b88adc2b98cdd8af54a9b933a27a1adb4d5ad74
BLAKE2b-256 checksum
How to use checksums
150d3b2f782c82560f018a73369b494cb6465932b4d051ffe87fb2e4fbd1c024
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / device_picker-0.1.2-py3-none-any.whl

Download URL device_picker-0.1.2-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05781bdc304198478e76ddce90126fdea6cd98e22ed7a7c37c4ba6ef1a23722c
BLAKE2b-256 checksum
How to use checksums
016cc345c27d877f746bd4087f439bb0024d05e43f8553b8f68a4a2ee3a4bab7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page