Updated steps for running on GPU machine
This commit is contained in:
parent
6c8f1d36f3
commit
780dcabb66
|
|
@ -1,6 +1,6 @@
|
|||
# This is an example .env file for the Trading Agent project.
|
||||
# Copy this file to .env and fill in your API keys and environment configurations.
|
||||
"NOTE: When using for `docker` command do not use quotes around the values, otherwiser environment variables will not be set."
|
||||
# "NOTE: When using for `docker` command do not use quotes around the values, otherwiser environment variables will not be set."
|
||||
|
||||
# API Keys
|
||||
# Set your OpenAI API key, for OpenAI, Ollama or other OpenAI-compatible models
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ cp .env.example .env
|
|||
# 4. Build the app
|
||||
docker-compose build
|
||||
|
||||
# 5. Run the comman-line app
|
||||
# 5. Run the command-line app
|
||||
docker-compose run -it app
|
||||
```
|
||||
|
||||
|
|
@ -73,12 +73,18 @@ The following command will build the Docker image, download the required LLM mod
|
|||
# Use --build the first time or when you change dependencies
|
||||
docker-compose build
|
||||
|
||||
# On subsequent runs, you can run directily
|
||||
# On subsequent runs, you can run directly
|
||||
docker-compose run -it app
|
||||
```
|
||||
|
||||
The first time you run this, it may take several minutes to download the base image and the LLM models. Subsequent builds will be much faster thanks to Docker's caching.
|
||||
|
||||
### Running on GPU machines
|
||||
For running on GPU machines, uncomment the `deploy gpu resource` section in docker-compose.yml and run the commands.
|
||||
```bash
|
||||
docker-compose run -it app
|
||||
```
|
||||
|
||||
#### View Logs
|
||||
|
||||
To view the application logs in real-time, you can run:
|
||||
|
|
@ -155,7 +161,7 @@ docker run -it \
|
|||
-e LLM_BACKEND_URL="http://localhost:11434/v1" \
|
||||
-e LLM_DEEP_THINK_MODEL="qwen3:0.6b" \
|
||||
-e LLM_EMBEDDING_MODEL="nomic-embed-text"\
|
||||
-v ./ollama_cache:/app/.ollma \
|
||||
-v ./ollama_cache:/app/.ollama \
|
||||
trading-agents \
|
||||
python test_ollama_connection.py
|
||||
```
|
||||
|
|
@ -168,10 +174,21 @@ docker run --rm -it \
|
|||
--env-file .env \
|
||||
-p 11434:11434 \
|
||||
-v ./data:/app/data \
|
||||
--name tradingagents-app \
|
||||
--name trading-agents \
|
||||
trading-agents
|
||||
```
|
||||
|
||||
**4. Run on GPU machine:**
|
||||
For running on GPU machine, pass `--gpus=all` flag to the `docker run` command:
|
||||
```bash
|
||||
docker run --rm -it \
|
||||
--gpus=all \
|
||||
--env-file .env \
|
||||
-p 11434:11434 \
|
||||
-v ./data:/app/data \
|
||||
--name trading-agents \
|
||||
trading-agents
|
||||
```
|
||||
|
||||
## Configuration Details
|
||||
|
||||
|
|
@ -181,4 +198,14 @@ The `app` directory is mounted as a volume into the container. This means any ch
|
|||
### Persistent Data
|
||||
The following volumes are used to persist data between container runs:
|
||||
* `./data`: Stores any data generated by or used by the application.
|
||||
* `ollama-cache`: A named volume that caches the Ollama models, so they don't need to be re-downloaded every time you restart the container.
|
||||
* `.ollama`: Caches the Ollama models, so they don't need to be re-downloaded every time you restart the container.
|
||||
|
||||
### GPU troubleshooting
|
||||
If you find model is running very slow on GPU machine, make sur you the latest GPU drivers installed and GPU is working fine with docker. Eg you can check for Nvidia GPUs by running:
|
||||
```bash
|
||||
docker run --rm -it --gpus=all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
|
||||
|
||||
or
|
||||
|
||||
nvidia-smi
|
||||
```
|
||||
|
|
@ -7,6 +7,8 @@ services:
|
|||
- .:/app # Mount current directory to /app in container for live code changes
|
||||
- ./.ollama:/app/.ollama # Cache Ollama models
|
||||
- ./data:/app/data # Mount data directory for data files
|
||||
env_file:
|
||||
- .env # Load environment variables from files.env
|
||||
#environment:
|
||||
# - LLM_PROVIDER=ollama
|
||||
# - LLM_BACKEND_URL=http://localhost:11434/v1
|
||||
|
|
@ -19,12 +21,18 @@ services:
|
|||
# For running tests with compose, one can use:
|
||||
# docker-compose run --rm app pytest tests/test_main.py
|
||||
# Or, we can set a default command here to run tests:
|
||||
env_file:
|
||||
- .env # Load environment variables from files.env
|
||||
tty: true # Keep the container running
|
||||
stdin_open: true # Keep stdin open for interactive mode
|
||||
#command: python test_ollama_connection.py # Uncomment to run a specific test script
|
||||
#command: python -m cli.main # Uncomment to run cli interface
|
||||
#command: python -m main # uncomment to run the main application
|
||||
tty: true # Keep the container running
|
||||
stdin_open: true # Keep stdin open for interactive mode
|
||||
|
||||
# Uncomment the following lines to enable GPU support
|
||||
# For more information, refer to the Docker documentation: https://docs.docker.com/compose/how-tos/gpu-support/
|
||||
#deploy:
|
||||
# resources:
|
||||
# reservations:
|
||||
# devices:
|
||||
# - capabilities: ["gpu"]
|
||||
ports:
|
||||
- "11434:11434" # Expose port 11434 for Ollama
|
||||
- "11434:11434" # Expose port 11434 for Ollama
|
||||
|
|
|
|||
Loading…
Reference in New Issue