APIFuture
Derived from the Tinker SDK (Apache-2.0)
Reference adapted from the Tinker SDK; changes have been made for MinT. See the attribution notice and the Apache 2.0 license.
class mint.APIFuture (...)¶
Abstract base class for futures that can be awaited or accessed synchronously.
APIFuture provides a unified interface for handling async operations that can be accessed both synchronously (via result()) and asynchronously (via await or result_async()). This allows for flexible usage patterns in both sync and async contexts.
The future can be awaited directly in async contexts:
Or accessed synchronously:
# In async context
future = training_client.forward_backward(data, "cross_entropy")
result = await future # Or await future.result_async()
# In sync context
future = training_client.forward_backward(data, "cross_entropy")
result = future.result()
result ( timeout=None )¶
Get the result synchronously with optional timeout.
Parameters:
- timeout ( float | None , default:
None) – Maximum time to wait in seconds. None means wait indefinitely.
Returns: The result value of type T
Async variant: result_async()
Referenced by¶
- RestClient.get_sampler
- RestClient.get_weights_info_by_tinker_path
- RestClient.whoami
- TrainingClient.forward
- TrainingClient.forward_backward
- TrainingClient.forward_backward_custom
- TrainingClient.load_state
- TrainingClient.load_state_with_optimizer
- TrainingClient.optim_step
- TrainingClient.save_state
- TrainingClient.save_weights_for_sampler