Disable half-precision for non-cuda
Browse files
app.py
CHANGED
@@ -14,7 +14,6 @@ bert_path = os.environ.get(
|
|
14 |
|
15 |
if "_CUDA_VISIBLE_DEVICES" in os.environ:
|
16 |
os.environ["CUDA_VISIBLE_DEVICES"] = os.environ["_CUDA_VISIBLE_DEVICES"]
|
17 |
-
is_half = eval(os.environ.get("is_half", "True"))
|
18 |
|
19 |
|
20 |
import gradio as gr
|
@@ -37,6 +36,11 @@ from text import cleaned_text_to_sequence
|
|
37 |
from text.cleaner import clean_text
|
38 |
|
39 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
|
|
|
|
|
|
|
40 |
tokenizer = AutoTokenizer.from_pretrained(bert_path)
|
41 |
bert_model = AutoModelForMaskedLM.from_pretrained(bert_path)
|
42 |
if is_half == True:
|
|
|
14 |
|
15 |
if "_CUDA_VISIBLE_DEVICES" in os.environ:
|
16 |
os.environ["CUDA_VISIBLE_DEVICES"] = os.environ["_CUDA_VISIBLE_DEVICES"]
|
|
|
17 |
|
18 |
|
19 |
import gradio as gr
|
|
|
36 |
from text.cleaner import clean_text
|
37 |
|
38 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
39 |
+
|
40 |
+
is_half = eval(
|
41 |
+
os.environ.get("is_half", "True" if torch.cuda.is_available() else "False")
|
42 |
+
)
|
43 |
+
|
44 |
tokenizer = AutoTokenizer.from_pretrained(bert_path)
|
45 |
bert_model = AutoModelForMaskedLM.from_pretrained(bert_path)
|
46 |
if is_half == True:
|