Update README.md
Browse files
README.md
CHANGED
|
@@ -15,31 +15,24 @@ tags: []
|
|
| 15 |
|
| 16 |
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
|
| 18 |
-
This is the model
|
| 19 |
|
| 20 |
-
- **Developed by:** [
|
| 21 |
-
- **Funded by [optional]:** [
|
| 22 |
-
- **Shared by [optional]:** [
|
| 23 |
-
- **Model type:** [
|
| 24 |
-
- **Language(s) (NLP):** [
|
| 25 |
-
- **License:** [
|
| 26 |
-
- **Finetuned from model [optional]:** [
|
| 27 |
|
| 28 |
-
### Model Sources [optional]
|
| 29 |
-
|
| 30 |
-
<!-- Provide the basic links for the model. -->
|
| 31 |
-
|
| 32 |
-
- **Repository:** [More Information Needed]
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
## Uses
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
### Direct Use
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
[More Information Needed]
|
| 45 |
|
|
@@ -57,143 +50,130 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
| 57 |
|
| 58 |
## Bias, Risks, and Limitations
|
| 59 |
|
| 60 |
-
|
| 61 |
|
| 62 |
[More Information Needed]
|
| 63 |
|
| 64 |
### Recommendations
|
| 65 |
|
| 66 |
-
|
| 67 |
|
| 68 |
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
|
| 70 |
## How to Get Started with the Model
|
| 71 |
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
### Training Data
|
| 79 |
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
[More Information Needed]
|
| 83 |
|
| 84 |
### Training Procedure
|
| 85 |
|
| 86 |
-
|
| 87 |
|
| 88 |
#### Preprocessing [optional]
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
#### Training Hyperparameters
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
## Evaluation
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
### Testing Data, Factors & Metrics
|
| 108 |
|
| 109 |
#### Testing Data
|
| 110 |
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
|
| 131 |
#### Summary
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
-
|
| 197 |
-
## Model Card Contact
|
| 198 |
-
|
| 199 |
-
[More Information Needed]
|
|
|
|
| 15 |
|
| 16 |
<!-- Provide a longer summary of what this model is. -->
|
| 17 |
|
| 18 |
+
This is the model used to seperate long questions into seperate questions if possible.
|
| 19 |
|
| 20 |
+
- **Developed by:** [Geerath Bhat]
|
| 21 |
+
- **Funded by [optional]:** [Geerath Bhat]
|
| 22 |
+
- **Shared by [optional]:** [Geerath Bhat]
|
| 23 |
+
- **Model type:** [Fine-tuned Instruct LLM]
|
| 24 |
+
- **Language(s) (NLP):** [English]
|
| 25 |
+
- **License:** []
|
| 26 |
+
- **Finetuned from model [optional]:** []
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
## Uses
|
| 30 |
|
| 31 |
+
We can use this model to seperate long context data into seperate meaningful parts.
|
| 32 |
|
| 33 |
### Direct Use
|
| 34 |
|
| 35 |
+
You can use this model and soon we will provide a demo version also.
|
| 36 |
|
| 37 |
[More Information Needed]
|
| 38 |
|
|
|
|
| 50 |
|
| 51 |
## Bias, Risks, and Limitations
|
| 52 |
|
| 53 |
+
The model will not work in very complex situations but we have measured it's perfommance and it performs well on most complex tasks.
|
| 54 |
|
| 55 |
[More Information Needed]
|
| 56 |
|
| 57 |
### Recommendations
|
| 58 |
|
| 59 |
+
Give a complex nested questions and it will seperate those questions or contexr into meaningful parts.
|
| 60 |
|
| 61 |
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 62 |
|
| 63 |
## How to Get Started with the Model
|
| 64 |
|
| 65 |
+
```
|
| 66 |
+
from transformers import AutoModelForSeq2SeqLM
|
| 67 |
+
import nltk
|
| 68 |
+
nltk.download('punkt')
|
| 69 |
+
nltk.download('punkt_tab')
|
| 70 |
+
import string
|
| 71 |
+
from transformers import AutoTokenizer
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
# Get the tokenizer
|
| 75 |
+
|
| 76 |
+
```
|
| 77 |
+
model_checkpoint = "Geerath/seperator"
|
| 78 |
+
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
# Load the model
|
| 82 |
+
```
|
| 83 |
+
model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)
|
| 84 |
+
|
| 85 |
+
max_input_length = 512
|
| 86 |
+
```
|
| 87 |
+
## Inference
|
| 88 |
+
```
|
| 89 |
+
prompt = """
|
| 90 |
+
You are given a query that combines multiple questions into a single string. Your task is to break down this combined query into individual questions, ensuring each question is clear and stands alone."""
|
| 91 |
+
text = """
|
| 92 |
+
Where is IISc Located, what is GDP?, How can we utilize the power of wind mill and what is photosynthesis?
|
| 93 |
+
"""
|
| 94 |
+
|
| 95 |
+
inputs = [prompt + text]
|
| 96 |
+
|
| 97 |
+
inputs = tokenizer(inputs, max_length=max_input_length, truncation=True, return_tensors="pt")
|
| 98 |
+
output = model.generate(**inputs, num_beams=8, do_sample=True, min_length=10, max_length=512)
|
| 99 |
+
decoded_output = tokenizer.batch_decode(output, skip_special_tokens=True)[0]
|
| 100 |
+
predicted_title = nltk.sent_tokenize(decoded_output.strip())
|
| 101 |
+
|
| 102 |
+
print(predicted_title)
|
| 103 |
+
```
|
| 104 |
+
## Result - ['Where is IISc Located, what is GDP?, How can we utilize the power of wind mill, and what is photosynthesis?']
|
| 105 |
|
| 106 |
### Training Data
|
| 107 |
|
| 108 |
+
Custom dataset generated using multiple LLMs.
|
|
|
|
|
|
|
| 109 |
|
| 110 |
### Training Procedure
|
| 111 |
|
| 112 |
+
Finetuned T5 on custom dataset
|
| 113 |
|
| 114 |
#### Preprocessing [optional]
|
| 115 |
+
```
|
| 116 |
+
max_input_length = 512
|
| 117 |
+
max_target_length = 512
|
| 118 |
+
def clean_text(text):
|
| 119 |
+
sentences = nltk.sent_tokenize(text.strip())
|
| 120 |
+
sentences_cleaned = [s for sent in sentences for s in sent.split("\n")]
|
| 121 |
+
sentences_cleaned_no_titles = [sent for sent in sentences_cleaned
|
| 122 |
+
if len(sent) > 0 and
|
| 123 |
+
sent[-1] in string.punctuation]
|
| 124 |
+
text_cleaned = "\n".join(sentences_cleaned_no_titles)
|
| 125 |
+
return text_cleaned
|
| 126 |
+
|
| 127 |
+
def preprocess_data(examples):
|
| 128 |
+
texts_cleaned = [text for text in examples["input"]]
|
| 129 |
+
inputs = [prefix + text for text in texts_cleaned]
|
| 130 |
+
model_inputs = tokenizer(inputs, max_length=max_input_length, truncation=True)
|
| 131 |
+
with tokenizer.as_target_tokenizer():
|
| 132 |
+
labels = tokenizer(examples["output"], max_length=max_target_length,
|
| 133 |
+
truncation=True)
|
| 134 |
+
|
| 135 |
+
model_inputs["labels"] = labels["input_ids"]
|
| 136 |
+
return model_inputs
|
| 137 |
+
```
|
| 138 |
|
| 139 |
#### Training Hyperparameters
|
| 140 |
+
```
|
| 141 |
+
batch_size = 16
|
| 142 |
+
args = Seq2SeqTrainingArguments(
|
| 143 |
+
model_dir,
|
| 144 |
+
evaluation_strategy="steps",
|
| 145 |
+
eval_steps=100,
|
| 146 |
+
logging_strategy="steps",
|
| 147 |
+
logging_steps=100,
|
| 148 |
+
save_strategy="steps",
|
| 149 |
+
save_steps=200,
|
| 150 |
+
learning_rate=4e-5,
|
| 151 |
+
per_device_train_batch_size=batch_size,
|
| 152 |
+
per_device_eval_batch_size=batch_size,
|
| 153 |
+
weight_decay=0.01,
|
| 154 |
+
save_total_limit=3,
|
| 155 |
+
num_train_epochs=10,
|
| 156 |
+
predict_with_generate=True,
|
| 157 |
+
fp16=True,
|
| 158 |
+
load_best_model_at_end=True,
|
| 159 |
+
metric_for_best_model="rouge1",
|
| 160 |
+
#push_to_hub=True
|
| 161 |
+
)
|
| 162 |
+
```
|
| 163 |
|
| 164 |
## Evaluation
|
| 165 |
|
| 166 |
+
|
| 167 |
|
| 168 |
### Testing Data, Factors & Metrics
|
| 169 |
|
| 170 |
#### Testing Data
|
| 171 |
|
| 172 |
+
Custom data prepared.
|
|
|
|
|
|
|
| 173 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
|
| 175 |
#### Summary
|
| 176 |
|
| 177 |
+
Model take a input as a text and gives output as list of text seperated by commas.
|
| 178 |
+
Example - Input -> Where is IISc Located, what is GDP?, How can we utilize the power of wind mill and what is photosynthesis?
|
| 179 |
+
Output -> ['Where is IISc Located, what is GDP?, How can we utilize the power of wind mill, and what is photosynthesis?']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|