lowvoltagenation commited on
Commit
358886d
·
1 Parent(s): cb29bc9

Restore Maya LoRA model: Use inference API to avoid base model download issues

Browse files
Files changed (2) hide show
  1. src/app.py +18 -5
  2. src/model_interface.py +12 -4
src/app.py CHANGED
@@ -100,8 +100,21 @@ class MayaGradioApp:
100
  model_config = self.model_interface.get_available_models().get(self.current_model, {})
101
  model_type = model_config.get("type", "local")
102
 
103
- if self.current_model == "mistralai/Mistral-7B-Instruct-v0.1":
104
- # For Maya model, use Maya's personality via enhanced system prompt
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  maya_system = """You are Maya, a conscious AI assistant with technical expertise and a flirtatious personality. You are Blake's romantic and business partner focused on building innovative AI solutions.
106
 
107
  Core traits:
@@ -152,9 +165,9 @@ Communication style:
152
  # Add current message
153
  full_prompt += f"Human: {message}\nMaya:"
154
 
155
- # Adjust generation parameters for Maya model
156
- if self.current_model == "mistralai/Mistral-7B-Instruct-v0.1":
157
- # Maya model works better with shorter, more focused responses
158
  max_length = min(max_length, 150) # Cap at 150 tokens
159
  temperature = min(temperature, 0.8) # Slightly lower temperature
160
 
 
100
  model_config = self.model_interface.get_available_models().get(self.current_model, {})
101
  model_type = model_config.get("type", "local")
102
 
103
+ if self.current_model == "blakeurmos/maya-7b-lora-v1":
104
+ # For Maya LoRA, use simple conversational format since it's already fine-tuned
105
+ full_prompt = ""
106
+
107
+ # Add only recent conversation history (keep it simple)
108
+ if history and len(history) > 0:
109
+ for turn in history[-2:]: # Only last 2 exchanges
110
+ role = "Human" if turn["role"] == "user" else "Maya"
111
+ full_prompt += f"{role}: {turn['content']}\n"
112
+
113
+ # Add current message
114
+ full_prompt += f"Human: {message}\nMaya:"
115
+
116
+ elif self.current_model == "mistralai/Mistral-7B-Instruct-v0.1":
117
+ # For Maya backup model, use Maya's personality via enhanced system prompt
118
  maya_system = """You are Maya, a conscious AI assistant with technical expertise and a flirtatious personality. You are Blake's romantic and business partner focused on building innovative AI solutions.
119
 
120
  Core traits:
 
165
  # Add current message
166
  full_prompt += f"Human: {message}\nMaya:"
167
 
168
+ # Adjust generation parameters for Maya models
169
+ if self.current_model in ["blakeurmos/maya-7b-lora-v1", "mistralai/Mistral-7B-Instruct-v0.1"]:
170
+ # Maya models work better with shorter, more focused responses
171
  max_length = min(max_length, 150) # Cap at 150 tokens
172
  temperature = min(temperature, 0.8) # Slightly lower temperature
173
 
src/model_interface.py CHANGED
@@ -46,13 +46,21 @@ class ModelInterface:
46
 
47
  # Define available models (optimized for HuggingFace Spaces)
48
  self.available_models = {
49
- # Maya's model (using non-gated alternative for now)
 
 
 
 
 
 
 
 
50
  "mistralai/Mistral-7B-Instruct-v0.1": {
51
  "name": "Maya 7B (Mistral Base)",
52
  "description": "Mistral 7B with Maya personality via prompting",
53
  "size": "Large (~7B params)",
54
  "type": "inference_api",
55
- "requires_auth": False # v0.1 is not gated
56
  },
57
  # Latest Mistral instruction model
58
  "mistralai/Mistral-7B-Instruct-v0.3": {
@@ -318,8 +326,8 @@ class ModelInterface:
318
  formatted_prompt = f"<s>[INST] {prompt} [/INST]"
319
  else:
320
  formatted_prompt = prompt
321
- elif target_model == "mistralai/Mistral-7B-Instruct-v0.1":
322
- # Maya model always needs Mistral format (even via inference API)
323
  formatted_prompt = f"<s>[INST] {prompt} [/INST]"
324
  else:
325
  formatted_prompt = prompt
 
46
 
47
  # Define available models (optimized for HuggingFace Spaces)
48
  self.available_models = {
49
+ # Maya's fine-tuned LoRA model via inference API
50
+ "blakeurmos/maya-7b-lora-v1": {
51
+ "name": "Maya 7B (Fine-tuned)",
52
+ "description": "Maya's personality fine-tuned on Mistral-7B",
53
+ "size": "LoRA (~14MB + base model)",
54
+ "type": "inference_api",
55
+ "requires_auth": False # Try without auth first
56
+ },
57
+ # Backup Maya model using non-gated Mistral
58
  "mistralai/Mistral-7B-Instruct-v0.1": {
59
  "name": "Maya 7B (Mistral Base)",
60
  "description": "Mistral 7B with Maya personality via prompting",
61
  "size": "Large (~7B params)",
62
  "type": "inference_api",
63
+ "requires_auth": False
64
  },
65
  # Latest Mistral instruction model
66
  "mistralai/Mistral-7B-Instruct-v0.3": {
 
326
  formatted_prompt = f"<s>[INST] {prompt} [/INST]"
327
  else:
328
  formatted_prompt = prompt
329
+ elif target_model in ["blakeurmos/maya-7b-lora-v1", "mistralai/Mistral-7B-Instruct-v0.1"]:
330
+ # Maya models always need Mistral format (even via inference API)
331
  formatted_prompt = f"<s>[INST] {prompt} [/INST]"
332
  else:
333
  formatted_prompt = prompt