ThanaritKanjanametawat commited on
Commit
3d6730e
1 Parent(s): 081c69d

Move everything to CPU

Browse files
Files changed (2) hide show
  1. ModelDriver.py +2 -2
  2. app.py +1 -1
ModelDriver.py CHANGED
@@ -62,7 +62,7 @@ def RobertaClassifierOpenGPTInference(input_text):
62
  tokenizer = RobertaTokenizer.from_pretrained("roberta-base")
63
  model_path = "ClassifierCheckpoint/RobertaClassifierOpenGPT.pth"
64
  model = RobertaForSequenceClassification.from_pretrained('roberta-base', num_labels=2)
65
- model.load_state_dict(torch.load(model_path, map_location=device))
66
  model = model.to(device)
67
  model.eval()
68
 
@@ -84,7 +84,7 @@ def RobertaClassifierCSAbstractInference(input_text):
84
  tokenizer = RobertaTokenizer.from_pretrained("roberta-base")
85
  model_path = "ClassifierCheckpoint/RobertaClassifierCSAbstract.pth"
86
  model = RobertaForSequenceClassification.from_pretrained('roberta-base', num_labels=2)
87
- model.load_state_dict(torch.load(model_path, map_location=device))
88
  model = model.to(device)
89
  model.eval()
90
 
 
62
  tokenizer = RobertaTokenizer.from_pretrained("roberta-base")
63
  model_path = "ClassifierCheckpoint/RobertaClassifierOpenGPT.pth"
64
  model = RobertaForSequenceClassification.from_pretrained('roberta-base', num_labels=2)
65
+ model.load_state_dict(torch.load(model_path, map_location=device), strict=False)
66
  model = model.to(device)
67
  model.eval()
68
 
 
84
  tokenizer = RobertaTokenizer.from_pretrained("roberta-base")
85
  model_path = "ClassifierCheckpoint/RobertaClassifierCSAbstract.pth"
86
  model = RobertaForSequenceClassification.from_pretrained('roberta-base', num_labels=2)
87
+ model.load_state_dict(torch.load(model_path, map_location=device), strict=False)
88
  model = model.to(device)
89
  model.eval()
90
 
app.py CHANGED
@@ -10,7 +10,7 @@ st.write("This is a demo for GPT detection. You can use this demo to test the mo
10
  # Add 4 options for 4 models
11
  ModelOption = st.sidebar.selectbox(
12
  'Which Model do you want to use?',
13
- ('RobertaSentinel'),
14
  )
15
 
16
  DatasetOption = st.sidebar.selectbox(
 
10
  # Add 4 options for 4 models
11
  ModelOption = st.sidebar.selectbox(
12
  'Which Model do you want to use?',
13
+ ('RobertaSentinel', 'RobertaClassifier'),
14
  )
15
 
16
  DatasetOption = st.sidebar.selectbox(