pub struct Environment { /* private fields */ }Expand description
The environment structure.
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn save(&self) -> Result<(), Box<dyn Error>>
pub fn save(&self) -> Result<(), Box<dyn Error>>
Save the environment to the configuration file.
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new environment structure.
Examples found in repository?
examples/train-lora.rs (line 5)
3fn main() {
4 let kohya_ss = std::env::var("KOHYA_SS_PATH").expect("KOHYA_SS_PATH not set");
5 let environment = Environment::new().with_kohya_ss(kohya_ss);
6
7 let prompt = Prompt::new("bacana", "white dog");
8 let image_data_set = ImageDataSet::from_dir("examples/training/lora/bacana/images");
9 let data_set = TrainingDataSet::new(image_data_set);
10 let output = Output::new("{prompt.instance}({prompt.class})d{network.dimension}a{network.alpha}", "examples/training/lora/bacana/output");
11 let parameters = Parameters::new(prompt, data_set, output);
12
13 Trainer::new()
14 .with_environment(environment)
15 .start(¶meters);
16}Sourcepub fn with_kohya_ss(self, kohya_ss: impl Into<PathBuf>) -> Self
pub fn with_kohya_ss(self, kohya_ss: impl Into<PathBuf>) -> Self
Set the kohya_ss path.
Examples found in repository?
examples/train-lora.rs (line 5)
3fn main() {
4 let kohya_ss = std::env::var("KOHYA_SS_PATH").expect("KOHYA_SS_PATH not set");
5 let environment = Environment::new().with_kohya_ss(kohya_ss);
6
7 let prompt = Prompt::new("bacana", "white dog");
8 let image_data_set = ImageDataSet::from_dir("examples/training/lora/bacana/images");
9 let data_set = TrainingDataSet::new(image_data_set);
10 let output = Output::new("{prompt.instance}({prompt.class})d{network.dimension}a{network.alpha}", "examples/training/lora/bacana/output");
11 let parameters = Parameters::new(prompt, data_set, output);
12
13 Trainer::new()
14 .with_environment(environment)
15 .start(¶meters);
16}Sourcepub fn binary_path(&self) -> PathBuf
pub fn binary_path(&self) -> PathBuf
Get the kohya_ss path.
Sourcepub fn python_executable_path(&self) -> PathBuf
pub fn python_executable_path(&self) -> PathBuf
Get the kohya_ss path.
Sourcepub fn deactivate(&mut self)
pub fn deactivate(&mut self)
Deactivate the environment.
Trait Implementations§
Source§impl Debug for Environment
impl Debug for Environment
Source§impl Default for Environment
impl Default for Environment
Source§impl<'de> Deserialize<'de> for Environment
impl<'de> Deserialize<'de> for Environment
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Environment
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more