bird-qa-model / README.md
Nicolas-Spettel's picture
Add new SentenceTransformer model
32b138f verified
metadata
tags:
  - sentence-transformers
  - sentence-similarity
  - feature-extraction
  - dense
  - generated_from_trainer
  - dataset_size:268
  - loss:MultipleNegativesRankingLoss
base_model: sentence-transformers/all-MiniLM-L6-v2
widget:
  - source_sentence: Birdwatching for Beginners with Barbara Hannah Grufferman
    sentences:
      - >-
        Bird that breeds in the Arctic and sub-Arctic and migrates to the
        Antarctic
      - >-
        [birds chirping] [Discover Bird-Watching

        with Barbara Hannah Grufferman] [ music and birds chirping ] We are in
        the park and I'm meeting up

        with Birder Bob, who's an expert on birding. >> It's so nice to meet
        you.

        >> Yes. So, listen. I came prepared.

        I have my backpack. >> I even have a little notepad in there.

        >> All right. >> But what am I missing?

        >> Ah! Binoculars. >> May I place these over your head?

        >> Please do! Thank you. [laughing]

        Let's go! Vamos! So birding is becoming

        the fastest-growing outdoor activity— ["Birding Bob" DeCandido,
        Ornithologist]

        >> Yes.

        >> —in the country. >> Why do you think that is? Why?

        >> Well, you can watch birds from inside looking outside

        at a bird feeder in your backyard, but you can also go to a local park.
        [ music ]

        Here we are in this giant woodland in the middle of the city. >> And
        it's beautiful.

        >> Yeah. And we're getting the clean air. We're looking up.

        We can see birds up there. >> We can hear the cardinals singing.

        >> Here's one. They're migrating north along a flyway here. >> What's a
        flyway?

        >> Oh my goodness! A flyway is like an aerial path for birds, and
        oftentimes it's tied to a coastline

        or a mountain chain. So there are some very common birds around

        that are easy to recognize. Here he is.

        Here's your red-bellied woodpecker right here. I'm going to use my
        binoculars.

        [laughing] Ah! It seems to me that with birding you could just—depending
        upon weather— put on a sweater, a jacket, whatever and get out there and
        walk and look

        and you'll be birding. >> Yes.

        >> Is it more complicated than that? Do I need more equipment? If you
        want to take it to the next level,

        a pair of inexpensive binoculars and a book so you have a reference to
        go with. It's like a guidebook to birds. Yes, because this is your
        classroom, you know? >> Right.

        >> And if you can teach yourself, all the best way in the world to
        learn. [ music ] I'm going to do some special sounds. This is called
        pishing, which is

        [demonstrating pishing] There comes somebody on the left. Now, it seems
        counterintuitive

        that you make sounds and birds come to the sound. >> Yes.

        >> But birds come in because they operate as a team. [demonstrating
        pishing]

        What a wonderful thing! Yes, yeah.

        [pishing] >> Look, here comes something.

        >> You never know what you're going to find

        as you turn a corner. And all you need

        is your eyes and ears and curiosity. Should I go closer? [birds
        chirping] Oh!

        [bird chirping] Hello, little cutie! [birds chirping] They like my chia
        energy bars.

        [laughing] [ music and birds chirping ] [ music and birds chirping ]
        This is such a great way to get outside,

        move your body, and be with nature. Bird-watching is a great way

        to see the local area and then take it national. I loved my birding
        experience today. It’s—a new world

        has been opened up for me really. So I think as of today

        I can call myself an official birder. [AARP, Real Possibilities]
      - >-
        Teal is a dark cyan color. Its name comes from that of a bird, the
        Eurasian teal which has a similarly colored stripe on its head. The word
        is often used colloquially to refer to shades of cyan in general.
  - source_sentence: Corn bunting
    sentences:
      - >-
        The corn bunting is a passerine bird in the bunting family Emberizidae,
        a group now separated by most modern authors from the finches,
        Fringillidae. This is a large bunting with heavily streaked buff-brown
        plumage. The sexes are similar but the male is slightly larger than the
        female. Its range extends from Western Europe and North Africa across to
        northwestern China.
      - >-
        The alpine swift is a species of swift found in Africa, southern Europe,
        and Asia. They breed in mountains from southern Europe to the Himalayas.
        Like common swifts, they are migratory; the southern European population
        winters further south in southern Africa. They have very short legs
        which are used for clinging to vertical surfaces. Like most swifts, they
        never settle voluntarily on the ground, spending most of their lives in
        the air living on the insects they catch in their beaks.
      - >-
        The little tern is a seabird of the family Laridae. It was first
        described by the German naturalist Peter Simon Pallas in 1764 and given
        the binomial name Sterna albifrons. It was moved to the genus Sternula
        when the genus Sterna was restricted to the larger typical terns. The
        genus name Sternula is a diminutive of Sterna, 'tern', while the
        specific name albifrons is from Latin albus, 'white', and frons,
        'forehead'.
  - source_sentence: Lesser spotted woodpecker
    sentences:
      - >-
        The Mediterranean gull is a small gull. The scientific name is from
        Ancient Greek. The genus Ichthyaetus is from ikhthus, "fish", and aetos,
        "eagle", and the specific melanocephalus is from melas, "black", and
        -kephalos "-headed".
      - >-
        The spotted flycatcher is a small passerine bird in the Old World
        flycatcher family. It breeds in most of Europe and in the Palearctic to
        Siberia, and is migratory, wintering in Africa and south western Asia.
        It is declining in parts of its range.
      - >-
        The lesser spotted woodpecker is a member of the woodpecker family
        Picidae. It was formerly assigned to the genus Dendrocopos. Some
        taxonomic authorities continue to list the species there.
  - source_sentence: Barnacle goose
    sentences:
      - >-
        The short-toed treecreeper is a small passerine bird found in woodlands
        through much of the warmer regions of Europe and into north Africa. It
        has a generally more southerly distribution than the other European
        treecreeper species, the common treecreeper, with which it is easily
        confused where they both occur. The short-toed treecreeper tends to
        prefer deciduous trees and lower altitudes than its relative in these
        overlap areas. Although mainly sedentary, vagrants have occurred outside
        the breeding range.
      - >-
        The barnacle goose is a species of goose that belongs to the genus
        Branta of black geese, which contains species with extensive black in
        the plumage, distinguishing them from the grey Anser species. Despite
        its superficial similarity to the brant goose, genetic analysis has
        shown its closest relative is the cackling goose.
      - >-
        The grey plover or black-bellied plover is a large plover breeding in
        Arctic regions. It is a long-distance migrant, with a nearly worldwide
        coastal distribution when not breeding.
  - source_sentence: White stork
    sentences:
      - >-
        The long-tailed duck is a medium-sized sea duck that breeds in the
        tundra and taiga regions of the arctic and winters along the northern
        coastlines of the Atlantic and Pacific Oceans. It is the only member of
        the genus Clangula.
      - "The white stork is a large bird in the stork family, Ciconiidae. Its plumage is mainly white, with black on the bird's wings. Adults have long red legs and long pointed red beaks, and measure on average 100–115\_cm (39–45\_in) from beak tip to end of tail, with a 155–215\_cm (61–85\_in) wingspan. The two subspecies, which differ slightly in size, breed in Europe north to Finland, northwestern Africa, Palearctic east to southern Kazakhstan and southern Africa. The white stork is a long-distance migrant, wintering in Africa from tropical Sub-Saharan Africa to as far south as South Africa, or on the Indian subcontinent. When migrating between Europe and Africa, it avoids crossing the Mediterranean Sea and detours via the Levant in the east or the Strait of Gibraltar in the west, because the air thermals on which it depends for soaring do not form over water."
      - >-
        The shovelers are four species of dabbling ducks in the genus Spatula
        with long, broad spatula-shaped beaks:Red shoveler Spatula platalea

        Cape shoveler Spatula smithii

        Australasian shoveler Spatula rhynchotis

        Northern shoveler Spatula clypeata
pipeline_tag: sentence-similarity
library_name: sentence-transformers

SentenceTransformer based on sentence-transformers/all-MiniLM-L6-v2

This is a sentence-transformers model finetuned from sentence-transformers/all-MiniLM-L6-v2. It maps sentences & paragraphs to a 384-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: sentence-transformers/all-MiniLM-L6-v2
  • Maximum Sequence Length: 256 tokens
  • Output Dimensionality: 384 dimensions
  • Similarity Function: Cosine Similarity

Model Sources

Full Model Architecture

SentenceTransformer(
  (0): Transformer({'max_seq_length': 256, 'do_lower_case': False, 'architecture': 'BertModel'})
  (1): Pooling({'word_embedding_dimension': 384, '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})
  (2): Normalize()
)

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("Nicolas-Spettel/bird-qa-model")
# Run inference
sentences = [
    'White stork',
    "The white stork is a large bird in the stork family, Ciconiidae. Its plumage is mainly white, with black on the bird's wings. Adults have long red legs and long pointed red beaks, and measure on average 100–115\xa0cm (39–45\xa0in) from beak tip to end of tail, with a 155–215\xa0cm (61–85\xa0in) wingspan. The two subspecies, which differ slightly in size, breed in Europe north to Finland, northwestern Africa, Palearctic east to southern Kazakhstan and southern Africa. The white stork is a long-distance migrant, wintering in Africa from tropical Sub-Saharan Africa to as far south as South Africa, or on the Indian subcontinent. When migrating between Europe and Africa, it avoids crossing the Mediterranean Sea and detours via the Levant in the east or the Strait of Gibraltar in the west, because the air thermals on which it depends for soaring do not form over water.",
    'The long-tailed duck is a medium-sized sea duck that breeds in the tundra and taiga regions of the arctic and winters along the northern coastlines of the Atlantic and Pacific Oceans. It is the only member of the genus Clangula.',
]
embeddings = model.encode(sentences)
print(embeddings.shape)
# [3, 384]

# Get the similarity scores for the embeddings
similarities = model.similarity(embeddings, embeddings)
print(similarities)
# tensor([[1.0000, 0.7092, 0.0837],
#         [0.7092, 1.0000, 0.1957],
#         [0.0837, 0.1957, 1.0000]])

Training Details

Training Dataset

Unnamed Dataset

  • Size: 268 training samples
  • Columns: sentence_0 and sentence_1
  • Approximate statistics based on the first 268 samples:
    sentence_0 sentence_1
    type string string
    details
    • min: 3 tokens
    • mean: 5.63 tokens
    • max: 16 tokens
    • min: 15 tokens
    • mean: 94.23 tokens
    • max: 256 tokens
  • Samples:
    sentence_0 sentence_1
    Corn bunting The corn bunting is a passerine bird in the bunting family Emberizidae, a group now separated by most modern authors from the finches, Fringillidae. This is a large bunting with heavily streaked buff-brown plumage. The sexes are similar but the male is slightly larger than the female. Its range extends from Western Europe and North Africa across to northwestern China.
    Water pipit The water pipit is a small passerine bird which breeds in the mountains of Southern Europe and the Palearctic eastwards to China. It is a short-distance migrant; many birds move to lower altitudes or wet open lowlands in winter.
    Marsh tit The marsh tit is a Eurasian passerine bird in the tit family Paridae and genus Poecile, closely related to the willow tit, Père David's and Songar tits. It is a small bird, around 12 cm (4.7 in) long and weighing 12 g (0.42 oz), with a black crown and nape, pale cheeks, brown back and greyish-brown wings and tail. Between 8 and 11 subspecies are recognised. Its close resemblance to the willow tit can cause identification problems, especially in the United Kingdom where the local subspecies of the two are very similar: they were not recognised as separate species until 1897.
  • Loss: MultipleNegativesRankingLoss with these parameters:
    {
        "scale": 20.0,
        "similarity_fct": "cos_sim",
        "gather_across_devices": false
    }
    

Training Hyperparameters

Non-Default Hyperparameters

  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • num_train_epochs: 2
  • multi_dataset_batch_sampler: round_robin

All Hyperparameters

Click to expand
  • overwrite_output_dir: False
  • do_predict: False
  • eval_strategy: no
  • prediction_loss_only: True
  • per_device_train_batch_size: 32
  • per_device_eval_batch_size: 32
  • per_gpu_train_batch_size: None
  • per_gpu_eval_batch_size: None
  • gradient_accumulation_steps: 1
  • eval_accumulation_steps: None
  • torch_empty_cache_steps: None
  • learning_rate: 5e-05
  • weight_decay: 0.0
  • adam_beta1: 0.9
  • adam_beta2: 0.999
  • adam_epsilon: 1e-08
  • max_grad_norm: 1
  • num_train_epochs: 2
  • max_steps: -1
  • lr_scheduler_type: linear
  • lr_scheduler_kwargs: {}
  • warmup_ratio: 0.0
  • warmup_steps: 0
  • 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: False
  • 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: True
  • 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}
  • parallelism_config: None
  • deepspeed: None
  • label_smoothing_factor: 0.0
  • optim: adamw_torch_fused
  • 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: None
  • hub_always_push: False
  • hub_revision: None
  • gradient_checkpointing: False
  • gradient_checkpointing_kwargs: None
  • include_inputs_for_metrics: False
  • include_for_metrics: []
  • 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
  • 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
  • use_liger_kernel: False
  • liger_kernel_config: None
  • eval_use_gather_object: False
  • average_tokens_across_devices: False
  • prompts: None
  • batch_sampler: batch_sampler
  • multi_dataset_batch_sampler: round_robin
  • router_mapping: {}
  • learning_rate_mapping: {}

Framework Versions

  • Python: 3.13.7
  • Sentence Transformers: 5.1.0
  • Transformers: 4.56.1
  • PyTorch: 2.8.0+cpu
  • Accelerate: 1.10.1
  • Datasets: 4.0.0
  • Tokenizers: 0.22.0

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",
}

MultipleNegativesRankingLoss

@misc{henderson2017efficient,
    title={Efficient Natural Language Response Suggestion for Smart Reply},
    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},
    year={2017},
    eprint={1705.00652},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}