Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- 1_Pooling/config.json +8 -6
- README.md +129 -35
- config.json +1 -2
- config_sentence_transformers.json +14 -0
- modules.json +14 -0
- sentence_bert_config.json +4 -0
- sentencepiece.bpe.model +3 -0
- special_tokens_map.json +15 -0
- tokenizer.json +3 -0
- tokenizer_config.json +55 -0
    	
        .gitattributes
    CHANGED
    
    | @@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text | |
| 33 | 
             
            *.zip filter=lfs diff=lfs merge=lfs -text
         | 
| 34 | 
             
            *.zst filter=lfs diff=lfs merge=lfs -text
         | 
| 35 | 
             
            *tfevents* filter=lfs diff=lfs merge=lfs -text
         | 
|  | 
|  | |
| 33 | 
             
            *.zip filter=lfs diff=lfs merge=lfs -text
         | 
| 34 | 
             
            *.zst filter=lfs diff=lfs merge=lfs -text
         | 
| 35 | 
             
            *tfevents* filter=lfs diff=lfs merge=lfs -text
         | 
| 36 | 
            +
            tokenizer.json filter=lfs diff=lfs merge=lfs -text
         | 
    	
        1_Pooling/config.json
    CHANGED
    
    | @@ -1,7 +1,9 @@ | |
| 1 | 
             
            {
         | 
| 2 | 
            -
             | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
|  | |
|  | 
|  | |
| 1 | 
             
            {
         | 
| 2 | 
            +
                "word_embedding_dimension": 1024,
         | 
| 3 | 
            +
                "pooling_mode_cls_token": true,
         | 
| 4 | 
            +
                "pooling_mode_mean_tokens": false,
         | 
| 5 | 
            +
                "pooling_mode_max_tokens": false,
         | 
| 6 | 
            +
                "pooling_mode_mean_sqrt_len_tokens": false,
         | 
| 7 | 
            +
                "pooling_mode_weightedmean_tokens": false,
         | 
| 8 | 
            +
                "pooling_mode_lasttoken": false
         | 
| 9 | 
            +
            }
         | 
    	
        README.md
    CHANGED
    
    | @@ -1,49 +1,143 @@ | |
| 1 | 
             
            ---
         | 
| 2 | 
            -
            library_name: transformers
         | 
| 3 | 
             
            tags:
         | 
| 4 | 
            -
            -  | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
            -  | 
| 8 | 
             
            pipeline_tag: sentence-similarity
         | 
|  | |
| 9 | 
             
            ---
         | 
| 10 |  | 
| 11 | 
            -
             | 
| 12 |  | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
| 17 |  | 
| 18 | 
            -
             | 
| 19 | 
            -
            model = XLMRobertaModel.from_pretrained("facebook/MEXMA", add_pooling_layer=False)
         | 
| 20 | 
            -
            example_sentences = ['Sentence1', 'Sentence2']
         | 
| 21 | 
            -
            example_inputs = tokenizer(example_sentences, return_tensors='pt')
         | 
| 22 |  | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
|  | |
|  | |
| 26 | 
             
            ```
         | 
| 27 |  | 
| 28 | 
            -
             | 
| 29 | 
            -
            This model is released under the MIT license.
         | 
| 30 |  | 
| 31 | 
            -
             | 
| 32 | 
            -
            For the training code of this model, please check the official [MEXMA repo](https://github.com/facebookresearch/mexma).
         | 
| 33 |  | 
| 34 | 
            -
             | 
| 35 | 
            -
            [MEXMA: Token-level objectives improve sentence representations](https://arxiv.org/abs/2409.12737)
         | 
| 36 |  | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
             
            ```
         | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
             
            ---
         | 
|  | |
| 2 | 
             
            tags:
         | 
| 3 | 
            +
            - sentence-transformers
         | 
| 4 | 
            +
            - sentence-similarity
         | 
| 5 | 
            +
            - feature-extraction
         | 
| 6 | 
            +
            - dense
         | 
| 7 | 
             
            pipeline_tag: sentence-similarity
         | 
| 8 | 
            +
            library_name: sentence-transformers
         | 
| 9 | 
             
            ---
         | 
| 10 |  | 
| 11 | 
            +
            # SentenceTransformer
         | 
| 12 |  | 
| 13 | 
            +
            This is a [sentence-transformers](https://www.SBERT.net) model trained. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ## Model Details
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            ### Model Description
         | 
| 18 | 
            +
            - **Model Type:** Sentence Transformer
         | 
| 19 | 
            +
            <!-- - **Base model:** [Unknown](https://huggingface.co/unknown) -->
         | 
| 20 | 
            +
            - **Maximum Sequence Length:** 512 tokens
         | 
| 21 | 
            +
            - **Output Dimensionality:** 1024 dimensions
         | 
| 22 | 
            +
            - **Similarity Function:** Cosine Similarity
         | 
| 23 | 
            +
            <!-- - **Training Dataset:** Unknown -->
         | 
| 24 | 
            +
            <!-- - **Language:** Unknown -->
         | 
| 25 | 
            +
            <!-- - **License:** Unknown -->
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            ### Model Sources
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
         | 
| 30 | 
            +
            - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
         | 
| 31 | 
            +
            - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
         | 
| 32 |  | 
| 33 | 
            +
            ### Full Model Architecture
         | 
|  | |
|  | |
|  | |
| 34 |  | 
| 35 | 
            +
            ```
         | 
| 36 | 
            +
            SentenceTransformer(
         | 
| 37 | 
            +
              (0): Transformer({'max_seq_length': 512, 'do_lower_case': False, 'architecture': 'XLMRobertaModel'})
         | 
| 38 | 
            +
              (1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
         | 
| 39 | 
            +
            )
         | 
| 40 | 
             
            ```
         | 
| 41 |  | 
| 42 | 
            +
            ## Usage
         | 
|  | |
| 43 |  | 
| 44 | 
            +
            ### Direct Usage (Sentence Transformers)
         | 
|  | |
| 45 |  | 
| 46 | 
            +
            First install the Sentence Transformers library:
         | 
|  | |
| 47 |  | 
| 48 | 
            +
            ```bash
         | 
| 49 | 
            +
            pip install -U sentence-transformers
         | 
| 50 | 
             
            ```
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            Then you can load this model and run inference.
         | 
| 53 | 
            +
            ```python
         | 
| 54 | 
            +
            from sentence_transformers import SentenceTransformer
         | 
| 55 | 
            +
             | 
| 56 | 
            +
            # Download from the 🤗 Hub
         | 
| 57 | 
            +
            model = SentenceTransformer("sentence_transformers_model_id")
         | 
| 58 | 
            +
            # Run inference
         | 
| 59 | 
            +
            sentences = [
         | 
| 60 | 
            +
                'The weather is lovely today.',
         | 
| 61 | 
            +
                "It's so sunny outside!",
         | 
| 62 | 
            +
                'He drove to the stadium.',
         | 
| 63 | 
            +
            ]
         | 
| 64 | 
            +
            embeddings = model.encode(sentences)
         | 
| 65 | 
            +
            print(embeddings.shape)
         | 
| 66 | 
            +
            # [3, 1024]
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            # Get the similarity scores for the embeddings
         | 
| 69 | 
            +
            similarities = model.similarity(embeddings, embeddings)
         | 
| 70 | 
            +
            print(similarities)
         | 
| 71 | 
            +
            # tensor([[1.0000, 0.8701, 0.8232],
         | 
| 72 | 
            +
            #         [0.8701, 1.0000, 0.7860],
         | 
| 73 | 
            +
            #         [0.8232, 0.7860, 1.0000]])
         | 
| 74 | 
            +
            ```
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            <!--
         | 
| 77 | 
            +
            ### Direct Usage (Transformers)
         | 
| 78 | 
            +
             | 
| 79 | 
            +
            <details><summary>Click to see the direct usage in Transformers</summary>
         | 
| 80 | 
            +
             | 
| 81 | 
            +
            </details>
         | 
| 82 | 
            +
            -->
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            <!--
         | 
| 85 | 
            +
            ### Downstream Usage (Sentence Transformers)
         | 
| 86 | 
            +
             | 
| 87 | 
            +
            You can finetune this model on your own dataset.
         | 
| 88 | 
            +
             | 
| 89 | 
            +
            <details><summary>Click to expand</summary>
         | 
| 90 | 
            +
             | 
| 91 | 
            +
            </details>
         | 
| 92 | 
            +
            -->
         | 
| 93 | 
            +
             | 
| 94 | 
            +
            <!--
         | 
| 95 | 
            +
            ### Out-of-Scope Use
         | 
| 96 | 
            +
             | 
| 97 | 
            +
            *List how the model may foreseeably be misused and address what users ought not to do with the model.*
         | 
| 98 | 
            +
            -->
         | 
| 99 | 
            +
             | 
| 100 | 
            +
            <!--
         | 
| 101 | 
            +
            ## Bias, Risks and Limitations
         | 
| 102 | 
            +
             | 
| 103 | 
            +
            *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
         | 
| 104 | 
            +
            -->
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            <!--
         | 
| 107 | 
            +
            ### Recommendations
         | 
| 108 | 
            +
             | 
| 109 | 
            +
            *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
         | 
| 110 | 
            +
            -->
         | 
| 111 | 
            +
             | 
| 112 | 
            +
            ## Training Details
         | 
| 113 | 
            +
             | 
| 114 | 
            +
            ### Framework Versions
         | 
| 115 | 
            +
            - Python: 3.10.14
         | 
| 116 | 
            +
            - Sentence Transformers: 5.1.0
         | 
| 117 | 
            +
            - Transformers: 4.55.3
         | 
| 118 | 
            +
            - PyTorch: 2.8.0+cu128
         | 
| 119 | 
            +
            - Accelerate: 1.10.0
         | 
| 120 | 
            +
            - Datasets: 
         | 
| 121 | 
            +
            - Tokenizers: 0.21.4
         | 
| 122 | 
            +
             | 
| 123 | 
            +
            ## Citation
         | 
| 124 | 
            +
             | 
| 125 | 
            +
            ### BibTeX
         | 
| 126 | 
            +
             | 
| 127 | 
            +
            <!--
         | 
| 128 | 
            +
            ## Glossary
         | 
| 129 | 
            +
             | 
| 130 | 
            +
            *Clearly define terms in order to be accessible across audiences.*
         | 
| 131 | 
            +
            -->
         | 
| 132 | 
            +
             | 
| 133 | 
            +
            <!--
         | 
| 134 | 
            +
            ## Model Card Authors
         | 
| 135 | 
            +
             | 
| 136 | 
            +
            *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
         | 
| 137 | 
            +
            -->
         | 
| 138 | 
            +
             | 
| 139 | 
            +
            <!--
         | 
| 140 | 
            +
            ## Model Card Contact
         | 
| 141 | 
            +
             | 
| 142 | 
            +
            *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
         | 
| 143 | 
            +
            -->
         | 
    	
        config.json
    CHANGED
    
    | @@ -1,5 +1,4 @@ | |
| 1 | 
             
            {
         | 
| 2 | 
            -
              "_name_or_path": "xlm-roberta-large",
         | 
| 3 | 
             
              "architectures": [
         | 
| 4 | 
             
                "XLMRobertaModel"
         | 
| 5 | 
             
              ],
         | 
| @@ -21,7 +20,7 @@ | |
| 21 | 
             
              "pad_token_id": 1,
         | 
| 22 | 
             
              "position_embedding_type": "absolute",
         | 
| 23 | 
             
              "torch_dtype": "float32",
         | 
| 24 | 
            -
              "transformers_version": "4. | 
| 25 | 
             
              "type_vocab_size": 1,
         | 
| 26 | 
             
              "use_cache": true,
         | 
| 27 | 
             
              "vocab_size": 250002
         | 
|  | |
| 1 | 
             
            {
         | 
|  | |
| 2 | 
             
              "architectures": [
         | 
| 3 | 
             
                "XLMRobertaModel"
         | 
| 4 | 
             
              ],
         | 
|  | |
| 20 | 
             
              "pad_token_id": 1,
         | 
| 21 | 
             
              "position_embedding_type": "absolute",
         | 
| 22 | 
             
              "torch_dtype": "float32",
         | 
| 23 | 
            +
              "transformers_version": "4.55.3",
         | 
| 24 | 
             
              "type_vocab_size": 1,
         | 
| 25 | 
             
              "use_cache": true,
         | 
| 26 | 
             
              "vocab_size": 250002
         | 
    	
        config_sentence_transformers.json
    ADDED
    
    | @@ -0,0 +1,14 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            {
         | 
| 2 | 
            +
              "model_type": "SentenceTransformer",
         | 
| 3 | 
            +
              "__version__": {
         | 
| 4 | 
            +
                "sentence_transformers": "5.1.0",
         | 
| 5 | 
            +
                "transformers": "4.55.3",
         | 
| 6 | 
            +
                "pytorch": "2.8.0+cu128"
         | 
| 7 | 
            +
              },
         | 
| 8 | 
            +
              "prompts": {
         | 
| 9 | 
            +
                "query": "",
         | 
| 10 | 
            +
                "document": ""
         | 
| 11 | 
            +
              },
         | 
| 12 | 
            +
              "default_prompt_name": null,
         | 
| 13 | 
            +
              "similarity_fn_name": "cosine"
         | 
| 14 | 
            +
            }
         | 
    	
        modules.json
    ADDED
    
    | @@ -0,0 +1,14 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            [
         | 
| 2 | 
            +
              {
         | 
| 3 | 
            +
                "idx": 0,
         | 
| 4 | 
            +
                "name": "0",
         | 
| 5 | 
            +
                "path": "",
         | 
| 6 | 
            +
                "type": "sentence_transformers.models.Transformer"
         | 
| 7 | 
            +
              },
         | 
| 8 | 
            +
              {
         | 
| 9 | 
            +
                "idx": 1,
         | 
| 10 | 
            +
                "name": "1",
         | 
| 11 | 
            +
                "path": "1_Pooling",
         | 
| 12 | 
            +
                "type": "sentence_transformers.models.Pooling"
         | 
| 13 | 
            +
              }
         | 
| 14 | 
            +
            ]
         | 
    	
        sentence_bert_config.json
    ADDED
    
    | @@ -0,0 +1,4 @@ | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            {
         | 
| 2 | 
            +
                "max_seq_length": 512,
         | 
| 3 | 
            +
                "do_lower_case": false
         | 
| 4 | 
            +
            }
         | 
    	
        sentencepiece.bpe.model
    ADDED
    
    | @@ -0,0 +1,3 @@ | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            version https://git-lfs.github.com/spec/v1
         | 
| 2 | 
            +
            oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
         | 
| 3 | 
            +
            size 5069051
         | 
    	
        special_tokens_map.json
    ADDED
    
    | @@ -0,0 +1,15 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            {
         | 
| 2 | 
            +
              "bos_token": "<s>",
         | 
| 3 | 
            +
              "cls_token": "<s>",
         | 
| 4 | 
            +
              "eos_token": "</s>",
         | 
| 5 | 
            +
              "mask_token": {
         | 
| 6 | 
            +
                "content": "<mask>",
         | 
| 7 | 
            +
                "lstrip": true,
         | 
| 8 | 
            +
                "normalized": false,
         | 
| 9 | 
            +
                "rstrip": false,
         | 
| 10 | 
            +
                "single_word": false
         | 
| 11 | 
            +
              },
         | 
| 12 | 
            +
              "pad_token": "<pad>",
         | 
| 13 | 
            +
              "sep_token": "</s>",
         | 
| 14 | 
            +
              "unk_token": "<unk>"
         | 
| 15 | 
            +
            }
         | 
    	
        tokenizer.json
    ADDED
    
    | @@ -0,0 +1,3 @@ | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            version https://git-lfs.github.com/spec/v1
         | 
| 2 | 
            +
            oid sha256:3a56def25aa40facc030ea8b0b87f3688e4b3c39eb8b45d5702b3a1300fe2a20
         | 
| 3 | 
            +
            size 17082734
         | 
    	
        tokenizer_config.json
    ADDED
    
    | @@ -0,0 +1,55 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            {
         | 
| 2 | 
            +
              "added_tokens_decoder": {
         | 
| 3 | 
            +
                "0": {
         | 
| 4 | 
            +
                  "content": "<s>",
         | 
| 5 | 
            +
                  "lstrip": false,
         | 
| 6 | 
            +
                  "normalized": false,
         | 
| 7 | 
            +
                  "rstrip": false,
         | 
| 8 | 
            +
                  "single_word": false,
         | 
| 9 | 
            +
                  "special": true
         | 
| 10 | 
            +
                },
         | 
| 11 | 
            +
                "1": {
         | 
| 12 | 
            +
                  "content": "<pad>",
         | 
| 13 | 
            +
                  "lstrip": false,
         | 
| 14 | 
            +
                  "normalized": false,
         | 
| 15 | 
            +
                  "rstrip": false,
         | 
| 16 | 
            +
                  "single_word": false,
         | 
| 17 | 
            +
                  "special": true
         | 
| 18 | 
            +
                },
         | 
| 19 | 
            +
                "2": {
         | 
| 20 | 
            +
                  "content": "</s>",
         | 
| 21 | 
            +
                  "lstrip": false,
         | 
| 22 | 
            +
                  "normalized": false,
         | 
| 23 | 
            +
                  "rstrip": false,
         | 
| 24 | 
            +
                  "single_word": false,
         | 
| 25 | 
            +
                  "special": true
         | 
| 26 | 
            +
                },
         | 
| 27 | 
            +
                "3": {
         | 
| 28 | 
            +
                  "content": "<unk>",
         | 
| 29 | 
            +
                  "lstrip": false,
         | 
| 30 | 
            +
                  "normalized": false,
         | 
| 31 | 
            +
                  "rstrip": false,
         | 
| 32 | 
            +
                  "single_word": false,
         | 
| 33 | 
            +
                  "special": true
         | 
| 34 | 
            +
                },
         | 
| 35 | 
            +
                "250001": {
         | 
| 36 | 
            +
                  "content": "<mask>",
         | 
| 37 | 
            +
                  "lstrip": true,
         | 
| 38 | 
            +
                  "normalized": false,
         | 
| 39 | 
            +
                  "rstrip": false,
         | 
| 40 | 
            +
                  "single_word": false,
         | 
| 41 | 
            +
                  "special": true
         | 
| 42 | 
            +
                }
         | 
| 43 | 
            +
              },
         | 
| 44 | 
            +
              "bos_token": "<s>",
         | 
| 45 | 
            +
              "clean_up_tokenization_spaces": false,
         | 
| 46 | 
            +
              "cls_token": "<s>",
         | 
| 47 | 
            +
              "eos_token": "</s>",
         | 
| 48 | 
            +
              "extra_special_tokens": {},
         | 
| 49 | 
            +
              "mask_token": "<mask>",
         | 
| 50 | 
            +
              "model_max_length": 512,
         | 
| 51 | 
            +
              "pad_token": "<pad>",
         | 
| 52 | 
            +
              "sep_token": "</s>",
         | 
| 53 | 
            +
              "tokenizer_class": "XLMRobertaTokenizer",
         | 
| 54 | 
            +
              "unk_token": "<unk>"
         | 
| 55 | 
            +
            }
         | 

