--- language: - zh pipeline_tag: sentence-similarity tags: - PEG - feature-extraction - sentence-similarity - transformers license: apache-2.0 library_name: transformers --- # Model Card for Model ID This modelcard aims to be a base template for new models. It has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md?plain=1). ## Model Details We propose the PEG model (a Progressively Learned Textual Embedding), which progressively adjusts the weights of samples contributing to the loss within an extremely large batch, based on the difficulty levels of negative samples. we have amassed an extensive collection of over 110 million data, spanning a wide range of fields such as general knowledge, finance, tourism, medicine, and more. ## Usage (HuggingFace Transformers) Install transformers: ``` pip install transformers ``` Then load model and predict: ```python from transformers import AutoModel, AutoTokenizer import torch # Load model from HuggingFace Hub tokenizer = AutoTokenizer.from_pretrained('TownsWu/PEG') model = AutoModel.from_pretrained('TownsWu/PEG') sentences = ['如何更换花呗绑定银行卡', '花呗更改绑定银行卡'] # Tokenize sentences inputs = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt') # Compute token embeddings with torch.no_grad(): last_hidden_state = model(**inputs, return_dict=True).last_hidden_state embeddings = last_hidden_state[:, 0] print("embeddings:") print(embeddings) ```