From a005a4a98a5a0626f6e1de353de2056523212c6c Mon Sep 17 00:00:00 2001 From: Antoine Date: Wed, 26 Nov 2025 16:42:39 -0500 Subject: [PATCH] feat: Add complete requirements and installation scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - requirements.txt: Added all dependencies including PyTorch, torch-geometric, tensorboard for neural network training - install.bat: One-click installation script that installs all dependencies with proper version constraints - train_neural.bat: Training script that runs parametric neural network training on collected FEA data Usage: 1. Double-click install.bat to install dependencies 2. Double-click train_neural.bat to train on bracket study 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- install.bat | 114 ++++++++++++++++++++++++++++++++++++++++++++++ requirements.txt | 65 +++++++++++++++++++++++---- train_neural.bat | 115 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 285 insertions(+), 9 deletions(-) create mode 100644 install.bat create mode 100644 train_neural.bat diff --git a/install.bat b/install.bat new file mode 100644 index 00000000..e67cb962 --- /dev/null +++ b/install.bat @@ -0,0 +1,114 @@ +@echo off +REM ============================================================================ +REM Atomizer Installation Script +REM ============================================================================ +REM This script installs all dependencies for Atomizer including neural networks +REM +REM Prerequisites: +REM - Python 3.10+ installed +REM - pip available in PATH +REM +REM For GPU support, run this BEFORE the script: +REM pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 +REM ============================================================================ + +echo. +echo ============================================================================ +echo ATOMIZER INSTALLATION +echo ============================================================================ +echo. + +REM Check Python +python --version >nul 2>&1 +if errorlevel 1 ( + echo ERROR: Python not found in PATH + echo Please install Python 3.10+ and add it to PATH + pause + exit /b 1 +) + +echo Found Python: +python --version +echo. + +REM Upgrade pip +echo Upgrading pip... +python -m pip install --upgrade pip +echo. + +REM Install core dependencies +echo Installing core dependencies... +python -m pip install numpy">=1.24.0,<2.0.0" scipy pandas scikit-learn +echo. + +REM Install optimization framework +echo Installing optimization framework... +python -m pip install optuna plotly matplotlib +echo. + +REM Install FEA tools +echo Installing FEA/Nastran tools... +python -m pip install "pyNastran>=1.4.0,<1.5.0" h5py +echo. + +REM Install web framework +echo Installing web framework... +python -m pip install fastapi uvicorn websockets pydantic python-multipart jinja2 +echo. + +REM Install utilities +echo Installing utilities... +python -m pip install psutil tqdm +echo. + +REM Install PyTorch (CPU version by default) +echo. +echo ============================================================================ +echo Installing PyTorch... +echo ============================================================================ +echo. +echo NOTE: Installing CPU version. For GPU support, run: +echo pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 +echo. +python -m pip install torch +echo. + +REM Install PyTorch Geometric +echo Installing PyTorch Geometric (Graph Neural Networks)... +python -m pip install torch-geometric +echo. + +REM Install TensorBoard +echo Installing TensorBoard... +python -m pip install tensorboard +echo. + +REM Verify installation +echo. +echo ============================================================================ +echo Verifying installation... +echo ============================================================================ +echo. +python -c "import numpy; import optuna; import torch; import torch_geometric; print('All core imports OK!')" +if errorlevel 1 ( + echo. + echo WARNING: Some packages may not have installed correctly + echo Please check the error messages above +) else ( + echo. + echo ============================================================================ + echo INSTALLATION COMPLETE! + echo ============================================================================ + echo. + echo Atomizer is ready to use. + echo. + echo To train a neural network: + echo train_neural.bat + echo. + echo To run an optimization study: + echo cd studies\your_study + echo python run_optimization.py --run --trials 100 + echo. +) + +pause diff --git a/requirements.txt b/requirements.txt index f8dee927..d9a8283b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,52 @@ -# Core Dependencies -optuna>=3.5.0 -pandas>=2.0.0 -numpy>=1.24.0 -scipy>=1.10.0 -scikit-learn>=1.3.0 -pyNastran>=1.4.0 -plotly>=5.18.0 +# Atomizer - Complete Requirements +# ================================= +# LLM-native FEA optimization framework with Neural Network acceleration +# +# Installation: +# pip install -r requirements.txt +# +# For GPU support (recommended for neural training): +# pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121 +# pip install torch-geometric +# +# Note: numpy<2.0 required for pyNastran compatibility -# Web Framework +# ============================================================================ +# Core Scientific Computing +# ============================================================================ +numpy>=1.24.0,<2.0.0 +scipy>=1.10.0 +pandas>=2.0.0 +scikit-learn>=1.3.0 + +# ============================================================================ +# Optimization Framework +# ============================================================================ +optuna>=3.5.0 +plotly>=5.18.0 +matplotlib>=3.5.0 + +# ============================================================================ +# FEA/Nastran Integration +# ============================================================================ +pyNastran>=1.4.0,<1.5.0 +h5py>=3.0.0 + +# ============================================================================ +# Neural Network / AtomizerField +# ============================================================================ +# PyTorch - Deep learning framework +torch>=2.0.0 + +# PyTorch Geometric - Graph neural networks +torch-geometric>=2.3.0 + +# TensorBoard - Training visualization +tensorboard>=2.13.0 + +# ============================================================================ +# Web Framework (Dashboard/API) +# ============================================================================ fastapi>=0.109.0 uvicorn>=0.27.0 websockets>=12.0 @@ -15,7 +54,15 @@ pydantic>=2.5.0 python-multipart>=0.0.6 jinja2>=3.1.3 +# ============================================================================ +# System Utilities +# ============================================================================ +psutil>=5.9.0 +tqdm>=4.65.0 + +# ============================================================================ # Development Tools (optional) +# ============================================================================ pytest>=7.4.0 pytest-cov>=4.1.0 black>=23.12.0 diff --git a/train_neural.bat b/train_neural.bat new file mode 100644 index 00000000..a84945ae --- /dev/null +++ b/train_neural.bat @@ -0,0 +1,115 @@ +@echo off +REM ============================================================================ +REM Atomizer Neural Network Training Script +REM ============================================================================ +REM Trains a parametric neural network on collected FEA data +REM +REM Usage: +REM train_neural.bat (uses default: bracket study) +REM train_neural.bat study_name (specify study name) +REM train_neural.bat study_name 200 (specify epochs) +REM ============================================================================ + +echo. +echo ============================================================================ +echo ATOMIZER NEURAL NETWORK TRAINING +echo ============================================================================ +echo. + +REM Set defaults +set STUDY_NAME=bracket_stiffness_optimization_atomizerfield +set EPOCHS=100 + +REM Parse arguments +if not "%~1"=="" set STUDY_NAME=%~1 +if not "%~2"=="" set EPOCHS=%~2 + +set TRAIN_DIR=atomizer_field_training_data\%STUDY_NAME% +set OUTPUT_DIR=atomizer-field\runs\%STUDY_NAME% + +echo Study: %STUDY_NAME% +echo Epochs: %EPOCHS% +echo Train Dir: %TRAIN_DIR% +echo Output: %OUTPUT_DIR% +echo. + +REM Check training data exists +if not exist "%TRAIN_DIR%" ( + echo ERROR: Training data not found at %TRAIN_DIR% + echo. + echo Available training data directories: + dir atomizer_field_training_data /b 2>nul + echo. + pause + exit /b 1 +) + +REM Count trials +echo Counting training trials... +set /a count=0 +for /d %%d in ("%TRAIN_DIR%\trial_*") do set /a count+=1 +echo Found %count% trials +echo. + +if %count% LSS 20 ( + echo WARNING: Less than 20 trials. Training may not converge well. + echo Consider running more FEA simulations first. + echo. +) + +REM Check PyTorch +python -c "import torch; print(f'PyTorch {torch.__version__}')" 2>nul +if errorlevel 1 ( + echo ERROR: PyTorch not installed + echo Run install.bat first + pause + exit /b 1 +) + +REM Check for GPU +echo. +echo Checking for GPU... +python -c "import torch; print(f'CUDA available: {torch.cuda.is_available()}'); print(f'Device: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else \"CPU\"}')" +echo. + +REM Start training +echo ============================================================================ +echo Starting training... +echo ============================================================================ +echo. +echo Press Ctrl+C to stop training early (checkpoint will be saved) +echo. + +cd atomizer-field +python train_parametric.py ^ + --train_dir "..\%TRAIN_DIR%" ^ + --epochs %EPOCHS% ^ + --output_dir "runs\%STUDY_NAME%" ^ + --batch_size 16 ^ + --learning_rate 0.001 ^ + --hidden_channels 128 ^ + --num_layers 4 + +if errorlevel 1 ( + echo. + echo Training failed! Check error messages above. + cd .. + pause + exit /b 1 +) + +cd .. + +echo. +echo ============================================================================ +echo TRAINING COMPLETE! +echo ============================================================================ +echo. +echo Model saved to: %OUTPUT_DIR%\checkpoint_best.pt +echo. +echo To use the trained model in optimization: +echo cd studies\%STUDY_NAME% +echo python run_optimization.py --run --trials 100 --enable-nn --resume +echo. + +pause