Devices
Device Selection
The full list of available devices can be retreived with get_devices()
.
import qai_hub as hub
devices = hub.get_devices()
print(devices)
Or using the Command Line Interface:
qai-hub list-devices
Device Filtering
This returns a list of Device
objects.
Devices can be filtered based on name, OS, or attributes. To get a specific device,
filter by name and OS.
import qai_hub as hub
devices = hub.get_devices(name="Samsung Galaxy S24 (Family)")
print(devices)
devices_os13 = hub.get_devices(os="13", attributes="os:android")
print(devices_os13)
OS versions can be expressed as a single value or half-open interval. For example,
os=[10, 12)
will select OS major versions 10 and 11, but not 12.
import qai_hub as hub
devices_os10_to_os11 = hub.get_devices(os="[10, 12)", attributes="os:android")
print(devices_os10_to_os11)
devices_os12_and_more = hub.get_devices(os="[12,)", attributes="os:android")
print(devices_os12_and_more)
Devices can be further filtered by attributes. The following example selects all
devices with a Snapdragon® 8 Gen 2 SOC that support TensorFlow Lite. Supported attributes
are documented in Device
.
import qai_hub as hub
devices = hub.get_devices(attributes=["chipset:qualcomm-snapdragon-8gen2", "framework:tflite"])
print(devices)
The name, OS, and attributes can be used together as well. The list of devices returned contain those that match all supplied filters. This list can be empty. The following code selects all devices with a Snapdragon® 8 Gen 2 SOC and Android OS version 12 and up.
import qai_hub as hub
devices = hub.get_devices(attributes=["chipset:qualcomm-snapdragon-8gen2", "os:android"], os="[12,)")
print(devices)
The name, OS, and attributes can be used to select a single device as well
using the Device
class.
import qai_hub as hub
device_sn8gen2 = hub.Device(attributes="chipset:qualcomm-snapdragon-8gen2")
device_os12 = hub.Device(os="12", attributes="os:android")
device_galaxy_s23 = hub.Device(name="Samsung Galaxy S23 Ultra")
If more than one device match the supplied filters, an arbitrary device with the latest available OS version is selected.