Spaces:
Running
Running
Update interfaces/cap.py
Browse files- interfaces/cap.py +3 -3
interfaces/cap.py
CHANGED
@@ -96,11 +96,11 @@ def build_huggingface_path(language: str, domain: str):
|
|
96 |
def predict(text, model_id, tokenizer_id):
|
97 |
device = torch.device("cpu")
|
98 |
gr.Info("Loading model")
|
99 |
-
model = AutoModelForSequenceClassification.from_pretrained(model_id, token=HF_TOKEN)
|
100 |
gr.Info("Loading tokenizer")
|
101 |
tokenizer = AutoTokenizer.from_pretrained(tokenizer_id)
|
102 |
-
gr.Info("Mapping model to device")
|
103 |
-
model.to(device)
|
104 |
|
105 |
gr.Info("Tokenizing")
|
106 |
inputs = tokenizer(text,
|
|
|
96 |
def predict(text, model_id, tokenizer_id):
|
97 |
device = torch.device("cpu")
|
98 |
gr.Info("Loading model")
|
99 |
+
model = AutoModelForSequenceClassification.from_pretrained(model_id, low_cpu_mem_usage=True, device_map="auto", token=HF_TOKEN)
|
100 |
gr.Info("Loading tokenizer")
|
101 |
tokenizer = AutoTokenizer.from_pretrained(tokenizer_id)
|
102 |
+
#gr.Info("Mapping model to device")
|
103 |
+
#model.to(device)
|
104 |
|
105 |
gr.Info("Tokenizing")
|
106 |
inputs = tokenizer(text,
|