{"action":"created","issue":{"url":"https://api.github.com/repos/fastai/fastai/issues/1228","repository_url":"https://api.github.com/repos/fastai/fastai","labels_url":"https://api.github.com/repos/fastai/fastai/issues/1228/labels{/name}","comments_url":"https://api.github.com/repos/fastai/fastai/issues/1228/comments","events_url":"https://api.github.com/repos/fastai/fastai/issues/1228/events","html_url":"https://github.com/fastai/fastai/pull/1228","id":383652014,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMDcwMTA4","number":1228,"title":"fixes bug where progress bar fails if default tensor type is cuda","user":{"login":"simonm3","id":1199593,"node_id":"MDQ6VXNlcjExOTk1OTM=","avatar_url":"https://avatars2.githubusercontent.com/u/1199593?v=4","gravatar_id":"","url":"https://api.github.com/users/simonm3","html_url":"https://github.com/simonm3","followers_url":"https://api.github.com/users/simonm3/followers","following_url":"https://api.github.com/users/simonm3/following{/other_user}","gists_url":"https://api.github.com/users/simonm3/gists{/gist_id}","starred_url":"https://api.github.com/users/simonm3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonm3/subscriptions","organizations_url":"https://api.github.com/users/simonm3/orgs","repos_url":"https://api.github.com/users/simonm3/repos","events_url":"https://api.github.com/users/simonm3/events{/privacy}","received_events_url":"https://api.github.com/users/simonm3/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-22T20:41:25Z","updated_at":"2018-11-23T20:51:45Z","closed_at":"2018-11-23T19:55:48Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/fastai/fastai/pulls/1228","html_url":"https://github.com/fastai/fastai/pull/1228","diff_url":"https://github.com/fastai/fastai/pull/1228.diff","patch_url":"https://github.com/fastai/fastai/pull/1228.patch"},"body":"<!-- If you are adding new functionality, please first create a thread on [fastai-dev](https://forums.fast.ai/c/fastai-users/fastai-dev) describing the functionality. Generally it's best to discuss changes to functionality there first, so we can all agree on an approach. Please include a test in your PR that fails without your code, and passes with it, as well as a test of a case that already worked without your code (and still works with it). Currently fastai has poor test coverage, so don't take the current tests as a role model - we're all working to fix it together! When creating your PR, please remove all the text in this template, and add details about your PR. -->\r\n"},"comment":{"url":"https://api.github.com/repos/fastai/fastai/issues/comments/441316310","html_url":"https://github.com/fastai/fastai/pull/1228#issuecomment-441316310","issue_url":"https://api.github.com/repos/fastai/fastai/issues/1228","id":441316310,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTMxNjMxMA==","user":{"login":"simonm3","id":1199593,"node_id":"MDQ6VXNlcjExOTk1OTM=","avatar_url":"https://avatars2.githubusercontent.com/u/1199593?v=4","gravatar_id":"","url":"https://api.github.com/users/simonm3","html_url":"https://github.com/simonm3","followers_url":"https://api.github.com/users/simonm3/followers","following_url":"https://api.github.com/users/simonm3/following{/other_user}","gists_url":"https://api.github.com/users/simonm3/gists{/gist_id}","starred_url":"https://api.github.com/users/simonm3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonm3/subscriptions","organizations_url":"https://api.github.com/users/simonm3/orgs","repos_url":"https://api.github.com/users/simonm3/repos","events_url":"https://api.github.com/users/simonm3/events{/privacy}","received_events_url":"https://api.github.com/users/simonm3/received_events","type":"User","site_admin":false},"created_at":"2018-11-23T20:51:45Z","updated_at":"2018-11-23T20:51:45Z","author_association":"NONE","body":"It is because I have default tensor type of cuda. And they are not put on\nthe CPU by the CallbackHandler - I agree they should be!\n\ntorch.set_default_tensor_type(torch.cuda.FloatTensor) => Now all new\ntensors are created cuda by default.\nbasic_train/25 => loss = cb_handler.on_backward_begin(loss) => this is a\ncuda tensor\nbasic_train/302 is Recorder.on_backward_begin. This does NOT put the tensor\non the CPU.\n\nIf not item() then perhaps just use .cpu()? There does not seem to be any\nlogic in having training losses stored as tensors nor in passing tensors to\nthe progress bar. Especially as validation losses are already just stored\nas list of floats not as tensors.\n\n\n\n\n\nOn Fri, 23 Nov 2018 at 19:56, Sylvain Gugger <notifications@github.com>\nwrote:\n\n> Again, I'm not sure how you manage to get CUDA tensors recorded there\n> since they are put on the CPU by the CallbackHandler.\n> The .item() method is very slow because it triggers a CUDA\n> synchronization, which is why we don't use it for the losses.\n>\n> —\n> You are receiving this because you authored the thread.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/fastai/fastai/pull/1228#issuecomment-441310477>, or mute\n> the thread\n> <https://github.com/notifications/unsubscribe-auth/ABJN6WkgBamiSeBVCgizFwdTODF5FLNHks5uyFLQgaJpZM4Yv36p>\n> .\n>\n"}}
{"actor":{"display_login":"simonm3"}}