from sentence_transformers import SentenceTransformer # Download from the 🤗 Hubmodel = SentenceTransformer("kokitabayashi/e5-mistral_FinModernBERT_query")# Run inferencequeries = [ 'What were the total capital expenditures for capacity expansion projects and the amount of cash returned to shareholders in fiscal 2015?',]documents = [ 'In fiscal 2015, our return on average invested capital improved modestly, despite near record levels of capital spending of $120 million in our capacity expansion projects... Also during fiscal 2015, we returned $718 million in cash to our shareholders through dividend payments of $256 million and share repurchases of $462 million, while maintaining investment-grade credit ratings.', 'BNO will be subject to credit risk with respect to counterparties to OTC contracts entered into by BNO or held by special purpose or structured vehicles. Unlike in futures contracts, the counterparty to these contracts is generally a single bank or other financial institution, rather than a clearing organization backed by a group of financial institutions. As a result, there will be greater counterparty credit risk in these transactions.', 'The decrease in core unit volume in 2005 reflects the following factors: \x95 Loss of market share in our North American roll materials business following our implementation of selling price increases to offset higher raw material costs \x95 The impact of an extra week in the 2004 fiscal year \x95 Accelerated purchases by Office and Consumer Products customers in advance of our 2005 selling price increases, which contributed to higher growth in 2004',]query_embeddings = model.encode_query(queries)document_embeddings = model.encode_document(documents)print(query_embeddings.shape, document_embeddings.shape)# [1, 4096] [3, 4096] # Get the similarity scores for the embeddingssimilarities = model.similarity(query_embeddings, document_embeddings)print(similarities)# tensor([[1.0000, 1.0000, 0.9999]])