evox.algorithms.so.es_variants.virtual_lora_es#
模块内容#
类#
Virtual LoRA-based Evolution Strategy for neuroevolution. |
API#
- class evox.algorithms.so.es_variants.virtual_lora_es.VirtualLoRAES(param_shapes: list[tuple], lora_rank: int, pop_size: int, center_init: torch.Tensor, learning_rate: float, noise_stdev: float, optimizer: Literal[adam] | None = None, device: torch.device | None = None)[源代码]#
基础:
evox.core.AlgorithmVirtual LoRA-based Evolution Strategy for neuroevolution.
Instead of materializing a full (pop_size, dim) population, this algorithm stores a center vector (dim,) and per-individual seeds (pop_size,). Using the Philox counter-based PRNG and LoRA low-rank noise, per-individual weight perturbations are generated on-demand, achieving O(dim) memory instead of O(pop_size * dim).
For a 2D weight (d, k), rather than generating a full (d, k) noise matrix per individual, two low-rank factors A (rank, k) and B (d, rank) are sampled and combined as
delta_W = B @ A, reducing the search-space dimensionality fromd * ktorank * (d + k).The algorithm passes a
(center_flat, seeds, sigma)tuple toself.evaluate(), which the workflow routes to aVirtualLoRAProblemfor on-demand evaluation.初始化
Initialize the VirtualLoRAES algorithm with the given parameters.
- 参数:
param_shapes -- List of parameter shapes, e.g. [(256, 784), (256,), (10, 256), (10,)].
lora_rank -- LoRA rank for 2D weights (e.g. 4, 8, 16).
pop_size -- 种群大小。
center_init -- The initial center of the population. Must be a 1D tensor of length equal to the total number of parameters (sum of element counts over param_shapes).
learning_rate -- 优化器的学习率。
noise_stdev -- The standard deviation of the noise (sigma).
optimizer -- 使用的优化器(optimizer)。 默认情况下为 None。 仅 support "adam" 或 None。
device -- 设备的使用者(设备用于存放张量的硬件)。默认为 None。