AnuarSh commited on
Commit
c443f04
·
verified ·
1 Parent(s): a56b051

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +5 -7
README.md CHANGED
@@ -15,7 +15,7 @@ tags:
15
 
16
  **Sentiment-Analysis-7B** is a 7B-parameter autoregressive language model fine-tuned for sentiment classification of user messages directed at a service, product, or agent (the "Target"). It is built on top of [*mistralai/Mistral-7B-Instruct-v0.2*](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) and was fine-tuned with reinforcement learning, using an LLM as a judge, on a small internal training set of ~300 examples. No pre-defined labels were used for training.
17
 
18
- Given a user message, the model generates a response in the following format: the **first token is the sentiment label** (`Negative`, `Neutral`, or `Positive`), followed by a short explanation of the decision. If only the label is needed, set `max_new_tokens=1`.
19
 
20
  ### Evaluation metrics
21
 
@@ -28,7 +28,7 @@ The evaluation metric used is accuracy. The following compares the base model wi
28
 
29
  ### How to use
30
 
31
- The model is a causal language model and is loaded with `AutoModelForCausalLM`. The sentiment label is always the first generated token, so setting `max_new_tokens=1` returns the label only. Use the system prompt below, which defines the "Target" and the sentiment rules.
32
 
33
  ```python
34
  import torch
@@ -67,7 +67,7 @@ inputs = tokenizer.apply_chat_template(
67
  ).to(model.device)
68
 
69
  # Label only
70
- output = model.generate(**inputs, max_new_tokens=1, do_sample=False)
71
  print(tokenizer.decode(output[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
72
  ```
73
 
@@ -80,7 +80,7 @@ Negative
80
  To get the explanation as well, increase `max_new_tokens`:
81
 
82
  ```python
83
- output = model.generate(**inputs, max_new_tokens=128, do_sample=False)
84
  print(tokenizer.decode(output[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
85
  ```
86
 
@@ -88,6 +88,4 @@ Output:
88
 
89
  ```
90
  Negative, the user states an inability to log in, which is a failure related to the Target.
91
- ```
92
-
93
- > Created by Microsoft
 
15
 
16
  **Sentiment-Analysis-7B** is a 7B-parameter autoregressive language model fine-tuned for sentiment classification of user messages directed at a service, product, or agent (the "Target"). It is built on top of [*mistralai/Mistral-7B-Instruct-v0.2*](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2) and was fine-tuned with reinforcement learning, using an LLM as a judge, on a small internal training set of ~300 examples. No pre-defined labels were used for training.
17
 
18
+ Given a user message, the model generates a response in the following format: the **first token is the sentiment label** (`Negative`, `Neutral`, or `Positive`), followed by a short explanation of the decision. If only the label is needed, set `max_new_tokens=3`.
19
 
20
  ### Evaluation metrics
21
 
 
28
 
29
  ### How to use
30
 
31
+ The model is a causal language model and is loaded with `AutoModelForCausalLM`. The sentiment label is always the first generated token, so setting `max_new_tokens=3` returns the label only. Use the system prompt below, which defines the "Target" and the sentiment rules.
32
 
33
  ```python
34
  import torch
 
67
  ).to(model.device)
68
 
69
  # Label only
70
+ output = model.generate(**inputs, max_new_tokens=3, do_sample=False)
71
  print(tokenizer.decode(output[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
72
  ```
73
 
 
80
  To get the explanation as well, increase `max_new_tokens`:
81
 
82
  ```python
83
+ output = model.generate(**inputs, max_new_tokens=64, do_sample=False)
84
  print(tokenizer.decode(output[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
85
  ```
86
 
 
88
 
89
  ```
90
  Negative, the user states an inability to log in, which is a failure related to the Target.
91
+ ```