File size: 2,075 Bytes
e9f9fd3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# NVIDIA GPU Setup Guide for DeOldify

This guide covers how to set up DeOldify with modern NVIDIA GPUs (RTX 30xx, 40xx, 50xx) using CUDA 12.x and PyTorch 2.5+.

## Prerequisites

- **NVIDIA Driver**: Version 550.x or later (supports CUDA 12.4+)
- **Anaconda** or **Miniconda** installed
- **Git** installed

## Installation Steps

1.  **Clone the Repository**
    ```bash
    git clone https://github.com/thookham/DeOldify.git
    cd DeOldify
    ```

2.  **Create Conda Environment**
    We use a modern environment file that installs PyTorch 2.5+ and CUDA 12.4 support.
    ```bash
    conda env create -f environment.yml
    ```

3.  **Activate Environment**
    ```bash
    conda activate deoldify
    ```

4.  **Download Weights**
    Download the pretrained weights and place them in the `models/` directory:
    - [ColorizeArtistic_gen.pth](https://github.com/thookham/DeOldify/releases/download/v2.0-models/ColorizeArtistic_gen.pth)
    - [ColorizeStable_gen.pth](https://github.com/thookham/DeOldify/releases/download/v2.0-models/ColorizeStable_gen.pth)
    - [ColorizeVideo_gen.pth](https://github.com/thookham/DeOldify/releases/download/v2.0-models/ColorizeVideo_gen.pth)

    ```bash
    mkdir -p models
    # Example using wget
    wget https://github.com/thookham/DeOldify/releases/download/v2.0-models/ColorizeArtistic_gen.pth -O models/ColorizeArtistic_gen.pth
    ```

## Verification

Run the verification script to ensure everything is set up correctly:

```bash
python verify_refactor.py
```

## Troubleshooting

### "CUDA not available"
- Ensure you have the correct NVIDIA drivers installed.
- Run `nvidia-smi` to check driver status.
- Ensure you installed the environment from `environment.yml` which pulls `pytorch-cuda`.

### "Out of Memory"
- Reduce `render_factor` in your scripts.
- Ensure no other processes are using the GPU.

### Performance Tuning
- For RTX 40xx/50xx series, you can enable TF32 for better performance:
  ```python
  import torch
  torch.backends.cuda.matmul.allow_tf32 = True
  torch.backends.cudnn.allow_tf32 = True
  ```