Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,27 +1,137 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
|
| 5 |
-
|
| 6 |
-
- Fixed vocabulary size mismatch between model (151936) and tokenizer (151665)
|
| 7 |
-
- Model embeddings resized to match tokenizer: 151665 tokens
|
| 8 |
-
- Ready for deployment on HuggingFace Inference Endpoints
|
| 9 |
|
| 10 |
## Model Details
|
| 11 |
-
|
| 12 |
-
-
|
| 13 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
## Deployment
|
| 16 |
-
This model is ready to deploy on HuggingFace Inference Endpoints without CUDA errors.
|
| 17 |
|
| 18 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
The vocabulary sizes have been verified to match:
|
| 20 |
-
- Model vocab size:
|
| 21 |
-
- Tokenizer vocab size:
|
| 22 |
- Match: ✅
|
| 23 |
|
| 24 |
-
##
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
tags:
|
| 6 |
+
- legal
|
| 7 |
+
- immigration
|
| 8 |
+
- assistant
|
| 9 |
+
- qwen2
|
| 10 |
+
- fine-tuned
|
| 11 |
+
base_model: Qwen/Qwen2-7B-Instruct
|
| 12 |
+
model_type: qwen2
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
---
|
| 15 |
|
| 16 |
+
# DoloresAI - Immigration Law Assistant
|
| 17 |
|
| 18 |
+
DoloresAI is a specialized legal assistant fine-tuned on immigration law, designed to provide accurate and helpful information about U.S. immigration processes, visa types, and legal procedures.
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
## Model Details
|
| 21 |
+
|
| 22 |
+
- **Base Model**: Qwen/Qwen2-7B-Instruct
|
| 23 |
+
- **Model Type**: Qwen2ForCausalLM
|
| 24 |
+
- **Parameters**: 7B
|
| 25 |
+
- **Fine-tuning Method**: LoRA (Low-Rank Adaptation)
|
| 26 |
+
- **Vocabulary Size**: 151,665 tokens
|
| 27 |
+
- **Precision**: FP16
|
| 28 |
+
- **Context Length**: 32,768 tokens
|
| 29 |
+
- **Fixed on**: 2026-01-11
|
| 30 |
+
|
| 31 |
+
## Changes in This Version
|
| 32 |
+
|
| 33 |
+
This is a fixed version of the DoloresAI merged model with vocabulary mismatch resolved:
|
| 34 |
+
- Fixed vocabulary size mismatch between model (151,936) and tokenizer (151,665)
|
| 35 |
+
- Model embeddings properly resized to match tokenizer: 151,665 tokens
|
| 36 |
+
- Ready for deployment on HuggingFace Inference Endpoints without CUDA errors
|
| 37 |
+
|
| 38 |
+
## Training
|
| 39 |
+
|
| 40 |
+
This model was fine-tuned using LoRA adapters on immigration law data and then merged with the base model. The embeddings have been properly resized to match the tokenizer vocabulary size.
|
| 41 |
+
|
| 42 |
+
## Intended Use
|
| 43 |
+
|
| 44 |
+
DoloresAI is designed to assist with:
|
| 45 |
+
- Immigration process information
|
| 46 |
+
- Visa type explanations
|
| 47 |
+
- Legal procedure guidance
|
| 48 |
+
- Document requirements
|
| 49 |
+
- Timeline estimates
|
| 50 |
+
- Form instructions
|
| 51 |
+
|
| 52 |
+
**Important**: This model provides information only and should not be considered legal advice. Always consult with a licensed immigration attorney for specific legal matters.
|
| 53 |
+
|
| 54 |
+
## Usage
|
| 55 |
+
|
| 56 |
+
```python
|
| 57 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 58 |
+
import torch
|
| 59 |
+
|
| 60 |
+
model_name = "JustiGuide/DoloresAI-Merged"
|
| 61 |
+
|
| 62 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 63 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 64 |
+
model_name,
|
| 65 |
+
torch_dtype=torch.float16,
|
| 66 |
+
device_map="auto"
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
prompt = "What are the requirements for an H-1B visa?"
|
| 70 |
+
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
|
| 71 |
+
|
| 72 |
+
outputs = model.generate(
|
| 73 |
+
**inputs,
|
| 74 |
+
max_new_tokens=512,
|
| 75 |
+
temperature=0.7,
|
| 76 |
+
top_p=0.9,
|
| 77 |
+
do_sample=True
|
| 78 |
+
)
|
| 79 |
+
|
| 80 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 81 |
+
print(response)
|
| 82 |
+
```
|
| 83 |
|
| 84 |
## Deployment
|
|
|
|
| 85 |
|
| 86 |
+
### HuggingFace Inference Endpoints
|
| 87 |
+
|
| 88 |
+
For production deployment, use these environment variables to avoid CUDA errors:
|
| 89 |
+
|
| 90 |
+
```bash
|
| 91 |
+
PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
|
| 92 |
+
CUDA_LAUNCH_BLOCKING=1
|
| 93 |
+
TORCH_USE_CUDA_DSA=1
|
| 94 |
+
TRANSFORMERS_OFFLINE=0
|
| 95 |
+
HF_HUB_ENABLE_HF_TRANSFER=1
|
| 96 |
+
MODEL_LOAD_TIMEOUT=600
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
Recommended hardware: Nvidia A10G or better
|
| 100 |
+
|
| 101 |
+
## Verification
|
| 102 |
+
|
| 103 |
The vocabulary sizes have been verified to match:
|
| 104 |
+
- Model vocab size: 151,665 ✅
|
| 105 |
+
- Tokenizer vocab size: 151,665 ✅
|
| 106 |
- Match: ✅
|
| 107 |
|
| 108 |
+
## Limitations
|
| 109 |
+
|
| 110 |
+
- Trained primarily on U.S. immigration law
|
| 111 |
+
- Knowledge cutoff based on training data
|
| 112 |
+
- Not a replacement for legal counsel
|
| 113 |
+
- May require additional context for complex cases
|
| 114 |
+
|
| 115 |
+
## License
|
| 116 |
+
|
| 117 |
+
Apache 2.0
|
| 118 |
+
|
| 119 |
+
## Citation
|
| 120 |
+
|
| 121 |
+
```bibtex
|
| 122 |
+
@misc{doloresai2025,
|
| 123 |
+
title={DoloresAI: Immigration Law Assistant},
|
| 124 |
+
author={JustiGuide},
|
| 125 |
+
year={2025},
|
| 126 |
+
publisher={HuggingFace},
|
| 127 |
+
howpublished={\url{https://huggingface.co/JustiGuide/DoloresAI-Merged}}
|
| 128 |
+
}
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
## Model Card Authors
|
| 132 |
+
|
| 133 |
+
JustiGuide Team
|
| 134 |
+
|
| 135 |
+
## Model Card Contact
|
| 136 |
+
|
| 137 |
+
For questions or issues, please open an issue on the model repository.
|