Tinkex.ServiceClient (Tinkex v0.3.4)
View SourceEntry point for Tinkex operations.
Starts a session via Tinkex.SessionManager, tracks sequencing counters, and
spawns Training/Sampling clients under Tinkex.ClientSupervisor.
Summary
Functions
Returns a specification to start this module under a supervisor.
Create a training client from this ServiceClient.
Create a LoRA training client asynchronously.
Return a REST client for session and checkpoint management.
Create a sampling client from this ServiceClient.
Create a sampling client asynchronously.
Create a training client from a saved checkpoint path.
Create a training client from checkpoint asynchronously.
Create a training client from a saved checkpoint path, loading optimizer state.
Async variant of create_training_client_from_state_with_optimizer/3.
Fetch server capabilities (supported models/features) via the Service API.
Async helper for get_server_capabilities/1.
Start a ServiceClient process.
Return the telemetry reporter pid if backend telemetry is enabled.
Types
@type t() :: pid()
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Create a training client from this ServiceClient.
base_model is a required second argument specifying the base model name
(e.g., "meta-llama/Llama-3.1-8B").
Pass call_timeout: :infinity (or a larger timeout in ms) via opts if model
creation may take longer than the default 5000ms GenServer call timeout.
Create a LoRA training client asynchronously.
Returns a Task that resolves to {:ok, pid} or {:error, reason}.
@spec create_rest_client(t()) :: {:ok, Tinkex.RestClient.t()}
Return a REST client for session and checkpoint management.
Create a sampling client from this ServiceClient.
Create a sampling client asynchronously.
Returns a Task that resolves to {:ok, pid} or {:error, reason}.
Examples
task = ServiceClient.create_sampling_client_async(service_pid, base_model: "meta-llama/Llama-3.2-1B")
{:ok, sampling_pid} = Task.await(task)
@spec create_training_client_from_state(t(), String.t(), keyword()) :: {:ok, pid()} | {:error, term()}
Create a training client from a saved checkpoint path.
Uses checkpoint metadata to configure the client, then loads the weights.
To include optimizer state, pass load_optimizer: true or use
create_training_client_from_state_with_optimizer/3.
Create a training client from checkpoint asynchronously.
Returns a Task that resolves to {:ok, pid} or {:error, reason}.
@spec create_training_client_from_state_with_optimizer(t(), String.t(), keyword()) :: {:ok, pid()} | {:error, term()}
Create a training client from a saved checkpoint path, loading optimizer state.
Convenience wrapper around create_training_client_from_state/3 that sets
load_optimizer: true.
@spec create_training_client_from_state_with_optimizer_async( t(), String.t(), keyword() ) :: Task.t()
Async variant of create_training_client_from_state_with_optimizer/3.
@spec get_server_capabilities(t()) :: {:ok, Tinkex.Types.GetServerCapabilitiesResponse.t()} | {:error, term()}
Fetch server capabilities (supported models/features) via the Service API.
Async helper for get_server_capabilities/1.
@spec start_link(keyword()) :: GenServer.on_start()
Start a ServiceClient process.
Accepts :config (Tinkex.Config.t()) and optional client modules via
:training_client_module / :sampling_client_module.
Return the telemetry reporter pid if backend telemetry is enabled.