### Install Pruna Compression Framework Source: https://docs.pruna.ai/en/stable/index Installs the Pruna framework using pip. This is the first step to start compressing and evaluating your AI models with Pruna. ```bash pip install pruna ``` -------------------------------- ### Install Pruna Pro (GPU) Source: https://docs.pruna.ai/en/stable/docs_pruna_pro/user_manual/pruna_pro Installs the Pruna Pro package with GPU support for advanced model compression. Ensure PyTorch is installed for GPU compatibility. ```bash pip install pruna_pro==0.3.0 ``` -------------------------------- ### Install Pruna SDK and Libraries Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/deploying_sana_tutorial Installs the Pruna SDK along with necessary third-party libraries like datasets, huggingface_hub, and gradio. This step is crucial for setting up the environment to run the tutorial. ```shell !pip install pruna !pip install datasets huggingface_hub gradio ``` -------------------------------- ### Install Pre-commit Hooks Source: https://docs.pruna.ai/en/stable/docs_pruna/contributions/how_to_contribute Installs the pre-commit framework hooks, which help automate checks before commits. ```bash pre-commit install ``` -------------------------------- ### Install Pruna Pro (CPU) Source: https://docs.pruna.ai/en/stable/docs_pruna_pro/user_manual/pruna_pro Installs the Pruna Pro package with CPU-only support, utilizing PyTorch's CPU-specific wheels. Recommended for systems without a compatible GPU. ```bash pip install pruna_pro==0.3.0 --extra-index-url https://download.pytorch.org/whl/cpu ``` -------------------------------- ### Install Pruna Dependency Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/image_generation Installs the Pruna library, which is necessary for model optimization and evaluation. This command should be run in your environment before proceeding with the model optimization steps. ```bash %pip install pruna ``` -------------------------------- ### Install Pruna and Dependencies Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/video_generation Installs the Pruna library and necessary dependencies like ftfy, imageio, and imageio-ffmpeg. These are essential for running the video generation and optimization workflow. ```python %pip install pruna %pip install ftfy imageio imageio-ffmpeg ``` -------------------------------- ### Install Dependencies with uv Source: https://docs.pruna.ai/en/stable/docs_pruna/contributions/how_to_contribute Installs project dependencies and the project itself in editable mode using uv, creating a virtual environment in `.venv/`. This is the recommended installation method. ```bash uv sync --extra dev ``` -------------------------------- ### Install vLLM Source: https://docs.pruna.ai/en/stable/setup/vllm Installs the vLLM library, a high-performance serving engine for LLMs. This is a prerequisite for serving optimized models. ```bash pip install vllm ``` -------------------------------- ### Install Pruna Pro for Advanced Compression Source: https://docs.pruna.ai/en/stable/index Installs the Pruna Pro premium offering, which provides enhanced compression algorithms and features. Use this for more advanced model optimization needs. ```bash pip install pruna_pro ``` -------------------------------- ### Install Pruna Python Package Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/llms Installs the Pruna library using pip. This is a prerequisite for using Pruna's model optimization functionalities. Ensure you have Python and pip installed. ```bash %pip install pruna ``` -------------------------------- ### Serve Pruna Model with vLLM (CLI) Source: https://docs.pruna.ai/en/stable/setup/vllm Starts a vLLM server to serve a Pruna-optimized model directly from the command line. This is a convenient way to deploy the model for inference. ```bash vllm serve path/to/pruna/model ``` -------------------------------- ### Install Pruna AI and FastAPI Dependencies with uv Source: https://docs.pruna.ai/en/stable/setup/koyeb Installs necessary Python packages for the Pruna AI application, including FastAPI for the web server, diffusers and torch for model inference, and pruna_pro for model optimization. This command uses the uv package manager. ```bash uv add fastapi diffusers torch pruna_pro ``` -------------------------------- ### Install Pruna Package Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/cv_cpu Installs the latest version of the pruna package. Ensure you are using the correct version for this tutorial to avoid compatibility issues. ```python # if you are not running the latest version of this tutorial, make sure to install the matching version of pruna # the following command will install the latest version of pruna %pip install pruna ``` -------------------------------- ### Install Triton Client Library (Python) Source: https://docs.pruna.ai/en/stable/setup/tritonserver Installs the Triton Inference Server client library for Python, enabling interaction with deployed models. Requires Python 3.9+. ```shell pip install tritonclient[grpc] ``` -------------------------------- ### Step 2: Define Optimizations with SmashConfig Source: https://docs.pruna.ai/en/stable/docs_pruna/user_manual/smash This snippet shows how to create a `SmashConfig` object to specify the desired optimizations for a model. It uses the `hqq_diffusers` quantizer as an example to accelerate inference. ```python from pruna import SmashConfig smash_config = SmashConfig(["hqq_diffusers"]) ``` -------------------------------- ### Initialize Pruna AI Project with uv Source: https://docs.pruna.ai/en/stable/setup/koyeb Initializes a new project named 'pruna-on-koyeb' using the uv package manager. This sets up the project structure for managing dependencies. ```bash uv init pruna-on-koyeb ``` -------------------------------- ### Pruna AI File Upload Response Source: https://docs.pruna.ai/en/stable/docs_pruna_endpoints/performance_models/p-image-edit This is an example JSON response after successfully uploading a file to the Pruna AI API. It provides the unique ID and a 'get' URL for the uploaded file. ```json { "id": "file-abc123", "urls": { "get": "https://api.pruna.ai/v1/files/file-abc123" } } ``` -------------------------------- ### Load Diffusion Model (PyTorch/Diffusers) Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/diffusion_quantization_acceleration Loads a pre-trained diffusion model from the 'diffusers' library. This example uses the 'FluxPipeline' and moves the model to the CUDA device for accelerated computation. Ensure PyTorch and Diffusers are installed. ```python import torch from diffusers import FluxPipeline pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16).to("cuda") ``` -------------------------------- ### Deploy Model to Koyeb using CLI Source: https://docs.pruna.ai/en/stable/setup/koyeb This command deploys the project to Koyeb, specifying a GPU instance type, region, service type, and port mapping. It also enables archive building and sets an environment variable for the Pruna API key. Replace `your_pruna_api_key` with your actual API key. ```bash koyeb deploy . pruna-on-koyeb \ --instance-type gpu-nvidia-l40s \ --region na \ --type web \ --port 8000:http \ --archive-builder \ --env PRUNA_API_KEY=`your_pruna_api_key` ``` -------------------------------- ### Configure Target Modules for Quantization (Python) Source: https://docs.pruna.ai/en/stable/docs_pruna/user_manual/power_user Example of configuring target modules using SmashConfig for the 'quanto' quantizer. It includes 'transformer.*' modules and excludes '*embed*' modules, targeting specific parts of the model for optimization. ```python from pruna import SmashConfig smash_config = SmashConfig({"quanto": {"target_modules": { "include": ["transformer.*"], "exclude": ["*embed*"] }}}) ``` -------------------------------- ### Initialize SmashConfig Source: https://docs.pruna.ai/en/stable/reference/config Demonstrates how to create an instance of the SmashConfig class. This is the first step in configuring Pruna for model optimization. No external dependencies are required for basic initialization. ```python from pruna import SmashConfig smash_config = SmashConfig() ``` -------------------------------- ### Run Pruna Model on AWS AMI (Python) Source: https://docs.pruna.ai/en/stable/setup/ami A minimal Python script to test the Pruna AI setup on an AWS AMI. This example demonstrates loading a Stable Diffusion pipeline, configuring Pruna's smash function with specific settings ('deepcache' cacher and 'stable_fast' compiler), and running a model inference without requiring a token. It requires the `torch`, `diffusers`, and `pruna` libraries. ```python import torch from diffusers import StableDiffusionPipeline from pruna import smash, SmashConfig # Define the model you want to smash pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16) pipe = pipe.to("cuda") # Initialize the SmashConfig smash_config = SmashConfig() smash_config['cacher'] = 'deepcache' smash_config['compiler'] = 'stable_fast' # Smash the model without a token smashed_model = smash( model=pipe, smash_config=smash_config, ) # Run the model on a prompt prompt = "a photo of an astronaut riding a horse on mars" image = smashed_model(prompt).images[0] ``` -------------------------------- ### Add Algorithms and Hyperparameters using add() Source: https://docs.pruna.ai/en/stable/reference/config Demonstrates the use of the `add` method to incorporate algorithms and their specific hyperparameters into the SmashConfig. This method provides a programmatic way to build the configuration. ```python >>> config = SmashConfig() >>> config.add("fastercache") >>> config.add("diffusers_int8") >>> config SmashConfig( 'fastercache': True, 'diffusers_int8': True, ) ``` -------------------------------- ### Build Docker Image with Pruna and Triton (Dockerfile) Source: https://docs.pruna.ai/en/stable/setup/tritonserver Creates a Docker image by starting with NVIDIA's Triton base image and installing Pruna, PyTorch, and other necessary system and Python packages. Ensures a self-contained environment for serving. ```dockerfile FROM nvcr.io/nvidia/tritonserver:23.12-py3 ENV DEBIAN_FRONTEND=noninteractive ENV TZ=Etc/UTC # Install system dependencies RUN apt-get update && \ apt-get install -y wget curl git vim sudo cmake build-essential \ libssl-dev libffi-dev python3-dev python3-venv python3-pip libsndfile1 && \ rm -rf /var/lib/apt/lists/* # Install Python packages RUN pip3 install packaging psutil pexpect ipywidgets jupyterlab ipykernel \ librosa soundfile # Upgrade pip RUN pip3 install --upgrade pip # Install Pruna RUN pip3 install pruna==0.3.0 # or pip3 install pruna_pro==0.3.0 depending on the algorithms used ``` -------------------------------- ### Evaluate Base Model and Offload to CPU Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/llms This snippet shows the initial steps of loading a base model, moving it to a specified device, configuring inference arguments, evaluating its performance, and then offloading it to the CPU for further comparison. ```python base_model = PrunaModel(model=copy_model) move_to_device(base_model, device) base_model.inference_handler.model_args.update(inference_args) base_model_results = eval_agent.evaluate(base_model) move_to_device(base_model, "cpu") ``` -------------------------------- ### Load Model and Tokenizer with Transformers Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/reasoning_llm Loads a pre-trained language model and its associated tokenizer using the Hugging Face transformers library. This example uses a small version of Qwen3 (Qwen/Qwen3-1.7B) as a starting point, but it's compatible with larger models. ```python from transformers import pipeline model_name = "Qwen/Qwen3-1.7B" pipe = pipeline( "text-generation", model_name, ) ``` -------------------------------- ### Create Dockerfile for Model Deployment Source: https://docs.pruna.ai/en/stable/setup/koyeb This Dockerfile sets up an Ubuntu environment with CUDA 12.8.1 and cuDNN, installs necessary build tools, copies project files, and configures Python environment using `uv`. It defines environment variables for Hugging Face cache and app port, and sets the entrypoint to run the application with Uvicorn. ```dockerfile FROM nvidia/cuda:12.8.1-cudnn-runtime-ubuntu22.04 COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/ ENV DEBIAN_FRONTEND=noninteractive \ UV_COMPILE_BYTECODE=1 \ UV_LINK_MODE=copy \ HF_HOME=/workspace/model-cache \ HF_HUB_ENABLE_HF_TRANSFER=1 \ PATH="/workspace/.venv/bin:$PATH" \ PORT=8000 RUN apt-get update && \ apt-get install -y build-essential && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* WORKDIR /workspace COPY . ./ RUN uv python pin 3.12.0 && \ uv sync ENTRYPOINT uvicorn server:app --host 0.0.0.0 --port ${PORT:-8000} ``` -------------------------------- ### Install Pruna with Pip (GPU) Source: https://docs.pruna.ai/en/stable/setup/install Installs the Pruna package version 0.3.0 for GPU environments using pip, specifying the CPU extra index URL for PyTorch. Ensure your system has a compatible NVIDIA driver and CUDA toolkit installed. ```bash pip install pruna==0.3.0 --extra-index-url https://download.pytorch.org/whl/cpu ``` -------------------------------- ### Instantiate SuperfastCompiler Source: https://docs.pruna.ai/en/stable/docs_pruna/user_manual/customize_algorithm Demonstrates the instantiation of the `SuperfastCompiler` class, showing how to create an object of the compiler. ```python # test instantiation of compiler SuperfastCompiler() ``` -------------------------------- ### Install Pruna with All Optional Dependencies Source: https://docs.pruna.ai/en/stable/setup/install Installs the Pruna package along with all optional algorithm dependencies using pip. This includes extras like 'stable-fast', 'gptq', and 'full' for comprehensive optimization capabilities. ```bash pip install "pruna[full]" ``` -------------------------------- ### Basic Pruna Optimization Workflow Source: https://docs.pruna.ai/en/stable/docs_pruna/user_manual/smash This snippet demonstrates the fundamental workflow for optimizing an AI model using Pruna. It covers loading a diffusion pipeline, configuring optimization with SmashConfig, applying optimizations via the smash function, evaluating the model's performance, and running inference. ```python from diffusers import DiffusionPipeline from pruna import SmashConfig, smash from pruna.data.pruna_datamodule import PrunaDataModule from pruna.evaluation.evaluation_agent import EvaluationAgent from pruna.evaluation.task import Task # Load the model model = DiffusionPipeline.from_pretrained("segmind/Segmind-Vega") # Create and configure SmashConfig smash_config = SmashConfig(["hqq_diffusers"]) # Smash the model optimized_model = smash(model=model, smash_config=smash_config) # Evaluate the model metrics = ["clip_score", "psnr"] datamodule = PrunaDataModule.from_string("LAION256") datamodule.limit_datasets(5) # You can limit the number of samples. task = Task(metrics, datamodule=datamodule) eval_agent = EvaluationAgent(task) eval_agent.evaluate(optimized_model) # Run inference optimized_model.set_progress_bar_config(disable=True) optimized_model.to("cuda") optimized_model("A serene landscape with mountains").images[0].save("output.png") ``` -------------------------------- ### Install Pruna with Pip (CPU) Source: https://docs.pruna.ai/en/stable/setup/install Installs the Pruna package version 0.3.0 for CPU environments using pip. It's recommended to use uv for package management to avoid performance issues. ```bash pip install pruna==0.3.0 ``` -------------------------------- ### Install CUDA Runtime Toolkit with Conda Source: https://docs.pruna.ai/en/stable/setup/install Installs the CUDA runtime toolkit version 12.4.0 using Conda. This is necessary for Pruna to function on CUDA-enabled machines. Verify compatibility with `nvcc --version` and `nvidia-smi`. ```bash conda install nvidia/label/cuda-12.4.0::cuda ``` -------------------------------- ### Install Dependencies with pip/conda Source: https://docs.pruna.ai/en/stable/docs_pruna/contributions/how_to_contribute Installs project dependencies and the project itself in editable mode directly into the current conda or pip environment. ```bash pip install -e . pip install -e .[dev] ``` -------------------------------- ### Setup Evaluation Environment for Smashed Model Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/reasoning_llm This code sets up the necessary components for model evaluation, including loading datasets, defining metrics (TotalTime, Throughput, Perplexity, EnergyConsumed), creating a PrunaDataModule, and initializing an EvaluationAgent. It also configures the model's inference arguments. ```python from datasets import load_dataset from pruna import PrunaModel from pruna.data.pruna_datamodule import PrunaDataModule from pruna.data.utils import split_train_into_train_val_test from pruna.evaluation.evaluation_agent import EvaluationAgent from pruna.evaluation.metrics import ( EnergyConsumedMetric, ThroughputMetric, TorchMetricWrapper, TotalTimeMetric, ) from pruna.evaluation.task import Task # Define the metrics. Increment the number of iterations # and warmup iterations to get a more accurate result. metrics = [ TotalTimeMetric(n_iterations=50, n_warmup_iterations=5), ThroughputMetric(n_iterations=50, n_warmup_iterations=5), TorchMetricWrapper("perplexity", call_type="single"), EnergyConsumedMetric(n_iterations=50, n_warmup_iterations=5), ] # Load the dataset and split it into train, validation and test train_ds = load_dataset("zwhe99/DeepMath-103K", split="train") train_ds = train_ds.rename_column( "question", "text" ) # Rename the column to match the `text_generation_collate` function train_ds, val_ds, test_ds = split_train_into_train_val_test(train_ds, seed=42) # (Optional) Use the eos_token as the pad_token pipe.tokenizer.pad_token = pipe.tokenizer.eos_token # Create the data module. Increment the `max_seq_len` to match the # `max_new_tokens` of the model for a more accurate evaluation. datamodule = PrunaDataModule.from_datasets( datasets=(train_ds, val_ds, test_ds), collate_fn="text_generation_collate", tokenizer=pipe.tokenizer, collate_fn_args={"max_seq_len": 512}, dataloader_args={"batch_size": 16, "num_workers": 4}, ) datamodule.limit_datasets(100) # Define the task and the evaluation agent task = Task(metrics, datamodule=datamodule, device=device) eval_agent = EvaluationAgent(task) # (Optional) Define specific inference arguments for benchmarking. inference_args = { "max_new_tokens": 512, # Increment the `max_new_tokens` for a more accurate evaluation. } ``` -------------------------------- ### Evaluate Base Model and Offload to CPU Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/video_generation This snippet demonstrates how to load a base model, move it to a specified device (GPU or CPU), evaluate its performance, and then offload it to the CPU for further processing or storage. It's crucial for comparing performance before and after optimization. ```python base_pipe = PrunaModel(model=copy_pipe) move_to_device(base_pipe, device) base_model_results = eval_agent.evaluate(base_pipe) move_to_device(base_pipe, "cpu") ``` -------------------------------- ### Define New Dataset Setup Method (Python) Source: https://docs.pruna.ai/en/stable/docs_pruna/user_manual/customize_dataset This Python function prepares the training, validation, and test splits for a new dataset. It typically involves downloading or generating the dataset and can be placed in `pruna/data/datasets/text_generation.py`. It takes a seed for splitting and returns the three dataset splits. ```python from typing import Tuple from datasets import Dataset from pruna.data.utils import split_train_into_train_val_test from datasets import load_dataset def setup_new_dataset(seed: int) -> Tuple[Dataset, Dataset, Dataset]: """ Setup the new dataset. License: unspecified Parameters ---------- seed : int The seed to use. Returns ------- Tuple[Dataset, Dataset, Dataset] The dataset splits. """ # Download or generate the dataset, for example: train_ds = load_dataset("SamuelYang/bookcorpus")["train"] # If necessary, split into training, validation, and test sets using the provided seed train_ds, val_ds, test_ds = split_train_into_train_val_test(train_ds, seed=42) # Adjust column names if necessary return train_ds, val_ds, test_ds ``` -------------------------------- ### Initializing Smash Config (Python) Source: https://docs.pruna.ai/en/stable/docs_pruna_pro/tutorials/vllm Initializes the SmashConfig object from the pruna_pro package, specifying quantization parameters. Requires `pruna_pro`. Takes a configuration dictionary as input and returns a SmashConfig object. ```python from pruna_pro import SmashConfig, smash # Initialize the SmashConfig smash_config = SmashConfig({ "hqq": { # Select the quantizer "weight_bits": 4, "compute_dtype": "torch.bfloat16", # can work with float16, but better performance with bfloat16 "use_torchao_kernels": False, # set to False to enable saving "force_hf_implementation": True # set to True to bypass the AutoHQQHFModel quantization } }) ``` -------------------------------- ### Install LitServe for Pruna AI Source: https://docs.pruna.ai/en/stable/setup/litserve Installs the LitServe library, a prerequisite for serving Pruna AI models. This command uses pip to manage Python packages. ```shell pip install litserve ``` -------------------------------- ### Initialize and Configure SmashConfig with Tokenizer and Processor Source: https://docs.pruna.ai/en/stable/docs_pruna/user_manual/configure Demonstrates how to initialize a SmashConfig object and add a tokenizer and processor using a model ID from Hugging Face Hub. This is a foundational step for model optimization workflows. ```python from pruna import SmashConfig smash_config = SmashConfig({"ifw": {"weight_bits": 16}}) # Add a tokenizer and processor model_id = 'openai/whisper-tiny' smash_config.add_tokenizer(model_id) smash_config.add_processor(model_id) ``` -------------------------------- ### Initialize Pruna Smash Config Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/diffusion_quantization_acceleration Initializes the 'SmashConfig' for Pruna, specifying optimization algorithms like 'hqq_diffusers' and 'torch_compile'. This configuration is crucial for defining how the model will be optimized. Advanced users can uncomment options for further speedups. ```python from pruna import SmashConfig smash_config = SmashConfig(["hqq_diffusers", "torch_compile"]) # smash_config.add({'torch_compile_mode': 'max-autotune'}) # Uncomment to enable extra speedups ``` -------------------------------- ### Install Pruna Package Source: https://docs.pruna.ai/en/stable/docs_pruna/tutorials/asr_tutorial Installs the latest version of the `pruna` package. Ensure you are using a compatible version for the tutorial. This is a prerequisite for running the optimization and transcription functions. ```python # if you are not running the latest version of this tutorial, make sure to install the matching version of pruna # the following command will install the latest version of pruna %pip install pruna ``` -------------------------------- ### Import and Use Pruna Pro Smash Function Source: https://docs.pruna.ai/en/stable/docs_pruna_pro/user_manual/pruna_pro Demonstrates how to import the 'smash' function from 'pruna_pro' and use it with a model, configuration, and a Pruna Pro token for advanced compression. ```python from pruna_pro import smash smashed_model = smash( model=pipe, smash_config=smash_config, token='' ) ``` -------------------------------- ### Initialize Pruna SmashConfig for Model Optimization Source: https://docs.pruna.ai/en/stable/docs_pruna_pro/tutorials/video Initializes the SmashConfig object from the pruna_pro package. This configuration includes settings for automatic optimization, such as cache mode and speed factor, and enables torch.compile for further performance enhancements. ```python from pruna_pro import SmashConfig, smash # Initialize the SmashConfig smash_config = SmashConfig({ "auto": { "cache_mode": "taylor", "speed_factor": 0.42 }, "torch_compile": {}, }) ``` -------------------------------- ### Step 5: Run Inference with Optimized Model Source: https://docs.pruna.ai/en/stable/docs_pruna/user_manual/smash This code shows how to perform inference using an optimized model loaded via `PrunaModel`. It includes setting progress bar configurations and running the model with a sample prompt to generate an image. ```python from pruna.engine.pruna_model import PrunaModel # Load the optimized model optimized_model = PrunaModel.from_pretrained("PrunaAI/Segmind-Vega-smashed") optimized_model.set_progress_bar_config(disable=True) prompt = "A serene landscape with mountains" optimized_model(prompt).images[0].save("output.png") ``` -------------------------------- ### Example Telemetry Metrics Output Source: https://docs.pruna.ai/en/stable/docs_pruna/contributions/telemetry This snippet shows an example of the output format for telemetry metrics, indicating function executions, smash configurations, and success status. It is useful for understanding the data collected by the Pruna telemetry system. ```text pruna_function_calls_total{function="test_metrics_integration.test_otlp_export_to_collector..test_decorated_function",job="unknown_service",session_id="7bb23832-d733-4404-b43e-7eea8c0b872e",smash_config="",status="success"} 12 pruna_function_calls_total{function="test_operation",job="unknown_service",session_id="7bb23832-d733-4404-b43e-7eea8c0b872e",smash_config="the best config",status="success"} 15 pruna_function_calls_total{function="test_operation",job="unknown_service",session_id="7bb23832-d733-4404-b43e-7eea8c0b872e",smash_config="the worse config",status="error"} 5 ``` -------------------------------- ### Example MetricResult Instance (Python) Source: https://docs.pruna.ai/en/stable/docs_pruna/user_manual/evaluate Provides an example of a MetricResult object. This object contains the name of the evaluated metric ('clip_score'), any associated parameters used during evaluation, and the final computed result value. ```python # Example output MetricResult( name="clip_score", params={"param1": "value1", "param2": "value2"}, result=28.0828 ) ```