File size: 1,597 Bytes
eda6cce
 
 
 
 
 
 
 
 
 
39785b7
 
 
 
0019528
eda6cce
ef25c3a
eda6cce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ff9e4a8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
---
library_name: sentence-transformers
pipeline_tag: sentence-similarity
tags:
- sentence-transformers
- feature-extraction
- sentence-similarity
- transformers
---

# SPACE-2

Model from the paper ["SPACE-2: Tree-Structured Semi-Supervised Contrastive Pre-training for Task-Oriented Dialog Understanding"](https://arxiv.org/abs/2209.06638).

This a port of the original [SPACE-2 model](https://github.com/AlibabaResearch/DAMO-ConvAI/tree/main/space-2) using authors' original [space2hug.py](https://github.com/AlibabaResearch/DAMO-ConvAI/blob/main/space-2/tools/space2hug.py) convertion script.

This is a [sentence-transformers](https://www.SBERT.net) wrapper around the ported model.


## Usage (Sentence-Transformers)

Using this model becomes easy when you have [sentence-transformers](https://www.SBERT.net) installed:

```
pip install -U sentence-transformers
```

Then you can use the model like this:

```python
from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]

model = SentenceTransformer('sergioburdisso/space-2')
embeddings = model.encode(sentences)
print(embeddings)
```


## Full Model Architecture
```
SentenceTransformer(
  (0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel 
  (1): Pooling({'word_embedding_dimension': 768, '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})
)
```