API Reference
MyxBoard
The MyxBoard is a tool designed to enhance reproducibility, tracking, and comparison of foundation models by managing evaluations and comparisons.
Constructor
MyxBoard(model_repo_ids: Optional[List[str]] = None, name: Optional[str] = None, hf_collection_name: Optional[str] = None)
- model_repo_ids: Optional list of model repository IDs to evaluate.
- name: Optional name for the MyxBoard instance.
- hf_collection_name: Optional Hugging Face collection name to initialize models from.
Class Attributes
- MYXMATCH_SUPPORTED_MODELS: List of supported model names for evaluation.
Methods
poll_and_store_results() -> bool
Polls for job completion and stores results. Returns True
if all jobs are completed, otherwise False
.
fetch_results() -> Dict[str, Union[str, dict]]
Fetches and updates results for completed jobs. Returns updated results or all results if no updates.
view_results() -> dict
Returns a simplified version of the evaluation results without polling the server.
get_results(verbose: bool = False) -> dict
Returns evaluation results. If verbose
is True
, returns detailed results; otherwise, returns simplified results.
push_to_hf() -> None
Pushes evaluation results to Hugging Face by creating a dataset, tagging it, and adding it to the original collection.
delete() -> None
Deletes the MyxBoard instance from the server.
Usage Example
Evaluation
These functions provide additional capabilities for managing evaluations in the RemyxAI platform.
EvaluationTask
Possible evaluation tasks:
- MYXMATCH: Represents the “myxmatch” evaluation task.
- BENCHMARK: Represents the “benchmark” task powered by lighteval
Functions
list_evaluations() -> list
Lists all evaluations from the server.
Returns:
- A list of evaluations if successful.
- A dictionary with an
"error"
key if the request fails.
Example:
download_evaluation(task_name: str, eval_name: str) -> dict
Downloads evaluation results for a specific task and evaluation name.
Parameters:
- task_name: The name of the task.
- eval_name: The name of the evaluation.
Returns:
- A dictionary containing the evaluation results if successful.
- A dictionary with an
"error"
key if the request fails.
Example:
delete_evaluation(eval_type: str, eval_name: str) -> dict
Deletes an evaluation from the server.
Parameters:
- eval_type: The type of the evaluation.
- eval_name: The name of the evaluation.
Returns:
- A dictionary containing the response from the server if successful.
- A dictionary with an
"error"
key if the request fails.
Example:
Model Deployment
The Model Deployment API provides functions for downloading and deploying machine learning models using Docker and Triton Server.
Functions
download_deployment_package(model_name: str, output_path: str) -> Optional[requests.Response]
Downloads a deployment package for the specified model and saves it to the provided output path.
Parameters:
- model_name: The name of the model to download.
- output_path: The file path where the deployment package should be saved.
Returns:
- A
requests.Response
object if the download is successful. None
if the download fails.
Example:
deploy_model(model_name: str, action: str = "up") -> None
Deploys or stops a model container using Docker Compose. The deployment package is downloaded and extracted, and a Triton server is started or stopped.
Parameters:
- model_name: The name of the model to deploy.
- action: The action to perform, either
"up"
to start the container or"down"
to stop it. Default is"up"
.
Behavior:
- For
"up"
action:- Downloads the deployment package.
- Creates necessary directories and Docker Compose files.
- Builds and runs the Docker container for the model using Triton Server.
- For
"down"
action:- Stops the Docker container using the
docker compose down
command.
- Stops the Docker container using the
Example:
Usage Example
Download and Deploy a Model
Inference
This API enables running inference on a model deployed using Triton Inference Server. It sends input data to the server, waits for a response, and returns the results along with the time taken to execute the inference.
Functions
run_inference(model_name: str, prompt: str, server_url: str = "localhost:8000", model_version: str = "1") -> Tuple[str, float]
Runs inference on a model deployed on Triton Inference Server and returns the results along with the time taken for inference.
Parameters:
- model_name: The name of the model to run inference on.
- prompt: The input text or prompt to send to the model.
- server_url: The URL of the Triton server. Default is
"localhost:8000"
. - model_version: The version of the model to use for inference. Default is
"1"
.
Returns:
- A tuple containing:
- results: The inference output as a string.
- elapsed_time: The time taken to run the inference, in seconds.
Example:
Usage Example
Model Management
This API provides functions to interact with a model repository, allowing you to list, get summaries, delete, and download models.
Functions
list_models() -> dict
Retrieves a list of available models from the server.
Returns:
- A dictionary containing the list of models.
Example:
get_model_summary(model_name: str) -> dict
Fetches a detailed summary of the specified model.
Parameters:
- model_name: The name of the model for which to retrieve the summary.
Returns:
- A dictionary containing the summary information of the model.
Example:
delete_model(model_name: str) -> dict
Deletes the specified model from the server.
Parameters:
- model_name: The name of the model to delete.
Returns:
- A dictionary containing the response from the server after the deletion request.
Example:
download_model(model_name: str, model_format: str) -> requests.Response
Downloads the specified model in the desired format from the server.
Parameters:
- model_name: The name of the model to download.
- model_format: The format in which the model should be downloaded (e.g.,
"onnx"
,"torchscript"
).
Returns:
- A
requests.Response
object containing the server’s response. - If the request is successful, the model will be saved as a
.zip
file with the format{model_name}.zip
.
Example:
Usage Example
Listing and Managing Models
Dataset Management
This API provides functions to list, download, and delete datasets from the server.
list_datasets() -> list
Lists all datasets available from the server.
Returns:
- A list of datasets if the request is successful, otherwise an error message.
Example:
download_dataset(dataset_type: str, dataset_name: str) -> dict
Downloads a dataset by generating a presigned URL.
Parameters:
- dataset_type: The type of the dataset to download.
- dataset_name: The name of the dataset to download.
Returns:
- A dictionary containing a success message if the dataset is downloaded successfully, otherwise an error message.
Example:
delete_dataset(dataset_type: str, dataset_name: str) -> str
Deletes a dataset from the server.
Parameters:
- dataset_type: The type of the dataset to delete.
- dataset_name: The name of the dataset to delete.
Returns:
- A success message if the dataset is deleted successfully, otherwise an error message.
Example:
Usage Example
Run Tasks
Train models and Curate datasets using tasks APIs
MyxMatch
Submit a MyxMatch task to the server.
- Endpoint:
POST /task/myxmatch/{name}/{prompt}/{models}
- Parameters:
name
: The name of the task.prompt
: The prompt for the task.models
: A list of model names.
- Returns: A dictionary containing the task status.
Example:
Benchmark
Submit a benchmark task to the server.
- Endpoint:
POST /task/benchmark
- Parameters:
name
: The name of the task.models
: A list of model names.evals
: A list of evaluation names.
- Returns: A dictionary containing the task status.
Example:
Get Job Status
Get the status of a specific job by job name.
- Endpoint:
GET /task/job-status/{job_name}
- Parameters:
job_name
: The name of the job to check.
- Returns: A dictionary containing the job status.
Example:
Train Classifier
Train a classifier model.
- Endpoint:
POST /task/classify/{model_name}/{labels}/{model_selector}
- Parameters:
model_name
: The name of the model to train.labels
: A list of labels for the model.model_selector
: The selector for the model.hf_dataset
: The Hugging Face dataset to use (optional).
- Returns: A dictionary containing the training status.
Example:
Train Detector
Train a detector model.
- Endpoint:
POST /task/detect/{model_name}/{labels}/{model_selector}
- Parameters:
model_name
: The name of the model to train.labels
: A list of labels for the model.model_selector
: The selector for the model.hf_dataset
: The Hugging Face dataset to use (optional).
- Returns: A dictionary containing the training status.
Example:
Train Generator
Train a generator model.
- Endpoint:
POST /task/generate/{model_name}
- Parameters:
model_name
: The name of the model to train.hf_dataset
: The Hugging Face dataset to use.
- Returns: A dictionary containing the training status.
Example:
Data Composer
Submit a Data Composer task to the server.
- Endpoint:
POST /task/datacomposer/{dataset_name}/{num_samples}
- Parameters:
dataset_name
: The name of the dataset to compose or extend.num_samples
: The number of samples to create.context
: The context, which could be a Hugging Face dataset or a text prompt (optional).dataset_file
: The path to the dataset file to upload (optional).
- Returns: A dictionary containing the task status.
Example:
User Management
This API provides functions to retrieve user profile information and check available credits from the server.
Functions
get_user_profile() -> dict
Fetches the user profile details from the server.
Returns:
- A dictionary containing the user profile information.
Example:
get_user_credits() -> dict
Retrieves the available credits for the user from the server.
Returns:
- A dictionary containing the user’s credit information.
Example: