Sentence Similarity
sentence-transformers
PyTorch
English
bert
feature-extraction
mteb
custom_code
Eval Results (legacy)
text-embeddings-inference
Instructions to use Hum-Works/lodestone-base-4096-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Hum-Works/lodestone-base-4096-v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("Hum-Works/lodestone-base-4096-v1", trust_remote_code=True) sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
| from huggingface_hub import snapshot_download | |
| import json | |
| import os | |
| REPO_ID = "mosaicml/mosaic-bert-base-seqlen-2048" | |
| MODEL_DIRECTORY = "mosaic-bert-base-seqlen-2048" | |
| def main(): | |
| snapshot_download(repo_id=REPO_ID, local_dir=MODEL_DIRECTORY) | |
| # modify the model's config.json file to satisfy our requirements | |
| config_file_path = os.path.join(MODEL_DIRECTORY, 'config.json') | |
| contents = json.load(open(config_file_path)) | |
| contents['architectures'] = ['BertModel'] | |
| contents['auto_map']['AutoModel'] = 'bert_layers.BertModel' | |
| contents['torch_dtype'] = 'bfloat16' | |
| contents['transformers_version'] = '4.28.1' | |
| contents['_name_or_path'] = 'mosaic-bert-base-seqlen-2048' | |
| json.dump(contents, open(config_file_path, 'w'), ensure_ascii=True) | |
| if __name__ == '__main__': | |
| main() |