Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ from theme_dropdown import create_theme_dropdown
|
|
8 |
|
9 |
model_name = "RootYuan/RootYuan-RedLing-7B-v0.1"
|
10 |
max_new_tokens = 2048
|
11 |
-
device = 'cpu'
|
12 |
|
13 |
|
14 |
DEFAULT_SYSTEM_MESSAGE = """
|
@@ -22,7 +22,7 @@ EOT_TOKEN = "<EOT>"
|
|
22 |
PROMPT_TEMPLATE = "USER:{user}<EOT>ASSISTANT:{assistant}{eos_token}"
|
23 |
|
24 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
25 |
-
model = AutoModelForCausalLM.from_pretrained(model_name).to(device)
|
26 |
|
27 |
dropdown, js = create_theme_dropdown()
|
28 |
|
|
|
8 |
|
9 |
model_name = "RootYuan/RootYuan-RedLing-7B-v0.1"
|
10 |
max_new_tokens = 2048
|
11 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
12 |
|
13 |
|
14 |
DEFAULT_SYSTEM_MESSAGE = """
|
|
|
22 |
PROMPT_TEMPLATE = "USER:{user}<EOT>ASSISTANT:{assistant}{eos_token}"
|
23 |
|
24 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
25 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.bfloat16).to(device)
|
26 |
|
27 |
dropdown, js = create_theme_dropdown()
|
28 |
|