Spaces:
Running
Running
Update predictors.py
Browse files- predictors.py +10 -10
predictors.py
CHANGED
@@ -39,20 +39,20 @@ bias_checker_model_name = params['BIAS_CHECKER_MODEL_PATH']
|
|
39 |
bias_corrector_model_name = params['BIAS_CORRECTOR_MODEL_PATH']
|
40 |
# access_token = params['HF_TOKEN']
|
41 |
|
42 |
-
text_bc_tokenizer = AutoTokenizer.from_pretrained(text_bc_model_path
|
43 |
-
text_bc_model = AutoModelForSequenceClassification.from_pretrained(text_bc_model_path
|
44 |
-
text_mc_tokenizer = AutoTokenizer.from_pretrained(text_mc_model_path
|
45 |
-
text_mc_model = AutoModelForSequenceClassification.from_pretrained(text_mc_model_path
|
46 |
-
quillbot_tokenizer = AutoTokenizer.from_pretrained(text_quillbot_model_path
|
47 |
-
quillbot_model = AutoModelForSequenceClassification.from_pretrained(text_quillbot_model_path
|
48 |
|
49 |
# proxy models for explainability
|
50 |
mini_bc_model_name = "polygraf-ai/bc-model"
|
51 |
-
bc_tokenizer_mini = AutoTokenizer.from_pretrained(mini_bc_model_name
|
52 |
-
bc_model_mini = AutoModelForSequenceClassification.from_pretrained(mini_bc_model_name
|
53 |
mini_humanizer_model_name = "polygraf-ai/humanizer-model"
|
54 |
-
humanizer_tokenizer_mini = AutoTokenizer.from_pretrained(mini_humanizer_model_name
|
55 |
-
humanizer_model_mini = AutoModelForSequenceClassification.from_pretrained(mini_humanizer_model_name
|
56 |
|
57 |
bc_model_mini = BetterTransformer.transform(bc_model_mini)
|
58 |
humanizer_model_mini = BetterTransformer.transform(humanizer_model_mini)
|
|
|
39 |
bias_corrector_model_name = params['BIAS_CORRECTOR_MODEL_PATH']
|
40 |
# access_token = params['HF_TOKEN']
|
41 |
|
42 |
+
text_bc_tokenizer = AutoTokenizer.from_pretrained(text_bc_model_path)
|
43 |
+
text_bc_model = AutoModelForSequenceClassification.from_pretrained(text_bc_model_path).to(device)
|
44 |
+
text_mc_tokenizer = AutoTokenizer.from_pretrained(text_mc_model_path)
|
45 |
+
text_mc_model = AutoModelForSequenceClassification.from_pretrained(text_mc_model_path).to(device)
|
46 |
+
quillbot_tokenizer = AutoTokenizer.from_pretrained(text_quillbot_model_path)
|
47 |
+
quillbot_model = AutoModelForSequenceClassification.from_pretrained(text_quillbot_model_path).to(device)
|
48 |
|
49 |
# proxy models for explainability
|
50 |
mini_bc_model_name = "polygraf-ai/bc-model"
|
51 |
+
bc_tokenizer_mini = AutoTokenizer.from_pretrained(mini_bc_model_name)
|
52 |
+
bc_model_mini = AutoModelForSequenceClassification.from_pretrained(mini_bc_model_name).to(device_needed)
|
53 |
mini_humanizer_model_name = "polygraf-ai/humanizer-model"
|
54 |
+
humanizer_tokenizer_mini = AutoTokenizer.from_pretrained(mini_humanizer_model_name)
|
55 |
+
humanizer_model_mini = AutoModelForSequenceClassification.from_pretrained(mini_humanizer_model_name).to(device_needed)
|
56 |
|
57 |
bc_model_mini = BetterTransformer.transform(bc_model_mini)
|
58 |
humanizer_model_mini = BetterTransformer.transform(humanizer_model_mini)
|