DonImages commited on
Commit
f09410f
·
verified ·
1 Parent(s): cc04915

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -14
app.py CHANGED
@@ -1,19 +1,11 @@
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 = "./lora_checkpoint.pt" # Assuming the checkpoint is in the current folder
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)
 
1
+ import torch
2
 
3
+ # Check if CUDA (GPU) is available, otherwise use CPU
4
+ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
5
 
6
+ # Load the checkpoint
7
+ lora_path = "./lora_checkpoint.pt" # Path to the checkpoint file
 
 
8
  checkpoint = torch.load(lora_path, map_location=device)
9
 
10
+ # Print the checkpoint keys to inspect the structure
11
  print("Checkpoint keys:", checkpoint.keys())