ink-pad mnagired commited on
Commit
e48b7b8
·
verified ·
1 Parent(s): 8cf97d3

typo fix for get_probabilities (#4)

Browse files

- typo fix for get_probabilities (19f5a83879ad41eb66c3f613202a9ff743d49b85)


Co-authored-by: Manish Nagireddy <[email protected]>

Files changed (1) hide show
  1. README.md +2 -2
README.md CHANGED
@@ -77,7 +77,7 @@ def parse_output(output, input_len):
77
  list_index_logprobs_i = [torch.topk(token_i, k=nlogprobs, largest=True, sorted=True)
78
  for token_i in list(output.scores)[:-1]]
79
  if list_index_logprobs_i is not None:
80
- prob = get_probablities(list_index_logprobs_i)
81
  prob_of_risk = prob[1]
82
 
83
  res = tokenizer.decode(output.sequences[:,input_len:][0],skip_special_tokens=True).strip()
@@ -90,7 +90,7 @@ def parse_output(output, input_len):
90
 
91
  return label, prob_of_risk.item()
92
 
93
- def get_probablities(logprobs):
94
  safe_token_prob = 1e-50
95
  unsafe_token_prob = 1e-50
96
  for gen_token_i in logprobs:
 
77
  list_index_logprobs_i = [torch.topk(token_i, k=nlogprobs, largest=True, sorted=True)
78
  for token_i in list(output.scores)[:-1]]
79
  if list_index_logprobs_i is not None:
80
+ prob = get_probabilities(list_index_logprobs_i)
81
  prob_of_risk = prob[1]
82
 
83
  res = tokenizer.decode(output.sequences[:,input_len:][0],skip_special_tokens=True).strip()
 
90
 
91
  return label, prob_of_risk.item()
92
 
93
+ def get_probabilities(logprobs):
94
  safe_token_prob = 1e-50
95
  unsafe_token_prob = 1e-50
96
  for gen_token_i in logprobs: