Spaces:
Running
Running
Quang Long
commited on
Commit
·
cdcee1d
1
Parent(s):
267f792
docker compose, fix_symlinks
Browse files- .dockerignore +3 -0
- .gitignore +2 -0
- .python-version +1 -1
- README.md +23 -0
- docker-compose.yaml +20 -0
- fix_symlinks.py +19 -0
- prepare_environment.py +11 -0
.dockerignore
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.python-version
|
| 2 |
+
.backup
|
| 3 |
+
backup
|
.gitignore
CHANGED
|
@@ -26,6 +26,8 @@ share/python-wheels/
|
|
| 26 |
*.egg
|
| 27 |
MANIFEST
|
| 28 |
|
|
|
|
|
|
|
| 29 |
# PyInstaller
|
| 30 |
# Usually these files are written by a python script from a template
|
| 31 |
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
|
|
| 26 |
*.egg
|
| 27 |
MANIFEST
|
| 28 |
|
| 29 |
+
backup/
|
| 30 |
+
|
| 31 |
# PyInstaller
|
| 32 |
# Usually these files are written by a python script from a template
|
| 33 |
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
.python-version
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
tts
|
README.md
CHANGED
|
@@ -24,3 +24,26 @@ pip install torch==2.4.0+cu124 torchaudio==2.4.0+cu124 torchvision==0.19.0 --ext
|
|
| 24 |
sudo apt-get update
|
| 25 |
sudo apt-get install sox ffmpeg
|
| 26 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
sudo apt-get update
|
| 25 |
sudo apt-get install sox ffmpeg
|
| 26 |
```
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
## Backup and Restore Volume
|
| 30 |
+
|
| 31 |
+
p/s: Need to mount backup folder to container
|
| 32 |
+
|
| 33 |
+
### Backup
|
| 34 |
+
```bash
|
| 35 |
+
tar -czvf /backup/data_cache_backup.tar.gz /home/user/.cache
|
| 36 |
+
tar -czvf /backup/data_gfpgan_backup.tar.gz /home/user/app/gfpgan
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
### Restore
|
| 40 |
+
|
| 41 |
+
```bash
|
| 42 |
+
mkdir -p /home/user/.cache
|
| 43 |
+
cd /home/user/.cache
|
| 44 |
+
tar xzvf /backup/data_cache_backup.tar.gz --strip 1
|
| 45 |
+
|
| 46 |
+
mkdir -p /home/user/app/gfpgan
|
| 47 |
+
cd /home/user/app/gfpgan
|
| 48 |
+
tar xzvf /backup/data_gfpgan_backup.tar.gz --strip 1
|
| 49 |
+
```
|
docker-compose.yaml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
services:
|
| 2 |
+
test:
|
| 3 |
+
build: .
|
| 4 |
+
ports:
|
| 5 |
+
- "7860:7860"
|
| 6 |
+
stdin_open: true # equivalent to -it
|
| 7 |
+
tty: true # equivalent to -it
|
| 8 |
+
restart: "no" # equivalent to --rm (don’t restart container automatically)
|
| 9 |
+
# environment:
|
| 10 |
+
# - HF_ENDPOINT=http://172.16.15.118:9557/repository/atalink-hf-models
|
| 11 |
+
volumes:
|
| 12 |
+
- test_data_cache:/home/user/.cache
|
| 13 |
+
- test_data_gfpgan:/home/user/app/gfpgan
|
| 14 |
+
# - ./backup:/backup
|
| 15 |
+
|
| 16 |
+
volumes:
|
| 17 |
+
test_data_cache:
|
| 18 |
+
external: true
|
| 19 |
+
test_data_gfpgan:
|
| 20 |
+
external: true
|
fix_symlinks.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
import os
|
| 3 |
+
# cd checkpoints
|
| 4 |
+
# Root folder where your symlinks are located
|
| 5 |
+
folder = "."
|
| 6 |
+
old_prefix = "/Users/cuongpc/"
|
| 7 |
+
new_prefix = "/home/user/"
|
| 8 |
+
|
| 9 |
+
old_prefix_1 = "../../../../../root/"
|
| 10 |
+
|
| 11 |
+
for entry in os.listdir(folder):
|
| 12 |
+
path = os.path.join(folder, entry)
|
| 13 |
+
if os.path.islink(path):
|
| 14 |
+
target = os.readlink(path)
|
| 15 |
+
if target.startswith(old_prefix) or target.startswith(old_prefix_1):
|
| 16 |
+
new_target = target.replace(old_prefix, new_prefix, 1).replace(old_prefix_1, new_prefix, 1)
|
| 17 |
+
print(f"Updating: {path}\n {target} -> {new_target}")
|
| 18 |
+
os.remove(path) # remove old symlink
|
| 19 |
+
os.symlink(new_target, path)
|
prepare_environment.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
# help me write a python script to download a file from remote server and storage in /tmp
|
| 3 |
+
|
| 4 |
+
# if the file has already exist in /tmp, just skip download step
|
| 5 |
+
|
| 6 |
+
# the next step, create the volume, and extract the downloaded data into that volume
|
| 7 |
+
|
| 8 |
+
# the final step, cleanup /tmp
|
| 9 |
+
|
| 10 |
+
# http://172.16.15.118:9557/repository/atalink-hf-models/backups/data_cache_backup.tar.gz
|
| 11 |
+
# http://172.16.15.118:9557/repository/atalink-hf-models/backups/data_gfpgan_backup.tar.gz
|