trinity.explorer.explorer module#
The explorer module
- class trinity.explorer.explorer.Explorer(config: Config)[源代码]#
基类:
objectResponsible for exploring the taskset.
- async setup_weight_sync_group(master_address: str, master_port: int, state_dict_meta: List = None)[源代码]#
- async setup_model_level_weight_sync_group()[源代码]#
Setup process group for each model, only used in serve mode.
- async get_weight(name: str) Tensor[源代码]#
Get the weight of the loaded model (For checkpoint weights update).
- async explore() str[源代码]#
- 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[源代码]#
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!"}] )