Update README.md
Browse files
README.md
CHANGED
|
@@ -9,15 +9,6 @@ datasets:
|
|
| 9 |
language:
|
| 10 |
- en
|
| 11 |
---
|
| 12 |
-
|
| 13 |
-
# Model Card for Model ID
|
| 14 |
-
|
| 15 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
## Model Details
|
| 20 |
-
|
| 21 |
### Model Description
|
| 22 |
|
| 23 |
<!-- Provide a longer summary of what this model is. -->
|
|
@@ -32,7 +23,7 @@ This is the model card of a 🤗 transformers model that has been pushed on the
|
|
| 32 |
|
| 33 |
|
| 34 |
## Training Details
|
| 35 |
-
|
| 36 |
|
| 37 |
|
| 38 |
|
|
@@ -46,16 +37,6 @@ The following hyperparameters were used during training:
|
|
| 46 |
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
| 47 |
- lr_scheduler_type: cosine
|
| 48 |
- training_steps: 10000
|
| 49 |
-
-
|
| 50 |
-
#### Speeds, Sizes, Times [optional]
|
| 51 |
-
|
| 52 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 53 |
-
|
| 54 |
-
[More Information Needed]
|
| 55 |
-
|
| 56 |
-
## Evaluation
|
| 57 |
-
|
| 58 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 59 |
|
| 60 |
### Inference
|
| 61 |
|
|
@@ -92,18 +73,12 @@ outputs = model.generate(inputs["input_ids"], max_new_tokens=1024, pad_token_id=
|
|
| 92 |
stopping_criteria = [EosListStoppingCriteria()])
|
| 93 |
|
| 94 |
text = tokenizer.batch_decode(outputs)[0]
|
| 95 |
-
|
| 96 |
-
# print(text.split("The correct option is")[-1].replace("<|im_end|>", "").replace(".", ""))
|
| 97 |
-
|
| 98 |
-
# Define a dictionary to map values to labels
|
| 99 |
-
label_map = {"2": "positive", "0": "negative", "1": "neutral"}
|
| 100 |
answer = text.split("<|im_start|>phi:")[-1].replace("<|im_end|>", "").replace(".", "")
|
| 101 |
|
| 102 |
sentiment_label = re.search(r'(\d)', answer)
|
| 103 |
sentiment_score = int(sentiment_label.group(1))
|
| 104 |
|
| 105 |
-
if
|
| 106 |
-
sentiment_score = int(sentiment_label.group(1))
|
| 107 |
print(id2label.get(sentiment_score, "none"))
|
| 108 |
else:
|
| 109 |
print("none")
|
|
|
|
| 9 |
language:
|
| 10 |
- en
|
| 11 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
### Model Description
|
| 13 |
|
| 14 |
<!-- Provide a longer summary of what this model is. -->
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
## Training Details
|
| 26 |
+
https://github.com/mit1280/fined-tuning/blob/main/phi_2_classification_fine_tune.ipynb
|
| 27 |
|
| 28 |
|
| 29 |
|
|
|
|
| 37 |
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
|
| 38 |
- lr_scheduler_type: cosine
|
| 39 |
- training_steps: 10000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
|
| 41 |
### Inference
|
| 42 |
|
|
|
|
| 73 |
stopping_criteria = [EosListStoppingCriteria()])
|
| 74 |
|
| 75 |
text = tokenizer.batch_decode(outputs)[0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
answer = text.split("<|im_start|>phi:")[-1].replace("<|im_end|>", "").replace(".", "")
|
| 77 |
|
| 78 |
sentiment_label = re.search(r'(\d)', answer)
|
| 79 |
sentiment_score = int(sentiment_label.group(1))
|
| 80 |
|
| 81 |
+
if sentiment_score:
|
|
|
|
| 82 |
print(id2label.get(sentiment_score, "none"))
|
| 83 |
else:
|
| 84 |
print("none")
|