lemms commited on
Commit
d017b63
Β·
verified Β·
1 Parent(s): 59f1bf5

Add Space setup guide

Browse files
Files changed (1) hide show
  1. HUGGINGFACE_SPACE_SETUP_GUIDE.md +18 -20
HUGGINGFACE_SPACE_SETUP_GUIDE.md CHANGED
@@ -1,6 +1,6 @@
1
- # πŸš€ Hugging Face Space Setup Guide for OpenLLM Training (GitHub Secrets)
2
 
3
- This guide will help you set up proper authentication for Hugging Face Spaces using GitHub secrets so that your OpenLLM training and model uploads work correctly.
4
 
5
  ## 🎯 Overview
6
 
@@ -16,26 +16,24 @@ The issue you encountered was that training completed successfully in Hugging Fa
16
  4. Select "Write" role for full access
17
  5. Copy the generated token
18
 
19
- ### Step 2: Set Up GitHub Repository Secrets
20
 
21
- 1. Go to your GitHub repository:
22
  ```
23
- https://github.com/your-username/your-repo
24
  ```
25
 
26
- 2. Click on the "Settings" tab
27
 
28
- 3. In the left sidebar, click "Secrets and variables" β†’ "Actions"
29
 
30
- 4. Click "New repository secret"
31
-
32
- 5. Add a new secret:
33
  - **Name**: `HF_TOKEN`
34
- - **Value**: Your Hugging Face token from Step 1
35
 
36
- 6. Click "Add secret"
37
 
38
- **Note**: Hugging Face Spaces automatically have access to GitHub repository secrets, so you don't need to set them separately in the Space.
39
 
40
  ### Step 3: Verify Authentication in Your Space
41
 
@@ -47,15 +45,15 @@ import os
47
  from huggingface_hub import HfApi, whoami
48
 
49
  def verify_space_auth():
50
- """Verify authentication is working in the Space using GitHub secrets."""
51
- print("πŸ” Verifying Space Authentication (GitHub Secrets)")
52
 
53
- # Check if HF_TOKEN is set (from GitHub secrets)
54
  token = os.getenv("HF_TOKEN")
55
  if not token:
56
  print("❌ HF_TOKEN not found in Space environment")
57
- print(" - Please set HF_TOKEN in your GitHub repository secrets")
58
- print(" - Go to GitHub repository β†’ Settings β†’ Secrets and variables β†’ Actions")
59
  return False
60
 
61
  try:
@@ -69,7 +67,7 @@ def verify_space_auth():
69
  print(f"βœ… Authentication successful!")
70
  print(f" - Username: {username}")
71
  print(f" - Token: {token[:8]}...{token[-4:]}")
72
- print(f" - Source: GitHub secrets")
73
 
74
  # Test API access
75
  api = HfApi()
@@ -96,7 +94,7 @@ from huggingface_hub import HfApi, login, create_repo
96
  import json
97
 
98
  class SpaceTrainingManager:
99
- """Manages training and upload in Hugging Face Spaces using GitHub secrets."""
100
 
101
  def __init__(self):
102
  self.api = None
 
1
+ # πŸš€ Hugging Face Space Setup Guide for OpenLLM Training (HF Access Token)
2
 
3
+ This guide will help you set up proper authentication for Hugging Face Spaces using HF access token so that your OpenLLM training and model uploads work correctly.
4
 
5
  ## 🎯 Overview
6
 
 
16
  4. Select "Write" role for full access
17
  5. Copy the generated token
18
 
19
+ ### Step 2: Set Up HF Access Token in Space Settings
20
 
21
+ 1. Go to your Hugging Face Space settings:
22
  ```
23
+ https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME/settings
24
  ```
25
 
26
+ 2. Navigate to "Repository secrets" section
27
 
28
+ 3. Click "New secret"
29
 
30
+ 4. Add a new secret:
 
 
31
  - **Name**: `HF_TOKEN`
32
+ - **Value**: Your Hugging Face access token from Step 1 (starts with `hf_`)
33
 
34
+ 5. Click "Add secret"
35
 
36
+ **Note**: This token will be automatically available to your Space as the `HF_TOKEN` environment variable.
37
 
38
  ### Step 3: Verify Authentication in Your Space
39
 
 
45
  from huggingface_hub import HfApi, whoami
46
 
47
  def verify_space_auth():
48
+ """Verify authentication is working in the Space using HF access token."""
49
+ print("πŸ” Verifying Space Authentication (HF Access Token)")
50
 
51
+ # Check if HF_TOKEN is set (from Space settings)
52
  token = os.getenv("HF_TOKEN")
53
  if not token:
54
  print("❌ HF_TOKEN not found in Space environment")
55
+ print(" - Please set HF_TOKEN in your Space settings")
56
+ print(" - Go to Space settings β†’ Repository secrets")
57
  return False
58
 
59
  try:
 
67
  print(f"βœ… Authentication successful!")
68
  print(f" - Username: {username}")
69
  print(f" - Token: {token[:8]}...{token[-4:]}")
70
+ print(f" - Source: HF access token in Space settings")
71
 
72
  # Test API access
73
  api = HfApi()
 
94
  import json
95
 
96
  class SpaceTrainingManager:
97
+ """Manages training and upload in Hugging Face Spaces using HF access token."""
98
 
99
  def __init__(self):
100
  self.api = None