Files changed (1) hide show
  1. README.md +39 -96
README.md CHANGED
@@ -10,135 +10,78 @@ tags:
10
  widget: []
11
  ---
12
 
 
 
13
  # SentenceTransformer
14
 
15
- This is a [sentence-transformers](https://www.SBERT.net) model trained. It maps sentences & paragraphs to a 768-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
16
 
17
- ## Model Details
18
 
19
- ### Model Description
20
- - **Model Type:** Sentence Transformer
21
- <!-- - **Base model:** [Unknown](https://huggingface.co/unknown) -->
22
- - **Maximum Sequence Length:** 2048 tokens
23
- - **Output Dimensionality:** 768 tokens
24
- - **Similarity Function:** Cosine Similarity
25
- <!-- - **Training Dataset:** Unknown -->
26
- <!-- - **Language:** Unknown -->
27
- <!-- - **License:** Unknown -->
28
 
29
- ### Model Sources
30
 
31
- - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
32
- - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
33
- - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
34
 
35
- ### Full Model Architecture
36
 
37
- ```
38
  SentenceTransformer(
39
  (0): Transformer({'max_seq_length': 2048, 'do_lower_case': False}) with Transformer model: GPT2Model
40
  (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})
41
- (2): Dense({'in_features': 1024, 'out_features': 768, 'bias': True, 'activation_function': 'torch.nn.modules.linear.Identity'})
42
  )
43
  ```
44
 
45
- ## Usage
46
 
47
- ### Direct Usage (Sentence Transformers)
48
 
49
- First install the Sentence Transformers library:
50
 
51
  ```bash
52
  pip install -U sentence-transformers
53
  ```
54
 
55
- Then you can load this model and run inference.
 
56
  ```python
57
  from sentence_transformers import SentenceTransformer
58
 
59
- # Download from the 🤗 Hub
60
- model = SentenceTransformer("sentence_transformers_model_id")
61
- # Run inference
62
  sentences = [
63
- 'The weather is lovely today.',
64
- "It's so sunny outside!",
65
- 'He drove to the stadium.',
66
  ]
67
  embeddings = model.encode(sentences)
68
  print(embeddings.shape)
69
- # [3, 768]
70
 
71
- # Get the similarity scores for the embeddings
72
  similarities = model.similarity(embeddings, embeddings)
73
  print(similarities.shape)
74
  # [3, 3]
75
  ```
76
 
77
- <!--
78
- ### Direct Usage (Transformers)
79
-
80
- <details><summary>Click to see the direct usage in Transformers</summary>
81
-
82
- </details>
83
- -->
84
-
85
- <!--
86
- ### Downstream Usage (Sentence Transformers)
87
-
88
- You can finetune this model on your own dataset.
89
-
90
- <details><summary>Click to expand</summary>
91
-
92
- </details>
93
- -->
94
-
95
- <!--
96
- ### Out-of-Scope Use
97
-
98
- *List how the model may foreseeably be misused and address what users ought not to do with the model.*
99
- -->
100
-
101
- <!--
102
- ## Bias, Risks and Limitations
103
-
104
- *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
105
- -->
106
-
107
- <!--
108
- ### Recommendations
109
 
110
- *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
111
- -->
112
-
113
- ## Training Details
114
-
115
- ### Framework Versions
116
- - Python: 3.10.12
117
- - Sentence Transformers: 3.0.1
118
- - Transformers: 4.44.2
119
- - PyTorch: 2.4.0+cu121
120
- - Accelerate: 0.33.0
121
- - Datasets: 2.21.0
122
- - Tokenizers: 0.19.1
123
-
124
- ## Citation
125
-
126
- ### BibTeX
127
-
128
- <!--
129
- ## Glossary
130
-
131
- *Clearly define terms in order to be accessible across audiences.*
132
- -->
133
-
134
- <!--
135
- ## Model Card Authors
136
-
137
- *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
138
- -->
139
-
140
- <!--
141
- ## Model Card Contact
142
 
143
- *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
144
- -->
 
 
 
 
10
  widget: []
11
  ---
12
 
13
+ Эксперимент по использованию модели, наподобие GPT-2, в качестве эмбеддера. Базовая модель: `ai-forever/rugpt3medium_based_on_gpt2`, извлечено первые 6 слоев.
14
+
15
  # SentenceTransformer
16
 
17
+ Это модель [sentence-transformers](https://www.SBERT.net), которая обучена для преобразования предложений и абзацев в плотное векторное пространство размерностью 1024. Она может использоваться для семантического сопоставления текста, семантического поиска, поиска парафраз, классификации текста, кластеризации и других задач.
18
 
19
+ ## Описание Модели
20
 
21
+ ### Основные Характеристики
22
+ - **Тип модели:** Sentence Transformer
23
+ - **Максимальная длина последовательности:** 2048 токенов
24
+ - **Размерность выхода:** 1024
25
+ - **Функция Similarity:** Косинусное сходство
 
 
 
 
26
 
27
+ ### Источники Модели
28
 
29
+ - **Документация:** [Sentence Transformers Documentation](https://sbert.net)
30
+ - **Репозиторий:** [Sentence Transformers на GitHub](https://github.com/UKPLab/sentence-transformers)
31
+ - **Hugging Face:** [Sentence Transformers на Hugging Face](https://huggingface.co/models?library=sentence-transformers)
32
 
33
+ ### Полная Архитектура Модели
34
 
35
+ ```python
36
  SentenceTransformer(
37
  (0): Transformer({'max_seq_length': 2048, 'do_lower_case': False}) with Transformer model: GPT2Model
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
+ ## Использование
43
 
44
+ ### Прямое Использование (Sentence Transformers)
45
 
46
+ Для начала установите библиотеку Sentence Transformers:
47
 
48
  ```bash
49
  pip install -U sentence-transformers
50
  ```
51
 
52
+ Затем загрузите эту модель и выполните инференс.
53
+
54
  ```python
55
  from sentence_transformers import SentenceTransformer
56
 
57
+ # Загрузка модели с 🤗 Hub
58
+ model = SentenceTransformer("Ponimash/gpt_text_embd")
59
+ # Запуск инференса
60
  sentences = [
61
+ 'Погода сегодня прекрасная.',
62
+ 'На улице так солнечно!',
63
+ 'Он поехал на стадион.',
64
  ]
65
  embeddings = model.encode(sentences)
66
  print(embeddings.shape)
67
+ # [3, 1024]
68
 
69
+ # Получение оценок схожести для эмбеддингов
70
  similarities = model.similarity(embeddings, embeddings)
71
  print(similarities.shape)
72
  # [3, 3]
73
  ```
74
 
75
+ ### Результаты
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
+ ```python
78
+ # Выходная размерность: 1024
79
+ tensor([[1.0000, 0.6575, 0.4605],
80
+ [0.6575, 1.0000, 0.4683],
81
+ [0.4605, 0.4683, 1.0000]])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
+ SentenceTransformer(
84
+ (0): Transformer({'max_seq_length': 2048, 'do_lower_case': False}) with Transformer model: GPT2Model
85
+ (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})
86
+ )
87
+ ```