from pprint import pprint from huggingface_hub import ModelFilter, HfApi api = HfApi() filt = ModelFilter(author='cardiffnlp') models = api.list_models(filter=filt) models_filtered = [i.modelId for i in models if 'mt5' in i.modelId] pprint(sorted(models_filtered)) input("private all? >>>") for i in models_filtered: api.update_repo_visibility(repo_id=i, repo_type='model', private=True)