Alexandre-Numind commited on
Commit
4ca9be5
·
1 Parent(s): 2482d1c

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +44 -0
README.md CHANGED
@@ -1,3 +1,47 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - en
5
+ pipeline_tag: text-classification
6
+ tags:
7
+ - sentiment-analysis
8
+ - text-classification
9
+ - generic
10
+ - sentiment-classification
11
+ - multilingual
12
  ---
13
+
14
+ ## Model
15
+
16
+ Base version of e5-multilingual finetunned on an annotated subset of mC4 (multilingual C4). This model provide generic embedding for sentiment analysis. Embeddings can be used out of the box or fine tune on specific datasets.
17
+
18
+
19
+ ## Usage
20
+
21
+ Below is an example to encode text and get embedding.
22
+
23
+ ```python
24
+ import torch
25
+ from transformers import AutoTokenizer, AutoModel
26
+
27
+
28
+ model = AutoModel.from_pretrained("Numind/e5-multilingual-sentiment_analysis")
29
+ tokenizer = AutoTokenizer.from_pretrained("Numind/e5-multilingual-sentiment_analysis")
30
+ device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
31
+ model.to(device)
32
+
33
+ size = 256
34
+ text = "This movie is amazing"
35
+
36
+ encoding = tokenizer(
37
+ text,
38
+ truncation=True,
39
+ padding='max_length',
40
+ max_length= size,
41
+ )
42
+
43
+ emb = model(
44
+ torch.reshape(torch.tensor(encoding.input_ids),(1,len(encoding.input_ids))).to(device),output_hidden_states=True
45
+ ).hidden_states[-1].cpu().detach()
46
+
47
+ embText = torch.mean(emb,axis = 1)