aabidk commited on
Commit
42b635a
·
verified ·
1 Parent(s): 53233b1

The 'not' part will be handled externally, so removed it

Browse files
Files changed (1) hide show
  1. app.py +20 -20
app.py CHANGED
@@ -26,26 +26,26 @@ def calculate_similarity(student_inputs, mentor_inputs):
26
  Then append a 'not' to such options and place them at same index as in student_inputs.
27
  Also we need to take care of value shifts after adding 'not' to some options, so use a new list
28
  """
29
- student = []
30
- mentor = []
31
-
32
- for i in range(len(options)):
33
- if options[i] in student_inputs:
34
- student.append(options[i])
35
- else:
36
- student.append(f"NOT {options[i]}")
37
-
38
- for i in range(len(options)):
39
- if options[i] in mentor_inputs:
40
- mentor.append(options[i])
41
- else:
42
- mentor.append(f"NOT {options[i]}")
43
-
44
- print(f"Student inputs: {student}")
45
- print(f"Mentor inputs: {mentor}")
46
-
47
- student_tokens = tokenizer(student, return_tensors="pt", padding=True)
48
- mentor_tokens = tokenizer(mentor, return_tensors="pt", padding=True)
49
 
50
  with torch.no_grad():
51
  student_output = model(**student_tokens).last_hidden_state.mean(dim=1)
 
26
  Then append a 'not' to such options and place them at same index as in student_inputs.
27
  Also we need to take care of value shifts after adding 'not' to some options, so use a new list
28
  """
29
+ # student = []
30
+ # mentor = []
31
+
32
+ # for i in range(len(options)):
33
+ # if options[i] in student_inputs:
34
+ # student.append(options[i])
35
+ # else:
36
+ # student.append(f"NOT {options[i]}")
37
+
38
+ # for i in range(len(options)):
39
+ # if options[i] in mentor_inputs:
40
+ # mentor.append(options[i])
41
+ # else:
42
+ # mentor.append(f"NOT {options[i]}")
43
+
44
+ # print(f"Student inputs: {student}")
45
+ # print(f"Mentor inputs: {mentor}")
46
+
47
+ student_tokens = tokenizer(student_inputs, return_tensors="pt", padding=True)
48
+ mentor_tokens = tokenizer(mentor_inputs, return_tensors="pt", padding=True)
49
 
50
  with torch.no_grad():
51
  student_output = model(**student_tokens).last_hidden_state.mean(dim=1)