mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
fix: Strip whitespace from base conversion source and target representations
This commit is contained in:
parent
64de76a488
commit
d9a6295dc0
1 changed files with 4 additions and 4 deletions
|
|
@ -71,14 +71,14 @@ class BaseConversionDataset:
|
|||
value, source_base, target_base = self._generate_conversion(rng)
|
||||
|
||||
# Convert decimal to source base representation
|
||||
source_repr = format(value, f'x' if source_base == 16 else f'b' if source_base == 2 else '')
|
||||
source_repr = format(value, f'x' if source_base == 16 else f'b' if source_base == 2 else '').strip()
|
||||
if source_base not in (2, 16):
|
||||
source_repr = format(value, f'{source_base}x').rstrip('L').lower()
|
||||
source_repr = format(value, f'{source_base}x').rstrip('L').lower().strip()
|
||||
|
||||
# Convert decimal to target base for answer
|
||||
target_repr = format(value, f'x' if target_base == 16 else f'b' if target_base == 2 else '')
|
||||
target_repr = format(value, f'x' if target_base == 16 else f'b' if target_base == 2 else '').strip()
|
||||
if target_base not in (2, 16):
|
||||
target_repr = format(value, f'{target_base}x').rstrip('L').lower()
|
||||
target_repr = format(value, f'{target_base}x').rstrip('L').lower().strip()
|
||||
|
||||
source_name = self._format_base_name(source_base)
|
||||
target_name = self._format_base_name(target_base)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue