Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
import torch
|
2 |
import gradio as gr
|
3 |
import spaces
|
4 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
import os
|
6 |
import re
|
7 |
from polyglot.detect import Detector
|
@@ -12,13 +12,11 @@ RELATIVE_MODEL="LLaMAX/LLaMAX3-8B"
|
|
12 |
|
13 |
TITLE = "<h1><center>LLaMAX3-Translator</center></h1>"
|
14 |
|
15 |
-
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
|
16 |
|
17 |
model = AutoModelForCausalLM.from_pretrained(
|
18 |
MODEL,
|
19 |
torch_dtype=torch.float16,
|
20 |
-
device_map="auto"
|
21 |
-
quantization_config=quantization_config)
|
22 |
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
23 |
|
24 |
|
|
|
1 |
import torch
|
2 |
import gradio as gr
|
3 |
import spaces
|
4 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
5 |
import os
|
6 |
import re
|
7 |
from polyglot.detect import Detector
|
|
|
12 |
|
13 |
TITLE = "<h1><center>LLaMAX3-Translator</center></h1>"
|
14 |
|
|
|
15 |
|
16 |
model = AutoModelForCausalLM.from_pretrained(
|
17 |
MODEL,
|
18 |
torch_dtype=torch.float16,
|
19 |
+
device_map="auto")
|
|
|
20 |
tokenizer = AutoTokenizer.from_pretrained(MODEL)
|
21 |
|
22 |
|