Skip to content

Commit 8b6c120

Browse files
committed
Export _outside_ dataset folder by default
1 parent 23d19e4 commit 8b6c120

File tree

2 files changed

+27
-11
lines changed

2 files changed

+27
-11
lines changed

crates/brush-process/src/config.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,14 @@ pub struct ProcessConfig {
1919
/// Export every this many steps.
2020
#[arg(long, help_heading = "Process options", default_value = "5000")]
2121
pub export_every: u32,
22-
/// Location to put exported files. By default uses the data directory if available,
23-
/// or the CWD otherwise. This can be set as a relative path.
24-
#[arg(long, help_heading = "Process options", default_value = "./")]
22+
/// Location to put exported files. Supports {dataset} interpolation for the dataset
23+
/// folder name. Path is relative to the dataset's parent directory (or CWD if unavailable).
24+
/// Use "./{dataset}/" to export inside the dataset folder.
25+
#[arg(
26+
long,
27+
help_heading = "Process options",
28+
default_value = "./{dataset}_exports/"
29+
)]
2530
pub export_path: String,
2631
/// Filename of exported ply file
2732
#[arg(

crates/brush-process/src/train_stream.rs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,25 @@ pub(crate) async fn train_stream(
149149
let bounds = get_splat_bounds(init_splats.clone(), BOUND_PERCENTILE).await;
150150
let mut trainer = SplatTrainer::new(&train_stream_config.train_config, &device, bounds);
151151

152-
let export_path = if let Some(base_path) = vfs.base_path() {
153-
base_path.join("exports")
154-
} else {
155-
// Defaults to CWD.
156-
PathBuf::from("./")
157-
};
158-
159-
let export_path = export_path.join(&train_stream_config.process_config.export_path);
152+
// Get the dataset name from the base path (if available) for interpolation.
153+
let dataset_name = vfs
154+
.base_path()
155+
.and_then(|p| p.file_name().map(|s| s.to_string_lossy().into_owned()))
156+
.unwrap_or_else(|| "dataset".to_owned());
157+
158+
// Interpolate {dataset} in the export path.
159+
let export_path_str = train_stream_config
160+
.process_config
161+
.export_path
162+
.replace("{dataset}", &dataset_name);
163+
164+
// Resolve relative to the dataset's parent directory if available, otherwise CWD.
165+
let base_path = vfs
166+
.base_path()
167+
.and_then(|p| p.parent().map(|p| p.to_path_buf()))
168+
.unwrap_or_else(|| PathBuf::from("."));
169+
170+
let export_path = base_path.join(&export_path_str);
160171
// Normalize path components
161172
let export_path: PathBuf = export_path.components().collect();
162173

0 commit comments

Comments
 (0)