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 torch==1.7.0 Path support #5781

Merged
merged 3 commits into from
Nov 25, 2021
Merged

TorchScript torch==1.7.0 Path support #5781

merged 3 commits into from
Nov 25, 2021

Conversation

miknyko
Copy link
Contributor

@miknyko miknyko commented Nov 25, 2021

HI,

Fixed the pathlib.Path error in low version pytorch(1.7.1)

it has to be converted to a string representation of the path before be passed in scriptmodule.save

thanks

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Improved compatibility in TorchScript export with type casting.

📊 Key Changes

  • Modified the torch.jit.trace call to cast the file name to a string before saving.

🎯 Purpose & Impact

  • 🎯 Purpose: To ensure that the file name is explicitly treated as a string, which improves compatibility and prevents potential type errors during TorchScript export.
  • 💥 Impact: This change is likely to increase the robustness of exporting models to TorchScript, especially in environments where the type of the file name could be misinterpreted. This could benefit users trying to deploy YOLOv5 models across different platforms and devices.

@miknyko
Copy link
Contributor Author

miknyko commented Nov 25, 2021

@glenn-jocher
Hi, I modified several other places as well, in case there is an error as well, is that ok ?

@glenn-jocher
Copy link
Member

@miknyko let's just fix this one issue, as the other packages have not had any bug reports yet. Thanks!

oops forget something
@glenn-jocher glenn-jocher changed the title fix path error in export.py TorchScript torch==1.7.0 Path support Nov 25, 2021
@glenn-jocher glenn-jocher merged commit 4c7b2bd into ultralytics:master Nov 25, 2021
@glenn-jocher
Copy link
Member

@miknyko PR is merged. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐

@miknyko
Copy link
Contributor Author

miknyko commented Nov 25, 2021

@glenn-jocher
Thanks. Great project by the way!

@miknyko miknyko deleted the patch-2 branch November 25, 2021 10:28
BjarneKuehl pushed a commit to fhkiel-mlaip/yolov5 that referenced this pull request Aug 26, 2022
* fix path error in export.py

* Update export.py

updated!

* Update export.py

oops forget something
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