Overview
The state management API provides comprehensive tools for managing ML workflow sessions, including dataset configurations, model libraries, training configurations, experiments, and session persistence.Workflow State
init_workflow_state()
Initialize workflow state with default values. Automatically loads persisted sessions if available.app/state/workflow.py:54
generate_session_id()
Generate a bird-based session ID for easy identification.str - A unique, human-readable session identifier
File reference: app/state/workflow.py:104
Session Management
get_session_id()
Get the current session ID.str - Current session identifier
File reference: app/state/workflow.py:113
clear_workflow_state()
Clear all workflow-related session state and reinitialize with fresh values.app/state/workflow.py:419
Dataset Configuration
save_dataset_config(config)
Save dataset configuration to session state and persist to disk.Dataset configuration dictionary containing paths, splits, and preprocessing settings
app/state/workflow.py:119
get_dataset_config()
Retrieve the current dataset configuration.dict[str, Any] - Dataset configuration dictionary
File reference: app/state/workflow.py:131
has_dataset_config()
Check if dataset is configured.bool - True if dataset configuration exists
File reference: app/state/workflow.py:136
Model Library
add_model_to_library(name, config)
Add a new model to the library.Human-readable name for the model
Model configuration dictionary with architecture and hyperparameters
str - Unique model ID
File reference: app/state/workflow.py:247
get_model_from_library(model_id)
Get a model by ID from the library.Unique model identifier
dict[str, Any] | None - Model dictionary or None if not found
File reference: app/state/workflow.py:262
update_model_in_library(model_id, name, config)
Update an existing model in the library.Model identifier to update
New name for the model
Updated model configuration
bool - True if model was found and updated
File reference: app/state/workflow.py:270
delete_model_from_library(model_id)
Delete a model from the library.Model identifier to delete
bool - True if model was found and deleted
File reference: app/state/workflow.py:282
get_model_library()
Get all models in the library.list[dict[str, Any]] - List of all model dictionaries
File reference: app/state/workflow.py:293
Training Library
add_training_to_library(name, config)
Add a new training configuration to the library.Human-readable name for the training configuration
Training configuration with hyperparameters and settings
str - Unique training configuration ID
File reference: app/state/workflow.py:303
get_training_library()
Get all training configurations in the library.list[dict[str, Any]] - List of all training configuration dictionaries
File reference: app/state/workflow.py:349
Experiments
create_experiment(name, model_id, training_id)
Create a new experiment by combining a model and training configuration.Human-readable experiment name
Model identifier from library
Training configuration identifier from library
str - Unique experiment ID
File reference: app/state/workflow.py:359
get_experiment(exp_id)
Get an experiment by ID.Experiment identifier
dict[str, Any] | None - Experiment dictionary or None if not found
Experiment Status Values:
ready- Ready to start trainingtraining- Currently trainingpaused- Training pausedcompleted- Training finished successfullyfailed- Training failed with error
app/state/workflow.py:380
update_experiment(exp_id, updates)
Update experiment fields.Experiment identifier
Dictionary of fields to update
bool - True if experiment was found and updated
File reference: app/state/workflow.py:388
delete_experiment(exp_id)
Delete an experiment.Experiment identifier to delete
bool - True if experiment was found and deleted
File reference: app/state/workflow.py:398
get_experiments()
Get all experiments.list[dict[str, Any]] - List of all experiment dictionaries
File reference: app/state/workflow.py:409
Session Persistence
save_session(session_id)
Save current session state to disk.Session identifier to save
bool - True if saved successfully
File reference: app/state/persistence.py:23
load_session(session_id)
Load session state from disk into st.session_state.Session identifier to load
bool - True if loaded successfully
File reference: app/state/persistence.py:66
list_saved_sessions()
Get list of all saved session IDs, sorted by modification time (newest first).list[str] - List of session IDs
File reference: app/state/persistence.py:110
delete_session(session_id)
Delete a saved session file.Session identifier to delete
bool - True if deleted successfully
File reference: app/state/persistence.py:136
Cache Management
get_dataset_info()
Get cached dataset scan information.DatasetInfo | None - Cached dataset information or None
DatasetInfo Structure:
total_train: int- Total training samplestotal_val: int- Total validation samplesclasses: list[str]- List of class namestrain_samples: dict[str, int]- Samples per class in training setval_samples: dict[str, int]- Samples per class in validation setsample_paths: dict[str, list[Path]]- Sample image paths per class
app/state/cache.py:49
set_dataset_info(info)
Cache dataset scan information.Dataset information dictionary to cache
app/state/cache.py:54
clear_cache_state()
Clear all cached data and reinitialize with defaults.app/state/cache.py:109
WorkflowState Type
Type definition for workflow state fields:app/state/workflow.py:33