Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug Fix: Update hub.py to fix NoneType error (huggingface#33315)
* Bug Fix: Update hub.py Bug: TypeError: argument of type 'NoneType' is not iterable Analysis: The error `TypeError: argument of type 'NoneType' is not iterable` suggests that `model_card.data.tags` is `None`, and the code is trying to iterate through it using `not in`. Fix: 1. **Check if `model_card.data.tags` is `None` before the loop**: Since you're checking the variable `tags` before the loop, you should also ensure that `model_card.data.tags` is not `None`. You can do this by initializing `model_card.data.tags` to an empty list if it's `None`. 2. **Updated code**: Add a check and initialize the `tags` if it is `None` before proceeding with the iteration. This way, if `model_card.data.tags` is `None`, it gets converted to an empty list before checking the contents. This prevents the `TypeError`. * Update hub.py
- Loading branch information