--- 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}) ) ```