Enhance error handling and update workflows#46
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request enhances error handling in the search_huggingface function and updates GitHub Actions workflows. The main improvement is a more robust candidate selection mechanism that tries multiple model options when the preferred choice is unavailable, with better handling of 401 Unauthorized errors. The workflow changes remove the debug workflow and improve the maintenance workflow with conditional checkout logic.
- Implements a candidate-based retry mechanism that collects all valid models before attempting downloads
- Adds URL validation with HEAD requests before downloads to detect 401 errors early
- Updates the PyPI check workflow to test the published package instead of source code
- Enhances the maintenance workflow with conditional repository checkout
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/auto_diffusers/pipeline_easy.py | Refactors the search logic to collect all candidates first, then try each one with improved exception handling and 401 error tracking |
| .github/workflows/pypi-check.yml | Renames from "Operation Debug (Source)" to "PyPI Package Check" and tests the PyPI-published package |
| .github/workflows/maintenance.yml | Makes checkout unconditional but with a conditional ref expression for workflow_dispatch vs scheduled runs |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| except Exception as e: | ||
| logger.info(f"Failed to get repo info for {repo_id}: {e}") | ||
| continue | ||
|
|
There was a problem hiding this comment.
This line contains trailing whitespace. Consider removing it for consistency with code style.
| if diffusers_model_exists or file_list: | ||
| break | ||
| else: | ||
|
|
There was a problem hiding this comment.
This line contains trailing whitespace. Consider removing it for consistency with code style.
| if last_error: | ||
| error_msg += f" Last error: {last_error}" | ||
| raise ValueError(error_msg) | ||
|
|
There was a problem hiding this comment.
This line contains trailing whitespace. Consider removing it for consistency with code style.
Improve error handling in the
search_huggingfacefunction to better manage candidate selection and exceptions. Update the GitHub Actions workflows by removing the debug workflow and enhancing the maintenance workflow with conditional checkout.