aamixsh commited on
Commit
ab42b4a
·
1 Parent(s): 4756c21

Run zero_to_fp32.py and commit changes

Browse files
Files changed (1) hide show
  1. upload_to_huggingface.py +9 -2
upload_to_huggingface.py CHANGED
@@ -3,12 +3,19 @@ import os
3
 
4
  # Define the paths
5
  converter_path = './zero_to_fp32.py'
6
- commit_message = 'Run zero_to_fp32.py and commit changes'
7
 
8
  # Extract the model
9
  subprocess.run(['python', converter_path, ".", "pytorch_model.bin"], check=True)
10
 
11
  # Commit and push
 
 
 
 
 
 
 
12
  subprocess.run(['git', 'add', '.'], check=True)
13
- subprocess.run(['git', 'commit', '-m', commit_message], check=True)
14
  subprocess.run(['git', 'push'], check=True)
 
3
 
4
  # Define the paths
5
  converter_path = './zero_to_fp32.py'
6
+ huggingface_repo = 'https://huggingface.co/TannerGladson/chess-roberta-whole-move-pretrained'
7
 
8
  # Extract the model
9
  subprocess.run(['python', converter_path, ".", "pytorch_model.bin"], check=True)
10
 
11
  # Commit and push
12
+ # Check if the current directory is a git repository
13
+ if not os.path.exists('.git'):
14
+ result = subprocess.run(['git', 'clone', huggingface_repo, '.'])
15
+ if result.returncode != 0:
16
+ raise RuntimeError("Failed to clone the repository.")
17
+
18
+ subprocess.run(['git', 'lfs', 'install'], check=True)
19
  subprocess.run(['git', 'add', '.'], check=True)
20
+ subprocess.run(['git', 'commit', '-m', 'Run zero_to_fp32.py and commit changes'], check=True)
21
  subprocess.run(['git', 'push'], check=True)