EphAsad commited on
Commit
c933843
·
verified ·
1 Parent(s): 095a655

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +112 -3
README.md CHANGED
@@ -1,3 +1,112 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ ---
4
+ FireGenEmbedder
5
+
6
+ FireGenEmbedder is a fine-tuned version of the MiniLM model, specifically adapted for sequence classification tasks. The model has been fine-tuned on the Stanford Natural Language Inference (SNLI) dataset to predict the relationship between two sentences, classifying them into three categories: Entailment, Neutral, and Contradiction. It is designed for applications in legal and other domains requiring inference tasks.
7
+
8
+ Model Details
9
+
10
+ Base Model: sentence-transformers/all-MiniLM-L6-v2
11
+
12
+ Fine-tuned Dataset: Stanford Natural Language Inference (SNLI)
13
+
14
+ Labels:
15
+
16
+ 0: Contradiction
17
+
18
+ 1: Neutral
19
+
20
+ 2: Entailment
21
+
22
+ Training Epochs: 3
23
+
24
+ Batch Size: 16 (both train and eval)
25
+
26
+ Precision: Mixed precision for training on GPU
27
+
28
+ Model Usage
29
+
30
+ You can use this model to make inferences on sentence pairs by classifying their relationship.
31
+
32
+ Install Dependencies
33
+
34
+ To use this model, install the following libraries:
35
+
36
+ pip install transformers datasets sentence-transformers torch
37
+
38
+
39
+ Example Code
40
+
41
+ Here’s an example of how to load and use the FireGenEmbedder model for inference:
42
+
43
+ from transformers import AutoTokenizer, AutoModelForSequenceClassification
44
+ import torch
45
+
46
+ # Load the tokenizer and model
47
+ model_name = "path_to_firegenembedder_model"
48
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
49
+ model = AutoModelForSequenceClassification.from_pretrained(model_name)
50
+
51
+ # Move model to device (GPU or CPU)
52
+ device = "cuda" if torch.cuda.is_available() else "cpu"
53
+ model.to(device)
54
+
55
+ # Prepare input
56
+ premise = "The sky is blue."
57
+ hypothesis = "The sky is not blue."
58
+
59
+ inputs = tokenizer(premise, hypothesis, return_tensors="pt", padding=True, truncation=True, max_length=128).to(device)
60
+
61
+ # Inference
62
+ with torch.no_grad():
63
+ outputs = model(**inputs)
64
+ predictions = torch.argmax(outputs.logits, dim=-1)
65
+
66
+ # Print the prediction
67
+ labels = ["Contradiction", "Neutral", "Entailment"]
68
+ print(f"Prediction: {labels[predictions.item()]}")
69
+
70
+
71
+ Model Fine-Tuning Process
72
+
73
+ Data: The model was fine-tuned using the Stanford Natural Language Inference (SNLI) dataset. The SNLI dataset contains labeled pairs of sentences with three classes: Entailment, Neutral, and Contradiction.
74
+
75
+ Training:
76
+
77
+ The model was fine-tuned for 3 epochs with a batch size of 16 on a GPU.
78
+
79
+ The training used mixed precision for faster computation if a GPU was available.
80
+
81
+ The model is based on the MiniLM architecture, known for being lightweight and efficient, making it suitable for real-time inference tasks.
82
+
83
+ Post-Training:
84
+
85
+ The model was saved and zipped for easy distribution.
86
+
87
+ The tokenizer and model were saved to the directory: miniLM-legal-finetuned-SNLI.
88
+
89
+ Model Evaluation
90
+
91
+ The model was evaluated using the validation set from the SNLI dataset, and results can be accessed as follows:
92
+
93
+ # Load the model and evaluate
94
+ results = trainer.evaluate()
95
+ print(results)
96
+
97
+ Zipped Model
98
+
99
+ You can download the model as a zip file containing both the model weights and the tokenizer:
100
+
101
+ Download Model
102
+
103
+ Citation
104
+
105
+ If you use this model in your research or application, please cite the following:
106
+
107
+ @misc{firegenembedder,
108
+ author = {Your Name},
109
+ title = {FireGenEmbedder: Fine-tuned MiniLM for Legal Inference Tasks},
110
+ year = {2026},
111
+ url = {Link to your Hugging Face model page},
112
+ }