File size: 7,199 Bytes
ebe598e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# βš™οΈ App Configuration Guide

## Overview

The Trackio app now includes a **Configuration tab** that allows you to set your Hugging Face token and dataset repository directly through the interface, providing an alternative to environment variables.

## πŸš€ New Features

### **Configuration Tab**
- βœ… **HF Token Input**: Secure password field for your Hugging Face token
- βœ… **Dataset Repository Input**: Text field for your dataset repository
- βœ… **Update Configuration**: Apply new settings and reload experiments
- βœ… **Test Connection**: Verify access to the dataset repository
- βœ… **Create Dataset**: Create a new dataset repository if it doesn't exist

### **Flexible Configuration**
- βœ… **Environment Variables**: Still supported as fallback
- βœ… **Interface Input**: New direct input method
- βœ… **Dynamic Updates**: Change configuration without restarting
- βœ… **Validation**: Input validation and error handling

## πŸ“‹ Configuration Tab Usage

### **1. Access the Configuration Tab**
- Open the Trackio app
- Click on the "βš™οΈ Configuration" tab
- You'll see input fields for HF Token and Dataset Repository

### **2. Set Your HF Token**
```
Hugging Face Token: hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```
- **Type**: Password field (hidden for security)
- **Required**: Yes (for dataset access)
- **Format**: Your HF token starting with `hf_`
- **Help**: Click the help text for instructions on getting your token

### **3. Set Your Dataset Repository**
```
Dataset Repository: your-username/your-dataset-name
```
- **Type**: Text field
- **Required**: No (defaults to `tonic/trackio-experiments`)
- **Format**: `username/dataset-name`
- **Examples**: 
  - `tonic/trackio-experiments`
  - `your-username/my-experiments`
  - `your-org/team-experiments`

### **4. Use the Action Buttons**

#### **Update Configuration**
- Applies new settings immediately
- Reloads experiments with new configuration
- Shows current status and experiment count

#### **Test Connection**
- Verifies access to the dataset repository
- Tests HF token permissions
- Shows dataset information and experiment count

#### **Create Dataset**
- Creates a new dataset repository if it doesn't exist
- Sets up the correct schema for experiments
- Makes the dataset private by default

## πŸ”§ Configuration Methods

### **Method 1: Interface Input (New)**
1. Go to "βš™οΈ Configuration" tab
2. Enter your HF token and dataset repository
3. Click "Update Configuration"
4. Verify with "Test Connection"

### **Method 2: Environment Variables (Existing)**
```bash
# Set environment variables
export HF_TOKEN=your_hf_token_here
export TRACKIO_DATASET_REPO=your-username/your-dataset-name

# Or for HF Spaces, add to Space settings
HF_TOKEN=your_hf_token_here
TRACKIO_DATASET_REPO=your-username/your-dataset-name
```

### **Method 3: Hybrid Approach**
- Set environment variables as defaults
- Override specific values through the interface
- Interface values take precedence over environment variables

## πŸ“Š Configuration Priority

The app uses this priority order for configuration:

1. **Interface Input** (highest priority)
2. **Environment Variables** (fallback)
3. **Default Values** (lowest priority)

## πŸ› οΈ Getting Your HF Token

### **Step-by-Step Instructions**
1. Go to [Hugging Face Settings](https://huggingface.co/settings/tokens)
2. Click "New token"
3. Give it a name (e.g., "Trackio Access")
4. Select "Write" permissions
5. Click "Generate token"
6. Copy the token (starts with `hf_`)
7. Paste it in the app's HF Token field

### **Token Permissions**
- **Read**: Required for loading experiments
- **Write**: Required for saving experiments
- **Scope**: Should have access to your dataset repositories

## πŸ“ Dataset Repository Format

### **Correct Format**
```
username/dataset-name
```

### **Examples**
- `tonic/trackio-experiments` (default)
- `your-username/my-experiments`
- `your-org/team-experiments`
- `your-username/smollm3-experiments`

### **Validation**
- Must contain exactly one `/`
- Username must be valid HF username
- Dataset name must be valid (alphanumeric + hyphens)

## πŸ” Testing Your Configuration

### **1. Test Connection**
- Enter your HF token and dataset repository
- Click "Test Connection"
- Should show: "βœ… Connection successful!"

### **2. Create Dataset (if needed)**
- If dataset doesn't exist, click "Create Dataset"
- Should show: "βœ… Dataset created successfully!"

### **3. Update Configuration**
- Click "Update Configuration"
- Should show: "βœ… Configuration updated successfully!"

## 🚨 Troubleshooting

### **Issue: "Please provide a Hugging Face token"**
**Solution**: 
- Enter your HF token in the interface
- Or set the `HF_TOKEN` environment variable

### **Issue: "Connection failed: 401 Unauthorized"**
**Solutions**:
1. Check your HF token is correct
2. Verify the token has read access to the dataset
3. Ensure the dataset repository exists

### **Issue: "Failed to create dataset"**
**Solutions**:
1. Check your HF token has write permissions
2. Verify the username in the repository name
3. Ensure the dataset name is valid

### **Issue: "Dataset repository must be in format: username/dataset-name"**
**Solution**: 
- Use the correct format: `username/dataset-name`
- Example: `your-username/my-experiments`

## πŸ“ˆ Benefits

### **For Users**
- βœ… **Easy Setup**: No need to set environment variables
- βœ… **Visual Interface**: Clear input fields and validation
- βœ… **Immediate Feedback**: Test connection and see results
- βœ… **Flexible**: Can change configuration anytime

### **For Development**
- βœ… **Backward Compatible**: Environment variables still work
- βœ… **Fallback Support**: Graceful degradation
- βœ… **Error Handling**: Clear error messages
- βœ… **Validation**: Input validation and testing

### **For Deployment**
- βœ… **HF Spaces Ready**: Works on Hugging Face Spaces
- βœ… **No Restart Required**: Dynamic configuration updates
- βœ… **Secure**: Password field for token input
- βœ… **User-Friendly**: Clear instructions and help text

## 🎯 Usage Examples

### **Basic Setup**
1. Open the app
2. Go to "βš™οΈ Configuration" tab
3. Enter your HF token
4. Enter your dataset repository
5. Click "Update Configuration"
6. Click "Test Connection" to verify

### **Advanced Setup**
1. Set environment variables as defaults
2. Use interface to override specific values
3. Test connection to verify access
4. Create dataset if it doesn't exist
5. Start using the app with persistent storage

### **Team Setup**
1. Create a shared dataset repository
2. Share the repository name with team
3. Each team member sets their own HF token
4. All experiments are stored in the shared dataset

## πŸ“‹ Configuration Status

The app shows current configuration status:
```
πŸ“Š Dataset: your-username/your-dataset
πŸ”‘ HF Token: Set
πŸ“ˆ Experiments: 5
```

## πŸ”„ Updating Configuration

You can update configuration at any time:
1. Go to "βš™οΈ Configuration" tab
2. Change HF token or dataset repository
3. Click "Update Configuration"
4. Experiments will reload with new settings

---

**πŸŽ‰ Your Trackio app is now more flexible and user-friendly with direct configuration input!**