AtAndDev commited on
Commit
f677010
·
verified ·
1 Parent(s): 557eb8b

Upload MoLA-LM: Mixture of LoRA Adapters Language Model

Browse files
README.md CHANGED
@@ -13,18 +13,13 @@ language:
13
  pipeline_tag: text-generation
14
  ---
15
 
16
- ![image/png](https://cdn-uploads.huggingface.co/production/uploads/630f3e4002ce39336c411048/3gVVmArsXVoogpkXvsBs7.png)
17
 
18
  # MoLA-LM: Mixture of LoRA Adapters LLM
19
 
20
  MoLA-LM combines multiple LoRA adapters with an intelligent router to automatically select the best adapter for each input prompt. This approach enables specialized performance across different tasks while maintaining efficiency.
21
 
22
- [**Click for evals**](https://github.com/alkinun/MoLA/blob/main/README.md)
23
-
24
- **Important Note**: *The v0.5 had issues with the lora applying part of the custom lm class and its router was a bit too small with little generalization.
25
- In v0.6 and future models, all of these issues are/will be resolved.*
26
-
27
- **TLDR:** *Dont use v0.5, use v0.6 and above.*
28
 
29
  ## Model Details
30
 
@@ -70,7 +65,7 @@ print(response)
70
  The MoLA-LM architecture consists of:
71
 
72
  1. **Base Model**: Qwen/Qwen3-4B-Thinking-2507
73
- 2. **Router Network**: Frozen encoder as Sentence transformer + decoder as MLP for adapter selection
74
  3. **LoRA Adapters**: 9 task-specific fine-tuned adapters
75
  4. **Dynamic Switching**: Automatic adapter application based on input
76
 
 
13
  pipeline_tag: text-generation
14
  ---
15
 
16
+ Image here
17
 
18
  # MoLA-LM: Mixture of LoRA Adapters LLM
19
 
20
  MoLA-LM combines multiple LoRA adapters with an intelligent router to automatically select the best adapter for each input prompt. This approach enables specialized performance across different tasks while maintaining efficiency.
21
 
22
+ Evals are coming...
 
 
 
 
 
23
 
24
  ## Model Details
25
 
 
65
  The MoLA-LM architecture consists of:
66
 
67
  1. **Base Model**: Qwen/Qwen3-4B-Thinking-2507
68
+ 2. **Router Network**: Frozen encoder as Sentence transformer + decoder as one layer MLP for adapter selection
69
  3. **LoRA Adapters**: 9 task-specific fine-tuned adapters
70
  4. **Dynamic Switching**: Automatic adapter application based on input
71
 
model-00002-of-00002.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bed174ccd40be44260f2d0433dd2e27f54994f06823929385883f0c913f26bfe
3
  size 3176026404
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6e2a333e0334f80a76b455abfd4db6b05779f440fc980a4bec61259c2ddb8371
3
  size 3176026404
modeling_mola_lm.py CHANGED
@@ -217,12 +217,16 @@ class MoLAForCausalLM(PreTrainedModel, GenerationMixin):
217
  else:
218
  # Hub path - download first adapter
219
  try:
220
- # Download first adapter to get local path
221
- adapter_file = hf_hub_download(
222
  repo_id=self.model_path,
223
  filename=f"loras/{first_adapter}/adapter_model.safetensors"
224
  )
225
- first_lora_path = os.path.dirname(adapter_file)
 
 
 
 
226
  print(f"Downloaded first adapter to: {first_lora_path}")
227
  except Exception as e:
228
  raise Exception(f"Failed to download first adapter {first_adapter}: {e}")
@@ -249,11 +253,15 @@ class MoLAForCausalLM(PreTrainedModel, GenerationMixin):
249
  else:
250
  # Hub path - download adapter
251
  try:
252
- adapter_file = hf_hub_download(
253
  repo_id=self.model_path,
254
  filename=f"loras/{task_name}/adapter_model.safetensors"
255
  )
256
- lora_path = os.path.dirname(adapter_file)
 
 
 
 
257
  except Exception as e:
258
  print(f"❌ Failed to download LoRA {task_name}: {e}")
259
  continue
 
217
  else:
218
  # Hub path - download first adapter
219
  try:
220
+ # Download both required files for first adapter
221
+ adapter_weights_file = hf_hub_download(
222
  repo_id=self.model_path,
223
  filename=f"loras/{first_adapter}/adapter_model.safetensors"
224
  )
225
+ adapter_config_file = hf_hub_download(
226
+ repo_id=self.model_path,
227
+ filename=f"loras/{first_adapter}/adapter_config.json"
228
+ )
229
+ first_lora_path = os.path.dirname(adapter_weights_file)
230
  print(f"Downloaded first adapter to: {first_lora_path}")
231
  except Exception as e:
232
  raise Exception(f"Failed to download first adapter {first_adapter}: {e}")
 
253
  else:
254
  # Hub path - download adapter
255
  try:
256
+ adapter_weights_file = hf_hub_download(
257
  repo_id=self.model_path,
258
  filename=f"loras/{task_name}/adapter_model.safetensors"
259
  )
260
+ adapter_config_file = hf_hub_download(
261
+ repo_id=self.model_path,
262
+ filename=f"loras/{task_name}/adapter_config.json"
263
+ )
264
+ lora_path = os.path.dirname(adapter_weights_file)
265
  except Exception as e:
266
  print(f"❌ Failed to download LoRA {task_name}: {e}")
267
  continue
router_weights.pth CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:95494775139afe1350f5bb1f37f5a283ac47ed9d52baf1764dfff16cd6d561ed
3
  size 7395773
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e912e595c3e4543b8057747d8032d8c220664aef6a28cd34fc538b7ff89c739a
3
  size 7395773