aws-cdk-neuronx-patterns
Version:
> [!WARNING] > This library is experimental module.
108 lines (107 loc) • 3.68 kB
TypeScript
import { Size } from "aws-cdk-lib";
import * as ec2 from "aws-cdk-lib/aws-ec2";
import { IVpc, SubnetSelection } from "aws-cdk-lib/aws-ec2";
import { ContainerImage } from "aws-cdk-lib/aws-ecs";
import { IBucket } from "aws-cdk-lib/aws-s3";
import { Construct } from "constructs";
import { INeuronxInstanceType, IVllmInferenceNeuronxImage, Model } from "../base/neuronx";
import { INeuronxContainerImage, NeuronxCompiledModel } from "../base/neuronx-compiler";
import { VllmEngineArguments } from "../base/server-engine/vllm-engine";
import { VllmNxdInferenceEcsImageBase } from "./vllm-nxd-inference-ecs-patterns";
/**
* Compile runtime container image for vLLM NxD Inference
*/
export declare class VllmNxdInferenceCompileImage extends VllmNxdInferenceEcsImageBase {
/**
* The container image.
*/
readonly image: ContainerImage;
constructor(scope: Construct, id: string, vllmInferenceNeuronxImage?: IVllmInferenceNeuronxImage);
}
/**
* Props of VllmNxdInferenceCompiler.
*/
export interface VllmNxdInferenceCompileProps {
/**
* VPC in which this will launch compile worker instance.
*/
readonly vpc: IVpc;
/**
* The bucket to upload compiled artifacts.
*/
readonly bucket: IBucket;
/**
* The instance type of compile worker instance.
*/
readonly neuronxInstanceType?: INeuronxInstanceType;
/**
* The model to be compiled.
*/
readonly model: Model;
/**
* The root volume of worker instance.
* @default - N bilion parameters * 5GiB EBS
*/
readonly volumeSize?: Size;
/**
* Whether or not to use spot instances. Spot instances are less expensive EC2 instances that can be reclaimed by EC2 at any time; your job will be given two minutes of notice before reclamation.
*
* @default false
*/
readonly spot?: boolean;
/**
* The VPC Subnets this Compute Environment will launch instances in.
*
* @default - new subnets will be created
*/
readonly vpcSubnets?: SubnetSelection;
/**
* The environment variables to pass to the container.
* This is only applicable when using container runtime.
*
* @default - No environment variables.
*/
readonly environment?: {
[key: string]: string;
};
/**
* The arguments to pass to the vllm engine.
* @default - no specific values. use default values.
*/
readonly vllmArgs?: VllmEngineArguments;
/**
* An image of the container where the compile job is executed.
* @default - latest image
*/
readonly image?: INeuronxContainerImage;
/**
* The EC2 instance type to use for cross-compilation.
* This should be a non-Neuron instance type with sufficient memory for model compilation.
*
* @default - Automatically selected based on model size
*/
readonly compileInstanceType?: ec2.InstanceType;
}
/**
* The model compiled by Neuronx compiler.
*/
export interface VllmNxdInferenceCompiledModel extends NeuronxCompiledModel {
/**
* Passed to the vllm engine at compile time.
*/
readonly vllmArgs: VllmEngineArguments;
}
/**
* Neuronx compiler construct for vLLM on NxD Inference.
* Compile the model to work with Neuronx instance and upload it to an S3 bucket.
*/
export declare class VllmNxdInferenceCompiler extends Construct {
private readonly vllmArgs;
private readonly compiler;
constructor(scope: Construct, id: string, props: VllmNxdInferenceCompileProps);
/**
* Compile the model and return the compiled model.
* @returns The compiled model.
*/
compile(): VllmNxdInferenceCompiledModel;
}