Upload train_autogrow.py with huggingface_hub
Browse files- train_autogrow.py +3 -1
train_autogrow.py
CHANGED
|
@@ -93,7 +93,8 @@ def run_test(model, tokenizer, step):
|
|
| 93 |
for i in range(10):
|
| 94 |
t = torch.tensor([1000 - (i*100) - 1], device="cuda").long()
|
| 95 |
pred = model(torch.cat([p_emb, r_noise], dim=1), t)
|
| 96 |
-
|
|
|
|
| 97 |
norm_weights = F.normalize(model.token_embedding.weight, dim=-1)
|
| 98 |
norm_r = F.normalize(r_noise, dim=-1)
|
| 99 |
logits = torch.matmul(norm_r, norm_weights.T)
|
|
@@ -148,6 +149,7 @@ if __name__ == "__main__":
|
|
| 148 |
log("Syncing to HF...")
|
| 149 |
try:
|
| 150 |
api.upload_file(path_or_fileobj=ckpt_path, path_in_repo=f"cropmark_{step}.pt", repo_id=REPO_ID, token=HF_TOKEN)
|
|
|
|
| 151 |
api.upload_file(path_or_fileobj="train_autogrow.py", path_in_repo="train_autogrow.py", repo_id=REPO_ID, token=HF_TOKEN)
|
| 152 |
except Exception as e: log(f"HF Sync Error: {e}")
|
| 153 |
step += 1
|
|
|
|
| 93 |
for i in range(10):
|
| 94 |
t = torch.tensor([1000 - (i*100) - 1], device="cuda").long()
|
| 95 |
pred = model(torch.cat([p_emb, r_noise], dim=1), t)
|
| 96 |
+
r_0_pred = pred[:, MAX_PROMPT_LEN:, :]
|
| 97 |
+
r_noise = 0.4 * r_noise + 0.6 * r_0_pred
|
| 98 |
norm_weights = F.normalize(model.token_embedding.weight, dim=-1)
|
| 99 |
norm_r = F.normalize(r_noise, dim=-1)
|
| 100 |
logits = torch.matmul(norm_r, norm_weights.T)
|
|
|
|
| 149 |
log("Syncing to HF...")
|
| 150 |
try:
|
| 151 |
api.upload_file(path_or_fileobj=ckpt_path, path_in_repo=f"cropmark_{step}.pt", repo_id=REPO_ID, token=HF_TOKEN)
|
| 152 |
+
api.upload_file(path_or_fileobj=CHECKPOINT_LOG, path_in_repo="checkpoint_log.txt", repo_id=REPO_ID, token=HF_TOKEN)
|
| 153 |
api.upload_file(path_or_fileobj="train_autogrow.py", path_in_repo="train_autogrow.py", repo_id=REPO_ID, token=HF_TOKEN)
|
| 154 |
except Exception as e: log(f"HF Sync Error: {e}")
|
| 155 |
step += 1
|