Instructions to use microsoft/Magma-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/Magma-8B with Transformers:
# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("microsoft/Magma-8B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
remove .transformer
Browse files- image_tower_magma.py +0 -7
image_tower_magma.py
CHANGED
|
@@ -181,13 +181,6 @@ def create_model(
|
|
| 181 |
model.to(device=device, dtype=dtype)
|
| 182 |
else:
|
| 183 |
model.to(dtype=dtype)
|
| 184 |
-
from .transformer import LayerNormFp32
|
| 185 |
-
|
| 186 |
-
def _convert_ln(m):
|
| 187 |
-
if isinstance(m, LayerNormFp32):
|
| 188 |
-
m.weight.data = m.weight.data.to(torch.float32)
|
| 189 |
-
m.bias.data = m.bias.data.to(torch.float32)
|
| 190 |
-
model.apply(_convert_ln)
|
| 191 |
else:
|
| 192 |
model.to(device=device)
|
| 193 |
convert_weights_to_lp(model, dtype=dtype)
|
|
|
|
| 181 |
model.to(device=device, dtype=dtype)
|
| 182 |
else:
|
| 183 |
model.to(dtype=dtype)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
else:
|
| 185 |
model.to(device=device)
|
| 186 |
convert_weights_to_lp(model, dtype=dtype)
|