Upload deduplicate_clients.py with huggingface_hub
Browse files- deduplicate_clients.py +8 -5
deduplicate_clients.py
CHANGED
|
@@ -84,7 +84,7 @@ def create_dataset_from_deduplicated(deduplicated_list, features=None):
|
|
| 84 |
# Use 'versions' (plural) for the deduplicated split
|
| 85 |
features = Features({
|
| 86 |
'name': Value('string'),
|
| 87 |
-
'versions': Value('string'),
|
| 88 |
'capabilities': Value('string'),
|
| 89 |
'last_seen': Value('string'),
|
| 90 |
})
|
|
@@ -93,7 +93,7 @@ def create_dataset_from_deduplicated(deduplicated_list, features=None):
|
|
| 93 |
for client in deduplicated_list:
|
| 94 |
records.append({
|
| 95 |
'name': client['name'],
|
| 96 |
-
'versions': client['versions'],
|
| 97 |
'capabilities': capabilities_to_string(client['capabilities']),
|
| 98 |
'last_seen': client['last_seen'],
|
| 99 |
})
|
|
@@ -106,12 +106,15 @@ def push_to_hub(deduplicated_list, repo_id, split=None, token=None, private=Fals
|
|
| 106 |
dataset = create_dataset_from_deduplicated(deduplicated_list)
|
| 107 |
|
| 108 |
if split:
|
| 109 |
-
print(f"Pushing dataset to https://huggingface.co/datasets/{repo_id} (split: {split})", file=sys.stderr)
|
| 110 |
else:
|
| 111 |
-
print(f"Pushing dataset to https://huggingface.co/datasets/{repo_id}", file=sys.stderr)
|
| 112 |
|
|
|
|
|
|
|
| 113 |
dataset.push_to_hub(
|
| 114 |
repo_id=repo_id,
|
|
|
|
| 115 |
split=split,
|
| 116 |
token=token,
|
| 117 |
private=private,
|
|
@@ -220,7 +223,7 @@ Examples:
|
|
| 220 |
|
| 221 |
deduplicated.append({
|
| 222 |
'name': name,
|
| 223 |
-
'versions': versions_str,
|
| 224 |
'capabilities': latest_record['capabilities'],
|
| 225 |
'last_seen': latest_record['last_seen'],
|
| 226 |
})
|
|
|
|
| 84 |
# Use 'versions' (plural) for the deduplicated split
|
| 85 |
features = Features({
|
| 86 |
'name': Value('string'),
|
| 87 |
+
'versions': Value('string'),
|
| 88 |
'capabilities': Value('string'),
|
| 89 |
'last_seen': Value('string'),
|
| 90 |
})
|
|
|
|
| 93 |
for client in deduplicated_list:
|
| 94 |
records.append({
|
| 95 |
'name': client['name'],
|
| 96 |
+
'versions': client['versions'],
|
| 97 |
'capabilities': capabilities_to_string(client['capabilities']),
|
| 98 |
'last_seen': client['last_seen'],
|
| 99 |
})
|
|
|
|
| 106 |
dataset = create_dataset_from_deduplicated(deduplicated_list)
|
| 107 |
|
| 108 |
if split:
|
| 109 |
+
print(f"Pushing dataset to https://huggingface.co/datasets/{repo_id} (config: deduplicated, split: {split})", file=sys.stderr)
|
| 110 |
else:
|
| 111 |
+
print(f"Pushing dataset to https://huggingface.co/datasets/{repo_id} (config: deduplicated)", file=sys.stderr)
|
| 112 |
|
| 113 |
+
# Push to hub with explicit config_name to avoid creating "default" config
|
| 114 |
+
# This ensures the data goes to the "deduplicated" config, not a "default" config
|
| 115 |
dataset.push_to_hub(
|
| 116 |
repo_id=repo_id,
|
| 117 |
+
config_name="deduplicated", # Explicitly set config name to avoid "default" config creation
|
| 118 |
split=split,
|
| 119 |
token=token,
|
| 120 |
private=private,
|
|
|
|
| 223 |
|
| 224 |
deduplicated.append({
|
| 225 |
'name': name,
|
| 226 |
+
'versions': versions_str,
|
| 227 |
'capabilities': latest_record['capabilities'],
|
| 228 |
'last_seen': latest_record['last_seen'],
|
| 229 |
})
|