-
Notifications
You must be signed in to change notification settings - Fork 684
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
Issue with decode in test_review when deploying the model using PyTorch? #1
Comments
Did you solve this? I am having the same issue. |
Hi, You just need to round the result in the predict.py first to either 0 or 1, then it will work in the main notebook. The result of predictor.predict(review_input) is in byte type but it does not matter. The int() function outside then converts it to int type because the value now is either 0 or 1 only. I forgot to round the result in the predict.py so it get errors when using int() outside. |
Can we see the intermediate outputs in predict function?? Because I am not really sure, I am having an error due to rounding. |
The intermediate part is similar to what we need to do in the notebook in (TODO) More testing before we get to the predict.py: input_data_cleaned = review_to_words(input_data) |
Hi,
In the project, at Step 6 (again) - Deploy the model for the web app, at the function def test_reviews(data_dir='../data/aclImdb', stop=250):,
# Read in the review and convert to 'utf-8' for transmission via HTTP review_input = review.read().encode('utf-8') # Send the review to the predictor and store the results results.append(int(predictor.predict(review_input)))
I think the last line should be:
results.append(round(float(predictor.predict(review_input))))
The output from predictor.predict is in byte type, that is b' ', so we need to use float() to convert to real number and use round to round it to the nearest integer (int() is not correct in this case because it rounds all numbers from 0-1 down to 0 only).
The text was updated successfully, but these errors were encountered: