Spaces:
Running
Running
Add detailed model descriptions for Mistral 7B and XGLM 7.5B in app and settings
Browse files- app.py +89 -0
- config/settings.py +45 -1
app.py
CHANGED
|
@@ -35,6 +35,7 @@ from src.analytics.chat_evaluator import ChatEvaluator
|
|
| 35 |
if not HF_TOKEN:
|
| 36 |
raise ValueError("HUGGINGFACE_TOKEN not found in environment variables")
|
| 37 |
|
|
|
|
| 38 |
# Enhanced model details for UI
|
| 39 |
MODEL_DETAILS = {
|
| 40 |
"llama-7b": {
|
|
@@ -78,8 +79,96 @@ MODEL_DETAILS = {
|
|
| 78 |
"Structured legal text generation"
|
| 79 |
],
|
| 80 |
"documentation": "https://huggingface.co/HuggingFaceH4/zephyr-7b-beta"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
}
|
| 82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
|
| 84 |
# Path for user preferences file
|
| 85 |
USER_PREFERENCES_PATH = os.path.join(os.path.dirname(__file__), "user_preferences.json")
|
|
|
|
| 35 |
if not HF_TOKEN:
|
| 36 |
raise ValueError("HUGGINGFACE_TOKEN not found in environment variables")
|
| 37 |
|
| 38 |
+
# Enhanced model details for UI
|
| 39 |
# Enhanced model details for UI
|
| 40 |
MODEL_DETAILS = {
|
| 41 |
"llama-7b": {
|
|
|
|
| 79 |
"Structured legal text generation"
|
| 80 |
],
|
| 81 |
"documentation": "https://huggingface.co/HuggingFaceH4/zephyr-7b-beta"
|
| 82 |
+
},
|
| 83 |
+
"mistral-7b": {
|
| 84 |
+
"full_name": "Mistral 7B Instruct v0.2",
|
| 85 |
+
"capabilities": [
|
| 86 |
+
"Strong multilingual support",
|
| 87 |
+
"Superior instruction following ability",
|
| 88 |
+
"Fast inference speed",
|
| 89 |
+
"Excellent reasoning capabilities",
|
| 90 |
+
"Free for commercial use"
|
| 91 |
+
],
|
| 92 |
+
"limitations": [
|
| 93 |
+
"May have limited knowledge of specialized legal terminology",
|
| 94 |
+
"Less exposure to legal domain than specialized models",
|
| 95 |
+
"Knowledge cutoff before latest legal developments"
|
| 96 |
+
],
|
| 97 |
+
"use_cases": [
|
| 98 |
+
"Multilingual legal assistance",
|
| 99 |
+
"Cross-border legal questions",
|
| 100 |
+
"Clear explanations of complex legal topics",
|
| 101 |
+
"Serving international clients in their native language"
|
| 102 |
+
],
|
| 103 |
+
"documentation": "https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2"
|
| 104 |
+
},
|
| 105 |
+
"xglm-7.5b": {
|
| 106 |
+
"full_name": "Meta XGLM 7.5B",
|
| 107 |
+
"capabilities": [
|
| 108 |
+
"Specialized for multilingual generation",
|
| 109 |
+
"Support for 30+ languages",
|
| 110 |
+
"Strong cross-lingual transfer abilities",
|
| 111 |
+
"Consistent performance across diverse languages"
|
| 112 |
+
],
|
| 113 |
+
"limitations": [
|
| 114 |
+
"Less instruction-tuned than dedicated chat models",
|
| 115 |
+
"May require more specific prompting",
|
| 116 |
+
"Not specifically optimized for legal domain",
|
| 117 |
+
"Slightly larger model requiring more GPU memory"
|
| 118 |
+
],
|
| 119 |
+
"use_cases": [
|
| 120 |
+
"International legal assistance in native languages",
|
| 121 |
+
"Complex multilingual documentation",
|
| 122 |
+
"Serving clients from diverse linguistic backgrounds",
|
| 123 |
+
"Translation and summarization of legal concepts across languages"
|
| 124 |
+
],
|
| 125 |
+
"documentation": "https://huggingface.co/facebook/xglm-7.5B"
|
| 126 |
}
|
| 127 |
}
|
| 128 |
+
# MODEL_DETAILS = {
|
| 129 |
+
# "llama-7b": {
|
| 130 |
+
# "full_name": "Meta Llama 2 7B Chat",
|
| 131 |
+
# "capabilities": [
|
| 132 |
+
# "Multilingual support ",
|
| 133 |
+
# "Good performance on legal texts",
|
| 134 |
+
# "Free model with open license",
|
| 135 |
+
# "Can run on computers with 16GB+ RAM"
|
| 136 |
+
# ],
|
| 137 |
+
# "limitations": [
|
| 138 |
+
# "Limited knowledge of specific legal terminology",
|
| 139 |
+
# "May provide incorrect answers to complex legal questions",
|
| 140 |
+
# "Knowledge is limited to training data"
|
| 141 |
+
# ],
|
| 142 |
+
# "use_cases": [
|
| 143 |
+
# "Legal document analysis",
|
| 144 |
+
# "Answering general legal questions",
|
| 145 |
+
# "Searching through legal knowledge base",
|
| 146 |
+
# "Assistance in document drafting"
|
| 147 |
+
# ],
|
| 148 |
+
# "documentation": "https://huggingface.co/meta-llama/Llama-2-7b-chat-hf"
|
| 149 |
+
# },
|
| 150 |
+
# "zephyr-7b": {
|
| 151 |
+
# "full_name": "HuggingFaceH4 Zephyr 7B Beta",
|
| 152 |
+
# "capabilities": [
|
| 153 |
+
# "High performance on instruction-following tasks",
|
| 154 |
+
# "Good response accuracy",
|
| 155 |
+
# "Advanced reasoning capabilities",
|
| 156 |
+
# "Excellent text generation quality"
|
| 157 |
+
# ],
|
| 158 |
+
# "limitations": [
|
| 159 |
+
# "May require paid API for usage",
|
| 160 |
+
# "Limited support for languages other than English",
|
| 161 |
+
# "Less optimization for legal topics compared to specialized models"
|
| 162 |
+
# ],
|
| 163 |
+
# "use_cases": [
|
| 164 |
+
# "Complex legal reasoning",
|
| 165 |
+
# "Case analysis",
|
| 166 |
+
# "Legal research",
|
| 167 |
+
# "Structured legal text generation"
|
| 168 |
+
# ],
|
| 169 |
+
# "documentation": "https://huggingface.co/HuggingFaceH4/zephyr-7b-beta"
|
| 170 |
+
# }
|
| 171 |
+
# }
|
| 172 |
|
| 173 |
# Path for user preferences file
|
| 174 |
USER_PREFERENCES_PATH = os.path.join(os.path.dirname(__file__), "user_preferences.json")
|
config/settings.py
CHANGED
|
@@ -64,6 +64,50 @@ MODELS = {
|
|
| 64 |
"target_modules": ["q_proj", "v_proj", "k_proj", "o_proj"]
|
| 65 |
}
|
| 66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
}
|
| 68 |
}
|
| 69 |
|
|
@@ -75,4 +119,4 @@ ACTIVE_MODEL = MODELS[DEFAULT_MODEL]
|
|
| 75 |
EMBEDDING_MODEL = "intfloat/multilingual-e5-large"
|
| 76 |
|
| 77 |
# Request settings
|
| 78 |
-
USER_AGENT = "Status-Law-Assistant/1.0"
|
|
|
|
| 64 |
"target_modules": ["q_proj", "v_proj", "k_proj", "o_proj"]
|
| 65 |
}
|
| 66 |
}
|
| 67 |
+
},
|
| 68 |
+
"mistral-7b": {
|
| 69 |
+
"id": "mistralai/Mistral-7B-Instruct-v0.2",
|
| 70 |
+
"name": "Mistral 7B Instruct",
|
| 71 |
+
"description": "Mistral's 7B instruction-tuned model with better multilingual support",
|
| 72 |
+
"type": "base",
|
| 73 |
+
"parameters": {
|
| 74 |
+
"max_length": 2048,
|
| 75 |
+
"temperature": 0.7,
|
| 76 |
+
"top_p": 0.9,
|
| 77 |
+
"repetition_penalty": 1.1,
|
| 78 |
+
},
|
| 79 |
+
"training": {
|
| 80 |
+
"base_model_path": "mistralai/Mistral-7B-Instruct-v0.2",
|
| 81 |
+
"fine_tuned_path": os.path.join(TRAINING_OUTPUT_DIR, "mistral-7b-instruct-tuned"),
|
| 82 |
+
"lora_config": {
|
| 83 |
+
"r": 16,
|
| 84 |
+
"lora_alpha": 32,
|
| 85 |
+
"lora_dropout": 0.05,
|
| 86 |
+
"target_modules": ["q_proj", "v_proj", "k_proj", "o_proj"]
|
| 87 |
+
}
|
| 88 |
+
}
|
| 89 |
+
},
|
| 90 |
+
"xglm-7.5b": {
|
| 91 |
+
"id": "facebook/xglm-7.5B",
|
| 92 |
+
"name": "XGLM 7.5B",
|
| 93 |
+
"description": "Meta's multilingual model designed for cross-lingual generation",
|
| 94 |
+
"type": "base",
|
| 95 |
+
"parameters": {
|
| 96 |
+
"max_length": 2048,
|
| 97 |
+
"temperature": 0.7,
|
| 98 |
+
"top_p": 0.9,
|
| 99 |
+
"repetition_penalty": 1.1,
|
| 100 |
+
},
|
| 101 |
+
"training": {
|
| 102 |
+
"base_model_path": "facebook/xglm-7.5B",
|
| 103 |
+
"fine_tuned_path": os.path.join(TRAINING_OUTPUT_DIR, "xglm-7.5b-tuned"),
|
| 104 |
+
"lora_config": {
|
| 105 |
+
"r": 16,
|
| 106 |
+
"lora_alpha": 32,
|
| 107 |
+
"lora_dropout": 0.05,
|
| 108 |
+
"target_modules": ["q_proj", "v_proj", "k_proj", "o_proj"]
|
| 109 |
+
}
|
| 110 |
+
}
|
| 111 |
}
|
| 112 |
}
|
| 113 |
|
|
|
|
| 119 |
EMBEDDING_MODEL = "intfloat/multilingual-e5-large"
|
| 120 |
|
| 121 |
# Request settings
|
| 122 |
+
USER_AGENT = "Status-Law-Assistant/1.0"
|