Spaces:
Build error
Build error
Commit ·
5a1d1f2
1
Parent(s): 082b37f
updated
Browse files
app.py
CHANGED
|
@@ -29,16 +29,9 @@ device = "cpu"
|
|
| 29 |
model_id = "satyanayak/custom-smallmv2135"
|
| 30 |
checkpoint_path = hf_hub_download(repo_id=model_id, filename="model-dict-step-5500.pt")
|
| 31 |
|
| 32 |
-
checkpoint = torch.load(checkpoint_path, map_location=device
|
| 33 |
model.load_state_dict(checkpoint['model_state_dict'])
|
| 34 |
model.to(device)
|
| 35 |
-
|
| 36 |
-
checkpoint = torch.load(
|
| 37 |
-
"model-dict-step-5500.pt",
|
| 38 |
-
map_location="cpu"
|
| 39 |
-
)
|
| 40 |
-
model.load_state_dict(checkpoint['model_state_dict']) # Extract model weights
|
| 41 |
-
model.to(device)
|
| 42 |
model.eval()
|
| 43 |
|
| 44 |
def generate_text(prompt, max_length=100, temperature=0.7, top_k=50):
|
|
|
|
| 29 |
model_id = "satyanayak/custom-smallmv2135"
|
| 30 |
checkpoint_path = hf_hub_download(repo_id=model_id, filename="model-dict-step-5500.pt")
|
| 31 |
|
| 32 |
+
checkpoint = torch.load(checkpoint_path, map_location=device)
|
| 33 |
model.load_state_dict(checkpoint['model_state_dict'])
|
| 34 |
model.to(device)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
model.eval()
|
| 36 |
|
| 37 |
def generate_text(prompt, max_length=100, temperature=0.7, top_k=50):
|