Skip to content

The best ChatGPT that $100 can buy.

Python

Merge branch 'master' into master

Andrej3a2ae631c4d5
diff --cc nanochat/common.py
index 2195a9f,ee02a6e..d4a9828
--- a/nanochat/common.py
+++ b/nanochat/common.py
@@@ -70,9 -70,13 +70,11 @@@ def download_file_with_lock(url, filena
if os.path.exists(file_path):
return file_path
- with open(lock_path, 'w', encoding='utf-8') as lock_file:
-
+ with FileLock(lock_path):
+ # Only a single rank can acquire this lock
+ # All other ranks block until it is released
- fcntl.flock(lock_file.fileno(), fcntl.LOCK_EX)
-- # Recheck after acquiring lock (another process may have downloaded it)
++ # Recheck after acquiring lock
if os.path.exists(file_path):
return file_path