NoQuest commited on
Commit
acd2c36
·
verified ·
1 Parent(s): c635636

Upload uploadSimpl2.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. uploadSimpl2.py +43 -0
uploadSimpl2.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ from huggingface_hub import HfApi, HfFolder
4
+ import os
5
+
6
+ # Save your token
7
+ HfFolder.save_token('...')
8
+
9
+ api = HfApi()
10
+
11
+ # Local path of the folder containing the model files
12
+ local_folder_path = "./Dockerfiles"
13
+
14
+ # Define the destination path in the repository
15
+ repo_id = "NoQuest/LLmSave"
16
+ repo_type = "model"
17
+
18
+ print(f"Uploading {local_folder_path} to {repo_id}...")
19
+
20
+ # Get a list of files and their sizes
21
+ file_sizes = []
22
+ for root, _, files in os.walk(local_folder_path):
23
+ for file in files:
24
+ file_path = os.path.join(root, file)
25
+ file_sizes.append((file_path, os.path.getsize(file_path)))
26
+
27
+ # Sort files by size (smallest to largest)
28
+ file_sizes.sort(key=lambda item: item[1])
29
+
30
+ # Upload files in order of size
31
+ for file_path, size in file_sizes:
32
+ print(f"Adding file: {file_path} (Size: {size} bytes)")
33
+ api.upload_file(
34
+ path_or_fileobj=file_path,
35
+ path_in_repo=os.path.relpath(file_path, local_folder_path),
36
+ repo_id=repo_id,
37
+ repo_type=repo_type,
38
+ )
39
+
40
+ print("Upload complete!")
41
+
42
+ #user@r-noquest-qp-anmixtao-5pisb5tc-14d83-d7h2k:/data$ ls LLmSave/
43
+ #Dockerfiles README.md models on_startup.sh