8000 Number predictions by schmmd · Pull Request #2709 · allenai/allennlp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Number predictions #2709

Merged
merged 2 commits into from
May 7, 2019
Merged

Number predictions #2709

merged 2 commits into from
May 7, 2019

Conversation

schmmd
Copy link
Member
@schmmd schmmd commented Apr 11, 2019

I was running some speed tests and it was difficult to tell how much progress my runs were making. I thought that numbering the predictions would be a good way to add some measure of progress.

@schmmd schmmd requested a review from joelgrus April 11, 2019 14:29
@@ -171,14 +172,17 @@ def _get_instance_data(self) -> Iterator[Instance]:

def run(self) -> None:
has_reader = self._dataset_reader is not None
index = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you may find this too cute, but one thing you could do to avoid having to track and increment the indices would be

index = itertools.count()

which generates an infinite sequence 0, 1, 2, ...

and then grab its value like

self._maybe_print_to_console_and_file(next(index), result, ...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joelgrus I loved doing things like that in Scala, but I have avoided them in Python (unpythonic?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine to me, as long as it's clear what's happening

@HarshTrivedi
Copy link
Contributor

@schmmd, this will be useful. Can you update and merge this?

@schmmd
Copy link
Member Author
schmmd commented May 7, 2019

@HarshTrivedi I'll merge after CI.

@schmmd schmmd merged commit 48f46ea into master May 7, 2019
@schmmd schmmd deleted the number-predictions branch May 7, 2019 17:06
@HarshTrivedi
Copy link
Contributor

@schmmd Thanks! 👍

reiyw pushed a commit to reiyw/allennlp that referenced this pull request Nov 12, 2019
TalSchuster pushed a commit to TalSchuster/allennlp-MultiLang that referenced this pull request Feb 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0