mattbitzesty commited on
Commit
cadd6b1
Β·
unverified Β·
1 Parent(s): ce7886d

docs(readme): overhaul public README for HF source repo

Browse files

- Add quick-start install, dataset generation, and HF Jobs training commands.
- Document repository layout and key design decisions.
- Include telemetry verification checklist for the first HF training run.

Files changed (1) hide show
  1. README.md +52 -32
README.md CHANGED
@@ -1,52 +1,72 @@
1
  # PINO β€” Physics-Informed Neural Olfaction
2
 
3
- Foundational thermodynamic engine and evaporation verifier for time-resolved fragrance evaluation.
4
 
5
- ## Milestone 1: Thermodynamic Engine & Synthetic Formula Verifier
6
 
7
- - `src/pino/structures.py` β€” RDKit/ugropy structure handling and UNIFAC group extraction.
8
- - `src/pino/vle.py` β€” Dortmund-Modified UNIFAC activity coefficients and non-ideal VLE.
9
- - `src/pino/evaporation.py` β€” Stiff ODE evaporation kinetics via `scipy.integrate`.
10
- - `src/pino/verifier.py` β€” High-level verifier producing `trajectory_output.json`.
11
- - `src/pino/models.py` β€” Pydantic/dataclass domain models.
12
- - `tests/test_pino.py` β€” Passing pytest suite for the classic 5-component accord in ethanol.
13
 
14
- ## Run the test suite
 
 
 
 
 
15
 
16
  ```bash
17
- cd /home/hermes/pino
 
18
  source .venv/bin/activate
 
 
 
19
  python -m pytest tests/ -v
20
- ```
21
 
22
- ## Generate the deterministic trajectory artifact
 
23
 
24
- ```bash
25
- cd /home/hermes/pino
26
- source .venv/bin/activate
27
- PYTHONPATH=src python -c "from pino.verifier import verify_formula_dict; import json, numpy as np; ..."
 
 
 
 
 
 
 
28
  ```
29
 
30
- The output file `trajectory_output.json` contains liquid mole fractions (`x_liquid`), gas-phase concentrations (`C_gas_mg_m3`), gas mole fractions (`y_gas_mole_fraction`), and Odor Activity Values (`OAV`) over 0–28,800 seconds (8 hours) at 60-second intervals.
31
 
32
- ## Milestone 5: Generative Inverse-Design Composer
 
 
 
 
 
 
 
 
 
33
 
34
- - `src/pino/optimizer.py` β€” CMA-ES-based `FormulationOptimizer` that evolves ingredient weight fractions against a sensory target.
35
- - `src/pino/cli.py` β€” adds `pino-critic compose` for agentic formula generation.
36
- - `run_generation.py` β€” reference end-to-end script that writes `data/generated_recipe_output.json`.
37
- - `data/design_brief.json` β€” example design brief (Citrus Summer Cologne).
38
 
39
- ### Generate a recipe
 
 
 
 
 
40
 
41
- ```bash
42
- cd /home/hermes/pino
43
- source .venv/bin/activate
44
- PYTHONPATH=src python run_generation.py --brief data/design_brief.json
45
- ```
46
 
47
- The composer enforces IFRA Category 4 limits, normalises every candidate to 100% mass, and scores candidates using the PIMT transformer critic. Generated recipes include an 8-hour physical dry-down trajectory and are saved to `data/generated_recipe_output.json`.
 
 
 
48
 
49
- ## Design constraints honored
50
 
51
- - Activity coefficients are computed with **Dortmund-Modified UNIFAC** (`thermo.unifac`); Raoult's law is not used.
52
- - Evaporation kinetics are solved with **scipy stiff integration** (`BDF`), not fixed Euler.
 
1
  # PINO β€” Physics-Informed Neural Olfaction
2
 
3
+ End-to-end fragrance intelligence: from molecular structure and Dortmund-UNIFAC thermodynamics to a multi-task transformer that predicts time-resolved odor trajectories.
4
 
5
+ ## What it does
6
 
7
+ PINO combines a first-principles evaporation engine with a Physics-Informed Mixture Transformer (PIMT):
 
 
 
 
 
8
 
9
+ 1. **Thermodynamic simulation** β€” Dortmund-Modified UNIFAC activity coefficients, stiff ODE evaporation, and headspace concentration profiles.
10
+ 2. **Empirical bootstrap dataset** β€” 5,600+ real-world records (single-molecule controls + multi-component blends), all cut with a commercial 15% concentrate / 85% ethanol solvent envelope and padded to a fixed 49-step temporal grid.
11
+ 3. **Multi-task transformer** β€” predicts objective odor trajectories, seasonality, gender/wearability profiles, and continuous alignment to the Principal Odor Map using an adaptive loss balancer.
12
+ 4. **Formula generation** β€” CMA-ES-based inverse-design composer that evolves blends against a sensory brief while respecting IFRA limits.
13
+
14
+ ## Quick start
15
 
16
  ```bash
17
+ # Install
18
+ python -m venv .venv
19
  source .venv/bin/activate
20
+ pip install -e .
21
+
22
+ # Run tests
23
  python -m pytest tests/ -v
 
24
 
25
+ # Generate the empirical dataset (5,600+ records, ~10 min on CPU)
26
+ python scripts/generate_empirical_bootstrap.py --output data/empirical_dataset_v1.jsonl
27
 
28
+ # Train locally (5 epochs, smoke-test config)
29
+ python src/pino/train.py --epochs 5 --smoke-test
30
+
31
+ # Train on Hugging Face Jobs GPU cluster
32
+ hf jobs run -d --flavor t4-small --timeout 7200 \
33
+ --secrets HF_TOKEN \
34
+ pytorch/pytorch:2.3.0-cuda12.1-cudnn8-runtime \
35
+ bash -c "apt-get update -qq && apt-get install -y -qq git && \
36
+ git clone https://huggingface.co/mattbitzesty/pino-source-code /workspace/pino && \
37
+ cd /workspace/pino && pip install -e . && \
38
+ python scripts/hf_train_job.py"
39
  ```
40
 
41
+ ## Repository layout
42
 
43
+ | Path | Purpose |
44
+ |------|---------|
45
+ | `src/pino/thermo/` | VLE, evaporation, IFRA, natural-oil profiles, OAV semantics |
46
+ | `src/pino/pimt_model.py` | `FragranceTrajectoryDataset` and `PhysicsInformedMixtureTransformer` |
47
+ | `src/pino/train.py` | Training loop with `AdaptiveLossBalancer` and molecule-disjoint split |
48
+ | `src/pino/heads.py` | PIMT output heads: objective, subjective, continuous alignment |
49
+ | `src/pino/optimizer.py` / `cli.py` | Generative inverse-design composer |
50
+ | `scripts/` | Dataset generation, HF job entrypoint, diagnostic scripts |
51
+ | `data/` | Registry, empirical dataset, literature formulas, Pyrfume annotations |
52
+ | `tests/` | Pytest suite for the thermodynamic engine |
53
 
54
+ ## Key design decisions
 
 
 
55
 
56
+ - **Natural oils are expanded** into pure constituent CASes before VLE so the engine runs real Dortmund-UNIFAC instead of falling back to Raoult's law.
57
+ - **All formulas are treated as 15% perfume oil concentrate + 85% ethanol**, mirroring real commercial fragrance products.
58
+ - **Molecule-disjoint train/validation split** prevents data leakage: if a molecule appears in a training formula, it never appears in validation.
59
+ - **597 pure single-molecule controls are pinned exclusively to training** to anchor baseline behavior.
60
+ - **Adaptive loss balancing** (4 tasks: objective MSE, seasonality, wearability, continuous alignment) removes hand-tuned loss coefficients.
61
+ - **Continuous alignment head** replaces the legacy InfoNCE contrastive head with dense cosine similarity on the Principal Odor Map.
62
 
63
+ ## Telemetry to verify on first HF training run
 
 
 
 
64
 
65
+ - **Step 1:** `AdaptiveLossBalancer` weights should be uniform (~0.25 each).
66
+ - **Step 10:** weights should shift dynamically as tasks progress at different rates.
67
+ - **Alignment loss:** starts near 1.0 and trends downward as the backbone organizes odor descriptors.
68
+ - **Validation loss:** reflects only unseen multi-component blends because controls are held out of the validation set.
69
 
70
+ ## License
71
 
72
+ MIT β€” see `LICENSE`.