netgvarun2005 commited on
Commit
b11ea2e
·
1 Parent(s): fb30d7d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +24 -35
README.md CHANGED
@@ -23,8 +23,6 @@ Model can accurately recognize emotions classes- Angry,Sad,Fearful,Happy,Disgust
23
 
24
 
25
  - **Developed by:** [https://www.linkedin.com/in/sharmavaruncs/]
26
- - **Funded by [optional]:** [More Information Needed]
27
- - **Shared by [optional]:** [More Information Needed]
28
  - **Model type:** [MultiModal - Text and Audio based]
29
  - **Language(s) (NLP):** [NLP, Speech processing]
30
  - **Finetuned from model [optional]:** [https://huggingface.co/docs/transformers/model_doc/hubert]
@@ -33,7 +31,7 @@ Model can accurately recognize emotions classes- Angry,Sad,Fearful,Happy,Disgust
33
 
34
  <!-- Provide the basic links for the model. -->
35
 
36
- - **Repository:** [https://github.com/netgvarun2012/VirtualTherapist/]
37
  - **Paper [optional]:** [https://github.com/netgvarun2012/VirtualTherapist/blob/main/documentation/Speech_and_Text_based_MultiModal_Emotion_Recognizer.pdf]
38
  - **Demo [optional]:** [https://huggingface.co/spaces/netgvarun2005/VirtualTherapist]
39
 
@@ -43,39 +41,30 @@ Model can accurately recognize emotions classes- Angry,Sad,Fearful,Happy,Disgust
43
  'Virtual Therapist' app - an Intelligent speech and text input based assistant that can decipher emotions and generate therapeutic messages based on the Emotional state of the user.
44
 
45
  Emotions recognized - Angry,Sad,Fearful,Happy,Disgusted,Surprised,Calm with ~80% accuracy.
46
- ### Direct Use
47
 
48
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
49
-
50
- [More Information Needed]
51
-
52
- ### Downstream Use [optional]
53
-
54
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
55
-
56
- [More Information Needed]
57
-
58
- ### Out-of-Scope Use
59
-
60
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
61
-
62
- [More Information Needed]
63
-
64
- ## Bias, Risks, and Limitations
65
-
66
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
67
-
68
- [More Information Needed]
69
-
70
- ### Recommendations
71
-
72
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
73
-
74
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
75
-
76
- ## How to Get Started with the Model
77
-
78
- Use the code below to get started with the model.
79
 
80
  [More Information Needed]
81
 
 
23
 
24
 
25
  - **Developed by:** [https://www.linkedin.com/in/sharmavaruncs/]
 
 
26
  - **Model type:** [MultiModal - Text and Audio based]
27
  - **Language(s) (NLP):** [NLP, Speech processing]
28
  - **Finetuned from model [optional]:** [https://huggingface.co/docs/transformers/model_doc/hubert]
 
31
 
32
  <!-- Provide the basic links for the model. -->
33
 
34
+ - **Repository:** [https://github.com/netgvarun2012/VirtualTherapist/]
35
  - **Paper [optional]:** [https://github.com/netgvarun2012/VirtualTherapist/blob/main/documentation/Speech_and_Text_based_MultiModal_Emotion_Recognizer.pdf]
36
  - **Demo [optional]:** [https://huggingface.co/spaces/netgvarun2005/VirtualTherapist]
37
 
 
41
  'Virtual Therapist' app - an Intelligent speech and text input based assistant that can decipher emotions and generate therapeutic messages based on the Emotional state of the user.
42
 
43
  Emotions recognized - Angry,Sad,Fearful,Happy,Disgusted,Surprised,Calm with ~80% accuracy.
 
44
 
45
+ Use the code below to get started with the model:
46
+ class MultimodalModel(nn.Module):
47
+ '''
48
+ Custom PyTorch model that takes as input both the audio features and the text embeddings, and concatenates the last hidden states from the Hubert and BERT models.
49
+ '''
50
+ def __init__(self, bert_model_name, num_labels):
51
+ super().__init__()
52
+ self.hubert = HubertForSequenceClassification.from_pretrained("netgvarun2005/HubertStandaloneEmoDetector", num_labels=num_labels).hubert
53
+ self.bert = AutoModel.from_pretrained(bert_model_name)
54
+ self.classifier = nn.Linear(self.hubert.config.hidden_size + self.bert.config.hidden_size, num_labels)
55
+
56
+ def forward(self, input_values, text):
57
+ hubert_output = self.hubert(input_values).last_hidden_state
58
+
59
+ bert_output = self.bert(text).last_hidden_state
60
+
61
+ # Apply mean pooling along the sequence dimension
62
+ hubert_output = hubert_output.mean(dim=1)
63
+ bert_output = bert_output.mean(dim=1)
64
+
65
+ concat_output = torch.cat((hubert_output, bert_output), dim=-1)
66
+ logits = self.classifier(concat_output)
67
+ return logits
 
 
 
 
 
 
 
 
68
 
69
  [More Information Needed]
70