testing1
Browse files- src/service/service.py +10 -7
src/service/service.py
CHANGED
|
@@ -64,10 +64,18 @@ try:
|
|
| 64 |
# print(os.listdir())
|
| 65 |
check_point = 'toxic_debiased-c7548aa0.ckpt'
|
| 66 |
log.info(f"device is: {device}")
|
|
|
|
| 67 |
#remove later
|
| 68 |
-
application_path = "/Responsible-Ai-Moderation-Models/"
|
| 69 |
-
print(application_path)
|
| 70 |
#---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
log.info(f"checkpoint Path is: {os.path.join(application_path, 'models/detoxify/'+ check_point)}")
|
| 72 |
log.info(f"huggingface_config_path Path is: {os.path.join(application_path, 'models/detoxify/'+ check_point)}")
|
| 73 |
log.info("Loading toxicity model")
|
|
@@ -77,11 +85,6 @@ try:
|
|
| 77 |
tokenizer = AutoTokenizer.from_pretrained(os.path.join(application_path, "models/detoxify"))
|
| 78 |
log.info("Toxicity model loaded")
|
| 79 |
|
| 80 |
-
log.info("Loading prompt injection model")
|
| 81 |
-
PromptModel_dberta = AutoModelForSequenceClassification.from_pretrained(os.path.join(application_path, "models/dbertaInjection")).to(device)
|
| 82 |
-
Prompttokens_dberta = AutoTokenizer.from_pretrained(os.path.join(application_path, "models/dbertaInjection"))
|
| 83 |
-
promtModel = pipeline("text-classification", model=PromptModel_dberta, tokenizer=Prompttokens_dberta, device=device)
|
| 84 |
-
log.info("Loaded prompt injection model")
|
| 85 |
|
| 86 |
#topictokenizer_Facebook = AutoTokenizer.from_pretrained("../models/facebook")
|
| 87 |
#topicmodel_Facebook = AutoModelForSequenceClassification.from_pretrained("../models/facebook").to(device)
|
|
|
|
| 64 |
# print(os.listdir())
|
| 65 |
check_point = 'toxic_debiased-c7548aa0.ckpt'
|
| 66 |
log.info(f"device is: {device}")
|
| 67 |
+
|
| 68 |
#remove later
|
| 69 |
+
# application_path = "/Responsible-Ai-Moderation-Models/"
|
| 70 |
+
# print(application_path)
|
| 71 |
#---
|
| 72 |
+
|
| 73 |
+
log.info("Loading prompt injection model")
|
| 74 |
+
PromptModel_dberta = AutoModelForSequenceClassification.from_pretrained(os.path.join(application_path, "models/dbertaInjection")).to(device)
|
| 75 |
+
Prompttokens_dberta = AutoTokenizer.from_pretrained(os.path.join(application_path, "models/dbertaInjection"))
|
| 76 |
+
promtModel = pipeline("text-classification", model=PromptModel_dberta, tokenizer=Prompttokens_dberta, device=device)
|
| 77 |
+
log.info("Loaded prompt injection model")
|
| 78 |
+
|
| 79 |
log.info(f"checkpoint Path is: {os.path.join(application_path, 'models/detoxify/'+ check_point)}")
|
| 80 |
log.info(f"huggingface_config_path Path is: {os.path.join(application_path, 'models/detoxify/'+ check_point)}")
|
| 81 |
log.info("Loading toxicity model")
|
|
|
|
| 85 |
tokenizer = AutoTokenizer.from_pretrained(os.path.join(application_path, "models/detoxify"))
|
| 86 |
log.info("Toxicity model loaded")
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
#topictokenizer_Facebook = AutoTokenizer.from_pretrained("../models/facebook")
|
| 90 |
#topicmodel_Facebook = AutoModelForSequenceClassification.from_pretrained("../models/facebook").to(device)
|