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

[Torchscript] Adds Sequence and Text feature postprocessing #2163

Merged
merged 9 commits into from
Jun 21, 2022

Conversation

geoffreyangus
Copy link
Contributor

This PR implements Sequence and Text postprocessing. In order to do this, we additionally standardize the outputs of both Sequence and Text output features. Now, both features output the following:

  • prediction: the maximum token for each timestep
  • probabilities: the probability of the maximum token for each timestep
  • probability: the log-probability of the predicted sequence
{
    "predictions": [
        ["lQhz", "HxgtdB", "HxgtdB", "HxgtdB", "HxgtdB", "HxgtdB", "HxgtdB", "HxgtdB", "HxgtdB"],
        ["lQhz", "HxgtdB", "HxgtdB", "HxgtdB", "HxgtdB", "HxgtdB", "HxgtdB", "HxgtdB", "HxgtdB"],
    ],
    "probabilities": tensor(
        [
            [0.2930, 0.2792, 0.2555, 0.2349, 0.2203, 0.2100, 0.2030, 0.1983, 0.1954],
            [0.2899, 0.2953, 0.2627, 0.2376, 0.2212, 0.2103, 0.2031, 0.1984, 0.1955],
        ]
    ),
    "probability": tensor(
        [
            -13.2349,
            -13.1438,
        ]
    ),
}

@github-actions
Copy link

github-actions bot commented Jun 17, 2022

Unit Test Results

       6 files  ±0         6 suites  ±0   2h 13m 29s ⏱️ + 9m 41s
2 831 tests +1  2 797 ✔️ +2    34 💤 ±0  0  - 1 
8 493 runs  +3  8 387 ✔️ +4  106 💤 ±0  0  - 1 

Results for commit 4c450d2. ± Comparison against base commit f43d23e.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@justinxzhao justinxzhao left a comment

Choose a reason for hiding this comment

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

Nice consolidation. Had a few minor comments.

ludwig/features/feature_utils.py Outdated Show resolved Hide resolved
ludwig/features/feature_utils.py Outdated Show resolved Hide resolved
ludwig/features/feature_utils.py Outdated Show resolved Hide resolved
ludwig/features/sequence_feature.py Show resolved Hide resolved
@geoffreyangus geoffreyangus merged commit 18f2c2f into master Jun 21, 2022
@geoffreyangus geoffreyangus deleted the ts-add-text-sequence-postproc branch June 21, 2022 22:51
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

Successfully merging this pull request may close these issues.

2 participants