Giter Club home page Giter Club logo

Comments (4)

sakshimaskara07 avatar sakshimaskara07 commented on July 2, 2024 1

I am getting the same error with cuda set to false
TypeError: tensor(0.6204) is not JSON serializable

Traceback (most recent call last):
File "supervised.py", line 93, in
logger.info("log:%s" % json.dumps(to_log))
File "/usr/lib/python2.7/json/init.py", line 244, in dumps
return _default_encoder.encode(obj)
File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib/python2.7/json/encoder.py", line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")

from muse.

glample avatar glample commented on July 2, 2024

Which version of PyTorch are you using?

from muse.

prabhakar267 avatar prabhakar267 commented on July 2, 2024

PyTorch version: 0.4.0
CUDA version: V9.0.176
Python version: 3.6

from muse.

glample avatar glample commented on July 2, 2024

This is most likely due to the last version of PyTorch -- many changes appeared in the version 0.4.0 (actually I'm quite surprised the script did not fail before line 93).

Looking at the error it looks like there is something in to_log which is a PyTorch object (maybe a scalar Tensor, as opposed to a float with PyTorch 0.3), and json does not know how to serialize this. If this is the issue then this should be a simple fix. Can you print everything in to_log and copy-paste it here? My guess is that there is a Torch tensor somewhere that should just be a Python scalar. This https://discuss.pytorch.org/t/get-value-out-of-torch-cuda-float-tensor/2539/7 might also be relevant (post is outdated, but the issue would be similar).

I don't have time to look more into this now, but we will push a fix next week.

from muse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.