Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Inspecting the keys: This will show you the structure of the checkpoint and help you identify the correct components to load into your model.
|
| 2 |
+
|
| 3 |
+
import torch # Import torch for loading the checkpoint
|
| 4 |
+
|
| 5 |
+
# Set the path to the LoRA checkpoint file
|
| 6 |
+
lora_path = "/path/to/your/lora_checkpoint.pt" # Replace with the correct path
|
| 7 |
+
|
| 8 |
+
# Load the checkpoint from the specified path
|
| 9 |
+
checkpoint = torch.load(lora_path, map_location=device)
|
| 10 |
+
|
| 11 |
+
# Print the keys to see the structure
|
| 12 |
+
print("Checkpoint keys:", checkpoint.keys())
|
| 13 |
+
|
| 14 |
+
# If you want to inspect the values of a specific key
|
| 15 |
+
for key in checkpoint.keys():
|
| 16 |
+
print(f"Key: {key}, Value shape: {checkpoint[key].shape if hasattr(checkpoint[key], 'shape') else 'N/A'}")
|
| 17 |
+
|
| 18 |
+
# You can also print the entire checkpoint if it is not too large
|
| 19 |
+
# print(checkpoint)
|