Spaces:
Sleeping
Sleeping
fix(dataset): enable trust_remote_code for BigBio; robust load_dataset retry
Browse files
app.py
CHANGED
|
@@ -64,12 +64,15 @@ def _train_ner_lora(
|
|
| 64 |
if lower_spec in alias_map:
|
| 65 |
ds_name, ds_config = alias_map[lower_spec]
|
| 66 |
log(f"Using alias mapping: {ds_spec} -> {ds_name}:{ds_config}")
|
| 67 |
-
ds = load_dataset(ds_name, ds_config)
|
| 68 |
elif ":" in ds_spec:
|
| 69 |
ds_name, ds_config = [s.strip() for s in ds_spec.split(":", 1)]
|
| 70 |
-
|
|
|
|
|
|
|
| 71 |
else:
|
| 72 |
-
|
|
|
|
| 73 |
except Exception as e:
|
| 74 |
# Fallback: if it looks like 'name:config' but was treated as a local path, try explicit two-arg call
|
| 75 |
err_msg = str(e)
|
|
@@ -78,7 +81,8 @@ def _train_ner_lora(
|
|
| 78 |
try:
|
| 79 |
ds_name, ds_config = [s.strip() for s in ds_spec.split(":", 1)]
|
| 80 |
log(f"Retrying with split name/config: {ds_name}, {ds_config}")
|
| 81 |
-
|
|
|
|
| 82 |
except Exception as e2:
|
| 83 |
log(f"Retry failed: {e2}")
|
| 84 |
raise
|
|
|
|
| 64 |
if lower_spec in alias_map:
|
| 65 |
ds_name, ds_config = alias_map[lower_spec]
|
| 66 |
log(f"Using alias mapping: {ds_spec} -> {ds_name}:{ds_config}")
|
| 67 |
+
ds = load_dataset(ds_name, ds_config, trust_remote_code=True)
|
| 68 |
elif ":" in ds_spec:
|
| 69 |
ds_name, ds_config = [s.strip() for s in ds_spec.split(":", 1)]
|
| 70 |
+
# If loading from community repo, allow remote code
|
| 71 |
+
trust = "/" in ds_name
|
| 72 |
+
ds = load_dataset(ds_name, ds_config, trust_remote_code=trust)
|
| 73 |
else:
|
| 74 |
+
trust = "/" in ds_spec
|
| 75 |
+
ds = load_dataset(ds_spec, trust_remote_code=trust)
|
| 76 |
except Exception as e:
|
| 77 |
# Fallback: if it looks like 'name:config' but was treated as a local path, try explicit two-arg call
|
| 78 |
err_msg = str(e)
|
|
|
|
| 81 |
try:
|
| 82 |
ds_name, ds_config = [s.strip() for s in ds_spec.split(":", 1)]
|
| 83 |
log(f"Retrying with split name/config: {ds_name}, {ds_config}")
|
| 84 |
+
trust = "/" in ds_name
|
| 85 |
+
ds = load_dataset(ds_name, ds_config, trust_remote_code=trust)
|
| 86 |
except Exception as e2:
|
| 87 |
log(f"Retry failed: {e2}")
|
| 88 |
raise
|