boss_bench.models#
Trained models from the BoSS paper, in PyTorch.
- boss_bench.models.download(name, path, onnx=False)[source]#
Download a trained PyTorch or ONNX model baseline from Hugging Face.
Three models are available:
"loss_fraction"(LossFractionModel), a neural surrogate which predicts the loss fraction of the alpha particles born on \(s_0 = 0.1\) from the plasma boundary and profiles, without a VMEC run."heat_flux"(HeatFluxModel), a flow matching model which samples the locations at which lost fast ions strike the boundary."inverse_design"(InverseDesignModel), a flow matching model which generates plasma boundaries with a desired loss fraction, shape, field and profiles.
This function downloads the model’s
config.jsonandmodel.safetensorsinto the folderpath, which the model’sloadthen reads, e.g.HeatFluxModel.load(path). Withonnx=True, it also downloads the model’s ONNX export, to run with ONNX Runtime:model.onnx, orencoder.onnx,velocity.onnxanddecoder.onnxfor the two flow matching models;config.jsondescribes their inputs. Files already in the folder are not downloaded again.- Parameters:
name (str) –
"loss_fraction","heat_flux"or"inverse_design".path (str) – the folder to download the model into; it is created if needed.
onnx (bool) – whether to also download the ONNX files.
- Returns:
path.- Return type:
str
- Raises:
ValueError – if the model name is unknown.