Update README.md
Browse files
README.md
CHANGED
|
@@ -98,30 +98,19 @@ model = xlora.from_pretrained(
|
|
| 98 |
"cuda",
|
| 99 |
)
|
| 100 |
```
|
| 101 |
-
## Loading pre-trained X-LoRA model
|
| 102 |
|
| 103 |
```python
|
| 104 |
import torch
|
| 105 |
-
from xlora.xlora_utils import load_model
|
| 106 |
|
| 107 |
-
|
| 108 |
|
| 109 |
-
model,
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
adapters={
|
| 115 |
-
"adapter_1": "lamm-mit/x-lora/X-LoRA_adapters/1/",
|
| 116 |
-
"adapter_2": "lamm-mit/x-lora/X-LoRA_adapters/2/",
|
| 117 |
-
"adapter_3": "lamm-mit/x-lora/X-LoRA_adapters/3/",
|
| 118 |
-
"adapter_4": "lamm-mit/x-lora/X-LoRA_adapters/4/",
|
| 119 |
-
"adapter_5": "lamm-mit/x-lora/X-LoRA_adapters/5/",
|
| 120 |
-
"adapter_6": "lamm-mit/x-lora/X-LoRA_adapters/6/",
|
| 121 |
-
"adapter_7": "lamm-mit/x-lora/X-LoRA_adapters/7/",
|
| 122 |
-
"adapter_8": "lamm-mit/x-lora/X-LoRA_adapters/8/",
|
| 123 |
-
"adapter_9": "lamm-mit/x-lora/X-LoRA_adapters/9/",
|
| 124 |
-
},
|
| 125 |
)
|
| 126 |
```
|
| 127 |
Inference:
|
|
|
|
| 98 |
"cuda",
|
| 99 |
)
|
| 100 |
```
|
| 101 |
+
## Loading pre-trained X-LoRA model directly from Hugging Face Hub
|
| 102 |
|
| 103 |
```python
|
| 104 |
import torch
|
| 105 |
+
from xlora.xlora_utils import load_model
|
| 106 |
|
| 107 |
+
XLoRa_model_name = 'lamm-mit/x-lora'
|
| 108 |
|
| 109 |
+
model,tokenizer=load_model(model_name = XLoRa_model_name,
|
| 110 |
+
device='cuda:0',
|
| 111 |
+
use_flash_attention_2=True,
|
| 112 |
+
dtype=torch.bfloat16,
|
| 113 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
)
|
| 115 |
```
|
| 116 |
Inference:
|