Edit model card

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

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, and negative
  • 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, and negative
  • 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: steps
  • gradient_accumulation_steps: 4
  • learning_rate: 1.08e-08
  • weight_decay: 0.1
  • num_train_epochs: 1
  • warmup_steps: 500
  • fp16: True
  • remove_unused_columns: False

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: steps
  • prediction_loss_only: True
  • per_device_train_batch_size: 8
  • per_device_eval_batch_size: 8
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 4
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 1.08e-08
  • weight_decay: 0.1
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1.0
  • num_train_epochs: 1
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.0
  • warmup_steps: 500
  • log_level: passive
  • log_level_replica: warning
  • log_on_each_node: True
  • logging_nan_inf_filter: True
  • save_safetensors: True
  • save_on_each_node: False
  • save_only_model: False
  • restore_callback_states_from_checkpoint: False
  • no_cuda: False
  • use_cpu: False
  • use_mps_device: False
  • seed: 42
  • data_seed: None
  • jit_mode_eval: False
  • use_ipex: False
  • bf16: False
  • fp16: True
  • fp16_opt_level: O1
  • half_precision_backend: auto
  • bf16_full_eval: False
  • fp16_full_eval: False
  • tf32: None
  • local_rank: 0
  • ddp_backend: None
  • tpu_num_cores: None
  • tpu_metrics_debug: False
  • debug: []
  • dataloader_drop_last: False
  • dataloader_num_workers: 0
  • dataloader_prefetch_factor: None
  • past_index: -1
  • disable_tqdm: False
  • remove_unused_columns: False
  • label_names: None
  • load_best_model_at_end: False
  • ignore_data_skip: False
  • fsdp: []
  • fsdp_min_num_params: 0
  • fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
  • fsdp_transformer_layer_cls_to_wrap: None
  • accelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch
  • optim_args: None
  • adafactor: False
  • group_by_length: False
  • length_column_name: length
  • ddp_find_unused_parameters: None
  • ddp_bucket_cap_mb: None
  • ddp_broadcast_buffers: False
  • dataloader_pin_memory: True
  • dataloader_persistent_workers: False
  • skip_memory_metrics: True
  • use_legacy_prediction_loop: False
  • push_to_hub: False
  • resume_from_checkpoint: None
  • hub_model_id: None
  • hub_strategy: every_save
  • hub_private_repo: False
  • hub_always_push: False
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • eval_do_concat_batches: True
  • fp16_backend: auto
  • push_to_hub_model_id: None
  • push_to_hub_organization: None
  • mp_parameters:
  • auto_find_batch_size: False
  • full_determinism: False
  • torchdynamo: None
  • ray_scope: last
  • ddp_timeout: 1800
  • torch_compile: False
  • torch_compile_backend: None
  • torch_compile_mode: None
  • dispatch_batches: None
  • split_batches: None
  • include_tokens_per_second: False
  • include_num_input_tokens_seen: False
  • neftune_noise_alpha: None
  • optim_target_modules: None
  • batch_eval_metrics: False
  • eval_on_start: False
  • eval_use_gather_object: False
  • batch_sampler: batch_sampler
  • multi_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
0
Safetensors
Model size
568M params
Tensor type
F32
·
Inference Examples
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

Finetuned
(1)
this model
Finetunes
1 model