Julien Simon commited on
Commit
0ccc8c8
1 Parent(s): f8024d7

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +10 -8
README.md CHANGED
@@ -67,17 +67,19 @@ SequenceClassifierOutput(loss=None, logits=tensor([[-0.4635, -1.0112, 4.7935,
67
  -2.4848, 0.2630, -0.4584, -2.4327, -1.1654, 0.3897, -0.3374, -1.2418,
68
  -0.1045, 0.2827, -1.5667, -0.0963]], grad_fn=<AddmmBackward0>), hidden_states=None, attentions=None)
69
  >>> classes = torch.softmax(logits.logits, dim = -1)
 
70
  >>> classes
71
- tensor([[3.6522e-03, 2.1118e-03, 7.0082e-01, 1.3621e-02, 2.9527e-02, 1.1071e-02,
72
- 2.7143e-02, 4.3466e-02, 2.9051e-02, 1.0417e-02, 6.1027e-04, 1.4051e-02,
73
- 1.3132e-02, 1.2132e-03, 1.4089e-03, 3.8160e-03, 5.2022e-03, 8.8345e-04,
74
- 1.1242e-02, 4.7424e-03, 6.3974e-03, 3.1215e-03, 9.0975e-03, 6.3689e-03,
75
- 4.8384e-04, 7.5519e-03, 3.6707e-03, 5.0970e-04, 1.8101e-03, 8.5720e-03,
76
- 4.1427e-03, 1.6769e-03, 5.2292e-03, 7.7021e-03, 1.2117e-03, 5.2723e-03]],
77
  grad_fn=<SoftmaxBackward0>)
78
  >>> top_class = torch.argmax(logits.logits, dim = -1)
79
- >>> top_class = top_class.detach().numpy()[0]
80
- >>> model.config.id2label[top_class]
 
81
  'up'
82
  ```
83
 
 
67
  -2.4848, 0.2630, -0.4584, -2.4327, -1.1654, 0.3897, -0.3374, -1.2418,
68
  -0.1045, 0.2827, -1.5667, -0.0963]], grad_fn=<AddmmBackward0>), hidden_states=None, attentions=None)
69
  >>> classes = torch.softmax(logits.logits, dim = -1)
70
+ >>> torch.set_printoptions(precision=3, sci_mode=False)
71
  >>> classes
72
+ tensor([[ 0.004, 0.002, 0.701, 0.014, 0.030, 0.011,
73
+ 0.027, 0.043, 0.029, 0.010, 0.001, 0.014,
74
+ 0.013, 0.001, 0.001, 0.004, 0.005, 0.001,
75
+ 0.011, 0.005, 0.006, 0.003, 0.009, 0.006,
76
+ 0.000, 0.008, 0.004, 0.001, 0.002, 0.009,
77
+ 0.004, 0.002, 0.005, 0.008, 0.001, 0.005]],
78
  grad_fn=<SoftmaxBackward0>)
79
  >>> top_class = torch.argmax(logits.logits, dim = -1)
80
+ >>> top_class
81
+ tensor([2])
82
+ >>> model.config.id2label[top_class.numpy()[0]]
83
  'up'
84
  ```
85