Instructions to use prosoro/ballnet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prosoro/ballnet with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("prosoro/ballnet", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Delete modify_safetensors.py
Browse files- modify_safetensors.py +0 -32
modify_safetensors.py
DELETED
|
@@ -1,32 +0,0 @@
|
|
| 1 |
-
from safetensors import safe_open
|
| 2 |
-
from safetensors.torch import save_file
|
| 3 |
-
import torch
|
| 4 |
-
|
| 5 |
-
# ==========================================================
|
| 6 |
-
# 1. Load original safetensors
|
| 7 |
-
# ==========================================================
|
| 8 |
-
input_path = "model.safetensors"
|
| 9 |
-
output_path = "model_fixed.safetensors"
|
| 10 |
-
|
| 11 |
-
new_state_dict = {}
|
| 12 |
-
|
| 13 |
-
with safe_open(input_path, framework="pt", device="cpu") as f:
|
| 14 |
-
for key in f.keys():
|
| 15 |
-
tensor = f.get_tensor(key)
|
| 16 |
-
# Add prefix "model." if not already
|
| 17 |
-
new_key = key if key.startswith("model.") else f"model.{key}"
|
| 18 |
-
new_state_dict[new_key] = tensor
|
| 19 |
-
|
| 20 |
-
metadata = {
|
| 21 |
-
"format": "pt",
|
| 22 |
-
}
|
| 23 |
-
# ==========================================================
|
| 24 |
-
# 2. Save to new safetensors file
|
| 25 |
-
# ==========================================================
|
| 26 |
-
save_file(new_state_dict, output_path, metadata=metadata)
|
| 27 |
-
print(f"✅ Saved updated safetensors to {output_path}")
|
| 28 |
-
print(f"✅ Total tensors: {len(new_state_dict)}")
|
| 29 |
-
|
| 30 |
-
# Optional: verify one sample
|
| 31 |
-
print("Example tensor key:", list(new_state_dict.keys())[0])
|
| 32 |
-
print("Shape:", new_state_dict[list(new_state_dict.keys())[0]].shape)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|