diff --git a/Dockerfile.wandb b/Dockerfile.wandb new file mode 100644 index 0000000..4736f1d --- /dev/null +++ b/Dockerfile.wandb @@ -0,0 +1,15 @@ +# syntax=docker/dockerfile:1.4 + +FROM python:3.9-slim +RUN apt update && apt install gcc -y + +WORKDIR /launch + +COPY --link requirements.txt ./ +RUN pip install -r requirements.txt + +COPY --link data_loader.py ./ +RUN python data_loader.py # loads the keras data + +COPY --link job.py configs/ ./ +ENTRYPOINT ["python", "job.py"] diff --git a/runner.py b/runner.py new file mode 100644 index 0000000..4c956c1 --- /dev/null +++ b/runner.py @@ -0,0 +1,32 @@ +# runner.py - Place this in your current working directory + +import sys +import importlib.util +import os + +def run_script(script_path, args=[]): + # Backup the original sys.argv + original_argv = sys.argv + + # Determine module name and path + module_name = os.path.basename(script_path).replace('.py', '') + spec = importlib.util.spec_from_file_location(module_name, script_path) + module = importlib.util.module_from_spec(spec) + + try: + # Mimic command line arguments + sys.argv = [script_path] + args + + # Load and execute the module + spec.loader.exec_module(module) + + # If the module has a main function, call it + if hasattr(module, 'main'): + module.main() + finally: + # Restore the original sys.argv + sys.argv = original_argv + +if __name__ == "__main__": + # Pass all arguments except the first (the script name itself) to run_script + run_script('./jobs/fashion_mnist_train/job.py', sys.argv[1:])