ink-pad jsilverman26 commited on
Commit
3b3fee4
1 Parent(s): deed3f1

Fix typo in example code (#3)

Browse files

- Fix typo in example code (c5c885a8066c37e68cce6bb34823442b0488ac09)


Co-authored-by: Jeong Deok <[email protected]>

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