Iterables
make_batches(iterable, batch_size)
¶
Make batches from an iterable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
iterable
|
Iterable[T]
|
The iterable to make batches from. |
required |
batch_size
|
int
|
The size of the batches. |
required |
Returns:
Type | Description |
---|---|
None
|
The batches. |
Source code in inference_sdk/http/utils/iterables.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
remove_empty_values(dictionary)
¶
Remove empty values from a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dictionary
|
dict
|
The dictionary to remove empty values from. |
required |
Returns:
Type | Description |
---|---|
dict
|
The dictionary with empty values removed. |
Source code in inference_sdk/http/utils/iterables.py
6 7 8 9 10 11 12 13 14 15 |
|
unwrap_single_element_list(sequence)
¶
Unwrap a single element list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence
|
List[T]
|
The list to unwrap. |
required |
Returns:
Type | Description |
---|---|
Union[T, List[T]]
|
The unwrapped list. |
Source code in inference_sdk/http/utils/iterables.py
18 19 20 21 22 23 24 25 26 27 28 29 |
|