trinity.explorer.explorer module#
The explorer module
- class trinity.explorer.explorer.Explorer(config: Config)[source]#
Bases:
objectResponsible for exploring the taskset.
- async setup_weight_sync_group(master_address: str, master_port: int, world_size: int = None, group_name: str = None, timeout: int = None)[source]#
- async set_state_dict_meta(state_dict_meta: List)[source]#
Set the state_dict meta on all model workers for NCCL weight sync.
Must be called after setup_weight_sync_group and before the first sync_model_weights call.
- async setup_model_level_weight_sync_group()[source]#
Setup process group for each model, only used in serve mode.
- async get_weight(name: str) Tensor[source]#
Get the weight of the loaded model (For checkpoint weights update).
- async explore() str[source]#
- The timeline of the exploration process:
- <βββββββββββ one period ββββββββββββ-> |
- explorer | <βββββ- step_1 βββββ> | |
- | <βββββ- step_2 βββββ> | |β¦ || <βββββ- step_n βββββ> | || <βββββββ- eval βββββββ> | <β sync β> |
|--------------------------------------------------------------------------------------|
trainer | <β idle β> | <β step_1 β> | <β step_2 β> | β¦ | <β step_n β> | <β sync β> |
- async serve() None[source]#
Run the explorer in serving mode.
In serving mode, the explorer starts an OpenAI compatible server to handle requests. Agent applications can be deployed separately and interact with the explorer via the API.
import openai client = openai.OpenAI( base_url=f"{explorer_server_url}/v1", api_key="EMPTY", ) response = client.chat.completions.create( model=config.model.model_path, messages=[{"role": "user", "content": "Hello!"}] )