HoangVuSnape commited on
Commit
b789a07
·
verified ·
1 Parent(s): 31b0324

Add new SentenceTransformer model

Browse files
.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 ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "word_embedding_dimension": 768,
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
+ "include_prompt": true
10
+ }
README.md ADDED
@@ -0,0 +1,1691 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - sentence-transformers
4
+ - sentence-similarity
5
+ - feature-extraction
6
+ - dense
7
+ - generated_from_trainer
8
+ - dataset_size:500
9
+ - loss:MatryoshkaLoss
10
+ - loss:MultipleNegativesRankingLoss
11
+ base_model: dangvantuan/vietnamese-document-embedding
12
+ widget:
13
+ - source_sentence: Ngành Kỹ thuật Trắc địa – Bản đồ là gì và sinh viên sẽ được trang
14
+ bị những kỹ năng nào?
15
+ sentences:
16
+ - 'Triển vọng việc làm
17
+
18
+
19
+ Các công ty xây dựng, nhà thầu xây dựng và các công ty tư vấn về xây dựng. Các
20
+ cơ quan, tổ chức quản lý nhà nước liên quan đến xây dựng, phát triển hạ tầng và
21
+ đô thị. Các công ty tài chính, ngân hàng và các tổ chức cho vay đầu tư vào các
22
+ dự án xây dựng. Các công ty cung cấp dịch vụ quản lý dự án và tư vấn xây dựng.
23
+ KỸ THUẬT XÂY DỰNG CÔNG TRÌNH GIAO THÔNG
24
+
25
+
26
+ Thông tin tuyển sinh:
27
+
28
+
29
+ Website: http://www.dce.hcmut.edu.vn/
30
+
31
+
32
+ Mã tuyển sinh: 115 (Chương trình tiêu chuẩn), 215 (Chương trình giảng dạy bằng
33
+ tiếng Anh)
34
+
35
+
36
+ Ngành Kỹ thuật Xây dựng Công trình Giao thông có 01 chuyên ngành : Cầu đường.
37
+ KỸ THUẬT TRẮC ĐỊA – BẢN ĐỒ
38
+
39
+
40
+ Website: http://www.dce.hcmut.edu.vn/
41
+
42
+
43
+ Ngành Kỹ thuật Trắc địa – Bản đồ thuộc Khoa Kỹ thuật Xây dựng. TỔNG QUAN CHƯƠNG
44
+ TRÌNH
45
+
46
+
47
+ Ngành Kỹ thuật Trắc địa – Bản đồ bao gồm Khoa học và công nghệ về việc thu thập,
48
+ phân tích và biễu diễn các thông tin không gian (dựa trên Trái đất). Nó bao gồm
49
+ những ứng dụng thú vị như định vị vệ tinh, viễn thám, trắc địa, địa chính và hệ
50
+ thông tin địa lý. Kỹ thuật Trắc địa – Bản đồ là một trong những ngành khoa học
51
+ thông tin phát triển nhanh nhất ở Việt Nam và khắp thế giới. Chương trình sẽ đào
52
+ tạo thành những kỹ sư có tay nghề cao, có năng lực thiết kế và tổ chức thi công
53
+ các công trình định vị chính xác cao bằng những kỹ thuật hiện đại như toàn đạc
54
+ điện tử và các hệ thống định vị bằng vệ tinh; công trình thành lập bản đồ địa
55
+ hình, địa chính và chuyên đề dưới dạng số bằng phương pháp toàn đạc, trắc lượng
56
+ ảnh, viễn thám và biên tập; công trình thành lập và vận hành các hệ thống thông
57
+ tin địa lý; các công tác trắc địa phục vụ xây dựng công trình.'
58
+ - 'Ngành: Sư phạm tiếng Anh
59
+
60
+
61
+ Mã ngành: 7140231D, Tổ hợp: (D01, D96), Điểm chuẩn: 26.08
62
+
63
+
64
+ 2. Ngành: Thiết kế đồ họa
65
+
66
+
67
+ Mã ngành: 7210403D, Tổ hợp: (V01, V02, V07, V08), Điểm chuẩn: 24.50
68
+
69
+
70
+ 3. Ngành: Thiết kế thời trang
71
+
72
+
73
+ Mã ngành: 7210404D, Tổ hợp: (V01, V02, V07, V09), Điểm chuẩn: 21.50
74
+
75
+
76
+ 4. Ngành: Ngôn ngữ Anh
77
+
78
+
79
+ Mã ngành: 7220201D, Tổ hợp: (A00, A01, D01, D96), Điểm chuẩn: 22.75
80
+
81
+
82
+ 5. Ngành: Kinh doanh Quốc tế
83
+
84
+
85
+ Mã ngành: 7340120D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 25.25
86
+
87
+
88
+ 6. Ngành: Thương mại điện tử
89
+
90
+
91
+ Mã ngành: 7340122D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 25.25
92
+
93
+
94
+ 7. Ngành: Kế toán
95
+
96
+
97
+ Mã ngành: 7340301D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.25
98
+
99
+
100
+ 8. Ngành: Công nghệ kỹ thuật máy tính
101
+
102
+
103
+ Mã ngành: 7480106D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 25.00
104
+
105
+
106
+ 9. Ngành: Hệ thống nhúng và IoT
107
+
108
+
109
+ Mã ngành: 7480109D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.75
110
+
111
+
112
+ 10. Ngành: Công nghệ thông tin
113
+
114
+
115
+ Mã ngành: 7480201D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 25.25
116
+
117
+
118
+ 11. Ngành: Công nghệ kỹ thuật công trình xây dựng
119
+
120
+
121
+ Mã ngành: 7510102D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 19.00
122
+
123
+
124
+ 12. Ngành: Hệ thống kỹ thuật công trình xây dựng
125
+
126
+
127
+ Mã ngành: 7510105D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 19.00
128
+
129
+
130
+ 13. Ngành: Công nghệ kỹ thuật cơ khí
131
+
132
+
133
+ Mã ngành: 7510201D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 21.50
134
+
135
+
136
+ 14. Ngành: Công nghệ chế tạo máy
137
+
138
+
139
+ Mã ngành: 7510202D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 18.00
140
+
141
+
142
+ 15. Ngành: Công nghệ kỹ thuật ô tô
143
+
144
+
145
+ Mã ngành: 7510205D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 22.50
146
+
147
+
148
+ 16. Ngành: Công nghệ kỹ thuật nhiệt
149
+
150
+
151
+ Mã ngành: 7510206D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 16.50
152
+
153
+
154
+ 17. Ngành: Công nghệ kỹ thuật điện, điện tử
155
+
156
+
157
+ Mã ngành: 7510301D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.25
158
+
159
+
160
+ 18. Ngành: Công nghệ kỹ thuật điện tử, viễn thông
161
+
162
+
163
+ Mã ngành: 7510302, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.75
164
+
165
+
166
+ 19. Ngành: Công nghệ kỹ thuật điều khiển và tự động hóa
167
+
168
+
169
+ Mã ngành: 7510303, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 25.00
170
+
171
+
172
+ 20. Ngành: Công nghệ kỹ thuật hóa học
173
+
174
+
175
+ Mã ngành: 7510401, Tổ hợp: (A00, B00, D07, D90), Điểm chuẩn: 17.00
176
+
177
+
178
+ 21. Ngành: Công nghệ vật liệu
179
+
180
+
181
+ Mã ngành: 7510402D, Tổ hợp: (A00, B00, D07, D90), Điểm chuẩn: 17.00
182
+
183
+
184
+ 22. Ngành: Công nghệ kỹ thuật môi trường
185
+
186
+
187
+ Mã ngành: 7510406, Tổ hợp: (A00, B00, D07, D90), Điểm chuẩn: 17.00
188
+
189
+
190
+ 23. Ngành: Quản lý công nghiệp
191
+
192
+
193
+ Mã ngành: 7510601, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.75
194
+
195
+
196
+ 24. Ngành: Logistics và quản lý chuỗi cung ứng
197
+
198
+
199
+ Mã ngành: 7510605D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 24.25
200
+
201
+
202
+ 25. Ngành: Công nghệ kỹ thuật in
203
+
204
+
205
+ Mã ngành: 7510802D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 17.00
206
+
207
+
208
+ 26. Ngành: Công nghệ may
209
+
210
+
211
+ Mã ngành: 7540204D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 17.50
212
+
213
+
214
+ 27. Ngành: Kiến trúc
215
+
216
+
217
+ Mã ngành: 7580101, Tổ hợp: (V00, V01, V02, V03), Điểm chuẩn: 22.25
218
+
219
+
220
+ 28. Ngành: Kiến trúc nội thất
221
+
222
+
223
+ Mã ngành: 7580101D, Tổ hợp: (V03, V04, V05, V06), Điểm chuẩn: 22.00
224
+
225
+
226
+ 29. Ngành: Kỹ thuật xây dựng công trình giao thông
227
+
228
+
229
+ Mã ngành: 7580205D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 17.00
230
+
231
+
232
+ 30. Ngành: Kỹ thuật xây dựng
233
+
234
+
235
+ Mã ngành: 7580201D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 17.00
236
+
237
+
238
+ 31. Ngành: Quản trị nhà hàng và dịch vụ ăn uống
239
+
240
+
241
+ Mã ngành: 7840110D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 17.50
242
+
243
+
244
+ 32. Ngành: Quản lý và vận hành hạ tầng
245
+
246
+
247
+ Mã ngành: 7840101D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 17.70
248
+
249
+
250
+ 33. Ngành: Công nghệ kỹ thuật điều khiển và tự động hóa
251
+
252
+
253
+ Mã ngành: 7510303D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 22.75
254
+
255
+
256
+ 34. Ngành: Công nghệ kỹ thuật điện tử - viễn thông
257
+
258
+
259
+ Mã ngành: 7510302D, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 21.50
260
+
261
+
262
+ CLC Tiếng Việt
263
+
264
+
265
+ 1. Ngành: Thiết kế thời trang
266
+
267
+
268
+ Mã ngành: 7210404C, Tổ hợp: (V01, V02, V07, V09), Điểm chuẩn: 21.60
269
+
270
+
271
+ 2. Ngành: Thương mại điện tử
272
+
273
+
274
+ Mã ngành: 7340122C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 25.50
275
+
276
+
277
+ 3. Ngành: Kế toán
278
+
279
+
280
+ Mã ngành: 7340301C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.75
281
+
282
+
283
+ 4. Ngành: Công nghệ kỹ thuật máy tính
284
+
285
+
286
+ Mã ngành: 7480106C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 25.65
287
+
288
+
289
+ 5. Ngành: Công nghệ thông tin
290
+
291
+
292
+ Mã ngành: 7480201C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 26.00
293
+
294
+
295
+ 6. Ngành: Công nghệ kỹ thuật công trình xây dựng
296
+
297
+
298
+ Mã ngành: 7510102C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 20.00
299
+
300
+
301
+ 7. Ngành: Công nghệ kỹ thuật cơ khí
302
+
303
+
304
+ Mã ngành: 7510201C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 22.00
305
+
306
+
307
+ 8. Ngành: Công nghệ chế tạo máy
308
+
309
+
310
+ Mã ngành: 7510202C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 19.00
311
+
312
+
313
+ 9. Ngành: Công nghệ kỹ thuật ô tô
314
+
315
+
316
+ Mã ngành: 7510205C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.00
317
+
318
+
319
+ 10. Ngành: Công nghệ kỹ thuật nhiệt
320
+
321
+
322
+ Mã ngành: 7510206C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 17.00
323
+
324
+
325
+ 11. Ngành: Công nghệ kỹ thuật điện, điện tử
326
+
327
+
328
+ Mã ngành: 7510301C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.00
329
+
330
+
331
+ 12. Ngành: Công nghệ kỹ thuật điều khiển và tự động hóa
332
+
333
+
334
+ Mã ngành: 7510303C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.00
335
+
336
+
337
+ 13. Ngành: Công nghệ kỹ thuật điện tử - viễn thông
338
+
339
+
340
+ Mã ngành: 7510302C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 22.50
341
+
342
+
343
+ 14. Ngành: Công nghệ kỹ thuật điện tử, viễn thông
344
+
345
+
346
+ Mã ngành: 7510302C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 22.50
347
+
348
+
349
+ 15. Ngành: Công nghệ kỹ thuật điều khiển và tự động hóa
350
+
351
+
352
+ Mã ngành: 7510303C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 24.00
353
+
354
+
355
+ 16. Ngành: Công nghệ kỹ thuật môi trường
356
+
357
+
358
+ Mã ngành: 7510406C, Tổ hợp: (A00, B00, D07, D90), Điểm chuẩn: 17.50
359
+
360
+
361
+ 17. Ngành: Quản lý công nghiệp
362
+
363
+
364
+ Mã ngành: 7510601C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 19.75
365
+
366
+
367
+ 18. Ngành: Công nghệ kỹ thuật cơ điện tử
368
+
369
+
370
+ Mã ngành: 7510203C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 21.50
371
+
372
+
373
+ 19. Ngành: Công nghệ may
374
+
375
+
376
+ Mã ngành: 7540204C, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.25
377
+
378
+
379
+ CLC Tiếng Anh:
380
+
381
+
382
+ 1. Ngành: Công nghệ kỹ thuật máy tính
383
+
384
+
385
+ Mã ngành: 7480106A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 26.00
386
+
387
+
388
+ 2. Ngành: Công nghệ thông tin
389
+
390
+
391
+ Mã ngành: 7480201A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 26.50
392
+
393
+
394
+ 3. Ngành: Công nghệ kỹ thuật công trình xây dựng
395
+
396
+
397
+ Mã ngành: 7510102A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 19.75
398
+
399
+
400
+ 4. Ngành: Công nghệ kỹ thuật cơ khí
401
+
402
+
403
+ Mã ngành: 7510201A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 22.50
404
+
405
+
406
+ 5. Ngành: Công nghệ chế tạo máy
407
+
408
+
409
+ Mã ngành: 7510202A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 19.50
410
+
411
+
412
+ 6. Ngành: Công nghệ kỹ thuật ô tô
413
+
414
+
415
+ Mã ngành: 7510205A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.50
416
+
417
+
418
+ 7. Ngành: Công nghệ kỹ thuật nhiệt
419
+
420
+
421
+ Mã ngành: 7510206A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 17.00
422
+
423
+
424
+ 8. Ngành: Công nghệ kỹ thuật điện, điện tử
425
+
426
+
427
+ Mã ngành: 7510301A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.50
428
+
429
+
430
+ 9. Ngành: Công nghệ kỹ thuật điều khiển và tự động hóa
431
+
432
+
433
+ Mã ngành: 7510303A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.50
434
+
435
+
436
+ 10. Ngành: Công nghệ kỹ thuật điện tử, viễn thông
437
+
438
+
439
+ Mã ngành: 7510302A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 22.25
440
+
441
+
442
+ 11. Ngành: Công nghệ kỹ thuật điều khiển và tự động hóa
443
+
444
+
445
+ Mã ngành: 7510303A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 23.50
446
+
447
+
448
+ 12. Ngành: Quản lý công nghiệp
449
+
450
+
451
+ Mã ngành: 7510601A, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 19.25
452
+
453
+
454
+ Nhân tài
455
+
456
+
457
+ Ngành: Robot và trí tuệ nhân tạo
458
+
459
+
460
+ Mã ngành: 7510209NT, Tổ hợp: (A00, A01, D01, D90), Điểm chuẩn: 25.00'
461
+ - 'xiv. Khoa tiếng Nhật
462
+
463
+
464
+ 1. CHẤT LƯỢNG ĐÀO TẠO
465
+
466
+
467
+ ĐÀO TẠO CỬ NHÂN (4 NĂM)
468
+
469
+
470
+ 2.CHẤT LƯỢNG GIẢNG VIÊN
471
+
472
+
473
+ ĐỘI NGŨ GIẢNG VIÊN: 8
474
+
475
+
476
+ Tiến sĩ: 1
477
+
478
+
479
+ Thạc sĩ: 5
480
+
481
+
482
+ Cử nhân: 2
483
+
484
+
485
+ 3. MỤC TIÊU ĐÀO TẠO
486
+
487
+
488
+ Đào tạo cử nhân ngôn ngữ Nhật, có phẩm chất chính trị, đạo đức và sức khỏe tốt,
489
+ hiểu và vận dụng các tri thức cơ bản về ngôn ngữ tiếng Nhật. Sau khi tốt nghiệp,
490
+ người học có đủ năng lực để làm việc ở các cơ quan, tổ chức, các công ty, doanh
491
+ nghiệp yêu cầu chuẩn về kỹ năng sử dụng tiếng Nhật đáp ứng những yêu cầu của xã
492
+ hội và của nền kinh tế trong quá trình hội nhập quốc tế. 4. CÁC NGÀNH ĐÀO TẠO
493
+
494
+
495
+ ĐẠI HỌC
496
+
497
+
498
+ Cử nhân Ngôn ngữ Nhật
499
+
500
+
501
+ xv. Khoa tiếng Hàn Quốc
502
+
503
+
504
+ 1. CHẤT LƯỢNG ĐÀO TẠO
505
+
506
+
507
+ ĐÀO TẠO CỬ NHÂN (4 NĂM)
508
+
509
+
510
+ TUYỂN SINH:
511
+
512
+
513
+ 2016 - 2017: 150 SV
514
+
515
+
516
+ 2017 - 2018: 195 SV
517
+
518
+
519
+ 2018 - 2019: 120 SV
520
+
521
+
522
+ 2019 - 2020: 54 SV
523
+
524
+
525
+ 2021 - 2022: 120 SV
526
+
527
+
528
+ 2022 - 2023: 88 SV
529
+
530
+
531
+ Song ngành: 20 SV
532
+
533
+
534
+ 2. CHẤT LƯỢNG GIẢNG VIÊN
535
+
536
+
537
+ ĐỘI NGŨ GIẢNG VIÊN: 6
538
+
539
+
540
+ Tiến sĩ: 1
541
+
542
+
543
+ Thạc sĩ: 4
544
+
545
+
546
+ Cử nhân: 1
547
+
548
+
549
+ 3. MỤC TIÊU ĐÀO TẠO
550
+
551
+
552
+ Đào tạo cử nhân ngôn ngữ Hàn Quốc, có phẩm chất chính trị, đạo đức và sức khỏe
553
+ tốt, hiểu và vận dụng các tri thức cơ bản về ngôn ngữ tiếng Hàn Quốc - định hướng
554
+ biên phiên dịch. Sau khi tốt nghiệp, người học có đủ năng lực để làm việc ở các
555
+ cơ quan, tổ chức, các công ty, doanh nghiệp yêu cầu chuẩn về kỹ năng sử dụng tiếng
556
+ Hàn Quốc đáp ứng những yêu cầu của xã hội và của nền kinh tế trong quá trình hội
557
+ nhập quốc tế. Đào tạo cử nhân ngôn ngữ Hàn Quốc chuyên ngành Du lịch, có phẩm
558
+ chất chính trị, đạo đức và sức khỏe tốt, hiểu và vận dụng các tri thức cơ bản
559
+ về ngôn ngữ Hàn Quốc ngành Du lịch. Sau khi tốt nghiệp, người học có đủ năng lực
560
+ để làm việc ở các cơ quan, tổ chức, các công ty, doanh nghiệp yêu cầu chuẩn về
561
+ công việc du lịch và các công việc có liên quan đáp ứng những yêu cầu của xã hội
562
+ và của nền kinh tế trong quá trình hội nhập quốc tế.'
563
+ - source_sentence: Điểm chuẩn dự kiến của một số ngành học như Vật lý học hay Công
564
+ nghệ Thông tin là bao nhiêu?
565
+ sentences:
566
+ - STT Mã ngành Tên ngành Tổ hợp môn Điểm chuẩn Ghi chú 1 7220201 Ngôn ngữ Anh A;
567
+ B; C01; C02; C03; C04 21 2 7220204 Ngôn ngữ Trung Quốc A; B; C01; C02; C03;
568
+ C04 21 3 7220209 Ngôn ngữ Nhật A; B; C01; C02; C03; C04 21 4 7220210 Ngôn ngữ
569
+ Hàn Quốc A; B; C01; C02; C03; C04 21 5 7320106 Công nghệ truyền thông A; B;
570
+ C01; C02; C03; C04 21 6 7340101 Quản trị kinh doanh A; B; C01; C02; C03; C04 21
571
+ 7 7480201 Công nghệ thông tin A; B; C01; C02; C03; C04 21 Phương thức xét tuyển
572
+ của fpt khá giống nhau.
573
+ - 'An ninh mạng: Làm việc tại các công ty bảo mật, ngân hàng, các tổ chức phòng
574
+ chống tội phạm mạng và bảo vệ thông tin. Quản lý hệ thống và mạng máy tính: Làm
575
+ việc tại các công ty quản lý hệ thống máy tính, mạng dữ liệu lớn, và cơ sở hạ
576
+ tầng công nghệ thông tin. Trí tuệ nhân tạo (AI) và Khoa học dữ liệu: Phát triển
577
+ các hệ thống AI, phân tích dữ liệu và học máy (machine learning) trong các ứng
578
+ dụng như tự động hóa, nhận diện hình ảnh và phân tích dự đoán. CHƯƠNG TRÌNH ĐÀO
579
+ TẠO & MÔN HỌC
580
+
581
+
582
+ Sinh viên sẽ học các môn như:
583
+
584
+
585
+ Lập trình và phát triển phần mềm: Học cách lập trình bằng các ngôn ngữ phổ biến
586
+ như Java, Python, C++, và phát triển các ứng dụng phần mềm cho các nền tảng khác
587
+ nhau. Mạng máy tính và hệ thống phân tán: Kiến thức về thiết kế, triển khai và
588
+ quản lý các mạng máy tính, hệ thống phân tán, và các giao thức mạng hiện đại.
589
+ An ninh mạng: Các phương pháp và công nghệ bảo mật trong việc bảo vệ dữ liệu và
590
+ hệ thống mạng khỏi các mối đe dọa. Trí tuệ nhân tạo và học máy: Học các lý thuyết
591
+ và kỹ thuật liên quan đến AI, học máy, khai thác dữ liệu và phân tích dữ liệu
592
+ lớn. Cơ sở dữ liệu: Quản lý và tối ưu hóa cơ sở dữ liệu, học cách phát triển các
593
+ hệ thống cơ sở dữ liệu lớn, ứng dụng trong các doanh nghiệp và tổ chức. Trí tuệ
594
+ nhân tạo
595
+
596
+
597
+ Mã tuyển sinh: 7480107
598
+
599
+
600
+ Tổ hợp xét tuyển: A00; A01; B08; D07
601
+
602
+
603
+ Thông tin liên hệ:
604
+
605
+
606
+ Địa chỉ: Khoa Công nghệ thông tin, Trường Đại học Khoa học Tự nhiên TP.HCM, 227
607
+ Nguyễn Văn Cừ, Quận 5, TP.HCM
608
+
609
+
610
+ Điện thoại: (028) 38 585 726
611
+
612
+
613
614
+
615
+
616
+ Website: https://www.fit.hcmus.edu.vn/
617
+
618
+
619
+ TỔNG QUAN CHƯƠNG TRÌNH
620
+
621
+
622
+ Chương trình đào tạo ngành Trí tuệ nhân tạo tại Trường Đại học Khoa học Tự nhiên
623
+ TP.HCM trang bị cho sinh viên kiến thức vững chắc về các lý thuyết và ứng dụng
624
+ của trí tuệ nhân tạo (AI), học máy (machine learning), và các kỹ thuật xử lý dữ
625
+ liệu lớn. Sinh viên sẽ được đào tạo để phát triển các hệ thống thông minh, phân
626
+ tích dữ liệu và ứng dụng AI trong các lĩnh vực như nhận diện hình ảnh, xử lý ngôn
627
+ ngữ tự nhiên, robot và các hệ thống tự động hóa. Chương trình học chú trọng đến
628
+ việc kết hợp lý thuyết với thực hành, giúp sinh viên có thể giải quyết các bài
629
+ toán thực tế trong môi trường công nghệ phát triển nhanh chóng. CƠ SỞ VẬT CHẤT
630
+ CHẤT LƯỢNG CAO
631
+
632
+
633
+ Khoa Công nghệ thông tin có các phòng thí nghiệm hiện đại phục vụ cho việc nghiên
634
+ cứu và học tập trong ngành Trí tuệ nhân tạo, bao gồm các phòng lab chuyên về học
635
+ máy, xử lý ngôn ngữ tự nhiên, robot và các ứng dụng AI. Sinh viên có cơ hội tiếp
636
+ cận với các công cụ phần mềm mạnh mẽ, mô phỏng AI và các nền tảng học máy được
637
+ ứng dụng trong các ngành công nghiệp khác nhau. CÁC ĐIỂM ĐẶC BIỆT
638
+
639
+
640
+ Chương trình học theo hướng thực tiễn: Sinh viên được đào tạo các kỹ năng giải
641
+ quyết bài toán thực tế thông qua các dự án nghiên cứu và hợp tác với các công
642
+ ty công nghệ. Môi trường học tập sáng tạo: Các chương trình hackathon, workshop
643
+ và dự án nghiên cứu là những cơ hội để sinh viên thể hiện sự sáng tạo và tìm ra
644
+ giải pháp sáng tạo cho các vấn đề trong trí tuệ nhân tạo. Cơ hội nghề nghiệp và
645
+ du học: Sinh viên có thể tham gia vào các chương trình trao đổi sinh viên quốc
646
+ tế và có cơ hội làm việc tại các công ty hàng đầu về AI trong và ngoài nước. Các
647
+ công ty như Google, Facebook, và các công ty khởi nghiệp về AI luôn tìm kiếm những
648
+ tài năng có nền tảng vững về AI. TRIỂN VỌNG NGHỀ NGHIỆP & CƠ HỘI VIỆC LÀM
649
+
650
+
651
+ Sinh viên tốt nghiệp ngành Trí tuệ nhân tạo có thể làm việc trong các lĩnh vực
652
+ như:
653
+
654
+
655
+ Phát triển phần mềm AI: Làm việc tại các công ty công nghệ phát triển các hệ thống
656
+ AI, phần mềm học máy, và các sản phẩm tự động hóa.'
657
+ - 'Vật lý học – 22.55
658
+
659
+
660
+ xxxix. Hóa học – 23.47
661
+
662
+
663
+ xl. Công nghệ Thông tin – 23.34
664
+
665
+
666
+ xli. Công tác Xã hội – 22.00
667
+
668
+
669
+ xlii. Du lịch – 22.00
670
+
671
+
672
+ 8. Học phí trường Đại học Sư phạm TPHCM 2023 dự kiến từ 9,8 đến 11,7 triệu đồng
673
+ một năm. Riêng các ngành sư phạm được miễn học phí.'
674
+ - source_sentence: Làm thế nào để đăng ký xét tuyển và thời gian dự kiến cho các phương
675
+ thức tuyển sinh là khi nào?
676
+ sentences:
677
+ - '4. Các ngành đào tạo
678
+
679
+
680
+ a. ĐẠI HỌC
681
+
682
+
683
+ Cử nhân Sư phạm Ngữ văn
684
+
685
+
686
+ Cử nhân Văn học (Hệ Chính quy; Văn bằng 2)
687
+
688
+
689
+ Cử nhân Việt Nam học
690
+
691
+
692
+ Cử nhân Tiếng Việt và Văn hóa Việt Nam
693
+
694
+
695
+ b. SAU ĐẠI HỌC
696
+
697
+
698
+ Thạc sĩ Văn học Việt Nam
699
+
700
+
701
+ Thạc sĩ Văn học nước ngoài
702
+
703
+
704
+ Thạc sĩ Lý luận văn học
705
+
706
+
707
+ Thạc sĩ Ngôn ngữ học
708
+
709
+
710
+ Tiến sĩ Văn học Việt Nam
711
+
712
+
713
+ Tiến sĩ Văn học nước ngoài
714
+
715
+
716
+ Tiến sĩ Lý luận ngôn ngữ
717
+
718
+
719
+ c. BỒI DƯỠNG
720
+
721
+
722
+ Chuyên đề cung cấp kiến thức mới; kỹ năng, phương pháp dạy học mới, nâng cao tính
723
+ thực tiễn, chú trọng phát triển năng lực ở người học
724
+
725
+
726
+ ii. Khoa Lịch sử
727
+
728
+
729
+ 1. CHẤT LƯỢNG ĐÀO TẠO
730
+
731
+
732
+ ĐÀO TẠO CỬ NHÂN (4 NĂM)
733
+
734
+
735
+ Cử nhân Sư phạm Lịch sử
736
+
737
+
738
+ TUYỂN SINH:
739
+
740
+
741
+ 2005 - 2015: 1.425 Cử nhân Sư phạm Lịch sử
742
+
743
+
744
+ 2006 - 2015: 343 Cử nhân Quốc tế học
745
+
746
+
747
+ 2007 - 2015: 464 Cử nhân Sử - GDQP
748
+
749
+
750
+ ĐÀO TẠO CAO HỌC (2 NĂM)
751
+
752
+
753
+ Bắt đầu đào tạo Thạc sĩ từ 1999
754
+
755
+
756
+ ThS Lịch sử Việt Nam và ThS Lịch sử thế giới
757
+
758
+
759
+ TUYỂN SINH: 20 - 25 HV/năm
760
+
761
+
762
+ 2016 - 2017: 09 HV
763
+
764
+
765
+ ĐÀO TẠO TIẾN SĨ
766
+
767
+
768
+ Tiến sĩ Lịch sử Việt Nam
769
+
770
+
771
+ TUYỂN SINH: 5 - 10 NCS/năm
772
+
773
+
774
+ 2017- 2018: 15 NCS
775
+
776
+
777
+ 2. CHẤT LƯỢNG GIẢNG VIÊN
778
+
779
+
780
+ SỐ LƯỢNG GIẢNG VIÊN: 22
781
+
782
+
783
+ SỐ LƯỢNG CHUYÊN VIÊN: 02
784
+
785
+
786
+ PGS.TS: 01
787
+
788
+
789
+ Tiến sĩ: 12
790
+
791
+
792
+ Thạc sĩ: 09
793
+
794
+
795
+ 3. MỤC TIÊU ĐÀO TẠO
796
+
797
+
798
+ Đào tạo Cử nhân Sư phạm Lịch sử đáp ứng yêu cầu về phẩm chất, năng lực đối với
799
+ giáo viên Lịch sử, bao gồm: có phẩm chất chính trị và đạo đức nghề nghiệp, có
800
+ kiến thức hệ thống, toàn diện về khoa học Lịch sử và phương pháp dạy học Lịch
801
+ sử, có năng lực thích ứng, sáng tạo, tự bồi dưỡng phát triển chuyên môn theo yêu
802
+ cầu của ngành giáo dục và của xã hội. Đào tạo Cử nhân Quốc tế học có phẩm chất
803
+ chính trị, đạo đức tốt, có kiến thức vững chắc về ngành học để đáp ứng nhu cầu
804
+ công tác trong các cơ quan, tổ chức chuyên về hoạt động đối ngoại của nhà nước,
805
+ trong các công ty đa quốc gia hoặc các tổ chức phi chính phủ; đồng thời có khả
806
+ năng thích ứng cao trong bối cảnh hội nhập quốc tế và khu vực.'
807
+ - 'Kết quả được công bố trước kỳ thi tốt nghiệp THPT. Cách thức đăng ký: Thí sinh
808
+ đăng ký trực tuyến thông qua hệ thống website của trường và nộp hồ sơ theo thông
809
+ báo tuyển sinh theo quy định. 1.2 Phương thức 2: Xét tuyển kết hợp Chứng chỉ ngoại
810
+ ngữ quốc tế và kết quả học tập/chứng chỉ năng lực quốc tế dành cho thí sinh hệ
811
+ chuyên và hệ không chuyên
812
+
813
+
814
+ Đối tượng xét tuyển: Thí sinh thuộc 1 trong 3 đối tượng sau:
815
+
816
+
817
+ Đối tượng 1: Thí sinh thuộc hệ chuyên, lớp chuyên Toán – Tin, Lý, Hóa, Văn và
818
+ Ngoại ngữ của các trường THPT trọng điểm quốc gia/chuyên. Đối tượng 2: Thí sinh
819
+ hệ không chuyên; hoặc hệ chuyên lớp chuyên (khác với các tổ hợp môn xét tuyển
820
+ của Nhà trường). Đối tượng 3: Thí sinh (hệ chuyên và không chuyên) có các chứng
821
+ chỉ năng lực quốc tế SAT, ACT hoặc A-level. Lưu ý: Áp dụng cho các chương trình
822
+ giảng dạy bằng tiếng Anh và các chương trình Chất lượng cao Ngôn ngữ thương mại.
823
+ Thời gian tuyển sinh: Dự kiến từ 22/5 – 31/5/2023. Kết quả được công bố trước
824
+ kỳ thi tốt nghiệp THPT. Cách thức đăng ký: Thí sinh đăng ký trực tuyến thông qua
825
+ hệ thống website của trường và nộp hồ sơ theo thông báo tuyển sinh của Nhà trường.
826
+ 1.3 Phương thức 3: X��t tuyển kết hợp Chứng chỉ ngoại ngữ quốc tế và kết quả thi
827
+ tốt nghiệp THPT năm 2023
828
+
829
+
830
+ Áp dụng cho: Các chương trình giảng dạy bằng tiếng Anh và Ngôn ngữ thương mại.
831
+ Thời gian tuyển sinh: Dự kiến cuối tháng 7/2023, ngay sau khi có kết quả thi tốt
832
+ nghiệp THPT năm 2023. Cách thức đăng ký: Thí sinh đăng ký trực tuyến thông qua
833
+ hệ thống website của trường và nộp hồ sơ theo thông báo tuyển sinh của Nhà trường.
834
+ 1.4 Phương thức 4: Xét tuyển dựa trên kết quả thi tốt nghiệp THPT năm 2023
835
+
836
+
837
+ Áp dụng cho: Các chương trình tiêu chuẩn và định hướng nghề nghiệp quốc tế.'
838
+ - 'Ứng dụng hạt nhân: Tìm hiểu về ứng dụng năng lượng hạt nhân, y học hạt nhân,
839
+ và xử lý chất thải hạt nhân trong công nghiệp. Kỹ thuật đo lường: Các kỹ thuật
840
+ đo đạc, phân tích phóng xạ, và các ứng dụng trong nghiên cứu khoa học. Vật lý
841
+ Y khoa
842
+
843
+
844
+ Mã tuyển sinh: 7520403
845
+
846
+
847
+ Tổ hợp xét tuyển: A00; A01; A02; D90
848
+
849
+
850
+ Thông tin liên hệ:
851
+
852
+
853
+ Địa chỉ: Trường Đại học Khoa học Tự nhiên TP.HCM, 227 Nguyễn Văn Cừ, Quận 5, TP.HCM
854
+
855
+
856
+ Điện thoại: (028) 38 585 726
857
+
858
+
859
860
+
861
+
862
+ Website: https://www.hcmus.edu.vn
863
+
864
+
865
+ TỔNG QUAN CHƯƠNG TRÌNH
866
+
867
+
868
+ Chương trình đào tạo ngành Vật lý Y khoa tại Trường Đại học Khoa học Tự nhiên
869
+ TP.HCM cung cấp cho sinh viên kiến thức nền tảng về vật lý, sinh học và y học,
870
+ đặc biệt là các ứng dụng vật lý trong y tế. Sinh viên sẽ được trang bị kiến thức
871
+ về các thiết bị y tế như máy chụp X-quang, máy cộng hưởng từ (MRI), máy cắt lớp
872
+ vi tính (CT), và các phương pháp điều trị bằng tia xạ. Chương trình học kết hợp
873
+ lý thuyết với thực hành để sinh viên có thể ứng dụng các kiến thức trong các môi
874
+ trường y tế thực tế. CƠ SỞ VẬT CHẤT CHẤT LƯỢNG CAO
875
+
876
+
877
+ Trường sở hữu các phòng thí nghiệm hiện đại chuyên về vật lý y khoa, với các thiết
878
+ bị y tế tiên tiến phục vụ cho việc học tập và nghiên cứu. Các phòng thí nghiệm
879
+ này cung cấp cơ hội cho sinh viên thực hành với các thiết bị như máy chụp X-quang,
880
+ CT, MRI và các thiết bị điều trị ung thư bằng tia xạ. CÁC ĐIỂM ĐẶC BIỆT
881
+
882
+
883
+ Chương trình học kết hợp lý thuyết và thực hành: Sinh viên không chỉ học lý thuyết
884
+ mà còn được thực hành trên các thiết bị y tế hiện đại trong các bệnh viện và cơ
885
+ sở y tế. Liên kết với các bệnh viện và cơ sở y tế: Trường có các mối quan hệ hợp
886
+ tác với các bệnh viện lớn, giúp sinh viên có cơ hội thực tập và nghiên cứu tại
887
+ các cơ sở y tế có ứng dụng vật lý y khoa. Cơ hội du học và học bổng: Sinh viên
888
+ có thể tham gia các chương trình trao đổi sinh viên và nhận học bổng du học thạc
889
+ sĩ, tiến sĩ tại các trường đại học nổi tiếng trên thế giới. TRIỂN VỌNG NGHỀ NGHIỆP
890
+ & CƠ HỘI VIỆC LÀM
891
+
892
+
893
+ Sinh viên tốt nghiệp ngành Vật lý Y khoa có thể làm việc trong các lĩnh vực như:
894
+
895
+
896
+ Các bệnh viện, phòng khám và cơ sở y tế: Vật lý gia trong các bệnh viện và phòng
897
+ khám sử dụng thiết bị y tế như X-quang, CT, MRI, và các phương pháp điều trị tia
898
+ xạ.'
899
+ - source_sentence: Các phương thức xét tuyển vào Trường Đại học Sư phạm TP Hồ Chí
900
+ Minh năm 2022 là gì?
901
+ sentences:
902
+ - 'Công nghệ thông tin, 7480201V, Tổ hợp: A00; A01; D01; D90, Điểm chuẩn: 25.97
903
+ 13. An toàn thông tin, 7480202V, Tổ hợp: A00; A01; D01; D90, Điểm chuẩn: 24.89
904
+ 14. Kỹ thuật dữ liệu, 7480203V, Tổ hợp: A00; A01; D01; D90, Điểm chuẩn: 24.05
905
+ 15. Công nghệ kỹ thuật công trình xây dựng, 7510102V, Tổ hợp: A00; A01; D01; D90,
906
+ Điểm chuẩn: 23.05 16. Hệ thống kỹ thuật công trình xây dựng, 7510106V, Tổ hợp:
907
+ A00; A01; D01; D90, Điểm chuẩn: 22.22 17. Công nghệ kỹ thuật cơ khí, 7510201V,
908
+ Tổ hợp: A00; A01; D01; D90, Điểm chuẩn: 25.1 18. Công nghệ chế tạo máy, 7510202V,
909
+ Tổ hợp: A00; A01; D01; D90, Điểm chuẩn: 24.27 19. Công nghệ kỹ thuật cơ điện tử,
910
+ 7510203V, Tổ hợp: A00; A01; D01; D90, Điểm chuẩn: 25.45 20. Công nghệ kỹ thuật
911
+ ô tô, 7510205V, Tổ hợp: A00; A01; D01; D90, Điểm chuẩn: 25.39 21.'
912
+ - '1. Phương thức xét tuyển
913
+
914
+
915
+ Trường Đại học Sư phạm TP Hồ Chí Minh xét tuyển đại học chính quy năm 2022 theo
916
+ các phương thức sau:
917
+
918
+
919
+ Xét tuyển thẳng
920
+
921
+
922
+ Ưu tiên xét tuyển và xét tuyển thí sinh là học sinh lớp chuyên
923
+
924
+
925
+ Xét kết quả thi tốt nghiệp THPT năm 2022
926
+
927
+
928
+ Xét học bạ THPT
929
+
930
+
931
+ Xét tuyển kết hợp thi tuyển với các ngành năng khiếu
932
+
933
+
934
+ Thông tin chi tiết về từng phương thức như sau:
935
+
936
+
937
+ A. Phương thức 1: Xét tuyển thẳng
938
+
939
+
940
+ Thực hiện theo quy định của Bộ GD&ĐT. B. Phương thức 2: Ưu tiên xét tuyển và xét
941
+ tuyển thí sinh lớp chuyên
942
+
943
+
944
+ a) Ưu tiên xét tuyển
945
+
946
+
947
+ Ngưỡng đảm bảo chất lượng đầu vào:
948
+
949
+
950
+ Áp dụng với thí sinh tốt nghiệp THPT năm 2022
951
+
952
+
953
+ Thí sinh xét tuyển ngành Giáo dục mầm non: Phải tham gia kỳ thi năng khiếu do
954
+ trường Đại học Sư phạm TPHCM tổ chức và >= 6.5 điểm. b) Xét tuyển thí sinh là
955
+ học sinh lớp chuyên
956
+
957
+
958
+ Đối tượng ưu tiên xét tuyển lớp chuyên: Thí sinh tốt nghiệp các trường THPT (theo
959
+ danh sách) có học lực lớp 12 chuyên năm 2021 – 2022 từ giỏi trở lên và đạt 1 trong
960
+ các điều kiện theo thứ tự ưu tiên vào ngành đúng hoặc gần đúng:
961
+
962
+
963
+ (1) Tham gia đội tuyển HSG quốc gia hoặc đội tuyển dự cuộc thi KHKT cấp quốc gia
964
+
965
+
966
+ (2) Đạt giải nhất, nhì, ba kỳ thi HSG do cấp tỉnh trở lên tổ chức
967
+
968
+
969
+ (3) Thí sinh có chứng chỉ ngoại ngữ B2 trở lên hoặc tương đương (áp dụng với các
970
+ ngành ngoại ngữ đúng hoặc gần)
971
+
972
+
973
+ (4) Có học lực lớp 10, 11 chuyên đạt học sinh giỏi.'
974
+ - '2. Xét tuyển sử dụng kết quả thi tốt nghiệp THPT năm 2024 (phương thức này áp
975
+ dụng với tất cả các ngành trừ Giáo dục Mầm non và Giáo dục Thể chất)
976
+
977
+
978
+ Ngưỡng điểm đảm bảo chất lượng đầu vào, điều kiện nhận hồ sơ đăng ký xét tuyển
979
+ được thông báo chính thức sau khi Bộ Giáo dục và Đào tạo xác định ngưỡng đảm bảo
980
+ chất lượng đầu vào đại học (căn cứ kết quả kỳ thi tốt nghiệp THPT năm 2024). 3.
981
+ Xét tuyển sử dụng kết quả học tập THPT (phương thức này áp dụng với tất cả các
982
+ ngành trừ Giáo dục Mầm non và Giáo dục Thể chất)
983
+
984
+
985
+ Phương thức xét tuyển này chỉ áp dụng đối với thí sinh tốt nghiệp THPT năm 2024
986
+ đồng thời phải thỏa một trong hai điều kiện sau:
987
+
988
+
989
+ + Có học lực lớp 12 xếp loại giỏi;
990
+
991
+
992
+ + Có điểm xét tốt nghiệp THPT từ 8,0 trở lên.'
993
+ - source_sentence: Chương trình đào tạo của Đại học FPT có những điểm nổi bật nào?
994
+ sentences:
995
+ - 'Học phí: 11,900,000 VNĐ/mức. 3. Các khoản phí cần nộp khi nhập học
996
+
997
+
998
+ Học phí kỳ định hướng: 11,900,000 VNĐ (có 01 học kỳ định hướng, chỉ áp dụng cho
999
+ SV mới nhập học năm 2024)
1000
+
1001
+
1002
+ Học phí 01 mức tiếng Anh chuẩn bị: 11,900,000 VNĐ/mức
1003
+
1004
+
1005
+ 1. Giáo trình chuẩn quốc tế
1006
+
1007
+
1008
+ Chương trình học của Đại học FPT được thiết kế theo chuẩn của Hiệp hội Máy tính
1009
+ (Association for Computing Machinery-ACM), chuẩn đào tạo kỹ sư phần mềm của Accreditation
1010
+ Board for Engineering and Technology (ABET – Mỹ), Hiệp hội Phần mềm Việt Nam (VINASA)
1011
+
1012
+
1013
+ Tất cả các giáo trình của Đại học FPT đều được nhập khẩu từ nước ngoài về và cập
1014
+ nhật liên tục theo từng kỳ học
1015
+
1016
+
1017
+ 2. Chú trọng vào thực hành
1018
+
1019
+
1020
+ Với thời lượng số tiết thực hành lên đến 60%, sinh viên Đại học FPT đã được làm
1021
+ quen với công việc ngay từ trên ghế nhà trường. 1 lớp học tối đa 30 sinh viên
1022
+ nên trong các giờ thực hành sinh viên sẽ được các thầy cô giảng viên hướng dẫn
1023
+ rất tỉ mỉ và chi tiết
1024
+
1025
+
1026
+ 3. Chú trọng vào ngoại ngữ và kỹ năng mềm
1027
+
1028
+
1029
+ Năm đầu tiên các bạn sinh viên sẽ phải trải qua 6 kỳ học tiếng Anh để có thể đạt
1030
+ được nền tảng ngoại ngữ nhất định trước khi sang năm thứ 2 bước vào kỳ học chuyên
1031
+ ngành. Ngoài tiếng Anh là ngôn ngữ bắt buộc ra thì sinh viên Đại học FPT còn được
1032
+ học thêm tiếng Nhật. Như vậy sau khi ra trường các bạn sinh viên có thêm rất nhiều
1033
+ cơ hội để có thể làm việc tại nước ngoài
1034
+
1035
+
1036
+ Ngay từ những ngày đầu thành lập, đại học FPT đã đề cao việc phát triển bản thân
1037
+ đặc biệt là kỹ năng mềm cho sinh viên. Các bạn sinh viên sẽ được học rất nhiều
1038
+ các khoá học như kỹ năng thuyết trình, tư duy phản biện, kỹ năng làm việc nhóm,
1039
+ kỹ năng phỏng vấn, kỹ năng viết CV .'
1040
+ - STT Mã ngành Tên ngành Tổ hợp môn Điểm chuẩn Ghi chú 1 7220201 Ngôn ngữ Anh A;
1041
+ B; C01; C02; C03; C04 21 2 7220204 Ngôn ngữ Trung Quốc A; B; C01; C02; C03;
1042
+ C04 21 3 7220209 Ngôn ngữ Nhật A; B; C01; C02; C03; C04 21 4 7220210 Ngôn ngữ
1043
+ Hàn Quốc A; B; C01; C02; C03; C04 21 5 7320106 Công nghệ truyền thông A; B;
1044
+ C01; C02; C03; C04 21 6 7340101 Quản trị kinh doanh A; B; C01; C02; C03; C04 21
1045
+ 7 7480201 Công nghệ thông tin A; B; C01; C02; C03; C04 21 Phương thức xét tuyển
1046
+ của fpt khá giống nhau.
1047
+ - 'Các môn học được giảng dạy chủ yếu bằng tiếng Anh, giúp sinh viên phát triển
1048
+ kỹ năng ngoại ngữ cũng như kiến thức chuyên môn trong lĩnh vực sinh học. Chương
1049
+ trình chú trọng vào các kỹ năng nghiên cứu, phân tích và giải quyết vấn đề trong
1050
+ môi trường sinh học toàn cầu. CƠ SỞ VẬT CHẤT CHẤT LƯỢNG CAO
1051
+
1052
+
1053
+ Các sinh viên trong chương trình này sẽ được học tập và nghiên cứu trong một môi
1054
+ trường quốc tế hóa, với các thiết bị nghiên cứu hiện đại và các cơ sở vật chất
1055
+ đạt chuẩn quốc tế. Ngoài ra, các phòng thí nghiệm và khu vực học tập đều được
1056
+ trang bị công nghệ tiên tiến phục vụ cho nghiên cứu chuyên sâu. CÁC ĐIỂM ĐẶC BIỆT
1057
+
1058
+
1059
+ Học bằng tiếng Anh: Mọi môn học đều được giảng dạy bằng tiếng Anh, giúp sinh viên
1060
+ nâng cao khả năng ngoại ngữ và tiếp cận kiến thức quốc tế. Cơ hội trao đổi quốc
1061
+ tế: Sinh viên có cơ hội tham gia các chương trình trao đổi sinh viên, học tập
1062
+ tại các trường đối tác quốc tế. Hỗ trợ nghề nghiệp: Chương trình cung cấp các
1063
+ khóa huấn luyện và tư vấn nghề nghiệp, giúp sinh viên chuẩn bị tốt cho công việc
1064
+ sau khi tốt nghiệp. TRIỂN VỌNG NGHỀ NGHIỆP & CƠ HỘI VIỆC LÀM
1065
+
1066
+
1067
+ Với nền tảng kiến thức vững chắc và khả năng sử dụng tiếng Anh, sinh viên chương
1068
+ trình tăng cường tiếng Anh có thể làm việc tại:
1069
+
1070
+
1071
+ Các tổ chức nghiên cứu quốc tế, các viện nghiên cứu sinh học.'
1072
+ pipeline_tag: sentence-similarity
1073
+ library_name: sentence-transformers
1074
+ metrics:
1075
+ - cosine_accuracy@1
1076
+ - cosine_accuracy@3
1077
+ - cosine_accuracy@5
1078
+ - cosine_accuracy@10
1079
+ - cosine_precision@1
1080
+ - cosine_precision@3
1081
+ - cosine_precision@5
1082
+ - cosine_precision@10
1083
+ - cosine_recall@1
1084
+ - cosine_recall@3
1085
+ - cosine_recall@5
1086
+ - cosine_recall@10
1087
+ - cosine_ndcg@10
1088
+ - cosine_mrr@10
1089
+ - cosine_map@100
1090
+ model-index:
1091
+ - name: SentenceTransformer based on dangvantuan/vietnamese-document-embedding
1092
+ results:
1093
+ - task:
1094
+ type: information-retrieval
1095
+ name: Information Retrieval
1096
+ dataset:
1097
+ name: dim 768
1098
+ type: dim_768
1099
+ metrics:
1100
+ - type: cosine_accuracy@1
1101
+ value: 0.466
1102
+ name: Cosine Accuracy@1
1103
+ - type: cosine_accuracy@3
1104
+ value: 0.63
1105
+ name: Cosine Accuracy@3
1106
+ - type: cosine_accuracy@5
1107
+ value: 0.678
1108
+ name: Cosine Accuracy@5
1109
+ - type: cosine_accuracy@10
1110
+ value: 0.752
1111
+ name: Cosine Accuracy@10
1112
+ - type: cosine_precision@1
1113
+ value: 0.466
1114
+ name: Cosine Precision@1
1115
+ - type: cosine_precision@3
1116
+ value: 0.21
1117
+ name: Cosine Precision@3
1118
+ - type: cosine_precision@5
1119
+ value: 0.1356
1120
+ name: Cosine Precision@5
1121
+ - type: cosine_precision@10
1122
+ value: 0.0752
1123
+ name: Cosine Precision@10
1124
+ - type: cosine_recall@1
1125
+ value: 0.466
1126
+ name: Cosine Recall@1
1127
+ - type: cosine_recall@3
1128
+ value: 0.63
1129
+ name: Cosine Recall@3
1130
+ - type: cosine_recall@5
1131
+ value: 0.678
1132
+ name: Cosine Recall@5
1133
+ - type: cosine_recall@10
1134
+ value: 0.752
1135
+ name: Cosine Recall@10
1136
+ - type: cosine_ndcg@10
1137
+ value: 0.6061109322735273
1138
+ name: Cosine Ndcg@10
1139
+ - type: cosine_mrr@10
1140
+ value: 0.5599031746031748
1141
+ name: Cosine Mrr@10
1142
+ - type: cosine_map@100
1143
+ value: 0.5685727812660539
1144
+ name: Cosine Map@100
1145
+ - task:
1146
+ type: information-retrieval
1147
+ name: Information Retrieval
1148
+ dataset:
1149
+ name: dim 512
1150
+ type: dim_512
1151
+ metrics:
1152
+ - type: cosine_accuracy@1
1153
+ value: 0.464
1154
+ name: Cosine Accuracy@1
1155
+ - type: cosine_accuracy@3
1156
+ value: 0.626
1157
+ name: Cosine Accuracy@3
1158
+ - type: cosine_accuracy@5
1159
+ value: 0.684
1160
+ name: Cosine Accuracy@5
1161
+ - type: cosine_accuracy@10
1162
+ value: 0.746
1163
+ name: Cosine Accuracy@10
1164
+ - type: cosine_precision@1
1165
+ value: 0.464
1166
+ name: Cosine Precision@1
1167
+ - type: cosine_precision@3
1168
+ value: 0.20866666666666664
1169
+ name: Cosine Precision@3
1170
+ - type: cosine_precision@5
1171
+ value: 0.1368
1172
+ name: Cosine Precision@5
1173
+ - type: cosine_precision@10
1174
+ value: 0.0746
1175
+ name: Cosine Precision@10
1176
+ - type: cosine_recall@1
1177
+ value: 0.464
1178
+ name: Cosine Recall@1
1179
+ - type: cosine_recall@3
1180
+ value: 0.626
1181
+ name: Cosine Recall@3
1182
+ - type: cosine_recall@5
1183
+ value: 0.684
1184
+ name: Cosine Recall@5
1185
+ - type: cosine_recall@10
1186
+ value: 0.746
1187
+ name: Cosine Recall@10
1188
+ - type: cosine_ndcg@10
1189
+ value: 0.6015125723964755
1190
+ name: Cosine Ndcg@10
1191
+ - type: cosine_mrr@10
1192
+ value: 0.55565
1193
+ name: Cosine Mrr@10
1194
+ - type: cosine_map@100
1195
+ value: 0.5647769486133264
1196
+ name: Cosine Map@100
1197
+ - task:
1198
+ type: information-retrieval
1199
+ name: Information Retrieval
1200
+ dataset:
1201
+ name: dim 256
1202
+ type: dim_256
1203
+ metrics:
1204
+ - type: cosine_accuracy@1
1205
+ value: 0.452
1206
+ name: Cosine Accuracy@1
1207
+ - type: cosine_accuracy@3
1208
+ value: 0.602
1209
+ name: Cosine Accuracy@3
1210
+ - type: cosine_accuracy@5
1211
+ value: 0.672
1212
+ name: Cosine Accuracy@5
1213
+ - type: cosine_accuracy@10
1214
+ value: 0.732
1215
+ name: Cosine Accuracy@10
1216
+ - type: cosine_precision@1
1217
+ value: 0.452
1218
+ name: Cosine Precision@1
1219
+ - type: cosine_precision@3
1220
+ value: 0.20066666666666666
1221
+ name: Cosine Precision@3
1222
+ - type: cosine_precision@5
1223
+ value: 0.13439999999999996
1224
+ name: Cosine Precision@5
1225
+ - type: cosine_precision@10
1226
+ value: 0.0732
1227
+ name: Cosine Precision@10
1228
+ - type: cosine_recall@1
1229
+ value: 0.452
1230
+ name: Cosine Recall@1
1231
+ - type: cosine_recall@3
1232
+ value: 0.602
1233
+ name: Cosine Recall@3
1234
+ - type: cosine_recall@5
1235
+ value: 0.672
1236
+ name: Cosine Recall@5
1237
+ - type: cosine_recall@10
1238
+ value: 0.732
1239
+ name: Cosine Recall@10
1240
+ - type: cosine_ndcg@10
1241
+ value: 0.5883841253468854
1242
+ name: Cosine Ndcg@10
1243
+ - type: cosine_mrr@10
1244
+ value: 0.5428119047619047
1245
+ name: Cosine Mrr@10
1246
+ - type: cosine_map@100
1247
+ value: 0.5525017191408654
1248
+ name: Cosine Map@100
1249
+ ---
1250
+
1251
+ # SentenceTransformer based on dangvantuan/vietnamese-document-embedding
1252
+
1253
+ This is a [sentence-transformers](https://www.SBERT.net) model finetuned from [dangvantuan/vietnamese-document-embedding](https://huggingface.co/dangvantuan/vietnamese-document-embedding). 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.
1254
+
1255
+ ## Model Details
1256
+
1257
+ ### Model Description
1258
+ - **Model Type:** Sentence Transformer
1259
+ - **Base model:** [dangvantuan/vietnamese-document-embedding](https://huggingface.co/dangvantuan/vietnamese-document-embedding) <!-- at revision 6fa4e2f8ed2d33120b0f4442cc81f8f973c3f56b -->
1260
+ - **Maximum Sequence Length:** 8192 tokens
1261
+ - **Output Dimensionality:** 768 dimensions
1262
+ - **Similarity Function:** Cosine Similarity
1263
+ <!-- - **Training Dataset:** Unknown -->
1264
+ <!-- - **Language:** Unknown -->
1265
+ <!-- - **License:** Unknown -->
1266
+
1267
+ ### Model Sources
1268
+
1269
+ - **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
1270
+ - **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
1271
+ - **Hugging Face:** [Sentence Transformers on Hugging Face](https://huggingface.co/models?library=sentence-transformers)
1272
+
1273
+ ### Full Model Architecture
1274
+
1275
+ ```
1276
+ SentenceTransformer(
1277
+ (0): Transformer({'max_seq_length': 8192, 'do_lower_case': False, 'architecture': 'VietnameseModel'})
1278
+ (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, 'include_prompt': True})
1279
+ (2): Normalize()
1280
+ )
1281
+ ```
1282
+
1283
+ ## Usage
1284
+
1285
+ ### Direct Usage (Sentence Transformers)
1286
+
1287
+ First install the Sentence Transformers library:
1288
+
1289
+ ```bash
1290
+ pip install -U sentence-transformers
1291
+ ```
1292
+
1293
+ Then you can load this model and run inference.
1294
+ ```python
1295
+ from sentence_transformers import SentenceTransformer
1296
+
1297
+ # Download from the 🤗 Hub
1298
+ model = SentenceTransformer("HoangVuSnape/vietnamese-document-embedding_pr_v3")
1299
+ # Run inference
1300
+ sentences = [
1301
+ 'Chương trình đào tạo của Đại học FPT có những điểm nổi bật nào?',
1302
+ 'Học phí: 11,900,000 VNĐ/mức. 3. Các khoản phí cần nộp khi nhập học\n\nHọc phí kỳ định hướng: 11,900,000 VNĐ (có 01 học kỳ định hướng, chỉ áp dụng cho SV mới nhập học năm 2024)\n\nHọc phí 01 mức tiếng Anh chuẩn bị: 11,900,000 VNĐ/mức\n\n1. Giáo trình chuẩn quốc tế\n\nChương trình học của Đại học FPT được thiết kế theo chuẩn của Hiệp hội Máy tính (Association for Computing Machinery-ACM), chuẩn đào tạo kỹ sư phần mềm của Accreditation Board for Engineering and Technology (ABET – Mỹ), Hiệp hội Phần mềm Việt Nam (VINASA)\n\nTất cả các giáo trình của Đại học FPT đều được nhập khẩu từ nước ngoài về và cập nhật liên tục theo từng kỳ học\n\n2. Chú trọng vào thực hành\n\nVới thời lượng số tiết thực hành lên đến 60%, sinh viên Đại học FPT đã được làm quen với công việc ngay từ trên ghế nhà trường. 1 lớp học tối đa 30 sinh viên nên trong các giờ thực hành sinh viên sẽ được các thầy cô giảng viên hướng dẫn rất tỉ mỉ và chi tiết\n\n3. Chú trọng vào ngoại ngữ và kỹ năng mềm\n\nNăm đầu tiên các bạn sinh viên sẽ phải trải qua 6 kỳ học tiếng Anh để có thể đạt được nền tảng ngoại ngữ nhất định trước khi sang năm thứ 2 bước vào kỳ học chuyên ngành. Ngoài tiếng Anh là ngôn ngữ bắt buộc ra thì sinh viên Đại học FPT còn được học thêm tiếng Nhật. Như vậy sau khi ra trường các bạn sinh viên có thêm rất nhiều cơ hội để có thể làm việc tại nước ngoài\n\nNgay từ những ngày đầu thành lập, đại học FPT đã đề cao việc phát triển bản thân đặc biệt là kỹ năng mềm cho sinh viên. Các bạn sinh viên sẽ được học rất nhiều các khoá học như kỹ năng thuyết trình, tư duy phản biện, kỹ năng làm việc nhóm, kỹ năng phỏng vấn, kỹ năng viết CV .',
1303
+ 'STT Mã ngành Tên ngành Tổ hợp môn Điểm chuẩn Ghi chú 1 7220201 Ngôn ngữ Anh A; B; C01; C02; C03; C04 21 2 7220204 Ngôn ngữ Trung Quốc A; B; C01; C02; C03; C04 21 3 7220209 Ngôn ngữ Nhật A; B; C01; C02; C03; C04 21 4 7220210 Ngôn ngữ Hàn Quốc A; B; C01; C02; C03; C04 21 5 7320106 Công nghệ truyền thông A; B; C01; C02; C03; C04 21 6 7340101 Quản trị kinh doanh A; B; C01; C02; C03; C04 21 7 7480201 Công nghệ thông tin A; B; C01; C02; C03; C04 21 Phương thức xét tuyển của fpt khá giống nhau.',
1304
+ ]
1305
+ embeddings = model.encode(sentences)
1306
+ print(embeddings.shape)
1307
+ # [3, 768]
1308
+
1309
+ # Get the similarity scores for the embeddings
1310
+ similarities = model.similarity(embeddings, embeddings)
1311
+ print(similarities)
1312
+ # tensor([[1.0000, 0.7188, 0.5351],
1313
+ # [0.7188, 1.0000, 0.5165],
1314
+ # [0.5351, 0.5165, 1.0000]])
1315
+ ```
1316
+
1317
+ <!--
1318
+ ### Direct Usage (Transformers)
1319
+
1320
+ <details><summary>Click to see the direct usage in Transformers</summary>
1321
+
1322
+ </details>
1323
+ -->
1324
+
1325
+ <!--
1326
+ ### Downstream Usage (Sentence Transformers)
1327
+
1328
+ You can finetune this model on your own dataset.
1329
+
1330
+ <details><summary>Click to expand</summary>
1331
+
1332
+ </details>
1333
+ -->
1334
+
1335
+ <!--
1336
+ ### Out-of-Scope Use
1337
+
1338
+ *List how the model may foreseeably be misused and address what users ought not to do with the model.*
1339
+ -->
1340
+
1341
+ ## Evaluation
1342
+
1343
+ ### Metrics
1344
+
1345
+ #### Information Retrieval
1346
+
1347
+ * Dataset: `dim_768`
1348
+ * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
1349
+ ```json
1350
+ {
1351
+ "truncate_dim": 768
1352
+ }
1353
+ ```
1354
+
1355
+ | Metric | Value |
1356
+ |:--------------------|:-----------|
1357
+ | cosine_accuracy@1 | 0.466 |
1358
+ | cosine_accuracy@3 | 0.63 |
1359
+ | cosine_accuracy@5 | 0.678 |
1360
+ | cosine_accuracy@10 | 0.752 |
1361
+ | cosine_precision@1 | 0.466 |
1362
+ | cosine_precision@3 | 0.21 |
1363
+ | cosine_precision@5 | 0.1356 |
1364
+ | cosine_precision@10 | 0.0752 |
1365
+ | cosine_recall@1 | 0.466 |
1366
+ | cosine_recall@3 | 0.63 |
1367
+ | cosine_recall@5 | 0.678 |
1368
+ | cosine_recall@10 | 0.752 |
1369
+ | **cosine_ndcg@10** | **0.6061** |
1370
+ | cosine_mrr@10 | 0.5599 |
1371
+ | cosine_map@100 | 0.5686 |
1372
+
1373
+ #### Information Retrieval
1374
+
1375
+ * Dataset: `dim_512`
1376
+ * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
1377
+ ```json
1378
+ {
1379
+ "truncate_dim": 512
1380
+ }
1381
+ ```
1382
+
1383
+ | Metric | Value |
1384
+ |:--------------------|:-----------|
1385
+ | cosine_accuracy@1 | 0.464 |
1386
+ | cosine_accuracy@3 | 0.626 |
1387
+ | cosine_accuracy@5 | 0.684 |
1388
+ | cosine_accuracy@10 | 0.746 |
1389
+ | cosine_precision@1 | 0.464 |
1390
+ | cosine_precision@3 | 0.2087 |
1391
+ | cosine_precision@5 | 0.1368 |
1392
+ | cosine_precision@10 | 0.0746 |
1393
+ | cosine_recall@1 | 0.464 |
1394
+ | cosine_recall@3 | 0.626 |
1395
+ | cosine_recall@5 | 0.684 |
1396
+ | cosine_recall@10 | 0.746 |
1397
+ | **cosine_ndcg@10** | **0.6015** |
1398
+ | cosine_mrr@10 | 0.5556 |
1399
+ | cosine_map@100 | 0.5648 |
1400
+
1401
+ #### Information Retrieval
1402
+
1403
+ * Dataset: `dim_256`
1404
+ * Evaluated with [<code>InformationRetrievalEvaluator</code>](https://sbert.net/docs/package_reference/sentence_transformer/evaluation.html#sentence_transformers.evaluation.InformationRetrievalEvaluator) with these parameters:
1405
+ ```json
1406
+ {
1407
+ "truncate_dim": 256
1408
+ }
1409
+ ```
1410
+
1411
+ | Metric | Value |
1412
+ |:--------------------|:-----------|
1413
+ | cosine_accuracy@1 | 0.452 |
1414
+ | cosine_accuracy@3 | 0.602 |
1415
+ | cosine_accuracy@5 | 0.672 |
1416
+ | cosine_accuracy@10 | 0.732 |
1417
+ | cosine_precision@1 | 0.452 |
1418
+ | cosine_precision@3 | 0.2007 |
1419
+ | cosine_precision@5 | 0.1344 |
1420
+ | cosine_precision@10 | 0.0732 |
1421
+ | cosine_recall@1 | 0.452 |
1422
+ | cosine_recall@3 | 0.602 |
1423
+ | cosine_recall@5 | 0.672 |
1424
+ | cosine_recall@10 | 0.732 |
1425
+ | **cosine_ndcg@10** | **0.5884** |
1426
+ | cosine_mrr@10 | 0.5428 |
1427
+ | cosine_map@100 | 0.5525 |
1428
+
1429
+ <!--
1430
+ ## Bias, Risks and Limitations
1431
+
1432
+ *What are the known or foreseeable issues stemming from this model? You could also flag here known failure cases or weaknesses of the model.*
1433
+ -->
1434
+
1435
+ <!--
1436
+ ### Recommendations
1437
+
1438
+ *What are recommendations with respect to the foreseeable issues? For example, filtering explicit content.*
1439
+ -->
1440
+
1441
+ ## Training Details
1442
+
1443
+ ### Training Dataset
1444
+
1445
+ #### Unnamed Dataset
1446
+
1447
+ * Size: 500 training samples
1448
+ * Columns: <code>anchor</code> and <code>positive</code>
1449
+ * Approximate statistics based on the first 500 samples:
1450
+ | | anchor | positive |
1451
+ |:--------|:-----------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------|
1452
+ | type | string | string |
1453
+ | details | <ul><li>min: 10 tokens</li><li>mean: 26.05 tokens</li><li>max: 62 tokens</li></ul> | <ul><li>min: 29 tokens</li><li>mean: 605.11 tokens</li><li>max: 6602 tokens</li></ul> |
1454
+ * Samples:
1455
+ | anchor | positive |
1456
+ |:-----------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
1457
+ | <code>Ngành Quản lý Tài nguyên và Môi trường trang bị cho sinh viên những kiến thức và kỹ năng gì?</code> | <code>Sau khi tốt nghiệp, người học sẽ:<br><br>Có kiến thức cơ bản về toán học, khoa học tự nhiên, đáp ứng cho việc tiếp thu các kiến thức giáo dục chuyên nghiệp và khả năng học tập ở trình độ cao hơn<br><br>Có các kiến thức kỹ thuật cơ sở ngành và chuyên ngành giúp đủ năng lực phát hiện, giải quyết các vấn đề liên quan đến công nghệ sản xuất, chế tạo và ứng dụng vật liệu vào trong xây dựng, kiểm soát chất lượng nguyên vật li��u và cấu kiện sản phẩm xây dựng, nghiên cứu sản xuất chế tạo và phát triển các loại vật liệu mới, hiện đại, tiên tiến, độc đáo, hiệu quả, xanh, bền vững… nhằm hướng tới sự phát triển bền vững trong công nghiệp xây dựng và kiến trúc, thiết kế và thi công trong các công trình xây dựng; có tính sáng tạo trong hoạt động nghề nghiệp, có khả năng tự học và tự nghiên cứu;<br><br>Có kỹ năng cá nhân, nghề nghiệp, giao tiếp, làm việc nhóm đủ để làm việc trong môi trường làm việc liên ngành, đa văn hóa;<br><br>Có hiểu biết về kinh tế, chính trị, có các kiến thức cơ bản trong lĩnh vực khoa học xã hội và n...</code> |
1458
+ | <code>Chương trình Kỹ thuật Môi trường đào tạo sinh viên về những năng lực nào và có điểm gì nổi bật đối với chương trình giảng dạy bằng tiếng Anh?</code> | <code>Sau khi tốt nghiệp, người học sẽ:<br><br>Có kiến thức cơ bản về toán học, khoa học tự nhiên, đáp ứng cho việc tiếp thu các kiến thức giáo dục chuyên nghiệp và khả năng học tập ở trình độ cao hơn<br><br>Có các kiến thức kỹ thuật cơ sở ngành và chuyên ngành giúp đủ năng lực phát hiện, giải quyết các vấn đề liên quan đến công nghệ sản xuất, chế tạo và ứng dụng vật liệu vào trong xây dựng, kiểm soát chất lượng nguyên vật liệu và cấu kiện sản phẩm xây dựng, nghiên cứu sản xuất chế tạo và phát triển các loại vật liệu mới, hiện đại, tiên tiến, độc đáo, hiệu quả, xanh, bền vững… nhằm hướng tới sự phát triển bền vững trong công nghiệp xây dựng và kiến trúc, thiết kế và thi công trong các công trình xây dựng; có tính sáng tạo trong hoạt động nghề nghiệp, có khả năng tự học và tự nghiên cứu;<br><br>Có kỹ năng cá nhân, nghề nghiệp, giao tiếp, làm việc nhóm đủ để làm việc trong môi trường làm việc liên ngành, đa văn hóa;<br><br>Có hiểu biết về kinh tế, chính trị, có các kiến thức cơ bản trong lĩnh vực khoa học xã hội và n...</code> |
1459
+ | <code>Ngành Kỹ thuật Dầu khí và Kỹ thuật Địa chất tập trung nghiên cứu và ứng dụng những lĩnh vực cốt lõi nào?</code> | <code>Các công ty nghiên cứu và khảo sát địa chất, tư vấn về nền móng công trình. Các tổ chức liên quan đến quy hoạch và phát triển đô thị. Kỹ thuật Dầu khí<br><br>Tổng quan<br><br>Kỹ thuật Dầu khí là ngành học chuyên nghiên cứu về các kỹ thuật khai thác, sản xuất và xử lý dầu khí. Sinh viên sẽ học các phương pháp khoan, khai thác dầu, khí tự nhiên, và xử lý các vấn đề kỹ thuật trong ngành dầu khí, từ việc tìm kiếm và khai thác tài nguyên cho đến việc tối ưu hóa quy trình sản xuất. CÁC ĐIỂM ĐẶC BIỆT<br><br>Khả năng ứng dụng cao: Sinh viên ngành Kỹ thuật Dầu khí sẽ được trang bị kiến thức thực tế về công nghệ khai thác dầu khí và các phương pháp tối ưu hóa sản xuất. Ngành công nghiệp chiến lược: Dầu khí vẫn là một trong những ngành công nghiệp mũi nhọn và cần nguồn nhân lực có trình độ cao trong việc khai thác và xử lý tài nguyên thiên nhiên. Triển vọng việc làm<br><br>Các công ty khai thác dầu khí trong nước và quốc tế. Các công ty tư vấn và kỹ thuật dầu khí, nghiên cứu các giải pháp tối ưu trong khai thác. Các côn...</code> |
1460
+ * Loss: [<code>MatryoshkaLoss</code>](https://sbert.net/docs/package_reference/sentence_transformer/losses.html#matryoshkaloss) with these parameters:
1461
+ ```json
1462
+ {
1463
+ "loss": "MultipleNegativesRankingLoss",
1464
+ "matryoshka_dims": [
1465
+ 768,
1466
+ 512,
1467
+ 256
1468
+ ],
1469
+ "matryoshka_weights": [
1470
+ 1,
1471
+ 1,
1472
+ 1
1473
+ ],
1474
+ "n_dims_per_step": -1
1475
+ }
1476
+ ```
1477
+
1478
+ ### Training Hyperparameters
1479
+ #### Non-Default Hyperparameters
1480
+
1481
+ - `eval_strategy`: steps
1482
+ - `per_device_train_batch_size`: 16
1483
+ - `per_device_eval_batch_size`: 16
1484
+ - `gradient_accumulation_steps`: 8
1485
+ - `learning_rate`: 2e-05
1486
+ - `num_train_epochs`: 1
1487
+ - `lr_scheduler_type`: cosine
1488
+ - `warmup_ratio`: 0.1
1489
+ - `bf16`: True
1490
+ - `tf32`: True
1491
+ - `dataloader_drop_last`: True
1492
+ - `dataloader_num_workers`: 8
1493
+ - `load_best_model_at_end`: True
1494
+ - `batch_sampler`: no_duplicates
1495
+
1496
+ #### All Hyperparameters
1497
+ <details><summary>Click to expand</summary>
1498
+
1499
+ - `overwrite_output_dir`: False
1500
+ - `do_predict`: False
1501
+ - `eval_strategy`: steps
1502
+ - `prediction_loss_only`: True
1503
+ - `per_device_train_batch_size`: 16
1504
+ - `per_device_eval_batch_size`: 16
1505
+ - `per_gpu_train_batch_size`: None
1506
+ - `per_gpu_eval_batch_size`: None
1507
+ - `gradient_accumulation_steps`: 8
1508
+ - `eval_accumulation_steps`: None
1509
+ - `torch_empty_cache_steps`: None
1510
+ - `learning_rate`: 2e-05
1511
+ - `weight_decay`: 0.0
1512
+ - `adam_beta1`: 0.9
1513
+ - `adam_beta2`: 0.999
1514
+ - `adam_epsilon`: 1e-08
1515
+ - `max_grad_norm`: 1.0
1516
+ - `num_train_epochs`: 1
1517
+ - `max_steps`: -1
1518
+ - `lr_scheduler_type`: cosine
1519
+ - `lr_scheduler_kwargs`: {}
1520
+ - `warmup_ratio`: 0.1
1521
+ - `warmup_steps`: 0
1522
+ - `log_level`: passive
1523
+ - `log_level_replica`: warning
1524
+ - `log_on_each_node`: True
1525
+ - `logging_nan_inf_filter`: True
1526
+ - `save_safetensors`: True
1527
+ - `save_on_each_node`: False
1528
+ - `save_only_model`: False
1529
+ - `restore_callback_states_from_checkpoint`: False
1530
+ - `no_cuda`: False
1531
+ - `use_cpu`: False
1532
+ - `use_mps_device`: False
1533
+ - `seed`: 42
1534
+ - `data_seed`: None
1535
+ - `jit_mode_eval`: False
1536
+ - `use_ipex`: False
1537
+ - `bf16`: True
1538
+ - `fp16`: False
1539
+ - `fp16_opt_level`: O1
1540
+ - `half_precision_backend`: auto
1541
+ - `bf16_full_eval`: False
1542
+ - `fp16_full_eval`: False
1543
+ - `tf32`: True
1544
+ - `local_rank`: 0
1545
+ - `ddp_backend`: None
1546
+ - `tpu_num_cores`: None
1547
+ - `tpu_metrics_debug`: False
1548
+ - `debug`: []
1549
+ - `dataloader_drop_last`: True
1550
+ - `dataloader_num_workers`: 8
1551
+ - `dataloader_prefetch_factor`: None
1552
+ - `past_index`: -1
1553
+ - `disable_tqdm`: False
1554
+ - `remove_unused_columns`: True
1555
+ - `label_names`: None
1556
+ - `load_best_model_at_end`: True
1557
+ - `ignore_data_skip`: False
1558
+ - `fsdp`: []
1559
+ - `fsdp_min_num_params`: 0
1560
+ - `fsdp_config`: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
1561
+ - `fsdp_transformer_layer_cls_to_wrap`: None
1562
+ - `accelerator_config`: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
1563
+ - `deepspeed`: None
1564
+ - `label_smoothing_factor`: 0.0
1565
+ - `optim`: adamw_torch_fused
1566
+ - `optim_args`: None
1567
+ - `adafactor`: False
1568
+ - `group_by_length`: False
1569
+ - `length_column_name`: length
1570
+ - `ddp_find_unused_parameters`: None
1571
+ - `ddp_bucket_cap_mb`: None
1572
+ - `ddp_broadcast_buffers`: False
1573
+ - `dataloader_pin_memory`: True
1574
+ - `dataloader_persistent_workers`: False
1575
+ - `skip_memory_metrics`: True
1576
+ - `use_legacy_prediction_loop`: False
1577
+ - `push_to_hub`: False
1578
+ - `resume_from_checkpoint`: None
1579
+ - `hub_model_id`: None
1580
+ - `hub_strategy`: every_save
1581
+ - `hub_private_repo`: None
1582
+ - `hub_always_push`: False
1583
+ - `hub_revision`: None
1584
+ - `gradient_checkpointing`: False
1585
+ - `gradient_checkpointing_kwargs`: None
1586
+ - `include_inputs_for_metrics`: False
1587
+ - `include_for_metrics`: []
1588
+ - `eval_do_concat_batches`: True
1589
+ - `fp16_backend`: auto
1590
+ - `push_to_hub_model_id`: None
1591
+ - `push_to_hub_organization`: None
1592
+ - `mp_parameters`:
1593
+ - `auto_find_batch_size`: False
1594
+ - `full_determinism`: False
1595
+ - `torchdynamo`: None
1596
+ - `ray_scope`: last
1597
+ - `ddp_timeout`: 1800
1598
+ - `torch_compile`: False
1599
+ - `torch_compile_backend`: None
1600
+ - `torch_compile_mode`: None
1601
+ - `include_tokens_per_second`: False
1602
+ - `include_num_input_tokens_seen`: False
1603
+ - `neftune_noise_alpha`: None
1604
+ - `optim_target_modules`: None
1605
+ - `batch_eval_metrics`: False
1606
+ - `eval_on_start`: False
1607
+ - `use_liger_kernel`: False
1608
+ - `liger_kernel_config`: None
1609
+ - `eval_use_gather_object`: False
1610
+ - `average_tokens_across_devices`: False
1611
+ - `prompts`: None
1612
+ - `batch_sampler`: no_duplicates
1613
+ - `multi_dataset_batch_sampler`: proportional
1614
+ - `router_mapping`: {}
1615
+ - `learning_rate_mapping`: {}
1616
+
1617
+ </details>
1618
+
1619
+ ### Training Logs
1620
+ | Epoch | Step | dim_768_cosine_ndcg@10 | dim_512_cosine_ndcg@10 | dim_256_cosine_ndcg@10 |
1621
+ |:-----:|:----:|:----------------------:|:----------------------:|:----------------------:|
1622
+ | -1 | -1 | 0.6061 | 0.6015 | 0.5884 |
1623
+
1624
+
1625
+ ### Framework Versions
1626
+ - Python: 3.10.12
1627
+ - Sentence Transformers: 5.1.0
1628
+ - Transformers: 4.55.2
1629
+ - PyTorch: 2.8.0+cu128
1630
+ - Accelerate: 1.10.0
1631
+ - Datasets: 4.0.0
1632
+ - Tokenizers: 0.21.4
1633
+
1634
+ ## Citation
1635
+
1636
+ ### BibTeX
1637
+
1638
+ #### Sentence Transformers
1639
+ ```bibtex
1640
+ @inproceedings{reimers-2019-sentence-bert,
1641
+ title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
1642
+ author = "Reimers, Nils and Gurevych, Iryna",
1643
+ booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
1644
+ month = "11",
1645
+ year = "2019",
1646
+ publisher = "Association for Computational Linguistics",
1647
+ url = "https://arxiv.org/abs/1908.10084",
1648
+ }
1649
+ ```
1650
+
1651
+ #### MatryoshkaLoss
1652
+ ```bibtex
1653
+ @misc{kusupati2024matryoshka,
1654
+ title={Matryoshka Representation Learning},
1655
+ author={Aditya Kusupati and Gantavya Bhatt and Aniket Rege and Matthew Wallingford and Aditya Sinha and Vivek Ramanujan and William Howard-Snyder and Kaifeng Chen and Sham Kakade and Prateek Jain and Ali Farhadi},
1656
+ year={2024},
1657
+ eprint={2205.13147},
1658
+ archivePrefix={arXiv},
1659
+ primaryClass={cs.LG}
1660
+ }
1661
+ ```
1662
+
1663
+ #### MultipleNegativesRankingLoss
1664
+ ```bibtex
1665
+ @misc{henderson2017efficient,
1666
+ title={Efficient Natural Language Response Suggestion for Smart Reply},
1667
+ author={Matthew Henderson and Rami Al-Rfou and Brian Strope and Yun-hsuan Sung and Laszlo Lukacs and Ruiqi Guo and Sanjiv Kumar and Balint Miklos and Ray Kurzweil},
1668
+ year={2017},
1669
+ eprint={1705.00652},
1670
+ archivePrefix={arXiv},
1671
+ primaryClass={cs.CL}
1672
+ }
1673
+ ```
1674
+
1675
+ <!--
1676
+ ## Glossary
1677
+
1678
+ *Clearly define terms in order to be accessible across audiences.*
1679
+ -->
1680
+
1681
+ <!--
1682
+ ## Model Card Authors
1683
+
1684
+ *Lists the people who create the model card, providing recognition and accountability for the detailed work that goes into its construction.*
1685
+ -->
1686
+
1687
+ <!--
1688
+ ## Model Card Contact
1689
+
1690
+ *Provides a way for people who have updates to the Model Card, suggestions, or questions, to contact the Model Card authors.*
1691
+ -->
config.json ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "VietnameseModel"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.0,
6
+ "auto_map": {
7
+ "AutoConfig": "configuration.VietnameseConfig",
8
+ "AutoModel": "modeling.VietnameseModel",
9
+ "AutoModelForMaskedLM": "dangvantuan/Vietnamese_impl--modeling.VietnameseForMaskedLM",
10
+ "AutoModelForMultipleChoice": "dangvantuan/Vietnamese_impl--modeling.VietnameseForMultipleChoice",
11
+ "AutoModelForQuestionAnswering": "dangvantuan/Vietnamese_impl--modeling.VietnameseForQuestionAnswering",
12
+ "AutoModelForSequenceClassification": "dangvantuan/Vietnamese_impl--modeling.VietnameseForSequenceClassification",
13
+ "AutoModelForTokenClassification": "dangvantuan/Vietnamese_impl--modeling.VietnameseForTokenClassification"
14
+ },
15
+ "classifier_dropout": 0.0,
16
+ "hidden_act": "gelu",
17
+ "hidden_dropout_prob": 0.1,
18
+ "hidden_size": 768,
19
+ "id2label": {
20
+ "0": "LABEL_0"
21
+ },
22
+ "initializer_range": 0.02,
23
+ "intermediate_size": 3072,
24
+ "label2id": {
25
+ "LABEL_0": 0
26
+ },
27
+ "layer_norm_eps": 1e-12,
28
+ "layer_norm_type": "layer_norm",
29
+ "logn_attention_clip1": false,
30
+ "logn_attention_scale": false,
31
+ "max_position_embeddings": 8192,
32
+ "model_type": "Vietnamese",
33
+ "num_attention_heads": 12,
34
+ "num_hidden_layers": 12,
35
+ "pack_qkv": true,
36
+ "pad_token_id": 1,
37
+ "position_embedding_type": "rope",
38
+ "rope_scaling": {
39
+ "factor": 8.0,
40
+ "type": "ntk"
41
+ },
42
+ "rope_theta": 20000,
43
+ "torch_dtype": "float32",
44
+ "transformers_version": "4.55.2",
45
+ "type_vocab_size": 1,
46
+ "unpad_inputs": false,
47
+ "use_memory_efficient_attention": false,
48
+ "vocab_size": 250048
49
+ }
config_sentence_transformers.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__version__": {
3
+ "sentence_transformers": "5.1.0",
4
+ "transformers": "4.55.2",
5
+ "pytorch": "2.8.0+cu128"
6
+ },
7
+ "prompts": {
8
+ "query": "",
9
+ "document": ""
10
+ },
11
+ "default_prompt_name": null,
12
+ "model_type": "SentenceTransformer",
13
+ "similarity_fn_name": "cosine"
14
+ }
configuration.py ADDED
@@ -0,0 +1,114 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # limitations under the License.
2
+ """ Vietnamese model configuration"""
3
+ from transformers.configuration_utils import PretrainedConfig
4
+ from transformers.utils import logging
5
+
6
+ logger = logging.get_logger(__name__)
7
+
8
+
9
+ class VietnameseConfig(PretrainedConfig):
10
+ r"""
11
+ This is the configuration class to store the configuration of a [`VietnameseModel`] or a [`TFVietnameseModel`]. It is used to
12
+ instantiate a Vietnamese model according to the specified arguments, defining the model architecture. Instantiating a
13
+ configuration with the defaults will yield a similar configuration to that of the Vietnamese
14
+ Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
15
+ documentation from [`PretrainedConfig`] for more information.
16
+ Args:
17
+ vocab_size (`int`, *optional*, defaults to 30522):
18
+ Vocabulary size of the Vietnamese model. Defines the number of different tokens that can be represented by the
19
+ `inputs_ids` passed when calling [`VietnameseModel`] or [`TFVietnameseModel`].
20
+ hidden_size (`int`, *optional*, defaults to 768):
21
+ Dimensionality of the encoder layers and the pooler layer.
22
+ num_hidden_layers (`int`, *optional*, defaults to 12):
23
+ Number of hidden layers in the Transformer encoder.
24
+ num_attention_heads (`int`, *optional*, defaults to 12):
25
+ Number of attention heads for each attention layer in the Transformer encoder.
26
+ intermediate_size (`int`, *optional*, defaults to 3072):
27
+ Dimensionality of the "intermediate" (often named feed-forward) layer in the Transformer encoder.
28
+ hidden_act (`str` or `Callable`, *optional*, defaults to `"gelu"`):
29
+ The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
30
+ `"relu"`, `"silu"` and `"gelu_Vietnamese"` are supported.
31
+ hidden_dropout_prob (`float`, *optional*, defaults to 0.1):
32
+ The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.
33
+ attention_probs_dropout_prob (`float`, *optional*, defaults to 0.1):
34
+ The dropout ratio for the attention probabilities.
35
+ max_position_embeddings (`int`, *optional*, defaults to 512):
36
+ The maximum sequence length that this model might ever be used with. Typically set this to something large
37
+ just in case (e.g., 512 or 1024 or 2048).
38
+ type_vocab_size (`int`, *optional*, defaults to 2):
39
+ The vocabulary size of the `token_type_ids` passed when calling [`VietnameseModel`] or [`TFVietnameseModel`].
40
+ initializer_range (`float`, *optional*, defaults to 0.02):
41
+ The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
42
+ layer_norm_eps (`float`, *optional*, defaults to 1e-12):
43
+ The epsilon used by the layer normalization layers.
44
+ position_embedding_type (`str`, *optional*, defaults to `"rope"`):
45
+ Type of position embedding. Choose one of `"absolute"`, `"rope"`.
46
+ rope_theta (`float`, *optional*, defaults to 10000.0):
47
+ The base period of the RoPE embeddings.
48
+ rope_scaling (`Dict`, *optional*):
49
+ Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
50
+ strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
51
+ `{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update
52
+ `max_position_embeddings` to the expected new maximum. See the following thread for more information on how
53
+ these scaling strategies behave:
54
+ https://www.reddit.com/r/LocalLLaMA/comments/14mrgpr/dynamically_scaled_rope_further_increases/. This is an
55
+ experimental feature, subject to breaking API changes in future versions.
56
+ classifier_dropout (`float`, *optional*):
57
+ The dropout ratio for the classification head.
58
+ Examples:
59
+ """
60
+
61
+ model_type = "Vietnamese"
62
+
63
+ def __init__(
64
+ self,
65
+ vocab_size=30528,
66
+ hidden_size=768,
67
+ num_hidden_layers=12,
68
+ num_attention_heads=12,
69
+ intermediate_size=3072,
70
+ hidden_act="gelu",
71
+ hidden_dropout_prob=0.1,
72
+ attention_probs_dropout_prob=0.0,
73
+ max_position_embeddings=2048,
74
+ type_vocab_size=1,
75
+ initializer_range=0.02,
76
+ layer_norm_type='layer_norm',
77
+ layer_norm_eps=1e-12,
78
+ # pad_token_id=0,
79
+ position_embedding_type="rope",
80
+ rope_theta=10000.0,
81
+ rope_scaling=None,
82
+ classifier_dropout=None,
83
+ pack_qkv=True,
84
+ unpad_inputs=False,
85
+ use_memory_efficient_attention=False,
86
+ logn_attention_scale=False,
87
+ logn_attention_clip1=False,
88
+ **kwargs,
89
+ ):
90
+ super().__init__(**kwargs)
91
+
92
+ self.vocab_size = vocab_size
93
+ self.hidden_size = hidden_size
94
+ self.num_hidden_layers = num_hidden_layers
95
+ self.num_attention_heads = num_attention_heads
96
+ self.hidden_act = hidden_act
97
+ self.intermediate_size = intermediate_size
98
+ self.hidden_dropout_prob = hidden_dropout_prob
99
+ self.attention_probs_dropout_prob = attention_probs_dropout_prob
100
+ self.max_position_embeddings = max_position_embeddings
101
+ self.type_vocab_size = type_vocab_size
102
+ self.initializer_range = initializer_range
103
+ self.layer_norm_type = layer_norm_type
104
+ self.layer_norm_eps = layer_norm_eps
105
+ self.position_embedding_type = position_embedding_type
106
+ self.rope_theta = rope_theta
107
+ self.rope_scaling = rope_scaling
108
+ self.classifier_dropout = classifier_dropout
109
+
110
+ self.pack_qkv = pack_qkv
111
+ self.unpad_inputs = unpad_inputs
112
+ self.use_memory_efficient_attention = use_memory_efficient_attention
113
+ self.logn_attention_scale = logn_attention_scale
114
+ self.logn_attention_clip1 = logn_attention_clip1
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:26b7c934bc01c424e66fca55f931b702b22940ca9af56b98d849eeaeca96ca09
3
+ size 1221487872
modeling.py ADDED
@@ -0,0 +1,1319 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """PyTorch Vietnamese model."""
2
+ import math
3
+ from dataclasses import dataclass
4
+ from typing import List, Optional, Tuple, Union
5
+
6
+ import torch
7
+ import torch.utils.checkpoint
8
+ from torch import nn
9
+
10
+ from transformers.activations import ACT2FN
11
+ from transformers.modeling_outputs import (
12
+ BaseModelOutput,
13
+ BaseModelOutputWithPooling,
14
+ MaskedLMOutput,
15
+ MultipleChoiceModelOutput,
16
+ QuestionAnsweringModelOutput,
17
+ SequenceClassifierOutput,
18
+ ModelOutput,
19
+ )
20
+ from transformers.modeling_utils import PreTrainedModel
21
+ from transformers.utils import logging
22
+
23
+ try:
24
+ import xformers.ops as xops
25
+ except ImportError as e:
26
+ xops = None
27
+
28
+ from .configuration import VietnameseConfig
29
+
30
+
31
+ logger = logging.get_logger(__name__)
32
+
33
+
34
+ # Adapted from https://github.com/HazyResearch/flash-attention/blob/main/flash_attn/bert_padding.py
35
+ # Which was adapted from https://github.com/mlcommons/training_results_v1.1/blob/main/NVIDIA/benchmarks/bert/implementations/pytorch/padding.py
36
+ class IndexFirstAxis(torch.autograd.Function):
37
+ @staticmethod
38
+ def forward(ctx, input, indices):
39
+ ctx.save_for_backward(indices)
40
+ assert input.ndim >= 2
41
+ ctx.first_axis_dim, other_shape = input.shape[0], input.shape[1:]
42
+ second_dim = other_shape.numel()
43
+ return torch.gather(
44
+ input.view(ctx.first_axis_dim, second_dim),
45
+ 0,
46
+ indices.unsqueeze(-1).expand(indices.size(0), second_dim)
47
+ ).reshape(-1, *other_shape)
48
+
49
+ @staticmethod
50
+ def backward(ctx, grad_output):
51
+ (indices,) = ctx.saved_tensors
52
+ assert grad_output.ndim >= 2
53
+ other_shape = grad_output.shape[1:]
54
+ grad_output = grad_output.view(grad_output.size(0), other_shape.numel())
55
+ grad_input = torch.zeros(
56
+ [ctx.first_axis_dim, grad_output.shape[1]],
57
+ device=grad_output.device,
58
+ dtype=grad_output.dtype,
59
+ )
60
+ grad_input.scatter_(
61
+ 0, indices.unsqueeze(-1).expand(indices.size(0), grad_output.size(1)), grad_output
62
+ )
63
+ return grad_input.reshape(ctx.first_axis_dim, *other_shape), None
64
+
65
+
66
+ index_first_axis = IndexFirstAxis.apply
67
+
68
+
69
+ def unpad_input(hidden_states, attention_mask=None, indices=None):
70
+ """
71
+ Arguments:
72
+ hidden_states: (batch, seqlen, ...)
73
+ attention_mask: (batch, seqlen), bool / int, 1 means valid and 0 means not valid.
74
+ indices: (total_nnz), the indices of non-masked tokens from the flattened input sequence.
75
+ Return:
76
+ hidden_states: (total_nnz, ...), where total_nnz = number of tokens in selected in attention_mask.
77
+ """
78
+ if indices is None:
79
+ assert attention_mask is not None
80
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
81
+
82
+ hidden_states = hidden_states.view(-1, *hidden_states.shape[2:])
83
+ return index_first_axis(hidden_states, indices)
84
+
85
+
86
+ class IndexPutFirstAxis(torch.autograd.Function):
87
+ @staticmethod
88
+ def forward(
89
+ ctx,
90
+ values: torch.Tensor,
91
+ indices: torch.Tensor,
92
+ first_axis_dim
93
+ ) -> torch.Tensor:
94
+ ctx.save_for_backward(indices)
95
+ assert indices.ndim == 1
96
+ assert values.ndim >= 2
97
+ output = torch.zeros(
98
+ first_axis_dim, *values.shape[1:], device=values.device, dtype=values.dtype
99
+ )
100
+ output[indices] = values
101
+ return output
102
+
103
+ @staticmethod
104
+ def backward(ctx, grad_output: torch.Tensor) -> Tuple[torch.Tensor, None, None]:
105
+ indices, = ctx.saved_tensors
106
+ grad_values = grad_output[indices]
107
+ return grad_values, None, None
108
+
109
+
110
+ index_put_first_axis = IndexPutFirstAxis.apply
111
+
112
+
113
+ def pad_input(inputs: torch.Tensor, indices: torch.Tensor, batch: int, seqlen: int) -> torch.Tensor:
114
+ """Add padding to sequences.
115
+ Arguments:
116
+ inputs: (total_nnz, ...), where total_nnz = number of tokens in selected in attention_mask.
117
+ indices: (total_nnz), `indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()`
118
+ batch: int batch_size
119
+ seqlen: int max sequence length
120
+ Returns:
121
+ inputs: (batch, seqlen, ...)
122
+ """
123
+ output = index_put_first_axis(inputs, indices, batch * seqlen)
124
+ return output.view(batch, seqlen, *inputs.shape[1:])
125
+
126
+
127
+ def rotate_half(x):
128
+ """Rotates half the hidden dims of the input."""
129
+ x1 = x[..., : x.shape[-1] // 2]
130
+ x2 = x[..., x.shape[-1] // 2 :]
131
+ return torch.cat((-x2, x1), dim=-1)
132
+
133
+
134
+ def apply_rotary_pos_emb(q, k, cos, sin):
135
+ """Applies Rotary Position Embedding to the query and key tensors.
136
+ Args:
137
+ q (`torch.Tensor`): The query tensor.
138
+ k (`torch.Tensor`): The key tensor.
139
+ cos (`torch.Tensor`): The cosine part of the rotary embedding.
140
+ sin (`torch.Tensor`): The sine part of the rotary embedding.
141
+ Returns:
142
+ `tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
143
+ """
144
+ cos, sin = cos.to(q.dtype), sin.to(q.dtype)
145
+ q_embed = (q * cos) + (rotate_half(q) * sin)
146
+ k_embed = (k * cos) + (rotate_half(k) * sin)
147
+ return q_embed, k_embed
148
+
149
+
150
+ class RotaryEmbedding(torch.nn.Module):
151
+ def __init__(self, dim, max_position_embeddings=512, base=10000.0, device=None):
152
+ super().__init__()
153
+
154
+ self.dim = dim
155
+ self.max_position_embeddings = max_position_embeddings
156
+ self.base = base
157
+ inv_freq = 1.0 / (self.base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
158
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
159
+
160
+ self._set_cos_sin_cache(
161
+ seq_len=max_position_embeddings, device=self.inv_freq.device, dtype=torch.get_default_dtype()
162
+ )
163
+
164
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
165
+ self.max_seq_len_cached = seq_len
166
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.float32)
167
+
168
+ freqs = torch.einsum("i,j->ij", t, self.inv_freq)
169
+ emb = torch.cat((freqs, freqs), dim=-1)
170
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
171
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
172
+
173
+ def forward(self, x, seq_len=None):
174
+ if seq_len > self.max_seq_len_cached:
175
+ self._set_cos_sin_cache(seq_len=seq_len, device=x.device, dtype=x.dtype)
176
+
177
+ return (
178
+ self.cos_cached[:seq_len, ...].to(dtype=x.dtype),
179
+ self.sin_cached[:seq_len, ...].to(dtype=x.dtype),
180
+ )
181
+
182
+
183
+ class NTKScalingRotaryEmbedding(RotaryEmbedding):
184
+ """RotaryEmbedding extended with fixed and mixed NTK scaling. https://kexue.fm/archives/9706 """
185
+
186
+ def __init__(self, dim, max_position_embeddings=512, base=10000, device=None, scaling_factor=1.0, mixed_b=None):
187
+ self.scaling_factor = scaling_factor
188
+ self.mixed_b = mixed_b
189
+ super().__init__(dim, max_position_embeddings, base, device)
190
+ max_position_embeddings = max_position_embeddings * self.scaling_factor
191
+ self._set_cos_sin_cache(max_position_embeddings, self.inv_freq.device, torch.get_default_dtype())
192
+
193
+ def _set_cos_sin_cache(self, seq_len, device, dtype):
194
+ self.max_seq_len_cached = seq_len
195
+
196
+ if seq_len > self.max_position_embeddings:
197
+ base = self.base * (self.scaling_factor if self.mixed_b is None else 1)
198
+ inv_freq = 1.0 / (base ** (torch.arange(0, self.dim, 2).float().to(device) / self.dim))
199
+
200
+ if self.mixed_b is None:
201
+ inv_freq = inv_freq / self.scaling_factor ** (2 / self.dim)
202
+ else:
203
+ a = torch.tensor(self.scaling_factor).log() / (self.dim / 2) ** self.mixed_b
204
+ lambda_1_m = (a * torch.arange(1, self.dim // 2 + 1).float().to(device) ** self.mixed_b).exp()
205
+ inv_freq = inv_freq / lambda_1_m
206
+
207
+ self.register_buffer("inv_freq", inv_freq, persistent=False)
208
+
209
+ t = torch.arange(self.max_seq_len_cached, device=device, dtype=torch.float32)
210
+
211
+ freqs = torch.einsum("i,j->ij", t, self.inv_freq)
212
+ emb = torch.cat((freqs, freqs), dim=-1)
213
+ self.register_buffer("cos_cached", emb.cos().to(dtype), persistent=False)
214
+ self.register_buffer("sin_cached", emb.sin().to(dtype), persistent=False)
215
+
216
+
217
+ class RMSNorm(nn.Module):
218
+ def __init__(self, hidden_size, eps=1e-6):
219
+ """
220
+ RMSNorm is equivalent to T5LayerNorm
221
+ """
222
+ super().__init__()
223
+ self.weight = nn.Parameter(torch.ones(hidden_size))
224
+ self.variance_epsilon = eps
225
+
226
+ def forward(self, hidden_states):
227
+ input_dtype = hidden_states.dtype
228
+ hidden_states = hidden_states.to(torch.float32)
229
+ variance = hidden_states.pow(2).mean(-1, keepdim=True)
230
+ hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
231
+ return self.weight * hidden_states.to(input_dtype)
232
+
233
+
234
+ LAYER_NORM = {
235
+ 'layer_norm': nn.LayerNorm,
236
+ 'rms_norm': RMSNorm
237
+ }
238
+
239
+
240
+ class VietnameseEmbeddings(nn.Module):
241
+ """
242
+ Embedding and Unpadding.
243
+ """
244
+
245
+ def __init__(self, config: VietnameseConfig):
246
+ super().__init__()
247
+ self.padding_idx = config.pad_token_id
248
+ self.word_embeddings = nn.Embedding(
249
+ config.vocab_size, config.hidden_size, padding_idx=self.padding_idx
250
+ )
251
+
252
+ self.position_embedding_type = config.position_embedding_type
253
+ if self.position_embedding_type == 'absolute':
254
+ self.position_embeddings = nn.Embedding(
255
+ config.max_position_embeddings, config.hidden_size, padding_idx=self.padding_idx
256
+ )
257
+ elif self.position_embedding_type == 'rope':
258
+ self._init_rope(config)
259
+ else:
260
+ raise ValueError
261
+
262
+ self.type_vocab_size = config.type_vocab_size
263
+ if self.type_vocab_size > 0:
264
+ self.token_type_embeddings = nn.Embedding(config.type_vocab_size, config.hidden_size)
265
+
266
+ self.LayerNorm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
267
+ self.dropout = nn.Dropout(config.hidden_dropout_prob)
268
+ self.register_buffer(
269
+ "position_ids", torch.arange(config.max_position_embeddings), persistent=False
270
+ )
271
+
272
+ def _init_rope(self, config):
273
+ kwargs = dict(
274
+ dim=int(config.hidden_size / config.num_attention_heads),
275
+ max_position_embeddings=config.max_position_embeddings,
276
+ base=config.rope_theta
277
+ )
278
+ if config.rope_scaling is None:
279
+ self.rotary_emb = RotaryEmbedding(**kwargs)
280
+ else:
281
+ kwargs.update(scaling_factor=config.rope_scaling["factor"])
282
+ scaling_type = config.rope_scaling["type"]
283
+ if scaling_type == 'ntk':
284
+ kwargs.update(mixed_b=config.rope_scaling.get('mixed_b', None))
285
+ self.rotary_emb = NTKScalingRotaryEmbedding(**kwargs)
286
+ else:
287
+ raise ValueError(f"Unknown RoPE scaling type {scaling_type}")
288
+
289
+ def forward(
290
+ self,
291
+ unpad_inputs: bool,
292
+ input_ids: Optional[torch.Tensor] = None,
293
+ attention_mask: Optional[torch.Tensor] = None,
294
+ length: Optional[List[int]] = None,
295
+ token_type_ids: Optional[torch.Tensor] = None,
296
+ position_ids: Optional[torch.Tensor] = None,
297
+ inputs_embeds: Optional[torch.Tensor] = None,
298
+ ) -> Tuple[torch.Tensor, torch.Tensor, Optional[Tuple], Optional[List[int]]]:
299
+ if inputs_embeds is None:
300
+ device, input_shape = input_ids.device, input_ids.shape
301
+ else:
302
+ device, input_shape = inputs_embeds.device, inputs_embeds.shape[:2]
303
+ batch_size, seq_length = input_shape
304
+
305
+ if attention_mask is None:
306
+ attention_mask = torch.ones(input_shape, device=device)
307
+ if length is not None:
308
+ for i, l in enumerate(length):
309
+ attention_mask[i, l:] = 0
310
+
311
+ if unpad_inputs:
312
+ attention_mask_bool = attention_mask.bool()
313
+ if length is None:
314
+ length = attention_mask.sum(-1).tolist()
315
+
316
+ if inputs_embeds is None:
317
+ if unpad_inputs:
318
+ input_ids = input_ids[attention_mask_bool].unsqueeze(0)
319
+ inputs_embeds = self.word_embeddings(input_ids)
320
+ else:
321
+ if unpad_inputs:
322
+ inputs_embeds = inputs_embeds[attention_mask_bool].unsqueeze(0)
323
+ embeddings = inputs_embeds
324
+
325
+ if position_ids is None:
326
+ if seq_length > self.position_ids.size(0):
327
+ self.register_buffer(
328
+ "position_ids", torch.arange(seq_length, device=embeddings.device), persistent=False
329
+ )
330
+ if unpad_inputs:
331
+ position_ids = torch.cat([self.position_ids[:l] for l in length]).unsqueeze(0)
332
+ else:
333
+ position_ids = self.position_ids[:seq_length].expand(batch_size, -1)
334
+ elif unpad_inputs:
335
+ position_ids = position_ids[attention_mask_bool].unsqueeze(0)
336
+
337
+ if self.position_embedding_type == 'rope':
338
+ rope_cos, rope_sin = self.rotary_emb(inputs_embeds, seq_len=seq_length)
339
+ rope_cos = rope_cos[position_ids].unsqueeze(2)
340
+ rope_sin = rope_sin[position_ids].unsqueeze(2)
341
+ rope_embeds = rope_cos, rope_sin
342
+ else:
343
+ rope_embeds = None
344
+
345
+ if self.type_vocab_size > 0:
346
+ if token_type_ids is None:
347
+ token_type_ids = position_ids.mul(0)
348
+ else:
349
+ if self.type_vocab_size < 2:
350
+ token_type_ids.mul_(0)
351
+ if unpad_inputs:
352
+ token_type_ids = token_type_ids[attention_mask_bool].unsqueeze(0)
353
+
354
+ token_type_embeddings = self.token_type_embeddings(token_type_ids)
355
+ embeddings = embeddings + token_type_embeddings
356
+
357
+ if self.position_embedding_type == "absolute":
358
+ position_embeddings = self.position_embeddings(position_ids)
359
+ embeddings = embeddings + position_embeddings
360
+
361
+ embeddings = self.LayerNorm(embeddings)
362
+ embeddings = self.dropout(embeddings)
363
+
364
+ return embeddings, attention_mask, rope_embeds, length
365
+
366
+
367
+ class VietnameseAttention(nn.Module):
368
+ def __init__(self, config: VietnameseConfig, pack_qkv=None, use_memory_efficient_attention=None):
369
+ super().__init__()
370
+ self.config = config
371
+ if config.hidden_size % config.num_attention_heads != 0 and not hasattr(config, "embedding_size"):
372
+ raise ValueError(
373
+ f"The hidden size ({config.hidden_size}) is not a multiple of the number of attention "
374
+ f"heads ({config.num_attention_heads})"
375
+ )
376
+
377
+ self.hidden_size = config.hidden_size
378
+ self.num_attention_heads = config.num_attention_heads
379
+ self.attention_head_size = int(config.hidden_size / config.num_attention_heads)
380
+ self.all_head_size = self.num_attention_heads * self.attention_head_size
381
+
382
+ if pack_qkv is None:
383
+ pack_qkv = config.pack_qkv
384
+ self.pack_qkv = pack_qkv
385
+
386
+ if self.pack_qkv:
387
+ self.qkv_proj = nn.Linear(config.hidden_size, self.all_head_size * 3, bias=True)
388
+ else:
389
+ self.q_proj = nn.Linear(config.hidden_size, self.all_head_size, bias=True)
390
+ self.k_proj = nn.Linear(config.hidden_size, self.all_head_size, bias=True)
391
+ self.v_proj = nn.Linear(config.hidden_size, self.all_head_size, bias=True)
392
+
393
+ self.dropout = nn.Dropout(config.attention_probs_dropout_prob)
394
+ self.o_proj = nn.Linear(config.hidden_size, config.hidden_size, bias=True)
395
+
396
+ if use_memory_efficient_attention is None:
397
+ use_memory_efficient_attention = self.config.use_memory_efficient_attention
398
+ self.use_memory_efficient_attention = use_memory_efficient_attention
399
+ self.memory_efficient_attention = None if xops is None else xops.memory_efficient_attention
400
+ if self.use_memory_efficient_attention:
401
+ assert self.memory_efficient_attention is not None, 'please install xformers'
402
+
403
+ def forward(
404
+ self,
405
+ hidden_states: torch.Tensor,
406
+ attention_bias: torch.FloatTensor,
407
+ rope_embeds: Optional[Tuple[torch.FloatTensor, torch.FloatTensor]] = None,
408
+ padding_inputs: Optional[Tuple] = None,
409
+ attention_scale: Optional[torch.FloatTensor] = None,
410
+ head_mask: Optional[torch.FloatTensor] = None,
411
+ output_attentions: Optional[bool] = False,
412
+ qkv_inputs: Optional[Tuple] = None,
413
+ ) -> Tuple[torch.Tensor, ...]:
414
+ shape_hd = (self.num_attention_heads, self.attention_head_size)
415
+ if self.pack_qkv and qkv_inputs is None:
416
+ qkv_pack = self.qkv_proj(hidden_states).split(self.all_head_size, dim=-1)
417
+ else:
418
+ if qkv_inputs is None:
419
+ qkv_inputs = (hidden_states, hidden_states, hidden_states)
420
+ qkv_pack = [
421
+ getattr(self, n + '_proj')(s) for s, n in zip(qkv_inputs, 'qkv')
422
+ ]
423
+ query_states, key_states, value_states = [t.view(t.shape[:-1] + shape_hd) for t in qkv_pack]
424
+
425
+ if self.config.position_embedding_type == 'rope':
426
+ query_states, key_states = apply_rotary_pos_emb(query_states, key_states, *rope_embeds)
427
+
428
+ dtype = query_states.dtype
429
+
430
+ if self.config.logn_attention_scale and attention_scale is not None:
431
+ query_states = query_states * attention_scale.to(dtype)
432
+
433
+ if padding_inputs is not None:
434
+ query_states = pad_input(query_states.squeeze(), *padding_inputs)
435
+ key_states = pad_input(key_states.squeeze(), *padding_inputs)
436
+ value_states = pad_input(value_states.squeeze(), *padding_inputs)
437
+
438
+ if self.use_memory_efficient_attention:
439
+ assert self.memory_efficient_attention is not None, "xformers is not loaded"
440
+ assert output_attentions is False, "memory_efficient_attention do not output attentions"
441
+ assert head_mask is None, "Not support yet"
442
+ attention_probs = None
443
+ if torch.is_tensor(attention_bias):
444
+ attention_bias = attention_bias.to(dtype)
445
+ context_layer = self.memory_efficient_attention(
446
+ query_states,
447
+ key_states,
448
+ value_states,
449
+ attn_bias=attention_bias,
450
+ p=self.dropout.p
451
+ )
452
+ else:
453
+ if output_attentions and isinstance(self, VietnameseSdpaAttention):
454
+ raise RuntimeError("SDPA do not output attentions")
455
+ context_layer, attention_probs = self._attention(
456
+ query_states, key_states, value_states, attention_bias, head_mask
457
+ )
458
+
459
+ if padding_inputs is not None:
460
+ context_layer = unpad_input(context_layer, indices=padding_inputs[0])
461
+
462
+ new_context_layer_shape = context_layer.size()[:-2] + (self.all_head_size,)
463
+ context_layer = context_layer.view(new_context_layer_shape)
464
+
465
+ attn_output = self.o_proj(context_layer)
466
+
467
+ outputs = (attn_output, attention_probs) if output_attentions else (attn_output,)
468
+ return outputs
469
+
470
+ def _attention(self, query_states, key_states, value_states, attention_bias, head_mask):
471
+ query_states = query_states.transpose(1, 2)
472
+ key_states = key_states.transpose(1, 2)
473
+ value_states = value_states.transpose(1, 2)
474
+ attention_scores = torch.matmul(query_states, key_states.transpose(-1, -2))
475
+
476
+ attention_scores = attention_scores / math.sqrt(self.attention_head_size)
477
+ if attention_bias is not None:
478
+ attention_scores = attention_scores + attention_bias
479
+
480
+ attention_probs = nn.functional.softmax(attention_scores, dim=-1)
481
+
482
+ if self.dropout.p > 0:
483
+ attention_probs = self.dropout(attention_probs)
484
+
485
+ if head_mask is not None:
486
+ attention_probs = attention_probs * head_mask
487
+
488
+ context_layer = torch.matmul(attention_probs, value_states)
489
+
490
+ context_layer = context_layer.permute(0, 2, 1, 3).contiguous()
491
+ return context_layer, attention_probs
492
+
493
+
494
+ class VietnameseSdpaAttention(VietnameseAttention):
495
+ """
496
+ Vietnamese attention module using torch.nn.functional.scaled_dot_product_attention. This module inherits from
497
+ `VietnameseAttention` as the weights of the module stays untouched. The only changes are on the forward pass to adapt to
498
+ SDPA API.
499
+ """
500
+ def __init__(self, config: VietnameseConfig, **kwargs):
501
+ super().__init__(config, **kwargs)
502
+
503
+ def _attention(self, query_states, key_states, value_states, attention_bias, head_mask):
504
+ attn_output = torch.nn.functional.scaled_dot_product_attention(
505
+ query_states.transpose(1, 2),
506
+ key_states.transpose(1, 2),
507
+ value_states.transpose(1, 2),
508
+ attn_mask=attention_bias,
509
+ dropout_p=self.dropout.p if self.training else 0.0,
510
+ )
511
+ attn_output = attn_output.permute(0, 2, 1, 3).contiguous()
512
+ return attn_output, None
513
+
514
+
515
+ Vietnamese_ATTENTION_CLASSES = {
516
+ "eager": VietnameseAttention,
517
+ "sdpa": VietnameseSdpaAttention,
518
+ }
519
+
520
+
521
+ class VietnameseGatedMLP(nn.Module):
522
+ """
523
+ GLU Variants Improve Transformer.
524
+ """
525
+
526
+ def __init__(self, config: VietnameseConfig):
527
+ super().__init__()
528
+ self.intermediate_size = config.intermediate_size
529
+ self.up_gate_proj = nn.Linear(config.hidden_size, self.intermediate_size * 2, bias=False)
530
+ self.down_proj = nn.Linear(self.intermediate_size, config.hidden_size, bias=True)
531
+ self.act_fn = ACT2FN[config.hidden_act]
532
+ if config.hidden_dropout_prob > 0:
533
+ self.hidden_dropout = nn.Dropout(config.hidden_dropout_prob)
534
+ else:
535
+ self.hidden_dropout = None
536
+
537
+ def forward(self, hidden_states):
538
+ up_gate = self.up_gate_proj(hidden_states)
539
+ up_states, gate = torch.split(up_gate, self.intermediate_size, dim=-1)
540
+ gate = self.act_fn(gate)
541
+ gated_states = gate * up_states
542
+ if self.hidden_dropout is not None:
543
+ gated_states = self.hidden_dropout(gated_states)
544
+ down_states = self.down_proj(gated_states)
545
+ return down_states
546
+
547
+
548
+ class VietnameseLayer(nn.Module):
549
+ def __init__(
550
+ self,
551
+ config: VietnameseConfig,
552
+ pack_qkv=None,
553
+ use_memory_efficient_attention=None,
554
+ attn_implementation=None
555
+ ):
556
+ super().__init__()
557
+ if attn_implementation is None:
558
+ attn_implementation = config._attn_implementation
559
+ if use_memory_efficient_attention is None:
560
+ use_memory_efficient_attention = config.use_memory_efficient_attention
561
+ if use_memory_efficient_attention:
562
+ if attn_implementation != 'eager':
563
+ logger.warning_once(f"Override {attn_implementation=} to 'eager' as {use_memory_efficient_attention=}")
564
+ attn_implementation = 'eager'
565
+ self.attention = Vietnamese_ATTENTION_CLASSES[attn_implementation](
566
+ config, pack_qkv=pack_qkv, use_memory_efficient_attention=use_memory_efficient_attention
567
+ )
568
+ self.mlp = VietnameseGatedMLP(config)
569
+
570
+ ln_class = LAYER_NORM[config.layer_norm_type]
571
+ self.attn_ln = ln_class(config.hidden_size, eps=config.layer_norm_eps)
572
+ self.mlp_ln = ln_class(config.hidden_size, eps=config.layer_norm_eps)
573
+
574
+ if config.hidden_dropout_prob > 0:
575
+ self.hidden_dropout = nn.Dropout(config.hidden_dropout_prob)
576
+ else:
577
+ self.hidden_dropout = None
578
+
579
+ def forward(
580
+ self,
581
+ hidden_states: torch.Tensor,
582
+ attention_bias: torch.FloatTensor,
583
+ rope_embeds: Optional[Tuple[torch.FloatTensor, torch.FloatTensor]] = None,
584
+ padding_inputs: Optional[Tuple] = None,
585
+ attention_scale: Optional[torch.FloatTensor] = None,
586
+ subset_indices: Optional[torch.LongTensor] = None,
587
+ head_mask: Optional[torch.FloatTensor] = None,
588
+ output_attentions: Optional[bool] = False,
589
+ qkv_inputs: Optional[Tuple] = None,
590
+ ) -> Tuple[torch.Tensor, ...]:
591
+ residual = hidden_states if qkv_inputs is None else qkv_inputs[0]
592
+ attention_outputs = self.attention(
593
+ hidden_states,
594
+ attention_bias,
595
+ rope_embeds,
596
+ padding_inputs,
597
+ attention_scale,
598
+ head_mask,
599
+ output_attentions=output_attentions,
600
+ qkv_inputs=qkv_inputs,
601
+ )
602
+ hidden_states = attention_outputs[0]
603
+ if self.hidden_dropout is not None:
604
+ hidden_states = self.hidden_dropout(hidden_states)
605
+ hidden_states = residual + hidden_states
606
+
607
+ if subset_indices is not None:
608
+ hidden_states = hidden_states[subset_indices]
609
+
610
+ hidden_states = self.attn_ln(hidden_states)
611
+
612
+ residual = hidden_states
613
+ hidden_states = self.mlp(hidden_states)
614
+ if self.hidden_dropout is not None:
615
+ hidden_states = self.hidden_dropout(hidden_states)
616
+ hidden_states = residual + hidden_states
617
+ hidden_states = self.mlp_ln(hidden_states)
618
+
619
+ outputs = (hidden_states,) + attention_outputs[1:]
620
+ return outputs
621
+
622
+
623
+ class VietnameseEncoder(nn.Module):
624
+ def __init__(self, config):
625
+ super().__init__()
626
+ self.config = config
627
+ self.layer = nn.ModuleList([VietnameseLayer(config) for _ in range(config.num_hidden_layers)])
628
+ self.gradient_checkpointing = False
629
+
630
+ def forward(
631
+ self,
632
+ hidden_states: torch.Tensor,
633
+ attention_bias: Optional[torch.FloatTensor] = None,
634
+ rope_embeds: Optional[Tuple[torch.FloatTensor, torch.FloatTensor]] = None,
635
+ padding_inputs: Optional[Tuple] = None,
636
+ attention_scale: Optional[torch.FloatTensor] = None,
637
+ subset_indices: Optional[torch.LongTensor] = None,
638
+ head_mask: Optional[torch.FloatTensor] = None,
639
+ output_attentions: Optional[bool] = False,
640
+ output_hidden_states: Optional[bool] = False,
641
+ return_dict: Optional[bool] = True,
642
+ ) -> Union[Tuple[torch.Tensor], BaseModelOutput]:
643
+ all_hidden_states = () if output_hidden_states else None
644
+ all_self_attentions = () if output_attentions else None
645
+
646
+ for i, layer_module in enumerate(self.layer):
647
+ if output_hidden_states:
648
+ all_hidden_states = all_hidden_states + (hidden_states,)
649
+
650
+ if i >= len(self.layer) - 1:
651
+ layer_subset_indices = subset_indices
652
+ else:
653
+ layer_subset_indices = None
654
+
655
+ layer_head_mask = head_mask[i] if head_mask is not None else None
656
+
657
+ if self.gradient_checkpointing and self.training:
658
+ layer_outputs = self._gradient_checkpointing_func(
659
+ layer_module.__call__,
660
+ hidden_states,
661
+ attention_bias,
662
+ rope_embeds,
663
+ padding_inputs,
664
+ attention_scale,
665
+ layer_subset_indices,
666
+ layer_head_mask,
667
+ )
668
+ else:
669
+ layer_outputs = layer_module(
670
+ hidden_states,
671
+ attention_bias,
672
+ rope_embeds,
673
+ padding_inputs,
674
+ attention_scale,
675
+ layer_subset_indices,
676
+ layer_head_mask,
677
+ output_attentions,
678
+ )
679
+
680
+ hidden_states = layer_outputs[0]
681
+ if output_attentions:
682
+ all_self_attentions = all_self_attentions + (layer_outputs[1],)
683
+
684
+ if output_hidden_states:
685
+ all_hidden_states = all_hidden_states + (hidden_states,)
686
+
687
+ if not return_dict:
688
+ return tuple(
689
+ v
690
+ for v in [
691
+ hidden_states,
692
+ all_hidden_states,
693
+ all_self_attentions,
694
+ ]
695
+ if v is not None
696
+ )
697
+ return BaseModelOutput(
698
+ last_hidden_state=hidden_states,
699
+ hidden_states=all_hidden_states,
700
+ attentions=all_self_attentions,
701
+ )
702
+
703
+
704
+ class VietnamesePooler(nn.Module):
705
+ def __init__(self, config):
706
+ super().__init__()
707
+ self.dense = nn.Linear(config.hidden_size, config.hidden_size)
708
+ self.activation = nn.Tanh()
709
+
710
+ def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
711
+ first_token_tensor = hidden_states[:, 0]
712
+ pooled_output = self.dense(first_token_tensor)
713
+ pooled_output = self.activation(pooled_output)
714
+ return pooled_output
715
+
716
+
717
+ class VietnamesePreTrainedModel(PreTrainedModel):
718
+ """
719
+ An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
720
+ models.
721
+ """
722
+
723
+ config_class = VietnameseConfig
724
+ base_model_prefix = "Vietnamese"
725
+ supports_gradient_checkpointing = True
726
+ _supports_sdpa = True
727
+
728
+ def _init_weights(self, module):
729
+ """Initialize the weights"""
730
+ if isinstance(module, nn.Linear):
731
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
732
+ if module.bias is not None:
733
+ module.bias.data.zero_()
734
+ elif isinstance(module, nn.Embedding):
735
+ module.weight.data.normal_(mean=0.0, std=self.config.initializer_range)
736
+ if module.padding_idx is not None:
737
+ module.weight.data[module.padding_idx].zero_()
738
+ elif isinstance(module, nn.LayerNorm):
739
+ module.bias.data.zero_()
740
+ module.weight.data.fill_(1.0)
741
+
742
+
743
+ class VietnameseModel(VietnamesePreTrainedModel):
744
+ """
745
+ The bare Vietnamese Model transformer outputting raw hidden-states without any specific head on top.
746
+ """
747
+
748
+ def __init__(self, config: VietnameseConfig, add_pooling_layer=False):
749
+ super().__init__(config)
750
+ self.config = config
751
+
752
+ self.embeddings = VietnameseEmbeddings(config)
753
+ self.encoder = VietnameseEncoder(config)
754
+
755
+ self.pooler = VietnamesePooler(config) if add_pooling_layer else None
756
+
757
+ self.post_init()
758
+
759
+ def get_input_embeddings(self):
760
+ return self.embeddings.word_embeddings
761
+
762
+ def set_input_embeddings(self, value):
763
+ self.embeddings.word_embeddings = value
764
+
765
+ def forward(
766
+ self,
767
+ input_ids: Optional[torch.Tensor] = None,
768
+ attention_mask: Optional[torch.Tensor] = None,
769
+ length: Optional[List[int]] = None,
770
+ subset_indices: Optional[torch.LongTensor] = None,
771
+ token_type_ids: Optional[torch.Tensor] = None,
772
+ position_ids: Optional[torch.Tensor] = None,
773
+ head_mask: Optional[torch.Tensor] = None,
774
+ inputs_embeds: Optional[torch.Tensor] = None,
775
+ output_attentions: Optional[bool] = None,
776
+ output_hidden_states: Optional[bool] = None,
777
+ return_dict: Optional[bool] = None,
778
+ unpad_inputs: Optional[bool] = None,
779
+ ) -> Union[Tuple[torch.Tensor], BaseModelOutputWithPooling]:
780
+ r"""
781
+ length (`list` of length `batch_size`, *optional*):
782
+ If is `None`, return padded `last_hidden_state`.
783
+ subset_indices ():
784
+ pass
785
+ unpad_inputs (`bool`, *optional*):
786
+ pass
787
+ """
788
+ output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
789
+ output_hidden_states = (
790
+ output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
791
+ )
792
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
793
+ unpad_inputs = unpad_inputs if unpad_inputs is not None else self.config.unpad_inputs
794
+ output_padded = length is None
795
+
796
+ if input_ids is not None and inputs_embeds is not None:
797
+ raise ValueError("You cannot specify both input_ids and inputs_embeds at the same time")
798
+ elif input_ids is not None:
799
+ self.warn_if_padding_and_no_attention_mask(input_ids, attention_mask)
800
+ input_shape = input_ids.size()
801
+ elif inputs_embeds is not None:
802
+ input_shape = inputs_embeds.size()[:-1]
803
+ else:
804
+ raise ValueError("You have to specify either input_ids or inputs_embeds")
805
+
806
+ (embedding_output, attention_mask, rope_embeds, length) = self.embeddings(
807
+ unpad_inputs,
808
+ input_ids=input_ids,
809
+ attention_mask=attention_mask,
810
+ length=length,
811
+ token_type_ids=token_type_ids,
812
+ position_ids=position_ids,
813
+ inputs_embeds=inputs_embeds
814
+ )
815
+
816
+ batch_size, seq_length = input_shape
817
+ if unpad_inputs and self.config.use_memory_efficient_attention:
818
+ attention_bias = xops.fmha.attn_bias.BlockDiagonalMask.from_seqlens(length)
819
+ else:
820
+ attention_bias = self.get_extended_attention_mask(attention_mask, input_shape)
821
+ if self.config.use_memory_efficient_attention:
822
+ attention_bias = attention_bias.expand(-1, self.config.num_attention_heads, seq_length, -1)
823
+
824
+ padding_inputs = None
825
+ if unpad_inputs and (output_padded or not self.config.use_memory_efficient_attention):
826
+ indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
827
+ if not self.config.use_memory_efficient_attention:
828
+ padding_inputs = (indices, *input_shape)
829
+
830
+ attention_scale = None
831
+ if self.config.logn_attention_scale:
832
+ logger.warning_once("TODO: logn_attention_scale")
833
+
834
+ encoder_outputs = self.encoder(
835
+ embedding_output,
836
+ attention_bias=attention_bias,
837
+ rope_embeds=rope_embeds,
838
+ padding_inputs=padding_inputs,
839
+ attention_scale=attention_scale,
840
+ subset_indices=subset_indices,
841
+ head_mask=head_mask,
842
+ output_attentions=output_attentions,
843
+ output_hidden_states=output_hidden_states,
844
+ return_dict=return_dict,
845
+ )
846
+ sequence_output = encoder_outputs[0]
847
+ if unpad_inputs and output_padded:
848
+ sequence_output = pad_input(
849
+ sequence_output.squeeze(), indices, batch_size, seq_length
850
+ )
851
+
852
+ pooled_output = self.pooler(sequence_output) if self.pooler is not None else None
853
+
854
+ if not return_dict:
855
+ return (sequence_output, pooled_output) + encoder_outputs[1:]
856
+
857
+ return BaseModelOutputWithPooling(
858
+ last_hidden_state=sequence_output,
859
+ pooler_output=pooled_output,
860
+ hidden_states=encoder_outputs.hidden_states,
861
+ attentions=encoder_outputs.attentions,
862
+ )
863
+
864
+
865
+ class VietnameseLMPredictionHead(nn.Module):
866
+ def __init__(self, config):
867
+ super().__init__()
868
+ self.dense = nn.Linear(config.hidden_size, config.hidden_size)
869
+ self.transform_act_fn = ACT2FN[config.hidden_act]
870
+ self.norm = nn.LayerNorm(config.hidden_size, eps=config.layer_norm_eps)
871
+
872
+ self.decoder = nn.Linear(config.hidden_size, config.vocab_size)
873
+
874
+ def forward(self, hidden_states):
875
+ hidden_states = self.dense(hidden_states)
876
+ hidden_states = self.transform_act_fn(hidden_states)
877
+ hidden_states = self.norm(hidden_states)
878
+ hidden_states = self.decoder(hidden_states)
879
+ return hidden_states
880
+
881
+
882
+ class VietnameseForMaskedLM(VietnamesePreTrainedModel):
883
+ _tied_weights_keys = ["lm_head.decoder.bias", "lm_head.decoder.weight"]
884
+
885
+ def __init__(self, config: VietnameseConfig):
886
+ super().__init__(config)
887
+ self.Vietnamese = VietnameseModel(config, add_pooling_layer=False)
888
+ self.lm_head = VietnameseLMPredictionHead(config)
889
+ self.loss_fct = nn.CrossEntropyLoss()
890
+
891
+ self.post_init()
892
+
893
+ def get_output_embeddings(self):
894
+ return self.lm_head.decoder
895
+
896
+ def set_output_embeddings(self, new_embeddings):
897
+ self.lm_head.decoder = new_embeddings
898
+
899
+ def forward(
900
+ self,
901
+ input_ids: Optional[torch.Tensor] = None,
902
+ attention_mask: Optional[torch.Tensor] = None,
903
+ token_type_ids: Optional[torch.Tensor] = None,
904
+ position_ids: Optional[torch.Tensor] = None,
905
+ head_mask: Optional[torch.Tensor] = None,
906
+ inputs_embeds: Optional[torch.Tensor] = None,
907
+ labels: Optional[torch.Tensor] = None,
908
+ output_attentions: Optional[bool] = None,
909
+ output_hidden_states: Optional[bool] = None,
910
+ return_dict: Optional[bool] = None,
911
+ unpad_inputs: Optional[bool] = None,
912
+ ) -> Union[Tuple[torch.Tensor], MaskedLMOutput]:
913
+ r"""
914
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
915
+ Labels for computing the masked language modeling loss. Indices should be in `[-100, 0, ...,
916
+ config.vocab_size]` (see `input_ids` docstring) Tokens with indices set to `-100` are ignored (masked), the
917
+ loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`
918
+ """
919
+
920
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
921
+
922
+ if labels is None or not self.Vietnamese.config.unpad_inputs:
923
+ length = None
924
+ subset_indices = None
925
+ else:
926
+ length = attention_mask.sum(-1).tolist()
927
+ labels = labels[attention_mask.bool()].unsqueeze(0)
928
+ subset_indices = labels > -100
929
+
930
+ outputs = self.Vietnamese(
931
+ input_ids,
932
+ attention_mask=attention_mask,
933
+ length=length,
934
+ subset_indices=subset_indices,
935
+ token_type_ids=token_type_ids,
936
+ position_ids=position_ids,
937
+ head_mask=head_mask,
938
+ inputs_embeds=inputs_embeds,
939
+ output_attentions=output_attentions,
940
+ output_hidden_states=output_hidden_states,
941
+ return_dict=return_dict,
942
+ unpad_inputs=unpad_inputs,
943
+ )
944
+
945
+ sequence_output = outputs[0]
946
+ prediction_scores = self.lm_head(sequence_output)
947
+
948
+ masked_lm_loss = None
949
+ if labels is not None:
950
+ if subset_indices is None:
951
+ mask = attention_mask.bool()
952
+ prediction_scores = prediction_scores[mask]
953
+ labels = labels[mask]
954
+ else:
955
+ labels = labels[subset_indices]
956
+ masked_lm_loss = self.loss_fct(prediction_scores, labels)
957
+
958
+ if not return_dict:
959
+ output = (prediction_scores,) + outputs[2:]
960
+ return ((masked_lm_loss,) + output) if masked_lm_loss is not None else output
961
+
962
+ return MaskedLMOutput(
963
+ loss=masked_lm_loss,
964
+ logits=prediction_scores,
965
+ hidden_states=outputs.hidden_states,
966
+ attentions=outputs.attentions,
967
+ )
968
+
969
+
970
+ class VietnameseForSequenceClassification(VietnamesePreTrainedModel):
971
+ def __init__(self, config):
972
+ super().__init__(config)
973
+ self.num_labels = config.num_labels
974
+ self.config = config
975
+
976
+ self.Vietnamese = VietnameseModel(config, add_pooling_layer=True)
977
+ classifier_dropout = (
978
+ config.classifier_dropout if config.classifier_dropout is not None else config.hidden_dropout_prob
979
+ )
980
+ self.dropout = nn.Dropout(classifier_dropout)
981
+ self.classifier = nn.Linear(config.hidden_size, config.num_labels)
982
+
983
+ self.post_init()
984
+
985
+ def forward(
986
+ self,
987
+ input_ids: Optional[torch.Tensor] = None,
988
+ attention_mask: Optional[torch.Tensor] = None,
989
+ token_type_ids: Optional[torch.Tensor] = None,
990
+ position_ids: Optional[torch.Tensor] = None,
991
+ head_mask: Optional[torch.Tensor] = None,
992
+ inputs_embeds: Optional[torch.Tensor] = None,
993
+ labels: Optional[torch.Tensor] = None,
994
+ output_attentions: Optional[bool] = None,
995
+ output_hidden_states: Optional[bool] = None,
996
+ return_dict: Optional[bool] = None,
997
+ unpad_inputs: Optional[bool] = None,
998
+ ) -> Union[Tuple[torch.Tensor], SequenceClassifierOutput]:
999
+ r"""
1000
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1001
+ Labels for computing the sequence classification/regression loss. Indices should be in `[0, ...,
1002
+ config.num_labels - 1]`. If `config.num_labels == 1` a regression loss is computed (Mean-Square loss), If
1003
+ `config.num_labels > 1` a classification loss is computed (Cross-Entropy).
1004
+ """
1005
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1006
+
1007
+ outputs = self.Vietnamese(
1008
+ input_ids,
1009
+ attention_mask=attention_mask,
1010
+ token_type_ids=token_type_ids,
1011
+ position_ids=position_ids,
1012
+ head_mask=head_mask,
1013
+ inputs_embeds=inputs_embeds,
1014
+ output_attentions=output_attentions,
1015
+ output_hidden_states=output_hidden_states,
1016
+ return_dict=return_dict,
1017
+ unpad_inputs=unpad_inputs,
1018
+ )
1019
+
1020
+ pooled_output = outputs[1]
1021
+
1022
+ pooled_output = self.dropout(pooled_output)
1023
+ logits = self.classifier(pooled_output)
1024
+
1025
+ loss = None
1026
+ if labels is not None:
1027
+ if self.config.problem_type is None:
1028
+ if self.num_labels == 1:
1029
+ self.config.problem_type = "regression"
1030
+ elif self.num_labels > 1 and (labels.dtype == torch.long or labels.dtype == torch.int):
1031
+ self.config.problem_type = "single_label_classification"
1032
+ else:
1033
+ self.config.problem_type = "multi_label_classification"
1034
+
1035
+ if self.config.problem_type == "regression":
1036
+ loss_fct = nn.MSELoss()
1037
+ if self.num_labels == 1:
1038
+ loss = loss_fct(logits.squeeze(), labels.squeeze())
1039
+ else:
1040
+ loss = loss_fct(logits, labels)
1041
+ elif self.config.problem_type == "single_label_classification":
1042
+ loss_fct = nn.CrossEntropyLoss()
1043
+ loss = loss_fct(logits.view(-1, self.num_labels), labels.view(-1))
1044
+ elif self.config.problem_type == "multi_label_classification":
1045
+ loss_fct = nn.BCEWithLogitsLoss()
1046
+ loss = loss_fct(logits, labels)
1047
+
1048
+ if not return_dict:
1049
+ output = (logits,) + outputs[2:]
1050
+ return ((loss,) + output) if loss is not None else output
1051
+
1052
+ return SequenceClassifierOutput(
1053
+ loss=loss,
1054
+ logits=logits,
1055
+ hidden_states=outputs.hidden_states,
1056
+ attentions=outputs.attentions,
1057
+ )
1058
+
1059
+
1060
+ class VietnameseForMultipleChoice(VietnamesePreTrainedModel):
1061
+ def __init__(self, config):
1062
+ super().__init__(config)
1063
+
1064
+ self.Vietnamese = VietnameseModel(config, add_pooling_layer=True)
1065
+ classifier_dropout = (
1066
+ config.classifier_dropout if config.classifier_dropout is not None else config.hidden_dropout_prob
1067
+ )
1068
+ self.dropout = nn.Dropout(classifier_dropout)
1069
+ self.classifier = nn.Linear(config.hidden_size, 1)
1070
+
1071
+ self.post_init()
1072
+
1073
+ def forward(
1074
+ self,
1075
+ input_ids: Optional[torch.Tensor] = None,
1076
+ attention_mask: Optional[torch.Tensor] = None,
1077
+ token_type_ids: Optional[torch.Tensor] = None,
1078
+ position_ids: Optional[torch.Tensor] = None,
1079
+ head_mask: Optional[torch.Tensor] = None,
1080
+ inputs_embeds: Optional[torch.Tensor] = None,
1081
+ labels: Optional[torch.Tensor] = None,
1082
+ output_attentions: Optional[bool] = None,
1083
+ output_hidden_states: Optional[bool] = None,
1084
+ return_dict: Optional[bool] = None,
1085
+ unpad_inputs: Optional[bool] = None,
1086
+ ) -> Union[Tuple[torch.Tensor], MultipleChoiceModelOutput]:
1087
+ r"""
1088
+ labels (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1089
+ Labels for computing the multiple choice classification loss. Indices should be in `[0, ...,
1090
+ num_choices-1]` where `num_choices` is the size of the second dimension of the input tensors. (See
1091
+ `input_ids` above)
1092
+ """
1093
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1094
+ num_choices = input_ids.shape[1] if input_ids is not None else inputs_embeds.shape[1]
1095
+
1096
+ input_ids = input_ids.view(-1, input_ids.size(-1)) if input_ids is not None else None
1097
+ attention_mask = attention_mask.view(-1, attention_mask.size(-1)) if attention_mask is not None else None
1098
+ token_type_ids = token_type_ids.view(-1, token_type_ids.size(-1)) if token_type_ids is not None else None
1099
+ position_ids = position_ids.view(-1, position_ids.size(-1)) if position_ids is not None else None
1100
+ inputs_embeds = (
1101
+ inputs_embeds.view(-1, inputs_embeds.size(-2), inputs_embeds.size(-1))
1102
+ if inputs_embeds is not None
1103
+ else None
1104
+ )
1105
+
1106
+ outputs = self.Vietnamese(
1107
+ input_ids,
1108
+ attention_mask=attention_mask,
1109
+ token_type_ids=token_type_ids,
1110
+ position_ids=position_ids,
1111
+ head_mask=head_mask,
1112
+ inputs_embeds=inputs_embeds,
1113
+ output_attentions=output_attentions,
1114
+ output_hidden_states=output_hidden_states,
1115
+ return_dict=return_dict,
1116
+ unpad_inputs=unpad_inputs,
1117
+ )
1118
+
1119
+ pooled_output = outputs[1]
1120
+
1121
+ pooled_output = self.dropout(pooled_output)
1122
+ logits = self.classifier(pooled_output)
1123
+ reshaped_logits = logits.view(-1, num_choices)
1124
+
1125
+ loss = None
1126
+ if labels is not None:
1127
+ loss_fct = nn.CrossEntropyLoss()
1128
+ loss = loss_fct(reshaped_logits, labels)
1129
+
1130
+ if not return_dict:
1131
+ output = (reshaped_logits,) + outputs[2:]
1132
+ return ((loss,) + output) if loss is not None else output
1133
+
1134
+ return MultipleChoiceModelOutput(
1135
+ loss=loss,
1136
+ logits=reshaped_logits,
1137
+ hidden_states=outputs.hidden_states,
1138
+ attentions=outputs.attentions,
1139
+ )
1140
+
1141
+
1142
+ @dataclass
1143
+ class VietnameseTokenClassifierOutput(ModelOutput):
1144
+ loss: Optional[torch.FloatTensor] = None
1145
+ logits: torch.FloatTensor = None
1146
+ last_hidden_state: torch.FloatTensor = None
1147
+ hidden_states: Optional[Tuple[torch.FloatTensor, ...]] = None
1148
+ attentions: Optional[Tuple[torch.FloatTensor, ...]] = None
1149
+
1150
+
1151
+ class VietnameseForTokenClassification(VietnamesePreTrainedModel):
1152
+ def __init__(self, config):
1153
+ super().__init__(config)
1154
+ self.num_labels = config.num_labels
1155
+
1156
+ self.Vietnamese = VietnameseModel(config, add_pooling_layer=False)
1157
+ classifier_dropout = (
1158
+ config.classifier_dropout if config.classifier_dropout is not None else config.hidden_dropout_prob
1159
+ )
1160
+ self.dropout = nn.Dropout(classifier_dropout)
1161
+ self.classifier = nn.Linear(config.hidden_size, config.num_labels)
1162
+
1163
+ self.post_init()
1164
+
1165
+ def forward(
1166
+ self,
1167
+ input_ids: Optional[torch.Tensor] = None,
1168
+ attention_mask: Optional[torch.Tensor] = None,
1169
+ token_type_ids: Optional[torch.Tensor] = None,
1170
+ position_ids: Optional[torch.Tensor] = None,
1171
+ head_mask: Optional[torch.Tensor] = None,
1172
+ inputs_embeds: Optional[torch.Tensor] = None,
1173
+ labels: Optional[torch.Tensor] = None,
1174
+ output_attentions: Optional[bool] = None,
1175
+ output_hidden_states: Optional[bool] = None,
1176
+ return_dict: Optional[bool] = None,
1177
+ unpad_inputs: Optional[bool] = None,
1178
+ ) -> Union[Tuple[torch.Tensor], VietnameseTokenClassifierOutput]:
1179
+ r"""
1180
+ labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
1181
+ Labels for computing the token classification loss. Indices should be in `[0, ..., config.num_labels - 1]`.
1182
+ """
1183
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1184
+
1185
+ outputs = self.Vietnamese(
1186
+ input_ids,
1187
+ attention_mask=attention_mask,
1188
+ token_type_ids=token_type_ids,
1189
+ position_ids=position_ids,
1190
+ head_mask=head_mask,
1191
+ inputs_embeds=inputs_embeds,
1192
+ output_attentions=output_attentions,
1193
+ output_hidden_states=output_hidden_states,
1194
+ return_dict=return_dict,
1195
+ unpad_inputs=unpad_inputs,
1196
+ )
1197
+
1198
+ sequence_output = outputs[0]
1199
+
1200
+ sequence_output = self.dropout(sequence_output)
1201
+ logits = self.classifier(sequence_output)
1202
+
1203
+ loss = None
1204
+ if labels is not None:
1205
+ loss_fct = nn.CrossEntropyLoss()
1206
+ loss = loss_fct(logits.view(-1, self.num_labels), labels.view(-1))
1207
+
1208
+ if not return_dict:
1209
+ output = (logits,) + outputs[2:]
1210
+ return ((loss,) + output) if loss is not None else output
1211
+
1212
+ return VietnameseTokenClassifierOutput(
1213
+ loss=loss,
1214
+ logits=logits,
1215
+ last_hidden_state=sequence_output,
1216
+ hidden_states=outputs.hidden_states,
1217
+ attentions=outputs.attentions,
1218
+ )
1219
+
1220
+
1221
+ class VietnameseForQuestionAnswering(VietnamesePreTrainedModel):
1222
+ def __init__(self, config):
1223
+ super().__init__(config)
1224
+ self.num_labels = config.num_labels
1225
+
1226
+ self.Vietnamese = VietnameseModel(config, add_pooling_layer=False)
1227
+ self.qa_outputs = nn.Linear(config.hidden_size, config.num_labels)
1228
+
1229
+ self.post_init()
1230
+
1231
+ def forward(
1232
+ self,
1233
+ input_ids: Optional[torch.Tensor] = None,
1234
+ attention_mask: Optional[torch.Tensor] = None,
1235
+ token_type_ids: Optional[torch.Tensor] = None,
1236
+ position_ids: Optional[torch.Tensor] = None,
1237
+ head_mask: Optional[torch.Tensor] = None,
1238
+ inputs_embeds: Optional[torch.Tensor] = None,
1239
+ start_positions: Optional[torch.Tensor] = None,
1240
+ end_positions: Optional[torch.Tensor] = None,
1241
+ output_attentions: Optional[bool] = None,
1242
+ output_hidden_states: Optional[bool] = None,
1243
+ return_dict: Optional[bool] = None,
1244
+ unpad_inputs: Optional[bool] = None,
1245
+ ) -> Union[Tuple[torch.Tensor], QuestionAnsweringModelOutput]:
1246
+ r"""
1247
+ start_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1248
+ Labels for position (index) of the start of the labelled span for computing the token classification loss.
1249
+ Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
1250
+ are not taken into account for computing the loss.
1251
+ end_positions (`torch.LongTensor` of shape `(batch_size,)`, *optional*):
1252
+ Labels for position (index) of the end of the labelled span for computing the token classification loss.
1253
+ Positions are clamped to the length of the sequence (`sequence_length`). Position outside of the sequence
1254
+ are not taken into account for computing the loss.
1255
+ """
1256
+ return_dict = return_dict if return_dict is not None else self.config.use_return_dict
1257
+
1258
+ outputs = self.Vietnamese(
1259
+ input_ids,
1260
+ attention_mask=attention_mask,
1261
+ token_type_ids=token_type_ids,
1262
+ position_ids=position_ids,
1263
+ head_mask=head_mask,
1264
+ inputs_embeds=inputs_embeds,
1265
+ output_attentions=output_attentions,
1266
+ output_hidden_states=output_hidden_states,
1267
+ return_dict=return_dict,
1268
+ unpad_inputs=unpad_inputs,
1269
+ )
1270
+
1271
+ sequence_output = outputs[0]
1272
+
1273
+ logits = self.qa_outputs(sequence_output)
1274
+ start_logits, end_logits = logits.split(1, dim=-1)
1275
+ start_logits = start_logits.squeeze(-1).contiguous()
1276
+ end_logits = end_logits.squeeze(-1).contiguous()
1277
+
1278
+ total_loss = None
1279
+ if start_positions is not None and end_positions is not None:
1280
+ if len(start_positions.size()) > 1:
1281
+ start_positions = start_positions.squeeze(-1)
1282
+ if len(end_positions.size()) > 1:
1283
+ end_positions = end_positions.squeeze(-1)
1284
+ ignored_index = start_logits.size(1)
1285
+ start_positions = start_positions.clamp(0, ignored_index)
1286
+ end_positions = end_positions.clamp(0, ignored_index)
1287
+
1288
+ loss_fct = nn.CrossEntropyLoss(ignore_index=ignored_index)
1289
+ start_loss = loss_fct(start_logits, start_positions)
1290
+ end_loss = loss_fct(end_logits, end_positions)
1291
+ total_loss = (start_loss + end_loss) / 2
1292
+
1293
+ if not return_dict:
1294
+ output = (start_logits, end_logits) + outputs[2:]
1295
+ return ((total_loss,) + output) if total_loss is not None else output
1296
+
1297
+ return QuestionAnsweringModelOutput(
1298
+ loss=total_loss,
1299
+ start_logits=start_logits,
1300
+ end_logits=end_logits,
1301
+ hidden_states=outputs.hidden_states,
1302
+ attentions=outputs.attentions,
1303
+ )
1304
+
1305
+
1306
+
1307
+
1308
+ def create_position_ids_from_input_ids(input_ids, padding_idx, past_key_values_length=0):
1309
+ """
1310
+ Replace non-padding symbols with their position numbers. Position numbers begin at padding_idx+1. Padding symbols
1311
+ are ignored. This is modified from fairseq's `utils.make_positions`.
1312
+ Args:
1313
+ x: torch.Tensor x:
1314
+ Returns: torch.Tensor
1315
+ """
1316
+ # The series of casts and type-conversions here are carefully balanced to both work with ONNX export and XLA.
1317
+ mask = input_ids.ne(padding_idx).int()
1318
+ incremental_indices = (torch.cumsum(mask, dim=1).type_as(mask) + past_key_values_length) * mask
1319
+ return incremental_indices.long() + padding_idx
modules.json ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {
15
+ "idx": 2,
16
+ "name": "2",
17
+ "path": "2_Normalize",
18
+ "type": "sentence_transformers.models.Normalize"
19
+ }
20
+ ]
sentence_bert_config.json ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ {
2
+ "max_seq_length": 8192,
3
+ "do_lower_case": false
4
+ }
special_tokens_map.json ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "cls_token": {
10
+ "content": "<s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "eos_token": {
17
+ "content": "</s>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "mask_token": {
24
+ "content": "<mask>",
25
+ "lstrip": true,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ },
30
+ "pad_token": {
31
+ "content": "<pad>",
32
+ "lstrip": false,
33
+ "normalized": false,
34
+ "rstrip": false,
35
+ "single_word": false
36
+ },
37
+ "sep_token": {
38
+ "content": "</s>",
39
+ "lstrip": false,
40
+ "normalized": false,
41
+ "rstrip": false,
42
+ "single_word": false
43
+ },
44
+ "unk_token": {
45
+ "content": "<unk>",
46
+ "lstrip": false,
47
+ "normalized": false,
48
+ "rstrip": false,
49
+ "single_word": false
50
+ }
51
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:aa7a6ad87a7ce8fe196787355f6af7d03aee94d19c54a5eb1392ed18c8ef451a
3
+ size 17082988
tokenizer_config.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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": true,
46
+ "cls_token": "<s>",
47
+ "eos_token": "</s>",
48
+ "extra_special_tokens": {},
49
+ "mask_token": "<mask>",
50
+ "max_length": 8192,
51
+ "model_max_length": 8192,
52
+ "pad_to_multiple_of": null,
53
+ "pad_token": "<pad>",
54
+ "pad_token_type_id": 0,
55
+ "padding_side": "right",
56
+ "sep_token": "</s>",
57
+ "stride": 0,
58
+ "tokenizer_class": "XLMRobertaTokenizerFast",
59
+ "truncation_side": "right",
60
+ "truncation_strategy": "longest_first",
61
+ "unk_token": "<unk>"
62
+ }