Spaces:
Running
on
T4
Running
on
T4
sparkleman
commited on
Commit
·
7063b82
1
Parent(s):
1c4c774
UPDATE
Browse files- Dockerfile +1 -2
- app.py +2 -2
Dockerfile
CHANGED
|
@@ -50,8 +50,7 @@ ENV HOME=/home/user \
|
|
| 50 |
PATH=/usr/local/cuda/bin:/home/user/.local/bin:$PATH \
|
| 51 |
LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}" \
|
| 52 |
CXX=/usr/bin/g++ \
|
| 53 |
-
TORCH_CUDA_ARCH_LIST="7.5"
|
| 54 |
-
PYTORCH_CUDA_ALLOC_CONF="expandable_segments:True"
|
| 55 |
WORKDIR $HOME/app
|
| 56 |
|
| 57 |
COPY --chown=user . $HOME/app
|
|
|
|
| 50 |
PATH=/usr/local/cuda/bin:/home/user/.local/bin:$PATH \
|
| 51 |
LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}" \
|
| 52 |
CXX=/usr/bin/g++ \
|
| 53 |
+
TORCH_CUDA_ARCH_LIST="7.5"
|
|
|
|
| 54 |
WORKDIR $HOME/app
|
| 55 |
|
| 56 |
COPY --chown=user . $HOME/app
|
app.py
CHANGED
|
@@ -5,7 +5,7 @@ if os.environ.get("MODELSCOPE_ENVIRONMENT") == "studio":
|
|
| 5 |
|
| 6 |
patch_hub()
|
| 7 |
|
| 8 |
-
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "
|
| 9 |
|
| 10 |
|
| 11 |
from config import CONFIG, ModelConfig
|
|
@@ -135,7 +135,7 @@ for model_config in CONFIG.MODELS:
|
|
| 135 |
MODEL_STORAGE[model_config.SERVICE_NAME].model, model_config.VOCAB
|
| 136 |
)
|
| 137 |
if "cuda" in CONFIG.STRATEGY:
|
| 138 |
-
|
| 139 |
gc.collect()
|
| 140 |
logGPUState()
|
| 141 |
|
|
|
|
| 5 |
|
| 6 |
patch_hub()
|
| 7 |
|
| 8 |
+
os.environ["PYTORCH_CUDA_ALLOC_CONF"] = "max_split_size_mb:512"
|
| 9 |
|
| 10 |
|
| 11 |
from config import CONFIG, ModelConfig
|
|
|
|
| 135 |
MODEL_STORAGE[model_config.SERVICE_NAME].model, model_config.VOCAB
|
| 136 |
)
|
| 137 |
if "cuda" in CONFIG.STRATEGY:
|
| 138 |
+
torch.cuda.empty_cache()
|
| 139 |
gc.collect()
|
| 140 |
logGPUState()
|
| 141 |
|