How to use tomaarsen/bert-base-nq with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("tomaarsen/bert-base-nq") sentences = [ "who ordered the charge of the light brigade", "Charge of the Light Brigade The Charge of the Light Brigade was a charge of British light cavalry led by Lord Cardigan against Russian forces during the Battle of Balaclava on 25 October 1854 in the Crimean War. Lord Raglan, overall commander of the British forces, had intended to send the Light Brigade to prevent the Russians from removing captured guns from overrun Turkish positions, a task well-suited to light cavalry.", "UNICEF The United Nations International Children's Emergency Fund was created by the United Nations General Assembly on 11 December 1946, to provide emergency food and healthcare to children in countries that had been devastated by World War II. The Polish physician Ludwik Rajchman is widely regarded as the founder of UNICEF and served as its first chairman from 1946. On Rajchman's suggestion, the American Maurice Pate was appointed its first executive director, serving from 1947 until his death in 1965.[5][6] In 1950, UNICEF's mandate was extended to address the long-term needs of children and women in developing countries everywhere. In 1953 it became a permanent part of the United Nations System, and the words \"international\" and \"emergency\" were dropped from the organization's name, making it simply the United Nations Children's Fund, retaining the original acronym, \"UNICEF\".[3]", "Marcus Jordan Marcus James Jordan (born December 24, 1990) is an American former college basketball player who played for the UCF Knights men's basketball team of Conference USA.[1] He is the son of retired Hall of Fame basketball player Michael Jordan." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4]