Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -5,7 +5,7 @@ import gradio as gr
|
|
5 |
|
6 |
# ## GGUF MOD: Unused environment variables for PyTorch have been removed.
|
7 |
# ## GGUF MOD: ctransformers handles its own memory and GPU management.
|
8 |
-
|
9 |
# os.putenv('TORCH_LINALG_PREFER_CUSOLVER','1')
|
10 |
# alloc_conf_parts = [
|
11 |
# 'expandable_segments:True',
|
@@ -19,6 +19,7 @@ os.putenv('HF_HUB_ENABLE_HF_TRANSFER','1')
|
|
19 |
# ## GGUF MOD: BitsAndBytesConfig is no longer needed.
|
20 |
from ctransformers import AutoModelForCausalLM
|
21 |
from transformers import AutoTokenizer
|
|
|
22 |
|
23 |
# ## GGUF MOD: PyTorch backend settings are not used by ctransformers.
|
24 |
# torch.backends.cuda.matmul.allow_tf32 = True
|
|
|
5 |
|
6 |
# ## GGUF MOD: Unused environment variables for PyTorch have been removed.
|
7 |
# ## GGUF MOD: ctransformers handles its own memory and GPU management.
|
8 |
+
os.putenv('PYTORCH_NVML_BASED_CUDA_CHECK','1')
|
9 |
# os.putenv('TORCH_LINALG_PREFER_CUSOLVER','1')
|
10 |
# alloc_conf_parts = [
|
11 |
# 'expandable_segments:True',
|
|
|
19 |
# ## GGUF MOD: BitsAndBytesConfig is no longer needed.
|
20 |
from ctransformers import AutoModelForCausalLM
|
21 |
from transformers import AutoTokenizer
|
22 |
+
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
23 |
|
24 |
# ## GGUF MOD: PyTorch backend settings are not used by ctransformers.
|
25 |
# torch.backends.cuda.matmul.allow_tf32 = True
|