From c0fd27da078d480cae05344d3e4c13cf4a59230b Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Tue, 17 Feb 2026 20:22:02 -0800 Subject: [PATCH] Remove the hard coded block for feature count and disable CUDA --- WebServer/AIPython/ai-predictor.py | 1 + WebServer/AIPython/ai-trainer.py | 3 ++- dockerfile | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/WebServer/AIPython/ai-predictor.py b/WebServer/AIPython/ai-predictor.py index 11a78142..de9e27fb 100644 --- a/WebServer/AIPython/ai-predictor.py +++ b/WebServer/AIPython/ai-predictor.py @@ -1,4 +1,5 @@ import os +os.environ["CUDA_VISIBLE_DEVICES"] = "-1" import yfinance as yf import features import matplotlib diff --git a/WebServer/AIPython/ai-trainer.py b/WebServer/AIPython/ai-trainer.py index 142b83a2..c747be67 100644 --- a/WebServer/AIPython/ai-trainer.py +++ b/WebServer/AIPython/ai-trainer.py @@ -3,6 +3,7 @@ import numpy as np import matplotlib.pyplot as plt import datapuller import os +os.environ["CUDA_VISIBLE_DEVICES"] = "-1" from sklearn.model_selection import train_test_split from keras import Sequential, layers, optimizers @@ -31,7 +32,7 @@ def TrainAI(): # Start with a linear model dnn_linear_model = Sequential([ - layers.Input(shape=(9,)), # Explicitly tell Keras there are 9 features + layers.Input(shape=(train_features.shape[1],)), # Load the feature count dynamically normalizer, layers.Dense(64, activation='relu'), layers.Dense(64, activation='relu'), diff --git a/dockerfile b/dockerfile index 714203d3..1e518978 100644 --- a/dockerfile +++ b/dockerfile @@ -58,8 +58,9 @@ RUN wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz && \ ln -s /usr/local/bin/python3.11 /usr/local/bin/python && \ ln -s /usr/local/bin/pip3.11 /usr/local/bin/pip +# Dont use CUDA for the tensorflow as the CPU is way faster for this smaller workload RUN pip install --upgrade pip && \ - pip install tensorflow[and-cuda] \ + pip install tensorflow \ fastparquet \ openpyxl \ yfinance \