1inkusFace commited on
Commit
213ac80
·
verified ·
1 Parent(s): a068f31

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
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
- # 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,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