Views
No views yet
SentenceTransformer(
(0): CLIPModel()
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("TatvaRA/clip-skin-embeddings")
5# Run inference
6sentences = [
7 'The image depicts the abdominal region with a reticulated, or net-like, erythematous pattern on the skin. The area shows a faint, reddish-brown discoloration with a lacy appearance, indicative of erythema ab igne. The borders of the discoloration are irregular but well-demarcated. No blistering or open lesions are visible, and the skin surface appears intact without signs of scaling or crusting.',
8 'The image depicts multiple small, soft, flesh-colored to slightly hyperpigmented skin lesions located on the eyelid and surrounding skin. These lesions are pedunculated with a smooth surface, typical of skin tags (acrochordons). Some are more prominent and raised, while others are flatter against the skin surface. The surrounding skin appears slightly wrinkled, consistent with normal aging changes.',
9 'The image shows an elderly person with erythematous patches and papules prominently located on the central face, including the cheeks, nose, and forehead. The skin findings display a symmetrical distribution. The nose is slightly bulbous, suggesting possible rhinophyma changes. The lesions do not have well-defined borders and there is no visible scaling or pustular formations. The background skin appears sun-damaged with fine wrinkling, but without significant telangiectasia visible in this image.',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 1024]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities)
18# tensor([[1.0000, 0.3884, 0.3253],
19# [0.3884, 1.0000, 0.5531],
20# [0.3253, 0.5531, 1.0000]])skin-dataset-train and skin-dataset-validTripletEvaluator| Metric | skin-dataset-train | skin-dataset-valid |
|---|---|---|
| cosine_accuracy | 1.0 | 1.0 |
anchor, positive, and negative| anchor | positive | negative | |
|---|---|---|---|
| type | PIL.PngImagePlugin.PngImageFile | string | string |
| details |
|
|
| anchor | positive | negative |
|---|---|---|
<PIL.PngImagePlugin.PngImageFile image mode=RGB size=1022x767 at 0x7F68FEB0AD40> | The image depicts a melanocytic nevus located on the skin. It is characterized by a well-defined, round brown lesion centrally located on a lighter skin background. The pigmentation appears uniform with a slightly darker speckled pattern distributed evenly throughout the nevus. The borders are smooth and clearly demarcated from the surrounding skin. There is no apparent erythema, ulceration, or significant secondary changes. Sparse hair is visible around the lesion, and the overall lesion is flat, without palpable elevation. | The image shows the upper lip, featuring a cluster of small, grouped vesicles on an erythematous base. The vesicles are clear, filled with fluid, and some are beginning to coalesce. There is minimal surrounding erythema, and the lesions are located at the vermillion border of the lip. The borders of the vesicles are well-defined, and there are no signs of crusting at this stage. |
<PIL.PngImagePlugin.PngImageFile image mode=RGB size=294x222 at 0x7F68FEB0A0E0> | The image shows a well-defined, erythematous plaque on the skin with a rough, scaly surface. The lesion is located on a hand and exhibits significant inflammation and lichenification. There is evidence of excoriation and possible oozing, suggesting chronic irritation and scratching. The borders of the lesion are distinct, and the surrounding skin appears dry. | The image displays multiple open comedones, appearing as black or dark brown plugs, located on the periocular region of the face. These lesions have a characteristic distribution, clustering under the eye and on the upper cheek area. The surrounding skin exhibits signs of chronic sun damage, including fine wrinkles and a mildly rough texture. The borders of the comedones are well-defined, and there is no evidence of erythema or secondary infection around the lesions. |
<PIL.PngImagePlugin.PngImageFile image mode=RGB size=600x450 at 0x7F68FEB0B160> | The image shows a close-up view of the skin with an irregularly shaped lesion displaying a mixture of colors, including pink, brown, and some erythematous areas. The lesion has uneven borders and appears slightly raised with scaly, crusted surfaces. There are areas of keratinization, with the lesion being distributed in a somewhat asymmetrical pattern. Surrounding skin appears less affected, with some visible telangiectasia. | The image shows the back of an individual with multiple vesicular lesions. These lesions are scattered across the skin surface and vary in size. They appear as small, red, blister-like eruptions that are slightly raised. Some lesions exhibit a clear vesicular head, while others are crusted over, indicating different stages of development. The distribution is widespread across the back, with a noticeable absence of clustering. The lesions have well-defined borders, and the surrounding skin appears otherwise normal without significant erythema or swelling. |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim"
4}anchor, positive, and negative| anchor | positive | negative | |
|---|---|---|---|
| type | PIL.PngImagePlugin.PngImageFile | string | string |
| details |
|
|
| anchor | positive | negative |
|---|---|---|
<PIL.PngImagePlugin.PngImageFile image mode=RGB size=294x222 at 0x7F68FEB0BE80> | The image shows an area of skin with multiple open comedones, commonly known as blackheads, scattered across the affected area. These comedones are predominantly located on the cheek and temple of the face. The skin appears weathered and sallow, with some areas exhibiting signs of solar damage, including wrinkling and yellowish discoloration. The borders of the lesions are irregular, and there are multiple large, open comedones. There are secondary changes, such as mild erythema and induration in some areas, suggesting chronic sun exposure. | The image displays toenails with signs of fungal infection. The nails appear thickened and discolored, predominantly yellowish-brown. There is noticeable onycholysis, especially in the larger toenail, with crumbling and irregular borders. The surface of the nails looks rough and uneven, and there is subungual debris. The surrounding skin appears intact without visible erythema or scaling. |
<PIL.PngImagePlugin.PngImageFile image mode=RGB size=294x222 at 0x7F68FEB0BC70> | The image shows a circular, red lesion on the skin, located on the cheek. It features a central elevated red spot with radiating capillaries, resembling a spider's web. The surrounding skin appears slightly erythematous. The lesion has well-defined borders and is isolated with no other lesions visible in the immediate vicinity. | The image shows an area of skin with multiple erythematous, excoriated papules and plaques, some of which are coalescing. The lesions are distributed on the flexural aspect of the extremity. The skin appears dry and lichenified with some areas showing slight scaling. Borders of the individual lesions are irregular, and there is no clear demarcation from the surrounding skin. |
<PIL.PngImagePlugin.PngImageFile image mode=RGB size=472x720 at 0x7F68FEB0BBE0> | The image shows an elderly person with erythematous patches and papules prominently located on the central face, including the cheeks, nose, and forehead. The skin findings display a symmetrical distribution. The nose is slightly bulbous, suggesting possible rhinophyma changes. The lesions do not have well-defined borders and there is no visible scaling or pustular formations. The background skin appears sun-damaged with fine wrinkling, but without significant telangiectasia visible in this image. | The image shows a round, erythematous (red) lesion with a well-defined, slightly raised border. The center of the lesion appears to be clearer with minor scaling, typical of a ringworm (tinea corporis) infection. The lesion is located on skin likely from a limb or torso. The margins are distinct with some subtle scaling toward the periphery. |
MultipleNegativesRankingLoss with these parameters:
1{
2 "scale": 20.0,
3 "similarity_fct": "cos_sim"
4}eval_strategy: epochper_device_train_batch_size: 16per_device_eval_batch_size: 16learning_rate: 0.0001num_train_epochs: 7overwrite_output_dir: Falsedo_predict: Falseeval_strategy: epochprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 0.0001weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1.0num_train_epochs: 7max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_steps: 0log_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: Falsefp16_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: Truelabel_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: Nonehub_always_push: Falsehub_revision: Nonegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_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: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseliger_kernel_config: Noneeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: proportionalrouter_mapping: {}learning_rate_mapping: {}| Epoch | Step | Training Loss | Validation Loss | skin-dataset-train_cosine_accuracy | skin-dataset-valid_cosine_accuracy |
|---|---|---|---|---|---|
| -1 | -1 | - | - | 0.9619 | 1.0 |
| 0.1429 | 1 | 2.7596 | - | - | - |
| 0.2857 | 2 | 2.5414 | - | - | - |
| 0.4286 | 3 | 2.6204 | - | - | - |
| 0.5714 | 4 | 2.4667 | - | - | - |
| 0.7143 | 5 | 2.4014 | - | - | - |
| 0.8571 | 6 | 2.5579 | - | - | - |
| 1.0 | 7 | 2.0899 | 2.2113 | - | - |
| 1.1429 | 8 | 2.1459 | - | - | - |
| 1.2857 | 9 | 2.0529 | - | - | - |
| 1.4286 | 10 | 1.8848 | - | - | - |
| 1.5714 | 11 | 2.0387 | - | - | - |
| 1.7143 | 12 | 2.0944 | - | - | - |
| 1.8571 | 13 | 2.1068 | - | - | - |
| 2.0 | 14 | 1.6342 | 2.1221 | - | - |
| 0.1429 | 1 | 1.7895 | - | - | - |
| 0.2857 | 2 | 1.6297 | - | - | - |
| 0.4286 | 3 | 1.9204 | - | - | - |
| 0.5714 | 4 | 1.9449 | - | - | - |
| 0.7143 | 5 | 1.8608 | - | - | - |
| 0.8571 | 6 | 2.186 | - | - | - |
| 1.0 | 7 | 1.522 | 1.8561 | - | - |
| 1.1429 | 8 | 1.5326 | - | - | - |
| 1.2857 | 9 | 1.3086 | - | - | - |
| 1.4286 | 10 | 1.1582 | - | - | - |
| 1.5714 | 11 | 1.4275 | - | - | - |
| 1.7143 | 12 | 1.3807 | - | - | - |
| 1.8571 | 13 | 1.4184 | - | - | - |
| 2.0 | 14 | 0.909 | 1.7285 | - | - |
| 2.1429 | 15 | 1.2727 | - | - | - |
| 2.2857 | 16 | 1.3549 | - | - | - |
| 2.4286 | 17 | 1.0448 | - | - | - |
| 2.5714 | 18 | 1.0773 | - | - | - |
| 2.7143 | 19 | 1.1036 | - | - | - |
| 2.8571 | 20 | 0.9444 | - | - | - |
| 3.0 | 21 | 0.5148 | 1.6311 | - | - |
| 3.1429 | 22 | 0.8764 | - | - | - |
| 3.2857 | 23 | 0.809 | - | - | - |
| 3.4286 | 24 | 0.8724 | - | - | - |
| 3.5714 | 25 | 0.8276 | - | - | - |
| 3.7143 | 26 | 0.8923 | - | - | - |
| 3.8571 | 27 | 0.797 | - | - | - |
| 4.0 | 28 | 0.5056 | 1.5989 | - | - |
| 4.1429 | 29 | 0.7625 | - | - | - |
| 4.2857 | 30 | 0.6356 | - | - | - |
| 4.4286 | 31 | 0.8352 | - | - | - |
| 4.5714 | 32 | 0.6936 | - | - | - |
| 4.7143 | 33 | 0.6338 | - | - | - |
| 4.8571 | 34 | 0.5392 | - | - | - |
| 5.0 | 35 | 0.3826 | 1.5942 | - | - |
| 5.1429 | 36 | 0.6252 | - | - | - |
| 5.2857 | 37 | 0.5969 | - | - | - |
| 5.4286 | 38 | 0.4948 | - | - | - |
| 5.5714 | 39 | 0.7617 | - | - | - |
| 5.7143 | 40 | 0.6775 | - | - | - |
| 5.8571 | 41 | 0.6289 | - | - | - |
| 6.0 | 42 | 0.2195 | 1.5698 | - | - |
| 6.1429 | 43 | 0.5786 | - | - | - |
| 6.2857 | 44 | 0.6049 | - | - | - |
| 6.4286 | 45 | 0.5162 | - | - | - |
| 6.5714 | 46 | 0.5841 | - | - | - |
| 6.7143 | 47 | 0.6579 | - | - | - |
| 6.8571 | 48 | 0.6702 | - | - | - |
| 7.0 | 49 | 0.2975 | 1.5598 | - | - |
| -1 | -1 | - | - | 1.0 | 1.0 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{henderson2017efficient,
2 title={Efficient Natural Language Response Suggestion for Smart Reply},
3 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},
4 year={2017},
5 eprint={1705.00652},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}