Fix hyperparameter parsing for read-only mode

- Improved CSV parsing logic for hyperparameters with empty type cells
- Enhanced read-only mode sheet access with multiple URL formats and GID mapping
- Added debug logging to identify parameter type mismatches
- Fixed UnboundLocalError for max_size variable
- Fixed unused variable warnings

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
warproxxx
2025-06-22 10:18:29 -07:00
parent dacee40482
commit ee24553856
3 changed files with 33 additions and 3 deletions
+19 -2
View File
@@ -44,7 +44,24 @@ def get_sheet_df(read_only=None):
hyperparams, current_type = {}, None
for r in records:
current_type = r['type'] or current_type
hyperparams.setdefault(current_type, {})[r['param']] = r['value']
# Update current_type only when we have a non-empty type value
if r['type'] and r['type'].strip():
current_type = r['type'].strip()
# Skip rows where we don't have a current_type set
if current_type:
# Convert numeric values to appropriate types
value = r['value']
try:
# Try to convert to float if it's numeric
if isinstance(value, str) and value.replace('.', '').replace('-', '').isdigit():
value = float(value)
elif isinstance(value, (int, float)):
value = float(value)
except (ValueError, TypeError):
pass # Keep as string if conversion fails
hyperparams.setdefault(current_type, {})[r['param']] = value
print(f"DEBUG: Loaded hyperparameters: {hyperparams}")
return result, hyperparams