Downloads · 30 days
488
10% of all-time downloads
Mira190/Euler-Legal-Embedding-V1
Euler-Legal-Embedding-V1 is a text classification model from Mira190. Use it when you need a label for a piece of text. It is set up for sentence-transformers. The card lists the license as apache-2.0.
<h1 align="center"Euler-Legal-Embedding-V1</h1 <p align="center" <a href="https://huggingface.co/Mira190/Euler-Legal-Embedding-V1" <img src="https://img.shields.io/badge/%F0%9F%A4%97HuggingFace-Model-ffbd45.svg" alt="…
Downloads · 30 days
488
10% of all-time downloads
All-time downloads
5.1K
Public
Parameters
8.2B
16.4 GB on disk
Likes
17
Public
Click a slice to open those files.
.safetensors16.4 GB · 100%
From the Hugging Face model README
Euler-Legal-Embedding-V1 is a specialized embedding model for the legal domain, fine-tuned on Qwen/Qwen3-Embedding-8B. It achieves strong performance on legal retrieval and reasoning tasks within the MTEB benchmark.
final-data-new-anonymized-grok4-filtered.jsonl)Using this model becomes easy when you have sentence-transformers installed:
pip install -U sentence-transformers
You can use the model like this:
from sentence_transformers import SentenceTransformer
import torch
# Load the model
# trust_remote_code=True is required for Qwen-based models
model = SentenceTransformer(
"Mira190/Euler-Legal-Embedding-V1",
trust_remote_code=True,
model_kwargs={
"torch_dtype": torch.bfloat16,
"attn_implementation": "flash_attention_2", # Optional, requires flash-attn installed
},
)
model.max_seq_length = 1536
sentences = [
"The plaintiff filed a motion for summary judgment.",
"The court granted the motion based on lack of genuine dispute of material fact."
]
# No specific prompt is required for this version
embeddings = model.encode(
sentences,
normalize_embeddings=True,
batch_size=16,
show_progress_bar=True,
)
print(embeddings.shape)
# Output: (2, 4096)
You can also use the model directly with the transformers library:
import torch
from transformers import AutoModel, AutoTokenizer
model_id = "Mira190/Euler-Legal-Embedding-V1"
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModel.from_pretrained(
model_id,
trust_remote_code=True,
torch_dtype=torch.bfloat16,
device_map="auto"
)
sentences = ["This is a legal document.", "This is another legal document."]
# Tokenize sentences
inputs = tokenizer(
sentences,
return_tensors="pt",
padding=True,
truncation=True,
max_length=1536
)
# Move inputs to the same device as the model
inputs = {k: v.to(model.device) for k, v in inputs.items()}
with torch.no_grad():
outputs = model(**inputs)
# Last token pooling (Standard for Qwen-Embedding)
# Note: Qwen embeddings typically use the last hidden state of the last token (EOS or specific token)
embeddings = outputs.last_hidden_state[:, -1]
# Normalize embeddings
embeddings = torch.nn.functional.normalize(embeddings, p=2, dim=1)
print(embeddings.shape)
# Output: (2, 4096)
The model was fine-tuned using LoRA (Low-Rank Adaptation) via the Swift framework.
If you find this model useful, please consider citing:
@misc{euler2025legal,
title={Euler-Legal-Embedding: Advanced Legal Representation Learning},
author={LawRank Team},
year={2025},
publisher={Hugging Face}
}