Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scientific notation number in list not converted correctly in cloned task #313

Closed
trbschneider opened this issue Feb 24, 2021 · 3 comments
Closed

Comments

@trbschneider
Copy link

Description

I encountered a problem when cloning a task from the webui where the Hyperparameters contain a list or tuple with scientific notation (such as 2e-6 etc). When running the task the first time, it runs fine but when cloning the task and running again, the numeric value in scientific notation is interpreted as a string. See below for minimal example to reproduce:

Code

from clearml import Task
task = Task.init()
parameters = {
    'list': [1.0, 2e-6],    
}
parameters = task.connect(parameters)
print(parameters)
print(parameters['list'][1]-parameters['list'][0])

Steps to reproduce

(I reproduced the issue on google collab and with the clearml demoserver)

  1. Run above code
    Output:
{'list': [1.0, 2e-06]}
-0.999998
  1. Clone task on web UI and enqueue
  2. Cloned task will fail due to type mismatch between list items
    Output:
{'list': [1.0, '2e-06']}
Traceback (most recent call last):
File "/root/.clearml/venvs-builds/3.7/code/Untitled17.py", line 10, in <module>
print(parameters['list'][1]-parameters['list'][0])
TypeError: unsupported operand type(s) for -: 'str' and 'float'

Software versions

clearml==0.17.4
Clearml server version: 0.17.0-67 (https://demoapp.demo.clear.ml/)

@bmartinn
Copy link
Member

bmartinn commented Feb 24, 2021

Thank you @trbschneider , we were able to reproduce and confirm the issue.
It seems to stem from PyYAML parsing of the text, basically '2.0e-06' will be parsed as float but '2e-06' will be parsed as string. Apparently the scientific-notation is a known PyYAML issue.
Let me see what we can do, I'll update here once there is a working fix.

@bmartinn
Copy link
Member

bmartinn commented Mar 2, 2021

Hi @trbschneider
Good news, the fix is available :)
Feel free to test it with:

pip install git+https://github.com/allegroai/clearml.git

@jkhenning
Copy link
Member

Closing this as it was already released. Please reopen if required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants