Skip to content

fix(genai): standardize .env pattern + helpers (Issue #78) - #87

Closed
jsboige wants to merge 3 commits into
mainfrom
fix/genai-orphan-commits-68
Closed

jsboige wants to merge 3 commits into
mainfrom
fix/genai-orphan-commits-68

Conversation

@jsboige

@jsboige jsboige commented Mar 15, 2026

Copy link
Copy Markdown
Owner

Summary

Standardisation du pattern de chargement .env pour tous les notebooks GenAI vers Pattern A (Papermill-safe).

Changes

  • 23 notebooks migrés vers Pattern A (while loop avec env_loaded)
  • genai_helpers.py corrigé avec le bon pattern
  • .gitignore mis à jour pour exclure les fichiers .backup

Pattern A (nouveau standard)

current_path = Path.cwd()
env_loaded = False
while current_path.name != "GenAI" and len(current_path.parts) > 1:
    env_path = current_path / ".env"
    if env_path.exists():
        load_dotenv(env_path)
        print(f".env charge depuis: {env_path}")
        env_loaded = True
        break
    current_path = current_path.parent
if not env_loaded:
    print("WARNING: .env non trouve, utilisation variables environnement")

Pourquoi Pattern A ?

  • ✅ Fonctionne avec Papermill (qui change le CWD)
  • ✅ Remonte l'arborescence automatiquement
  • ✅ Prévient les erreurs "WARNING: .env non trouve"

Affected notebooks (23)

Category Count
00-GenAI-Environment 4
EPF 3
Image 1
SemanticKernel 13
Texte 1
Video 1

Total GenAI notebooks: 101 (64 étaient déjà en Pattern A)

Test Plan

  • Validation syntaxe notebooks (notebook_tools.py)
  • Test execution Papermill sur un notebook de chaque catégorie

Related Issues


Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

jsboige and others added 3 commits March 15, 2026 20:33
#78)

- Migrate 23 notebooks from Pattern C/D/E to Pattern A (while loop)
- Update genai_helpers.py with correct Pattern A implementation
- Add *.ipynb.backup to .gitignore

Pattern A (Papermill-safe) is now the standard for all 101 GenAI notebooks:
- Walks up directory tree until "GenAI" folder found
- Works correctly when Papermill changes CWD
- Prevents "WARNING: .env non trouve" errors

Affected categories:
- 00-GenAI-Environment (4 notebooks)
- EPF (3 notebooks)
- Image (1 notebook)
- SemanticKernel (13 notebooks)
- Texte (1 notebook)
- Video (1 notebook)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tern A)

Critical bug fix for PR #87 - 3 notebooks had undefined GENAI_ROOT reference:
- 01-1-OpenAI-DALL-E-3.ipynb
- 01-2-GPT-5-Image-Generation.ipynb
- 01-3-Basic-Image-Operations.ipynb

Changed: GENAI_ROOT = GENAI_ROOT.parent (undefined)
To: current_path (defined in Pattern A while loop)

Also replaced all GENAI_ROOT / path references with current_path /

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- 01-5-Qwen-Image-Edit.ipynb: add from pathlib import Path
- 02-1-Qwen-Image-Edit-2509.ipynb: add Path, Dict, datetime imports + fix formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jsboige

jsboige commented Mar 16, 2026

Copy link
Copy Markdown
Owner Author

Supplanteee par PR #94 (approche propre). Fermeture conforme a la directive.

@jsboige jsboige closed this Mar 16, 2026
@jsboige
jsboige deleted the fix/genai-orphan-commits-68 branch March 19, 2026 02:17
jsboige added a commit that referenced this pull request Jun 14, 2026
…See #1203) (#2964)

* docs(search): add Part4-Metaheuristics entry point for MetaGeneticSharp (#1203)

Light entry point that closes the CoursIA <-> fork loop for the
MetaGeneticSharp side track. Creates Search/Part4-Metaheuristics/ (was
empty) with a README that:

- Positions MGS against GeneticSharp / mealpy / HeuristicLab (components
  over metaphors; mealpy-grade expressiveness over GeneticSharp's
  representation-agnostic components).
- Links the 4 existing .NET Interactive notebooks (MGS-1..4) in
  MetaGeneticSharp-Notebooks/ — all verified GREEN end-to-end on the
  .net-csharp kernel (re-executed this cycle: 9-10/9-10 cells, 0 errors).
- Documents the .NET 9 + dotnet-interactive + submodule build setup
  (rule F: install the env, no workaround).
- Redirects to the fork (jsboige/MetaGeneticSharp) for full source, tests,
  ROADMAP, and GeneticSharp PR #87 origin.

Must-have #2 of the #1203 finalization mandate (4 notebooks GREEN was
already true on main; this adds the pedagogical entry point that connects
the Python Search series to the C# metaheuristics library).

See #1203.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(search): add MGS-5 Benchmarks notebook — primitives-based argument (#1203)

NB5 Benchmarks: the empirical demonstration that MetaGeneticSharp's
primitives-based design works. Compares 3 configurations of the same
MetaGeneticAlgorithm engine on 10 canonical continuous test functions:

- Uniform  (DefaultMetaHeuristic): bare GeneticSharp GA, no meta layer
- Islands  (IslandMetaHeuristic):  structured population with migration
- WOA-from-primitives (WhaleOptimisationAlgorithm.Build()): compound
  reconstructed from composable primitives (Match, IfElse, GeometricCrossover)

Results (Dim=5, Pop=60, 80 generations): WOA-from-primitives wins or ties
on 7/10 (Sphere -6.7e-10 ~= global optimum, Ackley -0.0001, Zakharov/Booth/
Dixon-Price convergent), diverges on Schwefel (deceptive multimodal, [-500,500]
amplitude -- honestly documented as No-Free-Lunch evidence + inspectability).
This directly answers the Sorensen 'metaphor exposed' critique: reconstructing
WOA from bricks is competitive AND inspectable, not an opaque black box.

Honest narrative (G.9): no config dominates everywhere = No-Free-Lunch made
tangible. WOA divergence on Schwefel explained via the readable bubble-net IfElse
flow (geometric control without bounds clamp on large-amplitude surfaces).

Pedagogy (C.1/C.2): executed end-to-end on .net-csharp kernel, 0 errors, 7/7
code cells with real outputs (exec_count 1-7). 3 exercises (multi-seed mean+/-std,
winner-heatmap uni/multi split, add EquilibriumOptimizer as 4th config). No
NotImplementedError. DoubleArrayChromosome defined inline with per-gene bounds +
randomizing CreateNew() (initial diversity required for the benchmark).

Consumes KnownFunctions.cs from fork (PR jsboige/MetaGeneticSharp#8, geometry-agnostic
via KnownFunctionGenes.AsDoubles). #r paths mirror MGS-1..4 convention (local fork
checkout c:/dev/MetaGeneticSharp, documented in Part4-Metaheuristics/README.md).
0 submodule change, 0 catalog churn.

See #1203

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Jun 15, 2026
…FromImage/FromFile (H2) (#3054)

Couples MGS-7 Mode 3 (CustomImage) to the H2 fork helpers: the bimodal
image is now wrapped through LandscapeMaps.CreateFunctionFromImage (in
memory) and CreateFunctionFromFile (saved to disk then reloaded, file
released after render -- no leak). The three landscape modes are now
symmetric first-class entry points: KnownFunction (KnownFunctionLandscape),
KnownHeightMap (CreateFunction), CustomImage (these helpers).

Wrapper stratum only: the pixel->elevation read stays jsboige's verbatim
ImageHeightMapFunction (byte-exact from GeneticSharp @ d05826fd, PR #87);
no map swapped, no math reimplemented.

Submodule bump cbcb00e -> cb96ec7c (fork PR #20, +8 tests, 80->88 green).
Papermill .net-csharp: exit 0, 10 code cells, 0 errors, 0 null exec_count,
9 inline graphic PNGs (Mode 3 now renders 2: in-memory + from-file).

See #1203

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jsboige added a commit that referenced this pull request Jun 22, 2026
…log (#1630) (#3934)

Consolidated doc batch for the #1630 backbone baseline sequence. Both
baselines merged to main without their catalog rows (#86 via #3919, #87 via
#3926); this PR backfills the Verified table, removes their Tier 4 (Untested)
entries, and records their Key-findings.

- Verified table: +2 rows (#86 MomentumRegime-AdaptiveWeights Sharpe -0.729
  Tier 4->3 double-defense; #87 TermStructureCommodities Sharpe -0.244
  CAGR -31.5% MaxDD 96.8% Tier 4->3 catastrophic).
- Tier 4 list: removed #86 + #87 (now verified).
- Key-findings: +#27 (double-defense composite destroys the SectorMomentum
  edge) and #28 (roll-yield signal catastrophically fails on the modern
  period, confirms the published library header).

Doc-only, 1 file. main.py-per-project + doc-consolidated-batch pattern
(established #1630 workflow). 0 CATALOG-STATUS markers touched.

See #1630

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
myia-ai-01 pushed a commit that referenced this pull request Jul 5, 2026
…d release) (#5381)

Bumps the Search/MetaGeneticSharp submodule pointer from 1ea0399ea
(v0.1.0~1) to 30c3993c7 (v0.1.0). Fast-forward of 2 commits, both
doc-only on the fork side:

  6be95c0 docs(release): RELEASE_NOTES.md for v0.1.0 (See CoursIA#1203)
  30c3993 Merge pull request #40 from jsboige/docs/release-notes-v0.1.0

v0.1.0 is the first public tagged release of the MetaGeneticSharp fork
(jsboige/MetaGeneticSharp). It revives the metaheuristics layer of the
closed-unmerged GeneticSharp PR #87 as an autonomous child library
consuming GeneticSharp v3.1.4 as a vanilla submodule. All 7 ROADMAP
phases DONE; library buildable, tested, exercised by 19 pedagogical
notebooks in Search/Part4-Metaheuristics.

No CoursIA code change -- only the submodule gitlink pointer moves.
CoursIA now tracks the tagged release.

See #1203

Co-authored-by: Claude-Code <noreply@anthropic.com>
myia-ai-01 pushed a commit that referenced this pull request Sep 24, 2026
…atteignent les notebooks (#17608)

Grain: MED/tooling -- lane myia-po-2027:CoursIA -- prev: MED/tooling #17603

5ad0c7b -> fddd586 (fork PR MyIntelligenceAgency/Z3.Linq#31, MERGED
2026-09-23T18:39:12Z). Le pointeur parent epinglait le correctif Int16
read-back (#32) et n'avait pas suivi le port du bornage (endjin#98, leur #87),
atterri apres lui : les notebooks chargeaient un DLL ou la seule protection
contre une valeur hors-plage etait le garde de lecture.

Le bump couvre aussi c613392 (fix(deploy,#17301)), reconstruction de
.deploy/Z3.Linq.dll : le binaire et les sources portent le meme etat.

Mesure a fddd586 : dotnet test 102 reussis / 0 echec ; .deploy/Z3.Linq.dll
(blob 1e1dc35, 56832 o) porte AssertBounds, GetBounds, SymbolType et ToInt16
dans ses metadonnees, et le fichier sur disque est byte-identique au blob.

Voir #17301.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
myia-ai-01 pushed a commit that referenced this pull request Oct 19, 2026
…r tracked branch tips (#21385)

semantic-fleet 991b09de82 -> 2a9d48b4a8 (stable-from-v0343, fast-forward, 3 commits):
CI label token (#102), MultiConnectorAnalysis perf assert (#87), BenchmarkDotNet
baseline (#18770). No runtime change for the notebooks.

Argumentum 06384966bc -> 0021dab96c (master, fast-forward, 6 commits):
DNN localisation (#458: pt-BR, fr-FR, ru-RU resx). Website only.

Drift measured by scripts/coordination/submodule_watch.py (PR #21350), cycle c2191.

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GenAI: Standardisation pattern .env sur 80 notebooks (5 patterns -> 1)

1 participant