Spaces:
Running
Running
Update agent.py
Browse files
agent.py
CHANGED
@@ -7,9 +7,10 @@ emoji_tokenizer = AutoTokenizer.from_pretrained(emoji_model_id, trust_remote_cod
|
|
7 |
emoji_model = AutoModelForCausalLM.from_pretrained(
|
8 |
emoji_model_id,
|
9 |
trust_remote_code=True,
|
10 |
-
torch_dtype=torch.float16
|
11 |
-
|
12 |
-
|
|
|
13 |
|
14 |
# ✅ Step 2: 冒犯性文本识别模型
|
15 |
classifier = pipeline("text-classification", model="unitary/toxic-bert", device=0 if torch.cuda.is_available() else -1)
|
|
|
7 |
emoji_model = AutoModelForCausalLM.from_pretrained(
|
8 |
emoji_model_id,
|
9 |
trust_remote_code=True,
|
10 |
+
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
|
11 |
+
device_map="auto"
|
12 |
+
)
|
13 |
+
|
14 |
|
15 |
# ✅ Step 2: 冒犯性文本识别模型
|
16 |
classifier = pipeline("text-classification", model="unitary/toxic-bert", device=0 if torch.cuda.is_available() else -1)
|