orionhunts-ai
commited on
Commit
•
8b43b4a
1
Parent(s):
476d115
CR Model selection and implemented WandB for SKlearn
Browse files- push_to_hf.sh +40 -0
push_to_hf.sh
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
# Function to check if already authenticated
|
4 |
+
check_authentication() {
|
5 |
+
if hf_user_info=$(huggingface-cli whoami 2>&1); then
|
6 |
+
echo "Already authenticated as: $hf_user_info"
|
7 |
+
return 0
|
8 |
+
else
|
9 |
+
echo "Not authenticated. Please log in."
|
10 |
+
return 1
|
11 |
+
fi
|
12 |
+
}
|
13 |
+
|
14 |
+
# Function to log in
|
15 |
+
login_huggingface() {
|
16 |
+
echo "Logging in to Hugging Face..."
|
17 |
+
huggingface-cli login
|
18 |
+
}
|
19 |
+
|
20 |
+
# Function to push the file to Hugging Face Hub
|
21 |
+
push_to_hub() {
|
22 |
+
local file_path="$1"
|
23 |
+
local repo_name="$2"
|
24 |
+
|
25 |
+
if [ -z "$file_path" ] || [ -z "$repo_name" ]; then
|
26 |
+
echo "Usage: push_to_hub <file_path> <repo_name>"
|
27 |
+
exit 1
|
28 |
+
fi
|
29 |
+
|
30 |
+
echo "Pushing $file_path to Hugging Face Hub in repo $repo_name..."
|
31 |
+
huggingface-cli upload "$file_path" --repo-id "$repo_name"
|
32 |
+
}
|
33 |
+
|
34 |
+
# Main script
|
35 |
+
if ! check_authentication; then
|
36 |
+
login_huggingface
|
37 |
+
fi
|
38 |
+
|
39 |
+
# Example usage: pass the file path and repo name as arguments
|
40 |
+
push_to_hub "$1" "$2"
|