-
Notifications
You must be signed in to change notification settings - Fork 0
Fasttransform errors related to TTA? #4
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
Comments
I've fully removed TTA from the script but somehow the error persists after the Python upgrade. This is extra confusing because the errors mention augment.py which makes it still sound TTA-related. |
Thanks for raising this issue. Regarding your first error with python=3.9: Regarding the second error with python=3.10: I do have one educated guess based on this error Could you perhaps try and save the pipeline with python 3.10 and the latest version of fastai and see if that addresses the issue? |
Thank you for the timely reply. Yes, I can provide a version of the training and scoring codes shortly but to call it out—it was trained with FastAI v2.8.0 on Colab. Unless I’m wrong the only non-current version in play was Python 3.9 but there’s also clearly more to it than I understand. Currently reverting the GitHub repo to its previously good build now results in a Cloud Run build that has the same error regardless of Python version (tested 3.9, 3.10, 3.12).
I will follow up with code in several hours. 🙏
[signatureImage]
…________________________________
From: Rens ***@***.***>
Sent: Thursday, March 20, 2025 2:04:08 AM
To: AnswerDotAI/fasttransform ***@***.***>
Cc: Jason Miller ***@***.***>; Author ***@***.***>
Subject: Re: [AnswerDotAI/fasttransform] Fasttransform errors related to TTA? (Issue #4)
Thanks for raising this issue.
Regarding your first error with python=3.9:
I've been able to replicate it locally and I'm looking into how we can fix this.
Regarding the second error with python=3.10:
I have not yet been able to reproduce this error. If possible, could you share a minimum reproducible example for this error?
I do have one educated guess based on this error ERROR loading model.pkl: Could not import 'Pipeline' from fastcore.transform. Are you trying to save a pipeline under the old version of fastai and are you trying to load it with the new version?
Could you perhaps try and save the pipeline with python 3.10 and the latest version of fastai and see if that addresses the issue?
—
Reply to this email directly, view it on GitHub<#4 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABZE4BRKNV7ZSPQU6J652VT2VJK5RAVCNFSM6AAAAABZLSBSTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZZGI4TOMJWGI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
[RensDimmendaal]RensDimmendaal left a comment (AnswerDotAI/fasttransform#4)<#4 (comment)>
Thanks for raising this issue.
Regarding your first error with python=3.9:
I've been able to replicate it locally and I'm looking into how we can fix this.
Regarding the second error with python=3.10:
I have not yet been able to reproduce this error. If possible, could you share a minimum reproducible example for this error?
I do have one educated guess based on this error ERROR loading model.pkl: Could not import 'Pipeline' from fastcore.transform. Are you trying to save a pipeline under the old version of fastai and are you trying to load it with the new version?
Could you perhaps try and save the pipeline with python 3.10 and the latest version of fastai and see if that addresses the issue?
—
Reply to this email directly, view it on GitHub<#4 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABZE4BRKNV7ZSPQU6J652VT2VJK5RAVCNFSM6AAAAABZLSBSTKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMZZGI4TOMJWGI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Apologies for the delay. This is a sticky, on-going problem. Here's the scoring code. It glitches on the first
|
I believe that happens under python 3.9 right? That issue I was already able to reproduce. Apologies if I didnt phrase my question clearly. What I meant was that it would be great if you could share a minimum reproducible example that triggers the second error you shared: |
Yes, understood. Sorry for the long code. So, in theory, that actually should be reproducible of both errors because you'd just give it any pkl format vision model to run it. However, when I try to run any version of that in Colab it doesn't reproduce the error. In case that's not weird enough, so I can additionally report that:
I will continue trying to isolate the source of the error. Could you let me know if you recognize the error message (the one saying that Pipeline has moved)? I'm thinking maybe I should just set all of the library versions to the last version prior to the introduction of that change... |
I think we're getting closer. I can confirm that:
So, that must be the reason the errors inexplicably persisted across builds even without caching. It was always pulling the newest fastcore. The only things remaining are:
|
gojo;lkAt long last, here's the reproducible example. You just have to make sure the library versions are what you think they are. In Colab, the session has to be restarted to get the latest version of FastAI. https://colab.research.google.com/drive/1soaCB5Vnz2mdDpaXM3JETfMZR9CPS2Up?usp=sharing The specific .pkl shouldn't matter. You can even just pkl a dummy file to reproduce the error.
So, given that the error is caused by the I wonder if it's not just augment, but perhaps anything that imports |
Thanks for providing all this info. We've pulled the release of 2.8.0 and are working on a fix. You can see the details in the PR here: fastai/fastai#4083
Yeah I recognize it. It shows that the model.pkl used fastcore.transform.Pipeline when it was saved. But it is not available during when it is loaded (fastai>2.8.0). I've also been able to reproduce the error like that myself (see code snippet in the PR). We've now added a more helpful error message that advices people to downgrade when trying to load models exported under |
TTA predictions apparently required a Python upgrade to >=3.10. Since that upgrade I've been getting errors pertaining to the fastcore-to-fasttransform migration. I do not import fastcore or fasttransform directly.
I've described the issue on Stack Overflow as follows:
Test Time Augmentation (TTA) in FastAI should be easily applied with
learn.tta
, yet has led to numerous issues in my Cloud Run deployment. I have a working Cloud Run deployment that does base learner and metalearner scoring as a prediction endpoint usingload_learner
from FastAI.I want to switch
learn.predict
tolearn.tta
but issues keep arising. FastAI requires a slightly different input shape fortta
and has different shape of returned values. I wanted to make it more of a direct drop-in replacement forlearn.predict
. This function worked to accomplish that in a minimalistic test notebook on Colab:Although it seemed to work fine in the notebook, when I add that to the top of my production script and switch
learn.predict
totta_predict(learn, img)
for my base learners, the entire image starts to fail to build with Python 3.9:I don't see anything in my code that could've caused that, yet there it is. I noticed somewhere in those messages it mentions "augment", which I take as confirmation that TTA is at fault (it was also the only thing that changed). So, I tried switching the Python version to 3.10. Now it builds but it's clearly broken:
The migration guide it mentions says to change
from fastcore.transform import Transform, Pipeline
tofrom fasttransform import Transform, Pipeline
but my code never directly imports
Pipeline
orTransform
, nor does it directly importfastcore
.The text was updated successfully, but these errors were encountered: