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

Support unicode in metric data better. #2575

Closed
squirrelsc opened this issue Jun 18, 2020 · 1 comment
Closed

Support unicode in metric data better. #2575

squirrelsc opened this issue Jun 18, 2020 · 1 comment
Labels
enhancement New feature or request nnidev

Comments

@squirrelsc
Copy link
Member

Environment:

  • NNI version: master(nnictl, post v1.6)/1.4(worker)
  • NNI mode (local|remote|pai): pai
  • Client OS: Ubuntu
  • Server OS (for remote mode only):
  • Python version: py3.x
  • PyTorch/TensorFlow version: PyTorch
  • Is conda/virtualenv/venv used?: No
  • Is running in Docker?: Yes

What issue meet, what's expected?:

note, it may be caused by an inconsistent old version of NNI, and it needs to be monitored. If there are similar issues, it can be fixed by this solution.

This metric message, which is received in nniDataStore.storeMetricData causes an error

{"sequence": 0, "trial_job_id": "Do57b", "value": "{\\\\"default\\\\": 0.0006907543685855333, \\\\"detail\\\\": [0.0009301810563630108, 0.0007786923064047202, 0.00036338974298886936], \\\\"flops\\\\": 45699600.0}", "type": "FINAL", "parameter_id": 0}
SyntaxError: Unexpected token d in JSON at position 55

It causes by str.encode('utf8') in python code is not processed correctly. And it needs to be unescaped like below.

JSON.parse('"' + str.split('"').join('\\"') + '"');
@liuzhe-lz
Copy link
Contributor

Should not be a problem in latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request nnidev
Projects
None yet
Development

No branches or pull requests

3 participants