ZeroUniqueness commited on
Commit
f967b08
2 Parent(s): 0acb17c 7dfc068

Merge branch 'main' of https://huggingface.co/ZeroUniqueness/qlora-llama2-13b

Browse files
Files changed (1) hide show
  1. gitsaves.py +30 -0
gitsaves.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import time
3
+ import subprocess
4
+
5
+ # Function to update .gitignore file
6
+ def update_gitignore():
7
+ with open(".gitignore", "w") as gitignore_file:
8
+ gitignore_file.write("gitsaves.py\n")
9
+
10
+ # Function to perform git commit and push
11
+ def git_commit_and_push():
12
+ current_time = time.strftime("%Y-%m-%d %H:%M:%S")
13
+ commit_message = f"{current_time} Autosave for checkpoint additions"
14
+
15
+ print("Pushing with commit `"+commit_message+"`")
16
+ subprocess.run(["git", "add", "."])
17
+ subprocess.run(["git", "commit", "-m", commit_message])
18
+ subprocess.run(["git", "push"])
19
+
20
+ # Main loop
21
+ if __name__ == "__main__":
22
+ try:
23
+ while True:
24
+ update_gitignore()
25
+ git_commit_and_push()
26
+ print(f"Autosaved at {time.strftime('%H:%M:%S')}")
27
+ time.sleep(600) # Sleep for 10 minutes (600 seconds)
28
+ except KeyboardInterrupt:
29
+ print("Autosave stopped.")
30
+