From 94e84e068f37ef8f740dfdd8fb2e6981fe8458b5 Mon Sep 17 00:00:00 2001 From: liuzi Date: Tue, 17 Jun 2025 13:57:57 +0800 Subject: [PATCH 1/2] fix: add uv venv and env config for cuda --- .env.template | 1 + README.md | 75 +++++++++++++++++++ .../ETT_script/TimesNet_ETTh1.sh | 2 +- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 .env.template diff --git a/.env.template b/.env.template new file mode 100644 index 000000000..28952ff1f --- /dev/null +++ b/.env.template @@ -0,0 +1 @@ +CUDA_VISIBLE_DEVICES=0 \ No newline at end of file diff --git a/README.md b/README.md index 2399153f1..e2e863561 100644 --- a/README.md +++ b/README.md @@ -69,12 +69,87 @@ See our latest paper [[TimesNet]](https://arxiv.org/abs/2210.02186) for the comp ## Usage +### Environment Setup + +#### Just pip + 1. Install Python 3.8. For convenience, execute the following command. ``` pip install -r requirements.txt ``` +#### Using uv + +[uv](https://github.com/astral-sh/uv) is a fast Python package installer and resolver. Follow steps below to set up your environment: + +1. **Install uv** + + ```bash + # macOS/Linux + curl -LsSf https://astral.sh/uv/install.sh | sh + + # Windows (PowerShell) + irm https://astral.sh/uv/install.ps1 | iex + ``` + + For Windows user, if you meet permission error that requires admin, you can try to run the following command: + ```bash + # For Windows User + Set-ExecutionPolicy RemoteSigned -Scope Process -Force + ``` + +2. **Create a virtual environment and specify python version if needed** + + ```bash + uv venv --python 3.9 + ``` + +3. **Activate the virtual environment** + + ```bash + # macOS/Linux + source .venv/bin/activate + + # Windows + # set CLI to be admin mode + Set-ExecutionPolicy RemoteSigned -Scope Process -Force + .venv\Scripts\activate + ``` + +4. **Install dependencies** + + ```bash + uv pip install -r requirements.txt + ``` + + +### Configuration + +1. Set CUDA_VISIBLE_DEVICES to the GPU id you want to use by editing .env + ```bash + ## copy .envtemplate to your own version of .env + cp .envtemplate .env + ``` + + edit .env if you want to use other GPUs + ```bash + CUDA_VISIBLE_DEVICES={0,1,2,3...} + ``` + +2. If .env is not loaded automatically, you can activate it manually by running + ```bash + source .env + ``` + +3. Check if GPU device has been set globally + ```bash + echo $CUDA_VISIBLE_DEVICES + ## expected output: {0,1,2,3...} + ``` + +### Prepare data and run scripts + 2. Prepare Data. You can obtain the well pre-processed datasets from [[Google Drive]](https://drive.google.com/drive/folders/13Cg1KYOlzM5C7K8gK8NfC-F3EYxkM3D2?usp=sharing) orĀ [[Baidu Drive]](https://pan.baidu.com/s/1r3KhGd0Q9PJIUZdfEYoymg?pwd=i9iy), Then place the downloaded data in the folder`./dataset`. Here is a summary of supported datasets.

diff --git a/scripts/long_term_forecast/ETT_script/TimesNet_ETTh1.sh b/scripts/long_term_forecast/ETT_script/TimesNet_ETTh1.sh index 6a03e5f50..9191e9b12 100644 --- a/scripts/long_term_forecast/ETT_script/TimesNet_ETTh1.sh +++ b/scripts/long_term_forecast/ETT_script/TimesNet_ETTh1.sh @@ -1,4 +1,4 @@ -export CUDA_VISIBLE_DEVICES=2 +export CUDA_VISIBLE_DEVICES=0 model_name=TimesNet From eac0a0e22edda3c001c741e591b1605b4101f011 Mon Sep 17 00:00:00 2001 From: liuzi Date: Tue, 17 Jun 2025 14:04:59 +0800 Subject: [PATCH 2/2] delete hardcoded cuda device in python script --- scripts/long_term_forecast/ETT_script/TimesNet_ETTh1.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/long_term_forecast/ETT_script/TimesNet_ETTh1.sh b/scripts/long_term_forecast/ETT_script/TimesNet_ETTh1.sh index 9191e9b12..2f88f530a 100644 --- a/scripts/long_term_forecast/ETT_script/TimesNet_ETTh1.sh +++ b/scripts/long_term_forecast/ETT_script/TimesNet_ETTh1.sh @@ -1,5 +1,3 @@ -export CUDA_VISIBLE_DEVICES=0 - model_name=TimesNet python -u run.py \