Sentence Similarity
sentence-transformers
Safetensors
new
feature-extraction
Generated from Trainer
dataset_size:11779
loss:TripletLoss
custom_code
text-embeddings-inference
Instructions to use dpanea/skill-assignment-transformer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use dpanea/skill-assignment-transformer with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("dpanea/skill-assignment-transformer", trust_remote_code=True) sentences = [ "One day there was a boy called teddy (Ted Andrew)and his favorite game \nwas soccer. One day on his walk home from school he saw a glowing \nsoccer ball on the side of the road! It was just a normal soccer ball but \nglowing so he decided to touch it he walked,he bent,he touched and \nsuddenly he was been transported to the soccer finals.\nHe was in a real life soccer game, it had not started yet but somehow he \nwas running out on the pitch with them.What is happening?he thought,is \nthis a dream he was asking himself this but knew it was real.He checked all\nthe players and realized van dijk was missing then he looked down and \nrealized that they were his then he realized he was playing as him!\nSoon later the Match started and he was in it then konate passed the ball to\nhim so he passed it to Mac Alister, who lobbed it down the wing to salah, \nwho counted it to jota who headed it in! he couldn’t believe it he was in an \nactual soccer Match. It was 1-0 the other teams coach had called time out \nso he had a bit to think about this odd situation,then he just decided to have\nfun and play.\nSzoboszlai took the starting kick and passed it back to him so van dijk (Ted \nAndrew)raced down the pitch then he realized he had the skill of van dijk he \nkicked and won a corner,so Trent took and it was perfect teddy timed it with\nvan dijk’s skill and scored! now it was half time.\nHalf time stared of pretty normally the other side passed it back and tried to\nkeep possession but gravenberch the play maker stole it and passed to \nMac Alister who passed it back to Roberson who made some forward \nthrust and and passed it to Diaz. Now it was really close to another goal he \ncould feel it and sure enough Diaz scored,it was back to kick of the other \nteam was pushing up and took a good shot but Alisson did a great dive and\nsaved it now it was 3-0 and the Match was almost over, 3 minutes left they \nkept possession and won after they all celebrated he touched the mach ball\nand he got transported back and every day after that he would go play with \nthe team,The end.\n", "Narrative Storytelling Skills: Narrative Writing", "Essay Organization Skills: I can write three or more sentences with my ideas in order", "Source Analysis Skills: I can compose source analysis using appropriate sentence structure and paragraphs" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -230,9 +230,9 @@ pipeline_tag: sentence-similarity
|
|
| 230 |
library_name: sentence-transformers
|
| 231 |
---
|
| 232 |
|
| 233 |
-
# SentenceTransformer based on Alibaba-NLP/gte-large-en-v1.5
|
| 234 |
|
| 235 |
-
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [Alibaba-NLP/gte-large-en-v1.5](https://huggingface.co/Alibaba-NLP/gte-large-en-v1.5). It maps sentences & paragraphs to a 1024-dimensional dense vector space and
|
| 236 |
|
| 237 |
## Model Details
|
| 238 |
|
|
@@ -242,25 +242,12 @@ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [A
|
|
| 242 |
- **Maximum Sequence Length:** 8192 tokens
|
| 243 |
- **Output Dimensionality:** 1024 dimensions
|
| 244 |
- **Similarity Function:** Cosine Similarity
|
| 245 |
-
|
|
|
|
|
|
|
| 246 |
<!-- - **Language:** Unknown -->
|
| 247 |
<!-- - **License:** Unknown -->
|
| 248 |
|
| 249 |
-
### Model Sources
|
| 250 |
-
|
| 251 |
-
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
|
| 252 |
-
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
|
| 253 |
-
- **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
|
| 254 |
-
|
| 255 |
-
### Full Model Architecture
|
| 256 |
-
|
| 257 |
-
```
|
| 258 |
-
SentenceTransformer(
|
| 259 |
-
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: NewModel
|
| 260 |
-
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
|
| 261 |
-
)
|
| 262 |
-
```
|
| 263 |
-
|
| 264 |
## Usage
|
| 265 |
|
| 266 |
### Direct Usage (Sentence Transformers)
|
|
@@ -271,26 +258,31 @@ First install the Sentence Transformers library:
|
|
| 271 |
pip install -U sentence-transformers
|
| 272 |
```
|
| 273 |
|
| 274 |
-
Then you can load this model and run inference.
|
|
|
|
| 275 |
```python
|
| 276 |
from sentence_transformers import SentenceTransformer
|
| 277 |
|
| 278 |
# Download from the 🤗 Hub
|
| 279 |
model = SentenceTransformer("dpanea/skill-assignment-transformer")
|
| 280 |
-
#
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 285 |
]
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
similarities =
|
| 292 |
-
|
| 293 |
-
|
| 294 |
```
|
| 295 |
|
| 296 |
<!--
|
|
@@ -336,14 +328,14 @@ You can finetune this model on your own dataset.
|
|
| 336 |
#### Unnamed Dataset
|
| 337 |
|
| 338 |
* Size: 11,779 training samples
|
| 339 |
-
* Columns: <code>
|
| 340 |
* Approximate statistics based on the first 1000 samples:
|
| 341 |
-
| |
|
| 342 |
|:--------|:---------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
|
| 343 |
| type | string | string | string |
|
| 344 |
| details | <ul><li>min: 124 tokens</li><li>mean: 615.96 tokens</li><li>max: 1566 tokens</li></ul> | <ul><li>min: 7 tokens</li><li>mean: 19.72 tokens</li><li>max: 69 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 19.55 tokens</li><li>max: 53 tokens</li></ul> |
|
| 345 |
* Samples:
|
| 346 |
-
|
|
| 347 |
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 348 |
| <code>2024 POETRY FEATURE ARTICLE – SCAFFOLD - blank<br>Name: <br>Song Chosen: SET IT ALL FREE<br>Poem Chosen: STILL, I RISE<br>Common theme: These form together to give the message of overcoming challenges and rising above difficulties with confidence and strength.<br>]<br>THIS Scaffold could be submitted as your draft. <br>HEADLINE: It needs to be strong, catchy and stimulate the reader. Try for ‘ear appeal’ or ‘brain appeal’ if you can. Possibly use alliteration or a pun. Just use the title of your poem until you can think of a title for the article. FOCUS BLUB: A brief, gripping sentence or two that lets readers know more specifically what the article is about. It gives a sense of the style of your piece. / Voiceworks - Whispers Of Wisdom Discover the themes of resilience and empowerment in Scarlett Johanssons “set it all Free” and mya Angelou’s “still I rise” I will explore how these works help us to overcome adversity and embrace our true strength...</code> | <code>Emotionally Engaging Language: I can evoke an emotional response through emotive language.</code> | <code>Reference Formatting Skills: Formats the reference list/bibliography correctly.</code> |
|
| 349 |
| <code>Why is there no fuel for the next 500 kilometers? We need fuel and there is no way to turn back.This is such a bad time.We need fuel and i am gonna rage quit and drive us off the bridge if we can't get fuel any time soon pull over it's my turn, to drive you have been driving for the last hour and i want t go speeding, down this hill and get to the fuel station quicker, you drive way to slow and it is annoying me.Ok fine i'm pulling over.Finally ok i see that red car coming ,he wants to race and im racing him.ya i beat him but now we only have enough fuel for the next 200 km and the next fuel station is 250 km away i will drive until we run out of fuel then we will have to push and i'm paying for the fuel don't even think about paying for the fuel little brother.Ok time to push.No i am not pushing the car and you can not make me just because u are 1 year older than me does no mean can boss me around.Fine i will push lazy boy.What Why is the gas station shut down and the next one is 300k...</code> | <code>Essay Organization Skills: Essay Writing</code> | <code>Case Evaluation Skills: Does the student include discerning evaluation of ideas to support their case for positive change? </code> |
|
|
|
|
| 230 |
library_name: sentence-transformers
|
| 231 |
---
|
| 232 |
|
| 233 |
+
# Skill Assignment SentenceTransformer based on Alibaba-NLP/gte-large-en-v1.5
|
| 234 |
|
| 235 |
+
This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [Alibaba-NLP/gte-large-en-v1.5](https://huggingface.co/Alibaba-NLP/gte-large-en-v1.5). It maps sentences & paragraphs to a 1024-dimensional dense vector space and has been fine-tuned to match essay texts with relevant skills for pedadogical evaluation.
|
| 236 |
|
| 237 |
## Model Details
|
| 238 |
|
|
|
|
| 242 |
- **Maximum Sequence Length:** 8192 tokens
|
| 243 |
- **Output Dimensionality:** 1024 dimensions
|
| 244 |
- **Similarity Function:** Cosine Similarity
|
| 245 |
+
- **Training Dataset:** 11779 triplets (anchor, positive, negative) consisting of (essay text, relevant skill, irrelevant skill)
|
| 246 |
+
- **Training Loss:** Triplet loss
|
| 247 |
+
- **Final evaluation:** 100% accuracy using the [Triplet Evaluator](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#tripletevaluator) with 0 margin on 619 validation triplets.
|
| 248 |
<!-- - **Language:** Unknown -->
|
| 249 |
<!-- - **License:** Unknown -->
|
| 250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
## Usage
|
| 252 |
|
| 253 |
### Direct Usage (Sentence Transformers)
|
|
|
|
| 258 |
pip install -U sentence-transformers
|
| 259 |
```
|
| 260 |
|
| 261 |
+
Then you can load this model and run inference, to find matching skills for a given essay.
|
| 262 |
+
The essay should be in plain text, and the skills should ideally be of the form "Short skill name: detailed skill description"
|
| 263 |
```python
|
| 264 |
from sentence_transformers import SentenceTransformer
|
| 265 |
|
| 266 |
# Download from the 🤗 Hub
|
| 267 |
model = SentenceTransformer("dpanea/skill-assignment-transformer")
|
| 268 |
+
# Prepare data
|
| 269 |
+
essay_text = ['Fighter Jet\nGreetings my fellow friends. I am going to talk about my greatest passion fighter jets...']
|
| 270 |
+
skills = [
|
| 271 |
+
'Noun Consistency Skills: I can use nouns, pronouns, plurals and tenses accurately and consistently throughout.',
|
| 272 |
+
'Adventurous Vocabulary Skills: I can select from a range of known adventurous vocabulary. (tier 2 and tier 3 words).',
|
| 273 |
+
'Descriptive Language Skills: I can use appropriate, interesting and varied word choice (adjectives, adverbs and descriptive phrases).',
|
| 274 |
+
'Dialogue Tagging Skills: I can use dialogue tags successfully (eg correct positioning, new line for new speaker).',
|
| 275 |
+
'Spell Words: I can spell commonly used words accurately.',
|
| 276 |
+
...
|
| 277 |
]
|
| 278 |
+
# Get embeddings
|
| 279 |
+
essay_embedding = model.encode(essay_text)
|
| 280 |
+
skill_embeddings = model.encode(skills)
|
| 281 |
+
# Get the k most relevant skills for the given essay
|
| 282 |
+
from sentence_transformers.util import cos_sim
|
| 283 |
+
similarities = cos_sim(essay_embedding, skill_embeddings).flatten()
|
| 284 |
+
top_indices = np.argsort(similarities)[-k:][::-1]
|
| 285 |
+
top_skills = [all_skill_texts[i] for i in top_indices]
|
| 286 |
```
|
| 287 |
|
| 288 |
<!--
|
|
|
|
| 328 |
#### Unnamed Dataset
|
| 329 |
|
| 330 |
* Size: 11,779 training samples
|
| 331 |
+
* Columns: <code>Essay text</code>, <code>Relevant skill</code>, and <code>Irrelevant skill</code>
|
| 332 |
* Approximate statistics based on the first 1000 samples:
|
| 333 |
+
| | Essay text | Relevant skill | Irrelevant skill |
|
| 334 |
|:--------|:---------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|:----------------------------------------------------------------------------------|
|
| 335 |
| type | string | string | string |
|
| 336 |
| details | <ul><li>min: 124 tokens</li><li>mean: 615.96 tokens</li><li>max: 1566 tokens</li></ul> | <ul><li>min: 7 tokens</li><li>mean: 19.72 tokens</li><li>max: 69 tokens</li></ul> | <ul><li>min: 6 tokens</li><li>mean: 19.55 tokens</li><li>max: 53 tokens</li></ul> |
|
| 337 |
* Samples:
|
| 338 |
+
| Essay text | Relevant skill | Irrelevant skill |
|
| 339 |
|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
| 340 |
| <code>2024 POETRY FEATURE ARTICLE – SCAFFOLD - blank<br>Name: <br>Song Chosen: SET IT ALL FREE<br>Poem Chosen: STILL, I RISE<br>Common theme: These form together to give the message of overcoming challenges and rising above difficulties with confidence and strength.<br>]<br>THIS Scaffold could be submitted as your draft. <br>HEADLINE: It needs to be strong, catchy and stimulate the reader. Try for ‘ear appeal’ or ‘brain appeal’ if you can. Possibly use alliteration or a pun. Just use the title of your poem until you can think of a title for the article. FOCUS BLUB: A brief, gripping sentence or two that lets readers know more specifically what the article is about. It gives a sense of the style of your piece. / Voiceworks - Whispers Of Wisdom Discover the themes of resilience and empowerment in Scarlett Johanssons “set it all Free” and mya Angelou’s “still I rise” I will explore how these works help us to overcome adversity and embrace our true strength...</code> | <code>Emotionally Engaging Language: I can evoke an emotional response through emotive language.</code> | <code>Reference Formatting Skills: Formats the reference list/bibliography correctly.</code> |
|
| 341 |
| <code>Why is there no fuel for the next 500 kilometers? We need fuel and there is no way to turn back.This is such a bad time.We need fuel and i am gonna rage quit and drive us off the bridge if we can't get fuel any time soon pull over it's my turn, to drive you have been driving for the last hour and i want t go speeding, down this hill and get to the fuel station quicker, you drive way to slow and it is annoying me.Ok fine i'm pulling over.Finally ok i see that red car coming ,he wants to race and im racing him.ya i beat him but now we only have enough fuel for the next 200 km and the next fuel station is 250 km away i will drive until we run out of fuel then we will have to push and i'm paying for the fuel don't even think about paying for the fuel little brother.Ok time to push.No i am not pushing the car and you can not make me just because u are 1 year older than me does no mean can boss me around.Fine i will push lazy boy.What Why is the gas station shut down and the next one is 300k...</code> | <code>Essay Organization Skills: Essay Writing</code> | <code>Case Evaluation Skills: Does the student include discerning evaluation of ideas to support their case for positive change? </code> |
|