SentenceTransformer based on strongpear/M3-retriever-Vi-Text2SQL
This is a sentence-transformers model finetuned from strongpear/M3-retriever-Vi-Text2SQL. It maps sentences & paragraphs to a 1024-dimensional dense vector space and can be used for semantic textual similarity, semantic search, paraphrase mining, text classification, clustering, and more.
Model Details
Model Description
- Model Type: Sentence Transformer
- Base model: strongpear/M3-retriever-Vi-Text2SQL
- Maximum Sequence Length: 8192 tokens
- Output Dimensionality: 1024 tokens
- Similarity Function: Cosine Similarity
Model Sources
- Documentation: Sentence Transformers Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Sentence Transformers on Hugging Face
Full Model Architecture
SentenceTransformer(
(0): Transformer({'max_seq_length': 8192, 'do_lower_case': False}) with Transformer model: XLMRobertaModel
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)
Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import SentenceTransformer
# Download from the 🤗 Hub
model = SentenceTransformer("strongpear/M3-retriever-Vi-Text2SQL_ver2")
# Run inference
sentences = [
"Năm 2011 là bao nhiêu khi năm 2009 là 'MỘT'?",
'CREATE TABLE table 61807("Giải đấu" text,"2009" text,"2010" text,"2011" text,"2012" text)',
'CREATE TABLE table name 27(điểm VARCHAR,đội khách VARCHAR,date VARCHAR)',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 1024]
# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities.shape)
# [3, 3]
Training Details
Training Dataset
Unnamed Dataset
- Size: 1,312,839 training samples
- Columns:
anchor
,positive
, andnegative
- Approximate statistics based on the first 1000 samples:
anchor positive negative type string string string details - min: 6 tokens
- mean: 22.66 tokens
- max: 323 tokens
- min: 12 tokens
- mean: 56.47 tokens
- max: 159 tokens
- min: 11 tokens
- mean: 41.05 tokens
- max: 621 tokens
- Samples:
anchor positive negative Chủ đề StackOverflow vào tháng 5 năm 2010. Sẽ thật tuyệt nếu có một biểu đồ, tôi biết :)
CREATE TABLE Bài viết(Id number,PostTypeId number,AcceptedAnswerId number,ParentId number,CreationDate time,DeletionDate time,Score number,ViewCount number,Nội dung text,OwnerUserId number,OwnerDisplayName text,LastEditorUserId number,LastEditorDisplayName text,LastEditDate time,LastActivityDate time,Title text,Tags text,AnswerCount number,CommentCount number,FavoriteCount number,ClosedDate time,CommunityOwnedDate time,ContentLince text);
CREATE TABLE PostTypes(Id number,Name text)
sao2 của bệnh nhân 31854 trong lần khám tại bệnh viện hiện tại có bình thường không?
CREATE TABLE icustays(row id number,subject id number,hadm id number,icustay id number,first careunit text,last careunit text,first wardid number,last wardid number,intime time,outtime time);
CREATE TABLE inputevents cv(row id number,subject id number,hadm id number,icustay id number,charttime time,itemid number,amount number)
chuyến bay nào từ PITTSBURGH đến ATLANTA vào sáng thứ Tư phục vụ BỮA SÁNG
CREATE TABLE sân bay(airport code varchar,airport name text,airport location text,state code varchar,country name varchar,time zone code varchar,minimum connect time int);
CREATE TABLE máy bay(aircraft code varchar,aircraft description varchar,nhà sản xuất varchar,basic type varchar,engines int,động cơ varchar,thân rộng varchar,sải cánh int,chiều dài int,trọng lượng int,công suất int,tải trả int,tốc độ bay int,phạm vi dặm int,có áp suất varchar)
- Loss:
TripletLoss
with these parameters:{ "distance_metric": "TripletDistanceMetric.EUCLIDEAN", "triplet_margin": 5 }
Evaluation Dataset
Unnamed Dataset
- Size: 69,098 evaluation samples
- Columns:
anchor
,positive
, andnegative
- Approximate statistics based on the first 1000 samples:
anchor positive negative type string string string details - min: 8 tokens
- mean: 23.11 tokens
- max: 323 tokens
- min: 7 tokens
- mean: 57.77 tokens
- max: 181 tokens
- min: 12 tokens
- mean: 42.41 tokens
- max: 207 tokens
- Samples:
anchor positive negative Đã bao nhiêu ngày kể từ lần cuối bệnh nhân 1561 nhận được một lượng lactate ringer trong lần thăm khám tại phòng chăm sóc đặc biệt hiện tại?
CREATE TABLE inputevents cv(row id number,subject id number,hadm id number,icustay id number,charttime time,itemid number,amount number);
CREATE TABLE d icd diagnoses(row id number,icd9 code text,short title text,tiêu đề dài text)
Có nhiều giáo sư dạy ECON 631 trong kỳ Xuân Hè 2003 không?
CREATE TABLE giảng viên(instructor id int,name varchar,tên uniq varchar);
CREATE TABLE học kỳ(semester id int,semester varchar,year int)
bệnh nhân 011-55642 có được chẩn đoán mắc bệnh gì trong lần khám tại bệnh viện hiện tại không?
CREATE TABLE bệnh nhân(uniquepid text,bệnh nhânhealthsystemstayid number,bệnh nhân đơn vị ở lạiid number,giới tính text,tuổi text,dân tộc text,bệnh viện number,khu bệnh number,chiều cao nhập viện number,cân nặng nhập viện number,cân nặng xuất viện number,thời gian nhập viện time,nguồn nhập viện text,thời gian nhập viện đơn vị time,thời gian nhập viện time,thời gian xuất viện time,trạng thái xuất viện text)
CREATE TABLE inputoutput(intakeoutputid number,Patientunitstayid number,cellpath text,celllabel text,cellvaluenumeric number,intakeoutputtime time)
- Loss:
TripletLoss
with these parameters:{ "distance_metric": "TripletDistanceMetric.EUCLIDEAN", "triplet_margin": 5 }
Training Hyperparameters
Non-Default Hyperparameters
eval_strategy
: stepsgradient_accumulation_steps
: 4learning_rate
: 1.08e-08weight_decay
: 0.1num_train_epochs
: 1warmup_steps
: 500fp16
: Trueremove_unused_columns
: False
All Hyperparameters
Click to expand
overwrite_output_dir
: Falsedo_predict
: Falseeval_strategy
: stepsprediction_loss_only
: Trueper_device_train_batch_size
: 8per_device_eval_batch_size
: 8per_gpu_train_batch_size
: Noneper_gpu_eval_batch_size
: Nonegradient_accumulation_steps
: 4eval_accumulation_steps
: Nonetorch_empty_cache_steps
: Nonelearning_rate
: 1.08e-08weight_decay
: 0.1adam_beta1
: 0.9adam_beta2
: 0.999adam_epsilon
: 1e-08max_grad_norm
: 1.0num_train_epochs
: 1max_steps
: -1lr_scheduler_type
: linearlr_scheduler_kwargs
: {}warmup_ratio
: 0.0warmup_steps
: 500log_level
: passivelog_level_replica
: warninglog_on_each_node
: Truelogging_nan_inf_filter
: Truesave_safetensors
: Truesave_on_each_node
: Falsesave_only_model
: Falserestore_callback_states_from_checkpoint
: Falseno_cuda
: Falseuse_cpu
: Falseuse_mps_device
: Falseseed
: 42data_seed
: Nonejit_mode_eval
: Falseuse_ipex
: Falsebf16
: Falsefp16
: Truefp16_opt_level
: O1half_precision_backend
: autobf16_full_eval
: Falsefp16_full_eval
: Falsetf32
: Nonelocal_rank
: 0ddp_backend
: Nonetpu_num_cores
: Nonetpu_metrics_debug
: Falsedebug
: []dataloader_drop_last
: Falsedataloader_num_workers
: 0dataloader_prefetch_factor
: Nonepast_index
: -1disable_tqdm
: Falseremove_unused_columns
: Falselabel_names
: Noneload_best_model_at_end
: Falseignore_data_skip
: Falsefsdp
: []fsdp_min_num_params
: 0fsdp_config
: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap
: Noneaccelerator_config
: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed
: Nonelabel_smoothing_factor
: 0.0optim
: adamw_torchoptim_args
: Noneadafactor
: Falsegroup_by_length
: Falselength_column_name
: lengthddp_find_unused_parameters
: Noneddp_bucket_cap_mb
: Noneddp_broadcast_buffers
: Falsedataloader_pin_memory
: Truedataloader_persistent_workers
: Falseskip_memory_metrics
: Trueuse_legacy_prediction_loop
: Falsepush_to_hub
: Falseresume_from_checkpoint
: Nonehub_model_id
: Nonehub_strategy
: every_savehub_private_repo
: Falsehub_always_push
: Falsegradient_checkpointing
: Falsegradient_checkpointing_kwargs
: Noneinclude_inputs_for_metrics
: Falseeval_do_concat_batches
: Truefp16_backend
: autopush_to_hub_model_id
: Nonepush_to_hub_organization
: Nonemp_parameters
:auto_find_batch_size
: Falsefull_determinism
: Falsetorchdynamo
: Noneray_scope
: lastddp_timeout
: 1800torch_compile
: Falsetorch_compile_backend
: Nonetorch_compile_mode
: Nonedispatch_batches
: Nonesplit_batches
: Noneinclude_tokens_per_second
: Falseinclude_num_input_tokens_seen
: Falseneftune_noise_alpha
: Noneoptim_target_modules
: Nonebatch_eval_metrics
: Falseeval_on_start
: Falseeval_use_gather_object
: Falsebatch_sampler
: batch_samplermulti_dataset_batch_sampler
: proportional
Training Logs
Epoch | Step | Training Loss | loss |
---|---|---|---|
0.0244 | 1000 | 0.0334 | 0.0444 |
0.0487 | 2000 | 0.0284 | 0.0444 |
0.0731 | 3000 | 0.0304 | 0.0444 |
0.0975 | 4000 | 0.0244 | 0.0444 |
0.1219 | 5000 | 0.0276 | 0.0444 |
0.1462 | 6000 | 0.0286 | 0.0444 |
0.1706 | 7000 | 0.0276 | 0.0444 |
0.1950 | 8000 | 0.0252 | 0.0444 |
0.2194 | 9000 | 0.0267 | 0.0444 |
0.2437 | 10000 | 0.0258 | 0.0444 |
0.2681 | 11000 | 0.0216 | 0.0444 |
0.2925 | 12000 | 0.0224 | 0.0444 |
0.3169 | 13000 | 0.0209 | 0.0443 |
0.3412 | 14000 | 0.0211 | 0.0443 |
0.3656 | 15000 | 0.0221 | 0.0443 |
0.3900 | 16000 | 0.0183 | 0.0443 |
0.4144 | 17000 | 0.0207 | 0.0443 |
0.4387 | 18000 | 0.0175 | 0.0443 |
0.4631 | 19000 | 0.0192 | 0.0443 |
0.4875 | 20000 | 0.016 | 0.0443 |
0.5119 | 21000 | 0.0208 | 0.0443 |
0.5362 | 22000 | 0.0165 | 0.0443 |
0.5606 | 23000 | 0.016 | 0.0443 |
0.5850 | 24000 | 0.0141 | 0.0443 |
0.6094 | 25000 | 0.0185 | 0.0443 |
0.6337 | 26000 | 0.0143 | 0.0443 |
0.6581 | 27000 | 0.0175 | 0.0443 |
0.6825 | 28000 | 0.0155 | 0.0443 |
0.7069 | 29000 | 0.0172 | 0.0443 |
0.7312 | 30000 | 0.0174 | 0.0443 |
0.7556 | 31000 | 0.0185 | 0.0443 |
0.7800 | 32000 | 0.0166 | 0.0443 |
0.8044 | 33000 | 0.0171 | 0.0443 |
0.8287 | 34000 | 0.018 | 0.0443 |
0.8531 | 35000 | 0.0194 | 0.0443 |
0.8775 | 36000 | 0.0228 | 0.0443 |
0.9019 | 37000 | 0.0239 | 0.0443 |
0.9262 | 38000 | 0.0262 | 0.0443 |
0.9506 | 39000 | 0.0313 | 0.0443 |
0.9750 | 40000 | 0.0314 | 0.0443 |
0.9994 | 41000 | 0.0461 | 0.0443 |
Framework Versions
- Python: 3.9.19
- Sentence Transformers: 3.0.1
- Transformers: 4.44.2
- PyTorch: 2.4.0+cu121
- Accelerate: 0.34.2
- Datasets: 2.21.0
- Tokenizers: 0.19.1
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}
TripletLoss
@misc{hermans2017defense,
title={In Defense of the Triplet Loss for Person Re-Identification},
author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
year={2017},
eprint={1703.07737},
archivePrefix={arXiv},
primaryClass={cs.CV}
}
- Downloads last month
- 23
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social
visibility and check back later, or deploy to Inference Endpoints (dedicated)
instead.
Model tree for strongpear/M3-retriever-Vi-Text2SQL_ver2
Base model
strongpear/M3-retriever-Vi-Text2SQL