luisespinosa commited on
Commit
35fa6e8
•
1 Parent(s): 7456b1b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +4 -3
README.md CHANGED
@@ -115,21 +115,22 @@ from transformers import AutoTokenizer, AutoModel, TFAutoModel
115
  import numpy as np
116
 
117
  MODEL = "cardiffnlp/twitter-roberta-base"
 
 
118
  text = "Good night 😊"
119
  text = preprocess(text)
120
- tokenizer = AutoTokenizer.from_pretrained(MODEL)
121
 
122
  # Pytorch
123
- encoded_input = tokenizer(text, return_tensors='pt')
124
  model = AutoModel.from_pretrained(MODEL)
 
125
  features = model(**encoded_input)
126
  features = features[0].detach().cpu().numpy()
127
  features_mean = np.mean(features[0], axis=0)
128
  #features_max = np.max(features[0], axis=0)
129
 
130
  # # Tensorflow
131
- # encoded_input = tokenizer(text, return_tensors='tf')
132
  # model = TFAutoModel.from_pretrained(MODEL)
 
133
  # features = model(encoded_input)
134
  # features = features[0].numpy()
135
  # features_mean = np.mean(features[0], axis=0)
 
115
  import numpy as np
116
 
117
  MODEL = "cardiffnlp/twitter-roberta-base"
118
+ tokenizer = AutoTokenizer.from_pretrained(MODEL)
119
+
120
  text = "Good night 😊"
121
  text = preprocess(text)
 
122
 
123
  # Pytorch
 
124
  model = AutoModel.from_pretrained(MODEL)
125
+ encoded_input = tokenizer(text, return_tensors='pt')
126
  features = model(**encoded_input)
127
  features = features[0].detach().cpu().numpy()
128
  features_mean = np.mean(features[0], axis=0)
129
  #features_max = np.max(features[0], axis=0)
130
 
131
  # # Tensorflow
 
132
  # model = TFAutoModel.from_pretrained(MODEL)
133
+ # encoded_input = tokenizer(text, return_tensors='tf')
134
  # features = model(encoded_input)
135
  # features = features[0].numpy()
136
  # features_mean = np.mean(features[0], axis=0)