KevSun commited on
Commit
875614e
·
verified ·
1 Parent(s): 36ce1a8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -8
README.md CHANGED
@@ -52,7 +52,6 @@ model.eval() # Set the model to evaluation mode
52
  with torch.no_grad():
53
  outputs = model(**encoded_input)
54
 
55
- # Get the predictions
56
  predictions = outputs.logits.squeeze()
57
 
58
  # Convert to numpy array if necessary
@@ -60,11 +59,10 @@ predicted_scores = predictions.numpy()
60
 
61
  trait_names = ["Agreeableness", "Openness", "Conscientiousness", "Extraversion", "Neuroticism"]
62
 
63
- # Print the predicted personality traits scores
64
  for trait, score in zip(trait_names, predicted_scores):
65
  print(f"{trait}: {score:.4f}")
66
 
67
-
68
  ##"output":
69
  #Agreeableness: 0.3965
70
  #Openness: 0.6714
@@ -75,7 +73,7 @@ for trait, score in zip(trait_names, predicted_scores):
75
  ```
76
 
77
  **Alternatively**, you can use the following code to make inference based on the **bash** terminal.
78
- ```
79
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
80
  import torch
81
  import argparse
@@ -122,12 +120,10 @@ def main():
122
  if __name__ == "__main__":
123
  main()
124
  ```
125
- ```
126
- bash
127
  python script_name.py --input "Your text here"
128
  ```
129
  or
130
- ```
131
- bash
132
  python script_name.py --input path/to/your/textfile.txt
133
  ```
 
52
  with torch.no_grad():
53
  outputs = model(**encoded_input)
54
 
 
55
  predictions = outputs.logits.squeeze()
56
 
57
  # Convert to numpy array if necessary
 
59
 
60
  trait_names = ["Agreeableness", "Openness", "Conscientiousness", "Extraversion", "Neuroticism"]
61
 
62
+
63
  for trait, score in zip(trait_names, predicted_scores):
64
  print(f"{trait}: {score:.4f}")
65
 
 
66
  ##"output":
67
  #Agreeableness: 0.3965
68
  #Openness: 0.6714
 
73
  ```
74
 
75
  **Alternatively**, you can use the following code to make inference based on the **bash** terminal.
76
+ ```python
77
  from transformers import AutoModelForSequenceClassification, AutoTokenizer
78
  import torch
79
  import argparse
 
120
  if __name__ == "__main__":
121
  main()
122
  ```
123
+ ```bash
 
124
  python script_name.py --input "Your text here"
125
  ```
126
  or
127
+ ```bash
 
128
  python script_name.py --input path/to/your/textfile.txt
129
  ```