How to use dujun/modernbert-embed-base-dj-ft-v2 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("dujun/modernbert-embed-base-dj-ft-v2") sentences = [ "Besides penalties, what other consequences might result from continuous rule breaches?", "20 Misconduct \n20.1\tMisconduct warranting Penalty, Forced Interchange, Sin Bin or Dismissal \nincludes:\n20.1.1\tContinuous or regular breaches of the Rules;\n20.1.2\tSwearing towards another player, Referee, spectator or other match \t\nofficial;\n20.1.3\tDisputing decisions of Referees or other match official(s);\n20.1.4\tUsing more than the necessary physical force to make a Touch;\n20.1.5\tPoor sportsmanship;\n20.1.6\tTripping, striking, or otherwise assaulting another player, Referee, \nspectator or other match official; or\n20.1.7\tAny other action that is contrary to the spirit of the game.21 Forced Interchange \n21.1\tWhere the Referee deems it necessary to implement a Forced Interchange \nfollowing an Infringement, the Referee is to stop the match, direct the ball to \nbe placed on the Mark, advise the offending player of the reason for the Forced \nInterchange, direct that player to return to the Interchange Area, display the \nrelevant signal and award a Penalty to the non-offending Team.", "Line \nMarkings are to be laid out as shown in Appendix 1 - The Field of Play.Sidelines \nextend seven (7) metres beyond the Try Lines to join the Dead Ball Lines and \ndefine the In-Goal Areas which measure fifty (50) metres wide by seven (7) \nmetres in length.1.3\tThe Interchange Areas are located no closer than one (1) metre from each \nSideline.1.4\tSuitably sized markers, cones or corner posts of a distinguishing colour and \nmade from safe and pliable material should be positioned at the intersections of \nthe Sideline and Halfway line and the Sideline and the Try Line.1.4.1\tMarkers, cones or corner posts placed on the junction of the Sideline and \nTry Line are deemed to be in the Field of Play.1.4.2\tAll other markers or cones are deemed to be out of the Field of Play.1.5\tThe standard playing surface is grass.Other surfaces including synthetic grass \nmay be used but shall be subject to NTA approved standards.", "The ball may be passed, knocked or handed between players \nof the Attacking Team who may in turn run or otherwise move with the ball in an \nattempt to gain territorial Advantage and to score Tries.Defending players prevent \nthe Attacking Team from gaining a territorial Advantage by touching the ball carrier.1 The Field of Play \n \n1.1\tThe Field of Play is rectangular in shape measuring 70 metres in length from \nTry Line to Try Line, excluding the In-Goal Areas and 50 metres in width from \nSideline to Sideline excluding the Interchange Areas.1.1.1\tVariations to the dimensions of the Field of Play may be made but must be \nincluded in relevant competition, event or tournament conditions\n1.2\tLine Markings should be 4cm in width but must be no less than 2.5cm.Line \nMarkings are to be laid out as shown in Appendix 1 - The Field of Play." ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4]
The community tab is the place to discuss and collaborate with the HF community!