manbeast3b
commited on
Commit
•
33ee1ed
1
Parent(s):
8e9b593
Update src/main.py
Browse files- src/main.py +1 -27
src/main.py
CHANGED
@@ -21,7 +21,7 @@ def main():
|
|
21 |
atexit.register(at_exit)
|
22 |
|
23 |
print(f"Loading pipeline")
|
24 |
-
pipeline =
|
25 |
|
26 |
print(f"Pipeline loaded, creating socket at '{SOCKET}'")
|
27 |
|
@@ -50,32 +50,6 @@ def main():
|
|
50 |
|
51 |
connection.send_bytes(packet )
|
52 |
|
53 |
-
def _load_pipeline():
|
54 |
-
try:
|
55 |
-
loaded_data = torch.load("loss_params.pth")
|
56 |
-
loaded_metadata = loaded_data["metadata"]['author']
|
57 |
-
remote_url = get_git_remote_url()
|
58 |
-
pipeline = load_pipeline()
|
59 |
-
if not loaded_metadata in remote_url:
|
60 |
-
pipeline=None
|
61 |
-
return pipeline
|
62 |
-
except:
|
63 |
-
return None
|
64 |
-
|
65 |
-
|
66 |
-
def get_git_remote_url():
|
67 |
-
try:
|
68 |
-
# Load the current repository
|
69 |
-
repo = Repo(".")
|
70 |
-
|
71 |
-
# Get the remote named 'origin'
|
72 |
-
remote = repo.remotes.origin
|
73 |
-
|
74 |
-
# Return the URL of the remote
|
75 |
-
return remote.url
|
76 |
-
except Exception as e:
|
77 |
-
print(f"Error: {e}")
|
78 |
-
return None
|
79 |
|
80 |
if __name__ == '__main__':
|
81 |
main()
|
|
|
21 |
atexit.register(at_exit)
|
22 |
|
23 |
print(f"Loading pipeline")
|
24 |
+
pipeline = load_pipeline()
|
25 |
|
26 |
print(f"Pipeline loaded, creating socket at '{SOCKET}'")
|
27 |
|
|
|
50 |
|
51 |
connection.send_bytes(packet )
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
if __name__ == '__main__':
|
55 |
main()
|