discussion_title
stringlengths
15
149
discussion_url
stringlengths
55
178
discussion_topic_id
int64
11.3k
169k
discussion_category
int64
2
69
discussion_created_at
stringdate
2021-11-01 15:54:32
2025-10-25 07:31:09
thread
listlengths
3
20
question
stringlengths
77
20.5k
solution
stringlengths
24
23.2k
My Space suddenly went offline. The CPU cannot restart
https://discuss.huggingface.co/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121
151,121
5
2025-04-18T10:59:41.457000Z
[ { "id": 216534, "name": "Pollux Lee", "username": "PolluxKing", "avatar_template": "/user_avatar/discuss.huggingface.co/polluxking/{size}/45788_2.png", "created_at": "2025-04-18T10:59:41.517Z", "cooked": "<p>It was running normally before, then suddenly disappeared, showing the Huggingface icon and a message saying “Building Space.”</p>\n<p>I checked the backend logs, and before the logs stopped, there were several instances of “reloading database.” I tried restarting the Space, but it didn’t work. I tried rebuilding the Space, but it also didn’t work. Then I noticed my CPU is stuck in a spinning state. What should I do now?<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/5/d/5d4245d54edaad4ced1529499580256b3b3d5657.jpeg\" data-download-href=\"/uploads/short-url/dj0ooLRaFrqANokxA1YE1UMl6f5.jpeg?dl=1\" title=\"微信截图_20250418184550\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/d/5d4245d54edaad4ced1529499580256b3b3d5657_2_690x239.jpeg\" alt=\"微信截图_20250418184550\" data-base62-sha1=\"dj0ooLRaFrqANokxA1YE1UMl6f5\" width=\"690\" height=\"239\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/d/5d4245d54edaad4ced1529499580256b3b3d5657_2_690x239.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/d/5d4245d54edaad4ced1529499580256b3b3d5657_2_1035x358.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/5/d/5d4245d54edaad4ced1529499580256b3b3d5657.jpeg 2x\" data-dominant-color=\"FAFAFB\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">微信截图_20250418184550</span><span class=\"informations\">1259×437 62.1 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>", "post_number": 1, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-18T10:59:41.517Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 224, "reads": 58, "readers_count": 57, "score": 1116.6, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Pollux Lee", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/spaces-keep-building-never-start/97011/16", "internal": true, "reflection": true, "title": "Spaces keep building, never start!", "clicks": 1 }, { "url": "https://discuss.huggingface.co/t/main-app-stuck-in-building-but-hf-space-is-up-and-running/151168/2", "internal": true, "reflection": true, "title": "Main app stuck in 'building' but .hf.space is up and running", "clicks": 1 }, { "url": "https://discuss.huggingface.co/t/error-500-56198da1-9a0d-4212-ae4d-1cf0a8977de5/152005/2", "internal": true, "reflection": true, "title": "Error 500 - 56198da1-9a0d-4212-ae4d-1cf0a8977de5", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/error-code-137-cache-error/152177/4", "internal": true, "reflection": true, "title": "Error code 137 - cache error", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91155, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216545, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-18T12:38:21.815Z", "cooked": "<p>The <em>cause is unknown and cannot be resolved by the user</em> at this time.</p>\n<p>The dirty but quickest workaround is as follows.</p>\n<ul>\n<li>Rename the current space to something appropriate and set it to Private (for safekeeping in case the issue is resolved in the future).</li>\n<li>Create a new space with an available name.</li>\n<li>Upload the same source code.</li>\n</ul>\n<aside class=\"quote\" data-post=\"1\" data-topic=\"145005\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/felladrin/48/28725_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/space-is-stuck-for-hours-in-build-state/145005\">Space is stuck for hours in build state</a> <a class=\"badge-category__wrapper \" href=\"/c/spaces/24\"><span data-category-id=\"24\" style=\"--category-badge-color: #25AAE2; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category to ask any questions about Spaces or to share your work.\"><span class=\"badge-category__name\">Spaces</span></span></a>\n </div>\n <blockquote>\n Hi, this space (<a href=\"https://huggingface.co/spaces/Felladrin/MiniSearch\" class=\"inline-onebox\">MiniSearch - a Hugging Face Space by Felladrin</a>) was restarted today and got stuck in the “Building” state for hours. There are no logs indicating it’s actually building. Maybe it’s in some queue for building? But it never took so long. So I think there might be some error with the space. \nI already tried stopping, restarting and factory-rebuilding it, but nothing worked.\n </blockquote>\n</aside>\n<aside class=\"quote\" data-post=\"1\" data-topic=\"140495\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/tonyassi/48/31589_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/space-is-permanently-building/140495\">Space is permanently \"Building\"</a> <a class=\"badge-category__wrapper \" href=\"/c/spaces/24\"><span data-category-id=\"24\" style=\"--category-badge-color: #25AAE2; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category to ask any questions about Spaces or to share your work.\"><span class=\"badge-category__name\">Spaces</span></span></a>\n </div>\n <blockquote>\n A few of my Spaces have been “Building” for weeks. It’s happened in the past when it’s “Building” for a few days and then I reset it and its fine. But this time around it won’t start! \nI tried everything… restarting, factory rebuild, deleting files and then re-uploading, etc.\n </blockquote>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-18T12:38:31.298Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 4, "reads": 53, "readers_count": 52, "score": 35.6, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/space-is-stuck-for-hours-in-build-state/145005", "internal": true, "reflection": false, "title": "Space is stuck for hours in build state", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/space-is-permanently-building/140495", "internal": true, "reflection": false, "title": "Space is permanently \"Building\"", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216568, "name": "Pollux Lee", "username": "PolluxKing", "avatar_template": "/user_avatar/discuss.huggingface.co/polluxking/{size}/45788_2.png", "created_at": "2025-04-18T14:47:06.747Z", "cooked": "<p>What a tragedy. From the posts you shared, I see many people are in the same situation. No idea how long it will take to recover. I even saw some people stuck on this issue for weeks…</p>", "post_number": 5, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-18T14:47:06.747Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 1, "reads": 48, "readers_count": 47, "score": 29.6, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Pollux Lee", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91155, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/5", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 216570, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-18T14:50:02.397Z", "cooked": "<p>Exactly. Even a Hugging Face staff member who was maintaining Spaces couldn’t solve the problem on his own… <img src=\"https://emoji.discourse-cdn.com/apple/nauseated_face.png?v=14\" title=\":nauseated_face:\" class=\"emoji\" alt=\":nauseated_face:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>It probably requires quite high-level permissions…</p>", "post_number": 6, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-18T14:50:02.397Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 48, "readers_count": 47, "score": 9.6, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/6", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216614, "name": "David Flannery", "username": "dlflannery", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/7feea3/{size}.png", "created_at": "2025-04-18T19:47:31.179Z", "cooked": "<p>Me too. Python Gradio space. Was working fine yesterday. Committed modified app.py that works perfectly on my home PC in VS2022 . Even after factory rebuild, just sitting on “Building” while logs just look normal. Pushed and started.</p>\n<p>EDIT: After about 1.5 hours this additional error message appeared int Build log following the normal messages that looked like everything was OK:</p>\n<p>ERROR: failed to push spaces-registry.huggingface.tech/spaces/6801b2253a3d2135e30da61a:cpu-08475b3-7x848txl: unexpected status from HEAD request to <a href=\"https://spaces-registry.huggingface.tech/v2/spaces/6801b2253a3d2135e30da61a/manifests/cpu-08475b3-7x848txl:\" rel=\"noopener nofollow ugc\">https://spaces-registry.huggingface.tech/v2/spaces/6801b2253a3d2135e30da61a/manifests/cpu-08475b3-7x848txl:</a> 401 Unauthorized</p>", "post_number": 7, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-18T20:24:48.628Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 19, "reads": 52, "readers_count": 51, "score": 150.4, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "David Flannery", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://spaces-registry.huggingface.tech/v2/spaces/6801b2253a3d2135e30da61a/manifests/cpu-08475b3-7x848txl:", "internal": false, "reflection": false, "title": null, "clicks": 1 }, { "url": "https://discuss.huggingface.co/t/my-app-keeps-building-and-reuse-the-previous-commit/151194/8", "internal": true, "reflection": true, "title": "My app keeps building and reuse the previous commit", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 3 } ], "moderator": false, "admin": false, "staff": false, "user_id": 58612, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/7", "reactions": [ { "id": "+1", "type": "emoji", "count": 3 } ], "current_user_reaction": null, "reaction_users_count": 3, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216669, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-19T00:08:55.780Z", "cooked": "<p>It must be an error for so many to suddenly appear at the same time… <a class=\"mention\" href=\"/u/meganariley\">@meganariley</a> <a class=\"mention\" href=\"/u/pierric\">@pierric</a> <a class=\"mention\" href=\"/u/hysts\">@hysts</a></p><aside class=\"quote\" data-post=\"1\" data-topic=\"151168\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://avatars.discourse-cdn.com/v4/letter/l/22d042/48.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/main-app-stuck-in-building-but-hf-space-is-up-and-running/151168\">Main app stuck in 'building' but .hf.space is up and running</a> <a class=\"badge-category__wrapper \" href=\"/c/spaces/24\"><span data-category-id=\"24\" style=\"--category-badge-color: #25AAE2; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category to ask any questions about Spaces or to share your work.\"><span class=\"badge-category__name\">Spaces</span></span></a>\n </div>\n <blockquote>\n Hello, my app that was working previously is stuck in the “building” state: <a href=\"https://huggingface.co/spaces/liquidcarbon/puppy-hf-marimo\" class=\"inline-onebox\">Puppy Hf Marimo - a Hugging Face Space by liquidcarbon</a> \nThough it is up and running at this address: <a href=\"https://liquidcarbon-puppy-hf-marimo.hf.space/\" rel=\"noopener nofollow ugc\">https://liquidcarbon-puppy-hf-marimo.hf.space/</a> \nAny suggestions on why this is happening and how to fix it are appreciated\n </blockquote>\n</aside>\n<aside class=\"quote quote-modified\" data-post=\"1\" data-topic=\"151194\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/zhiminy/48/45157_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/my-app-keeps-building-and-reuse-the-previous-commit/151194\">My app keeps building and reuse the previous commit</a> <a class=\"badge-category__wrapper \" href=\"/c/spaces/24\"><span data-category-id=\"24\" style=\"--category-badge-color: #25AAE2; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category to ask any questions about Spaces or to share your work.\"><span class=\"badge-category__name\">Spaces</span></span></a>\n </div>\n <blockquote>\n Here is my space: <a href=\"https://huggingface.co/spaces/SE-Arena/Software-Engineering-Arena\">SE-Arena - a Hugging Face Space by SE-Arena</a> \nEven though there is no error message shown in the log, it does not run at all… \nContainer log: \n===== Application Startup at 2025-04-18 21:55:01 =====\n\n\n09_115956.json: 0%| | 0.00/124 [00:00&lt;?, ?B/s]\n09_115956.json: 100%|██████████| 124/124 [00:00&lt;00:00, 820kB/s]\n\n09_143236.json: 0%| | 0.00/130 [00:00&lt;?, ?B/s]\n09_143236.json: 100%|██████████| 130/130 [00:00&lt;00:00, 921kB/s]\n\n09_143825.json: 0%| | 0.00…\n </blockquote>\n</aside>\n", "post_number": 8, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-19T00:08:55.780Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 5, "reads": 50, "readers_count": 49, "score": 35, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/my-app-keeps-building-and-reuse-the-previous-commit/151194", "internal": true, "reflection": false, "title": "My app keeps building and reuse the previous commit", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/main-app-stuck-in-building-but-hf-space-is-up-and-running/151168", "internal": true, "reflection": false, "title": "Main app stuck in 'building' but .hf.space is up and running", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/8", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216672, "name": "David Flannery", "username": "dlflannery", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/7feea3/{size}.png", "created_at": "2025-04-19T00:22:27.808Z", "cooked": "<p>I finally created a new space, same configuration and same files as the space that was stuck building. It built and ran just fine. Deleted the stuck space.</p>", "post_number": 9, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-19T00:22:27.808Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 45, "readers_count": 44, "score": 29, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "David Flannery", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 58612, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/9", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216682, "name": "hysts", "username": "hysts", "avatar_template": "/user_avatar/discuss.huggingface.co/hysts/{size}/32230_2.png", "created_at": "2025-04-19T01:18:49.834Z", "cooked": "<p>Thanks for reporting! I shared this internally.</p>", "post_number": 10, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-19T01:18:49.834Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 9, "reads": 46, "readers_count": 45, "score": 129.2, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "hysts", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/error-in-hf-space-docker/151342/4", "internal": true, "reflection": true, "title": "Error in HF Space Docker", "clicks": 3 }, { "url": "https://discuss.huggingface.co/t/501-unauthorized-error/151251/3", "internal": true, "reflection": true, "title": "501- Unauthorized Error", "clicks": 2 } ], "read": true, "user_title": "", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 5 } ], "moderator": true, "admin": false, "staff": true, "user_id": 7263, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/10", "reactions": [ { "id": "hugs", "type": "emoji", "count": 3 }, { "id": "heart", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 5, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216687, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-19T02:45:13.089Z", "cooked": "<p>Thank you, hysts!</p>", "post_number": 11, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-19T02:45:13.089Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 48, "readers_count": 47, "score": 24.6, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/11", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216737, "name": "Nolan Zandi", "username": "nolanzandi", "avatar_template": "/user_avatar/discuss.huggingface.co/nolanzandi/{size}/45859_2.png", "created_at": "2025-04-19T05:47:29.906Z", "cooked": "<p>I’m having the same issue. Stuck in building until I get a build error that says unexpected status from HEAD request</p>", "post_number": 12, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-19T05:47:29.906Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 5, "reads": 48, "readers_count": 47, "score": 49.6, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Nolan Zandi", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/501-unauthorized-error/151251/2", "internal": true, "reflection": true, "title": "501- Unauthorized Error", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91249, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/12", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216833, "name": "Sybille Reuter", "username": "s-reuter", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/{size}.png", "created_at": "2025-04-19T19:56:29.384Z", "cooked": "<p>Same here, stuck at “Building” until…:</p>\n<pre><code class=\"lang-auto\">--&gt; ERROR: failed to push spaces-registry.huggingface.tech/spaces/66a915c181dd5b0fe315302a:cpu-0ada85f-8cwhnd27: unexpected status from HEAD request to https://spaces-registry.huggingface.tech/v2/spaces/66a915c181dd5b0fe315302a/manifests/cpu-0ada85f-8cwhnd27: 401 Unauthorized\n</code></pre>", "post_number": 13, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-19T19:56:29.384Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 48, "readers_count": 47, "score": 74.6, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Sybille Reuter", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 4 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91294, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/13", "reactions": [ { "id": "+1", "type": "emoji", "count": 4 } ], "current_user_reaction": null, "reaction_users_count": 4, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216858, "name": "Cameron Afzal", "username": "cafzal", "avatar_template": "/user_avatar/discuss.huggingface.co/cafzal/{size}/45922_2.png", "created_at": "2025-04-20T00:14:50.361Z", "cooked": "<p>+1, I’m running into the <a href=\"https://discuss.huggingface.co/t/error-in-hf-space-docker/151342/2\">same</a> issue.</p>", "post_number": 14, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-20T00:15:04.578Z", "reply_count": 0, "reply_to_post_number": 13, "quote_count": 0, "incoming_link_count": 6, "reads": 44, "readers_count": 43, "score": 53.8, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Cameron Afzal", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/error-in-hf-space-docker/151342/2", "internal": true, "reflection": false, "title": "Error in HF Space Docker", "clicks": 6 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91310, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/14", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 91294, "username": "s-reuter", "name": "Sybille Reuter", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/{size}.png" }, "action_code": null, "via_email": null }, { "id": 216983, "name": "David Korn", "username": "DaveK23", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/73ab20/{size}.png", "created_at": "2025-04-20T15:57:19.826Z", "cooked": "<p>Possibly related:</p>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/docker/build-push-action/discussions/1108\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/docker/build-push-action/discussions/1108\" target=\"_blank\" rel=\"noopener nofollow ugc\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/344;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/b/b/bb2cd52bdb839fae717ade8bf99144e461099d47_2_690x345.png\" class=\"thumbnail\" data-dominant-color=\"E5E7EA\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://github.com/docker/build-push-action/discussions/1108\" target=\"_blank\" rel=\"noopener nofollow ugc\">unexpected status from HEAD request to {{registry}}: 401 Unauthorized ·...</a></h3>\n\n <p>anyone have this issue? image has been built but can't be push to registry #21 exporting to image #21 pushing layers 4.2s done #21 ERROR: failed to push {{registry}}/satudikti/be:v3.0.369: unexpect...</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/docker/build-push-action/discussions/983\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/docker/build-push-action/discussions/983\" target=\"_blank\" rel=\"noopener nofollow ugc\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/344;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/8/0/80b549b44725aa677132ec20175475770945296c_2_690x345.png\" class=\"thumbnail\" data-dominant-color=\"EAECEF\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://github.com/docker/build-push-action/discussions/983\" target=\"_blank\" rel=\"noopener nofollow ugc\">Push to ECR registry fails with \"Error: buildx failed with: ERROR: failed to...</a></h3>\n\n <p>I'm trying to push an image with caching to my ECR repository. Caching succeeds but the push fails with 403 Forbidden. Here's the workflow: jobs: push_to_registry: name: Push Docker image to ECR ru...</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<p>Suggests a problem with docker vs. AWS perms:</p>\n<blockquote>\n<p>“Today I stumbled upon the same issue. The docker buildx build … --push command failed with the same error message (unexpected status from HEAD request to : 403 Forbidden). But docker push was working uninterrupted. It turns out that buildix required one additional AWS ECR permission - ecr:BatchGetImage. <img src=\"https://emoji.discourse-cdn.com/apple/upside_down_face.png?v=14\" title=\":upside_down_face:\" class=\"emoji\" alt=\":upside_down_face:\" loading=\"lazy\" width=\"20\" height=\"20\">”</p>\n</blockquote>\n<p>I know nothing about this stuff, but hope that clue might help those who do <img src=\"https://emoji.discourse-cdn.com/apple/slight_smile.png?v=14\" title=\":slight_smile:\" class=\"emoji\" alt=\":slight_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 15, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-20T15:57:19.826Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 27, "reads": 46, "readers_count": 45, "score": 174.2, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "David Korn", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/docker/build-push-action/discussions/1108", "internal": false, "reflection": false, "title": "unexpected status from HEAD request to {{registry}}: 401 Unauthorized · docker/build-push-action · Discussion #1108 · GitHub", "clicks": 7 }, { "url": "https://github.com/docker/build-push-action/discussions/983", "internal": false, "reflection": false, "title": "Push to ECR registry fails with \"Error: buildx failed with: ERROR: failed to solve: failed to push ** 403 Forbidden\" · docker/build-push-action · Discussion #983 · GitHub", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91379, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/15", "reactions": [ { "id": "+1", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217101, "name": "Debasish Dhal", "username": "DebasishDhal99", "avatar_template": "/user_avatar/discuss.huggingface.co/debasishdhal99/{size}/19893_2.png", "created_at": "2025-04-21T06:15:21.786Z", "cooked": "<p>Same issue. Over the past 3-4 days, 2 of my spaces went offline due to “Build error”. They were working fine for the last 1 year.</p>", "post_number": 16, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-21T06:15:21.786Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 37, "readers_count": 36, "score": 42.4, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Debasish Dhal", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 29992, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/16", "reactions": [ { "id": "+1", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217234, "name": "Serrano", "username": "Minaya1hv", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/{size}.png", "created_at": "2025-04-21T14:37:14.655Z", "cooked": "<p>Same issue here. Any update is appreciated!</p>", "post_number": 17, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-21T14:37:14.655Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 36, "readers_count": 35, "score": 32.2, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Serrano", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91483, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/17", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217318, "name": "Pollux Lee", "username": "PolluxKing", "avatar_template": "/user_avatar/discuss.huggingface.co/polluxking/{size}/45788_2.png", "created_at": "2025-04-21T22:55:34.345Z", "cooked": "<p>Wow, you’re really having a rough time. Hope they can fix this error. I haven’t been using Huggingface for long, so I don’t have much data, and I had to rebuild after careful selection.</p>", "post_number": 18, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-21T22:55:34.345Z", "reply_count": 1, "reply_to_post_number": 16, "quote_count": 0, "incoming_link_count": 1, "reads": 35, "readers_count": 34, "score": 47, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Pollux Lee", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91155, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/18", "reactions": [ { "id": "+1", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 29992, "username": "DebasishDhal99", "name": "Debasish Dhal", "avatar_template": "/user_avatar/discuss.huggingface.co/debasishdhal99/{size}/19893_2.png" }, "action_code": null, "via_email": null }, { "id": 217367, "name": "Davor Kondic", "username": "dkondic", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/b5e925/{size}.png", "created_at": "2025-04-22T03:41:58.465Z", "cooked": "<p>Was just having the same issue. What ended up working for me is to rebuild the image using a different Space Hardware. Then rebuild it back to the original hardware.</p>", "post_number": 19, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-22T03:41:58.465Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 8, "reads": 35, "readers_count": 34, "score": 97, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Davor Kondic", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/501-unauthorized-error/151251/8", "internal": true, "reflection": true, "title": "501- Unauthorized Error", "clicks": 1 }, { "url": "https://discuss.huggingface.co/t/error-in-hf-space-docker/151342/13", "internal": true, "reflection": true, "title": "Error in HF Space Docker", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 3 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90864, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/19", "reactions": [ { "id": "+1", "type": "emoji", "count": 3 } ], "current_user_reaction": null, "reaction_users_count": 3, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217370, "name": "Nolan Zandi", "username": "nolanzandi", "avatar_template": "/user_avatar/discuss.huggingface.co/nolanzandi/{size}/45859_2.png", "created_at": "2025-04-22T03:58:52.436Z", "cooked": "<p>I confirm that this also worked for me. What a relief.</p>", "post_number": 20, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-22T03:58:52.436Z", "reply_count": 0, "reply_to_post_number": 19, "quote_count": 0, "incoming_link_count": 0, "reads": 35, "readers_count": 34, "score": 22, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Nolan Zandi", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91249, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/20", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 90864, "username": "dkondic", "name": "Davor Kondic", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/b5e925/{size}.png" }, "action_code": null, "via_email": null }, { "id": 217418, "name": "Debasish Dhal", "username": "DebasishDhal99", "avatar_template": "/user_avatar/discuss.huggingface.co/debasishdhal99/{size}/19893_2.png", "created_at": "2025-04-22T08:55:50.351Z", "cooked": "<p>They have fixed the issue, it seems. All my gradio spaces are back. Great news.</p>", "post_number": 21, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-22T08:55:50.351Z", "reply_count": 0, "reply_to_post_number": 18, "quote_count": 0, "incoming_link_count": 4, "reads": 35, "readers_count": 34, "score": 57, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "Debasish Dhal", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/error-in-hf-space-docker/151342/14", "internal": true, "reflection": true, "title": "Error in HF Space Docker", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/501-unauthorized-error/151251/9", "internal": true, "reflection": true, "title": "501- Unauthorized Error", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 29992, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/21", "reactions": [ { "id": "confetti_ball", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 91155, "username": "PolluxKing", "name": "Pollux Lee", "avatar_template": "/user_avatar/discuss.huggingface.co/polluxking/{size}/45788_2.png" }, "action_code": null, "via_email": null }, { "id": 217498, "name": "hysts", "username": "hysts", "avatar_template": "/user_avatar/discuss.huggingface.co/hysts/{size}/32230_2.png", "created_at": "2025-04-22T13:34:10.731Z", "cooked": "<p>The infra team has resolved the issue. We are still investigating the root cause, but restarting the Space should fix it.</p>", "post_number": 22, "post_type": 1, "posts_count": 25, "updated_at": "2025-04-22T13:34:10.731Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 95, "reads": 32, "readers_count": 31, "score": 501.4, "yours": false, "topic_id": 151121, "topic_slug": "my-space-suddenly-went-offline-the-cpu-cannot-restart", "display_username": "hysts", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/why-are-nearly-all-spaces-down/152172/2", "internal": true, "reflection": true, "title": "Why are nearly all Spaces down?", "clicks": 3 } ], "read": true, "user_title": "", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 7263, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/my-space-suddenly-went-offline-the-cpu-cannot-restart/151121/22", "reactions": [ { "id": "confetti_ball", "type": "emoji", "count": 1 }, { "id": "hugs", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null } ]
<p>It was running normally before, then suddenly disappeared, showing the Huggingface icon and a message saying “Building Space.”</p> <p>I checked the backend logs, and before the logs stopped, there were several instances of “reloading database.” I tried restarting the Space, but it didn’t work. I tried rebuilding the Space, but it also didn’t work. Then I noticed my CPU is stuck in a spinning state. What should I do now?<br> <div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/5/d/5d4245d54edaad4ced1529499580256b3b3d5657.jpeg" data-download-href="/uploads/short-url/dj0ooLRaFrqANokxA1YE1UMl6f5.jpeg?dl=1" title="微信截图_20250418184550" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/d/5d4245d54edaad4ced1529499580256b3b3d5657_2_690x239.jpeg" alt="微信截图_20250418184550" data-base62-sha1="dj0ooLRaFrqANokxA1YE1UMl6f5" width="690" height="239" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/d/5d4245d54edaad4ced1529499580256b3b3d5657_2_690x239.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/d/5d4245d54edaad4ced1529499580256b3b3d5657_2_1035x358.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/5/d/5d4245d54edaad4ced1529499580256b3b3d5657.jpeg 2x" data-dominant-color="FAFAFB"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">微信截图_20250418184550</span><span class="informations">1259×437 62.1 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>I’m having the same issue. Stuck in building until I get a build error that says unexpected status from HEAD request</p>
Getting OOM during full-finetuning on kaggle T4s. Help please. Beginner here
https://discuss.huggingface.co/t/getting-oom-during-full-finetuning-on-kaggle-t4s-help-please-beginner-here/151640
151,640
5
2025-04-21T14:18:29.854000Z
[ { "id": 217227, "name": "Jahnavi", "username": "mnj-hf", "avatar_template": "/user_avatar/discuss.huggingface.co/mnj-hf/{size}/46026_2.png", "created_at": "2025-04-21T14:18:29.943Z", "cooked": "<p>Is there no other way than increasing computation power when we get OOMs? Is Lora, qlora the only way.<br>\nI’m pretty sure many must have faced this problem, what other ways other than trying qlora/lora, deepspeed, mixed-precision training, are there if we get OOMs during trying for full-finetuning?</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-21T14:18:29.943Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 9, "reads": 3, "readers_count": 2, "score": 60.6, "yours": false, "topic_id": 151640, "topic_slug": "getting-oom-during-full-finetuning-on-kaggle-t4s-help-please-beginner-here", "display_username": "Jahnavi", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91481, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/getting-oom-during-full-finetuning-on-kaggle-t4s-help-please-beginner-here/151640/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217395, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-22T06:21:01.725Z", "cooked": "<p>The first thing that comes to mind is gradient accumulation…</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/accelerate/main/en/usage_guides/gradient_accumulation\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/accelerate/main/en/usage_guides/gradient_accumulation\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/3/0383c0bc9dfffa44151c8cf13ec5adba8ac2156e_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F7F5EF\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/accelerate/main/en/usage_guides/gradient_accumulation\" target=\"_blank\" rel=\"noopener\">Performing gradient accumulation with Accelerate</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/transformers/main/en/performance\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/transformers/main/en/performance\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F5F3ED\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/transformers/main/en/performance\" target=\"_blank\" rel=\"noopener\">Performance and Scalability</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-22T06:21:01.725Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 151640, "topic_slug": "getting-oom-during-full-finetuning-on-kaggle-t4s-help-please-beginner-here", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/accelerate/main/en/usage_guides/gradient_accumulation", "internal": false, "reflection": false, "title": "Performing gradient accumulation with Accelerate", "clicks": 0 }, { "url": "https://huggingface.co/docs/transformers/main/en/performance", "internal": false, "reflection": false, "title": "Performance and Scalability", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/getting-oom-during-full-finetuning-on-kaggle-t4s-help-please-beginner-here/151640/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217643, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-23T09:18:17.386Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-23T09:18:17.386Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 1, "readers_count": 0, "score": 0.2, "yours": false, "topic_id": 151640, "topic_slug": "getting-oom-during-full-finetuning-on-kaggle-t4s-help-please-beginner-here", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/getting-oom-during-full-finetuning-on-kaggle-t4s-help-please-beginner-here/151640/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Is there no other way than increasing computation power when we get OOMs? Is Lora, qlora the only way.<br> I’m pretty sure many must have faced this problem, what other ways other than trying qlora/lora, deepspeed, mixed-precision training, are there if we get OOMs during trying for full-finetuning?</p>
<p>The first thing that comes to mind is gradient accumulation…</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/accelerate/main/en/usage_guides/gradient_accumulation"> <header class="source"> <a href="https://huggingface.co/docs/accelerate/main/en/usage_guides/gradient_accumulation" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/3/0383c0bc9dfffa44151c8cf13ec5adba8ac2156e_2_690x372.png" class="thumbnail" data-dominant-color="F7F5EF" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/accelerate/main/en/usage_guides/gradient_accumulation" target="_blank" rel="noopener">Performing gradient accumulation with Accelerate</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/transformers/main/en/performance"> <header class="source"> <a href="https://huggingface.co/docs/transformers/main/en/performance" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png" class="thumbnail" data-dominant-color="F5F3ED" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/transformers/main/en/performance" target="_blank" rel="noopener">Performance and Scalability</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Huggingface features and google sites website integrate
https://discuss.huggingface.co/t/huggingface-features-and-google-sites-website-integrate/151799
151,799
5
2025-04-22T11:44:13.463000Z
[ { "id": 217484, "name": "Catalin George Festila", "username": "catafest", "avatar_template": "/user_avatar/discuss.huggingface.co/catafest/{size}/46110_2.png", "created_at": "2025-04-22T11:44:13.521Z", "cooked": "<p>Can I integrate huggingface features with my google sites webpage ?<br>\nGoogle sites use GAScript .</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-22T11:44:13.521Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 16, "reads": 3, "readers_count": 2, "score": 95.6, "yours": false, "topic_id": 151799, "topic_slug": "huggingface-features-and-google-sites-website-integrate", "display_username": "Catalin George Festila", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91596, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/huggingface-features-and-google-sites-website-integrate/151799/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217499, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-22T13:41:11.566Z", "cooked": "<p>When integrating Hugging Face into other sites, there are two main methods: using it via API and embedding Spaces into web pages. If you want to use it via API with GAS, you can probably use JavaScript libraries and know-how.</p>\n<h3><a name=\"p-217499-via-api-1\" class=\"anchor\" href=\"#p-217499-via-api-1\"></a>via API</h3>\n<aside class=\"onebox stackexchange\" data-onebox-src=\"https://stackoverflow.com/questions/21460689/gas-code-for-api\">\n <header class=\"source\">\n\n <a href=\"https://stackoverflow.com/questions/21460689/gas-code-for-api\" target=\"_blank\" rel=\"noopener\">stackoverflow.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <a href=\"https://stackoverflow.com/users/3140214/shekhar-raj\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"Shekhar Raj\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/1/2/126d350c55a31a57c0f46f94d207bbb727c0812f.jpeg\" class=\"thumbnail onebox-avatar\" data-dominant-color=\"E6E7EA\" width=\"200\" height=\"200\">\n </a>\n\n<h4>\n <a href=\"https://stackoverflow.com/questions/21460689/gas-code-for-api\" target=\"_blank\" rel=\"noopener\">GAS CODE FOR API</a>\n</h4>\n\n<div class=\"tags\">\n <strong>google-apps-script</strong>\n</div>\n\n<div class=\"date\">\n asked by\n \n <a href=\"https://stackoverflow.com/users/3140214/shekhar-raj\" target=\"_blank\" rel=\"noopener\">\n Shekhar Raj\n </a>\n on <a href=\"https://stackoverflow.com/questions/21460689/gas-code-for-api\" target=\"_blank\" rel=\"noopener\">03:32PM - 30 Jan 14 UTC</a>\n</div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/huggingface.js/index\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/huggingface.js/index\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n \n\n<h3><a href=\"https://huggingface.co/docs/huggingface.js/index\" target=\"_blank\" rel=\"noopener\">Hugging Face JS libraries</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://www.gradio.app/guides/getting-started-with-the-js-client\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/1/1/1130c1c3169693f6b3624e85dda1c7b816ecbc0c.png\" class=\"site-icon\" data-dominant-color=\"F99D00\" width=\"64\" height=\"64\">\n\n <a href=\"https://www.gradio.app/guides/getting-started-with-the-js-client\" target=\"_blank\" rel=\"noopener\">gradio.app</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/357;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/5/4532d24411c1a1e834a20ef8aada4248d8075883_2_690x357.jpeg\" class=\"thumbnail\" data-dominant-color=\"E5E1DE\" width=\"690\" height=\"357\"></div>\n\n<h3><a href=\"https://www.gradio.app/guides/getting-started-with-the-js-client\" target=\"_blank\" rel=\"noopener\">Getting Started With The Js Client</a></h3>\n\n <p>A Step-by-Step Gradio Tutorial</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/inference-endpoints/guides/test_endpoint\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/inference-endpoints/guides/test_endpoint\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/a/4ab5b454b8210697406807d06e431ec677069516_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F1EFE9\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/inference-endpoints/guides/test_endpoint\" target=\"_blank\" rel=\"noopener\">Send Requests to Endpoints</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-217499-via-embedding-spaces-2\" class=\"anchor\" href=\"#p-217499-via-embedding-spaces-2\"></a>via Embedding Spaces</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/hub/spaces-embed\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/hub/spaces-embed\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"FAF8F2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/hub/spaces-embed\" target=\"_blank\" rel=\"noopener\">Embed your Space in another website</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-22T13:41:11.566Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 151799, "topic_slug": "huggingface-features-and-google-sites-website-integrate", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/inference-endpoints/guides/test_endpoint", "internal": false, "reflection": false, "title": "Send Requests to Endpoints", "clicks": 1 }, { "url": "https://www.gradio.app/guides/getting-started-with-the-js-client", "internal": false, "reflection": false, "title": "Getting Started With The Js Client", "clicks": 1 }, { "url": "https://stackoverflow.com/questions/21460689/gas-code-for-api", "internal": false, "reflection": false, "title": "google apps script - GAS CODE FOR API - Stack Overflow", "clicks": 0 }, { "url": "https://huggingface.co/docs/huggingface.js/index", "internal": false, "reflection": false, "title": "Hugging Face JS libraries", "clicks": 0 }, { "url": "https://huggingface.co/docs/hub/spaces-embed", "internal": false, "reflection": false, "title": "Embed your Space in another website", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/huggingface-features-and-google-sites-website-integrate/151799/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217566, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-23T01:42:04.177Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-23T01:42:04.177Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 1, "readers_count": 0, "score": 5.2, "yours": false, "topic_id": 151799, "topic_slug": "huggingface-features-and-google-sites-website-integrate", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/huggingface-features-and-google-sites-website-integrate/151799/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Can I integrate huggingface features with my google sites webpage ?<br> Google sites use GAScript .</p>
<p>When integrating Hugging Face into other sites, there are two main methods: using it via API and embedding Spaces into web pages. If you want to use it via API with GAS, you can probably use JavaScript libraries and know-how.</p> <h3><a name="p-217499-via-api-1" class="anchor" href="#p-217499-via-api-1"></a>via API</h3> <aside class="onebox stackexchange" data-onebox-src="https://stackoverflow.com/questions/21460689/gas-code-for-api"> <header class="source"> <a href="https://stackoverflow.com/questions/21460689/gas-code-for-api" target="_blank" rel="noopener">stackoverflow.com</a> </header> <article class="onebox-body"> <a href="https://stackoverflow.com/users/3140214/shekhar-raj" target="_blank" rel="noopener"> <img alt="Shekhar Raj" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/1/2/126d350c55a31a57c0f46f94d207bbb727c0812f.jpeg" class="thumbnail onebox-avatar" data-dominant-color="E6E7EA" width="200" height="200"> </a> <h4> <a href="https://stackoverflow.com/questions/21460689/gas-code-for-api" target="_blank" rel="noopener">GAS CODE FOR API</a> </h4> <div class="tags"> <strong>google-apps-script</strong> </div> <div class="date"> asked by <a href="https://stackoverflow.com/users/3140214/shekhar-raj" target="_blank" rel="noopener"> Shekhar Raj </a> on <a href="https://stackoverflow.com/questions/21460689/gas-code-for-api" target="_blank" rel="noopener">03:32PM - 30 Jan 14 UTC</a> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/huggingface.js/index"> <header class="source"> <a href="https://huggingface.co/docs/huggingface.js/index" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <h3><a href="https://huggingface.co/docs/huggingface.js/index" target="_blank" rel="noopener">Hugging Face JS libraries</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://www.gradio.app/guides/getting-started-with-the-js-client"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/1/1/1130c1c3169693f6b3624e85dda1c7b816ecbc0c.png" class="site-icon" data-dominant-color="F99D00" width="64" height="64"> <a href="https://www.gradio.app/guides/getting-started-with-the-js-client" target="_blank" rel="noopener">gradio.app</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/357;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/5/4532d24411c1a1e834a20ef8aada4248d8075883_2_690x357.jpeg" class="thumbnail" data-dominant-color="E5E1DE" width="690" height="357"></div> <h3><a href="https://www.gradio.app/guides/getting-started-with-the-js-client" target="_blank" rel="noopener">Getting Started With The Js Client</a></h3> <p>A Step-by-Step Gradio Tutorial</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/inference-endpoints/guides/test_endpoint"> <header class="source"> <a href="https://huggingface.co/docs/inference-endpoints/guides/test_endpoint" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/a/4ab5b454b8210697406807d06e431ec677069516_2_690x372.png" class="thumbnail" data-dominant-color="F1EFE9" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/inference-endpoints/guides/test_endpoint" target="_blank" rel="noopener">Send Requests to Endpoints</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <h3><a name="p-217499-via-embedding-spaces-2" class="anchor" href="#p-217499-via-embedding-spaces-2"></a>via Embedding Spaces</h3> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/hub/spaces-embed"> <header class="source"> <a href="https://huggingface.co/docs/hub/spaces-embed" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png" class="thumbnail" data-dominant-color="FAF8F2" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/hub/spaces-embed" target="_blank" rel="noopener">Embed your Space in another website</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
How to skip the upload delay BS when uploading an image on Gradio 4 or 5?
https://discuss.huggingface.co/t/how-to-skip-the-upload-delay-bs-when-uploading-an-image-on-gradio-4-or-5/150677
150,677
5
2025-04-15T17:59:38.362000Z
[ { "id": 215971, "name": "gutris1", "username": "gutris1", "avatar_template": "/user_avatar/discuss.huggingface.co/gutris1/{size}/45467_2.png", "created_at": "2025-04-15T17:59:38.417Z", "cooked": "<p>I just made a tiny HF space to extract image metadata generated from SD WebUI/SwarmUI using JavaScript <a href=\"https://huggingface.co/spaces/gutris1/image-info\" class=\"inline-onebox\">Image Info - a Hugging Face Space by gutris1</a><br>\nI’m sticking with version 3 because it doesn’t do any preprocessing and displays the image immediately after uploading within a second.<br>\nI’m curious if the same can be done with version 4 or 5.</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-15T17:59:38.417Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 39, "reads": 3, "readers_count": 2, "score": 210.6, "yours": false, "topic_id": 150677, "topic_slug": "how-to-skip-the-upload-delay-bs-when-uploading-an-image-on-gradio-4-or-5", "display_username": "gutris1", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/spaces/gutris1/image-info", "internal": false, "reflection": false, "title": "Image Info - a Hugging Face Space by gutris1", "clicks": 3 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90663, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-skip-the-upload-delay-bs-when-uploading-an-image-on-gradio-4-or-5/150677/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216022, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-16T01:04:58.247Z", "cooked": "<p>If you set it to type=“filepath”, it will not be processed. Also, I have never tried using it, but it may be possible with this.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://www.gradio.app/docs/gradio/image#param-event-preprocess\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/1/1/1130c1c3169693f6b3624e85dda1c7b816ecbc0c.png\" class=\"site-icon\" data-dominant-color=\"F99D00\" width=\"64\" height=\"64\">\n\n <a href=\"https://www.gradio.app/docs/gradio/image#param-event-preprocess\" target=\"_blank\" rel=\"noopener\">gradio.app</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/357;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/5/4532d24411c1a1e834a20ef8aada4248d8075883_2_690x357.jpeg\" class=\"thumbnail\" data-dominant-color=\"E5E1DE\" width=\"690\" height=\"357\"></div>\n\n<h3><a href=\"https://www.gradio.app/docs/gradio/image#param-event-preprocess\" target=\"_blank\" rel=\"noopener\">Gradio Docs</a></h3>\n\n <p>Gradio docs for using</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-16T01:04:58.247Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 20.4, "yours": false, "topic_id": 150677, "topic_slug": "how-to-skip-the-upload-delay-bs-when-uploading-an-image-on-gradio-4-or-5", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://www.gradio.app/docs/gradio/image#param-event-preprocess", "internal": false, "reflection": false, "title": "Gradio Docs", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-skip-the-upload-delay-bs-when-uploading-an-image-on-gradio-4-or-5/150677/2", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217407, "name": "gutris1", "username": "gutris1", "avatar_template": "/user_avatar/discuss.huggingface.co/gutris1/{size}/45467_2.png", "created_at": "2025-04-22T07:42:20.228Z", "cooked": "<p>not possible at all.<br>\nbut thanks john</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-22T07:42:20.228Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 15.4, "yours": false, "topic_id": 150677, "topic_slug": "how-to-skip-the-upload-delay-bs-when-uploading-an-image-on-gradio-4-or-5", "display_username": "gutris1", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90663, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-skip-the-upload-delay-bs-when-uploading-an-image-on-gradio-4-or-5/150677/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 217547, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-22T19:42:50.416Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-22T19:42:50.416Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 1, "readers_count": 0, "score": 5.2, "yours": false, "topic_id": 150677, "topic_slug": "how-to-skip-the-upload-delay-bs-when-uploading-an-image-on-gradio-4-or-5", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-skip-the-upload-delay-bs-when-uploading-an-image-on-gradio-4-or-5/150677/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I just made a tiny HF space to extract image metadata generated from SD WebUI/SwarmUI using JavaScript <a href="https://huggingface.co/spaces/gutris1/image-info" class="inline-onebox">Image Info - a Hugging Face Space by gutris1</a><br> I’m sticking with version 3 because it doesn’t do any preprocessing and displays the image immediately after uploading within a second.<br> I’m curious if the same can be done with version 4 or 5.</p>
<p>not possible at all.<br> but thanks john</p>
Payment Required huggingface&hellip;Qwen2.5-Coder-32B-Instruct
https://discuss.huggingface.co/t/payment-required-huggingface-qwen2-5-coder-32b-instruct/151620
151,620
5
2025-04-21T11:58:24.199000Z
[ { "id": 217202, "name": "Pavel Kruchinin", "username": "PavelKruchinin", "avatar_template": "/user_avatar/discuss.huggingface.co/pavelkruchinin/{size}/46005_2.png", "created_at": "2025-04-21T11:58:24.282Z", "cooked": "<p>I work with unit2 course: <a href=\"https://huggingface.co/learn/agents-course/unit2/smolagents/code_agents\" class=\"inline-onebox\">Building Agents That Use Code - Hugging Face Agents Course</a><br>\nAnd on secondrun of example i got this…<br>\nHow to resolve it ?</p>\n<p>402 Client Error: Payment Required for url: <a href=\"https://api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-32B-Instruct/v1/chat/completions\">https://api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-32B-Instruct/v1/chat/completions</a> (Request ID: Root=1-68063243-7ef4317d76eacb46003d4813;485422fc-79dd-43ff-8361-7cfd309a5eab)<br>\nYou have exceeded your monthly included credits for Inference Providers. Subscribe to PRO to get 20x more monthly included credits.<br>\npython-BaseException</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-21T11:58:24.282Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 119, "reads": 21, "readers_count": 20, "score": 614.2, "yours": false, "topic_id": 151620, "topic_slug": "payment-required-huggingface-qwen2-5-coder-32b-instruct", "display_username": "Pavel Kruchinin", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/learn/agents-course/unit2/smolagents/code_agents", "internal": false, "reflection": false, "title": "Building Agents That Use Code - Hugging Face Agents Course", "clicks": 2 }, { "url": "https://api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-32B-Instruct/v1/chat/completions", "internal": false, "reflection": false, "title": null, "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91459, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/payment-required-huggingface-qwen2-5-coder-32b-instruct/151620/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217213, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-21T12:54:09.677Z", "cooked": "<pre data-code-wrap=\"py\"><code class=\"lang-py\">model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud/'\n\n# Initialize the model\n\nmodel = HfApiModel(model_id=model_id)\n</code></pre>\n<p>From HF Discord. I hope this still works…</p>\n<p>Well, it might be easier to use other models or <a href=\"https://huggingface.co/docs/smolagents/reference/models#smolagents.TransformersModel\">local models</a>.</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-25T08:42:06.448Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 6, "reads": 20, "readers_count": 19, "score": 34, "yours": false, "topic_id": 151620, "topic_slug": "payment-required-huggingface-qwen2-5-coder-32b-instruct", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/smolagents/reference/models#smolagents.TransformersModel", "internal": false, "reflection": false, "title": "Models", "clicks": 28 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/payment-required-huggingface-qwen2-5-coder-32b-instruct/151620/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217511, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-22T14:45:46.315Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-22T14:45:46.315Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 14, "readers_count": 13, "score": 12.8, "yours": false, "topic_id": 151620, "topic_slug": "payment-required-huggingface-qwen2-5-coder-32b-instruct", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/payment-required-huggingface-qwen2-5-coder-32b-instruct/151620/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I work with unit2 course: <a href="https://huggingface.co/learn/agents-course/unit2/smolagents/code_agents" class="inline-onebox">Building Agents That Use Code - Hugging Face Agents Course</a><br> And on secondrun of example i got this…<br> How to resolve it ?</p> <p>402 Client Error: Payment Required for url: <a href="https://api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-32B-Instruct/v1/chat/completions">https://api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-32B-Instruct/v1/chat/completions</a> (Request ID: Root=1-68063243-7ef4317d76eacb46003d4813;485422fc-79dd-43ff-8361-7cfd309a5eab)<br> You have exceeded your monthly included credits for Inference Providers. Subscribe to PRO to get 20x more monthly included credits.<br> python-BaseException</p>
<pre data-code-wrap="py"><code class="lang-py">model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud/' # Initialize the model model = HfApiModel(model_id=model_id) </code></pre> <p>From HF Discord. I hope this still works…</p> <p>Well, it might be easier to use other models or <a href="https://huggingface.co/docs/smolagents/reference/models#smolagents.TransformersModel">local models</a>.</p>
Torch.cuda.is_available() is False on ZeroGPU Space
https://discuss.huggingface.co/t/torch-cuda-is-available-is-false-on-zerogpu-space/151707
151,707
24
2025-04-22T00:21:49.503000Z
[ { "id": 217328, "name": "Nari Admin", "username": "NariLabs", "avatar_template": "/user_avatar/discuss.huggingface.co/narilabs/{size}/46065_2.png", "created_at": "2025-04-22T00:21:49.566Z", "cooked": "<pre><code class=\"lang-auto\">/usr/local/lib/python3.10/site-packages/torch/cuda/__init__.py:734: UserWarning: Can't initialize NVML\n warnings.warn(\"Can't initialize NVML\")\nUsing device: cpu\nLoading Nari model...\n\nconfig.json: 0%| | 0.00/1.08k [00:00&lt;?, ?B/s]\nconfig.json: 100%|██████████| 1.08k/1.08k [00:00&lt;00:00, 7.24MB/s]\n\ndia-v0_1.pth: 0%| | 0.00/6.44G [00:00&lt;?, ?B/s]\ndia-v0_1.pth: 1%|▏ | 94.4M/6.44G [00:01&lt;01:08, 92.9MB/s]\ndia-v0_1.pth: 23%|██▎ | 1.46G/6.44G [00:02&lt;00:06, 830MB/s] \ndia-v0_1.pth: 50%|████▉ | 3.22G/6.44G [00:03&lt;00:02, 1.25GB/s]\ndia-v0_1.pth: 75%|███████▌ | 4.85G/6.44G [00:04&lt;00:01, 1.40GB/s]\ndia-v0_1.pth: 100%|█████████▉| 6.44G/6.44G [00:05&lt;00:00, 1.27GB/s]\nError loading Nari model: Error loading checkpoint from /home/user/.cache/huggingface/hub/models--nari-labs--Dia-1.6B/snapshots/ea1fb6655d1de2f270f1b0ee6743bba7465f407a/dia-v0_1.pth\nTraceback (most recent call last):\n File \"/home/user/app/dia/model.py\", line 91, in from_local\n dia.model.load_state_dict(torch.load(checkpoint_path, map_location=device))\n File \"/usr/local/lib/python3.10/site-packages/torch/serialization.py\", line 1462, in load\n return _load(\n File \"/usr/local/lib/python3.10/site-packages/torch/serialization.py\", line 1964, in _load\n result = unpickler.load()\n File \"/usr/local/lib/python3.10/site-packages/torch/_weights_only_unpickler.py\", line 512, in load\n self.append(self.persistent_load(pid))\n File \"/usr/local/lib/python3.10/site-packages/torch/serialization.py\", line 1928, in persistent_load\n typed_storage = load_tensor(\n File \"/usr/local/lib/python3.10/site-packages/torch/serialization.py\", line 1900, in load_tensor\n wrap_storage=restore_location(storage, location),\n File \"/usr/local/lib/python3.10/site-packages/torch/serialization.py\", line 1806, in restore_location\n return default_restore_location(storage, str(map_location))\n File \"/usr/local/lib/python3.10/site-packages/torch/serialization.py\", line 693, in default_restore_location\n result = fn(storage, location)\n File \"/usr/local/lib/python3.10/site-packages/torch/serialization.py\", line 631, in _deserialize\n device = _validate_device(location, backend_name)\n File \"/usr/local/lib/python3.10/site-packages/torch/serialization.py\", line 600, in _validate_device\n raise RuntimeError(\nRuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.\n</code></pre>\n<p>Trying to get my Space up with a ZeroGPU.<br>\nBut failing due to torch.cuda.is_available() being False?!</p>\n<p>Can someone please help me…</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-22T00:21:49.566Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 76, "reads": 5, "readers_count": 4, "score": 341, "yours": false, "topic_id": 151707, "topic_slug": "torch-cuda-is-available-is-false-on-zerogpu-space", "display_username": "Nari Admin", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91534, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/torch-cuda-is-available-is-false-on-zerogpu-space/151707/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217330, "name": "Nari Admin", "username": "NariLabs", "avatar_template": "/user_avatar/discuss.huggingface.co/narilabs/{size}/46065_2.png", "created_at": "2025-04-22T00:22:44.778Z", "cooked": "<p>descript-audio-codec&gt;=1.0.0<br>\ngradio&gt;=5.25.2<br>\nhuggingface-hub&gt;=0.30.2<br>\nnumpy&gt;=2.2.4<br>\npydantic&gt;=2.11.3<br>\nsoundfile&gt;=0.13.1<br>\ntorchaudio&gt;=2.0.0<br>\ntorch&gt;=2.0.0</p>\n<p>is requirements.txt</p>\n<p>here’s the link to space: <a href=\"https://huggingface.co/spaces/nari-labs/Dia-1.6B\" class=\"inline-onebox\">Dia 1.6B - a Hugging Face Space by nari-labs</a></p>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-22T00:22:44.778Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 21, "yours": false, "topic_id": 151707, "topic_slug": "torch-cuda-is-available-is-false-on-zerogpu-space", "display_username": "Nari Admin", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/spaces/nari-labs/Dia-1.6B", "internal": false, "reflection": false, "title": "Dia 1.6B - a Hugging Face Space by nari-labs", "clicks": 4 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91534, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/torch-cuda-is-available-is-false-on-zerogpu-space/151707/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217334, "name": "Nari Admin", "username": "NariLabs", "avatar_template": "/user_avatar/discuss.huggingface.co/narilabs/{size}/46065_2.png", "created_at": "2025-04-22T00:44:02.864Z", "cooked": "<p>Fixed it by using <span class=\"mention\">@spaces</span>.<br>\nSorry for the noob-issue.</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-22T00:44:02.864Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 1, "reads": 5, "readers_count": 4, "score": 21, "yours": false, "topic_id": 151707, "topic_slug": "torch-cuda-is-available-is-false-on-zerogpu-space", "display_username": "Nari Admin", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91534, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/torch-cuda-is-available-is-false-on-zerogpu-space/151707/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 91534, "username": "NariLabs", "name": "Nari Admin", "avatar_template": "/user_avatar/discuss.huggingface.co/narilabs/{size}/46065_2.png" }, "action_code": null, "via_email": null }, { "id": 217495, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-22T12:44:37.388Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-22T12:44:37.388Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 151707, "topic_slug": "torch-cuda-is-available-is-false-on-zerogpu-space", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/torch-cuda-is-available-is-false-on-zerogpu-space/151707/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<pre><code class="lang-auto">/usr/local/lib/python3.10/site-packages/torch/cuda/__init__.py:734: UserWarning: Can't initialize NVML warnings.warn("Can't initialize NVML") Using device: cpu Loading Nari model... config.json: 0%| | 0.00/1.08k [00:00&lt;?, ?B/s] config.json: 100%|██████████| 1.08k/1.08k [00:00&lt;00:00, 7.24MB/s] dia-v0_1.pth: 0%| | 0.00/6.44G [00:00&lt;?, ?B/s] dia-v0_1.pth: 1%|▏ | 94.4M/6.44G [00:01&lt;01:08, 92.9MB/s] dia-v0_1.pth: 23%|██▎ | 1.46G/6.44G [00:02&lt;00:06, 830MB/s] dia-v0_1.pth: 50%|████▉ | 3.22G/6.44G [00:03&lt;00:02, 1.25GB/s] dia-v0_1.pth: 75%|███████▌ | 4.85G/6.44G [00:04&lt;00:01, 1.40GB/s] dia-v0_1.pth: 100%|█████████▉| 6.44G/6.44G [00:05&lt;00:00, 1.27GB/s] Error loading Nari model: Error loading checkpoint from /home/user/.cache/huggingface/hub/models--nari-labs--Dia-1.6B/snapshots/ea1fb6655d1de2f270f1b0ee6743bba7465f407a/dia-v0_1.pth Traceback (most recent call last): File "/home/user/app/dia/model.py", line 91, in from_local dia.model.load_state_dict(torch.load(checkpoint_path, map_location=device)) File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 1462, in load return _load( File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 1964, in _load result = unpickler.load() File "/usr/local/lib/python3.10/site-packages/torch/_weights_only_unpickler.py", line 512, in load self.append(self.persistent_load(pid)) File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 1928, in persistent_load typed_storage = load_tensor( File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 1900, in load_tensor wrap_storage=restore_location(storage, location), File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 1806, in restore_location return default_restore_location(storage, str(map_location)) File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 693, in default_restore_location result = fn(storage, location) File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 631, in _deserialize device = _validate_device(location, backend_name) File "/usr/local/lib/python3.10/site-packages/torch/serialization.py", line 600, in _validate_device raise RuntimeError( RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU. </code></pre> <p>Trying to get my Space up with a ZeroGPU.<br> But failing due to torch.cuda.is_available() being False?!</p> <p>Can someone please help me…</p>
<p>Fixed it by using <span class="mention">@spaces</span>.<br> Sorry for the noob-issue.</p>
Invalid user token when trying to used gated repo
https://discuss.huggingface.co/t/invalid-user-token-when-trying-to-used-gated-repo/151160
151,160
5
2025-04-18T16:01:13.019000Z
[ { "id": 216583, "name": "Emmanuel", "username": "earrgames", "avatar_template": "/user_avatar/discuss.huggingface.co/earrgames/{size}/45815_2.png", "created_at": "2025-04-18T16:01:13.105Z", "cooked": "<p>Greetings everyone!</p>\n<p>Yesterday Flux.1 repos started failing on me due to permissions errors. I requested access to the repos and it was granted.</p>\n<p>I created two access tokens (One read, another finegrained). Both fails when using<br>\n“from huggingface_hub import login<br>\nlogin(token=“mytoken”)”</p>\n<pre><code class=\"lang-auto\">===== Application Startup at 2025-04-18 15:18:21 =====\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py\", line 409, in hf_raise_for_status\n response.raise_for_status()\n File \"/usr/local/lib/python3.10/site-packages/requests/models.py\", line 1024, in raise_for_status\n raise HTTPError(http_error_msg, response=self)\nrequests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py\", line 1737, in whoami\n hf_raise_for_status(r)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py\", line 482, in hf_raise_for_status\n raise _format(HfHubHTTPError, str(e), response) from e\nhuggingface_hub.errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2 (Request ID: Root=1-68026d70-2fc01fa71c1b05fa675ead85;49fd364d-489b-4d34-8f3a-fdd25b2cbd6d)\n\nInvalid credentials in Authorization header\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/home/user/app/app.py\", line 12, in &lt;module&gt;\n login(token=\"[REDACTED]\")\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py\", line 101, in inner_f\n return f(*args, **kwargs)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py\", line 31, in inner_f\n return f(*args, **kwargs)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py\", line 126, in login\n _login(token, add_to_git_credential=add_to_git_credential)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py\", line 404, in _login\n token_info = whoami(token)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py\", line 114, in _inner_fn\n return fn(*args, **kwargs)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py\", line 1750, in whoami\n raise HTTPError(error_message, request=e.request, response=e.response) from e\nrequests.exceptions.HTTPError: Invalid user token.\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py\", line 409, in hf_raise_for_status\n response.raise_for_status()\n File \"/usr/local/lib/python3.10/site-packages/requests/models.py\", line 1024, in raise_for_status\n raise HTTPError(http_error_msg, response=self)\nrequests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py\", line 1737, in whoami\n hf_raise_for_status(r)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py\", line 482, in hf_raise_for_status\n raise _format(HfHubHTTPError, str(e), response) from e\nhuggingface_hub.errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2 (Request ID: Root=1-68026d7b-0fb4003969dc68811495ef94;e6c2ca18-f70c-4163-840f-d0c55ff351b9)\n\nInvalid credentials in Authorization header\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/home/user/app/app.py\", line 12, in &lt;module&gt;\n login(token=\"[[REDACTED]]\")\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py\", line 101, in inner_f\n return f(*args, **kwargs)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py\", line 31, in inner_f\n return f(*args, **kwargs)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py\", line 126, in login\n _login(token, add_to_git_credential=add_to_git_credential)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py\", line 404, in _login\n token_info = whoami(token)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py\", line 114, in _inner_fn\n return fn(*args, **kwargs)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py\", line 1750, in whoami\n raise HTTPError(error_message, request=e.request, response=e.response) from e\nrequests.exceptions.HTTPError: Invalid user token.\n \nruntime error\nExit code: 1. Reason: us()\n File \"/usr/local/lib/python3.10/site-packages/requests/models.py\", line 1024, in raise_for_status\n raise HTTPError(http_error_msg, response=self)\nrequests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py\", line 1737, in whoami\n hf_raise_for_status(r)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py\", line 482, in hf_raise_for_status\n raise _format(HfHubHTTPError, str(e), response) from e\nhuggingface_hub.errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2 (Request ID: Root=1-68026d70-2fc01fa71c1b05fa675ead85;49fd364d-489b-4d34-8f3a-fdd25b2cbd6d)\n\nInvalid credentials in Authorization header\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/home/user/app/app.py\", line 12, in &lt;module&gt;\n login(token=\"[redacted]flux\")\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py\", line 101, in inner_f\n return f(*args, **kwargs)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py\", line 31, in inner_f\n return f(*args, **kwargs)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py\", line 126, in login\n _login(token, add_to_git_credential=add_to_git_credential)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py\", line 404, in _login\n token_info = whoami(token)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py\", line 114, in _inner_fn\n return fn(*args, **kwargs)\n File \"/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py\", line 1750, in whoami\n raise HTTPError(error_message, request=e.request, response=e.response) from e\nrequests.exceptions.HTTPError: Invalid user token.\n\n</code></pre>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/1/f/1fce17ecbb0dbdbfde2c7cd532154b18f7b1b29f.png\" data-download-href=\"/uploads/short-url/4xmlZLh0BWg8FGW6y1gHQmSuTDx.png?dl=1\" title=\"error\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/f/1fce17ecbb0dbdbfde2c7cd532154b18f7b1b29f_2_617x500.png\" alt=\"error\" data-base62-sha1=\"4xmlZLh0BWg8FGW6y1gHQmSuTDx\" width=\"617\" height=\"500\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/f/1fce17ecbb0dbdbfde2c7cd532154b18f7b1b29f_2_617x500.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/f/1fce17ecbb0dbdbfde2c7cd532154b18f7b1b29f_2_925x750.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/1/f/1fce17ecbb0dbdbfde2c7cd532154b18f7b1b29f.png 2x\" data-dominant-color=\"121722\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">error</span><span class=\"informations\">1112×900 76.1 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>Any ideas what I’m doing wrong?<br>\nThank you very much for your time.</p>", "post_number": 1, "post_type": 1, "posts_count": 7, "updated_at": "2025-04-18T16:04:18.194Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 347, "reads": 16, "readers_count": 15, "score": 1713.2, "yours": false, "topic_id": 151160, "topic_slug": "invalid-user-token-when-trying-to-used-gated-repo", "display_username": "Emmanuel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/invalid-credentials-in-authorization-header-flux-dev/168716/2", "internal": true, "reflection": true, "title": "Invalid credentials in Authorization header (FLux dev)", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91188, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/invalid-user-token-when-trying-to-used-gated-repo/151160/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216585, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-18T16:07:33.111Z", "cooked": "<p>A token is required for dev, but not for schnell. Perhaps it will work without login()…</p>\n<p>In any case, it seems likely that this is due to the Inference API construction work that has been going on for the past week…</p><aside class=\"quote\" data-post=\"32\" data-topic=\"150333\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/michellehbn/48/53028_2.png\" class=\"avatar\">\n <div class=\"quote-title__text-content\">\n <a href=\"https://discuss.huggingface.co/t/500-internal-error-were-working-hard-to-fix-this-as-soon-as-possible/150333/32\">500 Internal Error - We're working hard to fix this as soon as possible</a> <a class=\"badge-category__wrapper \" href=\"/c/transformers/9\"><span data-category-id=\"9\" style=\"--category-badge-color: #F7941D; --category-badge-text-color: #000000;\" data-drop-close=\"true\" class=\"badge-category --style-square \" title=\"This category is for any question related to the Transformers library. You can also file an issue.\"><span class=\"badge-category__name\">🤗Transformers</span></span></a>\n </div>\n </div>\n <blockquote>\n All should be starting to look better now <img width=\"20\" height=\"20\" src=\"https://emoji.discourse-cdn.com/apple/hugs.png?v=14\" title=\"hugs\" alt=\"hugs\" class=\"emoji\"> if that’s not the case, please let us know. And a big thanks to everyone for reporting and bearing with us, we appreciate it!\n </blockquote>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 7, "updated_at": "2025-04-18T16:08:12.478Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 9, "reads": 12, "readers_count": 11, "score": 52.4, "yours": false, "topic_id": 151160, "topic_slug": "invalid-user-token-when-trying-to-used-gated-repo", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/500-internal-error-were-working-hard-to-fix-this-as-soon-as-possible/150333/32", "internal": true, "reflection": false, "title": "500 Internal Error - We're working hard to fix this as soon as possible", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/invalid-user-token-when-trying-to-used-gated-repo/151160/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216586, "name": "Emmanuel", "username": "earrgames", "avatar_template": "/user_avatar/discuss.huggingface.co/earrgames/{size}/45815_2.png", "created_at": "2025-04-18T16:13:11.619Z", "cooked": "<p>I did notice that the other flux repos were working fine, it’s only the img2img, but I can’t find an alternative setup to Akjava (I cloned this repo months ago, and yesterday stopped working with the premission problems) <a href=\"https://huggingface.co/spaces/Akjava/flux1-schnell-img2img\">Flux1 Schnell Img2img - a Hugging Face Space by Akjava</a>.</p>\n<p>I added the login part with the hope it would resolve, but no clue atm if I should just wait a couple of days.</p>", "post_number": 3, "post_type": 1, "posts_count": 7, "updated_at": "2025-04-18T16:13:11.619Z", "reply_count": 1, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 1, "reads": 12, "readers_count": 11, "score": 27.4, "yours": false, "topic_id": 151160, "topic_slug": "invalid-user-token-when-trying-to-used-gated-repo", "display_username": "Emmanuel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/spaces/Akjava/flux1-schnell-img2img", "internal": false, "reflection": false, "title": "Flux1 Schnell Img2img - a Hugging Face Space by Akjava", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91188, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/invalid-user-token-when-trying-to-used-gated-repo/151160/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 216588, "name": "Emmanuel", "username": "earrgames", "avatar_template": "/user_avatar/discuss.huggingface.co/earrgames/{size}/45815_2.png", "created_at": "2025-04-18T16:18:49.448Z", "cooked": "<p>Without the login, I get</p>\n<pre><code class=\"lang-auto\">Cannot access gated repo for url https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/model_index.json.\nAccess to model black-forest-labs/FLUX.1-schnell is restricted. You must have access to it and be authenticated to access it. Please log in.\n</code></pre>\n<p>Which is weird, because I can access the link (<a href=\"https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/model_index.json\">https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/model_index.json</a>) in the browser while logged in my hf account.</p>", "post_number": 4, "post_type": 1, "posts_count": 7, "updated_at": "2025-04-18T16:18:49.448Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 1, "reads": 14, "readers_count": 13, "score": 22.8, "yours": false, "topic_id": 151160, "topic_slug": "invalid-user-token-when-trying-to-used-gated-repo", "display_username": "Emmanuel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/black-forest-labs/FLUX.1-schnell/resolve/main/model_index.json", "internal": false, "reflection": false, "title": null, "clicks": 5 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91188, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/invalid-user-token-when-trying-to-used-gated-repo/151160/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 91188, "username": "earrgames", "name": "Emmanuel", "avatar_template": "/user_avatar/discuss.huggingface.co/earrgames/{size}/45815_2.png" }, "action_code": null, "via_email": null }, { "id": 216671, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-19T00:14:17.322Z", "cooked": "<p>Hmm… FLUX.1 schnell is gated NOW but accessible… It’s definitely a bug. <a class=\"mention\" href=\"/u/meganariley\">@meganariley</a> <a class=\"mention\" href=\"/u/pierric\">@pierric</a> <a class=\"mention\" href=\"/u/wauplin\">@Wauplin</a> <a class=\"mention\" href=\"/u/michellehbn\">@michellehbn</a></p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/e/6/e672b70cea24c1235d54d75e1ba7d9d3fe907691.png\" data-download-href=\"/uploads/short-url/wSDAPvuiUyROn3Vm0LdfIGWTOM1.png?dl=1\" title=\"schnellgated1\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/e/6/e672b70cea24c1235d54d75e1ba7d9d3fe907691_2_690x463.png\" alt=\"schnellgated1\" data-base62-sha1=\"wSDAPvuiUyROn3Vm0LdfIGWTOM1\" width=\"690\" height=\"463\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/e/6/e672b70cea24c1235d54d75e1ba7d9d3fe907691_2_690x463.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/e/6/e672b70cea24c1235d54d75e1ba7d9d3fe907691_2_1035x694.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/e/6/e672b70cea24c1235d54d75e1ba7d9d3fe907691.png 2x\" data-dominant-color=\"121823\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">schnellgated1</span><span class=\"informations\">1040×698 47.9 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/1/2/1226390942a1489b6ab26100d78e7aea9736c1dd.png\" data-download-href=\"/uploads/short-url/2Ayu9QSutloIvGB8AjHKlhoNgDj.png?dl=1\" title=\"schnellgated2\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/2/1226390942a1489b6ab26100d78e7aea9736c1dd_2_690x423.png\" alt=\"schnellgated2\" data-base62-sha1=\"2Ayu9QSutloIvGB8AjHKlhoNgDj\" width=\"690\" height=\"423\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/2/1226390942a1489b6ab26100d78e7aea9736c1dd_2_690x423.png, https://us1.discourse-cdn.com/hellohellohello/original/3X/1/2/1226390942a1489b6ab26100d78e7aea9736c1dd.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/1/2/1226390942a1489b6ab26100d78e7aea9736c1dd.png 2x\" data-dominant-color=\"121824\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">schnellgated2</span><span class=\"informations\">909×558 33.2 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div><br>\n…</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/black-forest-labs/FLUX.1-schnell\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/black-forest-labs/FLUX.1-schnell\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/b/6/b688e2750c30e03123cdc58920a1fd7d568ac521_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5B70A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/black-forest-labs/FLUX.1-schnell\" target=\"_blank\" rel=\"noopener\">black-forest-labs/FLUX.1-schnell · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 5, "post_type": 1, "posts_count": 7, "updated_at": "2025-04-19T00:15:18.079Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 9, "reads": 14, "readers_count": 13, "score": 77.8, "yours": false, "topic_id": 151160, "topic_slug": "invalid-user-token-when-trying-to-used-gated-repo", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/black-forest-labs/FLUX.1-schnell", "internal": false, "reflection": false, "title": "black-forest-labs/FLUX.1-schnell · Hugging Face", "clicks": 2 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/invalid-user-token-when-trying-to-used-gated-repo/151160/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216861, "name": "Emmanuel", "username": "earrgames", "avatar_template": "/user_avatar/discuss.huggingface.co/earrgames/{size}/45815_2.png", "created_at": "2025-04-20T00:33:44.511Z", "cooked": "<p>Jesus… It’s working now. I’m an idiot, I didn’t know I had to pass the HF_TOKEN as a space secret <img src=\"https://emoji.discourse-cdn.com/apple/clown_face.png?v=14\" title=\":clown_face:\" class=\"emoji\" alt=\":clown_face:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>Thanks a lot for your time in any case!</p>", "post_number": 6, "post_type": 1, "posts_count": 7, "updated_at": "2025-04-20T00:33:44.511Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 8, "readers_count": 7, "score": 26.6, "yours": false, "topic_id": 151160, "topic_slug": "invalid-user-token-when-trying-to-used-gated-repo", "display_username": "Emmanuel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91188, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/invalid-user-token-when-trying-to-used-gated-repo/151160/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 217405, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-22T07:25:09.814Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 7, "post_type": 3, "posts_count": 7, "updated_at": "2025-04-22T07:25:09.814Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 5, "readers_count": 4, "score": 6, "yours": false, "topic_id": 151160, "topic_slug": "invalid-user-token-when-trying-to-used-gated-repo", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/invalid-user-token-when-trying-to-used-gated-repo/151160/7", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Greetings everyone!</p> <p>Yesterday Flux.1 repos started failing on me due to permissions errors. I requested access to the repos and it was granted.</p> <p>I created two access tokens (One read, another finegrained). Both fails when using<br> “from huggingface_hub import login<br> login(token=“mytoken”)”</p> <pre><code class="lang-auto">===== Application Startup at 2025-04-18 15:18:21 ===== Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 409, in hf_raise_for_status response.raise_for_status() File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py", line 1737, in whoami hf_raise_for_status(r) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 482, in hf_raise_for_status raise _format(HfHubHTTPError, str(e), response) from e huggingface_hub.errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2 (Request ID: Root=1-68026d70-2fc01fa71c1b05fa675ead85;49fd364d-489b-4d34-8f3a-fdd25b2cbd6d) Invalid credentials in Authorization header The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/user/app/app.py", line 12, in &lt;module&gt; login(token="[REDACTED]") File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py", line 101, in inner_f return f(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py", line 31, in inner_f return f(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py", line 126, in login _login(token, add_to_git_credential=add_to_git_credential) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py", line 404, in _login token_info = whoami(token) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py", line 1750, in whoami raise HTTPError(error_message, request=e.request, response=e.response) from e requests.exceptions.HTTPError: Invalid user token. Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 409, in hf_raise_for_status response.raise_for_status() File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py", line 1737, in whoami hf_raise_for_status(r) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 482, in hf_raise_for_status raise _format(HfHubHTTPError, str(e), response) from e huggingface_hub.errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2 (Request ID: Root=1-68026d7b-0fb4003969dc68811495ef94;e6c2ca18-f70c-4163-840f-d0c55ff351b9) Invalid credentials in Authorization header The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/user/app/app.py", line 12, in &lt;module&gt; login(token="[[REDACTED]]") File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py", line 101, in inner_f return f(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py", line 31, in inner_f return f(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py", line 126, in login _login(token, add_to_git_credential=add_to_git_credential) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py", line 404, in _login token_info = whoami(token) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py", line 1750, in whoami raise HTTPError(error_message, request=e.request, response=e.response) from e requests.exceptions.HTTPError: Invalid user token. runtime error Exit code: 1. Reason: us() File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2 The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py", line 1737, in whoami hf_raise_for_status(r) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_http.py", line 482, in hf_raise_for_status raise _format(HfHubHTTPError, str(e), response) from e huggingface_hub.errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2 (Request ID: Root=1-68026d70-2fc01fa71c1b05fa675ead85;49fd364d-489b-4d34-8f3a-fdd25b2cbd6d) Invalid credentials in Authorization header The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/user/app/app.py", line 12, in &lt;module&gt; login(token="[redacted]flux") File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py", line 101, in inner_f return f(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_deprecation.py", line 31, in inner_f return f(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py", line 126, in login _login(token, add_to_git_credential=add_to_git_credential) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/_login.py", line 404, in _login token_info = whoami(token) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn return fn(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/huggingface_hub/hf_api.py", line 1750, in whoami raise HTTPError(error_message, request=e.request, response=e.response) from e requests.exceptions.HTTPError: Invalid user token. </code></pre> <p><div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/1/f/1fce17ecbb0dbdbfde2c7cd532154b18f7b1b29f.png" data-download-href="/uploads/short-url/4xmlZLh0BWg8FGW6y1gHQmSuTDx.png?dl=1" title="error" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/f/1fce17ecbb0dbdbfde2c7cd532154b18f7b1b29f_2_617x500.png" alt="error" data-base62-sha1="4xmlZLh0BWg8FGW6y1gHQmSuTDx" width="617" height="500" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/f/1fce17ecbb0dbdbfde2c7cd532154b18f7b1b29f_2_617x500.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/f/1fce17ecbb0dbdbfde2c7cd532154b18f7b1b29f_2_925x750.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/1/f/1fce17ecbb0dbdbfde2c7cd532154b18f7b1b29f.png 2x" data-dominant-color="121722"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">error</span><span class="informations">1112×900 76.1 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p> <p>Any ideas what I’m doing wrong?<br> Thank you very much for your time.</p>
<p>Jesus… It’s working now. I’m an idiot, I didn’t know I had to pass the HF_TOKEN as a space secret <img src="https://emoji.discourse-cdn.com/apple/clown_face.png?v=14" title=":clown_face:" class="emoji" alt=":clown_face:" loading="lazy" width="20" height="20"></p> <p>Thanks a lot for your time in any case!</p>
Problem in AI Agents course - Smolagents
https://discuss.huggingface.co/t/problem-in-ai-agents-course-smolagents/151299
151,299
5
2025-04-19T13:57:53.024000Z
[ { "id": 216806, "name": "Saltuk Bugra KARACAN", "username": "sbkaracan", "avatar_template": "/user_avatar/discuss.huggingface.co/sbkaracan/{size}/45888_2.png", "created_at": "2025-04-19T13:57:53.110Z", "cooked": "<p>When I am trying to duplicate and build the Let’s Create Our First Agent Using smolagents’ template, I get this error:<br>\nruntime error<br>\nExit code: 1. Reason:</p>\n<p>tool.py: 0%| | 0.00/635 [00:00&lt;?, ?B/s]e[A<br>\ntool.py: 100%|██████████| 635/635 [00:00&lt;00:00, 3.55MB/s]<br>\nTraceback (most recent call last):<br>\nFile “/home/user/app/app.py”, line 56, in <br>\nagent = CodeAgent(<br>\nFile “/usr/local/lib/python3.10/site-packages/smolagents/agents.py”, line 1204, in <strong>init</strong><br>\nsuper().<strong>init</strong>(<br>\nFile “/usr/local/lib/python3.10/site-packages/smolagents/agents.py”, line 207, in <strong>init</strong><br>\nassert not missing_keys, (<br>\nAssertionError: Some prompt templates are missing from your custom <code>prompt_templates</code>: {‘final_answer’}</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-19T13:57:53.110Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 890, "reads": 76, "readers_count": 75, "score": 4535, "yours": false, "topic_id": 151299, "topic_slug": "problem-in-ai-agents-course-smolagents", "display_username": "Saltuk Bugra KARACAN", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 5 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91275, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-in-ai-agents-course-smolagents/151299/1", "reactions": [ { "id": "heart", "type": "emoji", "count": 3 }, { "id": "+1", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 5, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216872, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-20T01:59:11.737Z", "cooked": "<p>The new version of smolagents seems to have a bug. Change it like this and it should work.</p>\n<p><strong>requirements.txt</strong></p>\n<pre><code class=\"lang-auto\">markdownify\nsmolagents==1.13.0\nrequests\nduckduckgo_search\npandas\n</code></pre>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-20T01:59:11.737Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 26, "reads": 69, "readers_count": 68, "score": 383.6, "yours": false, "topic_id": 151299, "topic_slug": "problem-in-ai-agents-course-smolagents", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 16 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-in-ai-agents-course-smolagents/151299/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 16 } ], "current_user_reaction": null, "reaction_users_count": 16, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216971, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-20T14:00:03.782Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-20T14:00:03.782Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 6, "reads": 66, "readers_count": 65, "score": 43, "yours": false, "topic_id": 151299, "topic_slug": "problem-in-ai-agents-course-smolagents", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-in-ai-agents-course-smolagents/151299/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>When I am trying to duplicate and build the Let’s Create Our First Agent Using smolagents’ template, I get this error:<br> runtime error<br> Exit code: 1. Reason:</p> <p>tool.py: 0%| | 0.00/635 [00:00&lt;?, ?B/s]e[A<br> tool.py: 100%|██████████| 635/635 [00:00&lt;00:00, 3.55MB/s]<br> Traceback (most recent call last):<br> File “/home/user/app/app.py”, line 56, in <br> agent = CodeAgent(<br> File “/usr/local/lib/python3.10/site-packages/smolagents/agents.py”, line 1204, in <strong>init</strong><br> super().<strong>init</strong>(<br> File “/usr/local/lib/python3.10/site-packages/smolagents/agents.py”, line 207, in <strong>init</strong><br> assert not missing_keys, (<br> AssertionError: Some prompt templates are missing from your custom <code>prompt_templates</code>: {‘final_answer’}</p>
<p>The new version of smolagents seems to have a bug. Change it like this and it should work.</p> <p><strong>requirements.txt</strong></p> <pre><code class="lang-auto">markdownify smolagents==1.13.0 requests duckduckgo_search pandas </code></pre>
GIthub Dataset Filtering
https://discuss.huggingface.co/t/github-dataset-filtering/151277
151,277
10
2025-04-19T11:07:43.855000Z
[ { "id": 216777, "name": "James Martin", "username": "JamesMartin0105", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/f19dbf/{size}.png", "created_at": "2025-04-19T11:07:43.915Z", "cooked": "<p>Hello.<br>\nHope you are doing well.<br>\nI have a trouble.</p>\n<p>I have some code piece that is generated by github dataset “macrocosm-os/code-parrot-github-code”.<br>\nHow to get github repo and path url from this?</p>\n<p>Thanks for your reviewing.</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-19T11:08:56.831Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 7, "reads": 5, "readers_count": 4, "score": 51, "yours": false, "topic_id": 151277, "topic_slug": "github-dataset-filtering", "display_username": "James Martin", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91264, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/github-dataset-filtering/151277/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216800, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-19T13:09:13.786Z", "cooked": "<p>Hmm…</p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">github_url = f\"https://github.com/{repo_name}/blob/main/{file_path}\"\n</code></pre>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-19T13:09:13.786Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 5, "readers_count": 4, "score": 26, "yours": false, "topic_id": 151277, "topic_slug": "github-dataset-filtering", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/github-dataset-filtering/151277/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216880, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-20T02:18:50.170Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-20T02:18:50.170Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 0.8, "yours": false, "topic_id": 151277, "topic_slug": "github-dataset-filtering", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/github-dataset-filtering/151277/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello.<br> Hope you are doing well.<br> I have a trouble.</p> <p>I have some code piece that is generated by github dataset “macrocosm-os/code-parrot-github-code”.<br> How to get github repo and path url from this?</p> <p>Thanks for your reviewing.</p>
<p>Hmm…</p> <pre data-code-wrap="py"><code class="lang-py">github_url = f"https://github.com/{repo_name}/blob/main/{file_path}" </code></pre>
&ldquo;Challenges in Deploying and Syncing a Hugging Face Space with GitHub Actions
https://discuss.huggingface.co/t/challenges-in-deploying-and-syncing-a-hugging-face-space-with-github-actions/151150
151,150
24
2025-04-18T14:52:16.380000Z
[ { "id": 216571, "name": "siddharth choure", "username": "siddharth786", "avatar_template": "/user_avatar/discuss.huggingface.co/siddharth786/{size}/45809_2.png", "created_at": "2025-04-18T14:52:16.452Z", "cooked": "<p><strong>Description:</strong> I have been working on deploying a machine learning application to Hugging Face Spaces using GitHub Actions. While setting up the workflow, I encountered several challenges, including:</p>\n<ol>\n<li>Issues with large files being rejected by Hugging Face Spaces due to file size limits.</li>\n<li>Errors related to Git LFS not being supported by Hugging Face.</li>\n<li>Syntax and configuration issues in the GitHub Actions workflow file.</li>\n<li>Repository not found errors when pushing to the Hugging Face Space.</li>\n<li>General troubleshooting for Docker-based Hugging Face Spaces.</li>\n</ol>\n<p><strong>Discussion Points:</strong></p>\n<ul>\n<li>Best practices for handling large files when deploying to Hugging Face Spaces.</li>\n<li>How to properly configure GitHub Actions to sync with Hugging Face Spaces.</li>\n<li>Alternatives to Git LFS for managing large assets.</li>\n<li>Troubleshooting techniques for common deployment errors.</li>\n<li>Suggestions for organizing dependencies and Docker configurations for Spaces.</li>\n</ul>\n<p><strong>Objective:</strong> To gather insights, suggestions, and best practices from the community for addressing these challenges and improving the deployment process.<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/9/293be0d35f03f08c2b281f753e6b4d957754d785.png\" data-download-href=\"/uploads/short-url/5SLRCgIr8dgcMXFLo8UCD2fsUgR.png?dl=1\" title=\"Screenshot 2025-04-18 180505\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/9/293be0d35f03f08c2b281f753e6b4d957754d785_2_690x328.png\" alt=\"Screenshot 2025-04-18 180505\" data-base62-sha1=\"5SLRCgIr8dgcMXFLo8UCD2fsUgR\" width=\"690\" height=\"328\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/9/293be0d35f03f08c2b281f753e6b4d957754d785_2_690x328.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/9/293be0d35f03f08c2b281f753e6b4d957754d785_2_1035x492.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/9/293be0d35f03f08c2b281f753e6b4d957754d785_2_1380x656.png 2x\" data-dominant-color=\"0C0E13\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">Screenshot 2025-04-18 180505</span><span class=\"informations\">1675×797 53.4 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>[hugging face ](git clone <a href=\"https://huggingface.co/spaces/siddharth786/email-pii-classifier-v2\" class=\"inline-onebox\">Email Pii Classifier V2 - a Hugging Face Space by siddharth786</a>)<a href=\"https://github.com/siddharth786s1/internship1.git\" rel=\"noopener nofollow ugc\">github link </a></p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-18T14:55:55.040Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 16, "reads": 5, "readers_count": 4, "score": 91, "yours": false, "topic_id": 151150, "topic_slug": "challenges-in-deploying-and-syncing-a-hugging-face-space-with-github-actions", "display_username": "siddharth choure", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/siddharth786s1/internship1.git", "internal": false, "reflection": false, "title": "GitHub - siddharth786s1/internship1", "clicks": 0 }, { "url": "https://huggingface.co/spaces/siddharth786/email-pii-classifier-v2", "internal": false, "reflection": false, "title": "Email Pii Classifier V2 - a Hugging Face Space by siddharth786", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91181, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/challenges-in-deploying-and-syncing-a-hugging-face-space-with-github-actions/151150/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216584, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-18T16:02:39.271Z", "cooked": "<blockquote>\n<p>Best practices for handling large files when deploying to Hugging Face Spaces.</p>\n</blockquote>\n<p>The cheapest option for this is to use a Dataset repository.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/hub/en/spaces-storage#dataset-storage\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/hub/en/spaces-storage#dataset-storage\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"FAF8F2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/hub/en/spaces-storage#dataset-storage\" target=\"_blank\" rel=\"noopener\">Disk usage on Spaces</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<blockquote>\n<p>Alternatives to Git LFS for managing large assets.</p>\n</blockquote>\n<p>Xet is now available. There is an issue with programs that depend on the old huggingface_hub library, but other than that, it is fast and efficient.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/xet-on-the-hub\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/xet-on-the-hub\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/345;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/2/a2c5d55a9ef48c4a942d38f258c499791d392d5a_2_690x345.jpeg\" class=\"thumbnail\" data-dominant-color=\"F3EEE1\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://huggingface.co/blog/xet-on-the-hub\" target=\"_blank\" rel=\"noopener\">Xet is on the Hub</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<blockquote>\n<p>Errors related to Git LFS not being supported by Hugging Face.</p>\n</blockquote>\n<p>git lfs is supported and I use it regularly, but in Windows environments in particular, it won’t work properly unless you first install git and git lfs from the installer. This is because there is an outdated version of git already installed…</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://git-scm.com/downloads/win\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/4/f/4f0570085449c0065744f2d041b3ab486d2707b6.png\" class=\"site-icon\" data-dominant-color=\"F64D27\" width=\"32\" height=\"32\">\n\n <a href=\"https://git-scm.com/downloads/win\" target=\"_blank\" rel=\"noopener\">git-scm.com</a>\n </header>\n\n <article class=\"onebox-body\">\n \n\n<h3><a href=\"https://git-scm.com/downloads/win\" target=\"_blank\" rel=\"noopener\">Git - Downloading Package</a></h3>\n\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://git-lfs.com/\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/f/1/f16572aa053992106b3ae7b3792264219531fd73.png\" class=\"site-icon\" data-dominant-color=\"DE4130\" width=\"48\" height=\"48\">\n\n <a href=\"https://git-lfs.com/\" target=\"_blank\" rel=\"noopener\">Git Large File Storage</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:262/500;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/5/6591624baacb3d731d5b5f5fe3259e07eb8f9b28_2_690x362.png\" class=\"thumbnail\" data-dominant-color=\"E4E2DA\" width=\"690\" height=\"362\"></div>\n\n<h3><a href=\"https://git-lfs.com/\" target=\"_blank\" rel=\"noopener\">Git Large File Storage</a></h3>\n\n <p>Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<blockquote>\n<p>Repository not found errors when pushing to the Hugging Face Space.</p>\n</blockquote>\n<p>In many cases, tokens are not being passed to the private repository. This can often be resolved by using login().</p>\n<blockquote>\n<p>General troubleshooting for Docker-based Hugging Face Spaces.</p>\n</blockquote>\n<p>Searching forums and StackOverflow is also useful, but the official HF documentation is quite detailed and convenient.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/hub/en/spaces-sdks-docker\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/hub/en/spaces-sdks-docker\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/1X/5c4130fb1d8662cb15c5385a9fd9a44626aa4aa2_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"E9E7E2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/hub/en/spaces-sdks-docker\" target=\"_blank\" rel=\"noopener\">Docker Spaces</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/hub/en/spaces-config-reference\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/hub/en/spaces-config-reference\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"FAF8F2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/hub/en/spaces-config-reference\" target=\"_blank\" rel=\"noopener\">Spaces Configuration Reference</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-18T16:02:39.271Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 1, "yours": false, "topic_id": 151150, "topic_slug": "challenges-in-deploying-and-syncing-a-hugging-face-space-with-github-actions", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/hub/en/spaces-config-reference", "internal": false, "reflection": false, "title": "Spaces Configuration Reference", "clicks": 1 }, { "url": "https://huggingface.co/docs/hub/en/spaces-sdks-docker", "internal": false, "reflection": false, "title": "Docker Spaces", "clicks": 1 }, { "url": "https://huggingface.co/docs/hub/en/spaces-storage#dataset-storage", "internal": false, "reflection": false, "title": "Disk usage on Spaces", "clicks": 0 }, { "url": "https://huggingface.co/blog/xet-on-the-hub", "internal": false, "reflection": false, "title": "Xet is on the Hub", "clicks": 0 }, { "url": "https://git-scm.com/downloads/win", "internal": false, "reflection": false, "title": "Git - Downloading Package", "clicks": 0 }, { "url": "https://git-lfs.com/", "internal": false, "reflection": false, "title": "Git Large File Storage | Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/challenges-in-deploying-and-syncing-a-hugging-face-space-with-github-actions/151150/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216715, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-19T04:03:12.504Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-19T04:03:12.504Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 151150, "topic_slug": "challenges-in-deploying-and-syncing-a-hugging-face-space-with-github-actions", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/challenges-in-deploying-and-syncing-a-hugging-face-space-with-github-actions/151150/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p><strong>Description:</strong> I have been working on deploying a machine learning application to Hugging Face Spaces using GitHub Actions. While setting up the workflow, I encountered several challenges, including:</p> <ol> <li>Issues with large files being rejected by Hugging Face Spaces due to file size limits.</li> <li>Errors related to Git LFS not being supported by Hugging Face.</li> <li>Syntax and configuration issues in the GitHub Actions workflow file.</li> <li>Repository not found errors when pushing to the Hugging Face Space.</li> <li>General troubleshooting for Docker-based Hugging Face Spaces.</li> </ol> <p><strong>Discussion Points:</strong></p> <ul> <li>Best practices for handling large files when deploying to Hugging Face Spaces.</li> <li>How to properly configure GitHub Actions to sync with Hugging Face Spaces.</li> <li>Alternatives to Git LFS for managing large assets.</li> <li>Troubleshooting techniques for common deployment errors.</li> <li>Suggestions for organizing dependencies and Docker configurations for Spaces.</li> </ul> <p><strong>Objective:</strong> To gather insights, suggestions, and best practices from the community for addressing these challenges and improving the deployment process.<br> <div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/2/9/293be0d35f03f08c2b281f753e6b4d957754d785.png" data-download-href="/uploads/short-url/5SLRCgIr8dgcMXFLo8UCD2fsUgR.png?dl=1" title="Screenshot 2025-04-18 180505" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/9/293be0d35f03f08c2b281f753e6b4d957754d785_2_690x328.png" alt="Screenshot 2025-04-18 180505" data-base62-sha1="5SLRCgIr8dgcMXFLo8UCD2fsUgR" width="690" height="328" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/9/293be0d35f03f08c2b281f753e6b4d957754d785_2_690x328.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/9/293be0d35f03f08c2b281f753e6b4d957754d785_2_1035x492.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/9/293be0d35f03f08c2b281f753e6b4d957754d785_2_1380x656.png 2x" data-dominant-color="0C0E13"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot 2025-04-18 180505</span><span class="informations">1675×797 53.4 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p> <p>[hugging face ](git clone <a href="https://huggingface.co/spaces/siddharth786/email-pii-classifier-v2" class="inline-onebox">Email Pii Classifier V2 - a Hugging Face Space by siddharth786</a>)<a href="https://github.com/siddharth786s1/internship1.git" rel="noopener nofollow ugc">github link </a></p>
<blockquote> <p>Best practices for handling large files when deploying to Hugging Face Spaces.</p> </blockquote> <p>The cheapest option for this is to use a Dataset repository.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/hub/en/spaces-storage#dataset-storage"> <header class="source"> <a href="https://huggingface.co/docs/hub/en/spaces-storage#dataset-storage" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png" class="thumbnail" data-dominant-color="FAF8F2" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/hub/en/spaces-storage#dataset-storage" target="_blank" rel="noopener">Disk usage on Spaces</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <blockquote> <p>Alternatives to Git LFS for managing large assets.</p> </blockquote> <p>Xet is now available. There is an issue with programs that depend on the old huggingface_hub library, but other than that, it is fast and efficient.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/blog/xet-on-the-hub"> <header class="source"> <a href="https://huggingface.co/blog/xet-on-the-hub" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/345;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/2/a2c5d55a9ef48c4a942d38f258c499791d392d5a_2_690x345.jpeg" class="thumbnail" data-dominant-color="F3EEE1" width="690" height="345"></div> <h3><a href="https://huggingface.co/blog/xet-on-the-hub" target="_blank" rel="noopener">Xet is on the Hub</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <blockquote> <p>Errors related to Git LFS not being supported by Hugging Face.</p> </blockquote> <p>git lfs is supported and I use it regularly, but in Windows environments in particular, it won’t work properly unless you first install git and git lfs from the installer. This is because there is an outdated version of git already installed…</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://git-scm.com/downloads/win"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/4/f/4f0570085449c0065744f2d041b3ab486d2707b6.png" class="site-icon" data-dominant-color="F64D27" width="32" height="32"> <a href="https://git-scm.com/downloads/win" target="_blank" rel="noopener">git-scm.com</a> </header> <article class="onebox-body"> <h3><a href="https://git-scm.com/downloads/win" target="_blank" rel="noopener">Git - Downloading Package</a></h3> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://git-lfs.com/"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/f/1/f16572aa053992106b3ae7b3792264219531fd73.png" class="site-icon" data-dominant-color="DE4130" width="48" height="48"> <a href="https://git-lfs.com/" target="_blank" rel="noopener">Git Large File Storage</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:262/500;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/5/6591624baacb3d731d5b5f5fe3259e07eb8f9b28_2_690x362.png" class="thumbnail" data-dominant-color="E4E2DA" width="690" height="362"></div> <h3><a href="https://git-lfs.com/" target="_blank" rel="noopener">Git Large File Storage</a></h3> <p>Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <blockquote> <p>Repository not found errors when pushing to the Hugging Face Space.</p> </blockquote> <p>In many cases, tokens are not being passed to the private repository. This can often be resolved by using login().</p> <blockquote> <p>General troubleshooting for Docker-based Hugging Face Spaces.</p> </blockquote> <p>Searching forums and StackOverflow is also useful, but the official HF documentation is quite detailed and convenient.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/hub/en/spaces-sdks-docker"> <header class="source"> <a href="https://huggingface.co/docs/hub/en/spaces-sdks-docker" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/1X/5c4130fb1d8662cb15c5385a9fd9a44626aa4aa2_2_690x372.png" class="thumbnail" data-dominant-color="E9E7E2" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/hub/en/spaces-sdks-docker" target="_blank" rel="noopener">Docker Spaces</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/hub/en/spaces-config-reference"> <header class="source"> <a href="https://huggingface.co/docs/hub/en/spaces-config-reference" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png" class="thumbnail" data-dominant-color="FAF8F2" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/hub/en/spaces-config-reference" target="_blank" rel="noopener">Spaces Configuration Reference</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
When I use lm_eval and datasets to evaluate LLM, I met error
https://discuss.huggingface.co/t/when-i-use-lm-eval-and-datasets-to-evaluate-llm-i-met-error/151133
151,133
5
2025-04-18T12:45:02.474000Z
[ { "id": 216547, "name": "JustVelkhana", "username": "JustVelkhana", "avatar_template": "/user_avatar/discuss.huggingface.co/justvelkhana/{size}/45795_2.png", "created_at": "2025-04-18T12:45:02.537Z", "cooked": "<p>For example, ‘load_datasets(‘piqa’)’ cause the error ‘TypeError: ‘NoneType’ object is not callable’. Actually change it to ‘gimmaru/piqa’ didn’t error, but the args has been feed in by lm_eval, and the latter only accept ‘piqa’.</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-18T12:45:02.537Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 380, "reads": 14, "readers_count": 13, "score": 1862.6, "yours": false, "topic_id": 151133, "topic_slug": "when-i-use-lm-eval-and-datasets-to-evaluate-llm-i-met-error", "display_username": "JustVelkhana", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 91165, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/when-i-use-lm-eval-and-datasets-to-evaluate-llm-i-met-error/151133/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216551, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-18T13:20:38.573Z", "cooked": "<p>Possibly ongoing issue…</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/EleutherAI/lm-evaluation-harness/issues/2821#issuecomment-2751151919\">\n <header class=\"source\">\n\n <a href=\"https://github.com/EleutherAI/lm-evaluation-harness/issues/2821#issuecomment-2751151919\" target=\"_blank\" rel=\"noopener\">github.com/EleutherAI/lm-evaluation-harness</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/EleutherAI/lm-evaluation-harness/issues/2821#issuecomment-2751151919\" target=\"_blank\" rel=\"noopener\">Error in loading from HF datasets</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2025-03-20\" data-time=\"03:48:53\" data-timezone=\"UTC\">03:48AM - 20 Mar 25 UTC</span>\n </div>\n\n\n <div class=\"user\">\n <a href=\"https://github.com/baberabb\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/9/7/97ec8fef2f70c82c047d9a5b8314429cb38f8003.jpeg\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"A20505\">\n baberabb\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">Multiple users are reporting problems loading datasets (refs: #2743, #2793, #275<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">2), particularly those behind restrictive firewalls (potentially China). I haven't been able to reproduce these issues in my environment. This could act as a meta issue to consolidate all these related reports and find a common solution.\n\nMy understanding was setting `HF_ENDPOINT` environment variable for example:\n\n```export HF_ENDPOINT=\"https://hf-mirror.com\"```,\n\nwould fix things, but apparently it's not working for everyone.\n\nAs a diagnostic step, check if you can load datasets directly using the HF datasets library. For example:\n\n```python\nimport datasets\ndf = datasets.load_dataset(\"ceval/ceval-exam\", \"accountant\")\n```\nIf this works (either from HF remote or locally), then our library should also work since we use `load_dataset` internally. See our [Dataset configuration options](https://github.com/EleutherAI/lm-evaluation-harness/blob/main/docs/task_guide.md#configurations) documentation for details on how to pass these and other parameters from task configs.\n\nSome users have had success in downloading the dataset and loading it locally, though this becomes more complicated when the dataset has multiple subsets. cc: @lhoestq \n\nLet's use this thread to collect any successful solutions or workarounds.</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/EleutherAI/lm-evaluation-harness/issues/2505\">\n <header class=\"source\">\n\n <a href=\"https://github.com/EleutherAI/lm-evaluation-harness/issues/2505\" target=\"_blank\" rel=\"noopener\">github.com/EleutherAI/lm-evaluation-harness</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/EleutherAI/lm-evaluation-harness/issues/2505\" target=\"_blank\" rel=\"noopener\">Load dataset error</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-11-19\" data-time=\"04:42:12\" data-timezone=\"UTC\">04:42AM - 19 Nov 24 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-11-24\" data-time=\"08:13:48\" data-timezone=\"UTC\">08:13AM - 24 Nov 24 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/junming-yang\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/c/7/c77616a9d1997da997b5a7aed597cf14864e687b.jpeg\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"777F6A\">\n junming-yang\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">I use the following command to run lm-eval:\n```\naccelerate launch --multi-gpu <span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">--num_processes 2 \\\n -m lm_eval --model hf \\\n --model_args pretrained=${local_model_path} \\\n --tasks mmlu \\\n --batch_size 8 \\\n --log_samples \\\n --output_path ${output_path} \\\n --trust_remote_code\n```\n\nbut meet the problem:\n```\nTraceback (most recent call last):\n File \"/usr/lib/python3.10/runpy.py\", line 196, in _run_module_as_main\n return _run_code(code, main_globals, None,\n File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n exec(code, run_globals)\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/__main__.py\", line 461, in &lt;module&gt;\n cli_evaluate()\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/__main__.py\", line 382, in cli_evaluate\n results = evaluator.simple_evaluate(\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/utils.py\", line 397, in _wrapper\n return fn(*args, **kwargs)\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/evaluator.py\", line 235, in simple_evaluate\n task_dict = get_task_dict(tasks, task_manager)\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py\", line 618, in get_task_dict\n task_name_from_string_dict = task_manager.load_task_or_group(\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py\", line 414, in load_task_or_group\n collections.ChainMap(*map(self._load_individual_task_or_group, task_list))\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py\", line 398, in _load_individual_task_or_group\n group_name: dict(collections.ChainMap(*map(fn, reversed(subtask_list))))\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py\", line 398, in _load_individual_task_or_group\n group_name: dict(collections.ChainMap(*map(fn, reversed(subtask_list))))\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py\", line 314, in _load_individual_task_or_group\n return _load_task(task_config, task=name_or_config)\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py\", line 280, in _load_task\n task_object = ConfigurableTask(config=config)\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/api/task.py\", line 818, in __init__\n self.download(self.config.dataset_kwargs)\n File \"/usr/local/lib/python3.10/dist-packages/lm_eval/api/task.py\", line 925, in download\n self.dataset = datasets.load_dataset(\n File \"/usr/local/lib/python3.10/dist-packages/datasets/load.py\", line 2132, in load_dataset\n builder_instance = load_dataset_builder(\n File \"/usr/local/lib/python3.10/dist-packages/datasets/load.py\", line 1890, in load_dataset_builder\n builder_instance: DatasetBuilder = builder_cls(\nTypeError: 'NoneType' object is not callable\n```\n\n`lm-eval==0.4.5` and `datasets==3.1.0`. \n\nI also tried installing different versions of lm-eval and datasets, but it didn't work. Do you have any suggestions for solving the problem?</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-18T13:20:38.573Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 14, "readers_count": 13, "score": 7.6, "yours": false, "topic_id": 151133, "topic_slug": "when-i-use-lm-eval-and-datasets-to-evaluate-llm-i-met-error", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/EleutherAI/lm-evaluation-harness/issues/2821#issuecomment-2751151919", "internal": false, "reflection": false, "title": "Error in loading from HF datasets · Issue #2821 · EleutherAI/lm-evaluation-harness · GitHub", "clicks": 27 }, { "url": "https://github.com/EleutherAI/lm-evaluation-harness/issues/2505", "internal": false, "reflection": false, "title": "Load dataset error · Issue #2505 · EleutherAI/lm-evaluation-harness · GitHub", "clicks": 18 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/when-i-use-lm-eval-and-datasets-to-evaluate-llm-i-met-error/151133/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216683, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-19T01:21:13.469Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-19T01:21:13.469Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 11, "readers_count": 10, "score": 7, "yours": false, "topic_id": 151133, "topic_slug": "when-i-use-lm-eval-and-datasets-to-evaluate-llm-i-met-error", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/when-i-use-lm-eval-and-datasets-to-evaluate-llm-i-met-error/151133/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>For example, ‘load_datasets(‘piqa’)’ cause the error ‘TypeError: ‘NoneType’ object is not callable’. Actually change it to ‘gimmaru/piqa’ didn’t error, but the args has been feed in by lm_eval, and the latter only accept ‘piqa’.</p>
<p>Possibly ongoing issue…</p><aside class="onebox githubissue" data-onebox-src="https://github.com/EleutherAI/lm-evaluation-harness/issues/2821#issuecomment-2751151919"> <header class="source"> <a href="https://github.com/EleutherAI/lm-evaluation-harness/issues/2821#issuecomment-2751151919" target="_blank" rel="noopener">github.com/EleutherAI/lm-evaluation-harness</a> </header> <article class="onebox-body"> <div class="github-row"> <div class="github-icon-container" title="Issue" data-github-private-repo="false"> <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg> </div> <div class="github-info-container"> <h4> <a href="https://github.com/EleutherAI/lm-evaluation-harness/issues/2821#issuecomment-2751151919" target="_blank" rel="noopener">Error in loading from HF datasets</a> </h4> <div class="github-info"> <div class="date"> opened <span class="discourse-local-date" data-format="ll" data-date="2025-03-20" data-time="03:48:53" data-timezone="UTC">03:48AM - 20 Mar 25 UTC</span> </div> <div class="user"> <a href="https://github.com/baberabb" target="_blank" rel="noopener"> <img alt="" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/9/7/97ec8fef2f70c82c047d9a5b8314429cb38f8003.jpeg" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="A20505"> baberabb </a> </div> </div> <div class="labels"> </div> </div> </div> <div class="github-row"> <p class="github-body-container">Multiple users are reporting problems loading datasets (refs: #2743, #2793, #275<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">2), particularly those behind restrictive firewalls (potentially China). I haven't been able to reproduce these issues in my environment. This could act as a meta issue to consolidate all these related reports and find a common solution. My understanding was setting `HF_ENDPOINT` environment variable for example: ```export HF_ENDPOINT="https://hf-mirror.com"```, would fix things, but apparently it's not working for everyone. As a diagnostic step, check if you can load datasets directly using the HF datasets library. For example: ```python import datasets df = datasets.load_dataset("ceval/ceval-exam", "accountant") ``` If this works (either from HF remote or locally), then our library should also work since we use `load_dataset` internally. See our [Dataset configuration options](https://github.com/EleutherAI/lm-evaluation-harness/blob/main/docs/task_guide.md#configurations) documentation for details on how to pass these and other parameters from task configs. Some users have had success in downloading the dataset and loading it locally, though this becomes more complicated when the dataset has multiple subsets. cc: @lhoestq Let's use this thread to collect any successful solutions or workarounds.</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox githubissue" data-onebox-src="https://github.com/EleutherAI/lm-evaluation-harness/issues/2505"> <header class="source"> <a href="https://github.com/EleutherAI/lm-evaluation-harness/issues/2505" target="_blank" rel="noopener">github.com/EleutherAI/lm-evaluation-harness</a> </header> <article class="onebox-body"> <div class="github-row"> <div class="github-icon-container" title="Issue" data-github-private-repo="false"> <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg> </div> <div class="github-info-container"> <h4> <a href="https://github.com/EleutherAI/lm-evaluation-harness/issues/2505" target="_blank" rel="noopener">Load dataset error</a> </h4> <div class="github-info"> <div class="date"> opened <span class="discourse-local-date" data-format="ll" data-date="2024-11-19" data-time="04:42:12" data-timezone="UTC">04:42AM - 19 Nov 24 UTC</span> </div> <div class="date"> closed <span class="discourse-local-date" data-format="ll" data-date="2024-11-24" data-time="08:13:48" data-timezone="UTC">08:13AM - 24 Nov 24 UTC</span> </div> <div class="user"> <a href="https://github.com/junming-yang" target="_blank" rel="noopener"> <img alt="" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/c/7/c77616a9d1997da997b5a7aed597cf14864e687b.jpeg" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="777F6A"> junming-yang </a> </div> </div> <div class="labels"> </div> </div> </div> <div class="github-row"> <p class="github-body-container">I use the following command to run lm-eval: ``` accelerate launch --multi-gpu <span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">--num_processes 2 \ -m lm_eval --model hf \ --model_args pretrained=${local_model_path} \ --tasks mmlu \ --batch_size 8 \ --log_samples \ --output_path ${output_path} \ --trust_remote_code ``` but meet the problem: ``` Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.10/dist-packages/lm_eval/__main__.py", line 461, in &lt;module&gt; cli_evaluate() File "/usr/local/lib/python3.10/dist-packages/lm_eval/__main__.py", line 382, in cli_evaluate results = evaluator.simple_evaluate( File "/usr/local/lib/python3.10/dist-packages/lm_eval/utils.py", line 397, in _wrapper return fn(*args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/lm_eval/evaluator.py", line 235, in simple_evaluate task_dict = get_task_dict(tasks, task_manager) File "/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py", line 618, in get_task_dict task_name_from_string_dict = task_manager.load_task_or_group( File "/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py", line 414, in load_task_or_group collections.ChainMap(*map(self._load_individual_task_or_group, task_list)) File "/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py", line 398, in _load_individual_task_or_group group_name: dict(collections.ChainMap(*map(fn, reversed(subtask_list)))) File "/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py", line 398, in _load_individual_task_or_group group_name: dict(collections.ChainMap(*map(fn, reversed(subtask_list)))) File "/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py", line 314, in _load_individual_task_or_group return _load_task(task_config, task=name_or_config) File "/usr/local/lib/python3.10/dist-packages/lm_eval/tasks/__init__.py", line 280, in _load_task task_object = ConfigurableTask(config=config) File "/usr/local/lib/python3.10/dist-packages/lm_eval/api/task.py", line 818, in __init__ self.download(self.config.dataset_kwargs) File "/usr/local/lib/python3.10/dist-packages/lm_eval/api/task.py", line 925, in download self.dataset = datasets.load_dataset( File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 2132, in load_dataset builder_instance = load_dataset_builder( File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 1890, in load_dataset_builder builder_instance: DatasetBuilder = builder_cls( TypeError: 'NoneType' object is not callable ``` `lm-eval==0.4.5` and `datasets==3.1.0`. I also tried installing different versions of lm-eval and datasets, but it didn't work. Do you have any suggestions for solving the problem?</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Quota exceed error
https://discuss.huggingface.co/t/quota-exceed-error/150796
150,796
5
2025-04-16T10:32:43.509000Z
[ { "id": 216116, "name": "GREG", "username": "X-Greg", "avatar_template": "/user_avatar/discuss.huggingface.co/x-greg/{size}/45631_2.png", "created_at": "2025-04-16T10:32:43.565Z", "cooked": "<p>I have a quota exceed message, but I’m playing member and didn’t use m’y account since yesterday.</p>\n<p>Can you help me?</p>", "post_number": 1, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-16T10:32:43.565Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 50, "reads": 16, "readers_count": 15, "score": 263.2, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "GREG", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90930, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216148, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-16T11:41:16.821Z", "cooked": "<p>Although it has been resolved (in Gradio 5.12.0 or newer), it is a bug in the broad sense of the word.</p><aside class=\"quote\" data-post=\"2\" data-topic=\"150817\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/48/27664_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/quota-error-even-though-i-am-pro/150817/2\">Quota error even though I am Pro</a> <a class=\"badge-category__wrapper \" href=\"/c/beginners/5\"><span data-category-id=\"5\" style=\"--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category for any basic question you have on any of the Hugging Face library. Don’t moderate yourself, everyone has to begin somewhere and everyone on this forum is here to help!\"><span class=\"badge-category__name\">Beginners</span></span></a>\n </div>\n <blockquote>\n To put it roughly, it’s just a bug in the old version of the library and the HF server at the time. \nIn some cases, you can avoid it by using a newer version of Spaces or manually upgrading by duplicating it for your own use.\n </blockquote>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-16T11:41:16.821Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 15, "readers_count": 14, "score": 18, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/quota-error-even-though-i-am-pro/150817/2", "internal": true, "reflection": false, "title": "Quota error even though I am Pro", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216166, "name": "GREG", "username": "X-Greg", "avatar_template": "/user_avatar/discuss.huggingface.co/x-greg/{size}/45631_2.png", "created_at": "2025-04-16T13:20:28.293Z", "cooked": "<p>Thanks for your answer but I don’t understand what you mean.<br>\nIt would be simple for me if you give le the link to the newer version</p>", "post_number": 3, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-16T13:20:28.293Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 13, "readers_count": 12, "score": 17.6, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "GREG", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90930, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 216167, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-16T13:24:08.377Z", "cooked": "<p>Hmm… Well, we can either find it or upgrade the code ourselves…<img src=\"https://emoji.discourse-cdn.com/apple/cold_face.png?v=14\" title=\":cold_face:\" class=\"emoji\" alt=\":cold_face:\" loading=\"lazy\" width=\"20\" height=\"20\"><br>\nIf we’re lucky, updating <strong>sdk_version:</strong> in <strong>README.md</strong> to the latest version (5.24.0 now) should work.</p>", "post_number": 4, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-16T13:24:56.518Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 14, "readers_count": 13, "score": 2.8, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216184, "name": "javarribas", "username": "javarribas", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/f14d63/{size}.png", "created_at": "2025-04-16T15:17:58.163Z", "cooked": "<p><em>Quota error… inference is not supported by HF Inference API…<br>\nWait, did Elon Musk buy Hugging Face or what??</em><br>\n<img src=\"https://emoji.discourse-cdn.com/apple/joy.png?v=14\" title=\":joy:\" class=\"emoji\" alt=\":joy:\" loading=\"lazy\" width=\"20\" height=\"20\"><img src=\"https://emoji.discourse-cdn.com/apple/joy.png?v=14\" title=\":joy:\" class=\"emoji\" alt=\":joy:\" loading=\"lazy\" width=\"20\" height=\"20\"><img src=\"https://emoji.discourse-cdn.com/apple/joy.png?v=14\" title=\":joy:\" class=\"emoji\" alt=\":joy:\" loading=\"lazy\" width=\"20\" height=\"20\"><img src=\"https://emoji.discourse-cdn.com/apple/joy.png?v=14\" title=\":joy:\" class=\"emoji\" alt=\":joy:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 5, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-16T15:17:58.163Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 14, "readers_count": 13, "score": 17.8, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "javarribas", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 78166, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/5", "reactions": [ { "id": "laughing", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216207, "name": "Megan Riley", "username": "meganariley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png", "created_at": "2025-04-16T18:56:18.559Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/x-greg\">@X-Greg</a> Is this for ZeroGPU usage? If so, you can use up to 25 minutes of ZeroGPU compute (A100 GPUs) on Spaces per day as a PRO subscriber. You can track your usage in your billing settings: <a href=\"https://huggingface.co/settings/billing\" class=\"inline-onebox\">Hugging Face – The AI community building the future.</a>.</p>\n<p>If you’re receiving this error message and your ZeroGPU hasn’t exceeded the limit, let us know!</p>", "post_number": 6, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-16T18:56:18.559Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 13, "readers_count": 12, "score": 37.6, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "Megan Riley", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/settings/billing", "internal": false, "reflection": false, "title": "Hugging Face – The AI community building the future.", "clicks": 2 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 31941, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/6", "reactions": [ { "id": "hugs", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216240, "name": "GREG", "username": "X-Greg", "avatar_template": "/user_avatar/discuss.huggingface.co/x-greg/{size}/45631_2.png", "created_at": "2025-04-17T00:25:23.733Z", "cooked": "<p>For a few hours now, I’ve no longer had the “quota exceeded” message, but the Pony Realism space is no longer giving any results. Not even an error message. This has happened before, but it didn’t last. Today, nothing works. I’ve tried other spaces in the meantime, but the results aren’t satisfactory.<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/3/e/3e1fbc7f7ed49a13808d77acd463d17fbd16ac1a.jpeg\" data-download-href=\"/uploads/short-url/8RzB4pg832tdCSGGVuypUYuAKzE.jpeg?dl=1\" title=\"1000134418\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/e/3e1fbc7f7ed49a13808d77acd463d17fbd16ac1a_2_690x387.jpeg\" alt=\"1000134418\" data-base62-sha1=\"8RzB4pg832tdCSGGVuypUYuAKzE\" width=\"690\" height=\"387\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/e/3e1fbc7f7ed49a13808d77acd463d17fbd16ac1a_2_690x387.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/e/3e1fbc7f7ed49a13808d77acd463d17fbd16ac1a_2_1035x580.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/e/3e1fbc7f7ed49a13808d77acd463d17fbd16ac1a_2_1380x774.jpeg 2x\" data-dominant-color=\"60719A\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">1000134418</span><span class=\"informations\">1920×1077 133 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>", "post_number": 7, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-17T00:25:23.733Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 3, "reads": 9, "readers_count": 8, "score": 46.8, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "GREG", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90930, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/7", "reactions": [ { "id": "+1", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 31941, "username": "meganariley", "name": "Megan Riley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png" }, "action_code": null, "via_email": null }, { "id": 216254, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-17T03:31:27.309Z", "cooked": "<p>I think I fixed it. If you duplicate this as Zero GPU space, it should work with the quota applied.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/spaces/John6666/PonyRealism\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/spaces/John6666/PonyRealism\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/e/5e1d0cf1e405fbe86c639bea59ec2afb8d2ba7a7_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"E54D07\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/spaces/John6666/PonyRealism\" target=\"_blank\" rel=\"noopener\">Pony Realism / Cyber Realistic Pony / Stallion Dreams - a Hugging Face Space...</a></h3>\n\n <p>Discover amazing ML apps made by the community</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/7/07a55596b62119a08d6b613c8bcdc7f6c855bdfa.png\" data-download-href=\"/uploads/short-url/15Dzj15zAfmgbwSJ9yUScNoX91g.png?dl=1\" title=\"ponyrealismtest\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/7/07a55596b62119a08d6b613c8bcdc7f6c855bdfa_2_690x363.png\" alt=\"ponyrealismtest\" data-base62-sha1=\"15Dzj15zAfmgbwSJ9yUScNoX91g\" width=\"690\" height=\"363\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/7/07a55596b62119a08d6b613c8bcdc7f6c855bdfa_2_690x363.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/7/07a55596b62119a08d6b613c8bcdc7f6c855bdfa_2_1035x544.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/0/7/07a55596b62119a08d6b613c8bcdc7f6c855bdfa.png 2x\" data-dominant-color=\"2D3138\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">ponyrealismtest</span><span class=\"informations\">1121×590 177 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>", "post_number": 8, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-17T03:31:27.309Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 9, "readers_count": 8, "score": 6.8, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/spaces/John6666/PonyRealism", "internal": false, "reflection": false, "title": "Pony Realism / Cyber Realistic Pony / Stallion Dreams - a Hugging Face Space by John6666", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/8", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216353, "name": "GREG", "username": "X-Greg", "avatar_template": "/user_avatar/discuss.huggingface.co/x-greg/{size}/45631_2.png", "created_at": "2025-04-17T13:22:08.452Z", "cooked": "<p>The problem is that you’re not contacting a computer specialist. I have absolutely no idea what the instructions you gave me above mean. As for me, I’m using the online application as is, and I don’t understand when I might be able to intervene in the program.</p>", "post_number": 9, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-17T13:22:08.452Z", "reply_count": 0, "reply_to_post_number": 8, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 21.6, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "GREG", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90930, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/9", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 216354, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-17T13:26:53.867Z", "cooked": "<p>Hmm… It’s something like this.</p>\n<ol>\n<li><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/f/7/f7daf7169291c594932262c3f11454e646ec06d2.png\" data-download-href=\"/uploads/short-url/zmD45wrr5qX5DIzTDMU7LOCxncS.png?dl=1\" title=\"dupzero1\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/7/f7daf7169291c594932262c3f11454e646ec06d2_2_690x317.png\" alt=\"dupzero1\" data-base62-sha1=\"zmD45wrr5qX5DIzTDMU7LOCxncS\" width=\"690\" height=\"317\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/7/f7daf7169291c594932262c3f11454e646ec06d2_2_690x317.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/7/f7daf7169291c594932262c3f11454e646ec06d2_2_1035x475.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/f/7/f7daf7169291c594932262c3f11454e646ec06d2.png 2x\" data-dominant-color=\"151822\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">dupzero1</span><span class=\"informations\">1057×486 54 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></li>\n<li><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/5/1/51310dfc52884391393a2e9b4de7bf5baac2de02.png\" data-download-href=\"/uploads/short-url/bAfLZUfcPX7eWXw0e78StoFjpyG.png?dl=1\" title=\"dupzero2\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/1/51310dfc52884391393a2e9b4de7bf5baac2de02_2_690x300.png\" alt=\"dupzero2\" data-base62-sha1=\"bAfLZUfcPX7eWXw0e78StoFjpyG\" width=\"690\" height=\"300\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/1/51310dfc52884391393a2e9b4de7bf5baac2de02_2_690x300.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/1/51310dfc52884391393a2e9b4de7bf5baac2de02_2_1035x450.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/5/1/51310dfc52884391393a2e9b4de7bf5baac2de02.png 2x\" data-dominant-color=\"131119\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">dupzero2</span><span class=\"informations\">1042×454 28.8 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></li>\n</ol>", "post_number": 10, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-17T13:26:53.867Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 11, "readers_count": 10, "score": 17.2, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/zero-gpu-worker-error/166246/23", "internal": true, "reflection": true, "title": "Zero GPU Worker Error", "clicks": 1 }, { "url": "https://discuss.huggingface.co/t/virtual-try-on-doesnt-appear-to-work/151913/8", "internal": true, "reflection": true, "title": "Virtual Try-On doesn't appear to work", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/zero-gpu-worker-error/166246/31", "internal": true, "reflection": true, "title": "Zero GPU Worker Error", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/10", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216360, "name": "GREG", "username": "X-Greg", "avatar_template": "/user_avatar/discuss.huggingface.co/x-greg/{size}/45631_2.png", "created_at": "2025-04-17T14:25:23.604Z", "cooked": "<p>I tried this, but the problem persists. It’s exactly the same on my PC or phone. The progress bar is moving at full speed, but there’s no result, not even an error message.</p>", "post_number": 11, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-17T14:25:23.604Z", "reply_count": 0, "reply_to_post_number": 10, "quote_count": 0, "incoming_link_count": 2, "reads": 11, "readers_count": 10, "score": 27.2, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "GREG", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90930, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/11", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 216365, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-17T14:48:42.921Z", "cooked": "<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/3/037b04fec28226e4dc30465b71dea898eb41e7e9.png\" data-download-href=\"/uploads/short-url/uN01Vo62zxSl1Vak0nKOxdEUcN.png?dl=1\" title=\"ponyr3\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/3/037b04fec28226e4dc30465b71dea898eb41e7e9_2_690x369.png\" alt=\"ponyr3\" data-base62-sha1=\"uN01Vo62zxSl1Vak0nKOxdEUcN\" width=\"690\" height=\"369\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/3/037b04fec28226e4dc30465b71dea898eb41e7e9_2_690x369.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/3/037b04fec28226e4dc30465b71dea898eb41e7e9_2_1035x553.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/0/3/037b04fec28226e4dc30465b71dea898eb41e7e9.png 2x\" data-dominant-color=\"2C3039\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">ponyr3</span><span class=\"informations\">1162×623 171 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div><br>\nHmm… It works for me. That might be an undiscovered bug on the server GUI side. There was a time when there were frequent problems with it not working properly on iOS Safari.</p>", "post_number": 12, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-17T14:48:42.921Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 10, "readers_count": 9, "score": 12, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/12", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216393, "name": "GREG", "username": "X-Greg", "avatar_template": "/user_avatar/discuss.huggingface.co/x-greg/{size}/45631_2.png", "created_at": "2025-04-17T18:04:22.994Z", "cooked": "<p>so no solution <img src=\"https://emoji.discourse-cdn.com/apple/sob.png?v=14\" title=\":sob:\" class=\"emoji\" alt=\":sob:\" loading=\"lazy\" width=\"20\" height=\"20\"><img src=\"https://emoji.discourse-cdn.com/apple/sob.png?v=14\" title=\":sob:\" class=\"emoji\" alt=\":sob:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 13, "post_type": 1, "posts_count": 14, "updated_at": "2025-04-17T18:04:22.994Z", "reply_count": 0, "reply_to_post_number": 12, "quote_count": 0, "incoming_link_count": 2, "reads": 10, "readers_count": 9, "score": 27, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "GREG", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90930, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/13", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 216479, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-18T06:05:05.394Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 14, "post_type": 3, "posts_count": 14, "updated_at": "2025-04-18T06:05:05.394Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 8, "readers_count": 7, "score": 11.6, "yours": false, "topic_id": 150796, "topic_slug": "quota-exceed-error", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/quota-exceed-error/150796/14", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I have a quota exceed message, but I’m playing member and didn’t use m’y account since yesterday.</p> <p>Can you help me?</p>
<p>Hi <a class="mention" href="/u/x-greg">@X-Greg</a> Is this for ZeroGPU usage? If so, you can use up to 25 minutes of ZeroGPU compute (A100 GPUs) on Spaces per day as a PRO subscriber. You can track your usage in your billing settings: <a href="https://huggingface.co/settings/billing" class="inline-onebox">Hugging Face – The AI community building the future.</a>.</p> <p>If you’re receiving this error message and your ZeroGPU hasn’t exceeded the limit, let us know!</p>
Per_device_train_batch_size in model parallelism
https://discuss.huggingface.co/t/per-device-train-batch-size-in-model-parallelism/149171
149,171
5
2025-04-07T00:27:47.366000Z
[ { "id": 213824, "name": "Quoc Minh Nguyen", "username": "quocnguyen", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/q/3d9bf3/{size}.png", "created_at": "2025-04-07T00:27:47.421Z", "cooked": "<p>If I have two GPUs and use <code>device_map=\"auto\"</code>, by default the model evenly between them, how does setting <code>per_device_train_batch_size</code> affect the effective batch size? Specifically, is the effective batch size equal to <code>per_device_train_batch_size</code>, or is it 2 x <code>per_device_train_batch_size</code>? Is there a way to explicitly see the effective batch size</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-07T00:27:47.421Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 36, "reads": 4, "readers_count": 3, "score": 165.8, "yours": false, "topic_id": 149171, "topic_slug": "per-device-train-batch-size-in-model-parallelism", "display_username": "Quoc Minh Nguyen", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89735, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/per-device-train-batch-size-in-model-parallelism/149171/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213887, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-07T07:47:08.981Z", "cooked": "<p>I haven’t been able to find any materials that specifically mention the calculation formula or checking method, but I think this is probably correct.</p>\n<blockquote>\n<p>or is it 2 x <code>per_device_train_batch_size</code></p>\n</blockquote>\n<p>So maybe this one.</p>\n<pre><code class=\"lang-auto\"># if using gradient accumulation\neffective_batch_size = per_device_train_batch_size x gradient_accumulation_steps x num_gpus\n# else\neffective_batch_size = per_device_train_batch_size x num_gpus\n</code></pre>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/transformers/main/en/performance\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/transformers/main/en/performance\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F5F3ED\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/transformers/main/en/performance\" target=\"_blank\" rel=\"noopener\">Performance and Scalability</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://medium.com/@heyamit10/fine-tuning-mpt-7b-a-practical-guide-34b221da7d10\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/f/0f95de5840ff0771b84ea77cfa42a1e98b4f1614.png\" class=\"site-icon\" data-dominant-color=\"3B3B3B\" width=\"32\" height=\"32\">\n\n <a href=\"https://medium.com/@heyamit10/fine-tuning-mpt-7b-a-practical-guide-34b221da7d10\" target=\"_blank\" rel=\"noopener\" title=\"04:37PM - 02 January 2025\">Medium – 2 Jan 25</a>\n </header>\n\n <article class=\"onebox-body\">\n \n\n<h3><a href=\"https://medium.com/@heyamit10/fine-tuning-mpt-7b-a-practical-guide-34b221da7d10\" target=\"_blank\" rel=\"noopener\">Fine-Tuning MPT-7B: A Practical Guide</a></h3>\n\n <p>With Complete Code</p>\n\n <p>\n <span class=\"label1\">Reading time: 18 min read</span>\n </p>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-07T07:47:56.779Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 15.8, "yours": false, "topic_id": 149171, "topic_slug": "per-device-train-batch-size-in-model-parallelism", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/transformers/main/en/performance", "internal": false, "reflection": false, "title": "Performance and Scalability", "clicks": 3 }, { "url": "https://medium.com/@heyamit10/fine-tuning-mpt-7b-a-practical-guide-34b221da7d10", "internal": false, "reflection": false, "title": "Fine-Tuning MPT-7B: A Practical Guide | by Hey Amit | Medium", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/per-device-train-batch-size-in-model-parallelism/149171/2", "reactions": [ { "id": "white_check_mark", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 216325, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-17T11:34:18.680Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-17T11:34:18.680Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 1, "readers_count": 0, "score": 5.2, "yours": false, "topic_id": 149171, "topic_slug": "per-device-train-batch-size-in-model-parallelism", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/per-device-train-batch-size-in-model-parallelism/149171/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>If I have two GPUs and use <code>device_map="auto"</code>, by default the model evenly between them, how does setting <code>per_device_train_batch_size</code> affect the effective batch size? Specifically, is the effective batch size equal to <code>per_device_train_batch_size</code>, or is it 2 x <code>per_device_train_batch_size</code>? Is there a way to explicitly see the effective batch size</p>
<p>I haven’t been able to find any materials that specifically mention the calculation formula or checking method, but I think this is probably correct.</p> <blockquote> <p>or is it 2 x <code>per_device_train_batch_size</code></p> </blockquote> <p>So maybe this one.</p> <pre><code class="lang-auto"># if using gradient accumulation effective_batch_size = per_device_train_batch_size x gradient_accumulation_steps x num_gpus # else effective_batch_size = per_device_train_batch_size x num_gpus </code></pre> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/transformers/main/en/performance"> <header class="source"> <a href="https://huggingface.co/docs/transformers/main/en/performance" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png" class="thumbnail" data-dominant-color="F5F3ED" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/transformers/main/en/performance" target="_blank" rel="noopener">Performance and Scalability</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://medium.com/@heyamit10/fine-tuning-mpt-7b-a-practical-guide-34b221da7d10"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/0/f/0f95de5840ff0771b84ea77cfa42a1e98b4f1614.png" class="site-icon" data-dominant-color="3B3B3B" width="32" height="32"> <a href="https://medium.com/@heyamit10/fine-tuning-mpt-7b-a-practical-guide-34b221da7d10" target="_blank" rel="noopener" title="04:37PM - 02 January 2025">Medium – 2 Jan 25</a> </header> <article class="onebox-body"> <h3><a href="https://medium.com/@heyamit10/fine-tuning-mpt-7b-a-practical-guide-34b221da7d10" target="_blank" rel="noopener">Fine-Tuning MPT-7B: A Practical Guide</a></h3> <p>With Complete Code</p> <p> <span class="label1">Reading time: 18 min read</span> </p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Model loading internal error
https://discuss.huggingface.co/t/model-loading-internal-error/150334
150,334
23
2025-04-14T09:02:57.894000Z
[ { "id": 215442, "name": "Shivansh Kumar", "username": "HyperX-Sen", "avatar_template": "/user_avatar/discuss.huggingface.co/hyperx-sen/{size}/45014_2.png", "created_at": "2025-04-14T09:02:57.959Z", "cooked": "<p>Hey I am trying to load one of my own models in my kaggle notebook but it is returning :<br>\nHfHubHTTPError: 500 Server Error: Internal Server Error for url: <a href=\"https://huggingface.co/api/models/HyperX-Sen/Qwen-2.5-7B-Reasoning/commits/main\">https://huggingface.co/api/models/HyperX-Sen/Qwen-2.5-7B-Reasoning/commits/main</a> (Request ID: Root=…)</p>\n<p>Internal Error - We’re working hard to fix this as soon as possible!</p>\n<p>Is this actually a problem with huggingface or from my side ?</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-14T09:02:57.959Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 36, "reads": 17, "readers_count": 16, "score": 193.4, "yours": false, "topic_id": 150334, "topic_slug": "model-loading-internal-error", "display_username": "Shivansh Kumar", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/api/models/HyperX-Sen/Qwen-2.5-7B-Reasoning/commits/main", "internal": false, "reflection": false, "title": null, "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90030, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-loading-internal-error/150334/1", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 215447, "name": "Jun Li", "username": "RioJune", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/r/76d3ee/{size}.png", "created_at": "2025-04-14T09:05:55.707Z", "cooked": "<p>I met the same error, I think is sometinng wrong form huggingface…</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-14T09:05:55.707Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 17, "readers_count": 16, "score": 18.4, "yours": false, "topic_id": 150334, "topic_slug": "model-loading-internal-error", "display_username": "Jun Li", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 79658, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-loading-internal-error/150334/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 215628, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-14T21:06:52.327Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-14T21:06:52.327Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 7, "readers_count": 6, "score": 6.4, "yours": false, "topic_id": 150334, "topic_slug": "model-loading-internal-error", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-loading-internal-error/150334/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hey I am trying to load one of my own models in my kaggle notebook but it is returning :<br> HfHubHTTPError: 500 Server Error: Internal Server Error for url: <a href="https://huggingface.co/api/models/HyperX-Sen/Qwen-2.5-7B-Reasoning/commits/main">https://huggingface.co/api/models/HyperX-Sen/Qwen-2.5-7B-Reasoning/commits/main</a> (Request ID: Root=…)</p> <p>Internal Error - We’re working hard to fix this as soon as possible!</p> <p>Is this actually a problem with huggingface or from my side ?</p>
<p>I met the same error, I think is sometinng wrong form huggingface…</p>
One-to-many batch mapping with IterableDatasets and batch_size=1 doesn&rsquo;t work
https://discuss.huggingface.co/t/one-to-many-batch-mapping-with-iterabledatasets-and-batch-size-1-doesnt-work/150258
150,258
10
2025-04-14T02:52:22.491000Z
[ { "id": 215335, "name": "enyoukai", "username": "enyoukai", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/{size}.png", "created_at": "2025-04-14T02:52:22.547Z", "cooked": "<p>Does batch mapping work properly for IterableDatasets? I have my processing code set up to return for each column a list of rows, but it seems to only ignore all other entries in the list except the first entry.</p>\n<pre><code class=\"lang-auto\"> labels_ids = [reasoning_labels, answer_labels]\n\n return {\n 'labels_ids': labels_ids,\n }\n</code></pre>\n<p>However my dataset only includes the reasoning_labels rows.</p>\n<p>I also changed the Dataset back to streaming=False and it includes the answer_labels rows as expected.</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-14T03:05:54.340Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 23, "reads": 4, "readers_count": 3, "score": 130.8, "yours": false, "topic_id": 150258, "topic_slug": "one-to-many-batch-mapping-with-iterabledatasets-and-batch-size-1-doesnt-work", "display_username": "enyoukai", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 4, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90537, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/one-to-many-batch-mapping-with-iterabledatasets-and-batch-size-1-doesnt-work/150258/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 215399, "name": "enyoukai", "username": "enyoukai", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/e/a9a28c/{size}.png", "created_at": "2025-04-14T07:49:26.326Z", "cooked": "<p>Fixed. Turns out I had to remove all my original columns</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-14T07:49:26.326Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 3, "readers_count": 2, "score": 20.6, "yours": false, "topic_id": 150258, "topic_slug": "one-to-many-batch-mapping-with-iterabledatasets-and-batch-size-1-doesnt-work", "display_username": "enyoukai", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90537, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/one-to-many-batch-mapping-with-iterabledatasets-and-batch-size-1-doesnt-work/150258/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 215615, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-14T19:49:53.074Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-14T19:49:53.074Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 1, "readers_count": 0, "score": 0.2, "yours": false, "topic_id": 150258, "topic_slug": "one-to-many-batch-mapping-with-iterabledatasets-and-batch-size-1-doesnt-work", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/one-to-many-batch-mapping-with-iterabledatasets-and-batch-size-1-doesnt-work/150258/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Does batch mapping work properly for IterableDatasets? I have my processing code set up to return for each column a list of rows, but it seems to only ignore all other entries in the list except the first entry.</p> <pre><code class="lang-auto"> labels_ids = [reasoning_labels, answer_labels] return { 'labels_ids': labels_ids, } </code></pre> <p>However my dataset only includes the reasoning_labels rows.</p> <p>I also changed the Dataset back to streaming=False and it includes the answer_labels rows as expected.</p>
<p>Fixed. Turns out I had to remove all my original columns</p>
When trying to run model I get model_type is not defined
https://discuss.huggingface.co/t/when-trying-to-run-model-i-get-model-type-is-not-defined/149976
149,976
5
2025-04-11T15:57:24.010000Z
[ { "id": 214900, "name": "Smiltis Zilinskas", "username": "Smilits", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/{size}.png", "created_at": "2025-04-11T15:57:24.133Z", "cooked": "<p>Hi, when I try to run a model I get model_type is not defined, and that it should be of a certain list. I am using provided code in the model card:</p>\n<pre data-code-wrap=\"from\"><code class=\"lang-from\">\nmodel_id = \"utter-project/EuroLLM-9B-Instruct\"\ntokenizer = AutoTokenizer.from_pretrained(model_id)\nmodel = AutoModelForCausalLM.from_pretrained(model_id)\n\nmessages = [\n {\n \"role\": \"system\",\n \"content\": \"You are EuroLLM --- an AI assistant specialized in European languages that provides safe, educational and helpful answers.\",\n },\n {\n \"role\": \"user\", \"content\": \"What is the capital of Portugal? How would you describe it?\"\n },\n ]\n\ninputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors=\"pt\")\noutputs = model.generate(inputs, max_new_tokens=1024)\nprint(tokenizer.decode(outputs[0], skip_special_tokens=True))\n</code></pre>\n<p>Therefore, I have downloaded model locally, now I am able to run it, here is my setup:</p>\n<pre><code class=\"lang-auto\">from huggingface_hub import snapshot_download\nfrom transformers import LlamaTokenizer, LlamaForCausalLM\nimport torch\n\nDOWNLOAD_MODEL_LOCALLY = False\n\nif DOWNLOAD_MODEL_LOCALLY:\n local_path = snapshot_download(\n repo_id=\"utter-project/EuroLLM-9B-Instruct\",\n local_dir=\"./EuroLLM-9B-Instruct\",\n local_dir_use_symlinks=False, # ensure full copy\n )\n\n\nmodel_path = \"./EuroLLM-9B-Instruct\"\ntokenizer = LlamaTokenizer.from_pretrained(model_path, use_fast=False)\n\ntokenizer.pad_token_id = tokenizer.eos_token_id\nmodel = LlamaForCausalLM.from_pretrained(\n model_path,\n trust_remote_code=True,\n device_map=\"auto\",\n torch_dtype=torch.bfloat16,\n)\nmessages = [\n {\"role\": \"system\", \"content\": \"You are EuroLLM --- an AI assistant specialized in European languages that provides safe, educational and helpful answers.\"},\n {\"role\": \"user\", \"content\": \"What is the capital of the Netherlands? Tell me something about it.\"}\n]\n\n# Generate chat-formatted input instaed of prompt and inputs -v0, kind of working\ninputs = tokenizer.apply_chat_template(\n messages,\n tokenize=True,\n add_generation_prompt=True,\n return_tensors=\"pt\"\n).to(model.device)\n\n\n# # Safe pad fallback\n# if tokenizer.pad_token_id is None:\n# tokenizer.pad_token_id = tokenizer.eos_token_id\n\n# Generate\noutputs = model.generate(\n input_ids=inputs,\n max_new_tokens=512,\n do_sample=False,\n pad_token_id=2,\n eos_token_id=4\n)\n\n# Decode\nprint(tokenizer.decode(outputs[0], skip_special_tokens=True))\n</code></pre>\n<p>Although I am getting output such as :</p>\n<pre><code class=\"lang-auto\">&lt;|im_start|&gt; system\nYou are EuroLLM --- an AI assistant specialized in European languages that provides safe, educational and helpful answers. \n &lt;|im_start|&gt; user\nWhat is the capital of the Netherlands? Tell me something about it. \n &lt;|im_start|&gt; assistant\nونssss\n</code></pre>\n<p>Is it something I am doing wrong or the model itself is so bad, I assume the first. Could someone help me running the model correctly?</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-11T15:57:24.133Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 15, "reads": 5, "readers_count": 4, "score": 91, "yours": false, "topic_id": 149976, "topic_slug": "when-trying-to-run-model-i-get-model-type-is-not-defined", "display_username": "Smiltis Zilinskas", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90335, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/when-trying-to-run-model-i-get-model-type-is-not-defined/149976/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 215039, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-12T05:28:08.482Z", "cooked": "<p>If it works locally, it’s not the model itself. Either the model is not yet supported by default, and <strong>trust_remote_code=True</strong> is required, or there is a problem with the network environment. Since the download is working, it’s probably the former.</p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)\nmodel = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True)\n</code></pre>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-12T05:28:08.482Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 20, "reads": 3, "readers_count": 2, "score": 120.6, "yours": false, "topic_id": 149976, "topic_slug": "when-trying-to-run-model-i-get-model-type-is-not-defined", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/when-trying-to-run-model-i-get-model-type-is-not-defined/149976/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 215240, "name": "Smiltis Zilinskas", "username": "Smilits", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/{size}.png", "created_at": "2025-04-13T13:32:46.062Z", "cooked": "<p>Hi John,</p>\n<p>It was indeed the networking. I was running into cache limits on my cluster. Have used export TRANSFORMERS_CACHE=./hf_cache. For solving the strange symbols it was due to multiple GPUs, if I specified the GPU such as device_map = {“”: 0} while loading the model, I got correct results so far.</p>\n<p>Thanks for help and I hope this helps for other people as well!</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-13T13:32:46.062Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 149976, "topic_slug": "when-trying-to-run-model-i-get-model-type-is-not-defined", "display_username": "Smiltis Zilinskas", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90335, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/when-trying-to-run-model-i-get-model-type-is-not-defined/149976/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 215309, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-14T01:33:39.500Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-14T01:33:39.500Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 149976, "topic_slug": "when-trying-to-run-model-i-get-model-type-is-not-defined", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/when-trying-to-run-model-i-get-model-type-is-not-defined/149976/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi, when I try to run a model I get model_type is not defined, and that it should be of a certain list. I am using provided code in the model card:</p> <pre data-code-wrap="from"><code class="lang-from"> model_id = "utter-project/EuroLLM-9B-Instruct" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id) messages = [ { "role": "system", "content": "You are EuroLLM --- an AI assistant specialized in European languages that provides safe, educational and helpful answers.", }, { "role": "user", "content": "What is the capital of Portugal? How would you describe it?" }, ] inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt") outputs = model.generate(inputs, max_new_tokens=1024) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) </code></pre> <p>Therefore, I have downloaded model locally, now I am able to run it, here is my setup:</p> <pre><code class="lang-auto">from huggingface_hub import snapshot_download from transformers import LlamaTokenizer, LlamaForCausalLM import torch DOWNLOAD_MODEL_LOCALLY = False if DOWNLOAD_MODEL_LOCALLY: local_path = snapshot_download( repo_id="utter-project/EuroLLM-9B-Instruct", local_dir="./EuroLLM-9B-Instruct", local_dir_use_symlinks=False, # ensure full copy ) model_path = "./EuroLLM-9B-Instruct" tokenizer = LlamaTokenizer.from_pretrained(model_path, use_fast=False) tokenizer.pad_token_id = tokenizer.eos_token_id model = LlamaForCausalLM.from_pretrained( model_path, trust_remote_code=True, device_map="auto", torch_dtype=torch.bfloat16, ) messages = [ {"role": "system", "content": "You are EuroLLM --- an AI assistant specialized in European languages that provides safe, educational and helpful answers."}, {"role": "user", "content": "What is the capital of the Netherlands? Tell me something about it."} ] # Generate chat-formatted input instaed of prompt and inputs -v0, kind of working inputs = tokenizer.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_tensors="pt" ).to(model.device) # # Safe pad fallback # if tokenizer.pad_token_id is None: # tokenizer.pad_token_id = tokenizer.eos_token_id # Generate outputs = model.generate( input_ids=inputs, max_new_tokens=512, do_sample=False, pad_token_id=2, eos_token_id=4 ) # Decode print(tokenizer.decode(outputs[0], skip_special_tokens=True)) </code></pre> <p>Although I am getting output such as :</p> <pre><code class="lang-auto">&lt;|im_start|&gt; system You are EuroLLM --- an AI assistant specialized in European languages that provides safe, educational and helpful answers. &lt;|im_start|&gt; user What is the capital of the Netherlands? Tell me something about it. &lt;|im_start|&gt; assistant ونssss </code></pre> <p>Is it something I am doing wrong or the model itself is so bad, I assume the first. Could someone help me running the model correctly?</p>
<p>If it works locally, it’s not the model itself. Either the model is not yet supported by default, and <strong>trust_remote_code=True</strong> is required, or there is a problem with the network environment. Since the download is working, it’s probably the former.</p> <pre data-code-wrap="py"><code class="lang-py">tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained(model_id, trust_remote_code=True) </code></pre>
[Owlv2 - image_guided_detection - embed_image_query] Why choosing the least similar box from selected ones?
https://discuss.huggingface.co/t/owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones/63390
63,390
9
2023-11-24T09:13:10.849000Z
[ { "id": 100695, "name": "Dien-Hoa Truong", "username": "dhoa", "avatar_template": "/user_avatar/discuss.huggingface.co/dhoa/{size}/27650_2.png", "created_at": "2023-11-24T09:13:10.915Z", "cooked": "<p>I’m trying to understand the owlv2 image_guided_detection and have a question.</p>\n<p>From this tutorial about OWLv2 <a href=\"https://github.com/NielsRogge/Transformers-Tutorials/blob/master/OWLv2/Zero_and_one_shot_object_detection_with_OWLv2.ipynb\" rel=\"noopener nofollow ugc\">zero_oneshot_owlv2_ObjectionDetection</a>, the author said that the image_guided_detection part uses a heuristic way to <code>get the patch in the source image which most likely contains an object</code></p>\n<p>Looking at the source code at <a href=\"https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py\" rel=\"noopener nofollow ugc\">https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py</a></p>\n<p>The heuristic he mentioned I believe is here:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\"> iou_threshold = torch.max(ious) * 0.8\n\n selected_inds = (ious[0] &gt;= iou_threshold).nonzero()\n if selected_inds.numel():\n selected_embeddings = class_embeds[i][selected_inds.squeeze(1)]\n mean_embeds = torch.mean(class_embeds[i], axis=0)\n mean_sim = torch.einsum(\"d,id-&gt;i\", mean_embeds, selected_embeddings)\n best_box_ind = selected_inds[torch.argmin(mean_sim)]\n best_class_embeds.append(class_embeds[i][best_box_ind])\n best_box_indices.append(best_box_ind)\n</code></pre>\n<p>So what I understand from this code:</p>\n<ol>\n<li>Select a list of bbox</li>\n<li>Calculate the mean of embedding of these bbox</li>\n<li>Calculate the similarity of the mean_embedding and all bbox_embeddings</li>\n<li>Select the bbox which is the least similar to the mean via <code>best_box_ind = selected_inds[torch.argmin(mean_sim)]</code></li>\n</ol>\n<p>So, why choose the least similar here instead of the most similar one with argmax? We want to choose a box closest to the mean, right?</p>\n<p>Thanks</p>", "post_number": 1, "post_type": 1, "posts_count": 6, "updated_at": "2023-11-24T09:13:10.915Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 456, "reads": 15, "readers_count": 14, "score": 2278, "yours": false, "topic_id": 63390, "topic_slug": "owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones", "display_username": "Dien-Hoa Truong", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/NielsRogge/Transformers-Tutorials/blob/master/OWLv2/Zero_and_one_shot_object_detection_with_OWLv2.ipynb", "internal": false, "reflection": false, "title": null, "clicks": 25 }, { "url": "https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py", "internal": false, "reflection": false, "title": null, "clicks": 18 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 5358, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones/63390/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 100705, "name": "Dien-Hoa Truong", "username": "dhoa", "avatar_template": "/user_avatar/discuss.huggingface.co/dhoa/{size}/27650_2.png", "created_at": "2023-11-24T10:20:39.208Z", "cooked": "<p>[Update]</p>\n<p>Maybe the reason for choosing the least similar is to remove noise because when I change from argmin to argmax. I have a lot of False Positives ( even when the chosen bounding box is not different too much for both cases, very weird <img src=\"https://emoji.discourse-cdn.com/apple/thinking.png?v=12\" title=\":thinking:\" class=\"emoji\" alt=\":thinking:\" loading=\"lazy\" width=\"20\" height=\"20\">)</p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/f/2/f25bc0dccef1c7db9f1043e7999c20edb1483084.jpeg\" data-download-href=\"/uploads/short-url/yA07Y5EOdnlFZkmU3FBTGMNXLPS.jpeg?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/f/2/f25bc0dccef1c7db9f1043e7999c20edb1483084.jpeg\" alt=\"image\" data-base62-sha1=\"yA07Y5EOdnlFZkmU3FBTGMNXLPS\" width=\"546\" height=\"500\" data-dominant-color=\"AB789E\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">726×664 52 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>Still not sure what is the best way to work with OwlV2 for image-guided detection, anyone know the best practices?</p>\n<p>Thanks</p>", "post_number": 2, "post_type": 1, "posts_count": 6, "updated_at": "2023-11-24T10:32:59.970Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 15, "readers_count": 14, "score": 33, "yours": false, "topic_id": 63390, "topic_slug": "owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones", "display_username": "Dien-Hoa Truong", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://us1.discourse-cdn.com/hellohellohello/original/3X/f/2/f25bc0dccef1c7db9f1043e7999c20edb1483084.jpeg", "internal": false, "reflection": false, "title": "f25bc0dccef1c7db9f1043e7999c20edb1483084.jpeg", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 5358, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones/63390/2", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 100734, "name": "Dien-Hoa Truong", "username": "dhoa", "avatar_template": "/user_avatar/discuss.huggingface.co/dhoa/{size}/27650_2.png", "created_at": "2023-11-24T13:43:12.777Z", "cooked": "<p>The reason can be found in the original implementation of OWLv2 from scenic:</p><aside class=\"onebox githubblob\" data-onebox-src=\"https://github.com/google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py\">\n <header class=\"source\">\n\n <a href=\"https://github.com/google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py\" target=\"_blank\" rel=\"noopener nofollow ugc\">github.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <h4><a href=\"https://github.com/google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py\" target=\"_blank\" rel=\"noopener nofollow ugc\">google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py</a></h4>\n\n\n <pre><code class=\"lang-py\">\"\"\"Code for running (interactive) inference with OWL-ViT models.\"\"\"\n\nimport dataclasses\nimport functools\nfrom typing import Any, Dict, Tuple\n\nfrom flax import linen as nn\nimport jax\nimport jax.numpy as jnp\nimport ml_collections\nimport numpy as np\nfrom scenic.model_lib.base_models import box_utils\nfrom scenic.projects.owl_vit.notebooks import numpy_cache\nfrom scipy import special as sp_special\nfrom skimage import transform as skimage_transform\nimport tensorflow as tf\n\nsigmoid = sp_special.expit # Sigmoid is a more familiar name.\nQUERY_PAD_BIN_SIZE = 50\n\n</code></pre>\n\n\n\n This file has been truncated. <a href=\"https://github.com/google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py\" target=\"_blank\" rel=\"noopener nofollow ugc\">show original</a>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<pre><code># Due to the DETR style bipartite matching loss, only one embedding\n# feature for each object is \"good\" and the rest are \"background.\" To find\n# the one \"good\" feature we use the heuristic that it should be dissimilar\n# to the mean embedding.\n</code></pre>\n<p>Does it also mean that OWLv2 image-guided-detection is very sensible to noise? just a very small difference in the query bounding box and the result is completely wrong</p>", "post_number": 3, "post_type": 1, "posts_count": 6, "updated_at": "2023-11-24T13:45:50.854Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 18, "reads": 13, "readers_count": 12, "score": 127.6, "yours": false, "topic_id": 63390, "topic_slug": "owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones", "display_username": "Dien-Hoa Truong", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py", "internal": false, "reflection": false, "title": null, "clicks": 15 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 5358, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones/63390/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214935, "name": "Taherali Patrawala", "username": "taher30", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/t/c77e96/{size}.png", "created_at": "2025-04-11T19:55:38.517Z", "cooked": "<p>This seem to be the case here.<br>\nI have been trying to make this work for my project and it performs worse using the image_guided_detection method of the og class.<br>\nDid you happen to find the solution to make this work?</p>", "post_number": 4, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-11T19:55:38.517Z", "reply_count": 1, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 1, "reads": 3, "readers_count": 2, "score": 25.6, "yours": false, "topic_id": 63390, "topic_slug": "owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones", "display_username": "Taherali Patrawala", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90357, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones/63390/4", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 5358, "username": "dhoa", "name": "Dien-Hoa Truong", "avatar_template": "/user_avatar/discuss.huggingface.co/dhoa/{size}/27650_2.png" }, "action_code": null, "via_email": null }, { "id": 214957, "name": "Dien-Hoa Truong", "username": "dhoa", "avatar_template": "/user_avatar/discuss.huggingface.co/dhoa/{size}/27650_2.png", "created_at": "2025-04-11T20:31:57.536Z", "cooked": "<p>It’s been a while since I worked with Owlv2, so I don’t remember everything in detail. But in the end, I made it work, but please double-check my comment here <img src=\"https://emoji.discourse-cdn.com/apple/smiley.png?v=14\" title=\":smiley:\" class=\"emoji\" alt=\":smiley:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>HF Owl code runs a heuristic to find the good feature that represents the object. Due to DETR bipartite matching loss, even 2 bounding boxes that have high IoU, one can represent the background and the other represents the object. If we choose an incorrect feature, we might end up detecting the background ( The image in my old comment above )</p>\n<p>But this is for Owl-v1, not v2, HF repo uses the same logic of v1 but it’s not optimal for Owl-v2. Owl-v2 has an objectness score and we could use it directly to get the best feature instead of relying on the heuristic of v1. It’s confirmed by Google in an issue I asked before: <a href=\"https://github.com/google-research/scenic/issues/989\" rel=\"noopener nofollow ugc\">https://github.com/google-research/scenic/issues/989</a></p>\n<p>So, what I remember is that you run Owl-v2 on the reference image, extract the feature with the highest objectness score, and then use this feature for your image-guided detection. Also, be careful to double check the bounding box of the reference object, you can have a case your reference image has many possible objects.</p>\n<p>Hope it helps</p>", "post_number": 5, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-11T20:31:57.536Z", "reply_count": 1, "reply_to_post_number": 4, "quote_count": 0, "incoming_link_count": 3, "reads": 3, "readers_count": 2, "score": 50.6, "yours": false, "topic_id": 63390, "topic_slug": "owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones", "display_username": "Dien-Hoa Truong", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/google-research/scenic/issues/989", "internal": false, "reflection": false, "title": "What is the best way to do one-shot image-conditioned in Owl-v2 · Issue #989 · google-research/scenic · GitHub", "clicks": 5 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 5358, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones/63390/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 90357, "username": "taher30", "name": "Taherali Patrawala", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/t/c77e96/{size}.png" }, "action_code": null, "via_email": null }, { "id": 215218, "name": "Taherali Patrawala", "username": "taher30", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/t/c77e96/{size}.png", "created_at": "2025-04-13T09:42:02.228Z", "cooked": "<p>I will give it a try, and try to modify the class for my workflow. I know I am gonna run into issues, but I’ll give t a try.<br>\nThis clears lots of things, and it seems like I won’t have to choose the query embedding each time for it and just use argmax to choose the one with highest score.<br>\nOnly if there was a way to annotate the target image myself, and use the annotated part as a query to make the detections.<br>\nHowever, the given method works also.<br>\nThanks for taking out your time and reply <img src=\"https://emoji.discourse-cdn.com/apple/blush.png?v=14\" title=\":blush:\" class=\"emoji\" alt=\":blush:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 6, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-13T09:42:02.228Z", "reply_count": 0, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 30.6, "yours": false, "topic_id": 63390, "topic_slug": "owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones", "display_username": "Taherali Patrawala", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90357, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/owlv2-image-guided-detection-embed-image-query-why-choosing-the-least-similar-box-from-selected-ones/63390/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 5358, "username": "dhoa", "name": "Dien-Hoa Truong", "avatar_template": "/user_avatar/discuss.huggingface.co/dhoa/{size}/27650_2.png" }, "action_code": null, "via_email": null } ]
<p>I’m trying to understand the owlv2 image_guided_detection and have a question.</p> <p>From this tutorial about OWLv2 <a href="https://github.com/NielsRogge/Transformers-Tutorials/blob/master/OWLv2/Zero_and_one_shot_object_detection_with_OWLv2.ipynb" rel="noopener nofollow ugc">zero_oneshot_owlv2_ObjectionDetection</a>, the author said that the image_guided_detection part uses a heuristic way to <code>get the patch in the source image which most likely contains an object</code></p> <p>Looking at the source code at <a href="https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py" rel="noopener nofollow ugc">https://github.com/huggingface/transformers/blob/main/src/transformers/models/owlv2/modeling_owlv2.py</a></p> <p>The heuristic he mentioned I believe is here:</p> <pre data-code-wrap="python"><code class="lang-python"> iou_threshold = torch.max(ious) * 0.8 selected_inds = (ious[0] &gt;= iou_threshold).nonzero() if selected_inds.numel(): selected_embeddings = class_embeds[i][selected_inds.squeeze(1)] mean_embeds = torch.mean(class_embeds[i], axis=0) mean_sim = torch.einsum("d,id-&gt;i", mean_embeds, selected_embeddings) best_box_ind = selected_inds[torch.argmin(mean_sim)] best_class_embeds.append(class_embeds[i][best_box_ind]) best_box_indices.append(best_box_ind) </code></pre> <p>So what I understand from this code:</p> <ol> <li>Select a list of bbox</li> <li>Calculate the mean of embedding of these bbox</li> <li>Calculate the similarity of the mean_embedding and all bbox_embeddings</li> <li>Select the bbox which is the least similar to the mean via <code>best_box_ind = selected_inds[torch.argmin(mean_sim)]</code></li> </ol> <p>So, why choose the least similar here instead of the most similar one with argmax? We want to choose a box closest to the mean, right?</p> <p>Thanks</p>
<p>The reason can be found in the original implementation of OWLv2 from scenic:</p><aside class="onebox githubblob" data-onebox-src="https://github.com/google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py"> <header class="source"> <a href="https://github.com/google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py" target="_blank" rel="noopener nofollow ugc">github.com</a> </header> <article class="onebox-body"> <h4><a href="https://github.com/google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py" target="_blank" rel="noopener nofollow ugc">google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py</a></h4> <pre><code class="lang-py">"""Code for running (interactive) inference with OWL-ViT models.""" import dataclasses import functools from typing import Any, Dict, Tuple from flax import linen as nn import jax import jax.numpy as jnp import ml_collections import numpy as np from scenic.model_lib.base_models import box_utils from scenic.projects.owl_vit.notebooks import numpy_cache from scipy import special as sp_special from skimage import transform as skimage_transform import tensorflow as tf sigmoid = sp_special.expit # Sigmoid is a more familiar name. QUERY_PAD_BIN_SIZE = 50 </code></pre> This file has been truncated. <a href="https://github.com/google-research/scenic/blob/main/scenic/projects/owl_vit/notebooks/inference.py" target="_blank" rel="noopener nofollow ugc">show original</a> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <pre><code># Due to the DETR style bipartite matching loss, only one embedding # feature for each object is "good" and the rest are "background." To find # the one "good" feature we use the heuristic that it should be dissimilar # to the mean embedding. </code></pre> <p>Does it also mean that OWLv2 image-guided-detection is very sensible to noise? just a very small difference in the query bounding box and the result is completely wrong</p>
Model input shape doesnt match
https://discuss.huggingface.co/t/model-input-shape-doesnt-match/150085
150,085
5
2025-04-12T10:22:19.834000Z
[ { "id": 215078, "name": "Lukas Nolle", "username": "LukasUni", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/l/41988e/{size}.png", "created_at": "2025-04-12T10:22:19.892Z", "cooked": "<p>Hello,</p>\n<p>with the following Code</p>\n<pre><code class=\"lang-auto\">from diffusers import UNet1DModel\nimport torch\nimport torch.nn as nn\nclass ClassConditionedUned(nn.Module):\n def __init__(self, num_ela=8, class_emb_size=4):\n super().__init__()\n self.class_emb = nn.Sequential(\n nn.Linear(num_ela, 32),\n nn.ReLU(),\n nn.Linear(32, class_emb_size)\n )\n self.model = UNet1DModel(\n sample_size=512,\n in_channels=1+class_emb_size,\n out_channels=1,\n layers_per_block=1, \n block_out_channels = (32, 32, 64), \n down_block_types = (\"DownBlock1DNoSkip\", \"DownBlock1D\", \"AttnDownBlock1D\"),\n up_block_types = (\"AttnUpBlock1D\", \"UpBlock1D\", \"UpBlock1DNoSkip\"), \n )\n \n def forward(self, x, t, ela_vec):\n bs, ch, h = x.shape\n class_cond = self.class_emb(ela_vec) # Map to embedding dimension\n class_cond = class_cond.view(bs, -1, 1).expand(-1, -1, h)\n net_input = torch.cat((x, class_cond), 1)\n print(net_input.shape)\n return self.model(net_input, t).sample\n\nmodel = ClassConditionedUned()\nx = torch.randn(1, 1, 512)\nt = torch.randint(0, 1000, (1,))\nela_vec = torch.rand(1, 8) # normalisierte ELA-Vektoren\n\nwith torch.no_grad():\n out = model(x, t, ela_vec)\n</code></pre>\n<p>i get this error:<br>\nout = model(x, t, ela_vec)<br>\n^^^^^^^^^^^^^^^^^^^^<br>\nRuntimeError: Given groups=1, weight of size [32, 5, 1], expected input[1, 21, 512] to have 5 channels, but got 21 channels instead</p>\n<p>What am i doing wrong?</p>\n<p>Thank you in advance</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-12T10:22:19.892Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 20, "reads": 3, "readers_count": 2, "score": 115.6, "yours": false, "topic_id": 150085, "topic_slug": "model-input-shape-doesnt-match", "display_username": "Lukas Nolle", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90407, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-input-shape-doesnt-match/150085/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 215079, "name": "Lukas Nolle", "username": "LukasUni", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/l/41988e/{size}.png", "created_at": "2025-04-12T11:04:39.996Z", "cooked": "<p>this solvers my issue: <a href=\"https://github.com/huggingface/diffusers/issues/2967#issuecomment-1500800012\" rel=\"noopener nofollow ugc\">https://github.com/huggingface/diffusers/issues/2967#issuecomment-1500800012</a><br>\ni had to add 16 to the input channels</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-12T11:04:39.996Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 150085, "topic_slug": "model-input-shape-doesnt-match", "display_username": "Lukas Nolle", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/diffusers/issues/2967#issuecomment-1500800012", "internal": false, "reflection": false, "title": "Cannot get simple UNet1D to run · Issue #2967 · huggingface/diffusers · GitHub", "clicks": 2 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90407, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-input-shape-doesnt-match/150085/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 215154, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-12T23:05:32.425Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-12T23:05:32.425Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 150085, "topic_slug": "model-input-shape-doesnt-match", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-input-shape-doesnt-match/150085/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello,</p> <p>with the following Code</p> <pre><code class="lang-auto">from diffusers import UNet1DModel import torch import torch.nn as nn class ClassConditionedUned(nn.Module): def __init__(self, num_ela=8, class_emb_size=4): super().__init__() self.class_emb = nn.Sequential( nn.Linear(num_ela, 32), nn.ReLU(), nn.Linear(32, class_emb_size) ) self.model = UNet1DModel( sample_size=512, in_channels=1+class_emb_size, out_channels=1, layers_per_block=1, block_out_channels = (32, 32, 64), down_block_types = ("DownBlock1DNoSkip", "DownBlock1D", "AttnDownBlock1D"), up_block_types = ("AttnUpBlock1D", "UpBlock1D", "UpBlock1DNoSkip"), ) def forward(self, x, t, ela_vec): bs, ch, h = x.shape class_cond = self.class_emb(ela_vec) # Map to embedding dimension class_cond = class_cond.view(bs, -1, 1).expand(-1, -1, h) net_input = torch.cat((x, class_cond), 1) print(net_input.shape) return self.model(net_input, t).sample model = ClassConditionedUned() x = torch.randn(1, 1, 512) t = torch.randint(0, 1000, (1,)) ela_vec = torch.rand(1, 8) # normalisierte ELA-Vektoren with torch.no_grad(): out = model(x, t, ela_vec) </code></pre> <p>i get this error:<br> out = model(x, t, ela_vec)<br> ^^^^^^^^^^^^^^^^^^^^<br> RuntimeError: Given groups=1, weight of size [32, 5, 1], expected input[1, 21, 512] to have 5 channels, but got 21 channels instead</p> <p>What am i doing wrong?</p> <p>Thank you in advance</p>
<p>this solvers my issue: <a href="https://github.com/huggingface/diffusers/issues/2967#issuecomment-1500800012" rel="noopener nofollow ugc">https://github.com/huggingface/diffusers/issues/2967#issuecomment-1500800012</a><br> i had to add 16 to the input channels</p>
What is Temperature for Mistral-small
https://discuss.huggingface.co/t/what-is-temperature-for-mistral-small/149932
149,932
5
2025-04-11T09:21:55.572000Z
[ { "id": 214843, "name": "jv", "username": "jvoid", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/b3f665/{size}.png", "created_at": "2025-04-11T09:21:55.623Z", "cooked": "<p>Hi guys<br>\nIn <a href=\"https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503#usage\">Mistral-Small-3.1-24B-Instruct-250 Usage</a> section it is mentioned some recommended <code>temperature</code> value.</p>\n<p>From the examples same page bellow I can assume it is nothing about cpu or something environment requirements but more like some model parameter or something?</p>\n<p>So where it really comes from? Is it something</p>\n<ul>\n<li>model specific</li>\n<li>some mentioned vllm settings<br>\nor what is it in fact. Where’s some docs or info related to this <code>temperature</code> could be read.</li>\n</ul>\n<p>Thank you</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-11T09:21:55.623Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 276, "reads": 7, "readers_count": 6, "score": 1331.4, "yours": false, "topic_id": 149932, "topic_slug": "what-is-temperature-for-mistral-small", "display_username": "jv", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503#usage", "internal": false, "reflection": false, "title": "mistralai/Mistral-Small-3.1-24B-Instruct-2503 · Hugging Face", "clicks": 20 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88304, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/what-is-temperature-for-mistral-small/149932/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214847, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-11T10:01:52.588Z", "cooked": "<p>You can think of temperature as a common parameter that is used in all LLM. To be more precise, it might be more accurate to say that it is a programming strategy used when generating…</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/how-to-generate\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/how-to-generate\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/388;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/8/28c22037fa447ad6f6a439639ff57e0d17c84ada.png\" class=\"thumbnail\" data-dominant-color=\"F8F7F4\" width=\"690\" height=\"388\"></div>\n\n<h3><a href=\"https://huggingface.co/blog/how-to-generate\" target=\"_blank\" rel=\"noopener\">How to generate text: using different decoding methods for language...</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox stackexchange\" data-onebox-src=\"https://stackoverflow.com/questions/58764619/why-should-we-use-temperature-in-softmax/63471046#63471046\">\n <header class=\"source\">\n\n <a href=\"https://stackoverflow.com/questions/58764619/why-should-we-use-temperature-in-softmax/63471046#63471046\" target=\"_blank\" rel=\"noopener\">stackoverflow.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <a href=\"https://stackoverflow.com/users/10873786/zain-sarwar\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"Zain Sarwar\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/b/0/b0431dbac99813d51c9d4af8684f5d2ff9b745c6.jpeg\" class=\"thumbnail onebox-avatar\" data-dominant-color=\"82666B\" width=\"256\" height=\"256\">\n </a>\n\n<h4>\n <a href=\"https://stackoverflow.com/questions/58764619/why-should-we-use-temperature-in-softmax/63471046#63471046\" target=\"_blank\" rel=\"noopener\">Why should we use Temperature in softmax?</a>\n</h4>\n\n<div class=\"tags\">\n <strong>machine-learning, deep-learning, conv-neural-network, softmax</strong>\n</div>\n\n<div class=\"date\">\n \n answered by\n <a href=\"https://stackoverflow.com/users/10873786/zain-sarwar\" target=\"_blank\" rel=\"noopener\">\n Zain Sarwar\n </a>\n on <a href=\"https://stackoverflow.com/questions/58764619/why-should-we-use-temperature-in-softmax/63471046#63471046\" target=\"_blank\" rel=\"noopener\">02:42PM - 18 Aug 20 UTC</a>\n</div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://medium.com/@1511425435311/understanding-openais-temperature-and-top-p-parameters-in-language-models-d2066504684f\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/f/0f95de5840ff0771b84ea77cfa42a1e98b4f1614.png\" class=\"site-icon\" data-dominant-color=\"3B3B3B\" width=\"32\" height=\"32\">\n\n <a href=\"https://medium.com/@1511425435311/understanding-openais-temperature-and-top-p-parameters-in-language-models-d2066504684f\" target=\"_blank\" rel=\"noopener\" title=\"10:17PM - 04 November 2023\">Medium – 4 Nov 23</a>\n </header>\n\n <article class=\"onebox-body\">\n \n\n<h3><a href=\"https://medium.com/@1511425435311/understanding-openais-temperature-and-top-p-parameters-in-language-models-d2066504684f\" target=\"_blank\" rel=\"noopener\">Understanding OpenAI’s “Temperature” and “Top_p” Parameters in Language Models</a></h3>\n\n <p>This article presents a simplified explanation of how “temperature” and “top_p” affect text generation and illustrates how their…</p>\n\n <p>\n <span class=\"label1\">Reading time: 3 min read</span>\n </p>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-11T10:01:52.588Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 6, "readers_count": 5, "score": 31.2, "yours": false, "topic_id": 149932, "topic_slug": "what-is-temperature-for-mistral-small", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://medium.com/@1511425435311/understanding-openais-temperature-and-top-p-parameters-in-language-models-d2066504684f", "internal": false, "reflection": false, "title": "Understanding OpenAI’s “Temperature” and “Top_p” Parameters in Language Models | by Miguel de la Vega | Medium", "clicks": 7 }, { "url": "https://stackoverflow.com/questions/58764619/why-should-we-use-temperature-in-softmax/63471046#63471046", "internal": false, "reflection": false, "title": "machine learning - Why should we use Temperature in softmax? - Stack Overflow", "clicks": 5 }, { "url": "https://huggingface.co/blog/how-to-generate", "internal": false, "reflection": false, "title": "How to generate text: using different decoding methods for language generation with Transformers", "clicks": 2 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/what-is-temperature-for-mistral-small/149932/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214970, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-11T22:02:32.080Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-11T22:02:32.080Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 3, "readers_count": 2, "score": 5.6, "yours": false, "topic_id": 149932, "topic_slug": "what-is-temperature-for-mistral-small", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/what-is-temperature-for-mistral-small/149932/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi guys<br> In <a href="https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503#usage">Mistral-Small-3.1-24B-Instruct-250 Usage</a> section it is mentioned some recommended <code>temperature</code> value.</p> <p>From the examples same page bellow I can assume it is nothing about cpu or something environment requirements but more like some model parameter or something?</p> <p>So where it really comes from? Is it something</p> <ul> <li>model specific</li> <li>some mentioned vllm settings<br> or what is it in fact. Where’s some docs or info related to this <code>temperature</code> could be read.</li> </ul> <p>Thank you</p>
<p>You can think of temperature as a common parameter that is used in all LLM. To be more precise, it might be more accurate to say that it is a programming strategy used when generating…</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/blog/how-to-generate"> <header class="source"> <a href="https://huggingface.co/blog/how-to-generate" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/388;"><img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/2/8/28c22037fa447ad6f6a439639ff57e0d17c84ada.png" class="thumbnail" data-dominant-color="F8F7F4" width="690" height="388"></div> <h3><a href="https://huggingface.co/blog/how-to-generate" target="_blank" rel="noopener">How to generate text: using different decoding methods for language...</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox stackexchange" data-onebox-src="https://stackoverflow.com/questions/58764619/why-should-we-use-temperature-in-softmax/63471046#63471046"> <header class="source"> <a href="https://stackoverflow.com/questions/58764619/why-should-we-use-temperature-in-softmax/63471046#63471046" target="_blank" rel="noopener">stackoverflow.com</a> </header> <article class="onebox-body"> <a href="https://stackoverflow.com/users/10873786/zain-sarwar" target="_blank" rel="noopener"> <img alt="Zain Sarwar" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/b/0/b0431dbac99813d51c9d4af8684f5d2ff9b745c6.jpeg" class="thumbnail onebox-avatar" data-dominant-color="82666B" width="256" height="256"> </a> <h4> <a href="https://stackoverflow.com/questions/58764619/why-should-we-use-temperature-in-softmax/63471046#63471046" target="_blank" rel="noopener">Why should we use Temperature in softmax?</a> </h4> <div class="tags"> <strong>machine-learning, deep-learning, conv-neural-network, softmax</strong> </div> <div class="date"> answered by <a href="https://stackoverflow.com/users/10873786/zain-sarwar" target="_blank" rel="noopener"> Zain Sarwar </a> on <a href="https://stackoverflow.com/questions/58764619/why-should-we-use-temperature-in-softmax/63471046#63471046" target="_blank" rel="noopener">02:42PM - 18 Aug 20 UTC</a> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://medium.com/@1511425435311/understanding-openais-temperature-and-top-p-parameters-in-language-models-d2066504684f"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/0/f/0f95de5840ff0771b84ea77cfa42a1e98b4f1614.png" class="site-icon" data-dominant-color="3B3B3B" width="32" height="32"> <a href="https://medium.com/@1511425435311/understanding-openais-temperature-and-top-p-parameters-in-language-models-d2066504684f" target="_blank" rel="noopener" title="10:17PM - 04 November 2023">Medium – 4 Nov 23</a> </header> <article class="onebox-body"> <h3><a href="https://medium.com/@1511425435311/understanding-openais-temperature-and-top-p-parameters-in-language-models-d2066504684f" target="_blank" rel="noopener">Understanding OpenAI’s “Temperature” and “Top_p” Parameters in Language Models</a></h3> <p>This article presents a simplified explanation of how “temperature” and “top_p” affect text generation and illustrates how their…</p> <p> <span class="label1">Reading time: 3 min read</span> </p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Unable to download large datasets
https://discuss.huggingface.co/t/unable-to-download-large-datasets/149456
149,456
10
2025-04-08T13:59:57.343000Z
[ { "id": 214218, "name": "Thomas", "username": "thomaswnl", "avatar_template": "/user_avatar/discuss.huggingface.co/thomaswnl/{size}/45074_2.png", "created_at": "2025-04-08T13:59:57.412Z", "cooked": "<p>Hi, I have been trying to download the droid dataset using huggingface cli, both from</p>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/datasets/cadene/droid_1.0.1\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/datasets/cadene/droid_1.0.1\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/b/6b2c372f5a494bf30ebc1d3d6c635b9cda8ade28_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"6854C0\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/datasets/cadene/droid_1.0.1\" target=\"_blank\" rel=\"noopener\">cadene/droid_1.0.1 · Datasets at Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<p>\nand<br>\ndatasets/IPEC-COMMUNITY/droid_lerobot</p>\n<p>However, i cannot manage to download the full dataset. It downloads all of the parquet files, but only the first three (of 100) chunks of video.</p>\n<p>Alternatively, i have tried git clone, but I get the following error:<br>\ngit clone <a href=\"mailto:[email protected]\">[email protected]</a>:datasets/cadene/droid_1.0.1</p>\n<p>panic: runtime error: index out of range [0] with length 0</p>\n<p>goroutine 124 [running]:<br>\ngithub dot com/git-lfs/git-lfs/tq.(*basicDownloadAdapter).download(0xc000290348, 0xc00a70a900, 0xc000110ce0, 0x0, 0xc00e373f58, 0x0, {0xb4ce40, 0xc011c47c00})<br>\ngithub dot com/git-lfs/git-lfs/tq/basic_download.go:156 +0xceb<br>\ngithub dot com/git-lfs/git-lfs/tq.(*basicDownloadAdapter).DoTransfer(0xc000290348, {0x40?, 0x0?}, 0xc00a70a900, 0xc000110ce0, 0x0)<br>\ngithub dot com/git-lfs/git-lfs/tq/basic_download.go:96 +0x42d<br>\ngithub dot com/git-lfs/git-lfs/tq.(*adapterBase).worker(0xc0006042d0, 0x7, {0x0, 0x0})<br>\ngithub dot com/git-lfs/git-lfs/tq/adapterbase.go:183 +0x597<br>\ncreated by github dot com/git-lfs/git-lfs/tq.(*adapterBase).Begin in goroutine 79<br>\ngithub dot com/git-lfs/git-lfs/tq/adapterbase.go:96 +0x27a<br>\nerror: external filter ‘git-lfs filter-process’ failed<br>\nfatal: videos/chunk-040/observation.images.exterior_2_left/episode_040994.mp4: smudge filter lfs failed<br>\nwarning: Clone succeeded, but checkout failed.<br>\nYou can inspect what was checked out with ‘git status’<br>\nand retry with ‘git restore --source=HEAD :/’</p>\n<p>I used both huggingface-cli and git clone, on multiple machines, but the behaviour persists.<br>\nAny idea what is going on?</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-08T14:53:02.976Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 36, "reads": 8, "readers_count": 7, "score": 186.6, "yours": false, "topic_id": 149456, "topic_slug": "unable-to-download-large-datasets", "display_username": "Thomas", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 3, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/datasets/cadene/droid_1.0.1", "internal": false, "reflection": false, "title": "cadene/droid_1.0.1 · Datasets at Hugging Face", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89945, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-download-large-datasets/149456/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214255, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-08T16:00:57.844Z", "cooked": "<p>Hmm… Seems git-lfs issue.</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/git-lfs/git-lfs/issues/5546\">\n <header class=\"source\">\n\n <a href=\"https://github.com/git-lfs/git-lfs/issues/5546\" target=\"_blank\" rel=\"noopener\">github.com/git-lfs/git-lfs</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/git-lfs/git-lfs/issues/5546\" target=\"_blank\" rel=\"noopener\">panic: runtime error: index out of range [0] with length 0 goroutine 1 [running]:</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2023-10-16\" data-time=\"10:22:20\" data-timezone=\"UTC\">10:22AM - 16 Oct 23 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2023-10-16\" data-time=\"12:46:44\" data-timezone=\"UTC\">12:46PM - 16 Oct 23 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/BabaqKakRanshe\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/8/5/8534627e82ff6bd3df203fe8e7a6ddc6b7359ec3.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"E9E0C6\">\n BabaqKakRanshe\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n duplicate\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">$ git lfs env\ngit-lfs/3.4.0 (GitHub; windows amd64; go 1.20.6; git d06d6e9e)\ng<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">it version 2.42.0.windows.2\n\nEndpoint=http://tfs.nordic-it.ru:8081/VR_Collection/REALPROP/_git/RPROP.git/info/lfs (auth=basic)\nLocalWorkingDir=H:\\!Varvision\\Projects\\RPROP\\RPROP\nLocalGitDir=H:\\!Varvision\\Projects\\RPROP\\RPROP\\.git\nLocalGitStorageDir=H:\\!Varvision\\Projects\\RPROP\\RPROP\\.git\nLocalMediaDir=H:\\!Varvision\\Projects\\RPROP\\RPROP\\.git\\lfs\\objects\nLocalReferenceDirs=\nTempDir=H:\\!Varvision\\Projects\\RPROP\\RPROP\\.git\\lfs\\tmp\nConcurrentTransfers=8\nTusTransfers=false\nBasicTransfersOnly=false\nSkipDownloadErrors=false\nFetchRecentAlways=false\nFetchRecentRefsDays=7\nFetchRecentCommitsDays=0\nFetchRecentRefsIncludeRemotes=true\nPruneOffsetDays=3\nPruneVerifyRemoteAlways=false\nPruneRemoteName=origin\nLfsStorageDir=H:\\!Varvision\\Projects\\RPROP\\RPROP\\.git\\lfs\nAccessDownload=basic\nAccessUpload=basic\nDownloadTransfers=basic,lfs-standalone-file,ssh\nUploadTransfers=basic,lfs-standalone-file,ssh\nGIT_EXEC_PATH=C:/Program Files/Git/mingw64/libexec/git-core\nGIT_LFS_PATH=C:\\Program Files\\Git LFS\ngit config filter.lfs.process = \"git-lfs filter-process\"\ngit config filter.lfs.smudge = \"git-lfs smudge -- %f\"\ngit config filter.lfs.clean = \"git-lfs clean -- %f\"\n\n\n```\ngoroutine 1 [running]:\ngithub.com/git-lfs/git-lfs/v3/lfsapi.(*Client).getCreds(0xc0000c2960, {0xc00002a0c8, 0x6}, {{0xc0003304e4, 0x5}, {0xc0000d3630, 0x4b}}, 0xc000294f00)\n\tgithub.com/git-lfs/git-lfs/v3/lfsapi/auth.go:165 +0x7a5\ngithub.com/git-lfs/git-lfs/v3/lfsapi.(*Client).doWithAuth(0xc0000c2960, {0xc00002a0c8, 0x6}, {{0xc0003304e4, 0x5}, {0xc0000d3630, 0x4b}}, 0xc000294f00, {0x0, 0x0, ...})\n\tgithub.com/git-lfs/git-lfs/v3/lfsapi/auth.go:63 +0xd8\ngithub.com/git-lfs/git-lfs/v3/lfsapi.(*Client).DoWithAuth(0xc0000c2960, {0xc00002a0c8, 0x6}, {{0xc0003304e4, 0x5}, {0xc0000d3630, 0x4b}}, 0xc000294f00)\n\tgithub.com/git-lfs/git-lfs/v3/lfsapi/auth.go:26 +0x79\ngithub.com/git-lfs/git-lfs/v3/lfsapi.(*Client).DoWithAuth(0xc0000c2960, {0xc00002a0c8, 0x6}, {{0xc0003304e4, 0x5}, {0xc0000d3630, 0x4b}}, 0xc000294f00)\n\tgithub.com/git-lfs/git-lfs/v3/lfsapi/auth.go:36 +0x1b3\ngithub.com/git-lfs/git-lfs/v3/lfsapi.(*Client).DoAPIRequestWithAuth(0xc0000c2960, {0xc00002a0c8, 0x6}, 0xc000294f00)\n\tgithub.com/git-lfs/git-lfs/v3/lfsapi/auth.go:57 +0x147\ngithub.com/git-lfs/git-lfs/v3/locking.(*httpLockClient).SearchVerifiable(0xc0000981c8, {0xc00002a0c8, 0x6}, 0x138d8bf?)\n\tgithub.com/git-lfs/git-lfs/v3/locking/api.go:287 +0x155\ngithub.com/git-lfs/git-lfs/v3/locking.(*genericLockClient).SearchVerifiable(0xc0002fc330?, {0xc00002a0c8, 0x6}, 0xc0001238d8?)\n\tgithub.com/git-lfs/git-lfs/v3/locking/api.go:368 +0x4c\ngithub.com/git-lfs/git-lfs/v3/locking.(*Client).SearchLocksVerifiable(0xc00040a280, 0x0, 0x0)\n\tgithub.com/git-lfs/git-lfs/v3/locking/locks.go:273 +0x412\ngithub.com/git-lfs/git-lfs/v3/commands.(*lockVerifier).Verify(0xc0000cbb80, 0xc0002fc330)\n\tgithub.com/git-lfs/git-lfs/v3/commands/lockverifier.go:60 +0xbe\ngithub.com/git-lfs/git-lfs/v3/commands.verifyLocksForUpdates(0xc0002960c0?, {0xc000098188, 0x1, 0xc000123c10?})\n\tgithub.com/git-lfs/git-lfs/v3/commands/lockverifier.go:28 +0x34\ngithub.com/git-lfs/git-lfs/v3/commands.uploadForRefUpdates(0xc0002960c0, {0xc000098188?, 0x1, 0x1}, 0x0?)\n\tgithub.com/git-lfs/git-lfs/v3/commands/uploader.go:27 +0xde\ngithub.com/git-lfs/git-lfs/v3/commands.prePushCommand(0xc0000c6f00?, {0xc00009c3c0, 0x2, 0x2?})\n\tgithub.com/git-lfs/git-lfs/v3/commands/command_pre_push.go:62 +0x1df\ngithub.com/spf13/cobra.(*Command).execute(0xc0000c6f00, {0xc00009c360, 0x2, 0x2})\n\tgithub.com/spf13/[email protected]/command.go:920 +0x847\ngithub.com/spf13/cobra.(*Command).ExecuteC(0xc000004c00)\n\tgithub.com/spf13/[email protected]/command.go:1040 +0x3bd\ngithub.com/spf13/cobra.(*Command).Execute(...)\n\tgithub.com/spf13/[email protected]/command.go:968\ngithub.com/git-lfs/git-lfs/v3/commands.Run()\n\tgithub.com/git-lfs/git-lfs/v3/commands/run.go:154 +0x4ad\nmain.main()\n\tgithub.com/git-lfs/git-lfs/v3/git-lfs.go:34 +0xe5\nerror: failed to push some refs to 'http://tfs.nordic-it.ru:8081/VR_Collection/REALPROP/_git/RPROP'\n\n```</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-08T16:00:57.844Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 6.6, "yours": false, "topic_id": 149456, "topic_slug": "unable-to-download-large-datasets", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/git-lfs/git-lfs/issues/5546", "internal": false, "reflection": false, "title": "panic: runtime error: index out of range [0] with length 0 goroutine 1 [running]: · Issue #5546 · git-lfs/git-lfs · GitHub", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-download-large-datasets/149456/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214623, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-10T09:31:29.198Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-10T09:31:29.198Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 0.8, "yours": false, "topic_id": 149456, "topic_slug": "unable-to-download-large-datasets", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-download-large-datasets/149456/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi, I have been trying to download the droid dataset using huggingface cli, both from</p> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/datasets/cadene/droid_1.0.1"> <header class="source"> <a href="https://huggingface.co/datasets/cadene/droid_1.0.1" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/b/6b2c372f5a494bf30ebc1d3d6c635b9cda8ade28_2_690x372.png" class="thumbnail" data-dominant-color="6854C0" width="690" height="372"></div> <h3><a href="https://huggingface.co/datasets/cadene/droid_1.0.1" target="_blank" rel="noopener">cadene/droid_1.0.1 · Datasets at Hugging Face</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <p> and<br> datasets/IPEC-COMMUNITY/droid_lerobot</p> <p>However, i cannot manage to download the full dataset. It downloads all of the parquet files, but only the first three (of 100) chunks of video.</p> <p>Alternatively, i have tried git clone, but I get the following error:<br> git clone <a href="mailto:[email protected]">[email protected]</a>:datasets/cadene/droid_1.0.1</p> <p>panic: runtime error: index out of range [0] with length 0</p> <p>goroutine 124 [running]:<br> github dot com/git-lfs/git-lfs/tq.(*basicDownloadAdapter).download(0xc000290348, 0xc00a70a900, 0xc000110ce0, 0x0, 0xc00e373f58, 0x0, {0xb4ce40, 0xc011c47c00})<br> github dot com/git-lfs/git-lfs/tq/basic_download.go:156 +0xceb<br> github dot com/git-lfs/git-lfs/tq.(*basicDownloadAdapter).DoTransfer(0xc000290348, {0x40?, 0x0?}, 0xc00a70a900, 0xc000110ce0, 0x0)<br> github dot com/git-lfs/git-lfs/tq/basic_download.go:96 +0x42d<br> github dot com/git-lfs/git-lfs/tq.(*adapterBase).worker(0xc0006042d0, 0x7, {0x0, 0x0})<br> github dot com/git-lfs/git-lfs/tq/adapterbase.go:183 +0x597<br> created by github dot com/git-lfs/git-lfs/tq.(*adapterBase).Begin in goroutine 79<br> github dot com/git-lfs/git-lfs/tq/adapterbase.go:96 +0x27a<br> error: external filter ‘git-lfs filter-process’ failed<br> fatal: videos/chunk-040/observation.images.exterior_2_left/episode_040994.mp4: smudge filter lfs failed<br> warning: Clone succeeded, but checkout failed.<br> You can inspect what was checked out with ‘git status’<br> and retry with ‘git restore --source=HEAD :/’</p> <p>I used both huggingface-cli and git clone, on multiple machines, but the behaviour persists.<br> Any idea what is going on?</p>
<p>Hmm… Seems git-lfs issue.</p><aside class="onebox githubissue" data-onebox-src="https://github.com/git-lfs/git-lfs/issues/5546"> <header class="source"> <a href="https://github.com/git-lfs/git-lfs/issues/5546" target="_blank" rel="noopener">github.com/git-lfs/git-lfs</a> </header> <article class="onebox-body"> <div class="github-row"> <div class="github-icon-container" title="Issue" data-github-private-repo="false"> <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg> </div> <div class="github-info-container"> <h4> <a href="https://github.com/git-lfs/git-lfs/issues/5546" target="_blank" rel="noopener">panic: runtime error: index out of range [0] with length 0 goroutine 1 [running]:</a> </h4> <div class="github-info"> <div class="date"> opened <span class="discourse-local-date" data-format="ll" data-date="2023-10-16" data-time="10:22:20" data-timezone="UTC">10:22AM - 16 Oct 23 UTC</span> </div> <div class="date"> closed <span class="discourse-local-date" data-format="ll" data-date="2023-10-16" data-time="12:46:44" data-timezone="UTC">12:46PM - 16 Oct 23 UTC</span> </div> <div class="user"> <a href="https://github.com/BabaqKakRanshe" target="_blank" rel="noopener"> <img alt="" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/8/5/8534627e82ff6bd3df203fe8e7a6ddc6b7359ec3.png" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="E9E0C6"> BabaqKakRanshe </a> </div> </div> <div class="labels"> <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;"> duplicate </span> </div> </div> </div> <div class="github-row"> <p class="github-body-container">$ git lfs env git-lfs/3.4.0 (GitHub; windows amd64; go 1.20.6; git d06d6e9e) g<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">it version 2.42.0.windows.2 Endpoint=http://tfs.nordic-it.ru:8081/VR_Collection/REALPROP/_git/RPROP.git/info/lfs (auth=basic) LocalWorkingDir=H:\!Varvision\Projects\RPROP\RPROP LocalGitDir=H:\!Varvision\Projects\RPROP\RPROP\.git LocalGitStorageDir=H:\!Varvision\Projects\RPROP\RPROP\.git LocalMediaDir=H:\!Varvision\Projects\RPROP\RPROP\.git\lfs\objects LocalReferenceDirs= TempDir=H:\!Varvision\Projects\RPROP\RPROP\.git\lfs\tmp ConcurrentTransfers=8 TusTransfers=false BasicTransfersOnly=false SkipDownloadErrors=false FetchRecentAlways=false FetchRecentRefsDays=7 FetchRecentCommitsDays=0 FetchRecentRefsIncludeRemotes=true PruneOffsetDays=3 PruneVerifyRemoteAlways=false PruneRemoteName=origin LfsStorageDir=H:\!Varvision\Projects\RPROP\RPROP\.git\lfs AccessDownload=basic AccessUpload=basic DownloadTransfers=basic,lfs-standalone-file,ssh UploadTransfers=basic,lfs-standalone-file,ssh GIT_EXEC_PATH=C:/Program Files/Git/mingw64/libexec/git-core GIT_LFS_PATH=C:\Program Files\Git LFS git config filter.lfs.process = "git-lfs filter-process" git config filter.lfs.smudge = "git-lfs smudge -- %f" git config filter.lfs.clean = "git-lfs clean -- %f" ``` goroutine 1 [running]: github.com/git-lfs/git-lfs/v3/lfsapi.(*Client).getCreds(0xc0000c2960, {0xc00002a0c8, 0x6}, {{0xc0003304e4, 0x5}, {0xc0000d3630, 0x4b}}, 0xc000294f00) github.com/git-lfs/git-lfs/v3/lfsapi/auth.go:165 +0x7a5 github.com/git-lfs/git-lfs/v3/lfsapi.(*Client).doWithAuth(0xc0000c2960, {0xc00002a0c8, 0x6}, {{0xc0003304e4, 0x5}, {0xc0000d3630, 0x4b}}, 0xc000294f00, {0x0, 0x0, ...}) github.com/git-lfs/git-lfs/v3/lfsapi/auth.go:63 +0xd8 github.com/git-lfs/git-lfs/v3/lfsapi.(*Client).DoWithAuth(0xc0000c2960, {0xc00002a0c8, 0x6}, {{0xc0003304e4, 0x5}, {0xc0000d3630, 0x4b}}, 0xc000294f00) github.com/git-lfs/git-lfs/v3/lfsapi/auth.go:26 +0x79 github.com/git-lfs/git-lfs/v3/lfsapi.(*Client).DoWithAuth(0xc0000c2960, {0xc00002a0c8, 0x6}, {{0xc0003304e4, 0x5}, {0xc0000d3630, 0x4b}}, 0xc000294f00) github.com/git-lfs/git-lfs/v3/lfsapi/auth.go:36 +0x1b3 github.com/git-lfs/git-lfs/v3/lfsapi.(*Client).DoAPIRequestWithAuth(0xc0000c2960, {0xc00002a0c8, 0x6}, 0xc000294f00) github.com/git-lfs/git-lfs/v3/lfsapi/auth.go:57 +0x147 github.com/git-lfs/git-lfs/v3/locking.(*httpLockClient).SearchVerifiable(0xc0000981c8, {0xc00002a0c8, 0x6}, 0x138d8bf?) github.com/git-lfs/git-lfs/v3/locking/api.go:287 +0x155 github.com/git-lfs/git-lfs/v3/locking.(*genericLockClient).SearchVerifiable(0xc0002fc330?, {0xc00002a0c8, 0x6}, 0xc0001238d8?) github.com/git-lfs/git-lfs/v3/locking/api.go:368 +0x4c github.com/git-lfs/git-lfs/v3/locking.(*Client).SearchLocksVerifiable(0xc00040a280, 0x0, 0x0) github.com/git-lfs/git-lfs/v3/locking/locks.go:273 +0x412 github.com/git-lfs/git-lfs/v3/commands.(*lockVerifier).Verify(0xc0000cbb80, 0xc0002fc330) github.com/git-lfs/git-lfs/v3/commands/lockverifier.go:60 +0xbe github.com/git-lfs/git-lfs/v3/commands.verifyLocksForUpdates(0xc0002960c0?, {0xc000098188, 0x1, 0xc000123c10?}) github.com/git-lfs/git-lfs/v3/commands/lockverifier.go:28 +0x34 github.com/git-lfs/git-lfs/v3/commands.uploadForRefUpdates(0xc0002960c0, {0xc000098188?, 0x1, 0x1}, 0x0?) github.com/git-lfs/git-lfs/v3/commands/uploader.go:27 +0xde github.com/git-lfs/git-lfs/v3/commands.prePushCommand(0xc0000c6f00?, {0xc00009c3c0, 0x2, 0x2?}) github.com/git-lfs/git-lfs/v3/commands/command_pre_push.go:62 +0x1df github.com/spf13/cobra.(*Command).execute(0xc0000c6f00, {0xc00009c360, 0x2, 0x2}) github.com/spf13/[email protected]/command.go:920 +0x847 github.com/spf13/cobra.(*Command).ExecuteC(0xc000004c00) github.com/spf13/[email protected]/command.go:1040 +0x3bd github.com/spf13/cobra.(*Command).Execute(...) github.com/spf13/[email protected]/command.go:968 github.com/git-lfs/git-lfs/v3/commands.Run() github.com/git-lfs/git-lfs/v3/commands/run.go:154 +0x4ad main.main() github.com/git-lfs/git-lfs/v3/git-lfs.go:34 +0xe5 error: failed to push some refs to 'http://tfs.nordic-it.ru:8081/VR_Collection/REALPROP/_git/RPROP' ```</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
AgentCourse - Agent not responding
https://discuss.huggingface.co/t/agentcourse-agent-not-responding/149557
149,557
20
2025-04-09T08:27:58.474000Z
[ { "id": 214372, "name": "Shankar GS", "username": "sgs0101", "avatar_template": "/user_avatar/discuss.huggingface.co/sgs0101/{size}/45023_2.png", "created_at": "2025-04-09T08:27:58.551Z", "cooked": "<p>For the Agent course, I have updated the app.py with the tool decorators and the build is completed and status show as running, without any errors.</p>\n<p>But the agent is not responding at all - tried with the alternate model link provided but that also is not giving any response.</p>\n<p>Would greatly appreciate any help to get this resolved &amp; agent to work.</p>\n<p>My space: sgs0101/First_agent_template</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-09T08:27:58.551Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 110, "reads": 26, "readers_count": 25, "score": 565.2, "yours": false, "topic_id": 149557, "topic_slug": "agentcourse-agent-not-responding", "display_username": "Shankar GS", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89859, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/agentcourse-agent-not-responding/149557/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214400, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-09T10:58:27.241Z", "cooked": "<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/spaces/sgs0101/First_agent_template/discussions/1\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/spaces/sgs0101/First_agent_template/discussions/1\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/6/a6b558811e5deb0fcc1f559f7457190db87c6dce_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"EEF2F0\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/spaces/sgs0101/First_agent_template/discussions/1\" target=\"_blank\" rel=\"noopener\">sgs0101/First_agent_template · Update requirements.txt</a></h3>\n\n <p>First aid.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<p>\nI think this will fix it for now. It’s the same error as below.</p><aside class=\"quote\" data-post=\"1\" data-topic=\"148170\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://avatars.discourse-cdn.com/v4/letter/a/a8b319/48.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/agent-course-first-agent-template/148170\">Agent Course - First Agent Template</a> <a class=\"badge-category__wrapper \" href=\"/c/beginners/5\"><span data-category-id=\"5\" style=\"--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category for any basic question you have on any of the Hugging Face library. Don’t moderate yourself, everyone has to begin somewhere and everyone on this forum is here to help!\"><span class=\"badge-category__name\">Beginners</span></span></a>\n </div>\n <blockquote>\n After duplicating the space <a href=\"https://huggingface.co/spaces/agents-course/First_agent_template\" class=\"inline-onebox\">First Agent Template - a Hugging Face Space by agents-course</a>, \nI get this blocking exception at startup: \nFile “/usr/local/lib/python3.10/site-packages/gradio_client/utils.py”, line 898, in get_type \nif “const” in schema: \nTypeError: argument of type ‘bool’ is not iterable \nDo you have any idea what might be causing this error during startup?\n </blockquote>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-09T10:58:27.241Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 5, "reads": 25, "readers_count": 24, "score": 50, "yours": false, "topic_id": 149557, "topic_slug": "agentcourse-agent-not-responding", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/spaces/sgs0101/First_agent_template/discussions/1", "internal": false, "reflection": false, "title": null, "clicks": 27 }, { "url": "https://discuss.huggingface.co/t/agent-course-first-agent-template/148170", "internal": true, "reflection": false, "title": "Agent Course - First Agent Template", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/agentcourse-agent-not-responding/149557/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214490, "name": "Shankar GS", "username": "sgs0101", "avatar_template": "/user_avatar/discuss.huggingface.co/sgs0101/{size}/45023_2.png", "created_at": "2025-04-09T16:27:37.244Z", "cooked": "<p>Thank you - Much appreciated</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-09T16:27:37.244Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 22, "readers_count": 21, "score": 19.4, "yours": false, "topic_id": 149557, "topic_slug": "agentcourse-agent-not-responding", "display_username": "Shankar GS", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89859, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/agentcourse-agent-not-responding/149557/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 214583, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-10T04:28:09.110Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-10T04:28:09.110Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 17, "readers_count": 16, "score": 13.4, "yours": false, "topic_id": 149557, "topic_slug": "agentcourse-agent-not-responding", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/agentcourse-agent-not-responding/149557/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>For the Agent course, I have updated the app.py with the tool decorators and the build is completed and status show as running, without any errors.</p> <p>But the agent is not responding at all - tried with the alternate model link provided but that also is not giving any response.</p> <p>Would greatly appreciate any help to get this resolved &amp; agent to work.</p> <p>My space: sgs0101/First_agent_template</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/spaces/sgs0101/First_agent_template/discussions/1"> <header class="source"> <a href="https://huggingface.co/spaces/sgs0101/First_agent_template/discussions/1" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/6/a6b558811e5deb0fcc1f559f7457190db87c6dce_2_690x372.png" class="thumbnail" data-dominant-color="EEF2F0" width="690" height="372"></div> <h3><a href="https://huggingface.co/spaces/sgs0101/First_agent_template/discussions/1" target="_blank" rel="noopener">sgs0101/First_agent_template · Update requirements.txt</a></h3> <p>First aid.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <p> I think this will fix it for now. It’s the same error as below.</p><aside class="quote" data-post="1" data-topic="148170"> <div class="title"> <div class="quote-controls"></div> <img alt="" width="24" height="24" src="https://avatars.discourse-cdn.com/v4/letter/a/a8b319/48.png" class="avatar"> <a href="https://discuss.huggingface.co/t/agent-course-first-agent-template/148170">Agent Course - First Agent Template</a> <a class="badge-category__wrapper " href="/c/beginners/5"><span data-category-id="5" style="--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;" data-drop-close="true" class="badge-category " title="Use this category for any basic question you have on any of the Hugging Face library. Don’t moderate yourself, everyone has to begin somewhere and everyone on this forum is here to help!"><span class="badge-category__name">Beginners</span></span></a> </div> <blockquote> After duplicating the space <a href="https://huggingface.co/spaces/agents-course/First_agent_template" class="inline-onebox">First Agent Template - a Hugging Face Space by agents-course</a>, I get this blocking exception at startup: File “/usr/local/lib/python3.10/site-packages/gradio_client/utils.py”, line 898, in get_type if “const” in schema: TypeError: argument of type ‘bool’ is not iterable Do you have any idea what might be causing this error during startup? </blockquote> </aside>
403 error on login
https://discuss.huggingface.co/t/403-error-on-login/149631
149,631
23
2025-04-09T15:00:13.574000Z
[ { "id": 214464, "name": "Szymon Kułach", "username": "skmq", "avatar_template": "/user_avatar/discuss.huggingface.co/skmq/{size}/45161_2.png", "created_at": "2025-04-09T15:00:13.634Z", "cooked": "<p>Hello,</p>\n<p>today I received 403 errors on creating tokens or logout. I cleared site data in my browser and now I cannot login to the hub. Sending the full error below. Can someone help me out please?</p>\n<h1><a name=\"p-214464-h-403-error-1\" class=\"anchor\" href=\"#p-214464-h-403-error-1\"></a>403 ERROR</h1>\n<h2><a name=\"p-214464-the-request-could-not-be-satisfied-2\" class=\"anchor\" href=\"#p-214464-the-request-could-not-be-satisfied-2\"></a>The request could not be satisfied.</h2>\n<hr>\n<p>This distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests. We can’t connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.<br>\nIf you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.</p>\n<hr>\n<p>Generated by cloudfront (CloudFront) Request ID: I04OK2h9bX5Vgp8UTeprsC82N8vsUfbEDhM_wd45TEen5Bwiy0xr8A==</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2025-04-09T15:00:13.634Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 195, "reads": 8, "readers_count": 7, "score": 941.4, "yours": false, "topic_id": 149631, "topic_slug": "403-error-on-login", "display_username": "Szymon Kułach", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90089, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/403-error-on-login/149631/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214466, "name": "Szymon Kułach", "username": "skmq", "avatar_template": "/user_avatar/discuss.huggingface.co/skmq/{size}/45161_2.png", "created_at": "2025-04-09T15:04:36.470Z", "cooked": "<p>I also asked for help via <a href=\"mailto:[email protected]\">[email protected]</a></p>", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2025-04-09T15:04:36.470Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 16.4, "yours": false, "topic_id": 149631, "topic_slug": "403-error-on-login", "display_username": "Szymon Kułach", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90089, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/403-error-on-login/149631/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214471, "name": "Szymon Kułach", "username": "skmq", "avatar_template": "/user_avatar/discuss.huggingface.co/skmq/{size}/45161_2.png", "created_at": "2025-04-09T15:17:06.988Z", "cooked": "<p>Not sure if it’s coincidence or not but I successfully logged my phone and now everything works on the desktop.</p>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2025-04-09T15:17:06.988Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 7, "readers_count": 6, "score": 21.2, "yours": false, "topic_id": 149631, "topic_slug": "403-error-on-login", "display_username": "Szymon Kułach", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 90089, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/403-error-on-login/149631/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214484, "name": "Han Yoon", "username": "LPX55", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/l/a8b319/{size}.png", "created_at": "2025-04-09T16:00:01.447Z", "cooked": "<p>Was having the same issue on a paid plan, pretty sure it was just a temporary issue with the infra. Everything looking good to me now as well.</p>", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-04-09T16:00:01.447Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 6, "readers_count": 5, "score": 31, "yours": false, "topic_id": 149631, "topic_slug": "403-error-on-login", "display_username": "Han Yoon", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89772, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/403-error-on-login/149631/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214573, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-10T04:00:11.431Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-04-10T04:00:11.431Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 5, "readers_count": 4, "score": 15.8, "yours": false, "topic_id": 149631, "topic_slug": "403-error-on-login", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/403-error-on-login/149631/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello,</p> <p>today I received 403 errors on creating tokens or logout. I cleared site data in my browser and now I cannot login to the hub. Sending the full error below. Can someone help me out please?</p> <h1><a name="p-214464-h-403-error-1" class="anchor" href="#p-214464-h-403-error-1"></a>403 ERROR</h1> <h2><a name="p-214464-the-request-could-not-be-satisfied-2" class="anchor" href="#p-214464-the-request-could-not-be-satisfied-2"></a>The request could not be satisfied.</h2> <hr> <p>This distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests. We can’t connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.<br> If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.</p> <hr> <p>Generated by cloudfront (CloudFront) Request ID: I04OK2h9bX5Vgp8UTeprsC82N8vsUfbEDhM_wd45TEen5Bwiy0xr8A==</p>
<p>Not sure if it’s coincidence or not but I successfully logged my phone and now everything works on the desktop.</p>
Scalar Reward Model
https://discuss.huggingface.co/t/scalar-reward-model/149347
149,347
9
2025-04-07T22:40:13.526000Z
[ { "id": 214067, "name": "BenWang", "username": "BenatCambridge", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/b/e19adc/{size}.png", "created_at": "2025-04-07T22:40:13.587Z", "cooked": "<p>I have a generic question about reward model training for LLMs. I have an application scenario where (1) my input is natural language text and reward function is defined by scalar scores 0, 1, 2 etc. For this reason, it seems like in order to train my reward model I should use the TextClassification interface. However, (2) my input also has a “context-response” structure, and the scalar scores correspond to how well the response is wrt the context.</p>\n<p>My question: Is TextClassification the best interface I can use? Ideally, I would like to train the reward model to predict the score for the response given the context, so perhaps I am looking for a conditional reward model if that exists?</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-07T22:40:13.587Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 36, "reads": 3, "readers_count": 2, "score": 195.6, "yours": false, "topic_id": 149347, "topic_slug": "scalar-reward-model", "display_username": "BenWang", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89093, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/scalar-reward-model/149347/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214136, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-08T07:34:06.340Z", "cooked": "<p>It looks like TextClassification with RLHF is fine.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/rlhf\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/rlhf\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/345;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/0/203668c3db9a5743295c8a99728457c3b53d2901_2_690x345.png\" class=\"thumbnail\" data-dominant-color=\"D3BBC9\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://huggingface.co/blog/rlhf\" target=\"_blank\" rel=\"noopener\">Illustrating Reinforcement Learning from Human Feedback (RLHF)</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/GitBag/rebel\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/GitBag/rebel\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/7/0707fcfae536b7d43128f36332cbe28519e0fd39_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F7F7F6\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/blog/GitBag/rebel\" target=\"_blank\" rel=\"noopener\">RLHF 101: A Technical Dive into RLHF</a></h3>\n\n <p>A Blog post by Zhaolin Gao on Hugging Face</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://sudhirpol522.medium.com/reward-model-training-6d1693e41962\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/f/0f95de5840ff0771b84ea77cfa42a1e98b4f1614.png\" class=\"site-icon\" data-dominant-color=\"3B3B3B\" width=\"32\" height=\"32\">\n\n <a href=\"https://sudhirpol522.medium.com/reward-model-training-6d1693e41962\" target=\"_blank\" rel=\"noopener\" title=\"01:24PM - 11 December 2023\">Medium – 11 Dec 23</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/348;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/3/f39e05c29d47ad2e1e1b07213a634a9fe5ea10d1_2_690x348.png\" class=\"thumbnail\" data-dominant-color=\"F3F4F4\" width=\"690\" height=\"348\"></div>\n\n<h3><a href=\"https://sudhirpol522.medium.com/reward-model-training-6d1693e41962\" target=\"_blank\" rel=\"noopener\">Reward Model Training</a></h3>\n\n <p>Human feedback is used to create reward models or signals for the learning agent.</p>\n\n <p>\n <span class=\"label1\">Reading time: 6 min read</span>\n </p>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/trl/main/en/ppo_trainer\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/trl/main/en/ppo_trainer\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/6/06efed2b1b784c42c480f9fb86a9ce8e832a0dcd_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"FAF8F3\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/trl/main/en/ppo_trainer\" target=\"_blank\" rel=\"noopener\">PPO Trainer</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-08T07:34:27.225Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 3, "readers_count": 2, "score": 5.6, "yours": false, "topic_id": 149347, "topic_slug": "scalar-reward-model", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://sudhirpol522.medium.com/reward-model-training-6d1693e41962", "internal": false, "reflection": false, "title": "Reward Model Training. Human feedback is used to create reward… | by Sudhir Pol | Medium", "clicks": 3 }, { "url": "https://huggingface.co/blog/rlhf", "internal": false, "reflection": false, "title": "Illustrating Reinforcement Learning from Human Feedback (RLHF)", "clicks": 1 }, { "url": "https://huggingface.co/docs/trl/main/en/ppo_trainer", "internal": false, "reflection": false, "title": "PPO Trainer", "clicks": 1 }, { "url": "https://huggingface.co/blog/GitBag/rebel", "internal": false, "reflection": false, "title": "RLHF 101: A Technical Dive into RLHF", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/scalar-reward-model/149347/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214525, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-09T21:56:41.648Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-09T21:56:41.648Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 149347, "topic_slug": "scalar-reward-model", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/scalar-reward-model/149347/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I have a generic question about reward model training for LLMs. I have an application scenario where (1) my input is natural language text and reward function is defined by scalar scores 0, 1, 2 etc. For this reason, it seems like in order to train my reward model I should use the TextClassification interface. However, (2) my input also has a “context-response” structure, and the scalar scores correspond to how well the response is wrt the context.</p> <p>My question: Is TextClassification the best interface I can use? Ideally, I would like to train the reward model to predict the score for the response given the context, so perhaps I am looking for a conditional reward model if that exists?</p>
<p>It looks like TextClassification with RLHF is fine.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/blog/rlhf"> <header class="source"> <a href="https://huggingface.co/blog/rlhf" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/345;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/0/203668c3db9a5743295c8a99728457c3b53d2901_2_690x345.png" class="thumbnail" data-dominant-color="D3BBC9" width="690" height="345"></div> <h3><a href="https://huggingface.co/blog/rlhf" target="_blank" rel="noopener">Illustrating Reinforcement Learning from Human Feedback (RLHF)</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/blog/GitBag/rebel"> <header class="source"> <a href="https://huggingface.co/blog/GitBag/rebel" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/7/0707fcfae536b7d43128f36332cbe28519e0fd39_2_690x372.png" class="thumbnail" data-dominant-color="F7F7F6" width="690" height="372"></div> <h3><a href="https://huggingface.co/blog/GitBag/rebel" target="_blank" rel="noopener">RLHF 101: A Technical Dive into RLHF</a></h3> <p>A Blog post by Zhaolin Gao on Hugging Face</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://sudhirpol522.medium.com/reward-model-training-6d1693e41962"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/0/f/0f95de5840ff0771b84ea77cfa42a1e98b4f1614.png" class="site-icon" data-dominant-color="3B3B3B" width="32" height="32"> <a href="https://sudhirpol522.medium.com/reward-model-training-6d1693e41962" target="_blank" rel="noopener" title="01:24PM - 11 December 2023">Medium – 11 Dec 23</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/348;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/3/f39e05c29d47ad2e1e1b07213a634a9fe5ea10d1_2_690x348.png" class="thumbnail" data-dominant-color="F3F4F4" width="690" height="348"></div> <h3><a href="https://sudhirpol522.medium.com/reward-model-training-6d1693e41962" target="_blank" rel="noopener">Reward Model Training</a></h3> <p>Human feedback is used to create reward models or signals for the learning agent.</p> <p> <span class="label1">Reading time: 6 min read</span> </p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/trl/main/en/ppo_trainer"> <header class="source"> <a href="https://huggingface.co/docs/trl/main/en/ppo_trainer" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/6/06efed2b1b784c42c480f9fb86a9ce8e832a0dcd_2_690x372.png" class="thumbnail" data-dominant-color="FAF8F3" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/trl/main/en/ppo_trainer" target="_blank" rel="noopener">PPO Trainer</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Unable to Access Gated Model meta-llama/Llama-3.2-1B Despite Approved Access
https://discuss.huggingface.co/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782
148,782
13
2025-04-04T01:21:56.747000Z
[ { "id": 213288, "name": "Latifur", "username": "zihad100123", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/z/e95f7d/{size}.png", "created_at": "2025-04-04T01:21:56.814Z", "cooked": "<p><strong>Hi Hugging Face Support Team,</strong></p>\n<p>I hope this message finds you well. I’m encountering an issue while trying to access the gated model <code>meta-llama/Llama-3.2-1B</code>. Despite having my access request approved, I am still receiving a <code>403 Forbidden</code> error when attempting to download the model.</p>\n<hr>\n<h4><a name=\"p-213288-details-of-the-issue-1\" class=\"anchor\" href=\"#p-213288-details-of-the-issue-1\"></a><strong>Details of the Issue:</strong></h4>\n<ol>\n<li>\n<p><strong>Model Name:</strong><br>\n<code>meta-llama/Llama-3.2-1B</code></p>\n</li>\n<li>\n<p><strong>Error Message:</strong></p>\n<pre><code class=\"lang-auto\">HTTPError: 403 Client Error: Forbidden for url: https://huggingface.co/meta-llama/Llama-3.2-1B/resolve/main/config.json\n</code></pre>\n<p>The full traceback includes:</p>\n<pre><code class=\"lang-auto\">OSError: You are trying to access a gated repo. Make sure to have access to it at https://huggingface.co/meta-llama/Llama-3.2-1B.\n403 Client Error. (Request ID: Root=1-67ef2363-42b58be57736a28811717ca5;f127327b-3d0a-4879-9332-7afaec78ec7d)\n</code></pre>\n</li>\n<li>\n<p><strong>Environment:</strong></p>\n<ul>\n<li><strong>Platform:</strong> Google Colab (Free Tier)</li>\n<li><strong>Libraries Installed:</strong>\n<ul>\n<li><code>transformers</code>: Latest version (<code>pip install -U transformers</code>)</li>\n<li><code>huggingface_hub</code>: Latest version (<code>pip install -U huggingface_hub</code>)</li>\n</ul>\n</li>\n<li><strong>Authentication Method:</strong>\n<ul>\n<li>Logged in via <code>huggingface-cli login</code> and also tried passing the token explicitly in the code.</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>\n<p><strong>Steps Taken So Far:</strong></p>\n<ul>\n<li>Verified that my access was granted on the model page: <a href=\"https://huggingface.co/meta-llama/Llama-3.2-1B\">meta-llama/Llama-3.2-1B</a>.</li>\n<li>Generated a new Hugging Face token and used it in my script.</li>\n<li>Cleared the cache directory (<code>~/.cache/huggingface/</code>) to ensure no corrupted files were causing the issue.</li>\n<li>Tested with a public model (<code>bert-base-uncased</code>) to confirm my setup works correctly.</li>\n</ul>\n</li>\n<li>\n<p><strong>Code Used:</strong></p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">from transformers import AutoTokenizer\n\ntokenizer = AutoTokenizer.from_pretrained(\n 'meta-llama/Llama-3.2-1B',\n trust_remote_code=True,\n token=\"my_huggingface_token_here\"\n)\n</code></pre>\n</li>\n<li>\n<p><strong>Expected Behavior:</strong><br>\nThe model files should download successfully since my access has been approved.</p>\n</li>\n<li>\n<p><strong>Actual Behavior:</strong><br>\nThe process fails with a <code>403 Forbidden</code> error, indicating I do not have access to the repository.</p>\n</li>\n</ol>\n<hr>\n<h4><a name=\"p-213288-additional-information-2\" class=\"anchor\" href=\"#p-213288-additional-information-2\"></a><strong>Additional Information:</strong></h4>\n<ul>\n<li><strong>Hugging Face Username:</strong> <code>zihad100123</code></li>\n<li><strong>Request ID from Error Message:</strong><pre><code class=\"lang-auto\">Request ID: Root=1-67ef2363-42b58be57736a28811717ca5;f127327b-3d0a-4879-9332-7afaec78ec7d\n</code></pre>\n</li>\n</ul>\n<hr>\n<h4><a name=\"p-213288-request-for-assistance-3\" class=\"anchor\" href=\"#p-213288-request-for-assistance-3\"></a><strong>Request for Assistance:</strong></h4>\n<p>Could you please verify the following?</p>\n<ol>\n<li>Whether my access to <code>meta-llama/Llama-3.2-1B</code> has been fully granted.</li>\n<li>If there are any additional steps I need to take to authenticate or access the model.</li>\n<li>Whether there are any known issues with accessing this model in a Google Colab environment.</li>\n</ol>\n<p>Any guidance or clarification would be greatly appreciated. Please let me know if you need further details from my side.</p>\n<p>Thank you for your time and support!</p>\n<p>Best regards,<br>\nLatifur Rahman Zihad<br>\nHugging Face Username: <code>zihad100123</code><br>\nEmail: <a href=\"mailto:[email protected]\">[email protected]</a></p>", "post_number": 1, "post_type": 1, "posts_count": 11, "updated_at": "2025-04-04T01:24:46.489Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 573, "reads": 28, "readers_count": 27, "score": 2785.6, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "Latifur", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/meta-llama/Llama-3.2-1B", "internal": false, "reflection": false, "title": "meta-llama/Llama-3.2-1B · Hugging Face", "clicks": 3 }, { "url": "https://discuss.huggingface.co/t/python-says-locked-or-gated-repository-when-trying-to-tether-huggingface-llama-model/168306/2", "internal": true, "reflection": true, "title": "Python says [locked or gated repository] when trying to tether HuggingFace LLAMA Model", "clicks": 1 }, { "url": "https://discuss.huggingface.co/t/mistralai-mistral-7b-v0-1-is-not-a-local-folder-and-is-not-a-valid-model-identifier-listed-on-https-huggingface-co-models/103558/4", "internal": true, "reflection": true, "title": "mistralai/Mistral-7B-v0.1 is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89450, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213292, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-04T02:02:19.899Z", "cooked": "<p>Possibly this case?</p><aside class=\"quote\" data-post=\"3\" data-topic=\"147746\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/meganariley/48/20596_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/got-access-acceptance-for-the-wrong-llama-model/147746/3\">Got access acceptance for the wrong llama model</a> <a class=\"badge-category__wrapper \" href=\"/c/beginners/5\"><span data-category-id=\"5\" style=\"--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category for any basic question you have on any of the Hugging Face library. Don’t moderate yourself, everyone has to begin somewhere and everyone on this forum is here to help!\"><span class=\"badge-category__name\">Beginners</span></span></a>\n </div>\n <blockquote>\n Hi <a class=\"mention\" href=\"/u/fenghao999\">@fenghao999</a> You can head to your gated models in your settings here: <a href=\"https://huggingface.co/settings/gated-repos\" class=\"inline-onebox\">Hugging Face – The AI community building the future.</a>. You were given access to Meta’s Llama2 models which include meta-llama/Llama-2-13b - you can click on that link to access the collection.\n </blockquote>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 11, "updated_at": "2025-04-04T02:02:19.899Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 21, "readers_count": 20, "score": 14.2, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/got-access-acceptance-for-the-wrong-llama-model/147746/3", "internal": true, "reflection": false, "title": "Got access acceptance for the wrong llama model", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213298, "name": "Latifur", "username": "zihad100123", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/z/e95f7d/{size}.png", "created_at": "2025-04-04T03:19:19.108Z", "cooked": "<p>May be not that case.<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/5/6/56026d894962043612a7f54cfbfe615c6bbe57fd.png\" data-download-href=\"/uploads/short-url/cgSgnqw01znSj6cZqNaIdydMAJT.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/6/56026d894962043612a7f54cfbfe615c6bbe57fd_2_690x166.png\" alt=\"image\" data-base62-sha1=\"cgSgnqw01znSj6cZqNaIdydMAJT\" width=\"690\" height=\"166\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/6/56026d894962043612a7f54cfbfe615c6bbe57fd_2_690x166.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/6/56026d894962043612a7f54cfbfe615c6bbe57fd_2_1035x249.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/5/6/56026d894962043612a7f54cfbfe615c6bbe57fd.png 2x\" data-dominant-color=\"121822\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">1280×309 37.4 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div><br>\nAs the picture shows in gated grouped collections model,It shows I got access but whenever I try it on colab it failed and showing above error messages.</p>", "post_number": 3, "post_type": 1, "posts_count": 11, "updated_at": "2025-04-04T03:19:19.108Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 4, "reads": 20, "readers_count": 19, "score": 39, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "Latifur", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89450, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 213310, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-04T05:29:24.353Z", "cooked": "<p>Hmm… Known Colab issue is this one.</p><aside class=\"quote quote-modified\" data-post=\"31\" data-topic=\"12983\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jqf/48/25333_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/error-403-what-to-do-about-it/12983/31\">Error 403! What to do about it?</a> <a class=\"badge-category__wrapper \" href=\"/c/beginners/5\"><span data-category-id=\"5\" style=\"--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category for any basic question you have on any of the Hugging Face library. Don’t moderate yourself, everyone has to begin somewhere and everyone on this forum is here to help!\"><span class=\"badge-category__name\">Beginners</span></span></a>\n </div>\n <blockquote>\n The only way I found around it in Colab was to \n(I) disable Notebook Access for any and all keys (the key shaped menu item on the left side of the Colab UI) \n(Ii) Go to Runtime &gt; Disconnect and delete runtime \n(Iii) Reconnect to a new runtime \n(Iv) Replace any huggingfae-cli logins with : \nfrom huggingface_hub import notebook_login \nnotebook_login() \n(v) Enter your ‘write’ token when prompted \nBasically, colab seems to cache any prior “read” tokens in a very persistent way that doesn’t get overw…\n </blockquote>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 11, "updated_at": "2025-04-04T05:29:24.353Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 17, "readers_count": 16, "score": 8.4, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/error-403-what-to-do-about-it/12983/31", "internal": true, "reflection": false, "title": "Error 403! What to do about it?", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213529, "name": "Alejandro Arroyo de Anda", "username": "aaac12345", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/a/82dd89/{size}.png", "created_at": "2025-04-05T07:42:57.946Z", "cooked": "<p>It is not really free</p>", "post_number": 5, "post_type": 1, "posts_count": 11, "updated_at": "2025-04-05T07:42:57.946Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 5, "reads": 15, "readers_count": 14, "score": 43, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "Alejandro Arroyo de Anda", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89347, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213549, "name": "Abiodun Enoch SHITTU", "username": "I00N", "avatar_template": "/user_avatar/discuss.huggingface.co/i00n/{size}/43536_2.png", "created_at": "2025-04-05T10:30:19.030Z", "cooked": "<p>Try using this code. It works on Google colab for me:</p>\n<pre><code class=\"lang-auto\">from huggingface_hub import login\n\n#your access token with read access \nhf_token = \"\"\nlogin(token= hf_token)\n\n#HF repo ID\nrepo_ID = \"meta-llama/Llama-3.2-1B\"\n\nfrom transformers import AutoTokenizer\n\ntokenizer = AutoTokenizer.from_pretrained(\n repo_id,\n trust_remote_code=True,\n )\n\n#the rest of your code \n</code></pre>\n<p>Be sure your access token has read access or, it is a read token.</p>", "post_number": 6, "post_type": 1, "posts_count": 11, "updated_at": "2025-04-05T10:33:37.179Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 15, "readers_count": 14, "score": 33, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "Abiodun Enoch SHITTU", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87591, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213620, "name": "Latifur", "username": "zihad100123", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/z/e95f7d/{size}.png", "created_at": "2025-04-05T18:56:00.611Z", "cooked": "<p>my token is fine-grained .should I use a read token??</p>", "post_number": 7, "post_type": 1, "posts_count": 11, "updated_at": "2025-04-05T18:56:00.611Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 1, "reads": 13, "readers_count": 12, "score": 22.6, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "Latifur", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89450, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/7", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 87591, "username": "I00N", "name": "Abiodun Enoch SHITTU", "avatar_template": "/user_avatar/discuss.huggingface.co/i00n/{size}/43536_2.png" }, "action_code": null, "via_email": null }, { "id": 213655, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-06T00:47:17.545Z", "cooked": "<p>Fine-grained is safer if you set it up properly, but it’s a hassle, so I usually use Read tokens.</p>", "post_number": 8, "post_type": 1, "posts_count": 11, "updated_at": "2025-04-06T00:47:17.545Z", "reply_count": 2, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 13, "readers_count": 12, "score": 12.6, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/8", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214274, "name": "Latifur", "username": "zihad100123", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/z/e95f7d/{size}.png", "created_at": "2025-04-08T17:35:21.616Z", "cooked": "<p>I tried every types of tokens but not working</p>", "post_number": 9, "post_type": 1, "posts_count": 11, "updated_at": "2025-04-08T17:35:21.616Z", "reply_count": 0, "reply_to_post_number": 8, "quote_count": 0, "incoming_link_count": 0, "reads": 11, "readers_count": 10, "score": 17.2, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "Latifur", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89450, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/9", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 214283, "name": "Latifur", "username": "zihad100123", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/z/e95f7d/{size}.png", "created_at": "2025-04-08T18:13:09.619Z", "cooked": "<p>Alhamdulillah, I figured out the problem. I had not given access to the contents of all the public gated repositories that I have access to.<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/a/f/af7da35e14ab93304ecd491a9d2e394e08ff561f.png\" data-download-href=\"/uploads/short-url/p2sJCxxYEAhOfUdKoivklCRrHLp.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/f/af7da35e14ab93304ecd491a9d2e394e08ff561f_2_690x352.png\" alt=\"image\" data-base62-sha1=\"p2sJCxxYEAhOfUdKoivklCRrHLp\" width=\"690\" height=\"352\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/f/af7da35e14ab93304ecd491a9d2e394e08ff561f_2_690x352.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/f/af7da35e14ab93304ecd491a9d2e394e08ff561f_2_1035x528.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/a/f/af7da35e14ab93304ecd491a9d2e394e08ff561f.png 2x\" data-dominant-color=\"111620\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">1296×663 56.9 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>now the problem is solved.</p>", "post_number": 10, "post_type": 1, "posts_count": 11, "updated_at": "2025-04-08T18:13:09.619Z", "reply_count": 0, "reply_to_post_number": 8, "quote_count": 0, "incoming_link_count": 2, "reads": 12, "readers_count": 11, "score": 42.4, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "Latifur", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89450, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/10", "reactions": [ { "id": "confetti_ball", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 214350, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-09T06:13:22.330Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 11, "post_type": 3, "posts_count": 11, "updated_at": "2025-04-09T06:13:22.330Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 10, "readers_count": 9, "score": 7, "yours": false, "topic_id": 148782, "topic_slug": "unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/11", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p><strong>Hi Hugging Face Support Team,</strong></p> <p>I hope this message finds you well. I’m encountering an issue while trying to access the gated model <code>meta-llama/Llama-3.2-1B</code>. Despite having my access request approved, I am still receiving a <code>403 Forbidden</code> error when attempting to download the model.</p> <hr> <h4><a name="p-213288-details-of-the-issue-1" class="anchor" href="#p-213288-details-of-the-issue-1"></a><strong>Details of the Issue:</strong></h4> <ol> <li> <p><strong>Model Name:</strong><br> <code>meta-llama/Llama-3.2-1B</code></p> </li> <li> <p><strong>Error Message:</strong></p> <pre><code class="lang-auto">HTTPError: 403 Client Error: Forbidden for url: https://huggingface.co/meta-llama/Llama-3.2-1B/resolve/main/config.json </code></pre> <p>The full traceback includes:</p> <pre><code class="lang-auto">OSError: You are trying to access a gated repo. Make sure to have access to it at https://huggingface.co/meta-llama/Llama-3.2-1B. 403 Client Error. (Request ID: Root=1-67ef2363-42b58be57736a28811717ca5;f127327b-3d0a-4879-9332-7afaec78ec7d) </code></pre> </li> <li> <p><strong>Environment:</strong></p> <ul> <li><strong>Platform:</strong> Google Colab (Free Tier)</li> <li><strong>Libraries Installed:</strong> <ul> <li><code>transformers</code>: Latest version (<code>pip install -U transformers</code>)</li> <li><code>huggingface_hub</code>: Latest version (<code>pip install -U huggingface_hub</code>)</li> </ul> </li> <li><strong>Authentication Method:</strong> <ul> <li>Logged in via <code>huggingface-cli login</code> and also tried passing the token explicitly in the code.</li> </ul> </li> </ul> </li> <li> <p><strong>Steps Taken So Far:</strong></p> <ul> <li>Verified that my access was granted on the model page: <a href="https://huggingface.co/meta-llama/Llama-3.2-1B">meta-llama/Llama-3.2-1B</a>.</li> <li>Generated a new Hugging Face token and used it in my script.</li> <li>Cleared the cache directory (<code>~/.cache/huggingface/</code>) to ensure no corrupted files were causing the issue.</li> <li>Tested with a public model (<code>bert-base-uncased</code>) to confirm my setup works correctly.</li> </ul> </li> <li> <p><strong>Code Used:</strong></p> <pre data-code-wrap="python"><code class="lang-python">from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained( 'meta-llama/Llama-3.2-1B', trust_remote_code=True, token="my_huggingface_token_here" ) </code></pre> </li> <li> <p><strong>Expected Behavior:</strong><br> The model files should download successfully since my access has been approved.</p> </li> <li> <p><strong>Actual Behavior:</strong><br> The process fails with a <code>403 Forbidden</code> error, indicating I do not have access to the repository.</p> </li> </ol> <hr> <h4><a name="p-213288-additional-information-2" class="anchor" href="#p-213288-additional-information-2"></a><strong>Additional Information:</strong></h4> <ul> <li><strong>Hugging Face Username:</strong> <code>zihad100123</code></li> <li><strong>Request ID from Error Message:</strong><pre><code class="lang-auto">Request ID: Root=1-67ef2363-42b58be57736a28811717ca5;f127327b-3d0a-4879-9332-7afaec78ec7d </code></pre> </li> </ul> <hr> <h4><a name="p-213288-request-for-assistance-3" class="anchor" href="#p-213288-request-for-assistance-3"></a><strong>Request for Assistance:</strong></h4> <p>Could you please verify the following?</p> <ol> <li>Whether my access to <code>meta-llama/Llama-3.2-1B</code> has been fully granted.</li> <li>If there are any additional steps I need to take to authenticate or access the model.</li> <li>Whether there are any known issues with accessing this model in a Google Colab environment.</li> </ol> <p>Any guidance or clarification would be greatly appreciated. Please let me know if you need further details from my side.</p> <p>Thank you for your time and support!</p> <p>Best regards,<br> Latifur Rahman Zihad<br> Hugging Face Username: <code>zihad100123</code><br> Email: <a href="mailto:[email protected]">[email protected]</a></p>
<p>Fine-grained is safer if you set it up properly, but it’s a hassle, so I usually use Read tokens.</p>
Can&rsquo;t view or copy access token
https://discuss.huggingface.co/t/cant-view-or-copy-access-token/149346
149,346
5
2025-04-07T22:30:19.564000Z
[ { "id": 214066, "name": "Gb", "username": "tcltcl", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/t/439d5e/{size}.png", "created_at": "2025-04-07T22:30:19.618Z", "cooked": "<p>When I go to the access tokens page, under Value for the token, it just has the first and last few characters, with … in between. I don’t see a way to expand or copy it. Any ideas how to copy it? Do they need to be invalidated and refreshed everytime?</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-08T00:54:56.988Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 889, "reads": 18, "readers_count": 17, "score": 4248.4, "yours": false, "topic_id": 149346, "topic_slug": "cant-view-or-copy-access-token", "display_username": "Gb", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89864, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/cant-view-or-copy-access-token/149346/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214081, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-08T01:51:09.802Z", "cooked": "<blockquote>\n<p>Do they need to be invalidated and refreshed everytime?</p>\n</blockquote>\n<p>That’s what I do.<br>\nYou can make as many tokens as you like, so if you don’t want to change the existing ones, you can just make new ones…</p>\n<p>Or you could keep them somewhere local.</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-08T01:51:09.802Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 6, "reads": 18, "readers_count": 17, "score": 33.4, "yours": false, "topic_id": 149346, "topic_slug": "cant-view-or-copy-access-token", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/cant-view-or-copy-access-token/149346/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214211, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-08T13:51:11.247Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-08T13:51:11.247Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 6, "reads": 15, "readers_count": 14, "score": 32.8, "yours": false, "topic_id": 149346, "topic_slug": "cant-view-or-copy-access-token", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/cant-view-or-copy-access-token/149346/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>When I go to the access tokens page, under Value for the token, it just has the first and last few characters, with … in between. I don’t see a way to expand or copy it. Any ideas how to copy it? Do they need to be invalidated and refreshed everytime?</p>
<blockquote> <p>Do they need to be invalidated and refreshed everytime?</p> </blockquote> <p>That’s what I do.<br> You can make as many tokens as you like, so if you don’t want to change the existing ones, you can just make new ones…</p> <p>Or you could keep them somewhere local.</p>
Why Is My Fine-Tuned RoBERTa (Text classification) Model Only Predicting One Category/Class?
https://discuss.huggingface.co/t/why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class/146238
146,238
5
2025-03-18T05:58:20.604000Z
[ { "id": 209738, "name": "Llewellyn van Zyl", "username": "Psynalytics", "avatar_template": "/user_avatar/discuss.huggingface.co/psynalytics/{size}/43512_2.png", "created_at": "2025-03-18T05:58:20.716Z", "cooked": "<p>Dear all!</p>\n<p><em>(This is my first post on the forum. I’m sorry if anything is off or the code is weird looking… I tried to fix it as best I can… Im still learning!)</em></p>\n<p>I’m fairly new to NLP and I’ve run into an issue I cant seem to solve. I’m attempting to fine-tune RoBERTa on a dataset that classifies text into 199 different categories (representing various wellbeing triggers). Basically, we have a set of textual data (around 15000 lines of text) thats classified as various triggers of wellbeing (sample data below).</p>\n<p><em>The problem is</em>: after training, when I use my fine-tuned model for inference (even on data it has already seen), it always predicts the very first class (“acculturation stress”). I can’t get it to select any other class… it’s effectively stuck on one label. Im really not sure what Im doing wrong.</p>\n<p><strong>Weirdly enough,</strong> the training process itself doesn’t throw errors, and my training metrics look amazing. <em>And during the test prediction part, it classifies everything correctly</em>. In fact, I get the following results:</p>\n<div class=\"md-table\">\n<table>\n<thead>\n<tr>\n<th><strong>eval_loss</strong></th>\n<th><strong>eval_accuracy</strong></th>\n<th><strong>eval_weighted_f1</strong></th>\n<th><strong>eval_macro_f1</strong></th>\n<th><strong>eval_runtime</strong></th>\n<th><strong>epoch</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>0.002152</td>\n<td>0.99965</td>\n<td>0.999646</td>\n<td>0.999646</td>\n<td>909.2079</td>\n<td>6</td>\n</tr>\n</tbody>\n</table>\n</div><p>Everything seems near-perfect from the training side, so I’m not sure what’s going wrong. Any insights or tips would be greatly appreciated. Not even Qwen, ChatGPT, or Claude managed to crack it!</p>\n<p><strong>EDIT:</strong> I did notice that the <strong>“adapter_model.safetensors”</strong> file in the “full_model” directory (the location of the final model) is empty, but the one before merger is like 7mbs. However, jyst copying it over manually doesnt solve the problem. So perhaps there is an issue with the merging?</p>\n<hr>\n<h2><a name=\"p-209738-dataset-example-1\" class=\"anchor\" href=\"#p-209738-dataset-example-1\"></a>Dataset Example</h2>\n<p>Here’s the basic structure of the data:</p>\n<div class=\"md-table\">\n<table>\n<thead>\n<tr>\n<th><strong>Domain</strong></th>\n<th><strong>Sub Category</strong> (label)</th>\n<th><strong>Example</strong> (text)</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>life demands</td>\n<td>acculturation stress</td>\n<td>I really hate it in the Netherlands, even though I chose to move here.</td>\n</tr>\n<tr>\n<td>life demands</td>\n<td>acculturation stress</td>\n<td>I want to integrate and feel at home but the people here make it so difficult.</td>\n</tr>\n<tr>\n<td>wellbeing</td>\n<td>cognitive flexibility</td>\n<td>I enjoy collaborating because it forces me to flex my thinking.</td>\n</tr>\n<tr>\n<td>wellbeing</td>\n<td>affect balance: positive vs negative affect</td>\n<td>I try to focus on positive moments rather than dwelling on the negatives.</td>\n</tr>\n<tr>\n<td>life resources</td>\n<td>appreciation &amp; recognition</td>\n<td>My boss always tells me how much he appreciates the work I do after we complete a big project.</td>\n</tr>\n<tr>\n<td>life resources</td>\n<td>career development opportunities</td>\n<td>Being able to shadow colleagues helped me see how my skills transfer to new roles.</td>\n</tr>\n</tbody>\n</table>\n</div><hr>\n<h2><a name=\"p-209738-fine-tuning-code-2\" class=\"anchor\" href=\"#p-209738-fine-tuning-code-2\"></a>Fine-Tuning Code</h2>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\"># ----------------------------------------------\n# 1. Import Necessary Libraries\n# ----------------------------------------------\nimport torch\nimport os\nimport json\nimport logging\nimport pandas as pd\nfrom datasets import Dataset\nfrom transformers import (\n RobertaTokenizer,\n RobertaForSequenceClassification,\n TrainingArguments,\n Trainer,\n TrainerState\n)\nfrom peft import LoraConfig, get_peft_model, TaskType, PeftModel # !!! CHANGED !!!\nfrom sklearn.metrics import accuracy_score, f1_score\nfrom sklearn.model_selection import train_test_split\nimport bitsandbytes as bnb\nfrom sklearn.utils import resample # Ensure this import exists\n\n# ----------------------------------------------\n# 🛠 2. Configuration\n# ----------------------------------------------\nclass Config:\n model_name = \"roberta-base\"\n data_path = \"train.xlsx\"\n batch_size = 32 # Reduced for 16GB VRAM\n epochs = 1 #6\n gradient_accumulation_steps = 1 # Effective batch size = batch_size * grad_accum_steps\n max_seq_length = 512 # Memory optimization\n learning_rate = 3e-5\n weight_decay = 0.01\n output_dir = \"./roberta_output\"\n log_file = \"training.log\"\n results_csv = \"training_results.csv\"\n predictions_csv = \"test_predictions.csv\"\n metric_for_best_model = \"weighted_f1\" # !!! CHANGED !!! (Unify best model metric)\n greater_is_better = True\n evaluation_strategy = \"epoch\" # !!! CHANGED !!! (Align with actual usage)\n #eval_steps = 300 # Evaluate every 300 steps\n save_strategy = \"epoch\" # !!! CHANGED !!! (Align with actual usage)\n #save_steps = 300 # !!! CHANGED !!! (Add for step-based saving)\n save_total_limit = 2\n max_grad_norm = 1.0\n logging_steps = 300\n min_samples = 1\n\n# Check model's maximum sequence length\nfrom transformers import RobertaConfig\nconfig_check = RobertaConfig.from_pretrained(Config.model_name)\nprint(f\"Maximum allowed tokens: {config_check.max_position_embeddings}\") # Should show 512\n\n# Validate configuration parameters\nrequired_params = [\n 'model_name', 'data_path', 'batch_size', 'epochs',\n 'output_dir', 'learning_rate', 'min_samples', 'log_file',\n 'results_csv', 'predictions_csv'\n]\n\nfor param in required_params:\n if not hasattr(Config, param):\n raise AttributeError(f\"Missing config parameter: {param}\")\n\n# ----------------------------------------------\n# Logging Setup\n# ----------------------------------------------\nlogging.basicConfig(\n level=logging.INFO,\n format=\"%(asctime)s - %(levelname)s - %(message)s\",\n handlers=[\n logging.FileHandler(Config.log_file, encoding=\"utf-8\"),\n logging.StreamHandler()\n ]\n)\nlogger = logging.getLogger(__name__)\n\n# ----------------------------------------------\n# 4. Check GPU Availability\n# ----------------------------------------------\nDEVICE = \"cuda\" if torch.cuda.is_available() else \"cpu\"\nlogger.info(f\"Using device: {DEVICE}\")\nlogger.info(f\"Torch version: {torch.__version__}\")\nlogger.info(f\"CUDA Available: {torch.cuda.is_available()}\")\nlogger.info(f\"BitsandBytes Available: {hasattr(bnb, 'nn')}\")\n\n# ----------------------------------------------\n# 5. Load &amp; Preprocess Data\n# ----------------------------------------------\ndef load_and_preprocess_data(file_path):\n \"\"\"Loads, preprocesses, and balances the dataset.\"\"\"\n logger.info(f\"Loading dataset from {file_path}...\")\n df = pd.read_excel(file_path, engine=\"openpyxl\") if file_path.endswith(\".xlsx\") else pd.read_csv(file_path)\n df.dropna(subset=[\"Sub Category\", \"Example\"], inplace=True)\n\n # Add data validation\n if df.empty:\n raise ValueError(\"Empty dataset after loading\")\n\n df[\"Sub Category\"] = df[\"Sub Category\"].astype(str).str.replace(\" \", \"_\").str.strip()\n df[\"Example\"] = df[\"Example\"].str.lower().str.strip()\n\n label_counts = df[\"Sub Category\"].value_counts()\n valid_labels = label_counts[label_counts &gt;= Config.min_samples].index\n df = df[df[\"Sub Category\"].isin(valid_labels)]\n\n if df.empty:\n raise ValueError(f\"No categories meet min_samples={Config.min_samples} requirement\")\n\n def balance_dataset(df_):\n label_counts_ = df_[\"Sub Category\"].value_counts()\n max_samples = label_counts_.max()\n df_balanced = df_.groupby(\"Sub Category\", group_keys=False).apply(\n lambda x: resample(\n x,\n replace=True,\n n_samples=max_samples,\n random_state=42\n )\n ).reset_index(drop=True)\n return df_balanced\n\n df = balance_dataset(df)\n logger.info(f\"Final dataset size after balancing: {len(df)}\")\n return df\n\n# ----------------------------------------------\n# 6. Tokenization\n# ----------------------------------------------\ndef tokenize_function(examples):\n \"\"\"Tokenizes text using RoBERTa tokenizer.\"\"\"\n tokenizer = RobertaTokenizer.from_pretrained(Config.model_name)\n tokenized_inputs = tokenizer(\n examples[\"Example\"],\n padding=\"max_length\",\n truncation=True,\n max_length=512,\n return_tensors=\"pt\"\n )\n #tokenized_inputs[\"labels\"] = torch.tensor(examples[\"labels\"], dtype=torch.float) # Force labels to float\n #return tokenized_inputs\n\n # Use long (integer) labels instead of float\n tokenized_inputs[\"labels\"] = torch.tensor(examples[\"labels\"], dtype=torch.long)\n return tokenized_inputs\n# ----------------------------------------------\n# 7. Dataset Preparation\n# ----------------------------------------------\ndef prepare_datasets(df):\n \"\"\"Creates stratified datasets with proper label mapping.\"\"\"\n label_mapping = {label: idx for idx, label in enumerate(df[\"Sub Category\"].unique())}\n Config.num_labels = len(label_mapping)\n logger.info(f\"Number of categories: {Config.num_labels}\")\n\n # !!! CHANGED !!! - Create output dir if not existing\n if not os.path.exists(Config.output_dir):\n os.makedirs(Config.output_dir)\n\n with open(f\"{Config.output_dir}/label_mapping.json\", \"w\") as f:\n json.dump(label_mapping, f)\n\n df[\"label\"] = df[\"Sub Category\"].map(label_mapping).astype(int) # ✅ Convert to float explicitly\n\n # Stratified splits\n train_df, eval_test_df = train_test_split(\n df,\n test_size=0.3,\n stratify=df[\"label\"],\n random_state=42\n )\n eval_df, test_df = train_test_split(\n eval_test_df,\n test_size=0.5,\n stratify=eval_test_df[\"label\"],\n random_state=42\n )\n\n datasets = []\n for split_df in [train_df, eval_df, test_df]:\n dataset = Dataset.from_pandas(split_df).map(\n lambda x: {\"labels\": x[\"label\"]},\n remove_columns=[\"label\"]\n )\n datasets.append(dataset)\n\n return tuple(datasets) + (label_mapping,)\n\n# ----------------------------------------------\n# 8. Compute Evaluation Metrics\n# ----------------------------------------------\ndef compute_metrics(eval_pred):\n \"\"\"Calculates multiple evaluation metrics.\"\"\"\n logits, labels = eval_pred\n preds = logits.argmax(axis=-1)\n\n acc = accuracy_score(labels, preds)\n w_f1 = f1_score(labels, preds, average=\"weighted\")\n m_f1 = f1_score(labels, preds, average=\"macro\")\n\n return {\n \"accuracy\": acc,\n \"weighted_f1\": w_f1,\n \"macro_f1\": m_f1\n }\n\n# ------------------------------------------------------------------------------\n# 🚀 9. Fine-Tune RoBERTa with LoRA + Auto-Resume\n# ------------------------------------------------------------------------------\ndef train_model(train_dataset, eval_dataset, test_dataset, label_mapping):\n \"\"\"Trains RoBERTa model with LoRA and ensures all required files are saved.\"\"\"\n tokenizer = RobertaTokenizer.from_pretrained(Config.model_name)\n\n # Tokenize datasets\n train_dataset = train_dataset.map(tokenize_function, batched=True)\n eval_dataset = eval_dataset.map(tokenize_function, batched=True)\n test_dataset = test_dataset.map(tokenize_function, batched=True)\n\n num_labels = len(label_mapping)\n\n # !!! CHANGED !!!: We'll detect a checkpoint directory ourselves\n last_checkpoint = None\n if os.path.isdir(Config.output_dir) and any(fname.startswith(\"checkpoint-\") for fname in os.listdir(Config.output_dir)):\n # Attempt to find the most recent checkpoint folder\n checkpoints = [d for d in os.listdir(Config.output_dir) if d.startswith(\"checkpoint-\")]\n if checkpoints:\n # Sort by step\n checkpoints.sort(key=lambda x: int(x.split(\"-\")[-1]))\n last_checkpoint = os.path.join(Config.output_dir, checkpoints[-1])\n logger.info(f\" Found a possible checkpoint to resume from: {last_checkpoint}\")\n\n # Initialize model\n if last_checkpoint:\n logger.info(f\"Resuming from {last_checkpoint}\")\n model = RobertaForSequenceClassification.from_pretrained(last_checkpoint, num_labels=num_labels)\n else:\n logger.info(\"No valid checkpoint found. Starting fresh training.\")\n model = RobertaForSequenceClassification.from_pretrained(Config.model_name, num_labels=num_labels)\n\n model = model.to(DEVICE)\n\n # Apply LoRA Adapters\n lora_config = LoraConfig(\n task_type=TaskType.SEQ_CLS,\n r=32,\n lora_alpha=128,\n lora_dropout=0.1,\n bias=\"none\"\n )\n model = get_peft_model(model, lora_config)\n model.print_trainable_parameters()\n\n # !!! CHANGED !!!: Gradient Accumulation &amp; Seed\n training_args = TrainingArguments(\n output_dir=Config.output_dir,\n evaluation_strategy=Config.evaluation_strategy,\n save_strategy=Config.save_strategy,\n #save_steps=Config.save_steps,\n #eval_steps=Config.eval_steps,\n save_total_limit=Config.save_total_limit,\n per_device_train_batch_size=Config.batch_size,\n per_device_eval_batch_size=Config.batch_size,\n num_train_epochs=Config.epochs,\n learning_rate=Config.learning_rate,\n weight_decay=Config.weight_decay,\n logging_dir=\"./logs\",\n logging_steps=Config.logging_steps,\n report_to=\"none\",\n load_best_model_at_end=True,\n metric_for_best_model=Config.metric_for_best_model,\n greater_is_better=Config.greater_is_better,\n gradient_accumulation_steps=Config.gradient_accumulation_steps, # !!! CHANGED !!!\n seed=42 # !!! CHANGED !!!\n )\n\n trainer = Trainer(\n model=model,\n args=training_args,\n train_dataset=train_dataset,\n eval_dataset=eval_dataset,\n compute_metrics=compute_metrics,\n tokenizer=tokenizer,\n )\n\n logger.info(\"Starting training...\")\n # !!! CHANGED !!!: Actually pass `resume_from_checkpoint` to do auto-resume\n trainer.train(resume_from_checkpoint=last_checkpoint)\n\n # Save Final LoRA Adapter &amp; Tokenizer\n logger.info(\"Saving final model, LoRA adapters, and tokenizer...\")\n model.save_pretrained(Config.output_dir)\n tokenizer.save_pretrained(Config.output_dir)\n\n # Save Trainer State\n trainer.state.save_to_json(f\"{Config.output_dir}/trainer_state.json\")\n\n # Save Label Mapping for Inference\n label_mapping_path = f\"{Config.output_dir}/label_mapping.json\"\n with open(label_mapping_path, \"w\") as f:\n json.dump(label_mapping, f)\n logger.info(f\"Label mapping saved to {label_mapping_path}\")\n\n # Verify Label Mapping Integrity\n with open(label_mapping_path, \"r\") as f:\n loaded_mapping = json.load(f)\n if loaded_mapping == label_mapping:\n logger.info(\" Label mapping verification successful.\")\n else:\n logger.error(\" Label mapping mismatch! Check saved file.\")\n\n # Evaluate &amp; Save Results\n logger.info(\" Evaluating model...\")\n eval_results = trainer.evaluate()\n eval_df = pd.DataFrame([eval_results])\n eval_df.to_csv(Config.results_csv, index=False)\n logger.info(f\" Evaluation results saved to {Config.results_csv}\")\n\n # Save Predictions on Test Set\n logger.info(\" Running predictions on test dataset...\")\n test_predictions = trainer.predict(test_dataset)\n test_preds = test_predictions.predictions.argmax(axis=1)\n\n test_results_df = pd.DataFrame({\n \"Text\": test_dataset[\"Example\"],\n \"Predicted Label\": [list(label_mapping.keys())[p] for p in test_preds],\n \"Actual Label\": [list(label_mapping.keys())[int(l)] for l in test_dataset[\"labels\"]], # ✅ Convert to int\n \"Correct\": test_preds == test_dataset[\"labels\"]\n })\n test_results_df.to_csv(Config.predictions_csv, index=False)\n logger.info(f\" Test predictions saved to {Config.predictions_csv}\")\n\n test_metrics = compute_metrics((test_predictions.predictions, test_predictions.label_ids))\n logger.info(f\"Test metrics: {test_metrics}\")\n correct_preds = test_results_df[\"Correct\"].sum()\n total_preds = len(test_results_df)\n test_accuracy = correct_preds / total_preds\n logger.info(f\"Test Accuracy: {test_accuracy}\")\n\n # !!! CHANGED !!!: Use official PEFT merge\n logger.info(\" Merging LoRA adapters into base model for AWS deployment...\")\n full_model_path = f\"{Config.output_dir}/full_model\"\n if not os.path.exists(full_model_path):\n os.makedirs(full_model_path)\n\n\n # Load the LoRA-adapted model\n adapter_model = PeftModel.from_pretrained(\n model,\n Config.output_dir\n )\n\n # Merge LoRA weights into base and unload\n adapter_model = adapter_model.merge_and_unload() # merges LoRA into base weights\n\n # Now adapter_model is effectively the base model with LoRA merges\n adapter_model.save_pretrained(\"./roberta_output/full_model\")\n\n # Save Full Model Configuration &amp; Tokenizer for AWS\n adapter_model.config.to_json_file(f\"{full_model_path}/config.json\")\n tokenizer.save_pretrained(full_model_path)\n\n logger.info(\" Full model saved for AWS deployment!\")\n print(os.listdir(Config.output_dir))\n\n\n return model, trainer\n\n# ----------------------------------------------\n# 10. Main Execution Pipeline\n# ----------------------------------------------\nif __name__ == \"__main__\":\n try:\n df = load_and_preprocess_data(Config.data_path)\n train_dataset, eval_dataset, test_dataset, label_mapping = prepare_datasets(df)\n model, trainer = train_model(train_dataset, eval_dataset, test_dataset, label_mapping)\n logger.info(\"Training completed successfully!\")\n except Exception as e:\n logger.error(f\"Training failed: {str(e)}\", exc_info=True)\n raise\n</code></pre>\n<hr>\n<h1><a name=\"p-209738-the-files-it-produces-are-3\" class=\"anchor\" href=\"#p-209738-the-files-it-produces-are-3\"></a>The files it produces are:</h1>\n<pre><code class=\"lang-auto\">roberta_output/\n└─ full_model/\n ├─ adapter_config.json\n ├─ adapter_model.bin\n ├─ adapter_model.safetensors\n ├─ config.json\n ├─ merges.txt\n ├─ README.md\n ├─ special_tokens_map.json\n ├─ tokenizer_config.json\n └─ vocab.json\n</code></pre>\n<h2><a name=\"p-209738-prediction-script-4\" class=\"anchor\" href=\"#p-209738-prediction-script-4\"></a>Prediction Script</h2>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">import os\nimport json\nimport torch\nfrom transformers import RobertaTokenizer, RobertaForSequenceClassification\n\nMODEL_DIR = \"./roberta_output/full_model\"\nLABEL_MAPPING_PATH = \"./roberta_output/label_mapping.json\"\n\n# Load label mapping\nwith open(LABEL_MAPPING_PATH, \"r\") as f:\n label_mapping = json.load(f)\n\n# Create correct mappings\nid2label = {str(v): k for k, v in label_mapping.items()}\nlabel2id = {k: v for k, v in label_mapping.items()}\n\n# Load merged model with explicit config\ntokenizer = RobertaTokenizer.from_pretrained(MODEL_DIR)\nmodel = RobertaForSequenceClassification.from_pretrained(\n MODEL_DIR,\n num_labels=len(label_mapping),\n id2label=id2label,\n label2id=label2id,\n problem_type=\"single_label_classification\" # Important line\n).eval().to(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n\n# Test samples\nsamples = [\n \"I feel so exhausted. Everything is overwhelming me these days.\",\n \"I love spending time with my family and traveling on weekends!\",\n \"Whenever I get recognized at work, my motivation goes up.\"\n]\n\nfor text in samples:\n inputs = tokenizer(\n text.lower().strip(),\n max_length=512,\n padding=\"max_length\",\n truncation=True,\n return_tensors=\"pt\"\n ).to(model.device)\n\n with torch.no_grad():\n outputs = model(**inputs)\n\n probs = torch.softmax(outputs.logits, dim=-1)[0]\n pred_id = probs.argmax().item()\n\n print(f\"\\nText: {text}\")\n print(f\"Predicted: {id2label[str(pred_id)]}\")\n print(\"Top 3 probabilities:\")\n for prob, idx in zip(*probs.topk(3)):\n print(f\"- {id2label[str(idx.item())]}: {prob.item():.2%}\")\n</code></pre>\n<p><span class=\"hashtag-raw\">#Thank</span> you so much for taking the time to read through this long post and for helping me brainstorm ways to fix the problem</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-18T07:19:02.019Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 267, "reads": 14, "readers_count": 13, "score": 1287.8, "yours": false, "topic_id": 146238, "topic_slug": "why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class", "display_username": "Llewellyn van Zyl", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 8, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87536, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class/146238/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209854, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-18T16:10:11.805Z", "cooked": "<p>I think it’s probably one of two things: either the training is not producing grammatical errors, but it is evaluating the wrong content, or the model is being called in a different way during training and loading, so it is performing differently. I don’t have enough clues…</p>\n<p>In a case like this, I think it’s quicker to check for small mistakes in the basic flow of the training. In particular, since RoBerta seems to be a model with multiple modes, if you make a mistake there, the behavior probably changes?</p>\n<h3><a name=\"p-209854-fine-tuning-for-text-classification-1\" class=\"anchor\" href=\"#p-209854-fine-tuning-for-text-classification-1\"></a>Fine-tuning for text classification</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://achimoraites.medium.com/fine-tuning-roberta-for-topic-classification-with-hugging-face-transformers-and-datasets-library-c6f8432d0820\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/f/0f95de5840ff0771b84ea77cfa42a1e98b4f1614.png\" class=\"site-icon\" data-dominant-color=\"3B3B3B\" width=\"32\" height=\"32\">\n\n <a href=\"https://achimoraites.medium.com/fine-tuning-roberta-for-topic-classification-with-hugging-face-transformers-and-datasets-library-c6f8432d0820\" target=\"_blank\" rel=\"noopener\" title=\"07:34PM - 02 April 2023\">Medium – 2 Apr 23</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/459;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/d/0d3f5ed07c99b7b1d1e86b8bf2161c7fb128fd0c_2_690x459.jpeg\" class=\"thumbnail\" data-dominant-color=\"7E7670\" width=\"690\" height=\"459\"></div>\n\n<h3><a href=\"https://achimoraites.medium.com/fine-tuning-roberta-for-topic-classification-with-hugging-face-transformers-and-datasets-library-c6f8432d0820\" target=\"_blank\" rel=\"noopener\">Fine-tuning RoBERTa for Topic Classification with Hugging Face Transformers...</a></h3>\n\n <p>In This tutorial, we fine-tune a RoBERTa model for topic classification using the Hugging Face Transformers and Datasets libraries.</p>\n\n <p>\n <span class=\"label1\">Reading time: 4 min read</span>\n </p>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://medium.com/@upshift_be/how-to-fine-tune-a-roberta-model-for-text-classification-f2827a653ccb\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/f/0f95de5840ff0771b84ea77cfa42a1e98b4f1614.png\" class=\"site-icon\" data-dominant-color=\"3B3B3B\" width=\"32\" height=\"32\">\n\n <a href=\"https://medium.com/@upshift_be/how-to-fine-tune-a-roberta-model-for-text-classification-f2827a653ccb\" target=\"_blank\" rel=\"noopener\" title=\"07:15PM - 26 September 2022\">Medium – 26 Sep 22</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/459;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/e/9/e9a902da19623397eff7d05fab3a77fd28e9c030_2_690x459.jpeg\" class=\"thumbnail\" data-dominant-color=\"3E4D64\" width=\"690\" height=\"459\"></div>\n\n<h3><a href=\"https://medium.com/@upshift_be/how-to-fine-tune-a-roberta-model-for-text-classification-f2827a653ccb\" target=\"_blank\" rel=\"noopener\">How to fine-tune a Roberta model for text classification</a></h3>\n\n <p>Annotated datasets</p>\n\n <p>\n <span class=\"label1\">Reading time: 2 min read</span>\n </p>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/Valerii-Knowledgator/multi-label-classification\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/Valerii-Knowledgator/multi-label-classification\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/9/f922ce98ca100d4a011c5d0767ebf420fd777a5c_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F0F0EF\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/blog/Valerii-Knowledgator/multi-label-classification\" target=\"_blank\" rel=\"noopener\">Multi-Label Classification Model From Scratch: Step-by-Step Tutorial</a></h3>\n\n <p>A Blog post by Valerii Vasylevskyi on Hugging Face</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-18T16:10:11.805Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 11, "readers_count": 10, "score": 22.2, "yours": false, "topic_id": 146238, "topic_slug": "why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://achimoraites.medium.com/fine-tuning-roberta-for-topic-classification-with-hugging-face-transformers-and-datasets-library-c6f8432d0820", "internal": false, "reflection": false, "title": "Fine-tuning RoBERTa for Topic Classification with Hugging Face Transformers and Datasets Library | by Achilles Moraites | Medium", "clicks": 6 }, { "url": "https://huggingface.co/blog/Valerii-Knowledgator/multi-label-classification", "internal": false, "reflection": false, "title": "Multi-Label Classification Model From Scratch: Step-by-Step Tutorial", "clicks": 4 }, { "url": "https://medium.com/@upshift_be/how-to-fine-tune-a-roberta-model-for-text-classification-f2827a653ccb", "internal": false, "reflection": false, "title": "How to fine-tune a Roberta model for text classification | by upshift.be | Medium", "clicks": 2 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class/146238/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211071, "name": "Llewellyn van Zyl", "username": "Psynalytics", "avatar_template": "/user_avatar/discuss.huggingface.co/psynalytics/{size}/43512_2.png", "created_at": "2025-03-24T10:47:09.551Z", "cooked": "<p>Thanks <a class=\"mention\" href=\"/u/john6666\">@John6666</a> for the suggestions. I looked into this at length during the last few days, and I dont see any differences in the training logic between the examples and my work flow. So a bit confused.</p>\n<p>What I still notice is that the “adapter_model.safetensors” in the saved model doesnt contain any values, only a single strength:</p>\n<blockquote>\n<p>NULL NULL NULL NULL NULL {“<strong>metadata</strong>”:{“format”:“pt”}}</p>\n</blockquote>\n<p>So Im wondering if the problem isnt that the LoRa values arent being saved and integrated correctly?</p>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-24T10:47:09.551Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 16.6, "yours": false, "topic_id": 146238, "topic_slug": "why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class", "display_username": "Llewellyn van Zyl", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87536, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class/146238/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211081, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-24T11:27:36.757Z", "cooked": "<blockquote>\n<p>the problem isnt that the LoRa values arent being saved and integrated correctly?</p>\n</blockquote>\n<p>It seems that’s the case…<br>\nUsually, LoRA files are full of data.</p>\n<p>But if a file is not created, that’s one thing, but what does it mean if there is a file but no content…?</p>\n<p>Hmm…</p><aside class=\"quote quote-modified\" data-post=\"1\" data-topic=\"77836\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/48.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/correct-way-to-save-load-adapters-and-checkpoints-in-peft/77836\">Correct way to save/load adapters and checkpoints in PEFT</a> <a class=\"badge-category__wrapper \" href=\"/c/transformers/9\"><span data-category-id=\"9\" style=\"--category-badge-color: #F7941D; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"This category is for any question related to the Transformers library. You can also file an issue.\"><span class=\"badge-category__name\">🤗Transformers</span></span></a>\n </div>\n <blockquote>\n Hi, \nIt is not clear to me what is the correct way to save/load a PEFT checkpoint, as well as the final fine-tuned model. There have been reports of trainer.resume_from_checkpoint not working as expected <a href=\"https://github.com/huggingface/transformers/issues/24330\" rel=\"noopener nofollow ugc\">[1]</a><a href=\"https://github.com/huggingface/transformers/issues/24252\" rel=\"noopener nofollow ugc\">[2]</a><a href=\"https://discuss.huggingface.co/t/retraining-peft-model/43829\">[3]</a>, each of which have very few replies, or do not seem to have any sort of consensus. Proposed solutions range from trainer.save_model, to trainer.save_state to resume_from_checkpoint=True to model.save_pretrained <a href=\"https://huggingface.co/docs/transformers/main/en/peft\">(PEFT docs)</a> to even a very complicated procedure of merging and saving the…\n </blockquote>\n</aside>\n<aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/huggingface/peft/issues/96\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/peft/issues/96\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/peft</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/peft/issues/96\" target=\"_blank\" rel=\"noopener\">Incorrect Saving Peft Models using HuggingFace Trainer</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2023-02-16\" data-time=\"12:30:18\" data-timezone=\"UTC\">12:30PM - 16 Feb 23 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2023-04-13\" data-time=\"15:03:35\" data-timezone=\"UTC\">03:03PM - 13 Apr 23 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/agemagician\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/a/b/ab35fccaf7373405603129fbeaeab16198b24163.jpeg\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"615C5E\">\n agemagician\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n solved\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">Hello,\n\nThanks a lot for the great project.\n\nI am fine-tuning Flan-T5-XXL us<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">ing HuggingFace Seq2SeqTrainer and hyperparameter_search.\nHowever, the trainer doesn't store Peft models correctly because it is not a \"PreTrainedModel\" type.\nIt stores the whole PyTorch model, including the Flan-T5-XXL, which is around 42 GB.\n\nI have dug into the code, and I made a hacky solution inside \"trainer.py\" for now:\n\n```\n def _save(self, output_dir: Optional[str] = None, state_dict=None):\n # If we are executing this function, we are the process zero, so we don't check for that.\n output_dir = output_dir if output_dir is not None else self.args.output_dir\n os.makedirs(output_dir, exist_ok=True)\n logger.info(f\"Saving model checkpoint to {output_dir}\")\n from peft.peft_model import PeftModelForSeq2SeqLM\n if isinstance(self.model, PeftModelForSeq2SeqLM):\n self.model.save_pretrained(output_dir, state_dict=state_dict)\n # Save a trained model and configuration using `save_pretrained()`.\n # They can then be reloaded using `from_pretrained()`\n elif not isinstance(self.model, PreTrainedModel):\n if isinstance(unwrap_model(self.model), PreTrainedModel):\n if state_dict is None:\n state_dict = self.model.state_dict()\n unwrap_model(self.model).save_pretrained(output_dir, state_dict=state_dict)\n else:\n logger.info(\"Trainer.model is not a `PreTrainedModel`, only saving its state dict.\")\n if state_dict is None:\n state_dict = self.model.state_dict()\n torch.save(state_dict, os.path.join(output_dir, WEIGHTS_NAME))\n else:\n self.model.save_pretrained(output_dir, state_dict=state_dict)\n if self.tokenizer is not None:\n self.tokenizer.save_pretrained(output_dir)\n\n # Good practice: save your training arguments together with the trained model\n torch.save(self.args, os.path.join(output_dir, TRAINING_ARGS_NAME))\n```\n\nDo you have a better solution for saving the \"Peft models\" correctly using HuggingFace Seq2SeqTrainer and hyperparameter_search ?</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"quote\" data-post=\"3\" data-topic=\"76291\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://avatars.discourse-cdn.com/v4/letter/i/839c29/48.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/save-load-and-do-inference-with-fine-tuned-model/76291/3\">Save, load and do inference with fine-tuned model</a> <a class=\"badge-category__wrapper \" href=\"/c/beginners/5\"><span data-category-id=\"5\" style=\"--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category for any basic question you have on any of the Hugging Face library. Don’t moderate yourself, everyone has to begin somewhere and everyone on this forum is here to help!\"><span class=\"badge-category__name\">Beginners</span></span></a>\n </div>\n <blockquote>\n I’m seeing different methods to save the fine-tuned model. That confuses me. \nExample1 : model.save_pretrained('./output/')\nExample1 : trainer.save_model('./output/')\nExample1 : trainer.model.save_pretrained('./output/')\n\nand some example with merge and unload. \n<a class=\"mention\" href=\"/u/nielsr\">@nielsr</a> can you provide some example for fine-tuned model?\n </blockquote>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-24T11:45:19.319Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 7, "reads": 7, "readers_count": 6, "score": 51.4, "yours": false, "topic_id": 146238, "topic_slug": "why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/peft/issues/96", "internal": false, "reflection": false, "title": "Incorrect Saving Peft Models using HuggingFace Trainer · Issue #96 · huggingface/peft · GitHub", "clicks": 3 }, { "url": "https://discuss.huggingface.co/t/correct-way-to-save-load-adapters-and-checkpoints-in-peft/77836", "internal": true, "reflection": false, "title": "Correct way to save/load adapters and checkpoints in PEFT", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/save-load-and-do-inference-with-fine-tuned-model/76291/3", "internal": true, "reflection": false, "title": "Save, load and do inference with fine-tuned model", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class/146238/4", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214094, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-08T02:46:03.771Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-04-08T02:46:03.771Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 146238, "topic_slug": "why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-fine-tuned-roberta-text-classification-model-only-predicting-one-category-class/146238/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Dear all!</p> <p><em>(This is my first post on the forum. I’m sorry if anything is off or the code is weird looking… I tried to fix it as best I can… Im still learning!)</em></p> <p>I’m fairly new to NLP and I’ve run into an issue I cant seem to solve. I’m attempting to fine-tune RoBERTa on a dataset that classifies text into 199 different categories (representing various wellbeing triggers). Basically, we have a set of textual data (around 15000 lines of text) thats classified as various triggers of wellbeing (sample data below).</p> <p><em>The problem is</em>: after training, when I use my fine-tuned model for inference (even on data it has already seen), it always predicts the very first class (“acculturation stress”). I can’t get it to select any other class… it’s effectively stuck on one label. Im really not sure what Im doing wrong.</p> <p><strong>Weirdly enough,</strong> the training process itself doesn’t throw errors, and my training metrics look amazing. <em>And during the test prediction part, it classifies everything correctly</em>. In fact, I get the following results:</p> <div class="md-table"> <table> <thead> <tr> <th><strong>eval_loss</strong></th> <th><strong>eval_accuracy</strong></th> <th><strong>eval_weighted_f1</strong></th> <th><strong>eval_macro_f1</strong></th> <th><strong>eval_runtime</strong></th> <th><strong>epoch</strong></th> </tr> </thead> <tbody> <tr> <td>0.002152</td> <td>0.99965</td> <td>0.999646</td> <td>0.999646</td> <td>909.2079</td> <td>6</td> </tr> </tbody> </table> </div><p>Everything seems near-perfect from the training side, so I’m not sure what’s going wrong. Any insights or tips would be greatly appreciated. Not even Qwen, ChatGPT, or Claude managed to crack it!</p> <p><strong>EDIT:</strong> I did notice that the <strong>“adapter_model.safetensors”</strong> file in the “full_model” directory (the location of the final model) is empty, but the one before merger is like 7mbs. However, jyst copying it over manually doesnt solve the problem. So perhaps there is an issue with the merging?</p> <hr> <h2><a name="p-209738-dataset-example-1" class="anchor" href="#p-209738-dataset-example-1"></a>Dataset Example</h2> <p>Here’s the basic structure of the data:</p> <div class="md-table"> <table> <thead> <tr> <th><strong>Domain</strong></th> <th><strong>Sub Category</strong> (label)</th> <th><strong>Example</strong> (text)</th> </tr> </thead> <tbody> <tr> <td>life demands</td> <td>acculturation stress</td> <td>I really hate it in the Netherlands, even though I chose to move here.</td> </tr> <tr> <td>life demands</td> <td>acculturation stress</td> <td>I want to integrate and feel at home but the people here make it so difficult.</td> </tr> <tr> <td>wellbeing</td> <td>cognitive flexibility</td> <td>I enjoy collaborating because it forces me to flex my thinking.</td> </tr> <tr> <td>wellbeing</td> <td>affect balance: positive vs negative affect</td> <td>I try to focus on positive moments rather than dwelling on the negatives.</td> </tr> <tr> <td>life resources</td> <td>appreciation &amp; recognition</td> <td>My boss always tells me how much he appreciates the work I do after we complete a big project.</td> </tr> <tr> <td>life resources</td> <td>career development opportunities</td> <td>Being able to shadow colleagues helped me see how my skills transfer to new roles.</td> </tr> </tbody> </table> </div><hr> <h2><a name="p-209738-fine-tuning-code-2" class="anchor" href="#p-209738-fine-tuning-code-2"></a>Fine-Tuning Code</h2> <pre data-code-wrap="python"><code class="lang-python"># ---------------------------------------------- # 1. Import Necessary Libraries # ---------------------------------------------- import torch import os import json import logging import pandas as pd from datasets import Dataset from transformers import ( RobertaTokenizer, RobertaForSequenceClassification, TrainingArguments, Trainer, TrainerState ) from peft import LoraConfig, get_peft_model, TaskType, PeftModel # !!! CHANGED !!! from sklearn.metrics import accuracy_score, f1_score from sklearn.model_selection import train_test_split import bitsandbytes as bnb from sklearn.utils import resample # Ensure this import exists # ---------------------------------------------- # 🛠 2. Configuration # ---------------------------------------------- class Config: model_name = "roberta-base" data_path = "train.xlsx" batch_size = 32 # Reduced for 16GB VRAM epochs = 1 #6 gradient_accumulation_steps = 1 # Effective batch size = batch_size * grad_accum_steps max_seq_length = 512 # Memory optimization learning_rate = 3e-5 weight_decay = 0.01 output_dir = "./roberta_output" log_file = "training.log" results_csv = "training_results.csv" predictions_csv = "test_predictions.csv" metric_for_best_model = "weighted_f1" # !!! CHANGED !!! (Unify best model metric) greater_is_better = True evaluation_strategy = "epoch" # !!! CHANGED !!! (Align with actual usage) #eval_steps = 300 # Evaluate every 300 steps save_strategy = "epoch" # !!! CHANGED !!! (Align with actual usage) #save_steps = 300 # !!! CHANGED !!! (Add for step-based saving) save_total_limit = 2 max_grad_norm = 1.0 logging_steps = 300 min_samples = 1 # Check model's maximum sequence length from transformers import RobertaConfig config_check = RobertaConfig.from_pretrained(Config.model_name) print(f"Maximum allowed tokens: {config_check.max_position_embeddings}") # Should show 512 # Validate configuration parameters required_params = [ 'model_name', 'data_path', 'batch_size', 'epochs', 'output_dir', 'learning_rate', 'min_samples', 'log_file', 'results_csv', 'predictions_csv' ] for param in required_params: if not hasattr(Config, param): raise AttributeError(f"Missing config parameter: {param}") # ---------------------------------------------- # Logging Setup # ---------------------------------------------- logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s", handlers=[ logging.FileHandler(Config.log_file, encoding="utf-8"), logging.StreamHandler() ] ) logger = logging.getLogger(__name__) # ---------------------------------------------- # 4. Check GPU Availability # ---------------------------------------------- DEVICE = "cuda" if torch.cuda.is_available() else "cpu" logger.info(f"Using device: {DEVICE}") logger.info(f"Torch version: {torch.__version__}") logger.info(f"CUDA Available: {torch.cuda.is_available()}") logger.info(f"BitsandBytes Available: {hasattr(bnb, 'nn')}") # ---------------------------------------------- # 5. Load &amp; Preprocess Data # ---------------------------------------------- def load_and_preprocess_data(file_path): """Loads, preprocesses, and balances the dataset.""" logger.info(f"Loading dataset from {file_path}...") df = pd.read_excel(file_path, engine="openpyxl") if file_path.endswith(".xlsx") else pd.read_csv(file_path) df.dropna(subset=["Sub Category", "Example"], inplace=True) # Add data validation if df.empty: raise ValueError("Empty dataset after loading") df["Sub Category"] = df["Sub Category"].astype(str).str.replace(" ", "_").str.strip() df["Example"] = df["Example"].str.lower().str.strip() label_counts = df["Sub Category"].value_counts() valid_labels = label_counts[label_counts &gt;= Config.min_samples].index df = df[df["Sub Category"].isin(valid_labels)] if df.empty: raise ValueError(f"No categories meet min_samples={Config.min_samples} requirement") def balance_dataset(df_): label_counts_ = df_["Sub Category"].value_counts() max_samples = label_counts_.max() df_balanced = df_.groupby("Sub Category", group_keys=False).apply( lambda x: resample( x, replace=True, n_samples=max_samples, random_state=42 ) ).reset_index(drop=True) return df_balanced df = balance_dataset(df) logger.info(f"Final dataset size after balancing: {len(df)}") return df # ---------------------------------------------- # 6. Tokenization # ---------------------------------------------- def tokenize_function(examples): """Tokenizes text using RoBERTa tokenizer.""" tokenizer = RobertaTokenizer.from_pretrained(Config.model_name) tokenized_inputs = tokenizer( examples["Example"], padding="max_length", truncation=True, max_length=512, return_tensors="pt" ) #tokenized_inputs["labels"] = torch.tensor(examples["labels"], dtype=torch.float) # Force labels to float #return tokenized_inputs # Use long (integer) labels instead of float tokenized_inputs["labels"] = torch.tensor(examples["labels"], dtype=torch.long) return tokenized_inputs # ---------------------------------------------- # 7. Dataset Preparation # ---------------------------------------------- def prepare_datasets(df): """Creates stratified datasets with proper label mapping.""" label_mapping = {label: idx for idx, label in enumerate(df["Sub Category"].unique())} Config.num_labels = len(label_mapping) logger.info(f"Number of categories: {Config.num_labels}") # !!! CHANGED !!! - Create output dir if not existing if not os.path.exists(Config.output_dir): os.makedirs(Config.output_dir) with open(f"{Config.output_dir}/label_mapping.json", "w") as f: json.dump(label_mapping, f) df["label"] = df["Sub Category"].map(label_mapping).astype(int) # ✅ Convert to float explicitly # Stratified splits train_df, eval_test_df = train_test_split( df, test_size=0.3, stratify=df["label"], random_state=42 ) eval_df, test_df = train_test_split( eval_test_df, test_size=0.5, stratify=eval_test_df["label"], random_state=42 ) datasets = [] for split_df in [train_df, eval_df, test_df]: dataset = Dataset.from_pandas(split_df).map( lambda x: {"labels": x["label"]}, remove_columns=["label"] ) datasets.append(dataset) return tuple(datasets) + (label_mapping,) # ---------------------------------------------- # 8. Compute Evaluation Metrics # ---------------------------------------------- def compute_metrics(eval_pred): """Calculates multiple evaluation metrics.""" logits, labels = eval_pred preds = logits.argmax(axis=-1) acc = accuracy_score(labels, preds) w_f1 = f1_score(labels, preds, average="weighted") m_f1 = f1_score(labels, preds, average="macro") return { "accuracy": acc, "weighted_f1": w_f1, "macro_f1": m_f1 } # ------------------------------------------------------------------------------ # 🚀 9. Fine-Tune RoBERTa with LoRA + Auto-Resume # ------------------------------------------------------------------------------ def train_model(train_dataset, eval_dataset, test_dataset, label_mapping): """Trains RoBERTa model with LoRA and ensures all required files are saved.""" tokenizer = RobertaTokenizer.from_pretrained(Config.model_name) # Tokenize datasets train_dataset = train_dataset.map(tokenize_function, batched=True) eval_dataset = eval_dataset.map(tokenize_function, batched=True) test_dataset = test_dataset.map(tokenize_function, batched=True) num_labels = len(label_mapping) # !!! CHANGED !!!: We'll detect a checkpoint directory ourselves last_checkpoint = None if os.path.isdir(Config.output_dir) and any(fname.startswith("checkpoint-") for fname in os.listdir(Config.output_dir)): # Attempt to find the most recent checkpoint folder checkpoints = [d for d in os.listdir(Config.output_dir) if d.startswith("checkpoint-")] if checkpoints: # Sort by step checkpoints.sort(key=lambda x: int(x.split("-")[-1])) last_checkpoint = os.path.join(Config.output_dir, checkpoints[-1]) logger.info(f" Found a possible checkpoint to resume from: {last_checkpoint}") # Initialize model if last_checkpoint: logger.info(f"Resuming from {last_checkpoint}") model = RobertaForSequenceClassification.from_pretrained(last_checkpoint, num_labels=num_labels) else: logger.info("No valid checkpoint found. Starting fresh training.") model = RobertaForSequenceClassification.from_pretrained(Config.model_name, num_labels=num_labels) model = model.to(DEVICE) # Apply LoRA Adapters lora_config = LoraConfig( task_type=TaskType.SEQ_CLS, r=32, lora_alpha=128, lora_dropout=0.1, bias="none" ) model = get_peft_model(model, lora_config) model.print_trainable_parameters() # !!! CHANGED !!!: Gradient Accumulation &amp; Seed training_args = TrainingArguments( output_dir=Config.output_dir, evaluation_strategy=Config.evaluation_strategy, save_strategy=Config.save_strategy, #save_steps=Config.save_steps, #eval_steps=Config.eval_steps, save_total_limit=Config.save_total_limit, per_device_train_batch_size=Config.batch_size, per_device_eval_batch_size=Config.batch_size, num_train_epochs=Config.epochs, learning_rate=Config.learning_rate, weight_decay=Config.weight_decay, logging_dir="./logs", logging_steps=Config.logging_steps, report_to="none", load_best_model_at_end=True, metric_for_best_model=Config.metric_for_best_model, greater_is_better=Config.greater_is_better, gradient_accumulation_steps=Config.gradient_accumulation_steps, # !!! CHANGED !!! seed=42 # !!! CHANGED !!! ) trainer = Trainer( model=model, args=training_args, train_dataset=train_dataset, eval_dataset=eval_dataset, compute_metrics=compute_metrics, tokenizer=tokenizer, ) logger.info("Starting training...") # !!! CHANGED !!!: Actually pass `resume_from_checkpoint` to do auto-resume trainer.train(resume_from_checkpoint=last_checkpoint) # Save Final LoRA Adapter &amp; Tokenizer logger.info("Saving final model, LoRA adapters, and tokenizer...") model.save_pretrained(Config.output_dir) tokenizer.save_pretrained(Config.output_dir) # Save Trainer State trainer.state.save_to_json(f"{Config.output_dir}/trainer_state.json") # Save Label Mapping for Inference label_mapping_path = f"{Config.output_dir}/label_mapping.json" with open(label_mapping_path, "w") as f: json.dump(label_mapping, f) logger.info(f"Label mapping saved to {label_mapping_path}") # Verify Label Mapping Integrity with open(label_mapping_path, "r") as f: loaded_mapping = json.load(f) if loaded_mapping == label_mapping: logger.info(" Label mapping verification successful.") else: logger.error(" Label mapping mismatch! Check saved file.") # Evaluate &amp; Save Results logger.info(" Evaluating model...") eval_results = trainer.evaluate() eval_df = pd.DataFrame([eval_results]) eval_df.to_csv(Config.results_csv, index=False) logger.info(f" Evaluation results saved to {Config.results_csv}") # Save Predictions on Test Set logger.info(" Running predictions on test dataset...") test_predictions = trainer.predict(test_dataset) test_preds = test_predictions.predictions.argmax(axis=1) test_results_df = pd.DataFrame({ "Text": test_dataset["Example"], "Predicted Label": [list(label_mapping.keys())[p] for p in test_preds], "Actual Label": [list(label_mapping.keys())[int(l)] for l in test_dataset["labels"]], # ✅ Convert to int "Correct": test_preds == test_dataset["labels"] }) test_results_df.to_csv(Config.predictions_csv, index=False) logger.info(f" Test predictions saved to {Config.predictions_csv}") test_metrics = compute_metrics((test_predictions.predictions, test_predictions.label_ids)) logger.info(f"Test metrics: {test_metrics}") correct_preds = test_results_df["Correct"].sum() total_preds = len(test_results_df) test_accuracy = correct_preds / total_preds logger.info(f"Test Accuracy: {test_accuracy}") # !!! CHANGED !!!: Use official PEFT merge logger.info(" Merging LoRA adapters into base model for AWS deployment...") full_model_path = f"{Config.output_dir}/full_model" if not os.path.exists(full_model_path): os.makedirs(full_model_path) # Load the LoRA-adapted model adapter_model = PeftModel.from_pretrained( model, Config.output_dir ) # Merge LoRA weights into base and unload adapter_model = adapter_model.merge_and_unload() # merges LoRA into base weights # Now adapter_model is effectively the base model with LoRA merges adapter_model.save_pretrained("./roberta_output/full_model") # Save Full Model Configuration &amp; Tokenizer for AWS adapter_model.config.to_json_file(f"{full_model_path}/config.json") tokenizer.save_pretrained(full_model_path) logger.info(" Full model saved for AWS deployment!") print(os.listdir(Config.output_dir)) return model, trainer # ---------------------------------------------- # 10. Main Execution Pipeline # ---------------------------------------------- if __name__ == "__main__": try: df = load_and_preprocess_data(Config.data_path) train_dataset, eval_dataset, test_dataset, label_mapping = prepare_datasets(df) model, trainer = train_model(train_dataset, eval_dataset, test_dataset, label_mapping) logger.info("Training completed successfully!") except Exception as e: logger.error(f"Training failed: {str(e)}", exc_info=True) raise </code></pre> <hr> <h1><a name="p-209738-the-files-it-produces-are-3" class="anchor" href="#p-209738-the-files-it-produces-are-3"></a>The files it produces are:</h1> <pre><code class="lang-auto">roberta_output/ └─ full_model/ ├─ adapter_config.json ├─ adapter_model.bin ├─ adapter_model.safetensors ├─ config.json ├─ merges.txt ├─ README.md ├─ special_tokens_map.json ├─ tokenizer_config.json └─ vocab.json </code></pre> <h2><a name="p-209738-prediction-script-4" class="anchor" href="#p-209738-prediction-script-4"></a>Prediction Script</h2> <pre data-code-wrap="python"><code class="lang-python">import os import json import torch from transformers import RobertaTokenizer, RobertaForSequenceClassification MODEL_DIR = "./roberta_output/full_model" LABEL_MAPPING_PATH = "./roberta_output/label_mapping.json" # Load label mapping with open(LABEL_MAPPING_PATH, "r") as f: label_mapping = json.load(f) # Create correct mappings id2label = {str(v): k for k, v in label_mapping.items()} label2id = {k: v for k, v in label_mapping.items()} # Load merged model with explicit config tokenizer = RobertaTokenizer.from_pretrained(MODEL_DIR) model = RobertaForSequenceClassification.from_pretrained( MODEL_DIR, num_labels=len(label_mapping), id2label=id2label, label2id=label2id, problem_type="single_label_classification" # Important line ).eval().to("cuda" if torch.cuda.is_available() else "cpu") # Test samples samples = [ "I feel so exhausted. Everything is overwhelming me these days.", "I love spending time with my family and traveling on weekends!", "Whenever I get recognized at work, my motivation goes up." ] for text in samples: inputs = tokenizer( text.lower().strip(), max_length=512, padding="max_length", truncation=True, return_tensors="pt" ).to(model.device) with torch.no_grad(): outputs = model(**inputs) probs = torch.softmax(outputs.logits, dim=-1)[0] pred_id = probs.argmax().item() print(f"\nText: {text}") print(f"Predicted: {id2label[str(pred_id)]}") print("Top 3 probabilities:") for prob, idx in zip(*probs.topk(3)): print(f"- {id2label[str(idx.item())]}: {prob.item():.2%}") </code></pre> <p><span class="hashtag-raw">#Thank</span> you so much for taking the time to read through this long post and for helping me brainstorm ways to fix the problem</p>
<blockquote> <p>the problem isnt that the LoRa values arent being saved and integrated correctly?</p> </blockquote> <p>It seems that’s the case…<br> Usually, LoRA files are full of data.</p> <p>But if a file is not created, that’s one thing, but what does it mean if there is a file but no content…?</p> <p>Hmm…</p><aside class="quote quote-modified" data-post="1" data-topic="77836"> <div class="title"> <div class="quote-controls"></div> <img alt="" width="24" height="24" src="https://avatars.discourse-cdn.com/v4/letter/r/57b2e6/48.png" class="avatar"> <a href="https://discuss.huggingface.co/t/correct-way-to-save-load-adapters-and-checkpoints-in-peft/77836">Correct way to save/load adapters and checkpoints in PEFT</a> <a class="badge-category__wrapper " href="/c/transformers/9"><span data-category-id="9" style="--category-badge-color: #F7941D; --category-badge-text-color: #FFFFFF;" data-drop-close="true" class="badge-category " title="This category is for any question related to the Transformers library. You can also file an issue."><span class="badge-category__name">🤗Transformers</span></span></a> </div> <blockquote> Hi, It is not clear to me what is the correct way to save/load a PEFT checkpoint, as well as the final fine-tuned model. There have been reports of trainer.resume_from_checkpoint not working as expected <a href="https://github.com/huggingface/transformers/issues/24330" rel="noopener nofollow ugc">[1]</a><a href="https://github.com/huggingface/transformers/issues/24252" rel="noopener nofollow ugc">[2]</a><a href="https://discuss.huggingface.co/t/retraining-peft-model/43829">[3]</a>, each of which have very few replies, or do not seem to have any sort of consensus. Proposed solutions range from trainer.save_model, to trainer.save_state to resume_from_checkpoint=True to model.save_pretrained <a href="https://huggingface.co/docs/transformers/main/en/peft">(PEFT docs)</a> to even a very complicated procedure of merging and saving the… </blockquote> </aside> <aside class="onebox githubissue" data-onebox-src="https://github.com/huggingface/peft/issues/96"> <header class="source"> <a href="https://github.com/huggingface/peft/issues/96" target="_blank" rel="noopener">github.com/huggingface/peft</a> </header> <article class="onebox-body"> <div class="github-row"> <div class="github-icon-container" title="Issue" data-github-private-repo="false"> <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg> </div> <div class="github-info-container"> <h4> <a href="https://github.com/huggingface/peft/issues/96" target="_blank" rel="noopener">Incorrect Saving Peft Models using HuggingFace Trainer</a> </h4> <div class="github-info"> <div class="date"> opened <span class="discourse-local-date" data-format="ll" data-date="2023-02-16" data-time="12:30:18" data-timezone="UTC">12:30PM - 16 Feb 23 UTC</span> </div> <div class="date"> closed <span class="discourse-local-date" data-format="ll" data-date="2023-04-13" data-time="15:03:35" data-timezone="UTC">03:03PM - 13 Apr 23 UTC</span> </div> <div class="user"> <a href="https://github.com/agemagician" target="_blank" rel="noopener"> <img alt="" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/a/b/ab35fccaf7373405603129fbeaeab16198b24163.jpeg" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="615C5E"> agemagician </a> </div> </div> <div class="labels"> <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;"> solved </span> </div> </div> </div> <div class="github-row"> <p class="github-body-container">Hello, Thanks a lot for the great project. I am fine-tuning Flan-T5-XXL us<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">ing HuggingFace Seq2SeqTrainer and hyperparameter_search. However, the trainer doesn't store Peft models correctly because it is not a "PreTrainedModel" type. It stores the whole PyTorch model, including the Flan-T5-XXL, which is around 42 GB. I have dug into the code, and I made a hacky solution inside "trainer.py" for now: ``` def _save(self, output_dir: Optional[str] = None, state_dict=None): # If we are executing this function, we are the process zero, so we don't check for that. output_dir = output_dir if output_dir is not None else self.args.output_dir os.makedirs(output_dir, exist_ok=True) logger.info(f"Saving model checkpoint to {output_dir}") from peft.peft_model import PeftModelForSeq2SeqLM if isinstance(self.model, PeftModelForSeq2SeqLM): self.model.save_pretrained(output_dir, state_dict=state_dict) # Save a trained model and configuration using `save_pretrained()`. # They can then be reloaded using `from_pretrained()` elif not isinstance(self.model, PreTrainedModel): if isinstance(unwrap_model(self.model), PreTrainedModel): if state_dict is None: state_dict = self.model.state_dict() unwrap_model(self.model).save_pretrained(output_dir, state_dict=state_dict) else: logger.info("Trainer.model is not a `PreTrainedModel`, only saving its state dict.") if state_dict is None: state_dict = self.model.state_dict() torch.save(state_dict, os.path.join(output_dir, WEIGHTS_NAME)) else: self.model.save_pretrained(output_dir, state_dict=state_dict) if self.tokenizer is not None: self.tokenizer.save_pretrained(output_dir) # Good practice: save your training arguments together with the trained model torch.save(self.args, os.path.join(output_dir, TRAINING_ARGS_NAME)) ``` Do you have a better solution for saving the "Peft models" correctly using HuggingFace Seq2SeqTrainer and hyperparameter_search ?</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="quote" data-post="3" data-topic="76291"> <div class="title"> <div class="quote-controls"></div> <img alt="" width="24" height="24" src="https://avatars.discourse-cdn.com/v4/letter/i/839c29/48.png" class="avatar"> <a href="https://discuss.huggingface.co/t/save-load-and-do-inference-with-fine-tuned-model/76291/3">Save, load and do inference with fine-tuned model</a> <a class="badge-category__wrapper " href="/c/beginners/5"><span data-category-id="5" style="--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;" data-drop-close="true" class="badge-category " title="Use this category for any basic question you have on any of the Hugging Face library. Don’t moderate yourself, everyone has to begin somewhere and everyone on this forum is here to help!"><span class="badge-category__name">Beginners</span></span></a> </div> <blockquote> I’m seeing different methods to save the fine-tuned model. That confuses me. Example1 : model.save_pretrained('./output/') Example1 : trainer.save_model('./output/') Example1 : trainer.model.save_pretrained('./output/') and some example with merge and unload. <a class="mention" href="/u/nielsr">@nielsr</a> can you provide some example for fine-tuned model? </blockquote> </aside>
Caching only one feature, from a read-only dataset
https://discuss.huggingface.co/t/caching-only-one-feature-from-a-read-only-dataset/148262
148,262
10
2025-03-31T19:04:32.013000Z
[ { "id": 212566, "name": "Giuseppe Attanasio", "username": "g8a9", "avatar_template": "/user_avatar/discuss.huggingface.co/g8a9/{size}/39308_2.png", "created_at": "2025-03-31T19:04:32.084Z", "cooked": "<p>Hey,</p>\n<p>I want to add a feature to a large audio dataset before my training starts. In particular, it’s the length in seconds such that my HF trainer can “group_by_length” my inputs.<br>\nMy datasets are all saved locally in a read-only folder (they were saved through <code>save_to_disk()</code>).</p>\n<p>What’s happening now is that:</p>\n<ul>\n<li>when I load the dataset with <code>load_from_disk()</code> that folder is by default used as cache, so any map/filter function fails since I don’t have write access to it (e.g., <a href=\"https://discuss.huggingface.co/t/load-from-disk-and-read-only-filesystem/54312/1\">this issue</a>)</li>\n<li>If I pass a <code>cache_filename</code> with a path where I have write access, the cache files I’m creating are too big, since the whole dataset is cached there (I don’t have enough disk space for that)</li>\n<li>If I remove all the original columns through <code>remove_columns=</code> and specify a write-access path, the cache file contains correctly only the feature I’m generating (<code>length</code> in this case). However, when I add it back to the dataset through <code>add_column</code>, the method internally calls <code>flatten_indices()</code>, which again requires writing access to the dataset dir and crashes my script.</li>\n</ul>\n<p>Any ideas?</p>\n<p>Other constraints that I have are:</p>\n<ul>\n<li>I cannot keep the dataset in memory</li>\n<li>I cannot compute the lengths on the go since I need them for the length grouping sampler</li>\n<li>I cannot afford to compute each sample length every time I run the script since its it takes too long</li>\n<li>I would like to stay within the <code>datasets</code> framework since my codebase uses it in several places</li>\n</ul>", "post_number": 1, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-31T19:04:32.084Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 82, "reads": 7, "readers_count": 6, "score": 426.4, "yours": false, "topic_id": 148262, "topic_slug": "caching-only-one-feature-from-a-read-only-dataset", "display_username": "Giuseppe Attanasio", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/load-from-disk-and-read-only-filesystem/54312", "internal": true, "reflection": false, "title": "Load_from_disk and read-only filesystem", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 3220, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/caching-only-one-feature-from-a-read-only-dataset/148262/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212698, "name": "Giuseppe Attanasio", "username": "g8a9", "avatar_template": "/user_avatar/discuss.huggingface.co/g8a9/{size}/39308_2.png", "created_at": "2025-04-01T11:29:52.259Z", "cooked": "<p>I’m sorry, is this response AI-generated?<br>\nIf possibile, I would try to keep the conversation between humans (and the proposed approach does not address any of my issues <img src=\"https://emoji.discourse-cdn.com/apple/slight_smile.png?v=14\" title=\":slight_smile:\" class=\"emoji\" alt=\":slight_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"> )</p>", "post_number": 3, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-01T11:29:52.259Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 1.2, "yours": false, "topic_id": 148262, "topic_slug": "caching-only-one-feature-from-a-read-only-dataset", "display_username": "Giuseppe Attanasio", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 3220, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/caching-only-one-feature-from-a-read-only-dataset/148262/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 212794, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-04-01T16:38:49.050Z", "cooked": "<p>Hi ! maybe you can only keep the lengths in memory, and then concatenate back to the memory mapped (i.e. loaded from disk) dataset containing the audio ?</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">lengths_ds = ds.map(\n compute_length,\n remove_columns=ds.column_names,\n keep_in_memory=True\n)\nds = concatenate_datasets([ds, lengths_ds], axis=1)\n</code></pre>", "post_number": 4, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-01T16:39:14.120Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 21, "yours": false, "topic_id": 148262, "topic_slug": "caching-only-one-feature-from-a-read-only-dataset", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/caching-only-one-feature-from-a-read-only-dataset/148262/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212798, "name": "Giuseppe Attanasio", "username": "g8a9", "avatar_template": "/user_avatar/discuss.huggingface.co/g8a9/{size}/39308_2.png", "created_at": "2025-04-01T17:04:37.789Z", "cooked": "<p>Thanks! So, I guess the <code>concatenate_datasets</code> does not use any caching, right?</p>", "post_number": 5, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-01T17:04:37.789Z", "reply_count": 0, "reply_to_post_number": 4, "quote_count": 0, "incoming_link_count": 1, "reads": 5, "readers_count": 4, "score": 6, "yours": false, "topic_id": 148262, "topic_slug": "caching-only-one-feature-from-a-read-only-dataset", "display_username": "Giuseppe Attanasio", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 3220, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/caching-only-one-feature-from-a-read-only-dataset/148262/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 76, "username": "lhoestq", "name": "Quentin Lhoest", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png" }, "action_code": null, "via_email": null }, { "id": 213927, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-04-07T10:26:58.414Z", "cooked": "<p>yes correct !</p>", "post_number": 6, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-07T10:26:58.414Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 30.8, "yours": false, "topic_id": 148262, "topic_slug": "caching-only-one-feature-from-a-read-only-dataset", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/caching-only-one-feature-from-a-read-only-dataset/148262/6", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 }, { "id": "hugs", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 214065, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-07T22:27:38.728Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 7, "post_type": 3, "posts_count": 6, "updated_at": "2025-04-07T22:27:38.728Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 148262, "topic_slug": "caching-only-one-feature-from-a-read-only-dataset", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/caching-only-one-feature-from-a-read-only-dataset/148262/7", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hey,</p> <p>I want to add a feature to a large audio dataset before my training starts. In particular, it’s the length in seconds such that my HF trainer can “group_by_length” my inputs.<br> My datasets are all saved locally in a read-only folder (they were saved through <code>save_to_disk()</code>).</p> <p>What’s happening now is that:</p> <ul> <li>when I load the dataset with <code>load_from_disk()</code> that folder is by default used as cache, so any map/filter function fails since I don’t have write access to it (e.g., <a href="https://discuss.huggingface.co/t/load-from-disk-and-read-only-filesystem/54312/1">this issue</a>)</li> <li>If I pass a <code>cache_filename</code> with a path where I have write access, the cache files I’m creating are too big, since the whole dataset is cached there (I don’t have enough disk space for that)</li> <li>If I remove all the original columns through <code>remove_columns=</code> and specify a write-access path, the cache file contains correctly only the feature I’m generating (<code>length</code> in this case). However, when I add it back to the dataset through <code>add_column</code>, the method internally calls <code>flatten_indices()</code>, which again requires writing access to the dataset dir and crashes my script.</li> </ul> <p>Any ideas?</p> <p>Other constraints that I have are:</p> <ul> <li>I cannot keep the dataset in memory</li> <li>I cannot compute the lengths on the go since I need them for the length grouping sampler</li> <li>I cannot afford to compute each sample length every time I run the script since its it takes too long</li> <li>I would like to stay within the <code>datasets</code> framework since my codebase uses it in several places</li> </ul>
<p>Thanks! So, I guess the <code>concatenate_datasets</code> does not use any caching, right?</p>
Reward becomes nan when switching from full precision to fp16 for gemma3-12b-it
https://discuss.huggingface.co/t/reward-becomes-nan-when-switching-from-full-precision-to-fp16-for-gemma3-12b-it/148911
148,911
9
2025-04-04T22:09:47.197000Z
[ { "id": 213466, "name": "Qiyao Wei", "username": "QiyaoWei", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/q/8797f3/{size}.png", "created_at": "2025-04-04T22:09:47.262Z", "cooked": "<p>I am training <code>gemma3-12b-it</code> on a standard preference dataset. When I <code>accelerate launch train.py</code> on <code>gemma3-12b-it</code> in full precision, the training curve looks reasonable. However, if I switch from full precision to fp16, suddenly the logging shows <code>loss=0, grad_norm=0, reward=nan...</code>. Are multimodal models restricted to full precision training?</p>\n<pre><code class=\"lang-auto\">from datasets import load_dataset\nfrom trl import RewardTrainer, RewardConfig, DPOConfig, DPOTrainer\nfrom peft import LoraConfig, TaskType\nimport torch\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\nmodel_name = \"gemma-3-12b-it\"\nmodel = AutoModelForCausalLM.from_pretrained(model_name, attn_implementation=\"eager\")\ntokenizer = AutoTokenizer.from_pretrained(model_name)\ntrain_dataset = load_dataset(\"json\", data_files=\"training_data.json\", split=\"train\")\ntokenizer.pad_token = tokenizer.eos_token\n\ndef process_training_data(example):\n example[\"prompt\"] = example.pop(\"input\")\n example['rejected'] = example['rejected'][0]\n return example\ntrain_dataset = train_dataset.map(process_training_data)\n\ntraining_args = DPOConfig(\n dataloader_pin_memory=False,\n per_device_train_batch_size=1,\n gradient_accumulation_steps=4,\n logging_steps=10,\n # fp16=True\n)\ntraining_args.optimize_cuda_cache=True\n\npeft_config = LoraConfig(\n task_type=TaskType.SEQ_CLS,\n inference_mode=False,\n r=8,\n lora_alpha=32,\n lora_dropout=0.1,\n target_modules=[\n \"q_proj\",\n \"k_proj\",\n \"v_proj\",\n \"o_proj\",\n \"gate_proj\",\n \"up_proj\",\n \"down_proj\",\n \"lm_head\",\n ]\n)\n\ntrainer = DPOTrainer(model=model,\n args=training_args,\n processing_class=tokenizer,\n train_dataset=train_dataset,\n peft_config=peft_config)\ntrainer.train()\n</code></pre>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-04T22:09:47.262Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 144, "reads": 9, "readers_count": 8, "score": 721.8, "yours": false, "topic_id": 148911, "topic_slug": "reward-becomes-nan-when-switching-from-full-precision-to-fp16-for-gemma3-12b-it", "display_username": "Qiyao Wei", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 42125, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/reward-becomes-nan-when-switching-from-full-precision-to-fp16-for-gemma3-12b-it/148911/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213514, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-05T05:58:20.962Z", "cooked": "<p>Perhaps mixed precision training issue?</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/huggingface/transformers/issues/25021\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/transformers/issues/25021\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/transformers</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/transformers/issues/25021\" target=\"_blank\" rel=\"noopener\">fp16 DDP training in 4.31.0</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2023-07-23\" data-time=\"07:58:35\" data-timezone=\"UTC\">07:58AM - 23 Jul 23 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2023-08-31\" data-time=\"08:03:09\" data-timezone=\"UTC\">08:03AM - 31 Aug 23 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/getao\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/5/4/5476caf765dfc6ae6cead3b0624d763ec114b2e7.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"C4EAE2\">\n getao\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">### System Info\n\npytorch 1.13.1\ntransformers==4.31.0\n\n### Who can help?\n\n<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">Hi @sgugger ,\n\nI used the 4.31.0 to train a Llama model with LoRA. I observe some problems with --fp16 training and I'm not sure if it is a bug in Trainer.py:\n\nMy model is like:\n\n```\nclass MyModel(nn.Module):\n def __init__(self, model_name):\n super().__init__()\n self.model_name = model_name\n self.base_model = LlamaForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16)\n self.base_model = get_peft_model(self.base_model, lora_config)\n self.other_modules = nn.Linear(4096, 4096)\n```\n\nI used the Trainer to train the model with the following command line:\n`torchrun --nproc_per_node=4 main.py --max_steps 100000 --fp16\n`\nI find the model's gradients (in self.optimizer in the Trainer) are not fp16 but fp32. Is it correct?\n\nAlso, I find that no gradient_scaling is conducted during training since self.do_grad_scaling is always False (because self.sharded_ddp is None and args.half_precision_backend will be always \"auto\"). The current trainer.py will not correctly set up args.half_precision_backend and scaler if self.sharded_ddp is None. Are these observations expected? I'm a little confused why setting up args.half_precision_backend and scaler require sharded_ddp. As a result, I've found that during the training process, I often encounter the loss becoming NaN. I'm not sure whether it is because no gradient_scaling is conducted and half_precision_backend is not correctly set up during training.\n\nFollowing are my grad_norm (before grad_clipping) with and without --fp16. (My base model here is \"JackFram/llama-160m\" for debugging) **The results are significantly different.**\n\nWithout --fp16:\nstep 1: grad_norm=0.059\nStep 5: grad_norm=0.054\nStep 10: grad_norm=0.048\nStep 15: grad_norm=0.050\nStep 20: grad_norm=0.050\n\nWith --fp16:\nStep 1: grad_norm = nan\nStep 5: grad_norm = 129.88\nStep 10: grad_norm=126.98\nStep 15: grad_norm=149.58\nStep 20: grad_norm=80.7\n\n```\ndef compute_grad_norm(optimizer): # the function to compute grad_norm\n total_norm = 0.0\n for group in optimizer.param_groups:\n for param in group['params']:\n if param.grad is not None:\n param_norm = param.grad.data.norm(2)\n total_norm += param_norm.item() ** 2\n total_norm = torch.sqrt(torch.tensor(total_norm))\n return total_norm\n```\n\n\n### Information\n\n- [ ] The official example scripts\n- [X] My own modified scripts\n\n### Tasks\n\n- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)\n- [X] My own task or dataset (give details below)\n\n### Expected behavior\n\ndo_grad_scaling=True when --fp16 is enabled; rarely confronting loss becoming nan</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-05T05:58:20.962Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 9, "readers_count": 8, "score": 6.8, "yours": false, "topic_id": 148911, "topic_slug": "reward-becomes-nan-when-switching-from-full-precision-to-fp16-for-gemma3-12b-it", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/transformers/issues/25021", "internal": false, "reflection": false, "title": "fp16 DDP training in 4.31.0 · Issue #25021 · huggingface/transformers · GitHub", "clicks": 16 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/reward-becomes-nan-when-switching-from-full-precision-to-fp16-for-gemma3-12b-it/148911/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213613, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-05T17:58:24.251Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-05T17:58:24.251Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 1.4, "yours": false, "topic_id": 148911, "topic_slug": "reward-becomes-nan-when-switching-from-full-precision-to-fp16-for-gemma3-12b-it", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/reward-becomes-nan-when-switching-from-full-precision-to-fp16-for-gemma3-12b-it/148911/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null }, { "id": 213967, "name": "Benjamin Bossan", "username": "BenjaminB", "avatar_template": "/user_avatar/discuss.huggingface.co/benjaminb/{size}/30898_2.png", "created_at": "2025-04-07T13:23:02.302Z", "cooked": "<p>Could you check the dtype of the LoRA parameters after model initialization? Specifically, are they float16 or float32?</p>", "post_number": 4, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-07T13:23:02.302Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 7, "readers_count": 6, "score": 26.4, "yours": false, "topic_id": 148911, "topic_slug": "reward-becomes-nan-when-switching-from-full-precision-to-fp16-for-gemma3-12b-it", "display_username": "Benjamin Bossan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 14460, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/reward-becomes-nan-when-switching-from-full-precision-to-fp16-for-gemma3-12b-it/148911/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null } ]
<p>I am training <code>gemma3-12b-it</code> on a standard preference dataset. When I <code>accelerate launch train.py</code> on <code>gemma3-12b-it</code> in full precision, the training curve looks reasonable. However, if I switch from full precision to fp16, suddenly the logging shows <code>loss=0, grad_norm=0, reward=nan...</code>. Are multimodal models restricted to full precision training?</p> <pre><code class="lang-auto">from datasets import load_dataset from trl import RewardTrainer, RewardConfig, DPOConfig, DPOTrainer from peft import LoraConfig, TaskType import torch from transformers import AutoModelForCausalLM, AutoTokenizer model_name = "gemma-3-12b-it" model = AutoModelForCausalLM.from_pretrained(model_name, attn_implementation="eager") tokenizer = AutoTokenizer.from_pretrained(model_name) train_dataset = load_dataset("json", data_files="training_data.json", split="train") tokenizer.pad_token = tokenizer.eos_token def process_training_data(example): example["prompt"] = example.pop("input") example['rejected'] = example['rejected'][0] return example train_dataset = train_dataset.map(process_training_data) training_args = DPOConfig( dataloader_pin_memory=False, per_device_train_batch_size=1, gradient_accumulation_steps=4, logging_steps=10, # fp16=True ) training_args.optimize_cuda_cache=True peft_config = LoraConfig( task_type=TaskType.SEQ_CLS, inference_mode=False, r=8, lora_alpha=32, lora_dropout=0.1, target_modules=[ "q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj", "lm_head", ] ) trainer = DPOTrainer(model=model, args=training_args, processing_class=tokenizer, train_dataset=train_dataset, peft_config=peft_config) trainer.train() </code></pre>
<p>Perhaps mixed precision training issue?</p><aside class="onebox githubissue" data-onebox-src="https://github.com/huggingface/transformers/issues/25021"> <header class="source"> <a href="https://github.com/huggingface/transformers/issues/25021" target="_blank" rel="noopener">github.com/huggingface/transformers</a> </header> <article class="onebox-body"> <div class="github-row"> <div class="github-icon-container" title="Issue" data-github-private-repo="false"> <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg> </div> <div class="github-info-container"> <h4> <a href="https://github.com/huggingface/transformers/issues/25021" target="_blank" rel="noopener">fp16 DDP training in 4.31.0</a> </h4> <div class="github-info"> <div class="date"> opened <span class="discourse-local-date" data-format="ll" data-date="2023-07-23" data-time="07:58:35" data-timezone="UTC">07:58AM - 23 Jul 23 UTC</span> </div> <div class="date"> closed <span class="discourse-local-date" data-format="ll" data-date="2023-08-31" data-time="08:03:09" data-timezone="UTC">08:03AM - 31 Aug 23 UTC</span> </div> <div class="user"> <a href="https://github.com/getao" target="_blank" rel="noopener"> <img alt="" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/5/4/5476caf765dfc6ae6cead3b0624d763ec114b2e7.png" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="C4EAE2"> getao </a> </div> </div> <div class="labels"> </div> </div> </div> <div class="github-row"> <p class="github-body-container">### System Info pytorch 1.13.1 transformers==4.31.0 ### Who can help? <span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">Hi @sgugger , I used the 4.31.0 to train a Llama model with LoRA. I observe some problems with --fp16 training and I'm not sure if it is a bug in Trainer.py: My model is like: ``` class MyModel(nn.Module): def __init__(self, model_name): super().__init__() self.model_name = model_name self.base_model = LlamaForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16) self.base_model = get_peft_model(self.base_model, lora_config) self.other_modules = nn.Linear(4096, 4096) ``` I used the Trainer to train the model with the following command line: `torchrun --nproc_per_node=4 main.py --max_steps 100000 --fp16 ` I find the model's gradients (in self.optimizer in the Trainer) are not fp16 but fp32. Is it correct? Also, I find that no gradient_scaling is conducted during training since self.do_grad_scaling is always False (because self.sharded_ddp is None and args.half_precision_backend will be always "auto"). The current trainer.py will not correctly set up args.half_precision_backend and scaler if self.sharded_ddp is None. Are these observations expected? I'm a little confused why setting up args.half_precision_backend and scaler require sharded_ddp. As a result, I've found that during the training process, I often encounter the loss becoming NaN. I'm not sure whether it is because no gradient_scaling is conducted and half_precision_backend is not correctly set up during training. Following are my grad_norm (before grad_clipping) with and without --fp16. (My base model here is "JackFram/llama-160m" for debugging) **The results are significantly different.** Without --fp16: step 1: grad_norm=0.059 Step 5: grad_norm=0.054 Step 10: grad_norm=0.048 Step 15: grad_norm=0.050 Step 20: grad_norm=0.050 With --fp16: Step 1: grad_norm = nan Step 5: grad_norm = 129.88 Step 10: grad_norm=126.98 Step 15: grad_norm=149.58 Step 20: grad_norm=80.7 ``` def compute_grad_norm(optimizer): # the function to compute grad_norm total_norm = 0.0 for group in optimizer.param_groups: for param in group['params']: if param.grad is not None: param_norm = param.grad.data.norm(2) total_norm += param_norm.item() ** 2 total_norm = torch.sqrt(torch.tensor(total_norm)) return total_norm ``` ### Information - [ ] The official example scripts - [X] My own modified scripts ### Tasks - [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...) - [X] My own task or dataset (give details below) ### Expected behavior do_grad_scaling=True when --fp16 is enabled; rarely confronting loss becoming nan</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Gradio problem, gradio change not functioning good for gr.Image
https://discuss.huggingface.co/t/gradio-problem-gradio-change-not-functioning-good-for-gr-image/149081
149,081
5
2025-04-06T07:18:22.104000Z
[ { "id": 213707, "name": "Zhang", "username": "ironly3000", "avatar_template": "/user_avatar/discuss.huggingface.co/ironly3000/{size}/42120_2.png", "created_at": "2025-04-06T07:18:22.167Z", "cooked": "<h2><a name=\"p-213707-fastapi-gradio-error-typeerror-argument-of-type-bool-is-not-iterable-1\" class=\"anchor\" href=\"#p-213707-fastapi-gradio-error-typeerror-argument-of-type-bool-is-not-iterable-1\"></a><img src=\"https://emoji.discourse-cdn.com/apple/red_exclamation_mark.png?v=14\" title=\":red_exclamation_mark:\" class=\"emoji\" alt=\":red_exclamation_mark:\" loading=\"lazy\" width=\"20\" height=\"20\"> FastAPI / Gradio Error: <code>TypeError: argument of type 'bool' is not iterable</code></h2>\n<p>I’m running into an error when using <strong>Gradio</strong> (wrapped in <strong>FastAPI</strong>, served with <strong>uvicorn</strong>). When a frontend interaction is triggered, I get the following traceback (excerpt):</p>\n<pre><code class=\"lang-auto\">TypeError: argument of type 'bool' is not iterable\nFile \"gradio_client\\utils.py\", line 898, in get_type\n if \"const\" in schema:\n</code></pre>\n<h3><a name=\"p-213707-context-2\" class=\"anchor\" href=\"#p-213707-context-2\"></a><img src=\"https://emoji.discourse-cdn.com/apple/magnifying_glass_tilted_left.png?v=14\" title=\":magnifying_glass_tilted_left:\" class=\"emoji\" alt=\":magnifying_glass_tilted_left:\" loading=\"lazy\" width=\"20\" height=\"20\"> Context:</h3>\n<p>Here’s the code that causes the error:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">im_display.change(fn=update_image, inputs=[im_display], outputs=[s3image])\n</code></pre>\n<ul>\n<li><code>im_display</code> is a <code>gr.Image()</code></li>\n<li><code>s3image</code> is also a <code>gr.Image()</code></li>\n<li>The function <code>update_image</code> returns <code>gr.update(...)</code></li>\n</ul>\n<p><img src=\"https://emoji.discourse-cdn.com/apple/warning.png?v=14\" title=\":warning:\" class=\"emoji\" alt=\":warning:\" loading=\"lazy\" width=\"20\" height=\"20\"> If I change the output to a <code>gr.Textbox()</code>, like this:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">im_display.change(fn=update_image, inputs=[im_display], outputs=[gr.Textbox()])\n</code></pre>\n<p>Then the error <strong>does not</strong> happen. So the issue seems to be related to using <code>gr.Image</code> as the output.</p>\n<h3><a name=\"p-213707-additional-info-3\" class=\"anchor\" href=\"#p-213707-additional-info-3\"></a><img src=\"https://emoji.discourse-cdn.com/apple/repeat_button.png?v=14\" title=\":repeat_button:\" class=\"emoji\" alt=\":repeat_button:\" loading=\"lazy\" width=\"20\" height=\"20\"> Additional Info:</h3>\n<ul>\n<li>The error still happens no matter what arguments I pass to <code>gr.update()</code>, e.g., <code>value=...</code>, <code>visible=True</code>, etc.</li>\n<li>Everything works fine when returning updates to a <code>Textbox</code>.</li>\n</ul>\n<hr>\n<h3><a name=\"p-213707-question-4\" class=\"anchor\" href=\"#p-213707-question-4\"></a><img src=\"https://emoji.discourse-cdn.com/apple/red_question_mark.png?v=14\" title=\":red_question_mark:\" class=\"emoji\" alt=\":red_question_mark:\" loading=\"lazy\" width=\"20\" height=\"20\"> Question:</h3>\n<p>Has anyone else run into this issue when returning <code>gr.update()</code> to a <code>gr.Image()</code> output?<br>\nIs there a workaround or fix for this schema parsing issue?</p>\n<p>My environment:</p>\n<ul>\n<li>Windows / Conda</li>\n<li>Python 3.x</li>\n<li>Gradio installed via pip (5.20)</li>\n</ul>\n<p>Any help is appreciated! I can provide a minimal reproducible example if needed.</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-06T07:18:22.167Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 187, "reads": 9, "readers_count": 8, "score": 931.8, "yours": false, "topic_id": 149081, "topic_slug": "gradio-problem-gradio-change-not-functioning-good-for-gr-image", "display_username": "Zhang", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 85285, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/gradio-problem-gradio-change-not-functioning-good-for-gr-image/149081/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213725, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-06T10:17:00.762Z", "cooked": "<blockquote>\n<p>TypeError: argument of type ‘bool’ is not iterable<br>\nFile “gradio_client\\utils.py”, line 898, in get_type<br>\nif “const” in schema:</p>\n</blockquote>\n<p>The conditions and components are completely different, but the error content is exactly the same, so it might be the same cause…</p><aside class=\"quote quote-modified\" data-post=\"1\" data-topic=\"146226\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/saurabh502/48/43507_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/error-no-api-found/146226\">Error : No API Found</a> <a class=\"badge-category__wrapper \" href=\"/c/spaces/24\"><span data-category-id=\"24\" style=\"--category-badge-color: #25AAE2; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category to ask any questions about Spaces or to share your work.\"><span class=\"badge-category__name\">Spaces</span></span></a>\n </div>\n <blockquote>\n Hi, I have built a Gemini 2.0 flash based photo editing app with gradio ui. This app is running perfectly fine on my local system, but when I am trying to run it on spaces it is giving me Error : No API Found. \n <a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/6/4/646a62bd5ca4f08f055d7df888e653757ded180a.png\" data-download-href=\"/uploads/short-url/ekjFZLSkYworys6XVI8N5Uq8FCi.png?dl=1\" title=\"e1\" rel=\"noopener nofollow ugc\">[e1]</a> \nI have used gemini api keys in secrects \nCode : \n<a href=\"https://huggingface.co/spaces/Saurabh502/Gemini-photo/resolve/main/app.py\" class=\"onebox\" target=\"_blank\" rel=\"noopener\">https://huggingface.co/spaces/Saurabh502/Gemini-photo/resolve/main/app.py</a> \nPlease let me know your thoughts, on how to resolve this. Thanks\n </blockquote>\n</aside>\n\n<pre><code class=\"lang-auto\">pydantic==2.10.6\n</code></pre>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-06T10:17:00.762Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 19, "reads": 8, "readers_count": 7, "score": 111.6, "yours": false, "topic_id": 149081, "topic_slug": "gradio-problem-gradio-change-not-functioning-good-for-gr-image", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/error-no-api-found/146226", "internal": true, "reflection": false, "title": "Error : No API Found", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/gradio-problem-gradio-change-not-functioning-good-for-gr-image/149081/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213926, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-07T10:21:06.325Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-07T10:21:06.325Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 1, "yours": false, "topic_id": 149081, "topic_slug": "gradio-problem-gradio-change-not-functioning-good-for-gr-image", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/gradio-problem-gradio-change-not-functioning-good-for-gr-image/149081/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<h2><a name="p-213707-fastapi-gradio-error-typeerror-argument-of-type-bool-is-not-iterable-1" class="anchor" href="#p-213707-fastapi-gradio-error-typeerror-argument-of-type-bool-is-not-iterable-1"></a><img src="https://emoji.discourse-cdn.com/apple/red_exclamation_mark.png?v=14" title=":red_exclamation_mark:" class="emoji" alt=":red_exclamation_mark:" loading="lazy" width="20" height="20"> FastAPI / Gradio Error: <code>TypeError: argument of type 'bool' is not iterable</code></h2> <p>I’m running into an error when using <strong>Gradio</strong> (wrapped in <strong>FastAPI</strong>, served with <strong>uvicorn</strong>). When a frontend interaction is triggered, I get the following traceback (excerpt):</p> <pre><code class="lang-auto">TypeError: argument of type 'bool' is not iterable File "gradio_client\utils.py", line 898, in get_type if "const" in schema: </code></pre> <h3><a name="p-213707-context-2" class="anchor" href="#p-213707-context-2"></a><img src="https://emoji.discourse-cdn.com/apple/magnifying_glass_tilted_left.png?v=14" title=":magnifying_glass_tilted_left:" class="emoji" alt=":magnifying_glass_tilted_left:" loading="lazy" width="20" height="20"> Context:</h3> <p>Here’s the code that causes the error:</p> <pre data-code-wrap="python"><code class="lang-python">im_display.change(fn=update_image, inputs=[im_display], outputs=[s3image]) </code></pre> <ul> <li><code>im_display</code> is a <code>gr.Image()</code></li> <li><code>s3image</code> is also a <code>gr.Image()</code></li> <li>The function <code>update_image</code> returns <code>gr.update(...)</code></li> </ul> <p><img src="https://emoji.discourse-cdn.com/apple/warning.png?v=14" title=":warning:" class="emoji" alt=":warning:" loading="lazy" width="20" height="20"> If I change the output to a <code>gr.Textbox()</code>, like this:</p> <pre data-code-wrap="python"><code class="lang-python">im_display.change(fn=update_image, inputs=[im_display], outputs=[gr.Textbox()]) </code></pre> <p>Then the error <strong>does not</strong> happen. So the issue seems to be related to using <code>gr.Image</code> as the output.</p> <h3><a name="p-213707-additional-info-3" class="anchor" href="#p-213707-additional-info-3"></a><img src="https://emoji.discourse-cdn.com/apple/repeat_button.png?v=14" title=":repeat_button:" class="emoji" alt=":repeat_button:" loading="lazy" width="20" height="20"> Additional Info:</h3> <ul> <li>The error still happens no matter what arguments I pass to <code>gr.update()</code>, e.g., <code>value=...</code>, <code>visible=True</code>, etc.</li> <li>Everything works fine when returning updates to a <code>Textbox</code>.</li> </ul> <hr> <h3><a name="p-213707-question-4" class="anchor" href="#p-213707-question-4"></a><img src="https://emoji.discourse-cdn.com/apple/red_question_mark.png?v=14" title=":red_question_mark:" class="emoji" alt=":red_question_mark:" loading="lazy" width="20" height="20"> Question:</h3> <p>Has anyone else run into this issue when returning <code>gr.update()</code> to a <code>gr.Image()</code> output?<br> Is there a workaround or fix for this schema parsing issue?</p> <p>My environment:</p> <ul> <li>Windows / Conda</li> <li>Python 3.x</li> <li>Gradio installed via pip (5.20)</li> </ul> <p>Any help is appreciated! I can provide a minimal reproducible example if needed.</p>
<blockquote> <p>TypeError: argument of type ‘bool’ is not iterable<br> File “gradio_client\utils.py”, line 898, in get_type<br> if “const” in schema:</p> </blockquote> <p>The conditions and components are completely different, but the error content is exactly the same, so it might be the same cause…</p><aside class="quote quote-modified" data-post="1" data-topic="146226"> <div class="title"> <div class="quote-controls"></div> <img alt="" width="24" height="24" src="https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/saurabh502/48/43507_2.png" class="avatar"> <a href="https://discuss.huggingface.co/t/error-no-api-found/146226">Error : No API Found</a> <a class="badge-category__wrapper " href="/c/spaces/24"><span data-category-id="24" style="--category-badge-color: #25AAE2; --category-badge-text-color: #FFFFFF;" data-drop-close="true" class="badge-category " title="Use this category to ask any questions about Spaces or to share your work."><span class="badge-category__name">Spaces</span></span></a> </div> <blockquote> Hi, I have built a Gemini 2.0 flash based photo editing app with gradio ui. This app is running perfectly fine on my local system, but when I am trying to run it on spaces it is giving me Error : No API Found. <a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/6/4/646a62bd5ca4f08f055d7df888e653757ded180a.png" data-download-href="/uploads/short-url/ekjFZLSkYworys6XVI8N5Uq8FCi.png?dl=1" title="e1" rel="noopener nofollow ugc">[e1]</a> I have used gemini api keys in secrects Code : <a href="https://huggingface.co/spaces/Saurabh502/Gemini-photo/resolve/main/app.py" class="onebox" target="_blank" rel="noopener">https://huggingface.co/spaces/Saurabh502/Gemini-photo/resolve/main/app.py</a> Please let me know your thoughts, on how to resolve this. Thanks </blockquote> </aside> <pre><code class="lang-auto">pydantic==2.10.6 </code></pre>
Sharing Gradio app in private Space
https://discuss.huggingface.co/t/sharing-gradio-app-in-private-space/149056
149,056
24
2025-04-06T03:03:51.546000Z
[ { "id": 213677, "name": "Sasha Kuzovlev", "username": "sasha-kuzovlev", "avatar_template": "/user_avatar/discuss.huggingface.co/sasha-kuzovlev/{size}/44857_2.png", "created_at": "2025-04-06T03:03:51.598Z", "cooked": "<p>Hello Community, tell me if there is a way to give a link to the Radio application in a private Space. The way to make Space public is not suitable, and adding participants to Collaboration is not suitable either. I just need a link to the Gradio app that customers can open. If I use the standard Gradio sharing method, I get a User Warning: Setting share=True is not supported on Hugging Face Spaces</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-06T03:03:51.598Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 106, "reads": 8, "readers_count": 7, "score": 526.6, "yours": false, "topic_id": 149056, "topic_slug": "sharing-gradio-app-in-private-space", "display_username": "Sasha Kuzovlev", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89603, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-gradio-app-in-private-space/149056/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213684, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-06T04:12:56.302Z", "cooked": "<p>I think it would be quite difficult to use a private space from the outside without going through the API. Also, even with the API, normal requests using curl and other methods are more likely to fail than with a dedicated client.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://www.gradio.app/guides/getting-started-with-the-python-client\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/1/1/1130c1c3169693f6b3624e85dda1c7b816ecbc0c.png\" class=\"site-icon\" data-dominant-color=\"F99D00\" width=\"64\" height=\"64\">\n\n <a href=\"https://www.gradio.app/guides/getting-started-with-the-python-client\" target=\"_blank\" rel=\"noopener\">gradio.app</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/357;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/5/4532d24411c1a1e834a20ef8aada4248d8075883_2_690x357.jpeg\" class=\"thumbnail\" data-dominant-color=\"E5E1DE\" width=\"690\" height=\"357\"></div>\n\n<h3><a href=\"https://www.gradio.app/guides/getting-started-with-the-python-client\" target=\"_blank\" rel=\"noopener\">Getting Started With The Python Client</a></h3>\n\n <p>A Step-by-Step Gradio Tutorial</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"quote\" data-post=\"1\" data-topic=\"39608\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/asach/48/16077_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/embedding-a-private-space-on-my-website/39608\">Embedding a private space on my website</a> <a class=\"badge-category__wrapper \" href=\"/c/spaces/24\"><span data-category-id=\"24\" style=\"--category-badge-color: #25AAE2; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category to ask any questions about Spaces or to share your work.\"><span class=\"badge-category__name\">Spaces</span></span></a>\n </div>\n <blockquote>\n Is there any work around for this, using token or something? \nIt would be great. \nThank You\n </blockquote>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-06T04:12:56.302Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 7, "readers_count": 6, "score": 31.4, "yours": false, "topic_id": 149056, "topic_slug": "sharing-gradio-app-in-private-space", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://www.gradio.app/guides/getting-started-with-the-python-client", "internal": false, "reflection": false, "title": "Getting Started With The Python Client", "clicks": 4 }, { "url": "https://discuss.huggingface.co/t/embedding-a-private-space-on-my-website/39608", "internal": true, "reflection": false, "title": "Embedding a private space on my website", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-gradio-app-in-private-space/149056/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213690, "name": "Sasha Kuzovlev", "username": "sasha-kuzovlev", "avatar_template": "/user_avatar/discuss.huggingface.co/sasha-kuzovlev/{size}/44857_2.png", "created_at": "2025-04-06T05:10:30.411Z", "cooked": "<p>Thanks! The solution to make a separate static application with a connection to a private Space via hf_token sounds great!</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-06T05:10:30.411Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 2, "reads": 6, "readers_count": 5, "score": 26.2, "yours": false, "topic_id": 149056, "topic_slug": "sharing-gradio-app-in-private-space", "display_username": "Sasha Kuzovlev", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89603, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-gradio-app-in-private-space/149056/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 213764, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-06T17:11:22.296Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-06T17:11:22.296Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 0.8, "yours": false, "topic_id": 149056, "topic_slug": "sharing-gradio-app-in-private-space", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-gradio-app-in-private-space/149056/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello Community, tell me if there is a way to give a link to the Radio application in a private Space. The way to make Space public is not suitable, and adding participants to Collaboration is not suitable either. I just need a link to the Gradio app that customers can open. If I use the standard Gradio sharing method, I get a User Warning: Setting share=True is not supported on Hugging Face Spaces</p>
<p>I think it would be quite difficult to use a private space from the outside without going through the API. Also, even with the API, normal requests using curl and other methods are more likely to fail than with a dedicated client.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://www.gradio.app/guides/getting-started-with-the-python-client"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/1/1/1130c1c3169693f6b3624e85dda1c7b816ecbc0c.png" class="site-icon" data-dominant-color="F99D00" width="64" height="64"> <a href="https://www.gradio.app/guides/getting-started-with-the-python-client" target="_blank" rel="noopener">gradio.app</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/357;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/5/4532d24411c1a1e834a20ef8aada4248d8075883_2_690x357.jpeg" class="thumbnail" data-dominant-color="E5E1DE" width="690" height="357"></div> <h3><a href="https://www.gradio.app/guides/getting-started-with-the-python-client" target="_blank" rel="noopener">Getting Started With The Python Client</a></h3> <p>A Step-by-Step Gradio Tutorial</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="quote" data-post="1" data-topic="39608"> <div class="title"> <div class="quote-controls"></div> <img alt="" width="24" height="24" src="https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/asach/48/16077_2.png" class="avatar"> <a href="https://discuss.huggingface.co/t/embedding-a-private-space-on-my-website/39608">Embedding a private space on my website</a> <a class="badge-category__wrapper " href="/c/spaces/24"><span data-category-id="24" style="--category-badge-color: #25AAE2; --category-badge-text-color: #FFFFFF;" data-drop-close="true" class="badge-category " title="Use this category to ask any questions about Spaces or to share your work."><span class="badge-category__name">Spaces</span></span></a> </div> <blockquote> Is there any work around for this, using token or something? It would be great. Thank You </blockquote> </aside>
Reduce the restart time
https://discuss.huggingface.co/t/reduce-the-restart-time/148993
148,993
24
2025-04-05T14:54:14.995000Z
[ { "id": 213595, "name": "Sasha Kuzovlev", "username": "sasha-kuzovlev", "avatar_template": "/user_avatar/discuss.huggingface.co/sasha-kuzovlev/{size}/44857_2.png", "created_at": "2025-04-05T14:54:15.047Z", "cooked": "<p>Hi! I’m testing Gradio on a simple interface. With every simple update, such as adding a button, the HF Space application is restarting. It takes as much as a few minutes. It is impossible to work when you have to wait for several minutes to see the result of code changes. Please tell me how you can speed up or even cancel the restart of the application with each update? Perhaps this can be done using the Gradio settings? Or maybe there are Space settings?</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-05T14:54:15.047Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 52, "reads": 6, "readers_count": 5, "score": 276.2, "yours": false, "topic_id": 148993, "topic_slug": "reduce-the-restart-time", "display_username": "Sasha Kuzovlev", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89603, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/reduce-the-restart-time/148993/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213596, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-05T14:57:25.926Z", "cooked": "<p>Gradio has that feature locally.<br>\nAlso, if you want to use the Dev mode for Spaces in Hugging Face, you will need a Pro subscription.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://www.gradio.app/guides/developing-faster-with-reload-mode\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/1/1/1130c1c3169693f6b3624e85dda1c7b816ecbc0c.png\" class=\"site-icon\" data-dominant-color=\"F99D00\" width=\"64\" height=\"64\">\n\n <a href=\"https://www.gradio.app/guides/developing-faster-with-reload-mode\" target=\"_blank\" rel=\"noopener\">gradio.app</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/357;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/5/4532d24411c1a1e834a20ef8aada4248d8075883_2_690x357.jpeg\" class=\"thumbnail\" data-dominant-color=\"E5E1DE\" width=\"690\" height=\"357\"></div>\n\n<h3><a href=\"https://www.gradio.app/guides/developing-faster-with-reload-mode\" target=\"_blank\" rel=\"noopener\">Developing Faster With Reload Mode</a></h3>\n\n <p>A Step-by-Step Gradio Tutorial</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/spaces-dev-mode\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/spaces-dev-mode\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n \n\n<h3><a href=\"https://huggingface.co/blog/spaces-dev-mode\" target=\"_blank\" rel=\"noopener\">Introducing Spaces Dev Mode for a seamless developer experience</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-05T14:57:25.926Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 6, "readers_count": 5, "score": 26.2, "yours": false, "topic_id": 148993, "topic_slug": "reduce-the-restart-time", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://www.gradio.app/guides/developing-faster-with-reload-mode", "internal": false, "reflection": false, "title": "Developing Faster With Reload Mode", "clicks": 6 }, { "url": "https://huggingface.co/blog/spaces-dev-mode", "internal": false, "reflection": false, "title": "Introducing Spaces Dev Mode for a seamless developer experience", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/reduce-the-restart-time/148993/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213617, "name": "Sasha Kuzovlev", "username": "sasha-kuzovlev", "avatar_template": "/user_avatar/discuss.huggingface.co/sasha-kuzovlev/{size}/44857_2.png", "created_at": "2025-04-05T18:15:29.401Z", "cooked": "<p>Thanks, Dev Mode helps!!!</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-05T18:15:29.401Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 16, "yours": false, "topic_id": 148993, "topic_slug": "reduce-the-restart-time", "display_username": "Sasha Kuzovlev", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89603, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/reduce-the-restart-time/148993/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 213700, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-06T06:15:48.120Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-06T06:15:48.120Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 4, "readers_count": 3, "score": 5.8, "yours": false, "topic_id": 148993, "topic_slug": "reduce-the-restart-time", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/reduce-the-restart-time/148993/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi! I’m testing Gradio on a simple interface. With every simple update, such as adding a button, the HF Space application is restarting. It takes as much as a few minutes. It is impossible to work when you have to wait for several minutes to see the result of code changes. Please tell me how you can speed up or even cancel the restart of the application with each update? Perhaps this can be done using the Gradio settings? Or maybe there are Space settings?</p>
<p>Gradio has that feature locally.<br> Also, if you want to use the Dev mode for Spaces in Hugging Face, you will need a Pro subscription.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://www.gradio.app/guides/developing-faster-with-reload-mode"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/1/1/1130c1c3169693f6b3624e85dda1c7b816ecbc0c.png" class="site-icon" data-dominant-color="F99D00" width="64" height="64"> <a href="https://www.gradio.app/guides/developing-faster-with-reload-mode" target="_blank" rel="noopener">gradio.app</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/357;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/5/4532d24411c1a1e834a20ef8aada4248d8075883_2_690x357.jpeg" class="thumbnail" data-dominant-color="E5E1DE" width="690" height="357"></div> <h3><a href="https://www.gradio.app/guides/developing-faster-with-reload-mode" target="_blank" rel="noopener">Developing Faster With Reload Mode</a></h3> <p>A Step-by-Step Gradio Tutorial</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/blog/spaces-dev-mode"> <header class="source"> <a href="https://huggingface.co/blog/spaces-dev-mode" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <h3><a href="https://huggingface.co/blog/spaces-dev-mode" target="_blank" rel="noopener">Introducing Spaces Dev Mode for a seamless developer experience</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
NLP chapter 3 question
https://discuss.huggingface.co/t/nlp-chapter-3-question/148420
148,420
5
2025-04-01T14:28:15.948000Z
[ { "id": 212775, "name": "Ripunjay Tiwari", "username": "Rtdon8363737", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/{size}.png", "created_at": "2025-04-01T14:28:16.006Z", "cooked": "<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/a/1/a1418bed003690b4964efd7a9eedd3174cb299ff.png\" data-download-href=\"/uploads/short-url/n0xiWVIjxYgv27rS3iTmtwhZnKn.png?dl=1\" title=\"Screenshot 2025-04-01 195443\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/1/a1418bed003690b4964efd7a9eedd3174cb299ff_2_690x242.png\" alt=\"Screenshot 2025-04-01 195443\" data-base62-sha1=\"n0xiWVIjxYgv27rS3iTmtwhZnKn\" width=\"690\" height=\"242\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/1/a1418bed003690b4964efd7a9eedd3174cb299ff_2_690x242.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/1/a1418bed003690b4964efd7a9eedd3174cb299ff_2_1035x363.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/1/a1418bed003690b4964efd7a9eedd3174cb299ff_2_1380x484.png 2x\" data-dominant-color=\"F5F5F6\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">Screenshot 2025-04-01 195443</span><span class=\"informations\">1820×639 47.4 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div><br>\ni tried import adam_v2, as well as just opt object but getting error</p>\n<p>ValueError: Could not interpret optimizer identifier: &lt;keras.src.optimizers.adam.Adam object at 0x78d78061c650&gt;</p>", "post_number": 1, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-01T14:28:16.006Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 20, "reads": 9, "readers_count": 8, "score": 116.8, "yours": false, "topic_id": 148420, "topic_slug": "nlp-chapter-3-question", "display_username": "Ripunjay Tiwari", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89172, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/nlp-chapter-3-question/148420/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212785, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-01T15:19:41.040Z", "cooked": "<p>Apparently, there is a version incompatibility issue between Keras and TensorFlow that has been around for a long time. The solution differs for each version…</p>\n<p>For more information, search for the version you want to use…</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/keras-team/keras/issues/19262\">\n <header class=\"source\">\n\n <a href=\"https://github.com/keras-team/keras/issues/19262\" target=\"_blank\" rel=\"noopener\">github.com/keras-team/keras</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/keras-team/keras/issues/19262\" target=\"_blank\" rel=\"noopener\">ValueError: Could not interpret optimizer identifier: &lt;keras.src.optimizers.adam.Adam object at 0x79d9071160e0&gt; </a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-03-07\" data-time=\"05:56:10\" data-timezone=\"UTC\">05:56AM - 07 Mar 24 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-05-09\" data-time=\"01:49:19\" data-timezone=\"UTC\">01:49AM - 09 May 24 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/YikunHan42\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/3/f/3f815de275246e29e175fcf342f8a5fc8df9992b.jpeg\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"705C38\">\n YikunHan42\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n type:support\n </span>\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n stat:awaiting response from contributor\n </span>\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n stale\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">```python\nimport tensorflow as tf\nfrom datasets import load_dataset\nfrom tran<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">sformers import AutoTokenizer, TFAutoModelForSequenceClassification, DataCollatorWithPadding\nfrom tensorflow.keras.optimizers import Adam\nfrom tensorflow.keras.optimizers.schedules import PolynomialDecay\nfrom tensorflow.keras.losses import SparseCategoricalCrossentropy\n\ndef prepare_imdb_dataset(tokenizer):\n \"\"\"\n Prepares the IMDB dataset for training and validation.\n\n Args:\n tokenizer: The tokenizer to use for text tokenization.\n\n Returns:\n A tuple containing the tokenized training and validation datasets.\n \"\"\"\n imdb = load_dataset(\"imdb\")\n train_set = imdb['train'].map(lambda x: tokenizer(x['text'], truncation=True), batched=True)\n test_set = imdb['test'].map(lambda x: tokenizer(x['text'], truncation=True), batched=True)\n return train_set, test_set\n\ntokenizer = AutoTokenizer.from_pretrained(\"distilbert-base-uncased\")\nmodel = TFAutoModelForSequenceClassification.from_pretrained(\"distilbert-base-uncased\", num_labels=2)\n\ntrain_set, test_set = prepare_imdb_dataset(tokenizer)\n\ndata_collator = DataCollatorWithPadding(tokenizer=tokenizer, return_tensors=\"tf\")\n\ntf_train_dataset = train_set.to_tf_dataset(\n columns=[\"attention_mask\", \"input_ids\"],\n label_cols=[\"label\"],\n shuffle=True,\n collate_fn=data_collator,\n batch_size=8,\n)\n\ntf_validation_dataset = test_set.to_tf_dataset(\n columns=[\"attention_mask\", \"input_ids\"],\n label_cols=[\"label\"],\n shuffle=False,\n collate_fn=data_collator,\n batch_size=8,\n)\n\nbatch_size = 16\nnum_epochs = 1\nnum_train_steps = len(tf_train_dataset) * num_epochs\nlr_scheduler = PolynomialDecay(\n initial_learning_rate=5e-5, end_learning_rate=0.0, decay_steps=num_train_steps\n)\n\noptimizer = Adam(learning_rate=lr_scheduler)\nloss = SparseCategoricalCrossentropy(from_logits=True)\nmodel.compile(optimizer=optimizer, loss=loss, metrics=[\"accuracy\"])\n\nmodel.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=5)\n\n```\n\n```\nSome weights of the PyTorch model were not used when initializing the TF 2.0 model TFDistilBertForSequenceClassification: ['vocab_layer_norm.weight', 'vocab_transform.weight', 'vocab_projector.bias', 'vocab_transform.bias', 'vocab_layer_norm.bias']\n- This IS expected if you are initializing TFDistilBertForSequenceClassification from a PyTorch model trained on another task or with another architecture (e.g. initializing a TFBertForSequenceClassification model from a BertForPreTraining model).\n- This IS NOT expected if you are initializing TFDistilBertForSequenceClassification from a PyTorch model that you expect to be exactly identical (e.g. initializing a TFBertForSequenceClassification model from a BertForSequenceClassification model).\nSome weights or buffers of the TF 2.0 model TFDistilBertForSequenceClassification were not initialized from the PyTorch model and are newly initialized: ['pre_classifier.weight', 'pre_classifier.bias', 'classifier.weight', 'classifier.bias']\nYou should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\nMap: 100%\n 25000/25000 [00:23&lt;00:00, 1086.84 examples/s]\nMap: 100%\n 25000/25000 [00:20&lt;00:00, 1304.86 examples/s]\n---------------------------------------------------------------------------\nValueError Traceback (most recent call last)\n[&lt;ipython-input-17-ac80246ded67&gt;](https://localhost:8080/#) in &lt;cell line: 55&gt;()\n 53 optimizer = Adam(learning_rate=lr_scheduler)\n 54 loss = SparseCategoricalCrossentropy(from_logits=True)\n---&gt; 55 model.compile(optimizer=optimizer, loss=loss, metrics=[\"accuracy\"])\n 56 \n 57 model.fit(tf_train_dataset, validation_data=tf_validation_dataset, epochs=5)\n\n2 frames\n[/usr/local/lib/python3.10/dist-packages/tf_keras/src/optimizers/__init__.py](https://localhost:8080/#) in get(identifier, **kwargs)\n 332 )\n 333 else:\n--&gt; 334 raise ValueError(\n 335 f\"Could not interpret optimizer identifier: {identifier}\"\n 336 )\n\nValueError: Could not interpret optimizer identifier: &lt;keras.src.optimizers.adam.Adam object at 0x79d9071160e0&gt;\n```</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"quote\" data-post=\"1\" data-topic=\"76209\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://avatars.discourse-cdn.com/v4/letter/g/77aa72/48.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/pretrain-model-not-accepting-optimizer/76209\">Pretrain model not accepting optimizer</a> <a class=\"badge-category__wrapper \" href=\"/c/transformers/9\"><span data-category-id=\"9\" style=\"--category-badge-color: #F7941D; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"This category is for any question related to the Transformers library. You can also file an issue.\"><span class=\"badge-category__name\">🤗Transformers</span></span></a>\n </div>\n <blockquote>\n For this code, \nmodel = TFAutoModelForSequenceClassification.from_pretrained(“bert-base-cased”, num_labels=3) \nmodel.compile( \noptimizer = tf.keras.optimizers.Adam(learning_rate=5e-5) \n) \nThis gives me this error ValueError: Could not interpret optimizer identifier: &lt;keras.src.optimizers.adam.Adam object at 0x7e0d28e55fc0&gt; \nwhat to do? \nI am using google colab\n </blockquote>\n</aside>\n<aside class=\"onebox stackexchange\" data-onebox-src=\"https://stackoverflow.com/questions/50056356/could-not-interpret-optimizer-identifier-error-in-keras\">\n <header class=\"source\">\n\n <a href=\"https://stackoverflow.com/questions/50056356/could-not-interpret-optimizer-identifier-error-in-keras\" target=\"_blank\" rel=\"noopener\">stackoverflow.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <a href=\"https://stackoverflow.com/users/9708599/nehemia\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"Nehemia\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/b/5/b56a21d6a20fdcdc326d595eefce3b05bb79120b.png\" class=\"thumbnail onebox-avatar\" data-dominant-color=\"E873E2\" width=\"256\" height=\"256\">\n </a>\n\n<h4>\n <a href=\"https://stackoverflow.com/questions/50056356/could-not-interpret-optimizer-identifier-error-in-keras\" target=\"_blank\" rel=\"noopener\">\"Could not interpret optimizer identifier\" error in Keras</a>\n</h4>\n\n<div class=\"tags\">\n <strong>python, python-3.x, tensorflow, keras</strong>\n</div>\n\n<div class=\"date\">\n asked by\n \n <a href=\"https://stackoverflow.com/users/9708599/nehemia\" target=\"_blank\" rel=\"noopener\">\n Nehemia\n </a>\n on <a href=\"https://stackoverflow.com/questions/50056356/could-not-interpret-optimizer-identifier-error-in-keras\" target=\"_blank\" rel=\"noopener\">06:15AM - 27 Apr 18 UTC</a>\n</div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-01T15:19:41.040Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 11.6, "yours": false, "topic_id": 148420, "topic_slug": "nlp-chapter-3-question", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/keras-team/keras/issues/19262", "internal": false, "reflection": false, "title": "ValueError: Could not interpret optimizer identifier: <keras.src.optimizers.adam.Adam object at 0x79d9071160e0> · Issue #19262 · keras-team/keras · GitHub", "clicks": 1 }, { "url": "https://stackoverflow.com/questions/50056356/could-not-interpret-optimizer-identifier-error-in-keras", "internal": false, "reflection": false, "title": "python - \"Could not interpret optimizer identifier\" error in Keras - Stack Overflow", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/pretrain-model-not-accepting-optimizer/76209", "internal": true, "reflection": false, "title": "Pretrain model not accepting optimizer", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/nlp-chapter-3-question/148420/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213433, "name": "Ripunjay Tiwari", "username": "Rtdon8363737", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/r/6f9a4e/{size}.png", "created_at": "2025-04-04T18:10:56.907Z", "cooked": "<p>it works for me now after</p>\n<p>“”\"</p>\n<p>setting these to tackle:</p>\n<p>ValueError: Could not interpret optimizer identifier: &lt;keras.src.optimizers.adam.Adam object at 0x7cc289675050&gt;</p>\n<p>“”\"</p>\n<p>!pip install --upgrade transformers</p>\n<p>!pip install tf-keras</p>\n<p>import os</p>\n<p>os.environ[‘TF_USE_LEGACY_KERAS’] = ‘1’</p>", "post_number": 3, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-04T18:10:56.907Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 15.8, "yours": false, "topic_id": 148420, "topic_slug": "nlp-chapter-3-question", "display_username": "Ripunjay Tiwari", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89172, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/nlp-chapter-3-question/148420/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 213547, "name": "Bhubandeep Singh", "username": "bhuvnn", "avatar_template": "/user_avatar/discuss.huggingface.co/bhuvnn/{size}/44844_2.png", "created_at": "2025-04-05T10:22:57.584Z", "cooked": "<p>ValueError Traceback (most recent call last)<br>\n in &lt;cell line: 2&gt;()<br>\n1 optimizer = Adam(learning_rate=2e-5)<br>\n----&gt; 2 model.compile(loss=tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True),<br>\n3 optimizer=opt,<br>\n4 metrics=[“accuracy”])<br>\n5 tf.keras.backend.set_value(model.optimizer.learning_rate, 2e-5)</p>\n<p>/usr/local/lib/python3.10/dist-packages/transformers/modeling_tf_utils.py in compile(self, optimizer, loss, metrics, loss_weights, weighted_metrics, run_eagerly, steps_per_execution, **kwargs)<br>\n1561 # This argument got renamed, we need to support both versions<br>\n1562 if “steps_per_execution” in parent_args:<br>\n → 1563 super().compile(<br>\n1564 optimizer=optimizer,<br>\n1565 loss=loss,</p>\n<p>/usr/local/lib/python3.10/dist-packages/tf_keras/src/utils/traceback_utils.py in error_handler(*args, **kwargs)<br>\n68 # To get the full stack trace, call:<br>\n69 # <code>tf.debugging.disable_traceback_filtering()</code><br>\n—&gt; 70 raise e.with_traceback(filtered_tb) from None<br>\n71 finally:<br>\n72 del filtered_tb</p>\n<p>/usr/local/lib/python3.10/dist-packages/tf_keras/src/optimizers/<strong>init</strong>.py in get(identifier, **kwargs)<br>\n333 )<br>\n334 else:<br>\n → 335 raise ValueError(<br>\n336 f\"Could not interpret optimizer identifier: {identifier}\"<br>\n337 )</p>\n<p>ValueError: Could not interpret optimizer identifier: &lt;keras.src.optimizers.adam.Adam object at 0x7e17b44e89d0&gt;</p>\n<p>i am also facing a similiar kind of error</p>", "post_number": 4, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-05T10:22:57.584Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 148420, "topic_slug": "nlp-chapter-3-question", "display_username": "Bhubandeep Singh", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89583, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/nlp-chapter-3-question/148420/4", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213552, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-05T11:11:13.812Z", "cooked": "<p>It seems that there are different errors for each version…</p><aside class=\"quote\" data-post=\"19\" data-topic=\"76209\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/aligorjis/48/25575_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/pretrain-model-not-accepting-optimizer/76209/19?page=2\">Pretrain model not accepting optimizer</a> <a class=\"badge-category__wrapper \" href=\"/c/transformers/9\"><span data-category-id=\"9\" style=\"--category-badge-color: #F7941D; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"This category is for any question related to the Transformers library. You can also file an issue.\"><span class=\"badge-category__name\">🤗Transformers</span></span></a>\n </div>\n <blockquote>\n I have the same problem and still getting same error. I tried everything, but it doesn’t work. I am working on a project and I am short on time. Please help.\n </blockquote>\n</aside>\n<aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/amaiya/ktrain/issues/523\">\n <header class=\"source\">\n\n <a href=\"https://github.com/amaiya/ktrain/issues/523\" target=\"_blank\" rel=\"noopener\">github.com/amaiya/ktrain</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/amaiya/ktrain/issues/523\" target=\"_blank\" rel=\"noopener\">Could not interpret optimizer identifier</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-03-01\" data-time=\"06:00:01\" data-timezone=\"UTC\">06:00AM - 01 Mar 24 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-04-03\" data-time=\"01:37:40\" data-timezone=\"UTC\">01:37AM - 03 Apr 24 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/Nesarul-Hoque\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/e/9/e93086a945ca73617eea4efc128aa3528616dfaa.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"E8BDC5\">\n Nesarul-Hoque\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">I followed Tutorial A3: [Text Classification with Hugging Face Transformers]. I <span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">tried to implement the 'bert-base-multilingual-uncased' model from HuggingFace. When using the code, model = t_mod.get_classifier(), it generates an error message. This code was working perfectly some days ago. However, now it produces the following error:\n\n**Error**\n---------------------------------------------------------------------------\n\nValueError Traceback (most recent call last)\n\n[&lt;ipython-input-21-9ce4d9ec2ad7&gt;](https://localhost:8080/#) in &lt;cell line: 1&gt;()\n----&gt; 1 model = t_mod.get_classifier()\n\n3 frames\n\n[/usr/local/lib/python3.10/dist-packages/tf_keras/src/optimizers/__init__.py](https://localhost:8080/#) in get(identifier, **kwargs)\n 332 )\n 333 else:\n--&gt; 334 raise ValueError(\n 335 f\"Could not interpret optimizer identifier: {identifier}\"\n 336 )\n\nValueError: Could not interpret optimizer identifier: &lt;keras.src.optimizers.legacy.adam.Adam object at 0x7b2c22cb13c0&gt;</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 5, "post_type": 1, "posts_count": 6, "updated_at": "2025-04-05T11:11:13.812Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 3, "readers_count": 2, "score": 10.6, "yours": false, "topic_id": 148420, "topic_slug": "nlp-chapter-3-question", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/amaiya/ktrain/issues/523", "internal": false, "reflection": false, "title": "Could not interpret optimizer identifier · Issue #523 · amaiya/ktrain · GitHub", "clicks": 1 }, { "url": "https://discuss.huggingface.co/t/pretrain-model-not-accepting-optimizer/76209/19", "internal": true, "reflection": false, "title": "Pretrain model not accepting optimizer", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/nlp-chapter-3-question/148420/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213649, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-05T23:11:54.594Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 6, "post_type": 3, "posts_count": 6, "updated_at": "2025-04-05T23:11:54.594Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 148420, "topic_slug": "nlp-chapter-3-question", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/nlp-chapter-3-question/148420/6", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/a/1/a1418bed003690b4964efd7a9eedd3174cb299ff.png" data-download-href="/uploads/short-url/n0xiWVIjxYgv27rS3iTmtwhZnKn.png?dl=1" title="Screenshot 2025-04-01 195443" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/1/a1418bed003690b4964efd7a9eedd3174cb299ff_2_690x242.png" alt="Screenshot 2025-04-01 195443" data-base62-sha1="n0xiWVIjxYgv27rS3iTmtwhZnKn" width="690" height="242" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/1/a1418bed003690b4964efd7a9eedd3174cb299ff_2_690x242.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/1/a1418bed003690b4964efd7a9eedd3174cb299ff_2_1035x363.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/1/a1418bed003690b4964efd7a9eedd3174cb299ff_2_1380x484.png 2x" data-dominant-color="F5F5F6"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot 2025-04-01 195443</span><span class="informations">1820×639 47.4 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br> i tried import adam_v2, as well as just opt object but getting error</p> <p>ValueError: Could not interpret optimizer identifier: &lt;keras.src.optimizers.adam.Adam object at 0x78d78061c650&gt;</p>
<p>it works for me now after</p> <p>“”"</p> <p>setting these to tackle:</p> <p>ValueError: Could not interpret optimizer identifier: &lt;keras.src.optimizers.adam.Adam object at 0x7cc289675050&gt;</p> <p>“”"</p> <p>!pip install --upgrade transformers</p> <p>!pip install tf-keras</p> <p>import os</p> <p>os.environ[‘TF_USE_LEGACY_KERAS’] = ‘1’</p>
How to increase inference quota
https://discuss.huggingface.co/t/how-to-increase-inference-quota/148868
148,868
13
2025-04-04T14:42:11.731000Z
[ { "id": 213404, "name": "Biao Tang", "username": "biaotang", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/b/b782af/{size}.png", "created_at": "2025-04-04T14:42:11.786Z", "cooked": "<p>I have exceeded the monthly credits (0.1) for Inference. Does it support pay as you go? I added payment method but still didn’t allow LLM calls. I am not ready to upgrade to pro at this moment, still at learning period, prefer PAYG.</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-04T14:42:11.786Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 42, "reads": 9, "readers_count": 8, "score": 216.8, "yours": false, "topic_id": 148868, "topic_slug": "how-to-increase-inference-quota", "display_username": "Biao Tang", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89511, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-increase-inference-quota/148868/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213422, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-04T16:36:47.162Z", "cooked": "<p>The number of payment options is increasing week by week, but for now it seems that Pro or Enterprise subscriptions are the only options for PAYG.</p>\n<p>So, for example in the case of the smolagents course, I think the quickest way to get around this is to use a small model locally.</p>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-04T16:37:20.777Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 6.4, "yours": false, "topic_id": 148868, "topic_slug": "how-to-increase-inference-quota", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-increase-inference-quota/148868/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213432, "name": "Biao Tang", "username": "biaotang", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/b/b782af/{size}.png", "created_at": "2025-04-04T17:56:55.167Z", "cooked": "<p>Thanks John! I’ll try with a local model.</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-04T17:56:55.167Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 16, "yours": false, "topic_id": 148868, "topic_slug": "how-to-increase-inference-quota", "display_username": "Biao Tang", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89511, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-increase-inference-quota/148868/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 213513, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-05T05:56:55.479Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-05T05:56:55.479Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 4, "readers_count": 3, "score": 5.8, "yours": false, "topic_id": 148868, "topic_slug": "how-to-increase-inference-quota", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-increase-inference-quota/148868/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I have exceeded the monthly credits (0.1) for Inference. Does it support pay as you go? I added payment method but still didn’t allow LLM calls. I am not ready to upgrade to pro at this moment, still at learning period, prefer PAYG.</p>
<p>The number of payment options is increasing week by week, but for now it seems that Pro or Enterprise subscriptions are the only options for PAYG.</p> <p>So, for example in the case of the smolagents course, I think the quickest way to get around this is to use a small model locally.</p>
Wrong file is being downloaded
https://discuss.huggingface.co/t/wrong-file-is-being-downloaded/148556
148,556
10
2025-04-02T12:54:18.650000Z
[ { "id": 212977, "name": "A", "username": "drnhhl", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/4da419/{size}.png", "created_at": "2025-04-02T12:54:18.705Z", "cooked": "<p>I uploaded a file to a dataset repo, however when downloading it does not download the uploaded file, there seems to be some old copy stored which is instead downloaded. I have deleted and uploaded again via the API as well as the browser. Also when uploading it with a different name it does download the old version.<br>\nWhen using “hf_hub_download” it even raises the error: “OSError: Consistency check failed: file should be of size 1448673280 but has size 448000000”. Which identifies the correct file size (1,48GB) and recognizes that it is too small (448MB). Also, in the browser the correct file size is displayed.</p>\n<p>Any ideas how I can solve that?</p>\n<p>the file can be found here: <a href=\"https://huggingface.co/datasets/torchgeo/CropClimateX/resolve/main/landsat8/landsat8_12063_0-9_test.zarr.tar\">https://huggingface.co/datasets/torchgeo/CropClimateX/resolve/main/landsat8/landsat8_12063_0-9_test.zarr.tar</a></p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-02T12:54:18.705Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 65, "reads": 10, "readers_count": 9, "score": 311.8, "yours": false, "topic_id": 148556, "topic_slug": "wrong-file-is-being-downloaded", "display_username": "A", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/datasets/torchgeo/CropClimateX/resolve/main/landsat8/landsat8_12063_0-9_test.zarr.tar", "internal": false, "reflection": false, "title": null, "clicks": 4 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89275, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/wrong-file-is-being-downloaded/148556/1", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212979, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-02T13:03:48.133Z", "cooked": "<p>It’s a 400MB file that’s also being downloaded here…</p>\n<p>At first I thought it might be a problem with the git revision, but it’s more likely to be something to do with the LFS pointers or something like that. In any case, this is a bad anomaly… <a class=\"mention\" href=\"/u/pierric\">@pierric</a></p>\n<ul>\n<li><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/c/0/c00cdfc07c0ba745226353376b984ef7f60a323b.png\" data-download-href=\"/uploads/short-url/roXfVb1O3TxtJ5VhRpPLtDVjPPZ.png?dl=1\" title=\"landsat8\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/0/c00cdfc07c0ba745226353376b984ef7f60a323b_2_690x193.png\" alt=\"landsat8\" data-base62-sha1=\"roXfVb1O3TxtJ5VhRpPLtDVjPPZ\" width=\"690\" height=\"193\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/0/c00cdfc07c0ba745226353376b984ef7f60a323b_2_690x193.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/0/c00cdfc07c0ba745226353376b984ef7f60a323b_2_1035x289.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/0/c00cdfc07c0ba745226353376b984ef7f60a323b_2_1380x386.png 2x\" data-dominant-color=\"1C1E2D\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">landsat8</span><span class=\"informations\">1557×436 61.6 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></li>\n<li><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/c/d/cd370b9e80e0f9baf9de7c4c77aa12c2cbf5aa15.png\" data-download-href=\"/uploads/short-url/thpOzjXPM8blSo0wmIWbXpXy6Kp.png?dl=1\" title=\"landsat8b\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/d/cd370b9e80e0f9baf9de7c4c77aa12c2cbf5aa15_2_690x272.png\" alt=\"landsat8b\" data-base62-sha1=\"thpOzjXPM8blSo0wmIWbXpXy6Kp\" width=\"690\" height=\"272\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/d/cd370b9e80e0f9baf9de7c4c77aa12c2cbf5aa15_2_690x272.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/d/cd370b9e80e0f9baf9de7c4c77aa12c2cbf5aa15_2_1035x408.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/d/cd370b9e80e0f9baf9de7c4c77aa12c2cbf5aa15_2_1380x544.png 2x\" data-dominant-color=\"131926\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">landsat8b</span><span class=\"informations\">1532×604 57.9 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></li>\n<li><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/e/0e2caa83c3cf05fb277d0a657f03e3fc58d068d8.png\" data-download-href=\"/uploads/short-url/21onDmbh9XrzvmY3LfeZ9r3FUUw.png?dl=1\" title=\"landsat8c\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/e/0e2caa83c3cf05fb277d0a657f03e3fc58d068d8_2_690x176.png\" alt=\"landsat8c\" data-base62-sha1=\"21onDmbh9XrzvmY3LfeZ9r3FUUw\" width=\"690\" height=\"176\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/e/0e2caa83c3cf05fb277d0a657f03e3fc58d068d8_2_690x176.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/e/0e2caa83c3cf05fb277d0a657f03e3fc58d068d8_2_1035x264.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/e/0e2caa83c3cf05fb277d0a657f03e3fc58d068d8_2_1380x352.png 2x\" data-dominant-color=\"121824\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">landsat8c</span><span class=\"informations\">1548×395 41.2 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></li>\n</ul>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-02T13:04:04.517Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 10, "readers_count": 9, "score": 16.8, "yours": false, "topic_id": 148556, "topic_slug": "wrong-file-is-being-downloaded", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/wrong-file-is-being-downloaded/148556/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213431, "name": "A", "username": "drnhhl", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/4da419/{size}.png", "created_at": "2025-04-04T17:29:11.330Z", "cooked": "<p>The support solved the problem, but I don’t know what they did.</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-04T17:29:11.330Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 15.8, "yours": false, "topic_id": 148556, "topic_slug": "wrong-file-is-being-downloaded", "display_username": "A", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89275, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/wrong-file-is-being-downloaded/148556/3", "reactions": [ { "id": "confetti_ball", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213500, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-05T05:29:47.341Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-05T05:29:47.341Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 4, "readers_count": 3, "score": 5.6, "yours": false, "topic_id": 148556, "topic_slug": "wrong-file-is-being-downloaded", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/wrong-file-is-being-downloaded/148556/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I uploaded a file to a dataset repo, however when downloading it does not download the uploaded file, there seems to be some old copy stored which is instead downloaded. I have deleted and uploaded again via the API as well as the browser. Also when uploading it with a different name it does download the old version.<br> When using “hf_hub_download” it even raises the error: “OSError: Consistency check failed: file should be of size 1448673280 but has size 448000000”. Which identifies the correct file size (1,48GB) and recognizes that it is too small (448MB). Also, in the browser the correct file size is displayed.</p> <p>Any ideas how I can solve that?</p> <p>the file can be found here: <a href="https://huggingface.co/datasets/torchgeo/CropClimateX/resolve/main/landsat8/landsat8_12063_0-9_test.zarr.tar">https://huggingface.co/datasets/torchgeo/CropClimateX/resolve/main/landsat8/landsat8_12063_0-9_test.zarr.tar</a></p>
<p>The support solved the problem, but I don’t know what they did.</p>
Difference between pre-training and fine tuning with language modeling to instill new knowledge
https://discuss.huggingface.co/t/difference-between-pre-training-and-fine-tuning-with-language-modeling-to-instill-new-knowledge/148615
148,615
9
2025-04-02T20:59:12.088000Z
[ { "id": 213071, "name": "Jackson Fan", "username": "JacksonFan1225", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/90db22/{size}.png", "created_at": "2025-04-02T20:59:12.155Z", "cooked": "<p>Hi everyone,</p>\n<p>I am looking to incorporate an enterprise knowledge base into LLM so that it can be more well versed in the domain. I have done some initial research. The research indicated two paths forward: 1. continued pertaining and 2. supervised fine tuning. This is my understanding so far: with sft, there are two branches: completion only, where the model is not trained on loss on prompt but rather on the answer/completion of the prompt loss, which enhances the Q&amp;A capabilities of the model. However, there is also language modeling aspect of LLM where the model is trained both on the prompt and completion. The confusing part for me is how is language modeling fine tuning different from pre-training. Is the difference mainly on data size? Would love to know what is effective ways to instill new enterprise knowledge into the model.</p>\n<p>Thanks so much!</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-02T20:59:12.155Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 639, "reads": 13, "readers_count": 12, "score": 3012.6, "yours": false, "topic_id": 148615, "topic_slug": "difference-between-pre-training-and-fine-tuning-with-language-modeling-to-instill-new-knowledge", "display_username": "Jackson Fan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89321, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/difference-between-pre-training-and-fine-tuning-with-language-modeling-to-instill-new-knowledge/148615/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213131, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-03T04:18:00.913Z", "cooked": "<p>First, let’s sort out the confusion. In this case, I think fine-tuning is all that’s needed. Some people use Hugging Face for experiments, starting from pre-training, but most of the famous models are pre-trained.</p>\n<p>In other words, it’s fine to use SFT or other fine-tuning methods alone.<br>\nWhat’s important is the method you use to train the model, the model you choose as a base, and how you make the dataset easy for the model to understand and reduce errors (there is also research that says that if the dataset contains errors, the learning efficiency will drop hopelessly…), as well as the parameters used for training.</p>\n<p>The following was generated by a chatbot, so you can skip it as you see fit. It is only for reference purposes, such as terminology.</p>\n<hr>\n<p>by <a href=\"https://huggingface.co/chat/\">Hugging Chat</a></p>\n<p>The differences between pre-training, fine-tuning, and SFT (Supervised Fine-Tuning) in language modeling, particularly in instilling new knowledge, can be understood through their distinct roles and processes:</p>\n<ol>\n<li>\n<p><strong>Pre-Training</strong>:</p>\n<ul>\n<li><strong>Purpose</strong>: Establishes a general understanding of language.</li>\n<li><strong>Process</strong>: Involves exposure to large, diverse, unlabeled datasets.</li>\n<li><strong>Knowledge Instillation</strong>: Builds a broad linguistic foundation, enabling the model to understand various contexts and patterns.</li>\n</ul>\n</li>\n<li>\n<p><strong>Fine-Tuning</strong>:</p>\n<ul>\n<li><strong>Purpose</strong>: Adapts the model to specific tasks or domains.</li>\n<li><strong>Process</strong>: Refines the pre-trained model using task-specific data.</li>\n<li><strong>Techniques</strong>: Includes methods like SFT and RLHF, with each focusing on different aspects of task adaptation.</li>\n</ul>\n</li>\n<li>\n<p><strong>Supervised Fine-Tuning (SFT)</strong>:</p>\n<ul>\n<li><strong>Purpose</strong>: Enhances performance on specific tasks through structured learning.</li>\n<li><strong>Process</strong>: Uses labeled input-output pairs to improve task-specific outputs.</li>\n<li><strong>Knowledge Instillation</strong>: Teaches the model to produce desired outputs for specific inputs, refining its task-oriented abilities.</li>\n</ul>\n</li>\n</ol>\n<p><strong>Conclusion</strong>:</p>\n<ul>\n<li><strong>Pre-training</strong> lays the groundwork by providing general knowledge, which is essential for versatile language understanding.</li>\n<li><strong>Fine-tuning</strong>, including SFT, then specializes this knowledge, allowing the model to excel in particular areas by adapting to specific tasks through targeted data and methods. This layered approach ensures models are both broadly capable and highly effective in specialized applications.</li>\n</ul>\n<hr>\n<p>To incorporate an enterprise knowledge base into a large language model (LLM), supervised fine-tuning (SFT) offers two primary approaches: completion-only and language modeling. Here’s a structured summary of the considerations and conclusions:</p>\n<ol>\n<li>\n<p><strong>Completion-Only Approach</strong>:</p>\n<ul>\n<li><strong>Focus</strong>: Trains the model on generating accurate completions, enhancing Q&amp;A capabilities.</li>\n<li><strong>Use Case</strong>: Suitable for improving the model’s ability to answer specific domain-related questions, such as FAQs.</li>\n<li><strong>Efficiency</strong>: Potentially more efficient for tasks requiring precise responses.</li>\n</ul>\n</li>\n<li>\n<p><strong>Language Modeling Approach</strong>:</p>\n<ul>\n<li><strong>Focus</strong>: Trains the model on both prompts and completions, improving understanding and coherence in responses.</li>\n<li><strong>Use Case</strong>: Beneficial for generating coherent content, such as reports or aligning with internal guidelines.</li>\n<li><strong>Effectiveness</strong>: Enhances contextual relevance, making it suitable for conversational or creative tasks.</li>\n</ul>\n</li>\n<li>\n<p><strong>Considerations</strong>:</p>\n<ul>\n<li><strong>Data Preparation</strong>: Requires substantial labeled data, which can be resource-intensive but aligns with the availability of internal enterprise data.</li>\n<li><strong>Pipeline</strong>: The seven-stage pipeline includes data preparation, model selection, training, validation, testing, deployment, and monitoring, each tailored to enterprise needs.</li>\n<li><strong>Model Alignment</strong>: Ensures the model aligns with organizational values and standards, crucial for compliance and consistency, especially in regulated industries.</li>\n</ul>\n</li>\n<li>\n<p><strong>Conclusion</strong>:</p>\n<ul>\n<li>Both methods have their advantages and are suitable for different use cases.</li>\n<li>A combination of methods might be beneficial but could complicate the training process.</li>\n<li>Further research into detailed comparisons or case studies is recommended to determine the best approach based on specific enterprise goals and contexts.</li>\n</ul>\n</li>\n</ol>\n<p>Incorporating these approaches effectively can enhance the LLM’s domain expertise, improving its utility within the enterprise framework.</p>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-03T04:18:00.913Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 27, "reads": 13, "readers_count": 12, "score": 122.6, "yours": false, "topic_id": 148615, "topic_slug": "difference-between-pre-training-and-fine-tuning-with-language-modeling-to-instill-new-knowledge", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/chat/", "internal": false, "reflection": false, "title": "HuggingChat", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/difference-between-pre-training-and-fine-tuning-with-language-modeling-to-instill-new-knowledge/148615/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213213, "name": "Jackson Fan", "username": "JacksonFan1225", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/90db22/{size}.png", "created_at": "2025-04-03T14:17:42.111Z", "cooked": "<p>Thanks a lot for the clarification. That clears things up.</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-03T14:17:42.111Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 16.2, "yours": false, "topic_id": 148615, "topic_slug": "difference-between-pre-training-and-fine-tuning-with-language-modeling-to-instill-new-knowledge", "display_username": "Jackson Fan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89321, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/difference-between-pre-training-and-fine-tuning-with-language-modeling-to-instill-new-knowledge/148615/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213294, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-04T02:18:36.759Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-04T02:18:36.759Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 5, "readers_count": 4, "score": 6, "yours": false, "topic_id": 148615, "topic_slug": "difference-between-pre-training-and-fine-tuning-with-language-modeling-to-instill-new-knowledge", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/difference-between-pre-training-and-fine-tuning-with-language-modeling-to-instill-new-knowledge/148615/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi everyone,</p> <p>I am looking to incorporate an enterprise knowledge base into LLM so that it can be more well versed in the domain. I have done some initial research. The research indicated two paths forward: 1. continued pertaining and 2. supervised fine tuning. This is my understanding so far: with sft, there are two branches: completion only, where the model is not trained on loss on prompt but rather on the answer/completion of the prompt loss, which enhances the Q&amp;A capabilities of the model. However, there is also language modeling aspect of LLM where the model is trained both on the prompt and completion. The confusing part for me is how is language modeling fine tuning different from pre-training. Is the difference mainly on data size? Would love to know what is effective ways to instill new enterprise knowledge into the model.</p> <p>Thanks so much!</p>
<p>First, let’s sort out the confusion. In this case, I think fine-tuning is all that’s needed. Some people use Hugging Face for experiments, starting from pre-training, but most of the famous models are pre-trained.</p> <p>In other words, it’s fine to use SFT or other fine-tuning methods alone.<br> What’s important is the method you use to train the model, the model you choose as a base, and how you make the dataset easy for the model to understand and reduce errors (there is also research that says that if the dataset contains errors, the learning efficiency will drop hopelessly…), as well as the parameters used for training.</p> <p>The following was generated by a chatbot, so you can skip it as you see fit. It is only for reference purposes, such as terminology.</p> <hr> <p>by <a href="https://huggingface.co/chat/">Hugging Chat</a></p> <p>The differences between pre-training, fine-tuning, and SFT (Supervised Fine-Tuning) in language modeling, particularly in instilling new knowledge, can be understood through their distinct roles and processes:</p> <ol> <li> <p><strong>Pre-Training</strong>:</p> <ul> <li><strong>Purpose</strong>: Establishes a general understanding of language.</li> <li><strong>Process</strong>: Involves exposure to large, diverse, unlabeled datasets.</li> <li><strong>Knowledge Instillation</strong>: Builds a broad linguistic foundation, enabling the model to understand various contexts and patterns.</li> </ul> </li> <li> <p><strong>Fine-Tuning</strong>:</p> <ul> <li><strong>Purpose</strong>: Adapts the model to specific tasks or domains.</li> <li><strong>Process</strong>: Refines the pre-trained model using task-specific data.</li> <li><strong>Techniques</strong>: Includes methods like SFT and RLHF, with each focusing on different aspects of task adaptation.</li> </ul> </li> <li> <p><strong>Supervised Fine-Tuning (SFT)</strong>:</p> <ul> <li><strong>Purpose</strong>: Enhances performance on specific tasks through structured learning.</li> <li><strong>Process</strong>: Uses labeled input-output pairs to improve task-specific outputs.</li> <li><strong>Knowledge Instillation</strong>: Teaches the model to produce desired outputs for specific inputs, refining its task-oriented abilities.</li> </ul> </li> </ol> <p><strong>Conclusion</strong>:</p> <ul> <li><strong>Pre-training</strong> lays the groundwork by providing general knowledge, which is essential for versatile language understanding.</li> <li><strong>Fine-tuning</strong>, including SFT, then specializes this knowledge, allowing the model to excel in particular areas by adapting to specific tasks through targeted data and methods. This layered approach ensures models are both broadly capable and highly effective in specialized applications.</li> </ul> <hr> <p>To incorporate an enterprise knowledge base into a large language model (LLM), supervised fine-tuning (SFT) offers two primary approaches: completion-only and language modeling. Here’s a structured summary of the considerations and conclusions:</p> <ol> <li> <p><strong>Completion-Only Approach</strong>:</p> <ul> <li><strong>Focus</strong>: Trains the model on generating accurate completions, enhancing Q&amp;A capabilities.</li> <li><strong>Use Case</strong>: Suitable for improving the model’s ability to answer specific domain-related questions, such as FAQs.</li> <li><strong>Efficiency</strong>: Potentially more efficient for tasks requiring precise responses.</li> </ul> </li> <li> <p><strong>Language Modeling Approach</strong>:</p> <ul> <li><strong>Focus</strong>: Trains the model on both prompts and completions, improving understanding and coherence in responses.</li> <li><strong>Use Case</strong>: Beneficial for generating coherent content, such as reports or aligning with internal guidelines.</li> <li><strong>Effectiveness</strong>: Enhances contextual relevance, making it suitable for conversational or creative tasks.</li> </ul> </li> <li> <p><strong>Considerations</strong>:</p> <ul> <li><strong>Data Preparation</strong>: Requires substantial labeled data, which can be resource-intensive but aligns with the availability of internal enterprise data.</li> <li><strong>Pipeline</strong>: The seven-stage pipeline includes data preparation, model selection, training, validation, testing, deployment, and monitoring, each tailored to enterprise needs.</li> <li><strong>Model Alignment</strong>: Ensures the model aligns with organizational values and standards, crucial for compliance and consistency, especially in regulated industries.</li> </ul> </li> <li> <p><strong>Conclusion</strong>:</p> <ul> <li>Both methods have their advantages and are suitable for different use cases.</li> <li>A combination of methods might be beneficial but could complicate the training process.</li> <li>Further research into detailed comparisons or case studies is recommended to determine the best approach based on specific enterprise goals and contexts.</li> </ul> </li> </ol> <p>Incorporating these approaches effectively can enhance the LLM’s domain expertise, improving its utility within the enterprise framework.</p>
Using DistributedSampler with accelerate
https://discuss.huggingface.co/t/using-distributedsampler-with-accelerate/148474
148,474
9
2025-04-02T02:12:22.477000Z
[ { "id": 212858, "name": "Meghana Sistla", "username": "mesistla", "avatar_template": "/user_avatar/discuss.huggingface.co/mesistla/{size}/44593_2.png", "created_at": "2025-04-02T02:12:22.539Z", "cooked": "<p>I want to run CustomSFTTrainer (inherits <a href=\"https://github.com/huggingface/trl/blob/main/trl/trainer/sft_trainer.py\" rel=\"noopener nofollow ugc\">SFTTrainer</a> which inturn inherits <a href=\"https://github.com/huggingface/transformers/blob/v4.50.0/src/transformers/trainer.py\" rel=\"noopener nofollow ugc\">Trainer</a> class) on a multi-GPU setup using accelerate. I understand that the Trainer class already uses accelerate and hence appropriately creates a dataloader and calls accelerate.prepare(dataloader) in its train method.</p>\n<p>However, I fail to understand if it uses DistributedSampler. I noticed that it uses only RandomSampler and accelerate inturn calls SeedableRandomSampler and not a DistributedSampler. I want to run the model on different GPUs with exclusive unique chunks of data so that the training is faster.</p>\n<p>How do I use DistrubutedSampler with accelerate and the inbuilt Trainer class?</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2025-04-02T02:12:22.539Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 526, "reads": 18, "readers_count": 17, "score": 2598.6, "yours": false, "topic_id": 148474, "topic_slug": "using-distributedsampler-with-accelerate", "display_username": "Meghana Sistla", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/trl/blob/main/trl/trainer/sft_trainer.py", "internal": false, "reflection": false, "title": "trl/trl/trainer/sft_trainer.py at main · huggingface/trl · GitHub", "clicks": 2 }, { "url": "https://github.com/huggingface/transformers/blob/v4.50.0/src/transformers/trainer.py", "internal": false, "reflection": false, "title": "transformers/src/transformers/trainer.py at v4.50.0 · huggingface/transformers · GitHub", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89215, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/using-distributedsampler-with-accelerate/148474/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212903, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-02T07:53:12.260Z", "cooked": "<p>There may be no advantage to explicitly using DistributedSampler…</p>\n<aside class=\"quote\" data-post=\"1\" data-topic=\"12943\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://avatars.discourse-cdn.com/v4/letter/e/b9e5f3/48.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/can-accelerator-handle-the-distributed-sampler/12943\">Can accelerator handle the distributed sampler?</a> <a class=\"badge-category__wrapper \" href=\"/c/accelerate/18\"><span data-category-id=\"18\" style=\"--category-badge-color: #F7941D; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"This category is for any question related to the Accelerate library. You can also file an issue.\"><span class=\"badge-category__name\">🤗Accelerate</span></span></a>\n </div>\n <blockquote>\n As far as I know, for Pytorch, RandomSampler can not be directly used in the distributed data parallel training since DistributedSampler is desired (this <a href=\"https://discuss.pytorch.org/t/how-to-use-my-own-sampler-when-i-already-use-distributedsampler/62143\" rel=\"noopener nofollow ugc\">link</a> discusses the problem). I am wondering whether accelerator.prepare(dataloader) handles the data split for multiple GPUs if I use the RandomSampler, so that the sub-dataset on each device are exclusive.\n </blockquote>\n</aside>\n\n<blockquote>\n<p>You don’t have to worry about using a distributed sampler with Accelerate. Whatever your sampler is, Accelerate will automatically shard it for all processes.</p>\n</blockquote>", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2025-04-02T07:53:12.260Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 11, "reads": 18, "readers_count": 17, "score": 53.6, "yours": false, "topic_id": 148474, "topic_slug": "using-distributedsampler-with-accelerate", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/can-accelerator-handle-the-distributed-sampler/12943", "internal": true, "reflection": false, "title": "Can accelerator handle the distributed sampler?", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/using-distributedsampler-with-accelerate/148474/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212991, "name": "Meghana Sistla", "username": "mesistla", "avatar_template": "/user_avatar/discuss.huggingface.co/mesistla/{size}/44593_2.png", "created_at": "2025-04-02T14:28:01.160Z", "cooked": "<p>I see. So, just to be clear, Accelerate will ensure that, given any sampler, the data will be split exclusively for each GPU? Interesting, because I wasn’t able to find this functionality in the prepare_dataloader method of the Accelerate function. Is it wrapped in any other Accelerate method?</p>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2025-04-02T14:28:12.582Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 14, "readers_count": 13, "score": 17.8, "yours": false, "topic_id": 148474, "topic_slug": "using-distributedsampler-with-accelerate", "display_username": "Meghana Sistla", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89215, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/using-distributedsampler-with-accelerate/148474/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212996, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-02T14:54:31.260Z", "cooked": "<p>It’s hard to tell what’s where in the code of the library in charge of optimization…<br>\nThere’s no example that directly mentions the mechanism.</p>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/accelerate-library\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/accelerate-library\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/388;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/f/4ff47ff86dfd5a04d693b93fe28c06271f66bf4d_2_690x388.png\" class=\"thumbnail\" data-dominant-color=\"F2F4F4\" width=\"690\" height=\"388\"></div>\n\n<h3><a href=\"https://huggingface.co/blog/accelerate-library\" target=\"_blank\" rel=\"noopener\">Introducing 🤗 Accelerate</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/accelerate/concept_guides/internal_mechanism\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/accelerate/concept_guides/internal_mechanism\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/3/0383c0bc9dfffa44151c8cf13ec5adba8ac2156e_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F7F5EF\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/accelerate/concept_guides/internal_mechanism\" target=\"_blank\" rel=\"noopener\">Accelerate’s internal mechanisms</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/huggingface/accelerate/issues/679\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/accelerate/issues/679\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/accelerate</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/accelerate/issues/679\" target=\"_blank\" rel=\"noopener\">Error in prepared DataLoader with BatchSampler</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2022-09-04\" data-time=\"17:22:26\" data-timezone=\"UTC\">05:22PM - 04 Sep 22 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2022-09-12\" data-time=\"14:46:11\" data-timezone=\"UTC\">02:46PM - 12 Sep 22 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/etiennebeaulac\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/1/5/15c4aaf08a72719d0ef56fdf27fe93d6f79a352c.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"C8E7DA\">\n etiennebeaulac\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n feature request\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">### System Info\n\n```Shell\naccelerate: 0.12.0\nOS: Linux 5.4.188+ (Colab)\nPyt<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">hon: 3.7.13\nnumpy: 1.21.6\ntorch: 1.12.1+cu113\nconfig: 1 CPU\n```\n\n\n### Information\n\n- [ ] The official example scripts\n- [X] My own modified scripts\n\n### Tasks\n\n- [ ] One of the scripts in the examples/ folder of Accelerate or an officially supported `no_trainer` script in the `examples` folder of the `transformers` repo (such as `run_no_trainer_glue.py`)\n- [X] My own task or dataset (give details below)\n\n### Reproduction\n\nMRE : https://colab.research.google.com/drive/17krCJCF_nWtNFSiMBo3oz12l7eX1bBZ6\n\nFirst of all, thanks for this library and the great docs and examples that comes with it 😄!\n\nI am using a custom torch Dataset that contains a Hugging Face Dataset (pyarrow) instance. Therefore, as indicated in the Datasets docs (https://huggingface.co/docs/datasets/v2.4.0/en/use_with_pytorch#use-a-batchsampler), I tried to use a BatchSampler to reduce the number of queries. However, I have not been able yet to make it work yet with accelerate.\n\nI tried many different possibilities, one of which works one CPU or one GPU, but gets stuck when using distributed training.\n\nThanks for your help!</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/huggingface/accelerate/issues/2865\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/accelerate/issues/2865\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/accelerate</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/accelerate/issues/2865\" target=\"_blank\" rel=\"noopener\">Dataloader WeightedRandomSampler + Distributed Training</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-06-17\" data-time=\"19:18:26\" data-timezone=\"UTC\">07:18PM - 17 Jun 24 UTC</span>\n </div>\n\n\n <div class=\"user\">\n <a href=\"https://github.com/FrsECM\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/5/0/50ee5a18ec2470b66582df39d21175c7b512705b.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"59594D\">\n FrsECM\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n enhancement\n </span>\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n feature request\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">### System Info\n\n```Shell\naccelerate 0.31.0\nUbuntu 22.04 (WSL)\npython=3.10.<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">14\n```\n\n\n### Information\n\n- [ ] The official example scripts\n- [X] My own modified scripts\n\n### Tasks\n\n- [ ] One of the scripts in the examples/ folder of Accelerate or an officially supported `no_trainer` script in the `examples` folder of the `transformers` repo (such as `run_no_trainer_glue.py`)\n- [X] My own task or dataset (give details below)\n\n### Reproduction\n\nI would like to combine distributed training and a weighted random sampler. In order to do that, i :\n\n1. Create my Dataset inheriting from torch.utils.data.Dataset\n2. Compute weights specific to my classes and data\n3. Create my DataLoader with the random sampler\n4. Prepare my dataloader with accelerate\n\nBut it seems that this is not working because we have data leaks between processes.\n![image](https://github.com/huggingface/accelerate/assets/26071804/a8cff431-29f1-414a-97c2-c89c0d453ef1)\n\nI would like to make sure, processes uses different data, like that : \n&lt;img src='https://github.com/huggingface/accelerate/assets/26071804/93ce0cc7-4646-4e34-9b71-90c896f06f2a' width='400px' /&gt;\n\nI developped an example script in order to understand the process : \n```python\nfrom accelerate import Accelerator\nimport argparse\nimport os\nimport torch.distributed as dist\nimport torch\nfrom tqdm.auto import tqdm\nfrom torch.utils.data import Dataset,DataLoader\nfrom torch.utils.data import WeightedRandomSampler,BatchSampler\n\nWORLD_SIZE = int(os.getenv('WORLD_SIZE',1))\nMAIN_PROCESS = not int(os.getenv('RANK',0))\n\nparser = argparse.ArgumentParser()\nparser.add_argument('--dataset_count',default=12800)\nparser.add_argument('--epochs',default=20)\nparser.add_argument('--batch_size',default=64)\nparser.add_argument('--balance',action='store_true',default=False)\n\ndef is_even(number):\n return not number%2 # example 10 =&gt; 10%2 == 0\n\nclass DummyDataset(Dataset):\n def __init__(self,dataset_count:int):\n self.data = range(dataset_count)\n \n def __len__(self):\n return len(self.data)\n \n def dataloader(self,batch_size,balance:bool=False,seed=42,batch_sampler=False,drop_last:bool=False):\n generator = torch.Generator().manual_seed(seed)\n def get_weight(num):\n if is_even(num):\n # even\n return 1.0\n else:\n # odd (impair)\n return 0.1\n if balance:\n weights = [get_weight(i) for i in self.data]\n sampler = WeightedRandomSampler(weights,len(self),replacement=True,generator=generator)\n else:\n sampler = None\n\n if batch_sampler:\n return DataLoader(self,batch_sampler=BatchSampler(sampler,batch_size,drop_last))\n else:\n return DataLoader(self,batch_size,sampler=sampler,drop_last=drop_last)\n \n def __getitem__(self,idx):\n row_index = self.data[idx]\n return row_index\n\ndef main(\n dataset_count:int,\n epochs:int, \n batch_size:int,\n balance:bool=True):\n \n if int(os.environ.get('WORLD_SIZE',1))&gt;1:\n dist.init_process_group(backend='gloo')\n\n accelerator = Accelerator(cpu=True)\n # We mount the right storage...\n # We get the path\n dataset = DummyDataset(dataset_count)\n # Dataloader without Accelerate...\n dataloader = dataset.dataloader(batch_size,balance)\n batched_data = []\n if MAIN_PROCESS:\n print(f'Running {epochs*len(dataloader)} iterations')\n for epoch in range(epochs):\n for batch in dataloader:\n batch:torch.Tensor\n batched_data.extend(batch.tolist())\n\n count_even = len([v for v in batched_data if is_even(v)])\n count_odd = len([v for v in batched_data if not is_even(v)])\n ratio_odd = count_odd/(count_even+count_odd)\n if MAIN_PROCESS:\n print('Get proportion of Odd data without accelerate')\n print(f'Ratio Odd = {ratio_odd}')\n # Dataloader with Accelerate...\n dataloader = accelerator.prepare(dataloader)\n # We increase learning rate when multiGPU\n batched_data = []\n if MAIN_PROCESS:\n print(f'Running {epochs*len(dataloader)} iterations')\n for epoch in range(epochs):\n for batch in dataloader:\n batch:torch.Tensor\n batched_data.extend(batch.tolist()) \n count_even = len([v for v in batched_data if is_even(v)])\n count_odd = len([v for v in batched_data if not is_even(v)])\n ratio_odd = count_odd/(count_even+count_odd)\n if MAIN_PROCESS:\n print('Get proportion of Odd data with accelerate')\n print(f'Ratio Odd = {ratio_odd}')\n # We save to a file for further processing...\n suffix = '_balanced' if balance else '_unbalanced' \n rank = str(os.environ.get('RANK',0))\n with open(f'test_{rank}{suffix}.json','w') as jsf:\n import json\n json.dump(sorted(batched_data),jsf,indent=4)\n\n accelerator.wait_for_everyone()\n\n seen_data = set(batched_data)\n if WORLD_SIZE&gt;1:\n # Now every one will open the other...\n other_rank = str(int(not int(os.environ.get('RANK',0))))\n with open(f'test_{other_rank}{suffix}.json','r') as jsf:\n import json\n other_data = json.load(jsf)\n\n # We get unique ids in order to check that we don't have leaks...\n other_data = set(other_data)\n batched_data = set(batched_data)\n unique_in_rank = batched_data.difference(other_data)\n if MAIN_PROCESS:\n print('Verify the unicity of the data on each rank...\\n')\n print(f'{len(unique_in_rank)}/{len(batched_data)} data only are not leaking from rank {rank} to rank {other_rank}')\n seen_data = unique_in_rank.union(other_data)\n # Unseen data\n unseen_data = set(dataset.data).difference(seen_data)\n if MAIN_PROCESS:\n print(\"Unseen Data\")\n print(f'{len(unseen_data)}/{len(dataset)} have not been seen...')\nif __name__=='__main__':\n params = vars(parser.parse_args())\n print('----------------------------------------')\n [print(f'{k}: {v}') for k,v in params.items()]\n print('----------------------------------------')\n main(**params)\n```\n\nYou can try to run this script different ways : \n## Single node without \"balance\"\n```\n----------------------------------------\ndataset_count: 12800\nepochs: 20\nbatch_size: 64\nbalance: False\n----------------------------------------\nRunning 4000 iterations\nGet proportion of Odd data without accelerate\nRatio Odd = 0.5\nRunning 4000 iterations\nGet proportion of Odd data with accelerate\nRatio Odd = 0.5\nUnseen Data\n0/12800 have not been seen...\n```\n## Multiple node (2) without \"balance\"\n```\n----------------------------------------\ndataset_count: 12800\nepochs: 20\nbatch_size: 64\nbalance: False\n----------------------------------------\nRunning 4000 iterations\nGet proportion of Odd data without accelerate\nRatio Odd = 0.5\nRunning 2000 iterations\nGet proportion of Odd data with accelerate\nRatio Odd = 0.5\nVerify the unicity of the data on each rank...\n\nVerify the unicity of the data on each rank...\n6400/6400 data only are not leaking from rank 0 to rank 1\n\n6400/6400 data only are not leaking from rank 1 to rank 0\nUnseen Data\n0/12800 have not been seen...\n```\nWe see that we do not have any leak, all data are seen.\n\n## Single node with \"balance\"\n```\n----------------------------------------\ndataset_count: 12800\nepochs: 20\nbatch_size: 64\nbalance: True\n----------------------------------------\nRunning 4000 iterations\nGet proportion of Odd data without accelerate\nRatio Odd = 0.09179296875\nRunning 4000 iterations\nGet proportion of Odd data with accelerate\nRatio Odd = 0.09139453125\nUnseen Data\n167/12800 have not been seen...\n```\nWe see that a few data has not been seen. It's normal because we have a very low rate of Odd data.\n\n## Multiple node with \"balance\"\n```\n----------------------------------------\ndataset_count: 12800\nepochs: 20\nbatch_size: 64\nbalance: True\n----------------------------------------\nRunning 4000 iterations\nGet proportion of Odd data without accelerate\nRatio Odd = 0.09179296875\nRunning 2000 iterations\nGet proportion of Odd data with accelerate\nRatio Odd = 0.0917890625\nVerify the unicity of the data on each rank...\n\n895/11760 data only are not leaking from rank 0 to rank 1\n873/11738 data only are not leaking from rank 1 to rank 0\n\nUnseen Data\n167/12800 have not been seen...\n```\n\nWe see that data are leaking from one node to the other. Like if there was an issue with the distributed sampler.\nHow to fix it ?\n\n\n### Expected behavior\n\nI would like the weighted sampler to be used and i would like nothing to leak from node 1 to node 2 like in the case where we don't have weighted sampler.\n\n\n**Do you have any idea about how to get this result ?**\n\nThanks !</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox githubblob\" data-onebox-src=\"https://github.com/huggingface/accelerate/blob/v1.6.0/src/accelerate/data_loader.py#L696\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/accelerate/blob/v1.6.0/src/accelerate/data_loader.py#L696\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/accelerate</a>\n </header>\n\n <article class=\"onebox-body\">\n <h4><a href=\"https://github.com/huggingface/accelerate/blob/v1.6.0/src/accelerate/data_loader.py#L696\" target=\"_blank\" rel=\"noopener\">src/accelerate/data_loader.py</a></h4>\n\n<div class=\"git-blob-info\">\n <a href=\"https://github.com/huggingface/accelerate/blob/v1.6.0/src/accelerate/data_loader.py#L696\" rel=\"noopener\"><code>v1.6.0</code></a>\n</div>\n\n\n\n <pre class=\"onebox\"><code class=\"lang-py\">\n <ol class=\"start lines\" start=\"686\" style=\"counter-reset: li-counter 685 ;\">\n <li></li>\n <li> @property</li>\n <li> def batch_sampler(self):</li>\n <li> return self._loader.batch_sampler</li>\n <li></li>\n <li> @property</li>\n <li> def dataloader(self):</li>\n <li> return self._loader</li>\n <li></li>\n <li></li>\n <li class=\"selected\">class DataLoaderDispatcher(DataLoaderAdapter, DataLoaderStateMixin):</li>\n <li> \"\"\"</li>\n <li> Subclass of `DataLoaderAdapter` that will iterate and preprocess on process 0 only, then dispatch on each process</li>\n <li> their part of the batch.</li>\n <li></li>\n <li> Args:</li>\n <li> split_batches (`bool`, *optional*, defaults to `False`):</li>\n <li> Whether the resulting `DataLoader` should split the batches of the original data loader across devices or</li>\n <li> yield full batches (in which case it will yield batches starting at the `process_index`-th and advancing of</li>\n <li> `num_processes` batches at each iteration). Another way to see this is that the observed batch size will be</li>\n <li> the same as the initial `dataloader` if this option is set to `True`, the batch size of the initial</li>\n </ol>\n </code></pre>\n\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-04-02T14:54:31.260Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 4, "reads": 14, "readers_count": 13, "score": 22.8, "yours": false, "topic_id": 148474, "topic_slug": "using-distributedsampler-with-accelerate", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/accelerate/blob/v1.6.0/src/accelerate/data_loader.py#L696", "internal": false, "reflection": false, "title": "accelerate/src/accelerate/data_loader.py at v1.6.0 · huggingface/accelerate · GitHub", "clicks": 13 }, { "url": "https://huggingface.co/blog/accelerate-library", "internal": false, "reflection": false, "title": "Introducing 🤗 Accelerate", "clicks": 9 }, { "url": "https://github.com/huggingface/accelerate/issues/2865", "internal": false, "reflection": false, "title": "Dataloader WeightedRandomSampler + Distributed Training · Issue #2865 · huggingface/accelerate · GitHub", "clicks": 6 }, { "url": "https://huggingface.co/docs/accelerate/concept_guides/internal_mechanism", "internal": false, "reflection": false, "title": "Accelerate’s internal mechanisms", "clicks": 4 }, { "url": "https://github.com/huggingface/accelerate/issues/679", "internal": false, "reflection": false, "title": "Error in prepared DataLoader with BatchSampler · Issue #679 · huggingface/accelerate · GitHub", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/using-distributedsampler-with-accelerate/148474/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 213125, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-03T02:55:27.291Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-04-03T02:55:27.291Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 6.6, "yours": false, "topic_id": 148474, "topic_slug": "using-distributedsampler-with-accelerate", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/using-distributedsampler-with-accelerate/148474/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I want to run CustomSFTTrainer (inherits <a href="https://github.com/huggingface/trl/blob/main/trl/trainer/sft_trainer.py" rel="noopener nofollow ugc">SFTTrainer</a> which inturn inherits <a href="https://github.com/huggingface/transformers/blob/v4.50.0/src/transformers/trainer.py" rel="noopener nofollow ugc">Trainer</a> class) on a multi-GPU setup using accelerate. I understand that the Trainer class already uses accelerate and hence appropriately creates a dataloader and calls accelerate.prepare(dataloader) in its train method.</p> <p>However, I fail to understand if it uses DistributedSampler. I noticed that it uses only RandomSampler and accelerate inturn calls SeedableRandomSampler and not a DistributedSampler. I want to run the model on different GPUs with exclusive unique chunks of data so that the training is faster.</p> <p>How do I use DistrubutedSampler with accelerate and the inbuilt Trainer class?</p>
<p>It’s hard to tell what’s where in the code of the library in charge of optimization…<br> There’s no example that directly mentions the mechanism.</p> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/blog/accelerate-library"> <header class="source"> <a href="https://huggingface.co/blog/accelerate-library" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/388;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/f/4ff47ff86dfd5a04d693b93fe28c06271f66bf4d_2_690x388.png" class="thumbnail" data-dominant-color="F2F4F4" width="690" height="388"></div> <h3><a href="https://huggingface.co/blog/accelerate-library" target="_blank" rel="noopener">Introducing 🤗 Accelerate</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/accelerate/concept_guides/internal_mechanism"> <header class="source"> <a href="https://huggingface.co/docs/accelerate/concept_guides/internal_mechanism" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/3/0383c0bc9dfffa44151c8cf13ec5adba8ac2156e_2_690x372.png" class="thumbnail" data-dominant-color="F7F5EF" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/accelerate/concept_guides/internal_mechanism" target="_blank" rel="noopener">Accelerate’s internal mechanisms</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox githubissue" data-onebox-src="https://github.com/huggingface/accelerate/issues/679"> <header class="source"> <a href="https://github.com/huggingface/accelerate/issues/679" target="_blank" rel="noopener">github.com/huggingface/accelerate</a> </header> <article class="onebox-body"> <div class="github-row"> <div class="github-icon-container" title="Issue" data-github-private-repo="false"> <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg> </div> <div class="github-info-container"> <h4> <a href="https://github.com/huggingface/accelerate/issues/679" target="_blank" rel="noopener">Error in prepared DataLoader with BatchSampler</a> </h4> <div class="github-info"> <div class="date"> opened <span class="discourse-local-date" data-format="ll" data-date="2022-09-04" data-time="17:22:26" data-timezone="UTC">05:22PM - 04 Sep 22 UTC</span> </div> <div class="date"> closed <span class="discourse-local-date" data-format="ll" data-date="2022-09-12" data-time="14:46:11" data-timezone="UTC">02:46PM - 12 Sep 22 UTC</span> </div> <div class="user"> <a href="https://github.com/etiennebeaulac" target="_blank" rel="noopener"> <img alt="" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/1/5/15c4aaf08a72719d0ef56fdf27fe93d6f79a352c.png" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="C8E7DA"> etiennebeaulac </a> </div> </div> <div class="labels"> <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;"> feature request </span> </div> </div> </div> <div class="github-row"> <p class="github-body-container">### System Info ```Shell accelerate: 0.12.0 OS: Linux 5.4.188+ (Colab) Pyt<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">hon: 3.7.13 numpy: 1.21.6 torch: 1.12.1+cu113 config: 1 CPU ``` ### Information - [ ] The official example scripts - [X] My own modified scripts ### Tasks - [ ] One of the scripts in the examples/ folder of Accelerate or an officially supported `no_trainer` script in the `examples` folder of the `transformers` repo (such as `run_no_trainer_glue.py`) - [X] My own task or dataset (give details below) ### Reproduction MRE : https://colab.research.google.com/drive/17krCJCF_nWtNFSiMBo3oz12l7eX1bBZ6 First of all, thanks for this library and the great docs and examples that comes with it 😄! I am using a custom torch Dataset that contains a Hugging Face Dataset (pyarrow) instance. Therefore, as indicated in the Datasets docs (https://huggingface.co/docs/datasets/v2.4.0/en/use_with_pytorch#use-a-batchsampler), I tried to use a BatchSampler to reduce the number of queries. However, I have not been able yet to make it work yet with accelerate. I tried many different possibilities, one of which works one CPU or one GPU, but gets stuck when using distributed training. Thanks for your help!</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox githubissue" data-onebox-src="https://github.com/huggingface/accelerate/issues/2865"> <header class="source"> <a href="https://github.com/huggingface/accelerate/issues/2865" target="_blank" rel="noopener">github.com/huggingface/accelerate</a> </header> <article class="onebox-body"> <div class="github-row"> <div class="github-icon-container" title="Issue" data-github-private-repo="false"> <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg> </div> <div class="github-info-container"> <h4> <a href="https://github.com/huggingface/accelerate/issues/2865" target="_blank" rel="noopener">Dataloader WeightedRandomSampler + Distributed Training</a> </h4> <div class="github-info"> <div class="date"> opened <span class="discourse-local-date" data-format="ll" data-date="2024-06-17" data-time="19:18:26" data-timezone="UTC">07:18PM - 17 Jun 24 UTC</span> </div> <div class="user"> <a href="https://github.com/FrsECM" target="_blank" rel="noopener"> <img alt="" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/5/0/50ee5a18ec2470b66582df39d21175c7b512705b.png" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="59594D"> FrsECM </a> </div> </div> <div class="labels"> <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;"> enhancement </span> <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;"> feature request </span> </div> </div> </div> <div class="github-row"> <p class="github-body-container">### System Info ```Shell accelerate 0.31.0 Ubuntu 22.04 (WSL) python=3.10.<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">14 ``` ### Information - [ ] The official example scripts - [X] My own modified scripts ### Tasks - [ ] One of the scripts in the examples/ folder of Accelerate or an officially supported `no_trainer` script in the `examples` folder of the `transformers` repo (such as `run_no_trainer_glue.py`) - [X] My own task or dataset (give details below) ### Reproduction I would like to combine distributed training and a weighted random sampler. In order to do that, i : 1. Create my Dataset inheriting from torch.utils.data.Dataset 2. Compute weights specific to my classes and data 3. Create my DataLoader with the random sampler 4. Prepare my dataloader with accelerate But it seems that this is not working because we have data leaks between processes. ![image](https://github.com/huggingface/accelerate/assets/26071804/a8cff431-29f1-414a-97c2-c89c0d453ef1) I would like to make sure, processes uses different data, like that : &lt;img src='https://github.com/huggingface/accelerate/assets/26071804/93ce0cc7-4646-4e34-9b71-90c896f06f2a' width='400px' /&gt; I developped an example script in order to understand the process : ```python from accelerate import Accelerator import argparse import os import torch.distributed as dist import torch from tqdm.auto import tqdm from torch.utils.data import Dataset,DataLoader from torch.utils.data import WeightedRandomSampler,BatchSampler WORLD_SIZE = int(os.getenv('WORLD_SIZE',1)) MAIN_PROCESS = not int(os.getenv('RANK',0)) parser = argparse.ArgumentParser() parser.add_argument('--dataset_count',default=12800) parser.add_argument('--epochs',default=20) parser.add_argument('--batch_size',default=64) parser.add_argument('--balance',action='store_true',default=False) def is_even(number): return not number%2 # example 10 =&gt; 10%2 == 0 class DummyDataset(Dataset): def __init__(self,dataset_count:int): self.data = range(dataset_count) def __len__(self): return len(self.data) def dataloader(self,batch_size,balance:bool=False,seed=42,batch_sampler=False,drop_last:bool=False): generator = torch.Generator().manual_seed(seed) def get_weight(num): if is_even(num): # even return 1.0 else: # odd (impair) return 0.1 if balance: weights = [get_weight(i) for i in self.data] sampler = WeightedRandomSampler(weights,len(self),replacement=True,generator=generator) else: sampler = None if batch_sampler: return DataLoader(self,batch_sampler=BatchSampler(sampler,batch_size,drop_last)) else: return DataLoader(self,batch_size,sampler=sampler,drop_last=drop_last) def __getitem__(self,idx): row_index = self.data[idx] return row_index def main( dataset_count:int, epochs:int, batch_size:int, balance:bool=True): if int(os.environ.get('WORLD_SIZE',1))&gt;1: dist.init_process_group(backend='gloo') accelerator = Accelerator(cpu=True) # We mount the right storage... # We get the path dataset = DummyDataset(dataset_count) # Dataloader without Accelerate... dataloader = dataset.dataloader(batch_size,balance) batched_data = [] if MAIN_PROCESS: print(f'Running {epochs*len(dataloader)} iterations') for epoch in range(epochs): for batch in dataloader: batch:torch.Tensor batched_data.extend(batch.tolist()) count_even = len([v for v in batched_data if is_even(v)]) count_odd = len([v for v in batched_data if not is_even(v)]) ratio_odd = count_odd/(count_even+count_odd) if MAIN_PROCESS: print('Get proportion of Odd data without accelerate') print(f'Ratio Odd = {ratio_odd}') # Dataloader with Accelerate... dataloader = accelerator.prepare(dataloader) # We increase learning rate when multiGPU batched_data = [] if MAIN_PROCESS: print(f'Running {epochs*len(dataloader)} iterations') for epoch in range(epochs): for batch in dataloader: batch:torch.Tensor batched_data.extend(batch.tolist()) count_even = len([v for v in batched_data if is_even(v)]) count_odd = len([v for v in batched_data if not is_even(v)]) ratio_odd = count_odd/(count_even+count_odd) if MAIN_PROCESS: print('Get proportion of Odd data with accelerate') print(f'Ratio Odd = {ratio_odd}') # We save to a file for further processing... suffix = '_balanced' if balance else '_unbalanced' rank = str(os.environ.get('RANK',0)) with open(f'test_{rank}{suffix}.json','w') as jsf: import json json.dump(sorted(batched_data),jsf,indent=4) accelerator.wait_for_everyone() seen_data = set(batched_data) if WORLD_SIZE&gt;1: # Now every one will open the other... other_rank = str(int(not int(os.environ.get('RANK',0)))) with open(f'test_{other_rank}{suffix}.json','r') as jsf: import json other_data = json.load(jsf) # We get unique ids in order to check that we don't have leaks... other_data = set(other_data) batched_data = set(batched_data) unique_in_rank = batched_data.difference(other_data) if MAIN_PROCESS: print('Verify the unicity of the data on each rank...\n') print(f'{len(unique_in_rank)}/{len(batched_data)} data only are not leaking from rank {rank} to rank {other_rank}') seen_data = unique_in_rank.union(other_data) # Unseen data unseen_data = set(dataset.data).difference(seen_data) if MAIN_PROCESS: print("Unseen Data") print(f'{len(unseen_data)}/{len(dataset)} have not been seen...') if __name__=='__main__': params = vars(parser.parse_args()) print('----------------------------------------') [print(f'{k}: {v}') for k,v in params.items()] print('----------------------------------------') main(**params) ``` You can try to run this script different ways : ## Single node without "balance" ``` ---------------------------------------- dataset_count: 12800 epochs: 20 batch_size: 64 balance: False ---------------------------------------- Running 4000 iterations Get proportion of Odd data without accelerate Ratio Odd = 0.5 Running 4000 iterations Get proportion of Odd data with accelerate Ratio Odd = 0.5 Unseen Data 0/12800 have not been seen... ``` ## Multiple node (2) without "balance" ``` ---------------------------------------- dataset_count: 12800 epochs: 20 batch_size: 64 balance: False ---------------------------------------- Running 4000 iterations Get proportion of Odd data without accelerate Ratio Odd = 0.5 Running 2000 iterations Get proportion of Odd data with accelerate Ratio Odd = 0.5 Verify the unicity of the data on each rank... Verify the unicity of the data on each rank... 6400/6400 data only are not leaking from rank 0 to rank 1 6400/6400 data only are not leaking from rank 1 to rank 0 Unseen Data 0/12800 have not been seen... ``` We see that we do not have any leak, all data are seen. ## Single node with "balance" ``` ---------------------------------------- dataset_count: 12800 epochs: 20 batch_size: 64 balance: True ---------------------------------------- Running 4000 iterations Get proportion of Odd data without accelerate Ratio Odd = 0.09179296875 Running 4000 iterations Get proportion of Odd data with accelerate Ratio Odd = 0.09139453125 Unseen Data 167/12800 have not been seen... ``` We see that a few data has not been seen. It's normal because we have a very low rate of Odd data. ## Multiple node with "balance" ``` ---------------------------------------- dataset_count: 12800 epochs: 20 batch_size: 64 balance: True ---------------------------------------- Running 4000 iterations Get proportion of Odd data without accelerate Ratio Odd = 0.09179296875 Running 2000 iterations Get proportion of Odd data with accelerate Ratio Odd = 0.0917890625 Verify the unicity of the data on each rank... 895/11760 data only are not leaking from rank 0 to rank 1 873/11738 data only are not leaking from rank 1 to rank 0 Unseen Data 167/12800 have not been seen... ``` We see that data are leaking from one node to the other. Like if there was an issue with the distributed sampler. How to fix it ? ### Expected behavior I would like the weighted sampler to be used and i would like nothing to leak from node 1 to node 2 like in the case where we don't have weighted sampler. **Do you have any idea about how to get this result ?** Thanks !</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox githubblob" data-onebox-src="https://github.com/huggingface/accelerate/blob/v1.6.0/src/accelerate/data_loader.py#L696"> <header class="source"> <a href="https://github.com/huggingface/accelerate/blob/v1.6.0/src/accelerate/data_loader.py#L696" target="_blank" rel="noopener">github.com/huggingface/accelerate</a> </header> <article class="onebox-body"> <h4><a href="https://github.com/huggingface/accelerate/blob/v1.6.0/src/accelerate/data_loader.py#L696" target="_blank" rel="noopener">src/accelerate/data_loader.py</a></h4> <div class="git-blob-info"> <a href="https://github.com/huggingface/accelerate/blob/v1.6.0/src/accelerate/data_loader.py#L696" rel="noopener"><code>v1.6.0</code></a> </div> <pre class="onebox"><code class="lang-py"> <ol class="start lines" start="686" style="counter-reset: li-counter 685 ;"> <li></li> <li> @property</li> <li> def batch_sampler(self):</li> <li> return self._loader.batch_sampler</li> <li></li> <li> @property</li> <li> def dataloader(self):</li> <li> return self._loader</li> <li></li> <li></li> <li class="selected">class DataLoaderDispatcher(DataLoaderAdapter, DataLoaderStateMixin):</li> <li> """</li> <li> Subclass of `DataLoaderAdapter` that will iterate and preprocess on process 0 only, then dispatch on each process</li> <li> their part of the batch.</li> <li></li> <li> Args:</li> <li> split_batches (`bool`, *optional*, defaults to `False`):</li> <li> Whether the resulting `DataLoader` should split the batches of the original data loader across devices or</li> <li> yield full batches (in which case it will yield batches starting at the `process_index`-th and advancing of</li> <li> `num_processes` batches at each iteration). Another way to see this is that the observed batch size will be</li> <li> the same as the initial `dataloader` if this option is set to `True`, the batch size of the initial</li> </ol> </code></pre> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
How to login to Huggingface Hub with Access Token
https://discuss.huggingface.co/t/how-to-login-to-huggingface-hub-with-access-token/22498
22,498
5
2022-09-03T22:37:16.473000Z
[ { "id": 43671, "name": "Christopher Brown", "username": "mrlordbrown", "avatar_template": "/user_avatar/discuss.huggingface.co/mrlordbrown/{size}/5894_2.png", "created_at": "2022-09-03T22:37:16.546Z", "cooked": "<p>Hello and thank you! I looked up this issue but I keep getting topics about ‘tokenizer’ and did not find anything on using access tokens.</p>\n<p>I simply want to login to Huggingface HUB using an access token. I signed up, read the card, accepted its terms by checking the box, setup a conda env, installed huggingface-cli, and then executed huggingface-cli login. When I try and paste my access token (I have tried both read and write) it gives me the following error:</p>\n<pre><code class=\"lang-auto\">Traceback (most recent call last):\n File \"C:\\Users\\mrlor\\anaconda3\\envs\\ldm\\Scripts\\huggingface-cli-script.py\", line 9, in &lt;module&gt;\n sys.exit(main())\n File \"C:\\Users\\mrlor\\anaconda3\\envs\\ldm\\lib\\site-packages\\huggingface_hub\\commands\\huggingface_cli.py\", line 41, in main\n service.run()\n File \"C:\\Users\\mrlor\\anaconda3\\envs\\ldm\\lib\\site-packages\\huggingface_hub\\commands\\user.py\", line 176, in run\n _login(self._api, token=token)\n File \"C:\\Users\\mrlor\\anaconda3\\envs\\ldm\\lib\\site-packages\\huggingface_hub\\commands\\user.py\", line 343, in _login\n token, name = hf_api._validate_or_retrieve_token(token)\n File \"C:\\Users\\mrlor\\anaconda3\\envs\\ldm\\lib\\site-packages\\huggingface_hub\\hf_api.py\", line 691, in _validate_or_retrieve_token\n raise ValueError(\"Invalid token passed!\")\nValueError: Invalid token passed!\n</code></pre>\n<p>I have also tried typing in the access token by hand. I have deleted and created new access tokens. I also have git lfs setup. I restarted my computer and have updated my conda environment. I am sure this is something silly but I have been trying for hours to login with no avail. I thank you for your help!</p>", "post_number": 1, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-03T22:37:16.546Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 187381, "reads": 4544, "readers_count": 4543, "score": 936288.2, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Christopher Brown", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/cant-login-to-huggingface-cli/139741/2", "internal": true, "reflection": true, "title": "Can't login to Huggingface CLI", "clicks": 11 }, { "url": "https://discuss.huggingface.co/t/python-says-locked-or-gated-repository-when-trying-to-tether-huggingface-llama-model/168306/2", "internal": true, "reflection": true, "title": "Python says [locked or gated repository] when trying to tether HuggingFace LLAMA Model", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 9905, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/1", "reactions": [ { "id": "heart", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 43698, "name": "Shivansh", "username": "cvansh", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/{size}.png", "created_at": "2022-09-04T17:19:13.658Z", "cooked": "<p>Facing same issue. Any resolution?</p>", "post_number": 2, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-04T17:19:13.658Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 709, "reads": 3641, "readers_count": 3640, "score": 4282.6, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Shivansh", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 9918, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 43707, "name": "Christopher Brown", "username": "mrlordbrown", "avatar_template": "/user_avatar/discuss.huggingface.co/mrlordbrown/{size}/5894_2.png", "created_at": "2022-09-04T18:58:27.483Z", "cooked": "<p>No, I have not heard from anyone and still can not login.</p>", "post_number": 3, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-04T18:58:27.483Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 607, "reads": 3573, "readers_count": 3572, "score": 3744, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Christopher Brown", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 9905, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 43714, "name": "Farley Knight", "username": "farleyknight", "avatar_template": "/user_avatar/discuss.huggingface.co/farleyknight/{size}/5901_2.png", "created_at": "2022-09-04T20:38:55.681Z", "cooked": "<p>For what it’s worth, I’ve been doing it like this in my scripts:</p>\n<pre><code class=\"lang-auto\">pip install huggingface_hub\npython -c \"from huggingface_hub.hf_api import HfFolder; HfFolder.save_token('MY_HUGGINGFACE_TOKEN_HERE')\"\n</code></pre>\n<p>Not sure if it’s as convenient as pasting your token, but it might work.</p>\n<p>UPDATE: Oh I just realized you are on Windows. I guess my advice might not apply, since I don’t know how to pass code in the command line in Windows. But in general, I guess try using Python to do the login?</p>", "post_number": 4, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-04T20:38:55.681Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 828, "reads": 3527, "readers_count": 3526, "score": 5079.8, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Farley Knight", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 16 } ], "moderator": false, "admin": false, "staff": false, "user_id": 9927, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/4", "reactions": [ { "id": "heart", "type": "emoji", "count": 15 }, { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 16, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 43799, "name": "Bernd Hödl", "username": "Karottenrambo", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/k/c57346/{size}.png", "created_at": "2022-09-05T22:15:09.883Z", "cooked": "<p>I have the same issue, when i enter or paste the string, nothing happens on the coursor, like all my input gets blocked, yes im also on windows:</p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/2X/8/8bfb94e29c2d5dc96babf4ea457f3dc4694fb567.jpeg\" data-download-href=\"/uploads/short-url/jYlnwB0bJK5caqKJ2U1llfduuKb.jpeg?dl=1\" title=\"token\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/2X/8/8bfb94e29c2d5dc96babf4ea457f3dc4694fb567_2_690x280.jpeg\" alt=\"token\" data-base62-sha1=\"jYlnwB0bJK5caqKJ2U1llfduuKb\" width=\"690\" height=\"280\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/2X/8/8bfb94e29c2d5dc96babf4ea457f3dc4694fb567_2_690x280.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/2X/8/8bfb94e29c2d5dc96babf4ea457f3dc4694fb567_2_1035x420.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/2X/8/8bfb94e29c2d5dc96babf4ea457f3dc4694fb567.jpeg 2x\" data-dominant-color=\"181818\"><div class=\"meta\">\n<svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">token</span><span class=\"informations\">1138×462 144 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg>\n</div></a></div></p>\n<p>hoping for help <img src=\"https://emoji.discourse-cdn.com/apple/slight_smile.png?v=12\" title=\":slight_smile:\" class=\"emoji\" alt=\":slight_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 5, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-05T22:15:09.883Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 971, "reads": 3358, "readers_count": 3357, "score": 5561, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Bernd Hödl", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://us1.discourse-cdn.com/hellohellohello/original/2X/8/8bfb94e29c2d5dc96babf4ea457f3dc4694fb567.jpeg", "internal": false, "reflection": false, "title": "8bfb94e29c2d5dc96babf4ea457f3dc4694fb567.jpeg", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 9959, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/5", "reactions": [ { "id": "heart", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 43856, "name": "Christopher Brown", "username": "mrlordbrown", "avatar_template": "/user_avatar/discuss.huggingface.co/mrlordbrown/{size}/5894_2.png", "created_at": "2022-09-06T17:16:47.857Z", "cooked": "<p>So what ended up working for me was instead of using Ctrl+V to paste the access token I right-clicked on the command line and it pasted it. Note that you still won’t see anything on the ‘Token:’ line but it is should be there. Hope this helps!!</p>", "post_number": 6, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-06T17:16:47.857Z", "reply_count": 5, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 648, "reads": 2933, "readers_count": 2932, "score": 3916.2, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Christopher Brown", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 5 } ], "moderator": false, "admin": false, "staff": false, "user_id": 9905, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/6", "reactions": [ { "id": "heart", "type": "emoji", "count": 4 }, { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 5, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 9959, "username": "Karottenrambo", "name": "Bernd Hödl", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/k/c57346/{size}.png" }, "action_code": null, "via_email": null }, { "id": 43929, "name": "Oscar Iván", "username": "moscoebht", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/m/dbc845/{size}.png", "created_at": "2022-09-07T11:20:45.738Z", "cooked": "<p>I cant yet. I have the same problem. I right clicked before to verify that it copied it and if it was pasted, then I used huggingface-cli login, Enter, right click on the command line and enter and nothing. It won’t let me write either. <img src=\"https://emoji.discourse-cdn.com/apple/frowning.png?v=12\" title=\":frowning:\" class=\"emoji\" alt=\":frowning:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 7, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-07T11:20:45.738Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 155, "reads": 2746, "readers_count": 2745, "score": 1318.8, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Oscar Iván", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 10011, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/7", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 9905, "username": "mrlordbrown", "name": "Christopher Brown", "avatar_template": "/user_avatar/discuss.huggingface.co/mrlordbrown/{size}/5894_2.png" }, "action_code": null, "via_email": null }, { "id": 44003, "name": "Mike Mueller", "username": "MooSoup", "avatar_template": "/user_avatar/discuss.huggingface.co/moosoup/{size}/5951_2.png", "created_at": "2022-09-07T21:53:13.799Z", "cooked": "<p>How do you even right click? I can’t right click on anaconda prompt <img src=\"https://emoji.discourse-cdn.com/apple/confused.png?v=12\" title=\":confused:\" class=\"emoji\" alt=\":confused:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 8, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-07T21:53:13.799Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 199, "reads": 2584, "readers_count": 2583, "score": 1541.4, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Mike Mueller", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 10039, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/8", "reactions": [ { "id": "heart", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 9905, "username": "mrlordbrown", "name": "Christopher Brown", "avatar_template": "/user_avatar/discuss.huggingface.co/mrlordbrown/{size}/5894_2.png" }, "action_code": null, "via_email": null }, { "id": 44031, "name": "Shawn Vybiral", "username": "UnqleShawn", "avatar_template": "/user_avatar/discuss.huggingface.co/unqleshawn/{size}/5956_2.png", "created_at": "2022-09-08T04:00:28.601Z", "cooked": "<p>I wasn’t able to create my token with a username or my name so I tried my email registered to huggingface. I used the right click to paste function and it worked. Hope that helps</p>", "post_number": 9, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-08T04:00:28.601Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 334, "reads": 2453, "readers_count": 2452, "score": 2160.2, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Shawn Vybiral", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 10052, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/9", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 44432, "name": "Ryan Sellers", "username": "trapbuilder2", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/t/9d8465/{size}.png", "created_at": "2022-09-12T12:28:24.940Z", "cooked": "<p>Even when I paste the token into the command line, it calls the token invalid</p>\n<p>EDIT: I did it several times in a row and it finally worked, don’t know how.</p>", "post_number": 10, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-12T12:29:30.603Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 463, "reads": 2321, "readers_count": 2320, "score": 2779, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Ryan Sellers", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 10181, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/10", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 9905, "username": "mrlordbrown", "name": "Christopher Brown", "avatar_template": "/user_avatar/discuss.huggingface.co/mrlordbrown/{size}/5894_2.png" }, "action_code": null, "via_email": null }, { "id": 44669, "name": "Anon Anon 23", "username": "ponut64", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/p/85e7bf/{size}.png", "created_at": "2022-09-15T09:42:03.506Z", "cooked": "<p>i just have to come here and say that:</p>\n<ol>\n<li>run the command prompt as admin</li>\n<li>copy your token in</li>\n<li>wait about 5 minutes</li>\n<li>run huggingface-cli login</li>\n<li><strong>right-click the top bar of the command line window, go to “Edit”, and then Paste</strong></li>\n<li>it should work. IF IT DOESN’T WORK, DO IT UNTIL IT DOES.</li>\n</ol>", "post_number": 11, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-15T09:42:03.506Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 429, "reads": 2208, "readers_count": 2207, "score": 2711.4, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Anon Anon 23", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/cant-enter-client-token-in-anaconda-prompt/22664/11", "internal": true, "reflection": true, "title": "Can't Enter Client Token in Anaconda Prompt", "clicks": 68 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 8 } ], "moderator": false, "admin": false, "staff": false, "user_id": 10264, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/11", "reactions": [ { "id": "heart", "type": "emoji", "count": 3 }, { "id": "+1", "type": "emoji", "count": 2 }, { "id": "clap", "type": "emoji", "count": 2 }, { "id": "laughing", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 8, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 44731, "name": "Christopher Brown", "username": "mrlordbrown", "avatar_template": "/user_avatar/discuss.huggingface.co/mrlordbrown/{size}/5894_2.png", "created_at": "2022-09-15T16:34:34.458Z", "cooked": "<p>Thank you all for posting your tricks for logging in! It seems that using hotkeys to paste in the token DOES NOT work (in Windows) so you will have to resort to <em>right-clicking to paste in your token</em> or <em>using Edit-&gt;Paste from the toolbar</em>. Note again that you will not see the token on the command line and will not see asterixis in its place; it will appear completely invisible but will be submitted after your press enter.</p>", "post_number": 12, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-15T16:34:34.458Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 167, "reads": 2021, "readers_count": 2020, "score": 1239.2, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Christopher Brown", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 9905, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/12", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 44858, "name": "Andy DaMandy", "username": "BackfiringDatsun", "avatar_template": "/user_avatar/discuss.huggingface.co/backfiringdatsun/{size}/6097_2.png", "created_at": "2022-09-17T16:30:34.187Z", "cooked": "<p>Same issue. \"ValueError: Invalid token passed! in powershell with correct toket right clicked (at top) and pasted in. I even cleared my token and tried a fresh one…no luck.</p>", "post_number": 13, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-17T16:30:34.187Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 66, "reads": 1805, "readers_count": 1804, "score": 711, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Andy DaMandy", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 10329, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/13", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 44859, "name": "Andy DaMandy", "username": "BackfiringDatsun", "avatar_template": "/user_avatar/discuss.huggingface.co/backfiringdatsun/{size}/6097_2.png", "created_at": "2022-09-17T16:33:46.518Z", "cooked": "<p>Nevermind. Right click edit paste worked. You just won’t see any indication you put in the key. Then press enter. I was probably pasting multiple times or something stupid as the key input field would not show any change but just blink even with the key put it. Anyhoo, it works.</p>", "post_number": 14, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-17T16:33:46.518Z", "reply_count": 0, "reply_to_post_number": 13, "quote_count": 0, "incoming_link_count": 147, "reads": 1698, "readers_count": 1697, "score": 1069.6, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Andy DaMandy", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/cannot-login-into-huggingface-hub-from-paperspace/23893", "internal": true, "reflection": true, "title": "Cannot login into huggingface hub from Paperspace", "clicks": 21 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 10329, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/14", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 10329, "username": "BackfiringDatsun", "name": "Andy DaMandy", "avatar_template": "/user_avatar/discuss.huggingface.co/backfiringdatsun/{size}/6097_2.png" }, "action_code": null, "via_email": null }, { "id": 44891, "name": "IO", "username": "InquisitiveOtter", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/i/9fc348/{size}.png", "created_at": "2022-09-18T00:07:09.759Z", "cooked": "<p>In the anaconda prompt, just the act of right-clicking will paste your item. I got mine to work by copying the token, typing: huggingface-cli login into the anaconda prompt, literally just right-clicking on the window, and pressing enter.</p>", "post_number": 15, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-18T00:07:09.759Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 205, "reads": 1583, "readers_count": 1582, "score": 1351.6, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "IO", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 10338, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/15", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 45097, "name": "V", "username": "robotninja", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/{size}.png", "created_at": "2022-09-21T02:30:48.847Z", "cooked": "<p>Also, another way to go is to go to your “\\virtualenv\\Lib\\site-packages\\huggingface_hub\\commands” folder and there is a file in there called “user” or “userpy”. Edit the file and go to the area in the middle that looks like the huggingface login. The line should say <em>token = getpass (\"Token: \")</em> Change this line to say <strong>token = “<em>this is where your hugging face token goes including the quotation marks</em>” <span class=\"hashtag\">#getpass</span>(\"Token: \")</strong><br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/2X/f/f460bcb5ccb6fca931bdcbefa75fc2f9e58e26bf.png\" data-download-href=\"/uploads/short-url/yRRLbXrlLDaHtQfeNI50R0oijhB.png?dl=1\" title=\"Screenshot 2022-09-20 184134\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/2X/f/f460bcb5ccb6fca931bdcbefa75fc2f9e58e26bf.png\" alt=\"Screenshot 2022-09-20 184134\" data-base62-sha1=\"yRRLbXrlLDaHtQfeNI50R0oijhB\" width=\"469\" height=\"500\" data-small-upload=\"https://us1.discourse-cdn.com/hellohellohello/optimized/2X/f/f460bcb5ccb6fca931bdcbefa75fc2f9e58e26bf_2_10x10.png\"><div class=\"meta\">\n<svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">Screenshot 2022-09-20 184134</span><span class=\"informations\">668×712 36.2 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg>\n</div></a></div></p>\n<p>save file then run huggingface-cli login</p>", "post_number": 16, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-21T02:30:48.847Z", "reply_count": 2, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 540, "reads": 1582, "readers_count": 1581, "score": 3051.4, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "V", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://us1.discourse-cdn.com/hellohellohello/original/2X/f/f460bcb5ccb6fca931bdcbefa75fc2f9e58e26bf.png", "internal": false, "reflection": false, "title": "f460bcb5ccb6fca931bdcbefa75fc2f9e58e26bf.png", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 10412, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/16", "reactions": [ { "id": "heart", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 45308, "name": "Albert Destajo", "username": "albertdestajo", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/{size}.png", "created_at": "2022-09-24T04:55:00.197Z", "cooked": "<p>If you are using anaconda prompt and is having <strong>[WinError 2] File Not Found</strong> issue, try to install git first using the following command,</p>\n<p>conda install -c anaconda git</p>", "post_number": 17, "post_type": 1, "posts_count": 41, "updated_at": "2022-09-24T04:55:00.197Z", "reply_count": 1, "reply_to_post_number": 16, "quote_count": 0, "incoming_link_count": 105, "reads": 1355, "readers_count": 1354, "score": 816, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Albert Destajo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/invalid-token-passed/22711/9", "internal": true, "reflection": true, "title": "Invalid token passed?", "clicks": 54 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 10495, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/17", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 10412, "username": "robotninja", "name": "V", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/r/59ef9b/{size}.png" }, "action_code": null, "via_email": null }, { "id": 47219, "name": "JANE ARLETH DELA CRUZ", "username": "janearlethitgo", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/ea666f/{size}.png", "created_at": "2022-10-20T09:07:06.342Z", "cooked": "<p>thanks for this! this worked for me <img src=\"https://emoji.discourse-cdn.com/apple/slight_smile.png?v=12\" title=\":slight_smile:\" class=\"emoji\" alt=\":slight_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 18, "post_type": 1, "posts_count": 41, "updated_at": "2022-10-20T09:07:06.342Z", "reply_count": 0, "reply_to_post_number": 17, "quote_count": 0, "incoming_link_count": 100, "reads": 1235, "readers_count": 1234, "score": 747, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "JANE ARLETH DELA CRUZ", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 11148, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/18", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 10495, "username": "albertdestajo", "name": "Albert Destajo", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/a/a9a28c/{size}.png" }, "action_code": null, "via_email": null }, { "id": 49222, "name": "Chai Chaoweeraprasit", "username": "jaywee1115", "avatar_template": "/user_avatar/discuss.huggingface.co/jaywee1115/{size}/12513_2.png", "created_at": "2022-11-12T01:40:48.493Z", "cooked": "<p>It looks like pasting the token actually works fine for me. The problem is just that the login screen doesn’t show any visual indication that it does! So, just use whatever way you normally paste text onto your terminal screen on this login screen and hit Enter, and it’ll work. Seems like a very trivial fix on the login screen to at least shows dots in-place once the pasted text is entered.</p>", "post_number": 19, "post_type": 1, "posts_count": 41, "updated_at": "2022-11-12T01:40:48.493Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 159, "reads": 1182, "readers_count": 1181, "score": 1031.4, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Chai Chaoweeraprasit", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 11906, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/19", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 63371, "name": "Juan Stoppa", "username": "jstoppa", "avatar_template": "/user_avatar/discuss.huggingface.co/jstoppa/{size}/26669_2.png", "created_at": "2023-04-02T20:36:17.131Z", "cooked": "<p>same for me, this seems to be the problem</p>", "post_number": 20, "post_type": 1, "posts_count": 41, "updated_at": "2023-04-02T20:36:17.131Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 386, "reads": 1226, "readers_count": 1225, "score": 2175.2, "yours": false, "topic_id": 22498, "topic_slug": "how-to-login-to-huggingface-hub-with-access-token", "display_username": "Juan Stoppa", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 17343, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-login-to-huggingface-hub-with-access-token/22498/20", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 9905, "username": "mrlordbrown", "name": "Christopher Brown", "avatar_template": "/user_avatar/discuss.huggingface.co/mrlordbrown/{size}/5894_2.png" }, "action_code": null, "via_email": null } ]
<p>Hello and thank you! I looked up this issue but I keep getting topics about ‘tokenizer’ and did not find anything on using access tokens.</p> <p>I simply want to login to Huggingface HUB using an access token. I signed up, read the card, accepted its terms by checking the box, setup a conda env, installed huggingface-cli, and then executed huggingface-cli login. When I try and paste my access token (I have tried both read and write) it gives me the following error:</p> <pre><code class="lang-auto">Traceback (most recent call last): File "C:\Users\mrlor\anaconda3\envs\ldm\Scripts\huggingface-cli-script.py", line 9, in &lt;module&gt; sys.exit(main()) File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\commands\huggingface_cli.py", line 41, in main service.run() File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\commands\user.py", line 176, in run _login(self._api, token=token) File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\commands\user.py", line 343, in _login token, name = hf_api._validate_or_retrieve_token(token) File "C:\Users\mrlor\anaconda3\envs\ldm\lib\site-packages\huggingface_hub\hf_api.py", line 691, in _validate_or_retrieve_token raise ValueError("Invalid token passed!") ValueError: Invalid token passed! </code></pre> <p>I have also tried typing in the access token by hand. I have deleted and created new access tokens. I also have git lfs setup. I restarted my computer and have updated my conda environment. I am sure this is something silly but I have been trying for hours to login with no avail. I thank you for your help!</p>
<p>So what ended up working for me was instead of using Ctrl+V to paste the access token I right-clicked on the command line and it pasted it. Note that you still won’t see anything on the ‘Token:’ line but it is should be there. Hope this helps!!</p>
Pad token vs -100 index_id
https://discuss.huggingface.co/t/pad-token-vs-100-index-id/148352
148,352
6
2025-04-01T10:39:10.980000Z
[ { "id": 212683, "name": "Molly Petersen", "username": "vikipedia", "avatar_template": "/user_avatar/discuss.huggingface.co/vikipedia/{size}/44548_2.png", "created_at": "2025-04-01T10:39:11.045Z", "cooked": "<p>I understand the -100 label id is used so that the predictions for these are not included when calculating the loss.</p>\n<p>However <a href=\"https://huggingface.co/patrickvonplaten/bert2gpt2-cnn_dailymail-fp16#bert2gpt2-summarization-with-%F0%9F%A4%97-encoderdecoder-framework\">here</a>, they state “complicated list comprehension here because pad_token_id alone is not good enough to know whether label should be excluded or not”, when replacing pad tokens. In the implementation, they use nn.CrossEntropyLoss(), which has an argument “ignore_index”.</p>\n<p>Is there any benefit to changing the id to -100 as opposed to adding the argument ignore_index in the loss and setting it as the pad token id? Or are the results the same?</p>\n<p>The way it is written makes me think there is some benefit, but the description of “ignore_index” appears to achieve what is wanted. Or was this just a choice in case someone chose to change the pad token id?</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-01T10:39:11.045Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 50, "reads": 5, "readers_count": 4, "score": 256, "yours": false, "topic_id": 148352, "topic_slug": "pad-token-vs-100-index-id", "display_username": "Molly Petersen", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/patrickvonplaten/bert2gpt2-cnn_dailymail-fp16#bert2gpt2-summarization-with-%F0%9F%A4%97-encoderdecoder-framework", "internal": false, "reflection": false, "title": "patrickvonplaten/bert2gpt2-cnn_dailymail-fp16 · Hugging Face", "clicks": 6 } ], "read": true, "user_title": "", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89147, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/pad-token-vs-100-index-id/148352/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212812, "name": "Joshua Getner", "username": "jgetner", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5e9695/{size}.png", "created_at": "2025-04-01T19:10:33.030Z", "cooked": "<p>Its just for when someone wants to change the pad token id.</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-01T19:10:33.030Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 30.8, "yours": false, "topic_id": 148352, "topic_slug": "pad-token-vs-100-index-id", "display_username": "Joshua Getner", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89186, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/pad-token-vs-100-index-id/148352/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212919, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-02T09:20:55.222Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-02T09:20:55.222Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 1, "readers_count": 0, "score": 0.2, "yours": false, "topic_id": 148352, "topic_slug": "pad-token-vs-100-index-id", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/pad-token-vs-100-index-id/148352/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I understand the -100 label id is used so that the predictions for these are not included when calculating the loss.</p> <p>However <a href="https://huggingface.co/patrickvonplaten/bert2gpt2-cnn_dailymail-fp16#bert2gpt2-summarization-with-%F0%9F%A4%97-encoderdecoder-framework">here</a>, they state “complicated list comprehension here because pad_token_id alone is not good enough to know whether label should be excluded or not”, when replacing pad tokens. In the implementation, they use nn.CrossEntropyLoss(), which has an argument “ignore_index”.</p> <p>Is there any benefit to changing the id to -100 as opposed to adding the argument ignore_index in the loss and setting it as the pad token id? Or are the results the same?</p> <p>The way it is written makes me think there is some benefit, but the description of “ignore_index” appears to achieve what is wanted. Or was this just a choice in case someone chose to change the pad token id?</p>
<p>Its just for when someone wants to change the pad token id.</p>
For some reason GradioUI(agent).launch() can&rsquo;t detect the sqlite tables. even though the prints in the tool function returns the correct engine
https://discuss.huggingface.co/t/for-some-reason-gradioui-agent-launch-cant-detect-the-sqlite-tables-even-though-the-prints-in-the-tool-function-returns-the-correct-engine/148318
148,318
5
2025-04-01T06:22:27.533000Z
[ { "id": 212628, "name": "Ryan Ng", "username": "n094t23g", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/n/8dc957/{size}.png", "created_at": "2025-04-01T06:22:27.592Z", "cooked": "<p>I am trying this out: <a href=\"https://huggingface.co/docs/smolagents/examples/text_to_sql\" class=\"inline-onebox\">Text-to-SQL</a> in my hf space as a pro user.<br>\nfor some reason GradioUI(agent).launch() can’t detect the sqlite tables. even though the prints in the tool function returns the correct engine.</p>\n<pre><code class=\"lang-auto\">\n@tool\ndef sql_engine_tool(query: str) -&gt; str:\n \"\"\"\n Allows you to perform SQL queries on the table. Returns a string representation of the result.\n The table is named 'receipts'. Its description is as follows:\n Columns:\n - receipt_id: INTEGER\n - customer_name: VARCHAR(16)\n - price: FLOAT\n - tip: FLOAT\n\n Args:\n query: The query to perform. This should be correct SQL.\n\n \"\"\"\n output = \"\"\n print(\"debug sql_engine_tool\")\n print(engine)\n with engine.connect() as con:\n print(con.connection)\n print(metadata_objects.tables.keys())\n result = con.execute(\n text(\n \"SELECT name FROM sqlite_master WHERE type='table' AND name='receipts'\"\n )\n )\n print(\"tables available:\", result.fetchone())\n\n rows = con.execute(text(query))\n for row in rows:\n output += \"\\n\" + str(row)\n return output\n\n\ndef init_db(engine):\n\n metadata_obj = MetaData()\n\n def insert_rows_into_table(rows, table, engine=engine):\n for row in rows:\n stmt = insert(table).values(**row)\n with engine.begin() as connection:\n connection.execute(stmt)\n\n table_name = \"receipts\"\n receipts = Table(\n table_name,\n metadata_obj,\n Column(\"receipt_id\", Integer, primary_key=True),\n Column(\"customer_name\", String(16), primary_key=True),\n Column(\"price\", Float),\n Column(\"tip\", Float),\n )\n metadata_obj.create_all(engine)\n\n rows = [\n {\"receipt_id\": 1, \"customer_name\": \"Alan Payne\", \"price\": 12.06, \"tip\": 1.20},\n {\"receipt_id\": 2, \"customer_name\": \"Alex Mason\", \"price\": 23.86, \"tip\": 0.24},\n {\n \"receipt_id\": 3,\n \"customer_name\": \"Woodrow Wilson\",\n \"price\": 53.43,\n \"tip\": 5.43,\n },\n {\n \"receipt_id\": 4,\n \"customer_name\": \"Margaret James\",\n \"price\": 21.11,\n \"tip\": 1.00,\n },\n ]\n insert_rows_into_table(rows, receipts)\n with engine.begin() as conn:\n print(\"SELECT test\", conn.execute(text(\"SELECT * FROM receipts\")).fetchall())\n print(\"init_db debug\")\n print(engine)\n print()\n return engine, metadata_obj\n\n\nif __name__ == \"__main__\":\n engine = create_engine(\"sqlite:///:memory:\")\n engine, metadata_objects = init_db(engine)\n model = HfApiModel(\n model_id=\"meta-llama/Meta-Llama-3.1-8B-Instruct\",\n token=os.getenv(\"my_first_agents_hf_tokens\"),\n )\n\n agent = CodeAgent(\n tools=[sql_engine_tool],\n # system_prompt=\"\"\"\n # You are a text to sql converter\n # \"\"\",\n model=model,\n max_steps=1,\n verbosity_level=1,\n )\n # agent.run(\"What is the average each customer paid?\")\n GradioUI(agent).launch()\n\n\n</code></pre>\n<p>edit: I may need to just use gr.blocks instead and reimplement some things. I am not the most familiar with this library this will be tricky for me.</p>\n<p>LOG MESSAGES:</p>\n<pre><code class=\"lang-auto\">debug sql_engine_tool\nEngine(sqlite:///:memory:)\n&lt;sqlalchemy.pool.base._ConnectionFairy object at 0x7f9228250ee0&gt;\ndict_keys(['receipts'])\ntables available: None\nCode execution failed at line 'customer_total = sql_engine_tool(engine=engine, \nquery=query)' due to: OperationalError: (sqlite3.OperationalError) no such \ntable: receipts\n</code></pre>\n<p>edit: I don’t wish to put in too much codes I have written since here but I have tried gr.Blocks(), stream_to_gradio(), they are not working. if I directly use the tool function to SELECT * FROM receipts, it works</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-01T11:18:03.826Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 12, "reads": 4, "readers_count": 3, "score": 75.8, "yours": false, "topic_id": 148318, "topic_slug": "for-some-reason-gradioui-agent-launch-cant-detect-the-sqlite-tables-even-though-the-prints-in-the-tool-function-returns-the-correct-engine", "display_username": "Ryan Ng", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 10, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/smolagents/examples/text_to_sql", "internal": false, "reflection": false, "title": "Text-to-SQL", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89067, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/for-some-reason-gradioui-agent-launch-cant-detect-the-sqlite-tables-even-though-the-prints-in-the-tool-function-returns-the-correct-engine/148318/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212700, "name": "Ryan Ng", "username": "n094t23g", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/n/8dc957/{size}.png", "created_at": "2025-04-01T11:35:02.570Z", "cooked": "<p>By changing to<code>sqlite://:localhost:</code> I have solve the issue.</p>\n<p><a href=\"https://stackoverflow.com/questions/79548083/sqlite-table-does-not-exist-within-gradio-blocks-or-gradioui-even-after-creating?noredirect=1#comment140286595_79548083\" rel=\"noopener nofollow ugc\">Thanks to rasjani from stackoverflow.</a></p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-04-01T12:09:26.315Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 15.8, "yours": false, "topic_id": 148318, "topic_slug": "for-some-reason-gradioui-agent-launch-cant-detect-the-sqlite-tables-even-though-the-prints-in-the-tool-function-returns-the-correct-engine", "display_username": "Ryan Ng", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://stackoverflow.com/questions/79548083/sqlite-table-does-not-exist-within-gradio-blocks-or-gradioui-even-after-creating?noredirect=1#comment140286595_79548083", "internal": false, "reflection": false, "title": "python - sqlite table does not exist within gradio blocks or GradioUI even after creating said table - Stack Overflow", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89067, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/for-some-reason-gradioui-agent-launch-cant-detect-the-sqlite-tables-even-though-the-prints-in-the-tool-function-returns-the-correct-engine/148318/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212850, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-01T23:35:15.496Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-04-01T23:35:15.496Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 148318, "topic_slug": "for-some-reason-gradioui-agent-launch-cant-detect-the-sqlite-tables-even-though-the-prints-in-the-tool-function-returns-the-correct-engine", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/for-some-reason-gradioui-agent-launch-cant-detect-the-sqlite-tables-even-though-the-prints-in-the-tool-function-returns-the-correct-engine/148318/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I am trying this out: <a href="https://huggingface.co/docs/smolagents/examples/text_to_sql" class="inline-onebox">Text-to-SQL</a> in my hf space as a pro user.<br> for some reason GradioUI(agent).launch() can’t detect the sqlite tables. even though the prints in the tool function returns the correct engine.</p> <pre><code class="lang-auto"> @tool def sql_engine_tool(query: str) -&gt; str: """ Allows you to perform SQL queries on the table. Returns a string representation of the result. The table is named 'receipts'. Its description is as follows: Columns: - receipt_id: INTEGER - customer_name: VARCHAR(16) - price: FLOAT - tip: FLOAT Args: query: The query to perform. This should be correct SQL. """ output = "" print("debug sql_engine_tool") print(engine) with engine.connect() as con: print(con.connection) print(metadata_objects.tables.keys()) result = con.execute( text( "SELECT name FROM sqlite_master WHERE type='table' AND name='receipts'" ) ) print("tables available:", result.fetchone()) rows = con.execute(text(query)) for row in rows: output += "\n" + str(row) return output def init_db(engine): metadata_obj = MetaData() def insert_rows_into_table(rows, table, engine=engine): for row in rows: stmt = insert(table).values(**row) with engine.begin() as connection: connection.execute(stmt) table_name = "receipts" receipts = Table( table_name, metadata_obj, Column("receipt_id", Integer, primary_key=True), Column("customer_name", String(16), primary_key=True), Column("price", Float), Column("tip", Float), ) metadata_obj.create_all(engine) rows = [ {"receipt_id": 1, "customer_name": "Alan Payne", "price": 12.06, "tip": 1.20}, {"receipt_id": 2, "customer_name": "Alex Mason", "price": 23.86, "tip": 0.24}, { "receipt_id": 3, "customer_name": "Woodrow Wilson", "price": 53.43, "tip": 5.43, }, { "receipt_id": 4, "customer_name": "Margaret James", "price": 21.11, "tip": 1.00, }, ] insert_rows_into_table(rows, receipts) with engine.begin() as conn: print("SELECT test", conn.execute(text("SELECT * FROM receipts")).fetchall()) print("init_db debug") print(engine) print() return engine, metadata_obj if __name__ == "__main__": engine = create_engine("sqlite:///:memory:") engine, metadata_objects = init_db(engine) model = HfApiModel( model_id="meta-llama/Meta-Llama-3.1-8B-Instruct", token=os.getenv("my_first_agents_hf_tokens"), ) agent = CodeAgent( tools=[sql_engine_tool], # system_prompt=""" # You are a text to sql converter # """, model=model, max_steps=1, verbosity_level=1, ) # agent.run("What is the average each customer paid?") GradioUI(agent).launch() </code></pre> <p>edit: I may need to just use gr.blocks instead and reimplement some things. I am not the most familiar with this library this will be tricky for me.</p> <p>LOG MESSAGES:</p> <pre><code class="lang-auto">debug sql_engine_tool Engine(sqlite:///:memory:) &lt;sqlalchemy.pool.base._ConnectionFairy object at 0x7f9228250ee0&gt; dict_keys(['receipts']) tables available: None Code execution failed at line 'customer_total = sql_engine_tool(engine=engine, query=query)' due to: OperationalError: (sqlite3.OperationalError) no such table: receipts </code></pre> <p>edit: I don’t wish to put in too much codes I have written since here but I have tried gr.Blocks(), stream_to_gradio(), they are not working. if I directly use the tool function to SELECT * FROM receipts, it works</p>
<p>By changing to<code>sqlite://:localhost:</code> I have solve the issue.</p> <p><a href="https://stackoverflow.com/questions/79548083/sqlite-table-does-not-exist-within-gradio-blocks-or-gradioui-even-after-creating?noredirect=1#comment140286595_79548083" rel="noopener nofollow ugc">Thanks to rasjani from stackoverflow.</a></p>
Bot / Garbage Accounts?
https://discuss.huggingface.co/t/bot-garbage-accounts/148340
148,340
23
2025-04-01T08:42:49.523000Z
[ { "id": 212665, "name": "Mike", "username": "mWiegand", "avatar_template": "/user_avatar/discuss.huggingface.co/mwiegand/{size}/44536_2.png", "created_at": "2025-04-01T08:42:49.597Z", "cooked": "<p>Hi,</p>\n<p>while checking the models I happen to notice a few thousand of them being created 1970-01-01 and seem to contain nothing relevant. In fact, all models of the follow users only contain a gitatributes and sometimes a best_gene.json like these</p>\n<pre><code class=\"lang-auto\">https://huggingface.co/pypert/hurriers/tree/main\nhttps://huggingface.co/shropsdarcey84/arianrhod/tree/main\nhttps://huggingface.co/vinningrev201/glaciered/tree/main\n</code></pre>\n<p>Possible Spam users</p>\n<pre><code class=\"lang-auto\">https://huggingface.co/shropsdarcey84\nhttps://huggingface.co/jaydapichon68\nhttps://huggingface.co/vinningrev201\nhttps://huggingface.co/pypert\nhttps://huggingface.co/passfh\n</code></pre>\n<p>I just want to bring that to the admins attention in case you’d like to keep your model lsit clean. In case you like more details, I can share whatever information I have.</p>\n<p>Best<br>\nMike</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-01T08:42:49.597Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 6, "reads": 9, "readers_count": 8, "score": 46.8, "yours": false, "topic_id": 148340, "topic_slug": "bot-garbage-accounts", "display_username": "Mike", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89139, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/bot-garbage-accounts/148340/1", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212676, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-04-01T10:23:05.834Z", "cooked": "<p>(Probably) since the second half of last year, there have been a series of almost identical cases of harassment.<br>\nIt is possible to report from the model page, so I think that will get through to HF.</p>\n<p>Also, in the case of reporting this kind of harassment, it seems that HF Discord is easier for HF to deal with.<br>\nIn addition to Discord, you can use the support email or the issue column on github below for Hub issues.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/huggingface/hub-docs/issues\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/huggingface/hub-docs/issues\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/344;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/5/25df387b7fcebc6c884004bc125ef3504163d1c4_2_690x345.png\" class=\"thumbnail\" data-dominant-color=\"F4F2EB\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://github.com/huggingface/hub-docs/issues\" target=\"_blank\" rel=\"noopener\">huggingface/hub-docs</a></h3>\n\n <p>Docs of the Hugging Face Hub. Contribute to huggingface/hub-docs development by creating an account on GitHub.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<p><a href=\"mailto:[email protected]\">[email protected]</a></p>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-01T10:23:05.834Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 9, "readers_count": 8, "score": 6.8, "yours": false, "topic_id": 148340, "topic_slug": "bot-garbage-accounts", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/hub-docs/issues", "internal": false, "reflection": false, "title": "GitHub · Where software is built", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/bot-garbage-accounts/148340/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212682, "name": "Mike", "username": "mWiegand", "avatar_template": "/user_avatar/discuss.huggingface.co/mwiegand/{size}/44536_2.png", "created_at": "2025-04-01T10:34:44.518Z", "cooked": "<p>Thanks for your guidance <img src=\"https://emoji.discourse-cdn.com/apple/+1.png?v=14\" title=\":+1:\" class=\"emoji\" alt=\":+1:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-01T10:34:44.518Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 1, "reads": 7, "readers_count": 6, "score": 21.4, "yours": false, "topic_id": 148340, "topic_slug": "bot-garbage-accounts", "display_username": "Mike", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89139, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/bot-garbage-accounts/148340/3", "reactions": [ { "id": "hugs", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 212848, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-01T22:35:26.591Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-01T22:35:26.591Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 4, "readers_count": 3, "score": 5.8, "yours": false, "topic_id": 148340, "topic_slug": "bot-garbage-accounts", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/bot-garbage-accounts/148340/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi,</p> <p>while checking the models I happen to notice a few thousand of them being created 1970-01-01 and seem to contain nothing relevant. In fact, all models of the follow users only contain a gitatributes and sometimes a best_gene.json like these</p> <pre><code class="lang-auto">https://huggingface.co/pypert/hurriers/tree/main https://huggingface.co/shropsdarcey84/arianrhod/tree/main https://huggingface.co/vinningrev201/glaciered/tree/main </code></pre> <p>Possible Spam users</p> <pre><code class="lang-auto">https://huggingface.co/shropsdarcey84 https://huggingface.co/jaydapichon68 https://huggingface.co/vinningrev201 https://huggingface.co/pypert https://huggingface.co/passfh </code></pre> <p>I just want to bring that to the admins attention in case you’d like to keep your model lsit clean. In case you like more details, I can share whatever information I have.</p> <p>Best<br> Mike</p>
<p>(Probably) since the second half of last year, there have been a series of almost identical cases of harassment.<br> It is possible to report from the model page, so I think that will get through to HF.</p> <p>Also, in the case of reporting this kind of harassment, it seems that HF Discord is easier for HF to deal with.<br> In addition to Discord, you can use the support email or the issue column on github below for Hub issues.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/huggingface/hub-docs/issues"> <header class="source"> <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32"> <a href="https://github.com/huggingface/hub-docs/issues" target="_blank" rel="noopener">GitHub</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/344;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/5/25df387b7fcebc6c884004bc125ef3504163d1c4_2_690x345.png" class="thumbnail" data-dominant-color="F4F2EB" width="690" height="345"></div> <h3><a href="https://github.com/huggingface/hub-docs/issues" target="_blank" rel="noopener">huggingface/hub-docs</a></h3> <p>Docs of the Hugging Face Hub. Contribute to huggingface/hub-docs development by creating an account on GitHub.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <p><a href="mailto:[email protected]">[email protected]</a></p>
Error generating DOI
https://discuss.huggingface.co/t/error-generating-doi/40394
40,394
23
2023-05-19T15:22:38.328000Z
[ { "id": 70207, "name": "David Romero Santos", "username": "davidlms", "avatar_template": "/user_avatar/discuss.huggingface.co/davidlms/{size}/16219_2.png", "created_at": "2023-05-19T15:22:38.384Z", "cooked": "<p>Hello,</p>\n<p>I have generated a DOI with Hugging Face, but in spite of putting in the load script the citation, it has not generate the correct data. How could I modify it?</p>\n<p>Thank you very much.</p>", "post_number": 1, "post_type": 1, "posts_count": 9, "updated_at": "2023-05-19T15:22:38.384Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 93, "reads": 17, "readers_count": 16, "score": 468.4, "yours": false, "topic_id": 40394, "topic_slug": "error-generating-doi", "display_username": "David Romero Santos", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 20218, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/error-generating-doi/40394/1", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 70214, "name": "Mario Šaško", "username": "mariosasko", "avatar_template": "/user_avatar/discuss.huggingface.co/mariosasko/{size}/31548_2.png", "created_at": "2023-05-19T16:02:54.916Z", "cooked": "<p>You should be able to re-generate it as explained in the docs here: <a href=\"https://huggingface.co/docs/hub/doi#can-i-regenerate-a-new-doi-if-my-model-or-dataset-changes\" class=\"inline-onebox\">Digital Object Identifier (DOI)</a></p>", "post_number": 2, "post_type": 1, "posts_count": 9, "updated_at": "2023-05-19T16:02:54.916Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 16, "readers_count": 15, "score": 8.2, "yours": false, "topic_id": 40394, "topic_slug": "error-generating-doi", "display_username": "Mario Šaško", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/hub/doi#can-i-regenerate-a-new-doi-if-my-model-or-dataset-changes", "internal": false, "reflection": false, "title": "Digital Object Identifier (DOI)", "clicks": 11 } ], "read": true, "user_title": "", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 3725, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/error-generating-doi/40394/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 70235, "name": "David Romero Santos", "username": "davidlms", "avatar_template": "/user_avatar/discuss.huggingface.co/davidlms/{size}/16219_2.png", "created_at": "2023-05-19T20:08:47.949Z", "cooked": "<p>Thanks <a class=\"mention\" href=\"/u/mariosasko\">@mariosasko</a>!</p>\n<p>But… If I do that, I will get the same result. I want to know how to indicate, for example, the correct author for the DOI to generate it accurate.</p>\n<p>Greetings.</p>", "post_number": 3, "post_type": 1, "posts_count": 9, "updated_at": "2023-05-19T20:08:47.949Z", "reply_count": 1, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 16, "readers_count": 15, "score": 8.2, "yours": false, "topic_id": 40394, "topic_slug": "error-generating-doi", "display_username": "David Romero Santos", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 20218, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/error-generating-doi/40394/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 3725, "username": "mariosasko", "name": "Mario Šaško", "avatar_template": "/user_avatar/discuss.huggingface.co/mariosasko/{size}/31548_2.png" }, "action_code": null, "via_email": null }, { "id": 70392, "name": "Mario Šaško", "username": "mariosasko", "avatar_template": "/user_avatar/discuss.huggingface.co/mariosasko/{size}/31548_2.png", "created_at": "2023-05-21T15:47:04.915Z", "cooked": "<p>This is currently not possible. We have an issue open for this feature <a href=\"https://github.com/huggingface/hub-docs/issues/453\">here</a>.</p>", "post_number": 4, "post_type": 1, "posts_count": 9, "updated_at": "2023-05-21T15:47:04.915Z", "reply_count": 1, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 3, "reads": 13, "readers_count": 12, "score": 22.6, "yours": false, "topic_id": 40394, "topic_slug": "error-generating-doi", "display_username": "Mario Šaško", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/hub-docs/issues/453", "internal": false, "reflection": false, "title": "[FEATURE REQUEST] Custom author list when generating DOIs · Issue #453 · huggingface/hub-docs · GitHub", "clicks": 5 } ], "read": true, "user_title": "", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 3725, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/error-generating-doi/40394/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 20218, "username": "davidlms", "name": "David Romero Santos", "avatar_template": "/user_avatar/discuss.huggingface.co/davidlms/{size}/16219_2.png" }, "action_code": null, "via_email": null }, { "id": 70404, "name": "David Romero Santos", "username": "davidlms", "avatar_template": "/user_avatar/discuss.huggingface.co/davidlms/{size}/16219_2.png", "created_at": "2023-05-21T18:34:14.709Z", "cooked": "<p>Ok, thank you very much, I have already seen that you have added my request in the issue.</p>\n<p>And while it’s being fixed, is there any way to disable the repository DOI? It doesn’t seem right to me that the data is incorrect. maybe writing to support?</p>", "post_number": 5, "post_type": 1, "posts_count": 9, "updated_at": "2023-05-21T18:34:14.709Z", "reply_count": 1, "reply_to_post_number": 4, "quote_count": 0, "incoming_link_count": 0, "reads": 11, "readers_count": 10, "score": 7.2, "yours": false, "topic_id": 40394, "topic_slug": "error-generating-doi", "display_username": "David Romero Santos", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 20218, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/error-generating-doi/40394/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 3725, "username": "mariosasko", "name": "Mario Šaško", "avatar_template": "/user_avatar/discuss.huggingface.co/mariosasko/{size}/31548_2.png" }, "action_code": null, "via_email": null }, { "id": 70417, "name": "Mario Šaško", "username": "mariosasko", "avatar_template": "/user_avatar/discuss.huggingface.co/mariosasko/{size}/31548_2.png", "created_at": "2023-05-21T22:44:07.233Z", "cooked": "<p>You can email <a href=\"mailto:[email protected]\">[email protected]</a> to request the DOI removal (as explained <a href=\"https://huggingface.co/docs/hub/doi#why-is-there-locked-by-doi-message-on-delete-rename-and-change-visibility-action-on-my-model-or-dataset\">here</a>)</p>", "post_number": 6, "post_type": 1, "posts_count": 9, "updated_at": "2023-05-21T22:44:07.233Z", "reply_count": 0, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 0, "reads": 10, "readers_count": 9, "score": 2, "yours": false, "topic_id": 40394, "topic_slug": "error-generating-doi", "display_username": "Mario Šaško", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/hub/doi#why-is-there-locked-by-doi-message-on-delete-rename-and-change-visibility-action-on-my-model-or-dataset", "internal": false, "reflection": false, "title": "Digital Object Identifier (DOI)", "clicks": 4 } ], "read": true, "user_title": "", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 3725, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/error-generating-doi/40394/6", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 20218, "username": "davidlms", "name": "David Romero Santos", "avatar_template": "/user_avatar/discuss.huggingface.co/davidlms/{size}/16219_2.png" }, "action_code": null, "via_email": null }, { "id": 70452, "name": "David Romero Santos", "username": "davidlms", "avatar_template": "/user_avatar/discuss.huggingface.co/davidlms/{size}/16219_2.png", "created_at": "2023-05-22T07:02:05.080Z", "cooked": "<p>Hello again <a class=\"mention\" href=\"/u/mariosasko\">@mariosasko</a>,</p>\n<p>Thank you very much! I hadn’t noticed that email in the documentation.</p>\n<p>Sorry for the inconvenience.<br>\nBest regards.</p>", "post_number": 7, "post_type": 1, "posts_count": 9, "updated_at": "2023-05-22T07:02:05.080Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 11, "readers_count": 10, "score": 17.2, "yours": false, "topic_id": 40394, "topic_slug": "error-generating-doi", "display_username": "David Romero Santos", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 20218, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/error-generating-doi/40394/7", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 146981, "name": "Elizabeth Campolongo", "username": "egrace479", "avatar_template": "/user_avatar/discuss.huggingface.co/egrace479/{size}/47150_2.png", "created_at": "2024-07-29T19:50:10.475Z", "cooked": "<p>Is there any expectation for when this functionality will be added?</p>", "post_number": 8, "post_type": 1, "posts_count": 9, "updated_at": "2024-07-29T19:50:10.475Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 6, "readers_count": 5, "score": 11.2, "yours": false, "topic_id": 40394, "topic_slug": "error-generating-doi", "display_username": "Elizabeth Campolongo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 20988, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/error-generating-doi/40394/8", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212717, "name": "Sylvestre Bcht", "username": "Sylvestre", "avatar_template": "/user_avatar/discuss.huggingface.co/sylvestre/{size}/24532_2.png", "created_at": "2025-04-01T12:34:00.977Z", "cooked": "<p>Hello!<br>\nThis feature has landed on the hub. Repository maintainers can now customize author information for DOIs through the repository settings:</p>\n<ol>\n<li>Navigate to the repository containing your DOI</li>\n<li>Click on the “Settings” tab</li>\n<li>Click “Generate DOI” from the DOI settings</li>\n<li>Then you can add authors through the new “Authors” field</li>\n</ol>", "post_number": 9, "post_type": 1, "posts_count": 9, "updated_at": "2025-04-01T12:34:00.977Z", "reply_count": 0, "reply_to_post_number": 8, "quote_count": 0, "incoming_link_count": 2, "reads": 4, "readers_count": 3, "score": 25.8, "yours": false, "topic_id": 40394, "topic_slug": "error-generating-doi", "display_username": "Sylvestre Bcht", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 9858, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/error-generating-doi/40394/9", "reactions": [ { "id": "hugs", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 20988, "username": "egrace479", "name": "Elizabeth Campolongo", "avatar_template": "/user_avatar/discuss.huggingface.co/egrace479/{size}/47150_2.png" }, "action_code": null, "via_email": null } ]
<p>Hello,</p> <p>I have generated a DOI with Hugging Face, but in spite of putting in the load script the citation, it has not generate the correct data. How could I modify it?</p> <p>Thank you very much.</p>
<p>This is currently not possible. We have an issue open for this feature <a href="https://github.com/huggingface/hub-docs/issues/453">here</a>.</p>
Space: AttributeError: module &lsquo;gradio&rsquo; has no attribute &lsquo;Sidebar&rsquo;
https://discuss.huggingface.co/t/space-attributeerror-module-gradio-has-no-attribute-sidebar/148236
148,236
5
2025-03-31T16:00:14.717000Z
[ { "id": 212537, "name": "Ryan Ng", "username": "n094t23g", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/n/8dc957/{size}.png", "created_at": "2025-03-31T16:00:14.783Z", "cooked": "<p>I have this error when I trying to build my space:</p>\n<p>===== Application Startup at 2025-03-31 15:51:38 =====</p>\n<p>Traceback (most recent call last):<br>\nFile “/home/user/app/app.py”, line 95, in <br>\nGradioUI(agent).launch()<br>\nFile “/usr/local/lib/python3.10/site-packages/smolagents/gradio_ui.py”, line 265, in launch<br>\nwith gr.Sidebar():<br>\nAttributeError: module ‘gradio’ has no attribute ‘Sidebar’<br>\nTraceback (most recent call last):<br>\nFile “/home/user/app/app.py”, line 95, in <br>\nGradioUI(agent).launch()<br>\nFile “/usr/local/lib/python3.10/site-packages/smolagents/gradio_ui.py”, line 265, in launch<br>\nwith gr.Sidebar():<br>\nAttributeError: module ‘gradio’ has no attribute ‘Sidebar’</p>\n<p>my requirement.txt:</p>\n<p>huggingface_hub&gt;=0.28.0</p>\n<p>smolagents&gt;=1.12.0</p>\n<p>python-dotenv==1.1.0</p>\n<p>sqlalchemy==2.0.40</p>\n<p>gradio&gt;=5.23.1</p>\n<p>I am trying to build my first agents system. but this gradio error kept persisting. What could i have gone wrong here?</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-31T16:00:14.783Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 177, "reads": 11, "readers_count": 10, "score": 872.2, "yours": false, "topic_id": 148236, "topic_slug": "space-attributeerror-module-gradio-has-no-attribute-sidebar", "display_username": "Ryan Ng", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89067, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/space-attributeerror-module-gradio-has-no-attribute-sidebar/148236/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212538, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-31T16:03:11.780Z", "cooked": "<p>At least, the Gradio version of <strong>README.md</strong> takes precedence over <strong>requirements.txt</strong> with regard to the GUI, so it is possible that it is out of date.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/spaces/agents-course/First_agent_template/blob/main/README.md\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/spaces/agents-course/First_agent_template/blob/main/README.md\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/3/03cc248b30005b7cdcbd447e4c2ec2df8a9243a5_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"E4504E\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/spaces/agents-course/First_agent_template/blob/main/README.md\" target=\"_blank\" rel=\"noopener\">README.md · agents-course/First_agent_template at main</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<blockquote>\n<p>sdk_version: 5.15.0</p>\n</blockquote>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-31T16:03:11.780Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 4, "reads": 9, "readers_count": 8, "score": 41.8, "yours": false, "topic_id": 148236, "topic_slug": "space-attributeerror-module-gradio-has-no-attribute-sidebar", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/spaces/agents-course/First_agent_template/blob/main/README.md", "internal": false, "reflection": false, "title": "README.md · agents-course/First_agent_template at main", "clicks": 19 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/space-attributeerror-module-gradio-has-no-attribute-sidebar/148236/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212590, "name": "Ryan Ng", "username": "n094t23g", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/n/8dc957/{size}.png", "created_at": "2025-03-31T23:42:09.810Z", "cooked": "<p>Thanks for the correct direction, I changed it to 5.15 but it threw some errors so I put it to 5.23.2</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-31T23:42:09.810Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 16.6, "yours": false, "topic_id": 148236, "topic_slug": "space-attributeerror-module-gradio-has-no-attribute-sidebar", "display_username": "Ryan Ng", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 89067, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/space-attributeerror-module-gradio-has-no-attribute-sidebar/148236/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 212702, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-04-01T11:42:28.389Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-04-01T11:42:28.389Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 6, "readers_count": 5, "score": 6.2, "yours": false, "topic_id": 148236, "topic_slug": "space-attributeerror-module-gradio-has-no-attribute-sidebar", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/space-attributeerror-module-gradio-has-no-attribute-sidebar/148236/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I have this error when I trying to build my space:</p> <p>===== Application Startup at 2025-03-31 15:51:38 =====</p> <p>Traceback (most recent call last):<br> File “/home/user/app/app.py”, line 95, in <br> GradioUI(agent).launch()<br> File “/usr/local/lib/python3.10/site-packages/smolagents/gradio_ui.py”, line 265, in launch<br> with gr.Sidebar():<br> AttributeError: module ‘gradio’ has no attribute ‘Sidebar’<br> Traceback (most recent call last):<br> File “/home/user/app/app.py”, line 95, in <br> GradioUI(agent).launch()<br> File “/usr/local/lib/python3.10/site-packages/smolagents/gradio_ui.py”, line 265, in launch<br> with gr.Sidebar():<br> AttributeError: module ‘gradio’ has no attribute ‘Sidebar’</p> <p>my requirement.txt:</p> <p>huggingface_hub&gt;=0.28.0</p> <p>smolagents&gt;=1.12.0</p> <p>python-dotenv==1.1.0</p> <p>sqlalchemy==2.0.40</p> <p>gradio&gt;=5.23.1</p> <p>I am trying to build my first agents system. but this gradio error kept persisting. What could i have gone wrong here?</p>
<p>At least, the Gradio version of <strong>README.md</strong> takes precedence over <strong>requirements.txt</strong> with regard to the GUI, so it is possible that it is out of date.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/spaces/agents-course/First_agent_template/blob/main/README.md"> <header class="source"> <a href="https://huggingface.co/spaces/agents-course/First_agent_template/blob/main/README.md" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/3/03cc248b30005b7cdcbd447e4c2ec2df8a9243a5_2_690x372.png" class="thumbnail" data-dominant-color="E4504E" width="690" height="372"></div> <h3><a href="https://huggingface.co/spaces/agents-course/First_agent_template/blob/main/README.md" target="_blank" rel="noopener">README.md · agents-course/First_agent_template at main</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <blockquote> <p>sdk_version: 5.15.0</p> </blockquote>
Optimize GPU Usage for Long-Context Training
https://discuss.huggingface.co/t/optimize-gpu-usage-for-long-context-training/147736
147,736
9
2025-03-27T21:35:53.500000Z
[ { "id": 211877, "name": "Qiyao Wei", "username": "QiyaoWei", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/q/8797f3/{size}.png", "created_at": "2025-03-27T21:35:53.560Z", "cooked": "<p>I am working with a scenario where I need to perform fine-tuning for long-context models. I am specifically interested in optimizing GPU usage for single-GPU long-context training. Currently, I manage to get the training to run at a tokenization length of 8192 by juggling around a few parameters. Ideally, I would like to double or even quadruple that length, because I believe the context windows for the Gemma3 models are at least 32K. Also, I believe doubling the length is possible, because the GPU usage for length=8192 is around 40GB, which is almost exactly half of one A100. However, when I set length=16384, I get <code>CUDA OOM</code>. What are some avenues I can explore to optimize GPU usage, with the obvious two being (1) more GPUs (2) quantizing the model?</p>\n<pre><code class=\"lang-auto\">from datasets import load_dataset\nfrom trl import RewardTrainer, RewardConfig\nfrom peft import LoraConfig, TaskType\nimport torch\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\ntorch.set_default_device('cuda')\n\nmodel = AutoModelForCausalLM.from_pretrained(\"gemma3\", attn_implementation=\"eager\")\ntokenizer = AutoTokenizer.from_pretrained(\"gemma3\")\ntrain_dataset = load_dataset(\"json\", data_files=\"training_data.json\", split=\"train\")\ntokenizer.pad_token = tokenizer.eos_token\n\n# pre-processing the dataset a bit\ndef prefix_with_input(example):\n example['chosen'] = example['input'] + \" \" + example['chosen']\n example['rejected'] = example['input'] + \" \" + example['rejected'][0]\n return example\ntrain_dataset = train_dataset.map(prefix_with_input)\ntrain_dataset = train_dataset.remove_columns([\"input\"])\n\n# explicitly tokenizing the dataset\nmax_length = 8192\ndef tokenize_function(examples):\n return tokenizer(examples[\"chosen\"], max_length=max_length, padding='max_length', truncation=True)\ntrain_dataset = train_dataset.map(tokenize_function, batched=True)\n\ntraining_args = RewardConfig(\n dataloader_pin_memory=False,\n per_device_train_batch_size=1,\n gradient_checkpointing=True,\n gradient_accumulation_steps=4,\n)\ntraining_args.optimize_cuda_cache=True\n\npeft_config = LoraConfig(\n task_type=TaskType.SEQ_CLS,\n inference_mode=False,\n r=8,\n lora_alpha=32,\n lora_dropout=0.1,\n target_modules=[\n \"q_proj\",\n \"k_proj\",\n \"v_proj\",\n \"o_proj\",\n \"gate_proj\",\n \"up_proj\",\n \"down_proj\",\n \"lm_head\",\n ]\n)\n\ntrainer = RewardTrainer(\n model=model,\n args=training_args,\n processing_class=tokenizer,\n train_dataset=train_dataset,\n peft_config=peft_config,\n)\ntrainer.train()\n</code></pre>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-27T21:35:53.560Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 113, "reads": 7, "readers_count": 6, "score": 571.4, "yours": false, "topic_id": 147736, "topic_slug": "optimize-gpu-usage-for-long-context-training", "display_username": "Qiyao Wei", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 42125, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/optimize-gpu-usage-for-long-context-training/147736/1", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211906, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-28T03:25:04.963Z", "cooked": "<p>There are guidelines provided by Hugging Face, so I think it would be a good idea to try those first.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/transformers/perf_train_gpu_one\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/transformers/perf_train_gpu_one\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F5F3ED\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/transformers/perf_train_gpu_one\" target=\"_blank\" rel=\"noopener\">GPU</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/transformers/perf_infer_gpu_one\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/transformers/perf_infer_gpu_one\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F5F3ED\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/transformers/perf_infer_gpu_one\" target=\"_blank\" rel=\"noopener\">GPU</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-28T03:25:04.963Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 7, "readers_count": 6, "score": 6.4, "yours": false, "topic_id": 147736, "topic_slug": "optimize-gpu-usage-for-long-context-training", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/transformers/perf_train_gpu_one", "internal": false, "reflection": false, "title": "GPU", "clicks": 24 }, { "url": "https://huggingface.co/docs/transformers/perf_infer_gpu_one", "internal": false, "reflection": false, "title": "GPU", "clicks": 12 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/optimize-gpu-usage-for-long-context-training/147736/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212576, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-31T21:42:22.548Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-31T21:42:22.548Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 147736, "topic_slug": "optimize-gpu-usage-for-long-context-training", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/optimize-gpu-usage-for-long-context-training/147736/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I am working with a scenario where I need to perform fine-tuning for long-context models. I am specifically interested in optimizing GPU usage for single-GPU long-context training. Currently, I manage to get the training to run at a tokenization length of 8192 by juggling around a few parameters. Ideally, I would like to double or even quadruple that length, because I believe the context windows for the Gemma3 models are at least 32K. Also, I believe doubling the length is possible, because the GPU usage for length=8192 is around 40GB, which is almost exactly half of one A100. However, when I set length=16384, I get <code>CUDA OOM</code>. What are some avenues I can explore to optimize GPU usage, with the obvious two being (1) more GPUs (2) quantizing the model?</p> <pre><code class="lang-auto">from datasets import load_dataset from trl import RewardTrainer, RewardConfig from peft import LoraConfig, TaskType import torch from transformers import AutoModelForCausalLM, AutoTokenizer torch.set_default_device('cuda') model = AutoModelForCausalLM.from_pretrained("gemma3", attn_implementation="eager") tokenizer = AutoTokenizer.from_pretrained("gemma3") train_dataset = load_dataset("json", data_files="training_data.json", split="train") tokenizer.pad_token = tokenizer.eos_token # pre-processing the dataset a bit def prefix_with_input(example): example['chosen'] = example['input'] + " " + example['chosen'] example['rejected'] = example['input'] + " " + example['rejected'][0] return example train_dataset = train_dataset.map(prefix_with_input) train_dataset = train_dataset.remove_columns(["input"]) # explicitly tokenizing the dataset max_length = 8192 def tokenize_function(examples): return tokenizer(examples["chosen"], max_length=max_length, padding='max_length', truncation=True) train_dataset = train_dataset.map(tokenize_function, batched=True) training_args = RewardConfig( dataloader_pin_memory=False, per_device_train_batch_size=1, gradient_checkpointing=True, gradient_accumulation_steps=4, ) training_args.optimize_cuda_cache=True peft_config = LoraConfig( task_type=TaskType.SEQ_CLS, inference_mode=False, r=8, lora_alpha=32, lora_dropout=0.1, target_modules=[ "q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj", "lm_head", ] ) trainer = RewardTrainer( model=model, args=training_args, processing_class=tokenizer, train_dataset=train_dataset, peft_config=peft_config, ) trainer.train() </code></pre>
<p>There are guidelines provided by Hugging Face, so I think it would be a good idea to try those first.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/transformers/perf_train_gpu_one"> <header class="source"> <a href="https://huggingface.co/docs/transformers/perf_train_gpu_one" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png" class="thumbnail" data-dominant-color="F5F3ED" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/transformers/perf_train_gpu_one" target="_blank" rel="noopener">GPU</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/transformers/perf_infer_gpu_one"> <header class="source"> <a href="https://huggingface.co/docs/transformers/perf_infer_gpu_one" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png" class="thumbnail" data-dominant-color="F5F3ED" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/transformers/perf_infer_gpu_one" target="_blank" rel="noopener">GPU</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Limits on Gradio API (HF Spaces)
https://discuss.huggingface.co/t/limits-on-gradio-api-hf-spaces/147812
147,812
24
2025-03-28T10:59:42.948000Z
[ { "id": 211989, "name": "Roman", "username": "gblssroman", "avatar_template": "/user_avatar/discuss.huggingface.co/gblssroman/{size}/44276_2.png", "created_at": "2025-03-28T10:59:42.996Z", "cooked": "<p>Hi,<br>\nI am unclear on the rules or pricing for the <a href=\"https://hf.space/%E2%80%A6\" class=\"inline-onebox\" rel=\"noopener nofollow ugc\">Spaces - Hugging Face</a> API endpoints. When I send a cURL request, it returns fine, but unlike with <a href=\"https://api-inference.huggingface.co/%E2%80%A6\">https://api-inference.huggingface.co/…</a> I don’t include an API key, so how would it charge me. Or if it is free, then what are the usage limits?</p>\n<p>Re-asking the question from 2022. Thank you!</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-28T10:59:42.996Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 106, "reads": 14, "readers_count": 13, "score": 542.8, "yours": false, "topic_id": 147812, "topic_slug": "limits-on-gradio-api-hf-spaces", "display_username": "Roman", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://hf.space/%E2%80%A6", "internal": false, "reflection": false, "title": "Spaces - Hugging Face", "clicks": 1 }, { "url": "https://api-inference.huggingface.co/%E2%80%A6", "internal": false, "reflection": false, "title": null, "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88758, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/limits-on-gradio-api-hf-spaces/147812/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211997, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-28T12:04:12.813Z", "cooked": "<p>Calling Gradio Spaces via the API is free and best effort. Only for Zero GPU Spaces, there is a benefit from a token with a Pro subscription. (There is a version-dependent bug.)<br>\nIt is recommended that people who want stable operation use Endpoint API (dedicated) etc.</p>\n<p>The fee is paid by the person hosting the Spaces.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/pricing#spaces\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/pricing#spaces\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/5/c598ba3e73cf0397441b3eca65a189a71ffecee6_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F9F6F1\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/pricing#spaces\" target=\"_blank\" rel=\"noopener\">Hugging Face – Pricing</a></h3>\n\n <p>The simplest way to access compute for AI</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<p>If you’re worried, ask the following support.<br>\nPayment related: <a href=\"mailto:[email protected]\">[email protected]</a><br>\nGeneral: <a href=\"mailto:[email protected]\">[email protected]</a></p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-28T12:05:16.105Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 13, "readers_count": 12, "score": 22.6, "yours": false, "topic_id": 147812, "topic_slug": "limits-on-gradio-api-hf-spaces", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/pricing#spaces", "internal": false, "reflection": false, "title": "Hugging Face – Pricing", "clicks": 22 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/limits-on-gradio-api-hf-spaces/147812/2", "reactions": [ { "id": "white_check_mark", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212478, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-31T12:18:48.768Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-31T12:18:48.768Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 4, "reads": 10, "readers_count": 9, "score": 22, "yours": false, "topic_id": 147812, "topic_slug": "limits-on-gradio-api-hf-spaces", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/limits-on-gradio-api-hf-spaces/147812/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi,<br> I am unclear on the rules or pricing for the <a href="https://hf.space/%E2%80%A6" class="inline-onebox" rel="noopener nofollow ugc">Spaces - Hugging Face</a> API endpoints. When I send a cURL request, it returns fine, but unlike with <a href="https://api-inference.huggingface.co/%E2%80%A6">https://api-inference.huggingface.co/…</a> I don’t include an API key, so how would it charge me. Or if it is free, then what are the usage limits?</p> <p>Re-asking the question from 2022. Thank you!</p>
<p>Calling Gradio Spaces via the API is free and best effort. Only for Zero GPU Spaces, there is a benefit from a token with a Pro subscription. (There is a version-dependent bug.)<br> It is recommended that people who want stable operation use Endpoint API (dedicated) etc.</p> <p>The fee is paid by the person hosting the Spaces.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/pricing#spaces"> <header class="source"> <a href="https://huggingface.co/pricing#spaces" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/5/c598ba3e73cf0397441b3eca65a189a71ffecee6_2_690x372.png" class="thumbnail" data-dominant-color="F9F6F1" width="690" height="372"></div> <h3><a href="https://huggingface.co/pricing#spaces" target="_blank" rel="noopener">Hugging Face – Pricing</a></h3> <p>The simplest way to access compute for AI</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <p>If you’re worried, ask the following support.<br> Payment related: <a href="mailto:[email protected]">[email protected]</a><br> General: <a href="mailto:[email protected]">[email protected]</a></p>
Git clone &hellip; fails with error 422, service parameter is needed
https://discuss.huggingface.co/t/git-clone-fails-with-error-422-service-parameter-is-needed/147805
147,805
5
2025-03-28T10:36:53.571000Z
[ { "id": 211982, "name": "Peter Palmer", "username": "Ezzlar", "avatar_template": "/user_avatar/discuss.huggingface.co/ezzlar/{size}/44273_2.png", "created_at": "2025-03-28T10:36:53.626Z", "cooked": "<p>I’m trying to get my first llm to run locally, just to learn a bit about things. I’ve got git-lfs installed and initialized. When trying to clone this happens:</p>\n<pre><code class=\"lang-auto\">git clone https://Humble_me:[email protected]/google/codegemma-2b-GGUF\nCloning into 'codegemma-2b-GGUF'...\nremote: `service` parameter is needed\nfatal: unable to access 'https://hf.barry1.topm/google/codegemma-2b-GGUF/': The requested URL returned error: 422\n</code></pre>\n<p>I really don’t know what this service parameter is and how to pass it through.</p>\n<p>Maybe a read toke isn’t enough for this? I don’t know where to look any further.</p>\n<p><strong>EDIT:</strong><br>\nI found a seemingly unrelated post:</p>\n<p><a href=\"https://discuss.huggingface.co/t/llm-model-download-fail/103078\">llm-model-download-fail</a></p>\n<p>However it was mentioned in the replies that their version of git probably caused that issue. As my version was much older at<code>git version 2.34.1,</code>I just upgraded to <code>git version 2.49.0</code> which is the current one. This however didn’t make a difference.</p>", "post_number": 1, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-28T11:10:31.082Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 70, "reads": 5, "readers_count": 4, "score": 346, "yours": false, "topic_id": 147805, "topic_slug": "git-clone-fails-with-error-422-service-parameter-is-needed", "display_username": "Peter Palmer", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 3, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/llm-model-download-fail/103078", "internal": true, "reflection": false, "title": "LLM model download fail", "clicks": 4 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88751, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/git-clone-fails-with-error-422-service-parameter-is-needed/147805/1", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211996, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-28T11:59:04.077Z", "cooked": "<p>In the case of Windows, it’s usually because of the version of git.<br>\nThis time, though, it doesn’t seem to be the case.</p>\n<p>Even so, 422 errors with git are extremely rare.<br>\nIt might be a bug in the site.</p><aside class=\"onebox stackexchange\" data-onebox-src=\"https://stackoverflow.com/questions/65821162/gitlab-account-acces-error-422-the-change-you-requested-was-rejected\">\n <header class=\"source\">\n\n <a href=\"https://stackoverflow.com/questions/65821162/gitlab-account-acces-error-422-the-change-you-requested-was-rejected\" target=\"_blank\" rel=\"noopener\">stackoverflow.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <a href=\"https://stackoverflow.com/users/12662642/maxemilian\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"maxemilian\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/f/9/f96c272a5cafd962601f86ea2a804ea458e30ab2.png\" class=\"thumbnail onebox-avatar\" data-dominant-color=\"A2ACB3\" width=\"256\" height=\"256\">\n </a>\n\n<h4>\n <a href=\"https://stackoverflow.com/questions/65821162/gitlab-account-acces-error-422-the-change-you-requested-was-rejected\" target=\"_blank\" rel=\"noopener\">Gitlab account acces error: \"422 The change you requested was rejected.\"</a>\n</h4>\n\n<div class=\"tags\">\n <strong>cookies, gitlab, user-accounts</strong>\n</div>\n\n<div class=\"date\">\n asked by\n \n <a href=\"https://stackoverflow.com/users/12662642/maxemilian\" target=\"_blank\" rel=\"noopener\">\n maxemilian\n </a>\n on <a href=\"https://stackoverflow.com/questions/65821162/gitlab-account-acces-error-422-the-change-you-requested-was-rejected\" target=\"_blank\" rel=\"noopener\">04:21AM - 21 Jan 21 UTC</a>\n</div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-211996-for-windows-users-1\" class=\"anchor\" href=\"#p-211996-for-windows-users-1\"></a>For Windows users</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://git-scm.com/downloads/win\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/8/d/8de548c4559d01e6641ab24cbf08ea923ea7452d.png\" class=\"site-icon\" data-dominant-color=\"F64D27\" width=\"32\" height=\"32\">\n\n <a href=\"https://git-scm.com/downloads/win\" target=\"_blank\" rel=\"noopener\">git-scm.com</a>\n </header>\n\n <article class=\"onebox-body\">\n \n\n<h3><a href=\"https://git-scm.com/downloads/win\" target=\"_blank\" rel=\"noopener\">Git - Downloading Package</a></h3>\n\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://git-lfs.com/\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/f/1/f16572aa053992106b3ae7b3792264219531fd73.png\" class=\"site-icon\" data-dominant-color=\"DE4130\" width=\"48\" height=\"48\">\n\n <a href=\"https://git-lfs.com/\" target=\"_blank\" rel=\"noopener\">Git Large File Storage</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:262/500;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/5/6591624baacb3d731d5b5f5fe3259e07eb8f9b28_2_690x362.png\" class=\"thumbnail\" data-dominant-color=\"E4E2DA\" width=\"690\" height=\"362\"></div>\n\n<h3><a href=\"https://git-lfs.com/\" target=\"_blank\" rel=\"noopener\">Git Large File Storage</a></h3>\n\n <p>Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-28T11:59:04.077Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 0.8, "yours": false, "topic_id": 147805, "topic_slug": "git-clone-fails-with-error-422-service-parameter-is-needed", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://git-lfs.com/", "internal": false, "reflection": false, "title": "Git Large File Storage | Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.", "clicks": 2 }, { "url": "https://stackoverflow.com/questions/65821162/gitlab-account-acces-error-422-the-change-you-requested-was-rejected", "internal": false, "reflection": false, "title": "cookies - Gitlab account acces error: \"422 The change you requested was rejected.\" - Stack Overflow", "clicks": 1 }, { "url": "https://git-scm.com/downloads/win", "internal": false, "reflection": false, "title": "Git - Downloading Package", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/git-clone-fails-with-error-422-service-parameter-is-needed/147805/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212125, "name": "Peter Palmer", "username": "Ezzlar", "avatar_template": "/user_avatar/discuss.huggingface.co/ezzlar/{size}/44273_2.png", "created_at": "2025-03-29T04:53:28.493Z", "cooked": "<p>Thank you. I checked the stack-overflow question and my time-zone and time configuration are correct. Also in this case Firefox isn’t even involved as it’s git (this seemed to be a Firefox specific problem that didn’t occur with Chrome).</p>\n<p>Git executed from command line as I’m running Linux.</p>\n<p>What got me stumped from the stack-exchange contribution is the ‘change rejected’ bit as I’ve only got a read token. I just didn’t expect that I would need write access for this. Also it may me completely misleading as it was a problem with gitlab.</p>", "post_number": 3, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-29T04:53:28.493Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 147805, "topic_slug": "git-clone-fails-with-error-422-service-parameter-is-needed", "display_username": "Peter Palmer", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88751, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/git-clone-fails-with-error-422-service-parameter-is-needed/147805/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212126, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-29T05:06:31.663Z", "cooked": "<p>I couldn’t find any examples of the 422 error on Hugging Face because it’s so rare, except for Inference API-related errors… sorry about that.</p>\n<p>Although it’s not a 422 error, if a Fatal error occurs, it’s probably because the network connection itself isn’t working properly. In the case below, it seems that the IPv6 setting was the cause, but there are various other possibilities.</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/huggingface/huggingface_hub/issues/2043\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/huggingface_hub/issues/2043\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/huggingface_hub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/huggingface_hub/issues/2043\" target=\"_blank\" rel=\"noopener\">Unable to access Huggingface</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-02-23\" data-time=\"18:00:34\" data-timezone=\"UTC\">06:00PM - 23 Feb 24 UTC</span>\n </div>\n\n\n <div class=\"user\">\n <a href=\"https://github.com/ai-ml-with-kapil\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/8/7/87ede2047c662625b642f38f6d78e19699968962.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"AC9A97\">\n ai-ml-with-kapil\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n bug\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">### Describe the bug\n\nI am getting this error \"We couldn't connect to 'https://h<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">uggingface.co' to load this file, couldn't find it in the cached files and it looks like sentence-transformers/all-MiniLM-L6-v2 is not the path to a directory containing a file named config.json.\" Although I am able to access website using my web browser and also I have tried creating new token and tried that but same result. Unable to use any model. \n\n### Reproduction\n\n_No response_\n\n### Logs\n\n```shell\nOSError: We couldn't connect to 'https://huggingface.co' to load this file, couldn't find it in the cached files and it looks like sentence-transformers/all-MiniLM-L6-v2 is not the path to a directory containing a file named config.json.\nCheckout your internet connection or see how to run the library in offline mode at 'https://huggingface.co/docs/transformers/installation#offline-mode'.\n```\n\n\n### System info\n\n```shell\n- huggingface_hub version: 0.20.2\n- Platform: Windows-11-10.0.22621-SP0\n- Python version: 3.12.2\n- Running in iPython ?: No\n- Running in notebook ?: No\n- Running in Google Colab ?: No\n- Token path ?: C:\\Users\\panwa\\.cache\\huggingface\\token\n- Has saved token ?: False\n- Configured git credential helpers: manager\n- FastAI: N/A\n- Tensorflow: N/A\n- Torch: 2.2.1\n- Jinja2: 3.1.3\n- Graphviz: N/A\n- Pydot: N/A\n- Pillow: 10.2.0\n- hf_transfer: N/A\n- gradio: N/A\n- tensorboard: N/A\n- numpy: 1.26.4\n- pydantic: 2.6.1\n- aiohttp: 3.9.3\n- ENDPOINT: https://huggingface.co\n- HF_HUB_CACHE: C:\\Users\\panwa\\.cache\\huggingface\\hub\n- HF_ASSETS_CACHE: C:\\Users\\panwa\\.cache\\huggingface\\assets\n- HF_TOKEN_PATH: C:\\Users\\panwa\\.cache\\huggingface\\token\n- HF_HUB_OFFLINE: False\n- HF_HUB_DISABLE_TELEMETRY: False\n- HF_HUB_DISABLE_PROGRESS_BARS: None\n- HF_HUB_DISABLE_SYMLINKS_WARNING: False\n- HF_HUB_DISABLE_IMPLICIT_TOKEN: False\n- HF_HUB_ENABLE_HF_TRANSFER: False\n- HF_HUB_ETAG_TIMEOUT: 10\n- HF_HUB_DOWNLOAD_TIMEOUT: 10\n\n{'huggingface_hub version': '0.20.2', 'Platform': 'Windows-11-10.0.22621-SP0', 'Python version': '3.12.2', 'Running in iPython ?': 'No', 'Running in notebook ?': 'No', 'Running in Google Colab ?': 'No', 'Token path ?': 'C:\\\\Users\\\\panwa\\\\.cache\\\\huggingface\\\\token', 'Has saved token ?': False, 'Configured git credential helpers': 'manager', 'FastAI': 'N/A', 'Tensorflow': 'N/A', 'Torch': '2.2.1', 'Jinja2': '3.1.3', 'Graphviz': 'N/A', 'Pydot': 'N/A', 'Pillow': '10.2.0', 'hf_transfer': 'N/A', 'gradio': 'N/A', 'tensorboard': 'N/A', 'numpy': '1.26.4', 'pydantic': '2.6.1', 'aiohttp': '3.9.3', 'ENDPOINT': 'https://huggingface.co', 'HF_HUB_CACHE': 'C:\\\\Users\\\\panwa\\\\.cache\\\\huggingface\\\\hub', 'HF_ASSETS_CACHE': 'C:\\\\Users\\\\panwa\\\\.cache\\\\huggingface\\\\assets', 'HF_TOKEN_PATH': 'C:\\\\Users\\\\panwa\\\\.cache\\\\huggingface\\\\token', 'HF_HUB_OFFLINE': False, 'HF_HUB_DISABLE_TELEMETRY': False, 'HF_HUB_DISABLE_PROGRESS_BARS': None, 'HF_HUB_DISABLE_SYMLINKS_WARNING': False, 'HF_HUB_DISABLE_EXPERIMENTAL_WARNING': False, 'HF_HUB_DISABLE_IMPLICIT_TOKEN': False, 'HF_HUB_ENABLE_HF_TRANSFER': False, 'HF_HUB_ETAG_TIMEOUT': 10, 'HF_HUB_DOWNLOAD_TIMEOUT': 10}\n```</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox stackexchange\" data-onebox-src=\"https://stackoverflow.com/questions/27087483/how-to-resolve-git-pull-fatal-unable-to-access-https-github-com-empty\">\n <header class=\"source\">\n\n <a href=\"https://stackoverflow.com/questions/27087483/how-to-resolve-git-pull-fatal-unable-to-access-https-github-com-empty\" target=\"_blank\" rel=\"noopener\">stackoverflow.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <a href=\"https://stackoverflow.com/users/4283912/merlin\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"Merlin\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/8/0/80125e841fb6e49940b35bf0eea8154625421e56.png\" class=\"thumbnail onebox-avatar\" data-dominant-color=\"C3C7FF\" width=\"256\" height=\"256\">\n </a>\n\n<h4>\n <a href=\"https://stackoverflow.com/questions/27087483/how-to-resolve-git-pull-fatal-unable-to-access-https-github-com-empty\" target=\"_blank\" rel=\"noopener\">How to resolve \"git pull,fatal: unable to access 'https://github.com...\\': Empty reply from server\"</a>\n</h4>\n\n<div class=\"tags\">\n <strong>git, github, ssh-keys</strong>\n</div>\n\n<div class=\"date\">\n asked by\n \n <a href=\"https://stackoverflow.com/users/4283912/merlin\" target=\"_blank\" rel=\"noopener\">\n Merlin\n </a>\n on <a href=\"https://stackoverflow.com/questions/27087483/how-to-resolve-git-pull-fatal-unable-to-access-https-github-com-empty\" target=\"_blank\" rel=\"noopener\">09:33AM - 23 Nov 14 UTC</a>\n</div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-29T05:06:31.663Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 147805, "topic_slug": "git-clone-fails-with-error-422-service-parameter-is-needed", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/huggingface_hub/issues/2043", "internal": false, "reflection": false, "title": "Unable to access Huggingface · Issue #2043 · huggingface/huggingface_hub · GitHub", "clicks": 1 }, { "url": "https://stackoverflow.com/questions/27087483/how-to-resolve-git-pull-fatal-unable-to-access-https-github-com-empty", "internal": false, "reflection": false, "title": "How to resolve \"git pull,fatal: unable to access 'https://github.com...\\': Empty reply from server\" - Stack Overflow", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/git-clone-fails-with-error-422-service-parameter-is-needed/147805/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212130, "name": "Peter Palmer", "username": "Ezzlar", "avatar_template": "/user_avatar/discuss.huggingface.co/ezzlar/{size}/44273_2.png", "created_at": "2025-03-29T05:44:54.705Z", "cooked": "<p>Ok. It’s rather embarrassing. I did following change:</p>\n<p><code>huggingface.com</code></p>\n<p>to</p>\n<p><code>huggingface.co</code></p>\n<p>Now I’m getting Error 403.</p>\n<p><code>Your request to access model google/codegemma-2b-GGUF is awaiting a review from the repo authors.</code></p>\n<p>However this was because I accepted before the terms for a h5 file and had to accept again for this gguf. Once done the download started.</p>\n<p>Noob problems <img src=\"https://emoji.discourse-cdn.com/apple/zany_face.png?v=14\" title=\":zany_face:\" class=\"emoji\" alt=\":zany_face:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 5, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-29T05:44:54.705Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 3, "readers_count": 2, "score": 25.6, "yours": false, "topic_id": 147805, "topic_slug": "git-clone-fails-with-error-422-service-parameter-is-needed", "display_username": "Peter Palmer", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88751, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/git-clone-fails-with-error-422-service-parameter-is-needed/147805/5", "reactions": [ { "id": "confetti_ball", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212131, "name": "Peter Palmer", "username": "Ezzlar", "avatar_template": "/user_avatar/discuss.huggingface.co/ezzlar/{size}/44273_2.png", "created_at": "2025-03-29T05:54:38.750Z", "cooked": "<p>When you go with a web browser to <a href=\"https://hf.barry1.topm\" rel=\"noopener nofollow ugc\">https://hf.barry1.topm</a> you just get redirected to <a href=\"https://huggingface.co\">https://huggingface.co</a>.</p>\n<p><em>¡O, gloria inmarcesible!<br>\n¡O, júbilo inmortal!<br>\nEn surcos de dolores,<br>\nel bien germina ya.</em></p>", "post_number": 6, "post_type": 1, "posts_count": 8, "updated_at": "2025-04-01T14:08:47.563Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 147805, "topic_slug": "git-clone-fails-with-error-422-service-parameter-is-needed", "display_username": "Peter Palmer", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://hf.barry1.topm", "internal": false, "reflection": false, "title": "Hugging Face – The AI community building the future.", "clicks": 0 }, { "url": "https://huggingface.co", "internal": false, "reflection": false, "title": "Hugging Face – The AI community building the future.", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 88751, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/git-clone-fails-with-error-422-service-parameter-is-needed/147805/6", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212137, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-29T06:26:07.199Z", "cooked": "<blockquote>\n<p><code>huggingface.com</code></p>\n</blockquote>\n<p>lol😆</p>", "post_number": 7, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-29T06:26:07.199Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 147805, "topic_slug": "git-clone-fails-with-error-422-service-parameter-is-needed", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/git-clone-fails-with-error-422-service-parameter-is-needed/147805/7", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212222, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-29T18:26:48.776Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 8, "post_type": 3, "posts_count": 8, "updated_at": "2025-03-29T18:26:48.776Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 147805, "topic_slug": "git-clone-fails-with-error-422-service-parameter-is-needed", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/git-clone-fails-with-error-422-service-parameter-is-needed/147805/8", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I’m trying to get my first llm to run locally, just to learn a bit about things. I’ve got git-lfs installed and initialized. When trying to clone this happens:</p> <pre><code class="lang-auto">git clone https://Humble_me:[email protected]/google/codegemma-2b-GGUF Cloning into 'codegemma-2b-GGUF'... remote: `service` parameter is needed fatal: unable to access 'https://hf.barry1.topm/google/codegemma-2b-GGUF/': The requested URL returned error: 422 </code></pre> <p>I really don’t know what this service parameter is and how to pass it through.</p> <p>Maybe a read toke isn’t enough for this? I don’t know where to look any further.</p> <p><strong>EDIT:</strong><br> I found a seemingly unrelated post:</p> <p><a href="https://discuss.huggingface.co/t/llm-model-download-fail/103078">llm-model-download-fail</a></p> <p>However it was mentioned in the replies that their version of git probably caused that issue. As my version was much older at<code>git version 2.34.1,</code>I just upgraded to <code>git version 2.49.0</code> which is the current one. This however didn’t make a difference.</p>
<p>Ok. It’s rather embarrassing. I did following change:</p> <p><code>huggingface.com</code></p> <p>to</p> <p><code>huggingface.co</code></p> <p>Now I’m getting Error 403.</p> <p><code>Your request to access model google/codegemma-2b-GGUF is awaiting a review from the repo authors.</code></p> <p>However this was because I accepted before the terms for a h5 file and had to accept again for this gguf. Once done the download started.</p> <p>Noob problems <img src="https://emoji.discourse-cdn.com/apple/zany_face.png?v=14" title=":zany_face:" class="emoji" alt=":zany_face:" loading="lazy" width="20" height="20"></p>
Got access acceptance for the wrong llama model
https://discuss.huggingface.co/t/got-access-acceptance-for-the-wrong-llama-model/147746
147,746
5
2025-03-28T00:11:14.428000Z
[ { "id": 211888, "name": "Hao Feng", "username": "fenghao999", "avatar_template": "/user_avatar/discuss.huggingface.co/fenghao999/{size}/44249_2.png", "created_at": "2025-03-28T00:11:14.485Z", "cooked": "<p>I applied for the access to the model “meta-llama/Llama-2-13b” but received an email telling me that “Your request to access model meta-llama/Llama-2-70b-hf has been accepted”. Obviously, the access I got is not for the model I want.</p>\n<p>To test if the license for \"meta-llama/Llama-2-70b-hf \" also works for “meta-llama/Llama-2-13b”, I tried download both. It turns out to be \"meta-llama/Llama-2-70b-hf \" is downloadable, but “meta-llama/Llama-2-13b” not.</p>\n<p>On the page of “meta-llama/Llama-2-13b”, the application form disappears for me. So there is no way to re-apply accessing the model.</p>\n<p>Any suggestions on what to do?</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-28T00:11:14.485Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 9, "reads": 8, "readers_count": 7, "score": 61.6, "yours": false, "topic_id": 147746, "topic_slug": "got-access-acceptance-for-the-wrong-llama-model", "display_username": "Hao Feng", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88702, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/got-access-acceptance-for-the-wrong-llama-model/147746/1", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211900, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-28T02:37:27.558Z", "cooked": "<p>Normally, any problems with the gated model are dealt with between the author and the user, but in this particular case, I think it would be better to have Hugging Face act as an intermediary. This is a slightly unusual case. <a class=\"mention\" href=\"/u/meganariley\">@meganariley</a></p>\n<p><a href=\"mailto:[email protected]\">[email protected]</a></p>", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-28T02:38:55.604Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 7, "readers_count": 6, "score": 6.4, "yours": false, "topic_id": 147746, "topic_slug": "got-access-acceptance-for-the-wrong-llama-model", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/got-access-acceptance-for-the-wrong-llama-model/147746/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212042, "name": "Megan Riley", "username": "meganariley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png", "created_at": "2025-03-28T15:00:52.668Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/fenghao999\">@fenghao999</a> You can head to your gated models in your settings here: <a href=\"https://huggingface.co/settings/gated-repos\" class=\"inline-onebox\">Hugging Face – The AI community building the future.</a>. You were given access to Meta’s Llama2 models which include meta-llama/Llama-2-13b - you can click on that link to access the collection.</p>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-28T15:00:52.668Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 5, "readers_count": 4, "score": 31, "yours": false, "topic_id": 147746, "topic_slug": "got-access-acceptance-for-the-wrong-llama-model", "display_username": "Megan Riley", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/settings/gated-repos", "internal": false, "reflection": false, "title": "Hugging Face – The AI community building the future.", "clicks": 6 }, { "url": "https://discuss.huggingface.co/t/unable-to-access-gated-model-meta-llama-llama-3-2-1b-despite-approved-access/148782/2", "internal": true, "reflection": true, "title": "Unable to Access Gated Model meta-llama/Llama-3.2-1B Despite Approved Access", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 31941, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/got-access-acceptance-for-the-wrong-llama-model/147746/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 212071, "name": "Hao Feng", "username": "fenghao999", "avatar_template": "/user_avatar/discuss.huggingface.co/fenghao999/{size}/44249_2.png", "created_at": "2025-03-28T17:08:05.221Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/meganariley\">@meganariley</a> <a class=\"mention\" href=\"/u/john6666\">@John6666</a>, thank you both for handling my issue. The problem is solved. Yeah, now I found that I can access all the llama 2 models as <a class=\"mention\" href=\"/u/meganariley\">@meganariley</a> said. The problem actually was that I was trying to download the original llama-2-13b model, while the one compatible with Huggingface transformer library is llama-2-13b-hf. I should have accessed “meta-llama/Llama-2-13b-hf”. Thank you again!</p>", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-28T17:08:05.221Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 16, "yours": false, "topic_id": 147746, "topic_slug": "got-access-acceptance-for-the-wrong-llama-model", "display_username": "Hao Feng", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88702, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/got-access-acceptance-for-the-wrong-llama-model/147746/4", "reactions": [ { "id": "confetti_ball", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 31941, "username": "meganariley", "name": "Megan Riley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png" }, "action_code": null, "via_email": null }, { "id": 212127, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-29T05:08:14.723Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-03-29T05:08:14.723Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 4, "readers_count": 3, "score": 5.8, "yours": false, "topic_id": 147746, "topic_slug": "got-access-acceptance-for-the-wrong-llama-model", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/got-access-acceptance-for-the-wrong-llama-model/147746/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I applied for the access to the model “meta-llama/Llama-2-13b” but received an email telling me that “Your request to access model meta-llama/Llama-2-70b-hf has been accepted”. Obviously, the access I got is not for the model I want.</p> <p>To test if the license for "meta-llama/Llama-2-70b-hf " also works for “meta-llama/Llama-2-13b”, I tried download both. It turns out to be "meta-llama/Llama-2-70b-hf " is downloadable, but “meta-llama/Llama-2-13b” not.</p> <p>On the page of “meta-llama/Llama-2-13b”, the application form disappears for me. So there is no way to re-apply accessing the model.</p> <p>Any suggestions on what to do?</p>
<p>Hi <a class="mention" href="/u/fenghao999">@fenghao999</a> You can head to your gated models in your settings here: <a href="https://huggingface.co/settings/gated-repos" class="inline-onebox">Hugging Face – The AI community building the future.</a>. You were given access to Meta’s Llama2 models which include meta-llama/Llama-2-13b - you can click on that link to access the collection.</p>
.cache for upload large folder
https://discuss.huggingface.co/t/cache-for-upload-large-folder/147711
147,711
10
2025-03-27T17:33:30.568000Z
[ { "id": 211849, "name": "Samir Char", "username": "samirchar", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/{size}.png", "created_at": "2025-03-27T17:33:30.635Z", "cooked": "<p>Hello everyone,</p>\n<p>When I use the upload large folder i see a .cache folder that contains a folder called “upload”. This is created on the same directory of the folder I want to upload. Is there a way to change the location of this .cache folder?</p>\n<p>I tried setting HF_HOME, but this doesn’t seem to work.</p>\n<p>Thanks!</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-27T17:34:09.309Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 24, "reads": 6, "readers_count": 5, "score": 131.2, "yours": false, "topic_id": 147711, "topic_slug": "cache-for-upload-large-folder", "display_username": "Samir Char", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 80944, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/cache-for-upload-large-folder/147711/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211898, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-28T02:25:55.683Z", "cooked": "<p>There doesn’t seem to be a gentle way to do this using environment variables or arguments. If you really want to do it, you could change the code in the library in the Python folder, but…</p><aside class=\"onebox githubblob\" data-onebox-src=\"https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/hf_api.py#L5214\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/hf_api.py#L5214\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/huggingface_hub</a>\n </header>\n\n <article class=\"onebox-body\">\n <h4><a href=\"https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/hf_api.py#L5214\" target=\"_blank\" rel=\"noopener\">src/huggingface_hub/hf_api.py</a></h4>\n\n<div class=\"git-blob-info\">\n <a href=\"https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/hf_api.py#L5214\" rel=\"noopener\"><code>v0.30.0rc2</code></a>\n</div>\n\n\n\n <pre class=\"onebox\"><code class=\"lang-py\">\n <ol class=\"start lines\" start=\"5204\" style=\"counter-reset: li-counter 5203 ;\">\n <li> revision: Optional[str] = None,</li>\n <li> private: Optional[bool] = None,</li>\n <li> allow_patterns: Optional[Union[List[str], str]] = None,</li>\n <li> ignore_patterns: Optional[Union[List[str], str]] = None,</li>\n <li> num_workers: Optional[int] = None,</li>\n <li> print_report: bool = True,</li>\n <li> print_report_every: int = 60,</li>\n <li>) -&gt; None:</li>\n <li> \"\"\"Upload a large folder to the Hub in the most resilient way possible.</li>\n <li></li>\n <li class=\"selected\"> Several workers are started to upload files in an optimized way. Before being committed to a repo, files must be</li>\n <li> hashed and be pre-uploaded if they are LFS files. Workers will perform these tasks for each file in the folder.</li>\n <li> At each step, some metadata information about the upload process is saved in the folder under `.cache/.huggingface/`</li>\n <li> to be able to resume the process if interrupted. The whole process might result in several commits.</li>\n <li></li>\n <li> Args:</li>\n <li> repo_id (`str`):</li>\n <li> The repository to which the file will be uploaded.</li>\n <li> E.g. `\"HuggingFaceTB/smollm-corpus\"`.</li>\n <li> folder_path (`str` or `Path`):</li>\n <li> Path to the folder to upload on the local file system.</li>\n </ol>\n </code></pre>\n\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox githubblob\" data-onebox-src=\"https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/_local_folder.py#L409\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/_local_folder.py#L409\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/huggingface_hub</a>\n </header>\n\n <article class=\"onebox-body\">\n <h4><a href=\"https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/_local_folder.py#L409\" target=\"_blank\" rel=\"noopener\">src/huggingface_hub/_local_folder.py</a></h4>\n\n<div class=\"git-blob-info\">\n <a href=\"https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/_local_folder.py#L409\" rel=\"noopener\"><code>v0.30.0rc2</code></a>\n</div>\n\n\n\n <pre class=\"onebox\"><code class=\"lang-py\">\n <ol class=\"start lines\" start=\"399\" style=\"counter-reset: li-counter 398 ;\">\n <li> \"\"\"</li>\n <li> paths = get_local_download_paths(local_dir, filename)</li>\n <li> with WeakFileLock(paths.lock_path):</li>\n <li> with paths.metadata_path.open(\"w\") as f:</li>\n <li> f.write(f\"{commit_hash}\\n{etag}\\n{time.time()}\\n\")</li>\n <li></li>\n <li></li>\n <li>def _huggingface_dir(local_dir: Path) -&gt; Path:</li>\n <li> \"\"\"Return the path to the `.cache/huggingface` directory in a local directory.\"\"\"</li>\n <li> # Wrap in lru_cache to avoid overwriting the .gitignore file if called multiple times</li>\n <li class=\"selected\"> path = local_dir / \".cache\" / \"huggingface\"</li>\n <li> path.mkdir(exist_ok=True, parents=True)</li>\n <li></li>\n <li> # Create a .gitignore file in the .cache/huggingface directory if it doesn't exist</li>\n <li> # Should be thread-safe enough like this.</li>\n <li> gitignore = path / \".gitignore\"</li>\n <li> gitignore_lock = path / \".gitignore.lock\"</li>\n <li> if not gitignore.exists():</li>\n <li> try:</li>\n <li> with WeakFileLock(gitignore_lock, timeout=0.1):</li>\n <li> gitignore.write_text(\"*\")</li>\n </ol>\n </code></pre>\n\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-28T02:25:55.683Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 6, "yours": false, "topic_id": 147711, "topic_slug": "cache-for-upload-large-folder", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/_local_folder.py#L409", "internal": false, "reflection": false, "title": "huggingface_hub/src/huggingface_hub/_local_folder.py at v0.30.0rc2 · huggingface/huggingface_hub · GitHub", "clicks": 0 }, { "url": "https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/hf_api.py#L5214", "internal": false, "reflection": false, "title": "huggingface_hub/src/huggingface_hub/hf_api.py at v0.30.0rc2 · huggingface/huggingface_hub · GitHub", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/cache-for-upload-large-folder/147711/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211992, "name": "Samir Char", "username": "samirchar", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/{size}.png", "created_at": "2025-03-28T11:24:20.369Z", "cooked": "<p>Thank you!</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-28T11:24:20.369Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 16, "yours": false, "topic_id": 147711, "topic_slug": "cache-for-upload-large-folder", "display_username": "Samir Char", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 80944, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/cache-for-upload-large-folder/147711/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 212109, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-28T23:24:28.160Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-03-28T23:24:28.160Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 3, "readers_count": 2, "score": 5.6, "yours": false, "topic_id": 147711, "topic_slug": "cache-for-upload-large-folder", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/cache-for-upload-large-folder/147711/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello everyone,</p> <p>When I use the upload large folder i see a .cache folder that contains a folder called “upload”. This is created on the same directory of the folder I want to upload. Is there a way to change the location of this .cache folder?</p> <p>I tried setting HF_HOME, but this doesn’t seem to work.</p> <p>Thanks!</p>
<p>There doesn’t seem to be a gentle way to do this using environment variables or arguments. If you really want to do it, you could change the code in the library in the Python folder, but…</p><aside class="onebox githubblob" data-onebox-src="https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/hf_api.py#L5214"> <header class="source"> <a href="https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/hf_api.py#L5214" target="_blank" rel="noopener">github.com/huggingface/huggingface_hub</a> </header> <article class="onebox-body"> <h4><a href="https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/hf_api.py#L5214" target="_blank" rel="noopener">src/huggingface_hub/hf_api.py</a></h4> <div class="git-blob-info"> <a href="https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/hf_api.py#L5214" rel="noopener"><code>v0.30.0rc2</code></a> </div> <pre class="onebox"><code class="lang-py"> <ol class="start lines" start="5204" style="counter-reset: li-counter 5203 ;"> <li> revision: Optional[str] = None,</li> <li> private: Optional[bool] = None,</li> <li> allow_patterns: Optional[Union[List[str], str]] = None,</li> <li> ignore_patterns: Optional[Union[List[str], str]] = None,</li> <li> num_workers: Optional[int] = None,</li> <li> print_report: bool = True,</li> <li> print_report_every: int = 60,</li> <li>) -&gt; None:</li> <li> """Upload a large folder to the Hub in the most resilient way possible.</li> <li></li> <li class="selected"> Several workers are started to upload files in an optimized way. Before being committed to a repo, files must be</li> <li> hashed and be pre-uploaded if they are LFS files. Workers will perform these tasks for each file in the folder.</li> <li> At each step, some metadata information about the upload process is saved in the folder under `.cache/.huggingface/`</li> <li> to be able to resume the process if interrupted. The whole process might result in several commits.</li> <li></li> <li> Args:</li> <li> repo_id (`str`):</li> <li> The repository to which the file will be uploaded.</li> <li> E.g. `"HuggingFaceTB/smollm-corpus"`.</li> <li> folder_path (`str` or `Path`):</li> <li> Path to the folder to upload on the local file system.</li> </ol> </code></pre> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox githubblob" data-onebox-src="https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/_local_folder.py#L409"> <header class="source"> <a href="https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/_local_folder.py#L409" target="_blank" rel="noopener">github.com/huggingface/huggingface_hub</a> </header> <article class="onebox-body"> <h4><a href="https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/_local_folder.py#L409" target="_blank" rel="noopener">src/huggingface_hub/_local_folder.py</a></h4> <div class="git-blob-info"> <a href="https://github.com/huggingface/huggingface_hub/blob/v0.30.0rc2/src/huggingface_hub/_local_folder.py#L409" rel="noopener"><code>v0.30.0rc2</code></a> </div> <pre class="onebox"><code class="lang-py"> <ol class="start lines" start="399" style="counter-reset: li-counter 398 ;"> <li> """</li> <li> paths = get_local_download_paths(local_dir, filename)</li> <li> with WeakFileLock(paths.lock_path):</li> <li> with paths.metadata_path.open("w") as f:</li> <li> f.write(f"{commit_hash}\n{etag}\n{time.time()}\n")</li> <li></li> <li></li> <li>def _huggingface_dir(local_dir: Path) -&gt; Path:</li> <li> """Return the path to the `.cache/huggingface` directory in a local directory."""</li> <li> # Wrap in lru_cache to avoid overwriting the .gitignore file if called multiple times</li> <li class="selected"> path = local_dir / ".cache" / "huggingface"</li> <li> path.mkdir(exist_ok=True, parents=True)</li> <li></li> <li> # Create a .gitignore file in the .cache/huggingface directory if it doesn't exist</li> <li> # Should be thread-safe enough like this.</li> <li> gitignore = path / ".gitignore"</li> <li> gitignore_lock = path / ".gitignore.lock"</li> <li> if not gitignore.exists():</li> <li> try:</li> <li> with WeakFileLock(gitignore_lock, timeout=0.1):</li> <li> gitignore.write_text("*")</li> </ol> </code></pre> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Simple Model to rewrite/paraphrase
https://discuss.huggingface.co/t/simple-model-to-rewrite-paraphrase/145918
145,918
5
2025-03-15T20:46:12.030000Z
[ { "id": 209283, "name": "Johannes Vogt", "username": "jvogt", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/{size}.png", "created_at": "2025-03-15T20:46:12.095Z", "cooked": "<p>Hey,</p>\n<p>I am searching for a model, that can be used for re-writing a text using in a sophisticated style and is as small as possible (should focus only on this task).</p>\n<p>I was trying to use the the T5, BART and PEGASUS model but the first two did not change the text while the later gave a completely different text.</p>\n<p>The paraphrase models seem to map sentences and paragraphs to dense vectors instead of creating new sentences.</p>\n<pre><code class=\"lang-auto\">from transformers import PegasusForConditionalGeneration, PegasusTokenizer\nsource_path = \"/media/admin_ud/Volume/huggingface_cache/huggingface/hub\"\nmodel = PegasusForConditionalGeneration.from_pretrained(\"google/pegasus-xsum\",cache_dir = source_path)\ntokenizer = PegasusTokenizer.from_pretrained(\"google/pegasus-xsum\",cache_dir = source_path)\n\n# Input sentence\nsentence = \"I have backpain. And I have a headache. And I have pain in my leg.\"\n\n# Tokenizing the input\ninput_text = f\"paraphrase: {sentence}\"\ninputs = tokenizer(input_text, return_tensors=\"pt\", max_length=512, truncation=True)\n\n# Generating reformulated sentence\noutputs = model.generate(inputs[\"input_ids\"], max_length=128, num_beams=5, early_stopping=True)\n\n# Decoding the output\nreformulated_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)\nprint(reformulated_sentence) # \"I have pain in my leg.\"\n``\n\nWhich model/model class is suitable for that task?</code></pre>", "post_number": 1, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-15T20:59:03.942Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1227, "reads": 17, "readers_count": 16, "score": 5873.4, "yours": false, "topic_id": 145918, "topic_slug": "simple-model-to-rewrite-paraphrase", "display_username": "Johannes Vogt", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 3, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/which-model-select/155741/2", "internal": true, "reflection": true, "title": "Which model select?", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87294, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/simple-model-to-rewrite-paraphrase/145918/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209348, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-16T10:07:22.834Z", "cooked": "<p>PEGASUS is an LM for summarization, so I think its behavior is correct. For tasks like rewriting sentences, I think it would be easier to use a small LLM.</p>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/3/a39d9a0502e14b7793140925a4d4fb1639570bb1_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5A70A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B\" target=\"_blank\" rel=\"noopener\">HuggingFaceTB/SmolLM2-1.7B · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/6/a65d918d3320378eb824b38b86b3f7d88e99c03d_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5C71A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct\" target=\"_blank\" rel=\"noopener\">HuggingFaceTB/SmolLM2-135M-Instruct · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/4/4427a7bbc6909c3f696cbbcd6ee718dadc0e12ec_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5B70A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct\" target=\"_blank\" rel=\"noopener\">Qwen/Qwen2.5-1.5B-Instruct · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<hr>\n<p>Based on your requirements and the sources provided, here is an analysis of the situation and suggestions for a suitable model:</p>\n<hr>\n<h3><a name=\"p-209348-why-t5-bart-and-pegasus-might-not-be-suitable-1\" class=\"anchor\" href=\"#p-209348-why-t5-bart-and-pegasus-might-not-be-suitable-1\"></a>Why T5, BART, and PEGASUS Might Not Be Suitable</h3>\n<ol>\n<li>\n<p><strong>T5</strong>: While T5-Small is a compact model (~60 million parameters) designed for various NLP tasks, including text rewriting, it relies heavily on proper fine-tuning and prompting [2]. If you are using it for text rewriting without fine-tuning or with the wrong prompts, it may not produce the desired sophisticated rewrites.</p>\n</li>\n<li>\n<p><strong>BART</strong>: BART is also a text-to-text model that can handle rewriting tasks but might struggle with generating sophisticated paraphrases if it has not been explicitly trained or fine-tuned for this purpose [3].</p>\n</li>\n<li>\n<p><strong>PEGASUS</strong>: PEGASUS is primarily designed for summarization, which involves extracting key information rather than preserving the full context or style of the original text. This explains why it might produce rewrites that are too different from the original.</p>\n</li>\n<li>\n<p><strong>Paraphrase Models</strong>: Many paraphrase models focus on generating paraphrases by mapping sentences to dense vectors, which is not ideal for creating sophisticated rewrites [3].</p>\n</li>\n</ol>\n<hr>\n<h3><a name=\"p-209348-recommended-models-for-sophisticated-text-rewriting-2\" class=\"anchor\" href=\"#p-209348-recommended-models-for-sophisticated-text-rewriting-2\"></a>Recommended Models for Sophisticated Text Rewriting</h3>\n<p>If the above models are not suitable, here are some alternative models you can explore on Hugging Face:</p>\n<ol>\n<li>\n<p><strong>FLAN-T5</strong>: A variant of T5 that has been fine-tuned on a wide range of tasks, including rewriting and paraphrasing. It is instruction-agnostic and can generate more sophisticated outputs when given clear prompts [3].</p>\n</li>\n<li>\n<p><strong>Instruction-Tuned Models</strong>: Models like <a href=\"https://huggingface.co/mixtral-ai\">Mixtral</a>, <a href=\"https://huggingface.co/cohere-command-r\">Cohere Command R+</a>, or <a href=\"https://huggingface.co/meta-llama\">Meta Llama3</a> are designed to follow instructions and generate high-quality text. These models can be fine-tuned for sophisticated text rewriting [3].</p>\n</li>\n<li>\n<p><strong>Brio or Other Paraphrase Models</strong>: Models like <a href=\"https://huggingface.co/google/Brio\">Brio</a> or [MBart](<a href=\"https://huggingface.co/facebook/mbart-large-5%E9%95%98are\">https://huggingface.co/facebook/mbart-large-5镘are</a> designed for paraphrasing and can be adapted for text rewriting. However, they may not generate as sophisticated outputs as the instruction-tuned models mentioned above.</p>\n</li>\n</ol>\n<hr>\n<h3><a name=\"p-209348-conclusion-3\" class=\"anchor\" href=\"#p-209348-conclusion-3\"></a>Conclusion</h3>\n<p>For your task, I recommend using <strong>FLAN-T5</strong> or an <strong>instruction-tuned model</strong> like Mixtral. These models are better at following specific instructions and generating sophisticated rewrites. If you are looking for a smaller model, T5-Small can still work if you provide clear prompts or fine-tune it on a dataset with sophisticated paraphrasing examples [2][3].</p>", "post_number": 2, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-16T10:07:22.834Z", "reply_count": 2, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 68, "reads": 13, "readers_count": 12, "score": 362.6, "yours": false, "topic_id": 145918, "topic_slug": "simple-model-to-rewrite-paraphrase", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/HuggingFaceTB/SmolLM2-1.7B", "internal": false, "reflection": false, "title": null, "clicks": 29 }, { "url": "https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct", "internal": false, "reflection": false, "title": "Qwen/Qwen2.5-1.5B-Instruct · Hugging Face", "clicks": 24 }, { "url": "https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct", "internal": false, "reflection": false, "title": "HuggingFaceTB/SmolLM2-135M-Instruct · Hugging Face", "clicks": 12 }, { "url": "https://huggingface.co/meta-llama", "internal": false, "reflection": false, "title": "meta-llama (Meta Llama)", "clicks": 11 }, { "url": "https://huggingface.co/mixtral-ai", "internal": false, "reflection": false, "title": null, "clicks": 9 }, { "url": "https://huggingface.co/google/Brio", "internal": false, "reflection": false, "title": null, "clicks": 8 }, { "url": "https://huggingface.co/facebook/mbart-large-5%E9%95%98are", "internal": false, "reflection": false, "title": null, "clicks": 7 }, { "url": "https://huggingface.co/cohere-command-r", "internal": false, "reflection": false, "title": null, "clicks": 7 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/simple-model-to-rewrite-paraphrase/145918/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209379, "name": "Johannes Vogt", "username": "jvogt", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/{size}.png", "created_at": "2025-03-16T15:17:34.353Z", "cooked": "<p>This appears to be the answer from Chat-GPT, since it is the links are wrong and the answer is quite vague</p>", "post_number": 3, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-16T15:17:34.353Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 10, "readers_count": 9, "score": 17, "yours": false, "topic_id": 145918, "topic_slug": "simple-model-to-rewrite-paraphrase", "display_username": "Johannes Vogt", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87294, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/simple-model-to-rewrite-paraphrase/145918/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209380, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-16T15:19:11.932Z", "cooked": "<p>The second half is a general discussion using <a href=\"https://huggingface.co/chat/\">Hugging Chat</a>. It’s not as smart as ChatGPT. The first half is manual. I left it to the chatbot to explain why that model was unsuitable for that task, as it was too much trouble to explain.</p>", "post_number": 4, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-16T15:21:22.635Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 9, "readers_count": 8, "score": 31.8, "yours": false, "topic_id": 145918, "topic_slug": "simple-model-to-rewrite-paraphrase", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/chat/", "internal": false, "reflection": false, "title": "HuggingChat", "clicks": 2 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/simple-model-to-rewrite-paraphrase/145918/4", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209417, "name": "Johannes Vogt", "username": "jvogt", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/57b2e6/{size}.png", "created_at": "2025-03-16T17:48:54.157Z", "cooked": "<p>Thank you for your part! The problem is, that general models tend to add their own information to the text and this needs to be prohibited in the use case.</p>\n<p>That’s why a specialized model would be great, that is trained to not change the meaning of the text or only make minor changes.</p>", "post_number": 5, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-16T17:49:31.376Z", "reply_count": 0, "reply_to_post_number": 4, "quote_count": 0, "incoming_link_count": 8, "reads": 8, "readers_count": 7, "score": 56.6, "yours": false, "topic_id": 145918, "topic_slug": "simple-model-to-rewrite-paraphrase", "display_username": "Johannes Vogt", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87294, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/simple-model-to-rewrite-paraphrase/145918/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209495, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-17T05:14:45.445Z", "cooked": "<p>The Instruct models are tuned for chatbot-like use, so I think using the Base models would be a little better, but that tendency is certainly strong in LLM in general. I think something that creates something…<br>\nsomething that’s about halfway between LM and LLM would be good.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/google/flan-t5-large\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/google/flan-t5-large\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/c/1cc85985e6114d327f569f157e0a0d86a9ff63af_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5A70A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/google/flan-t5-large\" target=\"_blank\" rel=\"noopener\">google/flan-t5-large · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox stackexchange\" data-onebox-src=\"https://stackoverflow.com/questions/75203036/flan-t5-how-to-give-the-correct-prompt-question\">\n <header class=\"source\">\n\n <a href=\"https://stackoverflow.com/questions/75203036/flan-t5-how-to-give-the-correct-prompt-question\" target=\"_blank\" rel=\"noopener\">stackoverflow.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <a href=\"https://stackoverflow.com/users/21061599/rahul-seeetharaman\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"Rahul Seeetharaman\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/a/7/a7aee291529121afbbd3ce139c60449fb2b036be.png\" class=\"thumbnail onebox-avatar\" data-dominant-color=\"53BBE6\" width=\"256\" height=\"256\">\n </a>\n\n<h4>\n <a href=\"https://stackoverflow.com/questions/75203036/flan-t5-how-to-give-the-correct-prompt-question\" target=\"_blank\" rel=\"noopener\">Flan T5 - How to give the correct prompt/question?</a>\n</h4>\n\n<div class=\"tags\">\n <strong>nlp, huggingface-transformers</strong>\n</div>\n\n<div class=\"date\">\n asked by\n \n <a href=\"https://stackoverflow.com/users/21061599/rahul-seeetharaman\" target=\"_blank\" rel=\"noopener\">\n Rahul Seeetharaman\n </a>\n on <a href=\"https://stackoverflow.com/questions/75203036/flan-t5-how-to-give-the-correct-prompt-question\" target=\"_blank\" rel=\"noopener\">06:55PM - 22 Jan 23 UTC</a>\n</div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 6, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-17T05:14:45.445Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 17, "reads": 8, "readers_count": 7, "score": 101.6, "yours": false, "topic_id": 145918, "topic_slug": "simple-model-to-rewrite-paraphrase", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/google/flan-t5-large", "internal": false, "reflection": false, "title": "google/flan-t5-large · Hugging Face", "clicks": 28 }, { "url": "https://stackoverflow.com/questions/75203036/flan-t5-how-to-give-the-correct-prompt-question", "internal": false, "reflection": false, "title": "nlp - Flan T5 - How to give the correct prompt/question? - Stack Overflow", "clicks": 16 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/simple-model-to-rewrite-paraphrase/145918/6", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210099, "name": "LeeBase", "username": "leebase", "avatar_template": "/user_avatar/discuss.huggingface.co/leebase/{size}/42602_2.png", "created_at": "2025-03-19T16:02:48.335Z", "cooked": "<p>Thanks so much for this informative response</p>", "post_number": 7, "post_type": 1, "posts_count": 8, "updated_at": "2025-03-19T16:02:48.335Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 1, "reads": 5, "readers_count": 4, "score": 21, "yours": false, "topic_id": 145918, "topic_slug": "simple-model-to-rewrite-paraphrase", "display_username": "LeeBase", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86088, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/simple-model-to-rewrite-paraphrase/145918/7", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 211874, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-27T21:18:13.586Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 8, "post_type": 3, "posts_count": 8, "updated_at": "2025-03-27T21:18:13.586Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 2, "readers_count": 1, "score": 15.4, "yours": false, "topic_id": 145918, "topic_slug": "simple-model-to-rewrite-paraphrase", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/simple-model-to-rewrite-paraphrase/145918/8", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hey,</p> <p>I am searching for a model, that can be used for re-writing a text using in a sophisticated style and is as small as possible (should focus only on this task).</p> <p>I was trying to use the the T5, BART and PEGASUS model but the first two did not change the text while the later gave a completely different text.</p> <p>The paraphrase models seem to map sentences and paragraphs to dense vectors instead of creating new sentences.</p> <pre><code class="lang-auto">from transformers import PegasusForConditionalGeneration, PegasusTokenizer source_path = "/media/admin_ud/Volume/huggingface_cache/huggingface/hub" model = PegasusForConditionalGeneration.from_pretrained("google/pegasus-xsum",cache_dir = source_path) tokenizer = PegasusTokenizer.from_pretrained("google/pegasus-xsum",cache_dir = source_path) # Input sentence sentence = "I have backpain. And I have a headache. And I have pain in my leg." # Tokenizing the input input_text = f"paraphrase: {sentence}" inputs = tokenizer(input_text, return_tensors="pt", max_length=512, truncation=True) # Generating reformulated sentence outputs = model.generate(inputs["input_ids"], max_length=128, num_beams=5, early_stopping=True) # Decoding the output reformulated_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True) print(reformulated_sentence) # "I have pain in my leg." `` Which model/model class is suitable for that task?</code></pre>
<p>The Instruct models are tuned for chatbot-like use, so I think using the Base models would be a little better, but that tendency is certainly strong in LLM in general. I think something that creates something…<br> something that’s about halfway between LM and LLM would be good.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/google/flan-t5-large"> <header class="source"> <a href="https://huggingface.co/google/flan-t5-large" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/c/1cc85985e6114d327f569f157e0a0d86a9ff63af_2_690x372.png" class="thumbnail" data-dominant-color="5A70A4" width="690" height="372"></div> <h3><a href="https://huggingface.co/google/flan-t5-large" target="_blank" rel="noopener">google/flan-t5-large · Hugging Face</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox stackexchange" data-onebox-src="https://stackoverflow.com/questions/75203036/flan-t5-how-to-give-the-correct-prompt-question"> <header class="source"> <a href="https://stackoverflow.com/questions/75203036/flan-t5-how-to-give-the-correct-prompt-question" target="_blank" rel="noopener">stackoverflow.com</a> </header> <article class="onebox-body"> <a href="https://stackoverflow.com/users/21061599/rahul-seeetharaman" target="_blank" rel="noopener"> <img alt="Rahul Seeetharaman" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/a/7/a7aee291529121afbbd3ce139c60449fb2b036be.png" class="thumbnail onebox-avatar" data-dominant-color="53BBE6" width="256" height="256"> </a> <h4> <a href="https://stackoverflow.com/questions/75203036/flan-t5-how-to-give-the-correct-prompt-question" target="_blank" rel="noopener">Flan T5 - How to give the correct prompt/question?</a> </h4> <div class="tags"> <strong>nlp, huggingface-transformers</strong> </div> <div class="date"> asked by <a href="https://stackoverflow.com/users/21061599/rahul-seeetharaman" target="_blank" rel="noopener"> Rahul Seeetharaman </a> on <a href="https://stackoverflow.com/questions/75203036/flan-t5-how-to-give-the-correct-prompt-question" target="_blank" rel="noopener">06:55PM - 22 Jan 23 UTC</a> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
The size of tensor a (882) must match the size of tensor b (568) at non-singleton dimension 1
https://discuss.huggingface.co/t/the-size-of-tensor-a-882-must-match-the-size-of-tensor-b-568-at-non-singleton-dimension-1/147560
147,560
9
2025-03-26T19:02:36.537000Z
[ { "id": 211666, "name": "Qiyao Wei", "username": "QiyaoWei", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/q/8797f3/{size}.png", "created_at": "2025-03-26T19:02:36.598Z", "cooked": "<p>I am using quite a standard pipeline to train reward modelling with an implicit preference dataset, but I run into the issue of tensor dimension mismatch. May I ask what might be the issue here, and what debugging steps I can take to resolve this issue?</p>\n<pre><code class=\"lang-auto\">import torch\nfrom datasets import load_dataset\nfrom trl import RewardTrainer, RewardConfig\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\ntorch.set_default_device('cuda')\nmodel = AutoModelForCausalLM.from_pretrained(\"gemma3\", attn_implementation='eager')\ntokenizer = AutoTokenizer.from_pretrained(\"gemma3\")\n\n# load training data, and process it so it becomes an implicit preference dataset (\"chosen\" and \"rejected\")\ntrain_dataset = load_dataset(\"json\", data_files=\"custom_training_data.json\", split=\"train\")\ndef prefix_with_input(example):\n example['chosen'] = example['input'] + \" \" + example['chosen']\n example['rejected'] = example['input'] + \" \" + example['rejected'][0]\n return example\ntrain_dataset = train_dataset.map(prefix_with_input)\ntrain_dataset = train_dataset.remove_columns([\"input\"])\n\ntraining_args = RewardConfig()\ntokenizer.pad_token = tokenizer.eos_token\ntraining_args.dataloader_pin_memory=False\ntraining_args.per_device_train_batch_size = 1\n\ntrainer = RewardTrainer(\n model=model,\n args=training_args,\n processing_class=tokenizer,\n train_dataset=train_dataset\n)\ntrainer.train()\n</code></pre>\n<p>Error message below:</p>\n<pre><code class=\"lang-auto\">The size of tensor a (882) must match the size of tensor b (568) at non-singleton dimension 1\n File \"train.py\", line 109, in &lt;module&gt;\n trainer.train()\nRuntimeError: The size of tensor a (882) must match the size of tensor b (568) at non-singleton dimension 1\n</code></pre>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-26T19:02:36.598Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 189, "reads": 9, "readers_count": 8, "score": 896.8, "yours": false, "topic_id": 147560, "topic_slug": "the-size-of-tensor-a-882-must-match-the-size-of-tensor-b-568-at-non-singleton-dimension-1", "display_username": "Qiyao Wei", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 42125, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-size-of-tensor-a-882-must-match-the-size-of-tensor-b-568-at-non-singleton-dimension-1/147560/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211753, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-27T07:18:25.596Z", "cooked": "<p>In the simplest case, it seems that the problem can be fixed by setting <strong>tokenizer.model_max_length = 512</strong>.</p>\n<hr>\n<p>The error you’re encountering, “The size of tensor a (882) must match the size of tensor b (568) at non-singleton dimension 1,” indicates a mismatch in tensor dimensions during the training process. This is a common issue in deep learning when tensors of different shapes are combined or compared. Below, I’ll guide you through potential causes and debugging steps to resolve this issue.</p>\n<hr>\n<h3><a name=\"p-211753-potential-causes-1\" class=\"anchor\" href=\"#p-211753-potential-causes-1\"></a><strong>Potential Causes</strong></h3>\n<ol>\n<li>\n<p><strong>Mismatched Input Sizes</strong>:</p>\n<ul>\n<li>The tensors being passed to the model (e.g., <code>chosen</code> and <code>rejected</code> examples) might have inconsistent shapes.</li>\n<li>For example, the <code>chosen</code> and <code>rejected</code> sequences could have different lengths after tokenization.</li>\n</ul>\n</li>\n<li>\n<p><strong>Batching Issues</strong>:</p>\n<ul>\n<li>The <code>RewardTrainer</code> might be expecting batches of consistent size, but the data loader is providing batches with varying tensor dimensions.</li>\n</ul>\n</li>\n<li>\n<p><strong>Tokenization Differences</strong>:</p>\n<ul>\n<li>The <code>chosen</code> and <code>rejected</code> examples might not be tokenized to the same maximum length, causing tensor shape mismatches.</li>\n</ul>\n</li>\n<li>\n<p><strong>Inconsistent Dataset Processing</strong>:</p>\n<ul>\n<li>The <code>prefix_with_input</code> function could be introducing irregularities in the dataset, leading to inconsistent tensor shapes.</li>\n</ul>\n</li>\n</ol>\n<hr>\n<h3><a name=\"p-211753-debugging-steps-2\" class=\"anchor\" href=\"#p-211753-debugging-steps-2\"></a><strong>Debugging Steps</strong></h3>\n<h4><a name=\"p-211753-h-1-verify-input-tensor-shapes-3\" class=\"anchor\" href=\"#p-211753-h-1-verify-input-tensor-shapes-3\"></a>1. <strong>Verify Input Tensor Shapes</strong></h4>\n<ul>\n<li>Add print statements or use debugging tools to inspect the shapes of tensors before and after processing.</li>\n<li>For example, in the <code>prefix_with_input</code> function, check the lengths of <code>chosen</code> and <code>rejected</code> sequences:<pre data-code-wrap=\"python\"><code class=\"lang-python\">def prefix_with_input(example):\n example['chosen'] = example['input'] + \" \" + example['chosen']\n example['rejected'] = example['input'] + \" \" + example['rejected'][0]\n print(f\"Chosen length: {len(example['chosen'].split())}\")\n print(f\"Rejected length: {len(example['rejected'].split())}\")\n return example\n</code></pre>\n</li>\n<li>This will help identify if the sequences have mismatched lengths.</li>\n</ul>\n<h4><a name=\"p-211753-h-2-ensure-consistent-tokenization-4\" class=\"anchor\" href=\"#p-211753-h-2-ensure-consistent-tokenization-4\"></a>2. <strong>Ensure Consistent Tokenization</strong></h4>\n<ul>\n<li>The <code>tokenizer</code> might not be padding or truncating sequences to the same length. Try setting a fixed maximum sequence length:<pre data-code-wrap=\"python\"><code class=\"lang-python\">from transformers import AutoTokenizer\ntokenizer = AutoTokenizer.from_pretrained(\"gemma3\")\ntokenizer.model_max_length = 512 # Set a fixed maximum length\n</code></pre>\n</li>\n<li>When tokenizing, ensure that both <code>chosen</code> and <code>rejected</code> examples are padded or truncated to the same length:<pre data-code-wrap=\"python\"><code class=\"lang-python\">train_dataset = train_dataset.map(prefix_with_input).map(\n lambda x: tokenizer(\n x['chosen'], max_length=tokenizer.model_max_length,\n padding='max_length', truncation=True\n ),\n batched=True\n)\n</code></pre>\n</li>\n</ul>\n<h4><a name=\"p-211753-h-3-inspect-batch-sizes-5\" class=\"anchor\" href=\"#p-211753-h-3-inspect-batch-sizes-5\"></a>3. <strong>Inspect Batch Sizes</strong></h4>\n<ul>\n<li>Check if the data loader is producing batches with consistent tensor shapes. You can modify the <code>RewardConfig</code> to include:<pre data-code-wrap=\"python\"><code class=\"lang-python\">training_args = RewardConfig(\n dataloader_pin_memory=False,\n per_device_train_batch_size=1,\n max_steps=1 # Process only one batch to inspect shapes\n)\n</code></pre>\n</li>\n<li>After training, inspect the shapes of the input tensors:<pre data-code-wrap=\"python\"><code class=\"lang-python\">for batch in trainer.get_train_dataloader():\n print(f\"Batch shapes: {batch['input_ids'].shape}\")\n break # Exit after the first batch\n</code></pre>\n</li>\n</ul>\n<h4><a name=\"p-211753-h-4-check-the-reward-models-input-requirements-6\" class=\"anchor\" href=\"#p-211753-h-4-check-the-reward-models-input-requirements-6\"></a>4. <strong>Check the Reward Model’s Input Requirements</strong></h4>\n<ul>\n<li>Ensure that the reward model expects inputs of the same shape. You can print the model’s input requirements:<pre data-code-wrap=\"python\"><code class=\"lang-python\">print(model)\n</code></pre>\n</li>\n</ul>\n<h4><a name=\"p-211753-h-5-modify-the-dataset-processing-7\" class=\"anchor\" href=\"#p-211753-h-5-modify-the-dataset-processing-7\"></a>5. <strong>Modify the Dataset Processing</strong></h4>\n<ul>\n<li>The <code>prefix_with_input</code> function might be introducing inconsistencies. Try simplifying it to ensure consistent processing:<pre data-code-wrap=\"python\"><code class=\"lang-python\">def prefix_with_input(example):\n example['chosen'] = example['input'] + \" \" + example['chosen']\n example['rejected'] = example['input'] + \" \" + example['rejected'][0]\n # Ensure both sequences have the same format\n assert isinstance(example['chosen'], str) and isinstance(example['rejected'], str)\n return example\n</code></pre>\n</li>\n</ul>\n<hr>\n<h3><a name=\"p-211753-example-solution-8\" class=\"anchor\" href=\"#p-211753-example-solution-8\"></a><strong>Example Solution</strong></h3>\n<p>Based on the error message, the mismatch is likely due to inconsistent tokenization or batching. Here’s a modified version of your code with potential fixes:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">import torch\nfrom datasets import load_dataset\nfrom trl import RewardTrainer, RewardConfig\nfrom transformers import AutoModelForCausalLM, AutoTokenizer\n\ntorch.set_default_device('cuda')\nmodel = AutoModelForCausalLM.from_pretrained(\"gemma3\", attn_implementation='eager')\ntokenizer = AutoTokenizer.from_pretrained(\"gemma3\")\ntokenizer.pad_token = tokenizer.eos_token\ntokenizer.model_max_length = 512 # Fixed maximum sequence length\n\n# Load and process the dataset\ntrain_dataset = load_dataset(\"json\", data_files=\"custom_training_data.json\", split=\"train\")\n\ndef prefix_with_input(example):\n example['chosen'] = example['input'] + \" \" + example['chosen']\n example['rejected'] = example['input'] + \" \" + example['rejected'][0]\n return example\n\n# Apply the prefix function\ntrain_dataset = train_dataset.map(prefix_with_input, num_proc=4)\n\n# Tokenize the dataset\ntrain_dataset = train_dataset.map(\n lambda x: tokenizer(\n x['chosen'], max_length=tokenizer.model_max_length,\n padding='max_length', truncation=True\n ),\n batched=True\n)\n\n# Remove unnecessary columns\ntrain_dataset = train_dataset.remove_columns([\"input\"])\n\n# Initialize training arguments\ntraining_args = RewardConfig(\n dataloader_pin_memory=False,\n per_device_train_batch_size=1\n)\n\n# Initialize the trainer\ntrainer = RewardTrainer(\n model=model,\n args=training_args,\n processing_class=tokenizer,\n train_dataset=train_dataset\n)\n\n# Debugging: Print batch shapes\nfor batch in trainer.get_train_dataloader():\n print(f\"Batch shapes: {batch['input_ids'].shape}\")\n break\n\n# Train the model\ntrainer.train()\n</code></pre>\n<hr>\n<h3><a name=\"p-211753-final-notes-9\" class=\"anchor\" href=\"#p-211753-final-notes-9\"></a><strong>Final Notes</strong></h3>\n<ul>\n<li>If the issue persists, consider reducing the batch size (<code>per_device_train_batch_size</code>) or experimenting with different maximum sequence lengths.</li>\n<li>To gain more insights, you can also enable detailed error messages by setting <code>os.environ['HYDRA_FULL_ERROR'] = '1'</code> at the beginning of your script.</li>\n</ul>\n<p>By following these steps, you should be able to identify and resolve the tensor dimension mismatch issue in your reward modeling pipeline.</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-27T07:18:25.596Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 10, "reads": 6, "readers_count": 5, "score": 46.2, "yours": false, "topic_id": 147560, "topic_slug": "the-size-of-tensor-a-882-must-match-the-size-of-tensor-b-568-at-non-singleton-dimension-1", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-size-of-tensor-a-882-must-match-the-size-of-tensor-b-568-at-non-singleton-dimension-1/147560/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211869, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-27T20:55:05.247Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-27T20:55:05.247Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 3, "readers_count": 2, "score": 5.6, "yours": false, "topic_id": 147560, "topic_slug": "the-size-of-tensor-a-882-must-match-the-size-of-tensor-b-568-at-non-singleton-dimension-1", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-size-of-tensor-a-882-must-match-the-size-of-tensor-b-568-at-non-singleton-dimension-1/147560/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I am using quite a standard pipeline to train reward modelling with an implicit preference dataset, but I run into the issue of tensor dimension mismatch. May I ask what might be the issue here, and what debugging steps I can take to resolve this issue?</p> <pre><code class="lang-auto">import torch from datasets import load_dataset from trl import RewardTrainer, RewardConfig from transformers import AutoModelForCausalLM, AutoTokenizer torch.set_default_device('cuda') model = AutoModelForCausalLM.from_pretrained("gemma3", attn_implementation='eager') tokenizer = AutoTokenizer.from_pretrained("gemma3") # load training data, and process it so it becomes an implicit preference dataset ("chosen" and "rejected") train_dataset = load_dataset("json", data_files="custom_training_data.json", split="train") def prefix_with_input(example): example['chosen'] = example['input'] + " " + example['chosen'] example['rejected'] = example['input'] + " " + example['rejected'][0] return example train_dataset = train_dataset.map(prefix_with_input) train_dataset = train_dataset.remove_columns(["input"]) training_args = RewardConfig() tokenizer.pad_token = tokenizer.eos_token training_args.dataloader_pin_memory=False training_args.per_device_train_batch_size = 1 trainer = RewardTrainer( model=model, args=training_args, processing_class=tokenizer, train_dataset=train_dataset ) trainer.train() </code></pre> <p>Error message below:</p> <pre><code class="lang-auto">The size of tensor a (882) must match the size of tensor b (568) at non-singleton dimension 1 File "train.py", line 109, in &lt;module&gt; trainer.train() RuntimeError: The size of tensor a (882) must match the size of tensor b (568) at non-singleton dimension 1 </code></pre>
<p>In the simplest case, it seems that the problem can be fixed by setting <strong>tokenizer.model_max_length = 512</strong>.</p> <hr> <p>The error you’re encountering, “The size of tensor a (882) must match the size of tensor b (568) at non-singleton dimension 1,” indicates a mismatch in tensor dimensions during the training process. This is a common issue in deep learning when tensors of different shapes are combined or compared. Below, I’ll guide you through potential causes and debugging steps to resolve this issue.</p> <hr> <h3><a name="p-211753-potential-causes-1" class="anchor" href="#p-211753-potential-causes-1"></a><strong>Potential Causes</strong></h3> <ol> <li> <p><strong>Mismatched Input Sizes</strong>:</p> <ul> <li>The tensors being passed to the model (e.g., <code>chosen</code> and <code>rejected</code> examples) might have inconsistent shapes.</li> <li>For example, the <code>chosen</code> and <code>rejected</code> sequences could have different lengths after tokenization.</li> </ul> </li> <li> <p><strong>Batching Issues</strong>:</p> <ul> <li>The <code>RewardTrainer</code> might be expecting batches of consistent size, but the data loader is providing batches with varying tensor dimensions.</li> </ul> </li> <li> <p><strong>Tokenization Differences</strong>:</p> <ul> <li>The <code>chosen</code> and <code>rejected</code> examples might not be tokenized to the same maximum length, causing tensor shape mismatches.</li> </ul> </li> <li> <p><strong>Inconsistent Dataset Processing</strong>:</p> <ul> <li>The <code>prefix_with_input</code> function could be introducing irregularities in the dataset, leading to inconsistent tensor shapes.</li> </ul> </li> </ol> <hr> <h3><a name="p-211753-debugging-steps-2" class="anchor" href="#p-211753-debugging-steps-2"></a><strong>Debugging Steps</strong></h3> <h4><a name="p-211753-h-1-verify-input-tensor-shapes-3" class="anchor" href="#p-211753-h-1-verify-input-tensor-shapes-3"></a>1. <strong>Verify Input Tensor Shapes</strong></h4> <ul> <li>Add print statements or use debugging tools to inspect the shapes of tensors before and after processing.</li> <li>For example, in the <code>prefix_with_input</code> function, check the lengths of <code>chosen</code> and <code>rejected</code> sequences:<pre data-code-wrap="python"><code class="lang-python">def prefix_with_input(example): example['chosen'] = example['input'] + " " + example['chosen'] example['rejected'] = example['input'] + " " + example['rejected'][0] print(f"Chosen length: {len(example['chosen'].split())}") print(f"Rejected length: {len(example['rejected'].split())}") return example </code></pre> </li> <li>This will help identify if the sequences have mismatched lengths.</li> </ul> <h4><a name="p-211753-h-2-ensure-consistent-tokenization-4" class="anchor" href="#p-211753-h-2-ensure-consistent-tokenization-4"></a>2. <strong>Ensure Consistent Tokenization</strong></h4> <ul> <li>The <code>tokenizer</code> might not be padding or truncating sequences to the same length. Try setting a fixed maximum sequence length:<pre data-code-wrap="python"><code class="lang-python">from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("gemma3") tokenizer.model_max_length = 512 # Set a fixed maximum length </code></pre> </li> <li>When tokenizing, ensure that both <code>chosen</code> and <code>rejected</code> examples are padded or truncated to the same length:<pre data-code-wrap="python"><code class="lang-python">train_dataset = train_dataset.map(prefix_with_input).map( lambda x: tokenizer( x['chosen'], max_length=tokenizer.model_max_length, padding='max_length', truncation=True ), batched=True ) </code></pre> </li> </ul> <h4><a name="p-211753-h-3-inspect-batch-sizes-5" class="anchor" href="#p-211753-h-3-inspect-batch-sizes-5"></a>3. <strong>Inspect Batch Sizes</strong></h4> <ul> <li>Check if the data loader is producing batches with consistent tensor shapes. You can modify the <code>RewardConfig</code> to include:<pre data-code-wrap="python"><code class="lang-python">training_args = RewardConfig( dataloader_pin_memory=False, per_device_train_batch_size=1, max_steps=1 # Process only one batch to inspect shapes ) </code></pre> </li> <li>After training, inspect the shapes of the input tensors:<pre data-code-wrap="python"><code class="lang-python">for batch in trainer.get_train_dataloader(): print(f"Batch shapes: {batch['input_ids'].shape}") break # Exit after the first batch </code></pre> </li> </ul> <h4><a name="p-211753-h-4-check-the-reward-models-input-requirements-6" class="anchor" href="#p-211753-h-4-check-the-reward-models-input-requirements-6"></a>4. <strong>Check the Reward Model’s Input Requirements</strong></h4> <ul> <li>Ensure that the reward model expects inputs of the same shape. You can print the model’s input requirements:<pre data-code-wrap="python"><code class="lang-python">print(model) </code></pre> </li> </ul> <h4><a name="p-211753-h-5-modify-the-dataset-processing-7" class="anchor" href="#p-211753-h-5-modify-the-dataset-processing-7"></a>5. <strong>Modify the Dataset Processing</strong></h4> <ul> <li>The <code>prefix_with_input</code> function might be introducing inconsistencies. Try simplifying it to ensure consistent processing:<pre data-code-wrap="python"><code class="lang-python">def prefix_with_input(example): example['chosen'] = example['input'] + " " + example['chosen'] example['rejected'] = example['input'] + " " + example['rejected'][0] # Ensure both sequences have the same format assert isinstance(example['chosen'], str) and isinstance(example['rejected'], str) return example </code></pre> </li> </ul> <hr> <h3><a name="p-211753-example-solution-8" class="anchor" href="#p-211753-example-solution-8"></a><strong>Example Solution</strong></h3> <p>Based on the error message, the mismatch is likely due to inconsistent tokenization or batching. Here’s a modified version of your code with potential fixes:</p> <pre data-code-wrap="python"><code class="lang-python">import torch from datasets import load_dataset from trl import RewardTrainer, RewardConfig from transformers import AutoModelForCausalLM, AutoTokenizer torch.set_default_device('cuda') model = AutoModelForCausalLM.from_pretrained("gemma3", attn_implementation='eager') tokenizer = AutoTokenizer.from_pretrained("gemma3") tokenizer.pad_token = tokenizer.eos_token tokenizer.model_max_length = 512 # Fixed maximum sequence length # Load and process the dataset train_dataset = load_dataset("json", data_files="custom_training_data.json", split="train") def prefix_with_input(example): example['chosen'] = example['input'] + " " + example['chosen'] example['rejected'] = example['input'] + " " + example['rejected'][0] return example # Apply the prefix function train_dataset = train_dataset.map(prefix_with_input, num_proc=4) # Tokenize the dataset train_dataset = train_dataset.map( lambda x: tokenizer( x['chosen'], max_length=tokenizer.model_max_length, padding='max_length', truncation=True ), batched=True ) # Remove unnecessary columns train_dataset = train_dataset.remove_columns(["input"]) # Initialize training arguments training_args = RewardConfig( dataloader_pin_memory=False, per_device_train_batch_size=1 ) # Initialize the trainer trainer = RewardTrainer( model=model, args=training_args, processing_class=tokenizer, train_dataset=train_dataset ) # Debugging: Print batch shapes for batch in trainer.get_train_dataloader(): print(f"Batch shapes: {batch['input_ids'].shape}") break # Train the model trainer.train() </code></pre> <hr> <h3><a name="p-211753-final-notes-9" class="anchor" href="#p-211753-final-notes-9"></a><strong>Final Notes</strong></h3> <ul> <li>If the issue persists, consider reducing the batch size (<code>per_device_train_batch_size</code>) or experimenting with different maximum sequence lengths.</li> <li>To gain more insights, you can also enable detailed error messages by setting <code>os.environ['HYDRA_FULL_ERROR'] = '1'</code> at the beginning of your script.</li> </ul> <p>By following these steps, you should be able to identify and resolve the tensor dimension mismatch issue in your reward modeling pipeline.</p>
SSO Lockout from Enterprise
https://discuss.huggingface.co/t/sso-lockout-from-enterprise/147494
147,494
5
2025-03-26T11:55:07.850000Z
[ { "id": 211566, "name": "Jacob Hagstedt", "username": "wcgs", "avatar_template": "/user_avatar/discuss.huggingface.co/wcgs/{size}/44143_2.png", "created_at": "2025-03-26T11:55:07.908Z", "cooked": "<p>Hi!</p>\n<p>Similarly like the question here: <a href=\"https://discuss.huggingface.co/t/hugging-face-issue-with-sso/140700\" class=\"inline-onebox\">Hugging Face issue with sso</a>, while setting up SSO for our Enterprise Org we did get an error that we provided the wrong information when clicking the test button. Problem is that the page then reloaded and it seems like the SSO setup was activated, making it so that we are now locked out of the Enterprise settings.</p>\n<p>Not sure where to reach out to to get help with this. Is it something that perhaps you <a class=\"mention\" href=\"/u/meganariley\">@meganariley</a> can help with? <img src=\"https://emoji.discourse-cdn.com/apple/pray.png?v=14\" title=\":pray:\" class=\"emoji\" alt=\":pray:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>Thanks!</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-26T11:55:07.908Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 29, "reads": 7, "readers_count": 6, "score": 156.4, "yours": false, "topic_id": 147494, "topic_slug": "sso-lockout-from-enterprise", "display_username": "Jacob Hagstedt", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/hugging-face-issue-with-sso/140700", "internal": true, "reflection": false, "title": "Hugging Face issue with sso", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88512, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sso-lockout-from-enterprise/147494/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211577, "name": "Megan Riley", "username": "meganariley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png", "created_at": "2025-03-26T13:35:09.874Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/wcgs\">@wcgs</a> yes! We can help. You can email <a href=\"mailto:[email protected]\">[email protected]</a> and we’ll help getting you back into the org!</p>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-26T13:35:09.874Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 16.2, "yours": false, "topic_id": 147494, "topic_slug": "sso-lockout-from-enterprise", "display_username": "Megan Riley", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 31941, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sso-lockout-from-enterprise/147494/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211659, "name": "Kate Winslet", "username": "KateWinslet", "avatar_template": "/user_avatar/discuss.huggingface.co/katewinslet/{size}/26764_2.png", "created_at": "2025-03-26T18:13:35.453Z", "cooked": "<aside class=\"quote no-group quote-modified\" data-username=\"wcgs\" data-post=\"1\" data-topic=\"147494\" data-full=\"true\">\n<div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/wcgs/48/44143_2.png\" class=\"avatar\"> wcgs:</div>\n<blockquote>\n<p>Hi!</p>\n<p>Similarly like the question here: <a href=\"https://discuss.huggingface.co/t/hugging-face-issue-with-sso/140700\">Hugging Face issue with sso</a>, while setting up SSO for our Enterprise Org we did get an error that we provided the wrong information when clicking the test button. Problem is that the page then reloaded and it seems like the SSO setup was activated, making it so that we are now locked out of the Enterprise settings.</p>\n<p>Not sure where to reach out to to get help with this. Is it something that perhaps you <a href=\"https://animeslayer.me/\" rel=\"noopener nofollow ugc\">download anime slayer</a> <a class=\"mention\" href=\"/u/meganariley\">@meganariley</a> can help with? <img src=\"https://emoji.discourse-cdn.com/apple/pray.png?v=14\" title=\":pray:\" class=\"emoji\" alt=\":pray:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>Thanks!</p>\n</blockquote>\n</aside>\n<p>For the SSO issue with Hugging Face, try clearing your browser cache and cookies. If the problem persists, contact Hugging Face support for assistance. You can also reach out on their community forums or Slack, or ask your internal contact for help.</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-04-01T14:09:18.950Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 1, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 1.2, "yours": false, "topic_id": 147494, "topic_slug": "sso-lockout-from-enterprise", "display_username": "Kate Winslet", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 36462, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sso-lockout-from-enterprise/147494/3", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211737, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-27T06:13:48.399Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-03-27T06:13:48.399Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 147494, "topic_slug": "sso-lockout-from-enterprise", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sso-lockout-from-enterprise/147494/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi!</p> <p>Similarly like the question here: <a href="https://discuss.huggingface.co/t/hugging-face-issue-with-sso/140700" class="inline-onebox">Hugging Face issue with sso</a>, while setting up SSO for our Enterprise Org we did get an error that we provided the wrong information when clicking the test button. Problem is that the page then reloaded and it seems like the SSO setup was activated, making it so that we are now locked out of the Enterprise settings.</p> <p>Not sure where to reach out to to get help with this. Is it something that perhaps you <a class="mention" href="/u/meganariley">@meganariley</a> can help with? <img src="https://emoji.discourse-cdn.com/apple/pray.png?v=14" title=":pray:" class="emoji" alt=":pray:" loading="lazy" width="20" height="20"></p> <p>Thanks!</p>
<p>Hi <a class="mention" href="/u/wcgs">@wcgs</a> yes! We can help. You can email <a href="mailto:[email protected]">[email protected]</a> and we’ll help getting you back into the org!</p>
How does the hub handles http error 429?
https://discuss.huggingface.co/t/how-does-the-hub-handles-http-error-429/147346
147,346
23
2025-03-25T13:17:32.511000Z
[ { "id": 211363, "name": "Vincent CHALMEL", "username": "vchalmel-naomis", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/v/b487fb/{size}.png", "created_at": "2025-03-25T13:17:32.566Z", "cooked": "<p>Hi !</p>\n<p>I have trouble trying to experiment with <a href=\"https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503\">mistralai/Mistral-Small-3.1-24B-Instruct-2503</a> because any attempt to use it in python code or downloading, either with git clone or huggingface hub CLI throws error codes 429.</p>\n<p>I had the issue last thursday, friday, and this monday. I do not face the same issues with other models.</p>\n<p>I’m really scrapping my head there so I would like a complete explanation about how and when does HF hub returns that code :<br>\nHere are a few questions that came to my mind trying to understand what is going on :</p>\n<ol>\n<li>Is the issue on MY side or could the repo itself for the model be rate limited ?</li>\n<li>Is the error code used ONLY for rate limits or also when trying to access gated repos without an access token for an account allowed on that model ?</li>\n<li>How many failed attempts (e.g. bad token configuration, attempts before getting correct access to a gated repo, etc. ) would trigger that error ?</li>\n<li>How long does it takes to revert ? Is there any way to check if its lifted without risking to delay it / get it renewed for another cycle ?</li>\n<li>Does it reset when switching from “anonymous” usage (for non gated repos) to using my access token for gated repos. (which would be either a rate limit on the IP or the account ?)</li>\n<li>I’m experimenting on a cloud VM, Could I be “poisoned” by rates limits being applied to another VM in the same host network ?</li>\n</ol>\n<p>And Lastly… Is it possible that hugging face returns this code because some repos/models requires pro account or enterprise hub ?</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-25T13:19:42.789Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 6258, "reads": 88, "readers_count": 87, "score": 30997.6, "yours": false, "topic_id": 147346, "topic_slug": "how-does-the-hub-handles-http-error-429", "display_username": "Vincent CHALMEL", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503", "internal": false, "reflection": false, "title": "mistralai/Mistral-Small-3.1-24B-Instruct-2503 · Hugging Face", "clicks": 11 }, { "url": "https://discuss.huggingface.co/t/dedicated-endpoint-getting-429-errors/155707/2", "internal": true, "reflection": true, "title": "Dedicated endpoint getting 429 errors", "clicks": 2 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88362, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-does-the-hub-handles-http-error-429/147346/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211371, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-25T13:54:34.416Z", "cooked": "<blockquote>\n<p>1</p>\n</blockquote>\n<p>It’s probably because too many requests were made from your IP address or token in a short period of time. I think it’s a restriction on endpoints, including models and various APIs.</p>\n<blockquote>\n<p>2</p>\n</blockquote>\n<p>I’ve only seen 429 (Too Many Requests) on Hugging Face. If it’s Gated, it’s 401, and the rest are mostly 403, 500, 503, and 404. There are also sites that write lies as disguises for server error codes, but HF is not very strange in that regard.</p>\n<blockquote>\n<p>3</p>\n</blockquote>\n<p>It happens quite a few times. If you make a bug in the program and make it loop, it happens quite easily…</p>\n<blockquote>\n<p>4</p>\n</blockquote>\n<p>In my case, it was 24 hours.</p>\n<blockquote>\n<p>5</p>\n</blockquote>\n<p>I think it’s possible to have both token-based and IP-based restrictions. If it’s a token-based restriction, you could get around it by using a different account.<br>\nIn my case, it was a token-based restriction.</p>\n<blockquote>\n<p>6</p>\n</blockquote>\n<p>Unless it’s particularly malicious, I don’t think there are any restrictions on IP or hostname ranges…</p>\n<blockquote>\n<p>last</p>\n</blockquote>\n<p>I’ve never heard of it…</p>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-25T13:54:34.416Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 95, "reads": 75, "readers_count": 74, "score": 510, "yours": false, "topic_id": 147346, "topic_slug": "how-does-the-hub-handles-http-error-429", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-does-the-hub-handles-http-error-429/147346/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211390, "name": "Vincent CHALMEL", "username": "vchalmel-naomis", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/v/b487fb/{size}.png", "created_at": "2025-03-25T15:18:59.381Z", "cooked": "<p>Thanks for your answer ! It was in fact linked to my 6th question… And IPV6</p>\n<p>I got the same error with a docker pull which led me in a rabbit hole where I found that some services (including docker hub and hugging face hub) are using rate limit methods intended only for IPv4 and so, are de facto blocking / only checking the first half of IPv6 adresses so it is entire ranges that are blocked at a time…</p>\n<p>So as a workaround I can just disable IPV6 in ubuntu /etc/sysctl.conf…</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-26T10:42:54.366Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 42, "reads": 59, "readers_count": 58, "score": 231.8, "yours": false, "topic_id": 147346, "topic_slug": "how-does-the-hub-handles-http-error-429", "display_username": "Vincent CHALMEL", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 3, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/http-error-429-while-running-mmlu/167647/2", "internal": true, "reflection": true, "title": "HTTP Error 429 while running MMLU", "clicks": 10 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88362, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-does-the-hub-handles-http-error-429/147346/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 211547, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-26T10:43:32.191Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-03-26T10:43:32.191Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 33, "reads": 51, "readers_count": 50, "score": 175.2, "yours": false, "topic_id": 147346, "topic_slug": "how-does-the-hub-handles-http-error-429", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-does-the-hub-handles-http-error-429/147346/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi !</p> <p>I have trouble trying to experiment with <a href="https://huggingface.co/mistralai/Mistral-Small-3.1-24B-Instruct-2503">mistralai/Mistral-Small-3.1-24B-Instruct-2503</a> because any attempt to use it in python code or downloading, either with git clone or huggingface hub CLI throws error codes 429.</p> <p>I had the issue last thursday, friday, and this monday. I do not face the same issues with other models.</p> <p>I’m really scrapping my head there so I would like a complete explanation about how and when does HF hub returns that code :<br> Here are a few questions that came to my mind trying to understand what is going on :</p> <ol> <li>Is the issue on MY side or could the repo itself for the model be rate limited ?</li> <li>Is the error code used ONLY for rate limits or also when trying to access gated repos without an access token for an account allowed on that model ?</li> <li>How many failed attempts (e.g. bad token configuration, attempts before getting correct access to a gated repo, etc. ) would trigger that error ?</li> <li>How long does it takes to revert ? Is there any way to check if its lifted without risking to delay it / get it renewed for another cycle ?</li> <li>Does it reset when switching from “anonymous” usage (for non gated repos) to using my access token for gated repos. (which would be either a rate limit on the IP or the account ?)</li> <li>I’m experimenting on a cloud VM, Could I be “poisoned” by rates limits being applied to another VM in the same host network ?</li> </ol> <p>And Lastly… Is it possible that hugging face returns this code because some repos/models requires pro account or enterprise hub ?</p>
<p>Thanks for your answer ! It was in fact linked to my 6th question… And IPV6</p> <p>I got the same error with a docker pull which led me in a rabbit hole where I found that some services (including docker hub and hugging face hub) are using rate limit methods intended only for IPv4 and so, are de facto blocking / only checking the first half of IPv6 adresses so it is entire ranges that are blocked at a time…</p> <p>So as a workaround I can just disable IPV6 in ubuntu /etc/sysctl.conf…</p>
Will LFS related functionality come to hf_api?
https://discuss.huggingface.co/t/will-lfs-related-functionality-come-to-hf-api/146721
146,721
23
2025-03-21T01:35:31.058000Z
[ { "id": 210425, "name": "larryvrh", "username": "larryvrh", "avatar_template": "/user_avatar/discuss.huggingface.co/larryvrh/{size}/43749_2.png", "created_at": "2025-03-21T01:35:31.124Z", "cooked": "<p>Currently we can only access the LFS list/delete functionality through the web interface, which is very inconvenient to manage in cases where I need to upload and delete frequently.<br>\nAre there any plans to add these LFS management capabilities to the Hugging Face Python API (hf_api)? This would be extremely helpful for users who need to programmatically manage large file storage.</p>", "post_number": 1, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-21T01:35:31.124Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 22, "reads": 13, "readers_count": 12, "score": 112.6, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "larryvrh", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87914, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210483, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-21T06:38:20.409Z", "cooked": "<p>I think it would be faster to ask the developer.<img src=\"https://emoji.discourse-cdn.com/apple/sweat_smile.png?v=14\" title=\":sweat_smile:\" class=\"emoji\" alt=\":sweat_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"> <a class=\"mention\" href=\"/u/wauplin\">@Wauplin</a></p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/huggingface/huggingface_hub/issues\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/huggingface/huggingface_hub/issues\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/350;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/9/3/93152d4bd1ecf7bb826177a7c46c888beb440851_2_690x350.png\" class=\"thumbnail\" data-dominant-color=\"F8F5EA\" width=\"690\" height=\"350\"></div>\n\n<h3><a href=\"https://github.com/huggingface/huggingface_hub/issues\" target=\"_blank\" rel=\"noopener\">huggingface/huggingface_hub</a></h3>\n\n <p>The official Python client for the Huggingface Hub. - huggingface/huggingface_hub</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-21T06:38:20.409Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 12, "readers_count": 11, "score": 2.4, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/huggingface_hub/issues", "internal": false, "reflection": false, "title": "GitHub · Where software is built", "clicks": 2 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210492, "name": "Lucain Pouget", "username": "Wauplin", "avatar_template": "/user_avatar/discuss.huggingface.co/wauplin/{size}/40815_2.png", "created_at": "2025-03-21T07:31:40.531Z", "cooked": "<p>Thanks for the ping <img src=\"https://emoji.discourse-cdn.com/apple/slight_smile.png?v=14\" title=\":slight_smile:\" class=\"emoji\" alt=\":slight_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"><br>\n<a class=\"mention\" href=\"/u/larryvrh\">@larryvrh</a> what are you exactly trying to achieve? For context, the <code>upload_file</code>/<code>upload_folder</code>/<code>create_commit</code> methods already work correctly with LFS files (i.e. if file is too large or matches gitattributes rules, it will automatically be uploaded as an LFS pointer). Also you can use <code>list_repo_tree</code> to list files from the repo with their LFS status (i.e. is the file LFS or not, and if yes what is the pointer file). Finally you can also delete files from the repo using <code>delete_file</code>/<code>create_commit</code>, which works seamlessly for both regular and LFS files.</p>\n<p>In general, the LFS protocol is kinda hidden to the end user when dealing with the <code>HfApi</code> client. HTTP requests are made to seamlessly work with any type or size of files. Here is a short explanation about it: <a href=\"https://huggingface.co/docs/huggingface_hub/concepts/git_vs_http\" class=\"inline-onebox\">Git vs HTTP paradigm</a>.</p>\n<p>Let me know if you have any precise question regarding LFS support in <code>HfApi</code> <img src=\"https://emoji.discourse-cdn.com/apple/hugs.png?v=14\" title=\":hugs:\" class=\"emoji\" alt=\":hugs:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 3, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-21T07:31:40.531Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 11, "readers_count": 10, "score": 47.2, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "Lucain Pouget", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/huggingface_hub/concepts/git_vs_http", "internal": false, "reflection": false, "title": "Git vs HTTP paradigm", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 9207, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/3", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 }, { "id": "hugs", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210493, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-21T07:35:39.743Z", "cooked": "<p>Thanks Wauplin!</p>", "post_number": 4, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-21T07:35:39.743Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 4, "reads": 10, "readers_count": 9, "score": 37, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/4", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210675, "name": "larryvrh", "username": "larryvrh", "avatar_template": "/user_avatar/discuss.huggingface.co/larryvrh/{size}/43749_2.png", "created_at": "2025-03-22T01:26:29.543Z", "cooked": "<p>Hi, Wauplin, thanks for replying! My problem is that the LFS storage won’t release properly even after we use the high level API to delete files. For example, I currently store my different checkpoints in different branches of a repo, each created from the initial revision:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">huggingface_hub.create_branch(repo_id=repo_id,\n repo_type=repo_type,\n branch=branch,\n revision=huggingface_hub.list_repo_commits(repo_id=repo_id, repo_type=repo_type, token=token)[-1].commit_id,\n token=token,\n exist_ok=False)\n</code></pre>\n<p>However, when I want to delete some of the branches with the following code:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">api.delete_files(repo_id=repo_id, revision=branch, delete_patterns='*')\napi.super_squash_history(repo_id=repo_id, branch=branch)\napi.delete_branch(repo_id=repo_id, branch=branch)\n</code></pre>\n<p>The branch and files get successfully deleted, and I’m sure that those files aren’t referenced from any other branch, but the LFS storage won’t always release. I’ve observed that there are sometimes delayed releases, but most times it just won’t be released at all.</p>", "post_number": 5, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-22T01:26:29.543Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 5, "reads": 10, "readers_count": 9, "score": 42, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "larryvrh", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87914, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 9207, "username": "Wauplin", "name": "Lucain Pouget", "avatar_template": "/user_avatar/discuss.huggingface.co/wauplin/{size}/40815_2.png" }, "action_code": null, "via_email": null }, { "id": 210701, "name": "Lucain Pouget", "username": "Wauplin", "avatar_template": "/user_avatar/discuss.huggingface.co/wauplin/{size}/40815_2.png", "created_at": "2025-03-22T08:23:40.317Z", "cooked": "<p>Ok so if I understand it correctly, what you try to achieve is to delete the actual files that are stored on S3 but it does not do it when you delete all the commits with a pointer to the said files, am I right? Untracked LFS files are indeed garbage collected from time to time but not instant and not guaranteed. Can you tell us more why this is a problem on your side and how did you come to realize that some files are garbage collected and others not? I’d like to better understand your needs in order to help you in the good direction.</p>", "post_number": 6, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-22T08:23:40.317Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 10, "readers_count": 9, "score": 22, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "Lucain Pouget", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 9207, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210770, "name": "larryvrh", "username": "larryvrh", "avatar_template": "/user_avatar/discuss.huggingface.co/larryvrh/{size}/43749_2.png", "created_at": "2025-03-22T15:44:38.269Z", "cooked": "<p>Yes, this issue centers on S3 storage management. I can monitor which files are being garbage collected by checking the ‘Storage Usage’ section in each repository’s settings page. The problem arises because private storage is now a paid service. While I’m comfortable with paying, I frequently upload and delete temporary checkpoints to Hugging Face, causing my storage usage to increase indefinitely since I lack an effective method to clean up the accumulated storage.</p>", "post_number": 7, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-22T15:45:38.967Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 1, "reads": 10, "readers_count": 9, "score": 22, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "larryvrh", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87914, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/7", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 9207, "username": "Wauplin", "name": "Lucain Pouget", "avatar_template": "/user_avatar/discuss.huggingface.co/wauplin/{size}/40815_2.png" }, "action_code": null, "via_email": null }, { "id": 211056, "name": "Lucain Pouget", "username": "Wauplin", "avatar_template": "/user_avatar/discuss.huggingface.co/wauplin/{size}/40815_2.png", "created_at": "2025-03-24T09:38:08.051Z", "cooked": "<p>Right, I haven’t spot this issue indeed. I’ll ask around internally what can be done in this case. Note that repositories on the Hub are meant to version data and keep the history. And <code>super_squash_commit</code> meant to be a power-user method to reduce the number of commits but not thought it term of “deleting previously uploaded data”. If you do not need versioning (i.e. if you do not need past checkpoints to be stored) I can advice to store checkpoints in a temporary repository and then delete it once the “final checkpoints” are ready. Instead of the</p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">api.delete_files(repo_id=repo_id, revision=branch, delete_patterns='*')\napi.super_squash_history(repo_id=repo_id, branch=branch)\napi.delete_branch(repo_id=repo_id, branch=branch)\n</code></pre>\n<p>you could even do something like</p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">api.delete_repo(repo_id=repo_id)\napi.create_repo(repo_id=repo_id)\napi.upload_file(...)\n</code></pre>\n<p>Of course this would come with some drawbacks (total history is lost, community tab is lost, link to collections is lost etc.) but depending on your use case and workflow it can be a good workaround.</p>", "post_number": 8, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-24T09:38:08.051Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 10, "readers_count": 9, "score": 47, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "Lucain Pouget", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/storage-usage-never-update/166182/4", "internal": true, "reflection": true, "title": "Storage Usage never update?", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 9207, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/8", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211316, "name": "Lucain Pouget", "username": "Wauplin", "avatar_template": "/user_avatar/discuss.huggingface.co/wauplin/{size}/40815_2.png", "created_at": "2025-03-25T10:10:30.023Z", "cooked": "<p>To complete on my answer above, here is some documentation about how to free-up space: <a href=\"https://huggingface.co/docs/hub/storage-limits#how-can-i-free-up-storage-space-in-my-accountorganization\" class=\"inline-onebox\">Storage limits</a>. There is a UI in the repo settings to manually delete some LFS files.</p>\n<p>We will also add support for this method in the Python client in the near future.</p>", "post_number": 9, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-25T10:10:30.023Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 16.4, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "Lucain Pouget", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/hub/storage-limits#how-can-i-free-up-storage-space-in-my-accountorganization", "internal": false, "reflection": false, "title": "Storage limits", "clicks": 3 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 9207, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/9", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211332, "name": "Lucain Pouget", "username": "Wauplin", "avatar_template": "/user_avatar/discuss.huggingface.co/wauplin/{size}/40815_2.png", "created_at": "2025-03-25T12:08:01.331Z", "cooked": "<p>PR: <a href=\"https://github.com/huggingface/huggingface_hub/pull/2954\" class=\"inline-onebox\">Support permanently deleting LFS files by Wauplin · Pull Request #2954 · huggingface/huggingface_hub · GitHub</a>. Expect it to land in next huggingface_hub release.</p>", "post_number": 10, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-25T12:08:01.331Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 7, "readers_count": 6, "score": 41.4, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "Lucain Pouget", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/huggingface_hub/pull/2954", "internal": false, "reflection": false, "title": "Support permanently deleting LFS files by Wauplin · Pull Request #2954 · huggingface/huggingface_hub · GitHub", "clicks": 5 }, { "url": "https://discuss.huggingface.co/t/all-lfs-files-deleted-but-still-storage-limit-reached/168047/5", "internal": true, "reflection": true, "title": "All lfs files deleted, but still storage limit reached", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 9207, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/10", "reactions": [ { "id": "confetti_ball", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211446, "name": "larryvrh", "username": "larryvrh", "avatar_template": "/user_avatar/discuss.huggingface.co/larryvrh/{size}/43749_2.png", "created_at": "2025-03-25T22:27:02.507Z", "cooked": "<p>Got it, thanks a lot for helping! <img src=\"https://emoji.discourse-cdn.com/apple/+1.png?v=14\" title=\":+1:\" class=\"emoji\" alt=\":+1:\" loading=\"lazy\" width=\"20\" height=\"20\"> <img src=\"https://emoji.discourse-cdn.com/apple/blush.png?v=14\" title=\":blush:\" class=\"emoji\" alt=\":blush:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 11, "post_type": 1, "posts_count": 12, "updated_at": "2025-03-25T22:27:02.507Z", "reply_count": 0, "reply_to_post_number": 10, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 16.2, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "larryvrh", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87914, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/11", "reactions": [ { "id": "confetti_ball", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 9207, "username": "Wauplin", "name": "Lucain Pouget", "avatar_template": "/user_avatar/discuss.huggingface.co/wauplin/{size}/40815_2.png" }, "action_code": null, "via_email": null }, { "id": 211544, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-26T10:27:29.200Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 12, "post_type": 3, "posts_count": 12, "updated_at": "2025-03-26T10:27:29.200Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 4, "readers_count": 3, "score": 10.8, "yours": false, "topic_id": 146721, "topic_slug": "will-lfs-related-functionality-come-to-hf-api", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/will-lfs-related-functionality-come-to-hf-api/146721/12", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Currently we can only access the LFS list/delete functionality through the web interface, which is very inconvenient to manage in cases where I need to upload and delete frequently.<br> Are there any plans to add these LFS management capabilities to the Hugging Face Python API (hf_api)? This would be extremely helpful for users who need to programmatically manage large file storage.</p>
<p>PR: <a href="https://github.com/huggingface/huggingface_hub/pull/2954" class="inline-onebox">Support permanently deleting LFS files by Wauplin · Pull Request #2954 · huggingface/huggingface_hub · GitHub</a>. Expect it to land in next huggingface_hub release.</p>
Unexpected behavior of load_best_model_at_end in Trainer (or am I doing it wrong?)
https://discuss.huggingface.co/t/unexpected-behavior-of-load-best-model-at-end-in-trainer-or-am-i-doing-it-wrong/147341
147,341
9
2025-03-25T12:50:21.837000Z
[ { "id": 211340, "name": "Fabian", "username": "fabikru", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/f/e0b2c6/{size}.png", "created_at": "2025-03-25T12:50:21.907Z", "cooked": "<p>For me the trainer doesn’t load the best model in the end but the latest instead. I set <code>load_best_model_at_end=True</code> and also tried specifiying <code>metric_for_best_model=\"eval_loss\"</code> and <code>greater_is_better=False</code>. Anybody experiencing the same? I assume it’s the newest instead of the the best model by running <code>trainer.evaluate()</code> after training and seeing that it’s not the lowest eval_loss. I am using the newest transformers version. Thank you for your help!</p>\n<p>This is my code:</p>\n<pre><code class=\"lang-auto\"> trainer = Trainer(model=model,\n args=training_args,\n data_collator=data_collator,\n train_dataset=tokenized_dataset[\"train\"],\n eval_dataset=tokenized_dataset[\"test\"],\n compute_metrics=compute_metrics,\n callbacks=[early_stopping_callback, csv_logger_callback],\n preprocess_logits_for_metrics=preprocess_logits_for_metrics)\n\n trainer.train()\n eval_results = trainer.evaluate()\n logging.info(\"Final evaluation results on validation set are:\\n\" + json.dumps(eval_results, indent=2))\n</code></pre>\n<p>And this is my training_args:</p>\n<p>training_arguments:<br>\nload_best_model_at_end: True<br>\nmetric_for_best_model: “eval_loss”<br>\ngreater_is_better: False<br>\nmax_steps: 100000<br>\nper_device_train_batch_size: 2048<br>\nper_device_eval_batch_size: 2048<br>\noptim: “schedule_free_adamw”<br>\nlr_scheduler_type: “constant”<br>\nlearning_rate: 0.001<br>\nweight_decay: 0.00001<br>\nfp16: True<br>\neval_strategy: “steps”<br>\nsave_strategy: “steps”<br>\neval_steps: 500<br>\nsave_steps: 500<br>\ndataloader_num_workers: 32<br>\ndataloader_pin_memory: True<br>\nwarmup_steps: 1000<br>\ntf32: True<br>\ntorch_compile: True<br>\ntorch_compile_backend: “inductor’”<br>\neval_on_start: True<br>\neval_accumulation_steps: 8<br>\nsave_total_limit: 2<br>\ngradient_accumulation_steps: 1</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-25T12:50:21.907Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 49, "reads": 5, "readers_count": 4, "score": 251, "yours": false, "topic_id": 147341, "topic_slug": "unexpected-behavior-of-load-best-model-at-end-in-trainer-or-am-i-doing-it-wrong", "display_username": "Fabian", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88390, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unexpected-behavior-of-load-best-model-at-end-in-trainer-or-am-i-doing-it-wrong/147341/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211375, "name": "Fabian", "username": "fabikru", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/f/e0b2c6/{size}.png", "created_at": "2025-03-25T14:04:46.441Z", "cooked": "<p>Never mind, the issue was simply that I didn’t employ a deterministic evaluation loop (because of random masking). Consequently, it selects the best model, but I don’t necessarily obtain the lowest loss when calling trainer.evaluate().</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-25T14:04:46.441Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 4, "readers_count": 3, "score": 20.8, "yours": false, "topic_id": 147341, "topic_slug": "unexpected-behavior-of-load-best-model-at-end-in-trainer-or-am-i-doing-it-wrong", "display_username": "Fabian", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88390, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unexpected-behavior-of-load-best-model-at-end-in-trainer-or-am-i-doing-it-wrong/147341/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211460, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-26T02:05:09.561Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-26T02:05:09.561Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 147341, "topic_slug": "unexpected-behavior-of-load-best-model-at-end-in-trainer-or-am-i-doing-it-wrong", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unexpected-behavior-of-load-best-model-at-end-in-trainer-or-am-i-doing-it-wrong/147341/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>For me the trainer doesn’t load the best model in the end but the latest instead. I set <code>load_best_model_at_end=True</code> and also tried specifiying <code>metric_for_best_model="eval_loss"</code> and <code>greater_is_better=False</code>. Anybody experiencing the same? I assume it’s the newest instead of the the best model by running <code>trainer.evaluate()</code> after training and seeing that it’s not the lowest eval_loss. I am using the newest transformers version. Thank you for your help!</p> <p>This is my code:</p> <pre><code class="lang-auto"> trainer = Trainer(model=model, args=training_args, data_collator=data_collator, train_dataset=tokenized_dataset["train"], eval_dataset=tokenized_dataset["test"], compute_metrics=compute_metrics, callbacks=[early_stopping_callback, csv_logger_callback], preprocess_logits_for_metrics=preprocess_logits_for_metrics) trainer.train() eval_results = trainer.evaluate() logging.info("Final evaluation results on validation set are:\n" + json.dumps(eval_results, indent=2)) </code></pre> <p>And this is my training_args:</p> <p>training_arguments:<br> load_best_model_at_end: True<br> metric_for_best_model: “eval_loss”<br> greater_is_better: False<br> max_steps: 100000<br> per_device_train_batch_size: 2048<br> per_device_eval_batch_size: 2048<br> optim: “schedule_free_adamw”<br> lr_scheduler_type: “constant”<br> learning_rate: 0.001<br> weight_decay: 0.00001<br> fp16: True<br> eval_strategy: “steps”<br> save_strategy: “steps”<br> eval_steps: 500<br> save_steps: 500<br> dataloader_num_workers: 32<br> dataloader_pin_memory: True<br> warmup_steps: 1000<br> tf32: True<br> torch_compile: True<br> torch_compile_backend: “inductor’”<br> eval_on_start: True<br> eval_accumulation_steps: 8<br> save_total_limit: 2<br> gradient_accumulation_steps: 1</p>
<p>Never mind, the issue was simply that I didn’t employ a deterministic evaluation loop (because of random masking). Consequently, it selects the best model, but I don’t necessarily obtain the lowest loss when calling trainer.evaluate().</p>
SFT Trainer and chat templates
https://discuss.huggingface.co/t/sft-trainer-and-chat-templates/147205
147,205
5
2025-03-24T15:58:14.484000Z
[ { "id": 211126, "name": "Reuben Rouse", "username": "reubenrouse", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/{size}.png", "created_at": "2025-03-24T15:58:14.541Z", "cooked": "<p>Hello I’m implementing a framework for fine-tuning various LLMs using the TRL library’s SFTTrainer. I have a question about how chat templates work:</p>\n<ol>\n<li>When using SFTTrainer with datasets in the standard formats (with “messages” array or “prompt”/“completion” fields), does the trainer automatically apply the tokenizer’s chat_template? The documentation suggests it does.</li>\n<li>For models whose tokenizers don’t have a chat_template attribute set (or it’s empty), what template does SFTTrainer apply by default? Is it using ChatML format?</li>\n<li>For maximum performance, should I always manually set the appropriate chat_template on the tokenizer before passing it to SFTTrainer?</li>\n</ol>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-24T15:58:14.541Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 814, "reads": 28, "readers_count": 27, "score": 3870.2, "yours": false, "topic_id": 147205, "topic_slug": "sft-trainer-and-chat-templates", "display_username": "Reuben Rouse", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/question-about-llama-fine-tuning-dataset-token-string/155584/2", "internal": true, "reflection": true, "title": "Question about llama fine tuning dataset token string", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/best-practice-for-usage-of-data-collator-for-completiononlylm-in-multi-turn-chat/99263/3", "internal": true, "reflection": true, "title": "Best practice for usage of Data Collator For CompletionOnlyLM in multi-turn chat", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88286, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sft-trainer-and-chat-templates/147205/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211141, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-24T17:05:03.386Z", "cooked": "<p>Just to be sure, I also asked Hugging Chat, and it seems to be okay. I think it probably works fairly well with the default settings.</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/huggingface/trl/issues/1233\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/trl/issues/1233\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/trl</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/trl/issues/1233\" target=\"_blank\" rel=\"noopener\">How does SFTTrainer handle instruction formatted datasets when a tokenizer has no chat_template?</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-01-16\" data-time=\"18:08:04\" data-timezone=\"UTC\">06:08PM - 16 Jan 24 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-01-17\" data-time=\"17:22:10\" data-timezone=\"UTC\">05:22PM - 17 Jan 24 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/JohnGiorgi\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/4/b/4b0d03eccee972f59c15c76b278ea3d9dadd2e89.jpeg\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"6C5744\">\n JohnGiorgi\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">Hi! I am interested in using the `SFTTrainer` for instruction-tuning. Following <span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">[the docs](https://huggingface.co/docs/trl/main/en/sft_trainer#dataset-format-support), I can see that I can provided examples in the following format to have the trainer format things for me:\n\n```json\n{\"prompt\": \"&lt;prompt text&gt;\", \"completion\": \"&lt;ideal generated text&gt;\"}\n{\"prompt\": \"&lt;prompt text&gt;\", \"completion\": \"&lt;ideal generated text&gt;\"}\n{\"prompt\": \"&lt;prompt text&gt;\", \"completion\": \"&lt;ideal generated text&gt;\"}\n```\n\nThe docs also say:\n\n&gt; The [SFTTrainer](https://huggingface.co/docs/trl/main/en/trainer#trl.SFTTrainer) will then format the dataset for you using the defined format from the model’s tokenizer with the [apply_chat_template](https://huggingface.co/docs/transformers/main/en/chat_templating#templates-for-chat-models) method.\n\nMy question and confusion is, what does the trainer do if the tokenizer has no `chat_template`, as is the case with the [base llama model](https://huggingface.co/meta-llama/Llama-2-13b-hf/blob/main/tokenizer_config.json)?</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://www.philschmid.de/fine-tune-google-gemma\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/a/2ae7894ddf2aa7973f586cc30315e0348ab3bfd7.png\" class=\"site-icon\" data-dominant-color=\"4D4B4E\" width=\"256\" height=\"256\">\n\n <a href=\"https://www.philschmid.de/fine-tune-google-gemma\" target=\"_blank\" rel=\"noopener\" title=\"12:00AM - 01 March 2024\">philschmid.de – 1 Mar 24</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/361;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/8/4/84066316b19b394fc6e8c6762c68cd173a801d12_2_690x394.jpeg\" class=\"thumbnail\" data-dominant-color=\"2262C7\" width=\"690\" height=\"394\"></div>\n\n<h3><a href=\"https://www.philschmid.de/fine-tune-google-gemma\" target=\"_blank\" rel=\"noopener\">How to fine-tune Google Gemma with ChatML and Hugging Face TRL</a></h3>\n\n <p>In this blog post you will learn how to fine tune Google Gemma using Hugging Face Transformers, Datasets and TRL.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<hr>\n<p>The following is from Hugging Chat.</p>\n<p>When using the SFTTrainer in the TRL library with datasets in standard formats (such as those with a “messages” array or “prompt”/“completion” fields), the trainer does automatically apply the tokenizer’s chat_template, according to the documentation [1][3][4].</p>\n<p>This behavior is facilitated by the <code>apply_chat_template</code> method of the tokenizer, which is used to format the dataset into a structure suitable for training chat models. The setup is often handled using the <code>setup_chat_format</code> function from TRL, which configures the model and tokenizer with the necessary special tokens and formatting for conversational tasks [2][4].</p>\n<p>If your dataset is in one of the supported standard formats, you can pass it directly to the SFTTrainer without pre-processing, and the trainer will handle the formatting for you [1][4].</p>\n<p>When using the <code>SFTTrainer</code> and the tokenizer does not have a <code>chat_template</code> attribute set (or it is empty), the trainer does not automatically fall back to a default template like ChatML. Instead, the behavior depends on how the tokenizer is configured and whether you explicitly define a chat template for the model.</p>\n<p>If the tokenizer does not have a <code>chat_template</code> attribute, the <code>apply_chat_template</code> method will either raise an error or fail to format the input, as it relies on the template being defined to structure the conversations appropriately [2]. This is because different models may use different chat formats during pre-training, and the chat template must match the model’s expected input format for optimal performance [2].</p>\n<p>If you want to use a specific template (e.g., ChatML), you should explicitly set it as the <code>chat_template</code> in the tokenizer before using <code>SFTTrainer</code>. For example, you can define a ChatML template as follows:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">tokenizer.chat_template = \"{% for message in messages %}{{'&lt;|im_start|&gt;' + message['role'] + '\\n' + message['content'] + '&lt;|im_end|&gt;' + '\\n'}}{% endfor %}{% if add_generation_prompt %}{{ '&lt;|im_start|&gt;assistant\\n' }}{% endif %}\"\n</code></pre>\n<p>Once the <code>chat_template</code> is set, the <code>SFTTrainer</code> will use it to format the input data [2].</p>\n<p>In summary:</p>\n<ul>\n<li>If a <code>chat_template</code> is not set, the <code>SFTTrainer</code> will not automatically use a default template like ChatML.</li>\n<li>You must explicitly define and set the <code>chat_template</code> for the tokenizer if one is not already provided.</li>\n<li>If no template is defined, the <code>apply_chat_template</code> method will fail, as it requires a template to format the conversation data [2][1].</li>\n</ul>\n<p>If you are training a model from scratch or fine-tuning it for chat, you have the flexibility to choose a template (e.g., ChatML) and configure it accordingly [2].</p>\n<p>For maximum performance when using the SFTTrainer in the TRL library, it is highly recommended to manually set the appropriate <code>chat_template</code> on the tokenizer before initiating the training process. Here’s a structured overview of the reasoning and steps involved:</p>\n<h3><a name=\"p-211141-why-manually-set-the-chat_template-1\" class=\"anchor\" href=\"#p-211141-why-manually-set-the-chat_template-1\"></a>Why Manually Set the <code>chat_template</code>?</h3>\n<ol>\n<li>\n<p><strong>Consistency with Model Expectations</strong>: Different models are pre-trained on specific chat formats. Setting the correct <code>chat_template</code> ensures that the input data aligns with the model’s expected format, enhancing training effectiveness.</p>\n</li>\n<li>\n<p><strong>Special Tokens Handling</strong>: Many chat templates, such as ChatML, include special tokens (e.g., <code>&lt;|im_start|&gt;</code>). Ensuring these tokens are correctly formatted helps the model recognize and process them during training.</p>\n</li>\n<li>\n<p><strong>Avoiding Default Limitations</strong>: Relying on default settings can lead to suboptimal results if the tokenizer’s default template does not match your specific use case or model requirements.</p>\n</li>\n</ol>\n<h3><a name=\"p-211141-steps-to-manually-set-the-chat_template-2\" class=\"anchor\" href=\"#p-211141-steps-to-manually-set-the-chat_template-2\"></a>Steps to Manually Set the <code>chat_template</code></h3>\n<ol>\n<li>\n<p><strong>Choose the Right Template</strong>: Decide on the chat template format that best suits your model and task. Common formats include ChatML and Alpaca.</p>\n</li>\n<li>\n<p><strong>Define the Template</strong>: Create a Jinja template string that structures conversations. For instance, a ChatML template might look like:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">chat_template = \"{% for message in messages %}{{'&lt;|im_start|&gt;' + message['role'] + '\\n' + message['content'] + '&lt;|im_end|&gt;' + '\\n'}}{% endfor %}{% if add_generation_prompt %}{{ '&lt;|im_start|&gt;assistant\\n' }}{% endif %}\"\n</code></pre>\n</li>\n<li>\n<p><strong>Apply the Template</strong>: Use the <code>setup_chat_format</code> function from the TRL library to apply the template to both the model and tokenizer.</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">from trl import setup_chat_format\nmodel, tokenizer = setup_chat_format(model, tokenizer, chat_template=chat_template)\n</code></pre>\n</li>\n<li>\n<p><strong>Initialize SFTTrainer</strong>: Pass the configured tokenizer and model to the SFTTrainer, ensuring the data collator and other parameters are set correctly.</p>\n</li>\n</ol>\n<h3><a name=\"p-211141-conclusion-3\" class=\"anchor\" href=\"#p-211141-conclusion-3\"></a>Conclusion</h3>\n<p>Manually setting the <code>chat_template</code> is a crucial step for aligning the input data with the model’s expectations, especially for optimal performance in fine-tuning tasks. By defining the template explicitly, you ensure that the data is formatted correctly, include necessary special tokens, and thus maximize the effectiveness of the training process.</p>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-24T17:05:03.386Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 38, "reads": 27, "readers_count": 26, "score": 185, "yours": false, "topic_id": 147205, "topic_slug": "sft-trainer-and-chat-templates", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/trl/issues/1233", "internal": false, "reflection": false, "title": "How does SFTTrainer handle instruction formatted datasets when a tokenizer has no chat_template? · Issue #1233 · huggingface/trl · GitHub", "clicks": 35 }, { "url": "https://www.philschmid.de/fine-tune-google-gemma", "internal": false, "reflection": false, "title": "How to fine-tune Google Gemma with ChatML and Hugging Face TRL", "clicks": 29 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sft-trainer-and-chat-templates/147205/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211369, "name": "Reuben Rouse", "username": "reubenrouse", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/{size}.png", "created_at": "2025-03-25T13:50:43.673Z", "cooked": "<p>Thanks a lot man, this is really helpful !</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-25T13:50:43.673Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 1, "reads": 20, "readers_count": 19, "score": 23.6, "yours": false, "topic_id": 147205, "topic_slug": "sft-trainer-and-chat-templates", "display_username": "Reuben Rouse", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88286, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sft-trainer-and-chat-templates/147205/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 211456, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-26T01:51:08.490Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-03-26T01:51:08.490Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 16, "readers_count": 15, "score": 18, "yours": false, "topic_id": 147205, "topic_slug": "sft-trainer-and-chat-templates", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sft-trainer-and-chat-templates/147205/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello I’m implementing a framework for fine-tuning various LLMs using the TRL library’s SFTTrainer. I have a question about how chat templates work:</p> <ol> <li>When using SFTTrainer with datasets in the standard formats (with “messages” array or “prompt”/“completion” fields), does the trainer automatically apply the tokenizer’s chat_template? The documentation suggests it does.</li> <li>For models whose tokenizers don’t have a chat_template attribute set (or it’s empty), what template does SFTTrainer apply by default? Is it using ChatML format?</li> <li>For maximum performance, should I always manually set the appropriate chat_template on the tokenizer before passing it to SFTTrainer?</li> </ol>
<p>Just to be sure, I also asked Hugging Chat, and it seems to be okay. I think it probably works fairly well with the default settings.</p><aside class="onebox githubissue" data-onebox-src="https://github.com/huggingface/trl/issues/1233"> <header class="source"> <a href="https://github.com/huggingface/trl/issues/1233" target="_blank" rel="noopener">github.com/huggingface/trl</a> </header> <article class="onebox-body"> <div class="github-row"> <div class="github-icon-container" title="Issue" data-github-private-repo="false"> <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg> </div> <div class="github-info-container"> <h4> <a href="https://github.com/huggingface/trl/issues/1233" target="_blank" rel="noopener">How does SFTTrainer handle instruction formatted datasets when a tokenizer has no chat_template?</a> </h4> <div class="github-info"> <div class="date"> opened <span class="discourse-local-date" data-format="ll" data-date="2024-01-16" data-time="18:08:04" data-timezone="UTC">06:08PM - 16 Jan 24 UTC</span> </div> <div class="date"> closed <span class="discourse-local-date" data-format="ll" data-date="2024-01-17" data-time="17:22:10" data-timezone="UTC">05:22PM - 17 Jan 24 UTC</span> </div> <div class="user"> <a href="https://github.com/JohnGiorgi" target="_blank" rel="noopener"> <img alt="" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/4/b/4b0d03eccee972f59c15c76b278ea3d9dadd2e89.jpeg" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="6C5744"> JohnGiorgi </a> </div> </div> <div class="labels"> </div> </div> </div> <div class="github-row"> <p class="github-body-container">Hi! I am interested in using the `SFTTrainer` for instruction-tuning. Following <span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">[the docs](https://huggingface.co/docs/trl/main/en/sft_trainer#dataset-format-support), I can see that I can provided examples in the following format to have the trainer format things for me: ```json {"prompt": "&lt;prompt text&gt;", "completion": "&lt;ideal generated text&gt;"} {"prompt": "&lt;prompt text&gt;", "completion": "&lt;ideal generated text&gt;"} {"prompt": "&lt;prompt text&gt;", "completion": "&lt;ideal generated text&gt;"} ``` The docs also say: &gt; The [SFTTrainer](https://huggingface.co/docs/trl/main/en/trainer#trl.SFTTrainer) will then format the dataset for you using the defined format from the model’s tokenizer with the [apply_chat_template](https://huggingface.co/docs/transformers/main/en/chat_templating#templates-for-chat-models) method. My question and confusion is, what does the trainer do if the tokenizer has no `chat_template`, as is the case with the [base llama model](https://huggingface.co/meta-llama/Llama-2-13b-hf/blob/main/tokenizer_config.json)?</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://www.philschmid.de/fine-tune-google-gemma"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/2/a/2ae7894ddf2aa7973f586cc30315e0348ab3bfd7.png" class="site-icon" data-dominant-color="4D4B4E" width="256" height="256"> <a href="https://www.philschmid.de/fine-tune-google-gemma" target="_blank" rel="noopener" title="12:00AM - 01 March 2024">philschmid.de – 1 Mar 24</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/361;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/8/4/84066316b19b394fc6e8c6762c68cd173a801d12_2_690x394.jpeg" class="thumbnail" data-dominant-color="2262C7" width="690" height="394"></div> <h3><a href="https://www.philschmid.de/fine-tune-google-gemma" target="_blank" rel="noopener">How to fine-tune Google Gemma with ChatML and Hugging Face TRL</a></h3> <p>In this blog post you will learn how to fine tune Google Gemma using Hugging Face Transformers, Datasets and TRL.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <hr> <p>The following is from Hugging Chat.</p> <p>When using the SFTTrainer in the TRL library with datasets in standard formats (such as those with a “messages” array or “prompt”/“completion” fields), the trainer does automatically apply the tokenizer’s chat_template, according to the documentation [1][3][4].</p> <p>This behavior is facilitated by the <code>apply_chat_template</code> method of the tokenizer, which is used to format the dataset into a structure suitable for training chat models. The setup is often handled using the <code>setup_chat_format</code> function from TRL, which configures the model and tokenizer with the necessary special tokens and formatting for conversational tasks [2][4].</p> <p>If your dataset is in one of the supported standard formats, you can pass it directly to the SFTTrainer without pre-processing, and the trainer will handle the formatting for you [1][4].</p> <p>When using the <code>SFTTrainer</code> and the tokenizer does not have a <code>chat_template</code> attribute set (or it is empty), the trainer does not automatically fall back to a default template like ChatML. Instead, the behavior depends on how the tokenizer is configured and whether you explicitly define a chat template for the model.</p> <p>If the tokenizer does not have a <code>chat_template</code> attribute, the <code>apply_chat_template</code> method will either raise an error or fail to format the input, as it relies on the template being defined to structure the conversations appropriately [2]. This is because different models may use different chat formats during pre-training, and the chat template must match the model’s expected input format for optimal performance [2].</p> <p>If you want to use a specific template (e.g., ChatML), you should explicitly set it as the <code>chat_template</code> in the tokenizer before using <code>SFTTrainer</code>. For example, you can define a ChatML template as follows:</p> <pre data-code-wrap="python"><code class="lang-python">tokenizer.chat_template = "{% for message in messages %}{{'&lt;|im_start|&gt;' + message['role'] + '\n' + message['content'] + '&lt;|im_end|&gt;' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '&lt;|im_start|&gt;assistant\n' }}{% endif %}" </code></pre> <p>Once the <code>chat_template</code> is set, the <code>SFTTrainer</code> will use it to format the input data [2].</p> <p>In summary:</p> <ul> <li>If a <code>chat_template</code> is not set, the <code>SFTTrainer</code> will not automatically use a default template like ChatML.</li> <li>You must explicitly define and set the <code>chat_template</code> for the tokenizer if one is not already provided.</li> <li>If no template is defined, the <code>apply_chat_template</code> method will fail, as it requires a template to format the conversation data [2][1].</li> </ul> <p>If you are training a model from scratch or fine-tuning it for chat, you have the flexibility to choose a template (e.g., ChatML) and configure it accordingly [2].</p> <p>For maximum performance when using the SFTTrainer in the TRL library, it is highly recommended to manually set the appropriate <code>chat_template</code> on the tokenizer before initiating the training process. Here’s a structured overview of the reasoning and steps involved:</p> <h3><a name="p-211141-why-manually-set-the-chat_template-1" class="anchor" href="#p-211141-why-manually-set-the-chat_template-1"></a>Why Manually Set the <code>chat_template</code>?</h3> <ol> <li> <p><strong>Consistency with Model Expectations</strong>: Different models are pre-trained on specific chat formats. Setting the correct <code>chat_template</code> ensures that the input data aligns with the model’s expected format, enhancing training effectiveness.</p> </li> <li> <p><strong>Special Tokens Handling</strong>: Many chat templates, such as ChatML, include special tokens (e.g., <code>&lt;|im_start|&gt;</code>). Ensuring these tokens are correctly formatted helps the model recognize and process them during training.</p> </li> <li> <p><strong>Avoiding Default Limitations</strong>: Relying on default settings can lead to suboptimal results if the tokenizer’s default template does not match your specific use case or model requirements.</p> </li> </ol> <h3><a name="p-211141-steps-to-manually-set-the-chat_template-2" class="anchor" href="#p-211141-steps-to-manually-set-the-chat_template-2"></a>Steps to Manually Set the <code>chat_template</code></h3> <ol> <li> <p><strong>Choose the Right Template</strong>: Decide on the chat template format that best suits your model and task. Common formats include ChatML and Alpaca.</p> </li> <li> <p><strong>Define the Template</strong>: Create a Jinja template string that structures conversations. For instance, a ChatML template might look like:</p> <pre data-code-wrap="python"><code class="lang-python">chat_template = "{% for message in messages %}{{'&lt;|im_start|&gt;' + message['role'] + '\n' + message['content'] + '&lt;|im_end|&gt;' + '\n'}}{% endfor %}{% if add_generation_prompt %}{{ '&lt;|im_start|&gt;assistant\n' }}{% endif %}" </code></pre> </li> <li> <p><strong>Apply the Template</strong>: Use the <code>setup_chat_format</code> function from the TRL library to apply the template to both the model and tokenizer.</p> <pre data-code-wrap="python"><code class="lang-python">from trl import setup_chat_format model, tokenizer = setup_chat_format(model, tokenizer, chat_template=chat_template) </code></pre> </li> <li> <p><strong>Initialize SFTTrainer</strong>: Pass the configured tokenizer and model to the SFTTrainer, ensuring the data collator and other parameters are set correctly.</p> </li> </ol> <h3><a name="p-211141-conclusion-3" class="anchor" href="#p-211141-conclusion-3"></a>Conclusion</h3> <p>Manually setting the <code>chat_template</code> is a crucial step for aligning the input data with the model’s expectations, especially for optimal performance in fine-tuning tasks. By defining the template explicitly, you ensure that the data is formatted correctly, include necessary special tokens, and thus maximize the effectiveness of the training process.</p>
Multimodal training
https://discuss.huggingface.co/t/multimodal-training/146698
146,698
9
2025-03-20T20:40:55.288000Z
[ { "id": 210395, "name": "alper Celik ", "username": "celalp", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/8edcca/{size}.png", "created_at": "2025-03-20T20:40:55.343Z", "cooked": "<p>Hi,</p>\n<p>I have a dataset that consists of images, their captions (they are scientific figures) and some excerpts from the paper main text that references the figure. The goal of this is to for a given figure and its caption, can we understand the figure (the text in the paper). This is different from an image captioning problem but more of a reasoning problem.</p>\n<p>I would appreciate any pointers on how to train on image-text pairs as input and text as output. In this instance the figure captions are quite important because many figures look alike even within a paper and the figure caption is important to differentiate between them.</p>\n<p>Thanks for all the suggestions in advance.</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-20T20:41:19.231Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 28, "reads": 9, "readers_count": 8, "score": 161.8, "yours": false, "topic_id": 146698, "topic_slug": "multimodal-training", "display_username": "alper Celik ", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/cost-of-tax-receipt-recognition-ocr-vs-llm/146835/2", "internal": true, "reflection": true, "title": "Cost of Tax receipt recognition OCR vs. LLM", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/any-model-that-takes-in-a-clean-pdf-and-outputs-a-json-of-all-the-fillable-fields-that-should-be-added-to-it-coordinates/147198/2", "internal": true, "reflection": true, "title": "Any model that takes in a clean PDF and outputs a JSON of all the fillable fields that should be added to it + coordinates?", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 46560, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/multimodal-training/146698/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210488, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-21T07:20:52.073Z", "cooked": "<p>In your case, I think you would want to combine VLM and LLM to perform VQA-like tasks. You could train each lightweight model separately and then combine them, or some high-performance VLMs already have quite LLM-like capabilities.</p>\n<p>However, I think a model like LLaVA, which is a combination of VLM and LLM, would be more suitable.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/mikelabs/llava-o1-let-vision-language-models-reason\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/mikelabs/llava-o1-let-vision-language-models-reason\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/b/5b57284142f6d7223b0b56dedcc3755f102324c9_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F3F2F2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/blog/mikelabs/llava-o1-let-vision-language-models-reason\" target=\"_blank\" rel=\"noopener\">LLaVA-o1: Let Vision Language Models Reason Step-by-Step</a></h3>\n\n <p>A Blog post by Mike Young on Hugging Face</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/manu/colpali\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/manu/colpali\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/b/2/b22a572c75a28c5597d39e7c498c0e257d9f5c9a_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F1F1F0\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/blog/manu/colpali\" target=\"_blank\" rel=\"noopener\">ColPali: Efficient Document Retrieval with Vision Language Models 👀</a></h3>\n\n <p>A Blog post by Manuel Faysse on Hugging Face</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-210488-vlms-1\" class=\"anchor\" href=\"#p-210488-vlms-1\"></a>VLMs</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/CohereForAI/aya-vision-8b\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/CohereForAI/aya-vision-8b\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/8/3/8365321eeb1e6cb7a95c2b2ff153e3ac60089130_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5B70A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/CohereForAI/aya-vision-8b\" target=\"_blank\" rel=\"noopener\">CohereForAI/aya-vision-8b · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/5/a50ae69cb5c99b29e45086ea5d294c85d3c7748d_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5B70A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct\" target=\"_blank\" rel=\"noopener\">Qwen/Qwen2.5-VL-7B-Instruct · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://mistral.ai/news/pixtral-12b\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/4/041bb3808a600401e66c7570e4306ea62abf4b16.png\" class=\"site-icon\" data-dominant-color=\"E65D2E\" width=\"48\" height=\"48\">\n\n <a href=\"https://mistral.ai/news/pixtral-12b\" target=\"_blank\" rel=\"noopener\">mistral.ai</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/362;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/9/299bf7c349cb72ac8f1da8ca7bb18dd47a0e0f8c_2_690x362.png\" class=\"thumbnail\" data-dominant-color=\"F7C073\" width=\"690\" height=\"362\"></div>\n\n<h3><a href=\"https://mistral.ai/news/pixtral-12b\" target=\"_blank\" rel=\"noopener\">Announcing Pixtral 12B | Mistral AI</a></h3>\n\n <p>Pixtral 12B - the first-ever multimodal Mistral model. Apache 2.0.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-210488-other-approaches-by-hugging-chathttpshuggingfacecochat-2\" class=\"anchor\" href=\"#p-210488-other-approaches-by-hugging-chathttpshuggingfacecochat-2\"></a>Other approaches by <a href=\"https://huggingface.co/chat/\">Hugging Chat</a></h3>\n<hr>\n<p>Based on the sources provided, here are effective approaches and models for training on image-text pairs to understand scientific figures and generate reasoned text outputs:</p>\n<hr>\n<h3><a name=\"p-210488-h-1-contrastive-learning-with-captioning-models-3\" class=\"anchor\" href=\"#p-210488-h-1-contrastive-learning-with-captioning-models-3\"></a>1. <strong>Contrastive Learning with Captioning Models</strong></h3>\n<ul>\n<li>\n<p><strong>Model</strong>: CoCa (Contrastive Captioner) [1]</p>\n<ul>\n<li>CoCa is a foundation model that leverages both contrastive and captioning losses. It aligns images and text by learning similar representations for related image-text pairs and generates descriptive captions.</li>\n<li><strong>Key Features</strong>:\n<ul>\n<li>Simultaneous learning of cross-modal alignment and caption generation.</li>\n<li>Effective for nuanced understanding of visual-text relationships.</li>\n</ul>\n</li>\n<li><strong>Use Case</strong>: Ideal for your dataset, as it can handle image-text pairs and generate context-aware captions.</li>\n</ul>\n</li>\n<li>\n<p><strong>Model</strong>: Mistral 7B [3]</p>\n<ul>\n<li>A large language model fine-tuned for image captioning tasks. It focuses on generating human-like captions by understanding complex scenes.</li>\n<li><strong>Key Features</strong>:\n<ul>\n<li>Sophisticated scene understanding and natural language description.</li>\n<li>Can be adapted for scientific figures by training on your dataset.</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<hr>\n<h3><a name=\"p-210488-h-2-explicit-image-caption-reasoning-ecr-4\" class=\"anchor\" href=\"#p-210488-h-2-explicit-image-caption-reasoning-ecr-4\"></a>2. <strong>Explicit Image Caption Reasoning (ECR)</strong></h3>\n<ul>\n<li><strong>Model</strong>: ECRMM (Explicit Caption Reasoning Multimodal Model) [4]\n<ul>\n<li>ECR employs inference chaining to analyze images deeply and generate detailed captions. It is particularly effective for complex scenes and fine-grained information.</li>\n<li><strong>Key Features</strong>:\n<ul>\n<li>Focuses on reasoning and semantic parsing for accurate and detailed descriptions.</li>\n<li>Fine-tuned on datasets like ICICD, which includes images, captions, and textual context.</li>\n</ul>\n</li>\n<li><strong>Use Case</strong>: Suitable for your dataset, as it emphasizes understanding the relationships between images, captions, and textual context.</li>\n</ul>\n</li>\n</ul>\n<hr>\n<h3><a name=\"p-210488-h-3-contrastive-learning-and-multi-modal-training-5\" class=\"anchor\" href=\"#p-210488-h-3-contrastive-learning-and-multi-modal-training-5\"></a>3. <strong>Contrastive Learning and Multi-Modal Training</strong></h3>\n<ul>\n<li>\n<p><strong>Approach</strong>: Contrastive learning [2][4]</p>\n<ul>\n<li>Train a model to align images and text by encouraging similar representations for related pairs. This is particularly useful when figure captions are critical for differentiation.</li>\n<li><strong>Implementation</strong>:\n<ul>\n<li>Use pre-trained models like CoCa or Mistral 7B and fine-tune them on your dataset.</li>\n<li>Incorporate the figure captions as part of the training input to guide the model toward accurate and context-aware reasoning.</li>\n</ul>\n</li>\n</ul>\n</li>\n<li>\n<p><strong>Model</strong>: Multi-Modal Transformers [2]</p>\n<ul>\n<li>Models like MAsked Pre-training (MAST) can process images and text together, improving cross-modal understanding.</li>\n<li><strong>Key Features</strong>:\n<ul>\n<li>Handles image-text pairs as input and generates text output aligned with the visual context.</li>\n<li>Effective for reasoning tasks where captions are central to understanding.</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<hr>\n<h3><a name=\"p-210488-recommendations-6\" class=\"anchor\" href=\"#p-210488-recommendations-6\"></a>Recommendations</h3>\n<ul>\n<li><strong>Start with CoCa</strong> for its strong performance in image-text alignment and caption generation.</li>\n<li>Fine-tune Mistral 7B or ECRMM on your dataset to leverage advanced scene understanding and reasoning capabilities.</li>\n<li>Use contrastive learning to align images with their captions, especially when figures are visually similar.</li>\n</ul>\n<hr>\n<h3><a name=\"p-210488-references-7\" class=\"anchor\" href=\"#p-210488-references-7\"></a>References</h3>\n<ul>\n<li>[1] Learn CoCa: Image-Text Foundation Models with Contrastive Captioners [Source]</li>\n<li>[2] Multimodal training - <img src=\"https://emoji.discourse-cdn.com/apple/hugs.png?v=14\" title=\":hugs:\" class=\"emoji\" alt=\":hugs:\" loading=\"lazy\" width=\"20\" height=\"20\">Transformers - Hugging Face Forums [Source]</li>\n<li>[3] Image Captioning with Mistral 7B LLM: A Hands-on Guide [Source]</li>\n<li>[4] Explicit Image Caption Reasoning (ECR) [Source]</li>\n</ul>", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-21T07:21:51.331Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 4, "reads": 8, "readers_count": 7, "score": 41.6, "yours": false, "topic_id": 146698, "topic_slug": "multimodal-training", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/blog/mikelabs/llava-o1-let-vision-language-models-reason", "internal": false, "reflection": false, "title": "LLaVA-o1: Let Vision Language Models Reason Step-by-Step", "clicks": 7 }, { "url": "https://huggingface.co/blog/manu/colpali", "internal": false, "reflection": false, "title": "ColPali: Efficient Document Retrieval with Vision Language Models 👀", "clicks": 3 }, { "url": "https://huggingface.co/chat/", "internal": false, "reflection": false, "title": "HuggingChat", "clicks": 2 }, { "url": "https://huggingface.co/CohereForAI/aya-vision-8b", "internal": false, "reflection": false, "title": "CohereForAI/aya-vision-8b · Hugging Face", "clicks": 1 }, { "url": "https://mistral.ai/news/pixtral-12b", "internal": false, "reflection": false, "title": "Announcing Pixtral 12B | Mistral AI", "clicks": 0 }, { "url": "https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct", "internal": false, "reflection": false, "title": "Qwen/Qwen2.5-VL-7B-Instruct · Hugging Face", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/multimodal-training/146698/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210489, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-21T07:26:04.593Z", "cooked": "<h3><a name=\"p-210489-training-tips-1\" class=\"anchor\" href=\"#p-210489-training-tips-1\"></a>Training Tips</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/learn/computer-vision-course/en/unit4/multimodal-models/tasks-models-part1\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/learn/computer-vision-course/en/unit4/multimodal-models/tasks-models-part1\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n \n\n<h3><a href=\"https://huggingface.co/learn/computer-vision-course/en/unit4/multimodal-models/tasks-models-part1\" target=\"_blank\" rel=\"noopener\">Multimodal Tasks and Models - Hugging Face Community Computer Vision Course</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/learn/cookbook/fine_tuning_vlm_trl\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/learn/cookbook/fine_tuning_vlm_trl\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/e/a/ea9cb8984ae142b418ec39bae9f1aee7ee6c224b_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F2F0EB\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/learn/cookbook/fine_tuning_vlm_trl\" target=\"_blank\" rel=\"noopener\">Fine-Tuning a Vision Language Model (Qwen2-VL-7B) with the Hugging Face...</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/document-ai\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/document-ai\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/345;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/4/04a7cced77f60180a36cec11be5c1d8ee4cc5523.png\" class=\"thumbnail\" data-dominant-color=\"D9E0CE\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://huggingface.co/blog/document-ai\" target=\"_blank\" rel=\"noopener\">Accelerating Document AI</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://docs.unsloth.ai/basics/vision-fine-tuning\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/8/a/8a4bc5d08bba83739f80e9358b25e094dd7acab2.avif\" class=\"site-icon\" data-dominant-color=\"539180\" width=\"48\" height=\"47\">\n\n <a href=\"https://docs.unsloth.ai/basics/vision-fine-tuning\" target=\"_blank\" rel=\"noopener\">docs.unsloth.ai</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/345;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/1/012603612cff90a1ee839eba66a6b66218c5b284_2_690x345.jpeg\" class=\"thumbnail\" data-dominant-color=\"EDEEEE\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://docs.unsloth.ai/basics/vision-fine-tuning\" target=\"_blank\" rel=\"noopener\">Vision Fine-tuning | Unsloth Documentation</a></h3>\n\n <p>Details on vision/multimodal fine-tuning with Unsloth</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-21T07:26:04.593Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 16, "yours": false, "topic_id": 146698, "topic_slug": "multimodal-training", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/learn/computer-vision-course/en/unit4/multimodal-models/tasks-models-part1", "internal": false, "reflection": false, "title": "Multimodal Tasks and Models - Hugging Face Community Computer Vision Course", "clicks": 4 }, { "url": "https://huggingface.co/blog/document-ai", "internal": false, "reflection": false, "title": "Accelerating Document AI", "clicks": 3 }, { "url": "https://huggingface.co/learn/cookbook/fine_tuning_vlm_trl", "internal": false, "reflection": false, "title": "Fine-Tuning a Vision Language Model (Qwen2-VL-7B) with the Hugging Face Ecosystem (TRL) - Hugging Face Open-Source AI Cookbook", "clicks": 2 }, { "url": "https://docs.unsloth.ai/basics/vision-fine-tuning", "internal": false, "reflection": false, "title": "Vision Fine-tuning | Unsloth Documentation", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/multimodal-training/146698/3", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210576, "name": "alper Celik ", "username": "celalp", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/8edcca/{size}.png", "created_at": "2025-03-21T15:21:23.992Z", "cooked": "<p>Oh wow thank <a class=\"mention\" href=\"/u/john6666\">@John6666</a> for the detailed answers. I will check the models and references out.</p>", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-21T15:21:23.992Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 146698, "topic_slug": "multimodal-training", "display_username": "alper Celik ", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 46560, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/multimodal-training/146698/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 211430, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-25T19:38:51.302Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-03-25T19:38:51.302Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 1, "readers_count": 0, "score": 15.2, "yours": false, "topic_id": 146698, "topic_slug": "multimodal-training", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/multimodal-training/146698/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi,</p> <p>I have a dataset that consists of images, their captions (they are scientific figures) and some excerpts from the paper main text that references the figure. The goal of this is to for a given figure and its caption, can we understand the figure (the text in the paper). This is different from an image captioning problem but more of a reasoning problem.</p> <p>I would appreciate any pointers on how to train on image-text pairs as input and text as output. In this instance the figure captions are quite important because many figures look alike even within a paper and the figure caption is important to differentiate between them.</p> <p>Thanks for all the suggestions in advance.</p>
<p>Oh wow thank <a class="mention" href="/u/john6666">@John6666</a> for the detailed answers. I will check the models and references out.</p>
Issue with FlaskAPI in a Private Space After Sleeping Mode
https://discuss.huggingface.co/t/issue-with-flaskapi-in-a-private-space-after-sleeping-mode/147150
147,150
5
2025-03-24T08:05:56.654000Z
[ { "id": 211040, "name": "Idan Kashtan", "username": "Kashtan", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/k/90ced4/{size}.png", "created_at": "2025-03-24T08:05:56.728Z", "cooked": "<p>Hey everyone,</p>\n<p>I’m facing an issue with my FlaskAPI running in a private Hugging Face Space. I’ve set the space to enter sleeping mode after some time to save resources. However, when I try to wake it up after a few hours by sending a GET/POST request, I get a 404 error.</p>\n<p>I suspect this might be related to the spaces-jwt token refreshing periodically. I found this thread discussing JWT expiration settings:<br>\n<a href=\"https://discuss.huggingface.co/t/how-to-modify-the-fastapi-jwt-token-expiration-setting-issued-by-huggingface/78593\">https://discuss.huggingface.co/t/how-to-modify-the-fastapi-jwt-token-expiration-setting-issued-by-huggingface/78593</a></p>\n<p>However, when I try to send the GET request, I get a “Sorry, we can’t find the page you are looking for” error. I’m not sure if my issue is due to an incorrect setup, the token expiration, or something related to the sleeping mode.</p>\n<p>My Space: idkash1/Detect_Edits_in_AI-Generated_Text</p>\n<p>Would appreciate any insights or advice.<br>\nThanks in advance!</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-24T08:05:56.728Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 21, "reads": 4, "readers_count": 3, "score": 120.8, "yours": false, "topic_id": 147150, "topic_slug": "issue-with-flaskapi-in-a-private-space-after-sleeping-mode", "display_username": "Idan Kashtan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/how-to-modify-the-fastapi-jwt-token-expiration-setting-issued-by-huggingface/78593", "internal": true, "reflection": false, "title": "How to modify the FastAPI JWT Token Expiration Setting Issued by HuggingFace", "clicks": 2 }, { "url": "https://discuss.huggingface.co/t/unexpected-delay-while-building-gradio-server/151592/2", "internal": true, "reflection": true, "title": "Unexpected delay while building Gradio server", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88249, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/issue-with-flaskapi-in-a-private-space-after-sleeping-mode/147150/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211080, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-24T11:24:26.859Z", "cooked": "<p>Hmm… It works. I think it’s sleeping on its own, but I wonder if it won’t happen unless you explicitly put it into sleep mode.</p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">HF_TOKEN = \"hf_my_pro_token\"\nimport requests\nheaders = {\"Authorization\": f\"Bearer {HF_TOKEN}\"}\nurl = \"https://huggingface.co/api/spaces/John6666/gradio-server-test/jwt\"\nresult = requests.get(url, headers=headers).json()\nprint(result)\n# {'token': '...\n</code></pre>", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-24T11:24:26.859Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 5.6, "yours": false, "topic_id": 147150, "topic_slug": "issue-with-flaskapi-in-a-private-space-after-sleeping-mode", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/issue-with-flaskapi-in-a-private-space-after-sleeping-mode/147150/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211109, "name": "Idan Kashtan", "username": "Kashtan", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/k/90ced4/{size}.png", "created_at": "2025-03-24T14:42:19.921Z", "cooked": "<p>I couldn’t see it because it was a private space, so I changed it to public and found the token via the API.</p>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-24T14:42:19.921Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 147150, "topic_slug": "issue-with-flaskapi-in-a-private-space-after-sleeping-mode", "display_username": "Idan Kashtan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88249, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/issue-with-flaskapi-in-a-private-space-after-sleeping-mode/147150/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 211110, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-24T14:46:04.116Z", "cooked": "<p>In my case, the script above worked in Private Space. So, I think it’s possible that there’s something wrong with the state of the Spaces or it’s a server glitch.</p>\n<p>A few hours ago, an error was reported on HF Discord for a completely different matter, and it fixed itself. It might be something similar.</p>", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-24T14:46:04.116Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 147150, "topic_slug": "issue-with-flaskapi-in-a-private-space-after-sleeping-mode", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/issue-with-flaskapi-in-a-private-space-after-sleeping-mode/147150/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 211232, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-25T02:46:10.675Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-03-25T02:46:10.675Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 2, "readers_count": 1, "score": 10.4, "yours": false, "topic_id": 147150, "topic_slug": "issue-with-flaskapi-in-a-private-space-after-sleeping-mode", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/issue-with-flaskapi-in-a-private-space-after-sleeping-mode/147150/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hey everyone,</p> <p>I’m facing an issue with my FlaskAPI running in a private Hugging Face Space. I’ve set the space to enter sleeping mode after some time to save resources. However, when I try to wake it up after a few hours by sending a GET/POST request, I get a 404 error.</p> <p>I suspect this might be related to the spaces-jwt token refreshing periodically. I found this thread discussing JWT expiration settings:<br> <a href="https://discuss.huggingface.co/t/how-to-modify-the-fastapi-jwt-token-expiration-setting-issued-by-huggingface/78593">https://discuss.huggingface.co/t/how-to-modify-the-fastapi-jwt-token-expiration-setting-issued-by-huggingface/78593</a></p> <p>However, when I try to send the GET request, I get a “Sorry, we can’t find the page you are looking for” error. I’m not sure if my issue is due to an incorrect setup, the token expiration, or something related to the sleeping mode.</p> <p>My Space: idkash1/Detect_Edits_in_AI-Generated_Text</p> <p>Would appreciate any insights or advice.<br> Thanks in advance!</p>
<p>I couldn’t see it because it was a private space, so I changed it to public and found the token via the API.</p>
GPT2Model model output inconsistency between different transformers versions
https://discuss.huggingface.co/t/gpt2model-model-output-inconsistency-between-different-transformers-versions/146833
146,833
6
2025-03-21T17:36:35.320000Z
[ { "id": 210601, "name": "Wenzhong Zhao", "username": "Wenzhong2005", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/w/b3f665/{size}.png", "created_at": "2025-03-21T17:36:35.388Z", "cooked": "<p>We fine-tuned the GPT2Model (distilgpt2) some time ago. Due to tool vulnerability issues, we have to upgrade transformers 4.48.0 or above. However, the exact same GPT2 model produces different outputs for the exact same input after the upgrading. It seems to me that the masked portion of the model output changed, while the unmasked portion stays the same. Therefore, after applying a classification head (linear layer) on top of GPT-2 output, we got different scores for the same input. Can anyone help to point to what’s changed?</p>\n<p>The code to reproduce the results:<br>\nimport torch<br>\nimport tokenizers<br>\nimport transformers<br>\nfrom transformers import GPT2Model, GPT2Tokenizer</p>\n<h1><a name=\"p-210601-sample-input-1\" class=\"anchor\" href=\"#p-210601-sample-input-1\"></a>Sample input</h1>\n<p>tokenizer = GPT2Tokenizer.from_pretrained(“distilgpt2”)<br>\ntokenizer.pad_token = tokenizer.eos_token<br>\ntokenizer.padding_side = “left”</p>\n<p>text = ‘Model output changed’<br>\nmodel_inputs = tokenizer(text, padding=‘max_length’, max_length=12,<br>\ntruncation=True, return_tensors=“pt”)<br>\ninput_ids, attention_mask = model_inputs[“input_ids”], model_inputs[“attention_mask”]<br>\nprint(‘input_ids:’, input_ids)<br>\nprint(‘mask:’, attention_mask)</p>\n<h1><a name=\"p-210601-load-gpt-2-model-2\" class=\"anchor\" href=\"#p-210601-load-gpt-2-model-2\"></a>Load GPT-2 Model</h1>\n<p>model = GPT2Model.from_pretrained(“distilgpt2”)<br>\nmodel.eval()</p>\n<h1><a name=\"p-210601-run-model-3\" class=\"anchor\" href=\"#p-210601-run-model-3\"></a>Run model</h1>\n<p>with torch.no_grad():<br>\noutputs = model(input_ids=input_ids, attention_mask=attention_mask)</p>\n<p>last_hidden_state = outputs.last_hidden_state<br>\nprint(last_hidden_state)</p>\n<p>Here are the 2 requirements.txt files and model outputs:<br>\nBefore:<br>\ntorch==2.4.0<br>\ntransformers==4.41.0<br>\nhuggingface_hub==0.27.1</p>\n<p>input_ids: tensor([[50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 17633, 5072, 3421]])<br>\nmask: tensor([[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]])<br>\nModel output:<br>\ntensor([[[-0.1352, 0.0991, -0.2160, …, -0.1755, -0.0512, -0.0338],<br>\n[-0.5171, -0.0978, -0.3561, …, -0.3091, 0.1552, -0.1503],<br>\n[-0.4233, -0.1778, -0.1415, …, -0.0925, 0.1203, -0.1014],<br>\n…,<br>\n[-0.3410, 0.2196, -0.1369, …, -0.4246, 0.3772, -0.4357],<br>\n[-0.6979, 0.1779, -1.0862, …, -0.5422, 0.1065, -0.2090],<br>\n[-0.5766, 0.1015, -0.2526, …, -1.4290, -0.1708, 0.1124]]])</p>\n<p>After:<br>\ntorch==2.4.0<br>\ntransformers==4.42.0<br>\nhuggingface_hub==0.27.1</p>\n<p>input_ids: tensor([[50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 17633, 5072, 3421]])<br>\nmask: tensor([[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]])<br>\nModel output:<br>\ntensor([[[-5.1260e-02, 1.1421e-01, -6.7051e-02, …, -8.8936e-02,<br>\n-7.6510e-02, 8.6264e-03],<br>\n[-1.5280e-01, -5.6395e-02, 2.1665e-01, …, 1.1190e-01,<br>\n2.2004e-02, -9.5938e-02],<br>\n[-1.1987e-01, -5.4886e-02, 2.0053e-01, …, 1.3524e-01,<br>\n-4.1297e-04, -8.2952e-02],<br>\n…,<br>\n[-3.4099e-01, 2.1960e-01, -1.3687e-01, …, -4.2462e-01,<br>\n3.7722e-01, -4.3574e-01],<br>\n[-6.9789e-01, 1.7786e-01, -1.0862e+00, …, -5.4218e-01,<br>\n1.0647e-01, -2.0897e-01],<br>\n[-5.7657e-01, 1.0148e-01, -2.5263e-01, …, -1.4290e+00,<br>\n-1.7080e-01, 1.1240e-01]]])</p>", "post_number": 1, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-21T23:07:28.666Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 17, "reads": 6, "readers_count": 5, "score": 91.2, "yours": false, "topic_id": 146833, "topic_slug": "gpt2model-model-output-inconsistency-between-different-transformers-versions", "display_username": "Wenzhong Zhao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 5, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/inconsistent-gpt2model-results-between-transformers-versions/163484", "internal": true, "reflection": true, "title": "Inconsistent GPT2Model results between transformers versions", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 22921, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/gpt2model-model-output-inconsistency-between-different-transformers-versions/146833/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210609, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-21T18:31:21.817Z", "cooked": "<p>Possibly related this phenomenon.</p><aside class=\"quote quote-modified\" data-post=\"1\" data-topic=\"146303\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://avatars.discourse-cdn.com/v4/letter/s/67e7ee/48.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/ask-for-help-output-inconsistency-when-using-llm-batch-inference-compared-to-single-input/146303\">Ask for help: Output inconsistency when using LLM batch inference compared to single input</a> <a class=\"badge-category__wrapper \" href=\"/c/beginners/5\"><span data-category-id=\"5\" style=\"--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category for any basic question you have on any of the Hugging Face library. Don’t moderate yourself, everyone has to begin somewhere and everyone on this forum is here to help!\"><span class=\"badge-category__name\">Beginners</span></span></a>\n </div>\n <blockquote>\n I found single LLM input get different output logits when merging into a batch for inference. \nBesides, I need to use inputs_embeds as model input. \nMy test LLM is “Qwen/Qwen2.5-1.5B-Instruct” and the test code is below. \nfrom transformers import AutoModelForCausalLM, AutoTokenizer\nimport torch\n\n# load model and tokenizezr\nmodel_name = \"Qwen/Qwen2.5-1.5B-Instruct\"\nmodel = AutoModelForCausalLM.from_pretrained(\n model_name,\n torch_dtype=\"auto\",\n device_map=\"auto\",\n trust_remote_code=Tr…\n </blockquote>\n</aside>\n\n<p>Also, the part that has changed a lot recently is the KV cache-related area, which seems to have changed quite a bit.</p>", "post_number": 2, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-21T18:31:21.817Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 5.8, "yours": false, "topic_id": 146833, "topic_slug": "gpt2model-model-output-inconsistency-between-different-transformers-versions", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/ask-for-help-output-inconsistency-when-using-llm-batch-inference-compared-to-single-input/146303", "internal": true, "reflection": false, "title": "Ask for help: Output inconsistency when using LLM batch inference compared to single input", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/gpt2model-model-output-inconsistency-between-different-transformers-versions/146833/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210641, "name": "Wenzhong Zhao", "username": "Wenzhong2005", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/w/b3f665/{size}.png", "created_at": "2025-03-21T20:36:15.809Z", "cooked": "<p>Thanks <a class=\"mention\" href=\"/u/john6666\">@John6666</a> for your input. I tried and it did not work. They were trying to resolve the model output inconsistency between batch run and single run, but my issue is the model output inconsistency between different transformers versions (4.39.2 vs 4.48.0). Also, the inconsistency lies in the masked portion only, but not in the unmasked portion.</p>", "post_number": 3, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-21T20:45:02.061Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 146833, "topic_slug": "gpt2model-model-output-inconsistency-between-different-transformers-versions", "display_username": "Wenzhong Zhao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 22921, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/gpt2model-model-output-inconsistency-between-different-transformers-versions/146833/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 210662, "name": "Wenzhong Zhao", "username": "Wenzhong2005", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/w/b3f665/{size}.png", "created_at": "2025-03-21T22:23:17.509Z", "cooked": "<p>After digging into it a little deeper, I found that the model output inconsistency was introduced between transformers v4.41.0 and v4.42.0.</p>", "post_number": 4, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-21T22:23:17.509Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 146833, "topic_slug": "gpt2model-model-output-inconsistency-between-different-transformers-versions", "display_username": "Wenzhong Zhao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 22921, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/gpt2model-model-output-inconsistency-between-different-transformers-versions/146833/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210685, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-22T04:55:00.045Z", "cooked": "<p>Perhaps this? SDPA is now default attention.</p><aside class=\"onebox githubcommit\" data-onebox-src=\"https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/transformers</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Commit\">\n <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M10.86 7c-.45-1.72-2-3-3.86-3-1.86 0-3.41 1.28-3.86 3H0v2h3.14c.45 1.72 2 3 3.86 3 1.86 0 3.41-1.28 3.86-3H14V7h-3.14zM7 10.2c-1.22 0-2.2-.98-2.2-2.2 0-1.22.98-2.2 2.2-2.2 1.22 0 2.2.98 2.2 2.2 0 1.22-.98 2.2-2.2 2.2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6\" target=\"_blank\" rel=\"noopener\">[`GPT2`] Add SDPA support (#31172)</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n committed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-06-19\" data-time=\"07:40:57\" data-timezone=\"UTC\">07:40AM - 19 Jun 24 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/vasqu\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/e/4/e4b1788d08936c3a2fbb349b2e5071b02639c357.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"483E3E\">\n vasqu\n </a>\n </div>\n\n <div class=\"lines\" title=\"changed 4 files with 191 additions and 11 deletions\">\n <a href=\"https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6\" target=\"_blank\" rel=\"noopener\">\n <span class=\"added\">+191</span>\n <span class=\"removed\">-11</span>\n </a>\n </div>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">* `gpt2` sdpa support\n\n* fix (at least) one test, style, repo consistency\n\n*<span class=\"show-more-container\"><a href=\"https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6\" target=\"_blank\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\"> fix sdpa mask in forward --&gt; fixes generation\n\n* test\n\n* test2\n\n* test3\n\n* test4\n\n* simplify shapes for attn mask creation and small comments\n\n* hub fail test\n\n* benchmarks\n\n* flash attn 2 mask should not be inverted on enc-dec setup\n\n* fix comment\n\n* apply some suggestion from code review\n\n- only save _attn_implentation once\n- remove unnecessary comment\n\n* change elif logic\n\n* [run-slow] gpt2\n\n* modify `test_gpt2_sample_max_time` to follow previous assertion patterns</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/huggingface/transformers/commits/v4.42.0/src/transformers/models\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/huggingface/transformers/commits/v4.42.0/src/transformers/models\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/295;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/8/5/855bb4421bfc5b888c9759e3e1fefb757672f6a2_2_690x295.png\" class=\"thumbnail\" data-dominant-color=\"F8F6F4\" width=\"690\" height=\"295\"></div>\n\n<h3><a href=\"https://github.com/huggingface/transformers/commits/v4.42.0/src/transformers/models\" target=\"_blank\" rel=\"noopener\">History for src/transformers/models - huggingface/transformers</a></h3>\n\n <p>🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX. - History for src/transformers/models - huggingface/transformers</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 5, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-22T04:55:15.640Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 20.6, "yours": false, "topic_id": 146833, "topic_slug": "gpt2model-model-output-inconsistency-between-different-transformers-versions", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/transformers/commits/v4.42.0/src/transformers/models", "internal": false, "reflection": false, "title": "History for src/transformers/models - huggingface/transformers · GitHub", "clicks": 2 }, { "url": "https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6", "internal": false, "reflection": false, "title": "[`GPT2`] Add SDPA support (#31172) · huggingface/transformers@b275a41 · GitHub", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/gpt2model-model-output-inconsistency-between-different-transformers-versions/146833/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210794, "name": "Wenzhong Zhao", "username": "Wenzhong2005", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/w/b3f665/{size}.png", "created_at": "2025-03-22T18:25:57.217Z", "cooked": "<p>Really appreciate your help <a class=\"mention\" href=\"/u/john6666\">@John6666</a>. It worked after I switched back to the “eager” attention with attn_implementation=“eager”.</p>", "post_number": 6, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-22T18:25:57.217Z", "reply_count": 0, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 146833, "topic_slug": "gpt2model-model-output-inconsistency-between-different-transformers-versions", "display_username": "Wenzhong Zhao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 22921, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/gpt2model-model-output-inconsistency-between-different-transformers-versions/146833/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 210860, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-23T06:26:30.487Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 7, "post_type": 3, "posts_count": 7, "updated_at": "2025-03-23T06:26:30.487Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 2, "readers_count": 1, "score": 5.4, "yours": false, "topic_id": 146833, "topic_slug": "gpt2model-model-output-inconsistency-between-different-transformers-versions", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/gpt2model-model-output-inconsistency-between-different-transformers-versions/146833/7", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>We fine-tuned the GPT2Model (distilgpt2) some time ago. Due to tool vulnerability issues, we have to upgrade transformers 4.48.0 or above. However, the exact same GPT2 model produces different outputs for the exact same input after the upgrading. It seems to me that the masked portion of the model output changed, while the unmasked portion stays the same. Therefore, after applying a classification head (linear layer) on top of GPT-2 output, we got different scores for the same input. Can anyone help to point to what’s changed?</p> <p>The code to reproduce the results:<br> import torch<br> import tokenizers<br> import transformers<br> from transformers import GPT2Model, GPT2Tokenizer</p> <h1><a name="p-210601-sample-input-1" class="anchor" href="#p-210601-sample-input-1"></a>Sample input</h1> <p>tokenizer = GPT2Tokenizer.from_pretrained(“distilgpt2”)<br> tokenizer.pad_token = tokenizer.eos_token<br> tokenizer.padding_side = “left”</p> <p>text = ‘Model output changed’<br> model_inputs = tokenizer(text, padding=‘max_length’, max_length=12,<br> truncation=True, return_tensors=“pt”)<br> input_ids, attention_mask = model_inputs[“input_ids”], model_inputs[“attention_mask”]<br> print(‘input_ids:’, input_ids)<br> print(‘mask:’, attention_mask)</p> <h1><a name="p-210601-load-gpt-2-model-2" class="anchor" href="#p-210601-load-gpt-2-model-2"></a>Load GPT-2 Model</h1> <p>model = GPT2Model.from_pretrained(“distilgpt2”)<br> model.eval()</p> <h1><a name="p-210601-run-model-3" class="anchor" href="#p-210601-run-model-3"></a>Run model</h1> <p>with torch.no_grad():<br> outputs = model(input_ids=input_ids, attention_mask=attention_mask)</p> <p>last_hidden_state = outputs.last_hidden_state<br> print(last_hidden_state)</p> <p>Here are the 2 requirements.txt files and model outputs:<br> Before:<br> torch==2.4.0<br> transformers==4.41.0<br> huggingface_hub==0.27.1</p> <p>input_ids: tensor([[50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 17633, 5072, 3421]])<br> mask: tensor([[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]])<br> Model output:<br> tensor([[[-0.1352, 0.0991, -0.2160, …, -0.1755, -0.0512, -0.0338],<br> [-0.5171, -0.0978, -0.3561, …, -0.3091, 0.1552, -0.1503],<br> [-0.4233, -0.1778, -0.1415, …, -0.0925, 0.1203, -0.1014],<br> …,<br> [-0.3410, 0.2196, -0.1369, …, -0.4246, 0.3772, -0.4357],<br> [-0.6979, 0.1779, -1.0862, …, -0.5422, 0.1065, -0.2090],<br> [-0.5766, 0.1015, -0.2526, …, -1.4290, -0.1708, 0.1124]]])</p> <p>After:<br> torch==2.4.0<br> transformers==4.42.0<br> huggingface_hub==0.27.1</p> <p>input_ids: tensor([[50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 50256, 17633, 5072, 3421]])<br> mask: tensor([[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1]])<br> Model output:<br> tensor([[[-5.1260e-02, 1.1421e-01, -6.7051e-02, …, -8.8936e-02,<br> -7.6510e-02, 8.6264e-03],<br> [-1.5280e-01, -5.6395e-02, 2.1665e-01, …, 1.1190e-01,<br> 2.2004e-02, -9.5938e-02],<br> [-1.1987e-01, -5.4886e-02, 2.0053e-01, …, 1.3524e-01,<br> -4.1297e-04, -8.2952e-02],<br> …,<br> [-3.4099e-01, 2.1960e-01, -1.3687e-01, …, -4.2462e-01,<br> 3.7722e-01, -4.3574e-01],<br> [-6.9789e-01, 1.7786e-01, -1.0862e+00, …, -5.4218e-01,<br> 1.0647e-01, -2.0897e-01],<br> [-5.7657e-01, 1.0148e-01, -2.5263e-01, …, -1.4290e+00,<br> -1.7080e-01, 1.1240e-01]]])</p>
<p>Perhaps this? SDPA is now default attention.</p><aside class="onebox githubcommit" data-onebox-src="https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6"> <header class="source"> <a href="https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6" target="_blank" rel="noopener">github.com/huggingface/transformers</a> </header> <article class="onebox-body"> <div class="github-row"> <div class="github-icon-container" title="Commit"> <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M10.86 7c-.45-1.72-2-3-3.86-3-1.86 0-3.41 1.28-3.86 3H0v2h3.14c.45 1.72 2 3 3.86 3 1.86 0 3.41-1.28 3.86-3H14V7h-3.14zM7 10.2c-1.22 0-2.2-.98-2.2-2.2 0-1.22.98-2.2 2.2-2.2 1.22 0 2.2.98 2.2 2.2 0 1.22-.98 2.2-2.2 2.2z"></path></svg> </div> <div class="github-info-container"> <h4> <a href="https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6" target="_blank" rel="noopener">[`GPT2`] Add SDPA support (#31172)</a> </h4> <div class="github-info"> <div class="date"> committed <span class="discourse-local-date" data-format="ll" data-date="2024-06-19" data-time="07:40:57" data-timezone="UTC">07:40AM - 19 Jun 24 UTC</span> </div> <div class="user"> <a href="https://github.com/vasqu" target="_blank" rel="noopener"> <img alt="" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/e/4/e4b1788d08936c3a2fbb349b2e5071b02639c357.png" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="483E3E"> vasqu </a> </div> <div class="lines" title="changed 4 files with 191 additions and 11 deletions"> <a href="https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6" target="_blank" rel="noopener"> <span class="added">+191</span> <span class="removed">-11</span> </a> </div> </div> </div> </div> <div class="github-row"> <p class="github-body-container">* `gpt2` sdpa support * fix (at least) one test, style, repo consistency *<span class="show-more-container"><a href="https://github.com/huggingface/transformers/commit/b275a410057b282495422a4dcf5782418aa484e6" target="_blank" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden"> fix sdpa mask in forward --&gt; fixes generation * test * test2 * test3 * test4 * simplify shapes for attn mask creation and small comments * hub fail test * benchmarks * flash attn 2 mask should not be inverted on enc-dec setup * fix comment * apply some suggestion from code review - only save _attn_implentation once - remove unnecessary comment * change elif logic * [run-slow] gpt2 * modify `test_gpt2_sample_max_time` to follow previous assertion patterns</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/huggingface/transformers/commits/v4.42.0/src/transformers/models"> <header class="source"> <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32"> <a href="https://github.com/huggingface/transformers/commits/v4.42.0/src/transformers/models" target="_blank" rel="noopener">GitHub</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/295;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/8/5/855bb4421bfc5b888c9759e3e1fefb757672f6a2_2_690x295.png" class="thumbnail" data-dominant-color="F8F6F4" width="690" height="295"></div> <h3><a href="https://github.com/huggingface/transformers/commits/v4.42.0/src/transformers/models" target="_blank" rel="noopener">History for src/transformers/models - huggingface/transformers</a></h3> <p>🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX. - History for src/transformers/models - huggingface/transformers</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
HuggingFace Inference API cannot determine image type of the image I am sending
https://discuss.huggingface.co/t/huggingface-inference-api-cannot-determine-image-type-of-the-image-i-am-sending/146864
146,864
64
2025-03-21T21:49:47.086000Z
[ { "id": 210656, "name": "Caner Cetin", "username": "canercetin", "avatar_template": "/user_avatar/discuss.huggingface.co/canercetin/{size}/43825_2.png", "created_at": "2025-03-21T21:49:47.142Z", "cooked": "<p>Hi. I am using meta-llama/Llama-3.2-11B-Vision-Instruct model from the endpoint <a href=\"https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision-Instruct/v1/chat/completions\">https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision-Instruct/v1/chat/completions</a> and, due to a misconfiguration in my server, or something related from HF, I cant feed the image.</p>\n<p>I am getting hit with the response “Input validation error: invalid image: The image format could not be determined” when I try to use image =&gt; <a href=\"https://static.cansu.dev/DTF%20Wallets/Wallets/Walllets%20logos%20%20(National%20Football%20League)/Walllets%20logos%20%20(National%20Football%20League)-06.jpg\" rel=\"noopener nofollow ugc\">https://static.cansu.dev/DTF%20Wallets/Wallets/Walllets%20logos%20%20(National%20Football%20League)/Walllets%20logos%20%20(National%20Football%20League)-06.jpg</a></p>\n<p>from cURL,</p>\n<pre><code class=\"lang-auto\">HTTP/2 200 \ndate: Fri, 21 Mar 2025 22:03:44 GMT\ncontent-type: image/jpeg\ncontent-disposition: attachment; filename=image.jpg\netag: W/\"1269648391-br\"\nlast-modified: Wed, 12 Mar 2025 13:21:23 GMT\nvary: Accept-Encoding\nx-content-type-options: nosniff\ncache-control: max-age=14400\ncf-cache-status: MISS\nreport-to: {\"endpoints\":[{\"url\":\"https:\\/\\/a.nel.cloudflare.com\\/report\\/v4?s=eYHY2KYXJVb89gHUe0lnG6X7aSTLJ2PEYc%2Fy2UUysK4E8QEcuae9IWaVlahiG0KOZ%2FWU%2B7AmO8%2FQvVAKynNEjg9e7KzoFSul9udVS5pBYVEdGRJFvcdE7O9ktWFQ5tLly67w\"}],\"group\":\"cf-nel\",\"max_age\":604800}\nnel: {\"success_fraction\":0,\"report_to\":\"cf-nel\",\"max_age\":604800}\nserver: cloudflare\ncf-ray: 9240bdb1cbedd251-AMS\nalt-svc: h3=\":443\"; ma=86400\nserver-timing: cfL4;desc=\"?proto=TCP&amp;rtt=99423&amp;min_rtt=80127&amp;rtt_var=37870&amp;sent=5&amp;recv=8&amp;lost=0&amp;retrans=0&amp;sent_bytes=3379&amp;recv_bytes=857&amp;delivery_rate=36142&amp;cwnd=238&amp;unsent_bytes=0&amp;cid=23ff9705addda769&amp;ts=187&amp;x=0\"\n</code></pre>\n<p>As you can see here, I am helping Hugging Face as much as I can to determine the image type. Content-Type is set to image/jpeg, x-content-type-options set to nosniff for no confusions, content-disposition set to attachment, file name is clear, what am I doing wrong? When I feed Google Drive link, it is all fine, what is wrong here?</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-21T22:08:55.778Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 39, "reads": 5, "readers_count": 4, "score": 191, "yours": false, "topic_id": 146864, "topic_slug": "huggingface-inference-api-cannot-determine-image-type-of-the-image-i-am-sending", "display_username": "Caner Cetin", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 3, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision-Instruct/v1/chat/completions", "internal": false, "reflection": false, "title": null, "clicks": 2 }, { "url": "https://static.cansu.dev/DTF%20Wallets/Wallets/Walllets%20logos%20%20(National%20Football%20League)/Walllets%20logos%20%20(National%20Football%20League)-06.jpg", "internal": false, "reflection": false, "title": "Walllets%20logos%20%20(National%20Football%20League)-06.jpg", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88024, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/huggingface-inference-api-cannot-determine-image-type-of-the-image-i-am-sending/146864/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210666, "name": "Caner Cetin", "username": "canercetin", "avatar_template": "/user_avatar/discuss.huggingface.co/canercetin/{size}/43825_2.png", "created_at": "2025-03-21T23:15:42.467Z", "cooked": "<p>Fixed. All I had to do was changing the endpoint URL to <a href=\"https://router.huggingface.co/novita/v3/openai/chat/completions\">https://router.huggingface.co/novita/v3/openai/chat/completions</a></p>\n<p>such a fucking shame. thanks for wasting my 2 hours with your own “Huggingface Inference” provider, Novita worked on first try.</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-21T23:16:14.580Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 21, "reads": 5, "readers_count": 4, "score": 121, "yours": false, "topic_id": 146864, "topic_slug": "huggingface-inference-api-cannot-determine-image-type-of-the-image-i-am-sending", "display_username": "Caner Cetin", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://router.huggingface.co/novita/v3/openai/chat/completions", "internal": false, "reflection": false, "title": null, "clicks": 6 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 88024, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/huggingface-inference-api-cannot-determine-image-type-of-the-image-i-am-sending/146864/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210726, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-22T11:16:17.574Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-22T11:16:17.574Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 146864, "topic_slug": "huggingface-inference-api-cannot-determine-image-type-of-the-image-i-am-sending", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/huggingface-inference-api-cannot-determine-image-type-of-the-image-i-am-sending/146864/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi. I am using meta-llama/Llama-3.2-11B-Vision-Instruct model from the endpoint <a href="https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision-Instruct/v1/chat/completions">https://api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision-Instruct/v1/chat/completions</a> and, due to a misconfiguration in my server, or something related from HF, I cant feed the image.</p> <p>I am getting hit with the response “Input validation error: invalid image: The image format could not be determined” when I try to use image =&gt; <a href="https://static.cansu.dev/DTF%20Wallets/Wallets/Walllets%20logos%20%20(National%20Football%20League)/Walllets%20logos%20%20(National%20Football%20League)-06.jpg" rel="noopener nofollow ugc">https://static.cansu.dev/DTF%20Wallets/Wallets/Walllets%20logos%20%20(National%20Football%20League)/Walllets%20logos%20%20(National%20Football%20League)-06.jpg</a></p> <p>from cURL,</p> <pre><code class="lang-auto">HTTP/2 200 date: Fri, 21 Mar 2025 22:03:44 GMT content-type: image/jpeg content-disposition: attachment; filename=image.jpg etag: W/"1269648391-br" last-modified: Wed, 12 Mar 2025 13:21:23 GMT vary: Accept-Encoding x-content-type-options: nosniff cache-control: max-age=14400 cf-cache-status: MISS report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v4?s=eYHY2KYXJVb89gHUe0lnG6X7aSTLJ2PEYc%2Fy2UUysK4E8QEcuae9IWaVlahiG0KOZ%2FWU%2B7AmO8%2FQvVAKynNEjg9e7KzoFSul9udVS5pBYVEdGRJFvcdE7O9ktWFQ5tLly67w"}],"group":"cf-nel","max_age":604800} nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800} server: cloudflare cf-ray: 9240bdb1cbedd251-AMS alt-svc: h3=":443"; ma=86400 server-timing: cfL4;desc="?proto=TCP&amp;rtt=99423&amp;min_rtt=80127&amp;rtt_var=37870&amp;sent=5&amp;recv=8&amp;lost=0&amp;retrans=0&amp;sent_bytes=3379&amp;recv_bytes=857&amp;delivery_rate=36142&amp;cwnd=238&amp;unsent_bytes=0&amp;cid=23ff9705addda769&amp;ts=187&amp;x=0" </code></pre> <p>As you can see here, I am helping Hugging Face as much as I can to determine the image type. Content-Type is set to image/jpeg, x-content-type-options set to nosniff for no confusions, content-disposition set to attachment, file name is clear, what am I doing wrong? When I feed Google Drive link, it is all fine, what is wrong here?</p>
<p>Fixed. All I had to do was changing the endpoint URL to <a href="https://router.huggingface.co/novita/v3/openai/chat/completions">https://router.huggingface.co/novita/v3/openai/chat/completions</a></p> <p>such a fucking shame. thanks for wasting my 2 hours with your own “Huggingface Inference” provider, Novita worked on first try.</p>
Adding dropout in custom model, but setting dropout through .from_pretrained()
https://discuss.huggingface.co/t/adding-dropout-in-custom-model-but-setting-dropout-through-from-pretrained/146821
146,821
9
2025-03-21T16:06:36.735000Z
[ { "id": 210584, "name": "Radek Štulc", "username": "stulcrad", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/{size}.png", "created_at": "2025-03-21T16:06:36.798Z", "cooked": "<p>Hello, I need to create a custom model for my research using the HuggingFace PreTrainedModel. I was wondering what would happen when I put my custom dropout into <strong>init</strong>, but when calling the model using .from_pretrained() or using model config, I change the hidden_dropout_prob and attention_probs_dropout_prob, to show what I mean I will put a little of my code here.</p>\n<p>This is my model, where I assign self.dropout 0.5:</p>\n<pre><code class=\"lang-auto\">class RelationExtractionModel(PreTrainedModel):\n config_class = AutoConfig\n\n def __init__(self, model_config: AutoConfig, tokenizer: AutoTokenizer):\n super().__init__(model_config)\n self.model: AutoModel = AutoModel.from_pretrained(config.MODEL, config=model_config)\n self.model.resize_token_embeddings(len(tokenizer))\n self.tokenizer = tokenizer\n\n # HERE\n self.dropout = nn.Dropout(config.DROPOUT)\n #\n self.classifier = nn.Linear(model_config.hidden_size * 3, model_config.num_labels)\n\n self.e1_start_id = tokenizer.convert_tokens_to_ids(consts.E1_START_TOKEN)\n self.e2_start_id = tokenizer.convert_tokens_to_ids(consts.E2_START_TOKEN)\n self.cls_token_id = tokenizer.cls_token_id\n\n def forward(self, input_ids, attention_mask, labels=None, token_type_ids=None):\n outputs = self.model(input_ids=input_ids, attention_mask=attention_mask)\n sequence_output = outputs.last_hidden_state\n\n \n e1_mask = (input_ids == self.e1_start_id).unsqueeze(-1).expand(sequence_output.size())\n entity_a = torch.sum(sequence_output * e1_mask, dim=1)\n\n e2_mask = (input_ids == self.e2_start_id).unsqueeze(-1).expand(sequence_output.size())\n entity_b = torch.sum(sequence_output * e2_mask, dim=1)\n\n cls_mask = (input_ids == self.cls_token_id).unsqueeze(-1).expand(sequence_output.size())\n cls_embedding = torch.sum(sequence_output * cls_mask, dim=1)\n\n embedding = torch.cat([entity_a, entity_b, cls_embedding], dim=1)\n embedding = self.dropout(embedding)\n\n logits = self.classifier(embedding)\n\n loss = None\n if labels is not None:\n loss_fct = nn.CrossEntropyLoss()\n loss = loss_fct(logits, labels)\n\n return {\"loss\": loss, \"logits\": logits} if labels is not None else {\"logits\": logits}\n</code></pre>\n<p>and call the model like this:</p>\n<pre><code class=\"lang-auto\">from utils.RE_utils.CERED.RE_model import RelationExtractionModel\nmodel = RelationExtractionModel.from_pretrained(config.MODEL, tokenizer=tokenizer,\n num_labels=len(id2label), \n label2id=label2id, id2label=id2label,\n hidden_dropout_prob=0.25,\n attention_probs_dropout_prob=0.25)\n</code></pre>\n<p>where I put different values on purpose to show what I mean better.<br>\nMy idea is, that the dropout on the hidden layers and for the attention probabilities will change to my assigned dropout in <strong>init</strong>, but I am not sure.</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-21T16:09:43.510Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 69, "reads": 4, "readers_count": 3, "score": 350.8, "yours": false, "topic_id": 146821, "topic_slug": "adding-dropout-in-custom-model-but-setting-dropout-through-from-pretrained", "display_username": "Radek Štulc", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 41660, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/adding-dropout-in-custom-model-but-setting-dropout-through-from-pretrained/146821/1", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210593, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-21T17:06:17.897Z", "cooked": "<p>OK, I don’t really understand. It seems to be correct, but when I asked <a href=\"https://huggingface.co/chat/\">Hugging Chat</a>, it pointed out a few possible problems.</p>\n<hr>\n<p>When working with Hugging Face’s <code>PreTrainedModel</code> and custom dropout layers, it’s important to understand how dropout probabilities are applied during model initialization and fine-tuning. Here’s a breakdown of the situation you described and potential implications:</p>\n<hr>\n<h3><a name=\"p-210593-key-points-to-consider-1\" class=\"anchor\" href=\"#p-210593-key-points-to-consider-1\"></a>Key Points to Consider</h3>\n<ol>\n<li>\n<p><strong>Custom Dropout Layer Initialization</strong><br>\nIn your <code>RelationExtractionModel</code> class, you explicitly define a custom dropout layer with a fixed dropout probability of 0.5:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">self.dropout = nn.Dropout(config.DROPOUT)\n</code></pre>\n<p>This dropout layer is applied to the concatenated embeddings before the final classification step. This is a separate dropout layer from the dropout layers defined in the base transformer model (e.g., <code>hidden_dropout_prob</code> and <code>attention_probs_dropout_prob</code>).</p>\n</li>\n<li>\n<p><strong>Setting Dropout Probabilities via <code>from_pretrained()</code></strong><br>\nWhen you call <code>RelationExtractionModel.from_pretrained()</code>, you are passing custom dropout probabilities (<code>hidden_dropout_prob=0.25</code>, <code>attention_probs_dropout_prob=0.25</code>) to the model. These values:</p>\n<ul>\n<li>Modify the dropout probabilities in the transformer model’s configuration.</li>\n<li>Update the dropout layers within the transformer model (e.g., dropout after attention layers and hidden layers).</li>\n</ul>\n</li>\n<li>\n<p><strong>Coexistence of Custom Dropout and Transformer Dropout</strong><br>\nThe transformer model’s dropout layers (with the new probabilities) and your custom dropout layer (with a fixed 0.5 probability) will both be active during training. This means:</p>\n<ul>\n<li>The transformer model will apply dropout to its internal computations (e.g., attention and hidden states).</li>\n<li>Your custom dropout will be applied to the concatenated embeddings before classification.</li>\n</ul>\n</li>\n<li>\n<p><strong>Potential Issues</strong></p>\n<ul>\n<li><strong>Over-Dropout</strong>: Applying multiple dropout layers (transformer dropout and custom dropout) could lead to excessive dropout, reducing the model’s performance. Be cautious with the total dropout rate.</li>\n<li><strong>Inconsistent Dropout During Inference</strong>: Ensure that dropout is correctly handled during inference by setting <code>model.eval()</code> to disable dropout.</li>\n</ul>\n</li>\n</ol>\n<hr>\n<h3><a name=\"p-210593-clarifications-2\" class=\"anchor\" href=\"#p-210593-clarifications-2\"></a>Clarifications</h3>\n<ul>\n<li>\n<p><strong>Transformer Dropout (<code>hidden_dropout_prob</code> and <code>attention_probs_dropout_prob</code>)</strong>:<br>\nThese dropout probabilities affect the transformer model’s internal dropout layers. They are updated when you call <code>from_pretrained()</code> with the new probabilities.</p>\n</li>\n<li>\n<p><strong>Custom Dropout Layer</strong>:<br>\nYour custom dropout layer, defined in the <code>__init__</code> method, is independent of the transformer’s dropout layers. It will retain its dropout probability of 0.5, regardless of the values passed to <code>from_pretrained()</code>.</p>\n</li>\n</ul>\n<hr>\n<h3><a name=\"p-210593-recommendations-3\" class=\"anchor\" href=\"#p-210593-recommendations-3\"></a>Recommendations</h3>\n<ol>\n<li>\n<p><strong>Adjust Custom Dropout Probability</strong>:<br>\nSince the transformer model’s dropout has been reduced to 0.25, you may want to adjust the custom dropout layer to a lower value (e.g., 0.2) to avoid over-dropping.</p>\n</li>\n<li>\n<p><strong>Monitor Model Behavior</strong>:<br>\nExperiment with different dropout combinations and monitor the model’s performance during training and validation to ensure that it generalizes well.</p>\n</li>\n<li>\n<p><strong>Documentation</strong>:<br>\nRefer to Hugging Face’s official documentation for fine-tuning models and customizing architectures [here][1].</p>\n</li>\n<li>\n<p><strong>Seed for Reproducibility</strong>:<br>\nEnsure consistent results by setting a random seed when experimenting with different dropout values.</p>\n</li>\n</ol>\n<hr>\n<h3><a name=\"p-210593-example-of-adjusted-custom-dropout-4\" class=\"anchor\" href=\"#p-210593-example-of-adjusted-custom-dropout-4\"></a>Example of Adjusted Custom Dropout</h3>\n<p>If you decide to adjust the custom dropout probability, update the <code>__init__</code> method in your <code>RelationExtractionModel</code> class:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">self.dropout = nn.Dropout(0.2) # Reduced from 0.5\n</code></pre>\n<hr>\n<p>By carefully managing dropout rates, you can balance regularization and model performance in your custom architecture.</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-21T17:06:17.897Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 4, "readers_count": 3, "score": 30.8, "yours": false, "topic_id": 146821, "topic_slug": "adding-dropout-in-custom-model-but-setting-dropout-through-from-pretrained", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/chat/", "internal": false, "reflection": false, "title": "HuggingChat", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/adding-dropout-in-custom-model-but-setting-dropout-through-from-pretrained/146821/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210689, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-22T05:07:02.149Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-22T05:07:02.149Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 1, "readers_count": 0, "score": 10.2, "yours": false, "topic_id": 146821, "topic_slug": "adding-dropout-in-custom-model-but-setting-dropout-through-from-pretrained", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/adding-dropout-in-custom-model-but-setting-dropout-through-from-pretrained/146821/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello, I need to create a custom model for my research using the HuggingFace PreTrainedModel. I was wondering what would happen when I put my custom dropout into <strong>init</strong>, but when calling the model using .from_pretrained() or using model config, I change the hidden_dropout_prob and attention_probs_dropout_prob, to show what I mean I will put a little of my code here.</p> <p>This is my model, where I assign self.dropout 0.5:</p> <pre><code class="lang-auto">class RelationExtractionModel(PreTrainedModel): config_class = AutoConfig def __init__(self, model_config: AutoConfig, tokenizer: AutoTokenizer): super().__init__(model_config) self.model: AutoModel = AutoModel.from_pretrained(config.MODEL, config=model_config) self.model.resize_token_embeddings(len(tokenizer)) self.tokenizer = tokenizer # HERE self.dropout = nn.Dropout(config.DROPOUT) # self.classifier = nn.Linear(model_config.hidden_size * 3, model_config.num_labels) self.e1_start_id = tokenizer.convert_tokens_to_ids(consts.E1_START_TOKEN) self.e2_start_id = tokenizer.convert_tokens_to_ids(consts.E2_START_TOKEN) self.cls_token_id = tokenizer.cls_token_id def forward(self, input_ids, attention_mask, labels=None, token_type_ids=None): outputs = self.model(input_ids=input_ids, attention_mask=attention_mask) sequence_output = outputs.last_hidden_state e1_mask = (input_ids == self.e1_start_id).unsqueeze(-1).expand(sequence_output.size()) entity_a = torch.sum(sequence_output * e1_mask, dim=1) e2_mask = (input_ids == self.e2_start_id).unsqueeze(-1).expand(sequence_output.size()) entity_b = torch.sum(sequence_output * e2_mask, dim=1) cls_mask = (input_ids == self.cls_token_id).unsqueeze(-1).expand(sequence_output.size()) cls_embedding = torch.sum(sequence_output * cls_mask, dim=1) embedding = torch.cat([entity_a, entity_b, cls_embedding], dim=1) embedding = self.dropout(embedding) logits = self.classifier(embedding) loss = None if labels is not None: loss_fct = nn.CrossEntropyLoss() loss = loss_fct(logits, labels) return {"loss": loss, "logits": logits} if labels is not None else {"logits": logits} </code></pre> <p>and call the model like this:</p> <pre><code class="lang-auto">from utils.RE_utils.CERED.RE_model import RelationExtractionModel model = RelationExtractionModel.from_pretrained(config.MODEL, tokenizer=tokenizer, num_labels=len(id2label), label2id=label2id, id2label=id2label, hidden_dropout_prob=0.25, attention_probs_dropout_prob=0.25) </code></pre> <p>where I put different values on purpose to show what I mean better.<br> My idea is, that the dropout on the hidden layers and for the attention probabilities will change to my assigned dropout in <strong>init</strong>, but I am not sure.</p>
<p>OK, I don’t really understand. It seems to be correct, but when I asked <a href="https://huggingface.co/chat/">Hugging Chat</a>, it pointed out a few possible problems.</p> <hr> <p>When working with Hugging Face’s <code>PreTrainedModel</code> and custom dropout layers, it’s important to understand how dropout probabilities are applied during model initialization and fine-tuning. Here’s a breakdown of the situation you described and potential implications:</p> <hr> <h3><a name="p-210593-key-points-to-consider-1" class="anchor" href="#p-210593-key-points-to-consider-1"></a>Key Points to Consider</h3> <ol> <li> <p><strong>Custom Dropout Layer Initialization</strong><br> In your <code>RelationExtractionModel</code> class, you explicitly define a custom dropout layer with a fixed dropout probability of 0.5:</p> <pre data-code-wrap="python"><code class="lang-python">self.dropout = nn.Dropout(config.DROPOUT) </code></pre> <p>This dropout layer is applied to the concatenated embeddings before the final classification step. This is a separate dropout layer from the dropout layers defined in the base transformer model (e.g., <code>hidden_dropout_prob</code> and <code>attention_probs_dropout_prob</code>).</p> </li> <li> <p><strong>Setting Dropout Probabilities via <code>from_pretrained()</code></strong><br> When you call <code>RelationExtractionModel.from_pretrained()</code>, you are passing custom dropout probabilities (<code>hidden_dropout_prob=0.25</code>, <code>attention_probs_dropout_prob=0.25</code>) to the model. These values:</p> <ul> <li>Modify the dropout probabilities in the transformer model’s configuration.</li> <li>Update the dropout layers within the transformer model (e.g., dropout after attention layers and hidden layers).</li> </ul> </li> <li> <p><strong>Coexistence of Custom Dropout and Transformer Dropout</strong><br> The transformer model’s dropout layers (with the new probabilities) and your custom dropout layer (with a fixed 0.5 probability) will both be active during training. This means:</p> <ul> <li>The transformer model will apply dropout to its internal computations (e.g., attention and hidden states).</li> <li>Your custom dropout will be applied to the concatenated embeddings before classification.</li> </ul> </li> <li> <p><strong>Potential Issues</strong></p> <ul> <li><strong>Over-Dropout</strong>: Applying multiple dropout layers (transformer dropout and custom dropout) could lead to excessive dropout, reducing the model’s performance. Be cautious with the total dropout rate.</li> <li><strong>Inconsistent Dropout During Inference</strong>: Ensure that dropout is correctly handled during inference by setting <code>model.eval()</code> to disable dropout.</li> </ul> </li> </ol> <hr> <h3><a name="p-210593-clarifications-2" class="anchor" href="#p-210593-clarifications-2"></a>Clarifications</h3> <ul> <li> <p><strong>Transformer Dropout (<code>hidden_dropout_prob</code> and <code>attention_probs_dropout_prob</code>)</strong>:<br> These dropout probabilities affect the transformer model’s internal dropout layers. They are updated when you call <code>from_pretrained()</code> with the new probabilities.</p> </li> <li> <p><strong>Custom Dropout Layer</strong>:<br> Your custom dropout layer, defined in the <code>__init__</code> method, is independent of the transformer’s dropout layers. It will retain its dropout probability of 0.5, regardless of the values passed to <code>from_pretrained()</code>.</p> </li> </ul> <hr> <h3><a name="p-210593-recommendations-3" class="anchor" href="#p-210593-recommendations-3"></a>Recommendations</h3> <ol> <li> <p><strong>Adjust Custom Dropout Probability</strong>:<br> Since the transformer model’s dropout has been reduced to 0.25, you may want to adjust the custom dropout layer to a lower value (e.g., 0.2) to avoid over-dropping.</p> </li> <li> <p><strong>Monitor Model Behavior</strong>:<br> Experiment with different dropout combinations and monitor the model’s performance during training and validation to ensure that it generalizes well.</p> </li> <li> <p><strong>Documentation</strong>:<br> Refer to Hugging Face’s official documentation for fine-tuning models and customizing architectures [here][1].</p> </li> <li> <p><strong>Seed for Reproducibility</strong>:<br> Ensure consistent results by setting a random seed when experimenting with different dropout values.</p> </li> </ol> <hr> <h3><a name="p-210593-example-of-adjusted-custom-dropout-4" class="anchor" href="#p-210593-example-of-adjusted-custom-dropout-4"></a>Example of Adjusted Custom Dropout</h3> <p>If you decide to adjust the custom dropout probability, update the <code>__init__</code> method in your <code>RelationExtractionModel</code> class:</p> <pre data-code-wrap="python"><code class="lang-python">self.dropout = nn.Dropout(0.2) # Reduced from 0.5 </code></pre> <hr> <p>By carefully managing dropout rates, you can balance regularization and model performance in your custom architecture.</p>
Need Help with analyzing my so called GPT
https://discuss.huggingface.co/t/need-help-with-analyzing-my-so-called-gpt/146507
146,507
5
2025-03-19T18:27:49.394000Z
[ { "id": 210119, "name": "Kamil P", "username": "kamanakama", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/{size}.png", "created_at": "2025-03-19T18:27:49.455Z", "cooked": "<p>Hi, everyone I just started programming GPT model almost all by myself after some patches it started working and now I’m worried that my layers are not connected as they should be, in the visualization(which I will upload) I can recognize some things like multi-head and linear layer, but I still think that something is messed up(please don’t hate me if something is wrong, I’m just someone who codes as a hobby)<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/f/b/fba1cfa3caeadec8c86c3cbbbc4e89e798b64dca.png\" data-download-href=\"/uploads/short-url/zU2wtirIduLtnpi6RKyjX6ycM3g.png?dl=1\" title=\"ANALIZA2\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/b/fba1cfa3caeadec8c86c3cbbbc4e89e798b64dca_2_273x500.png\" alt=\"ANALIZA2\" data-base62-sha1=\"zU2wtirIduLtnpi6RKyjX6ycM3g\" width=\"273\" height=\"500\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/b/fba1cfa3caeadec8c86c3cbbbc4e89e798b64dca_2_273x500.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/b/fba1cfa3caeadec8c86c3cbbbc4e89e798b64dca_2_409x750.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/b/fba1cfa3caeadec8c86c3cbbbc4e89e798b64dca_2_546x1000.png 2x\" data-dominant-color=\"F7F8F8\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">ANALIZA2</span><span class=\"informations\">1584×2895 304 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-19T18:27:49.455Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 7, "readers_count": 6, "score": 26.4, "yours": false, "topic_id": 146507, "topic_slug": "need-help-with-analyzing-my-so-called-gpt", "display_username": "Kamil P", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87751, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/need-help-with-analyzing-my-so-called-gpt/146507/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210285, "name": "Kamil P", "username": "kamanakama", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/{size}.png", "created_at": "2025-03-20T13:04:44.463Z", "cooked": "<p>I have big update, I think I fixed everything cause now the graph looks like this:<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/f/c/fc89f66627e256939c21368ca04db28d47ea8ec0.png\" data-download-href=\"/uploads/short-url/A23Ua2BMQ7KwwIK3H66mJxMSGru.png?dl=1\" title=\"ANALIZAGPT\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/c/fc89f66627e256939c21368ca04db28d47ea8ec0_2_67x500.png\" alt=\"ANALIZAGPT\" data-base62-sha1=\"A23Ua2BMQ7KwwIK3H66mJxMSGru\" width=\"67\" height=\"500\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/c/fc89f66627e256939c21368ca04db28d47ea8ec0_2_67x500.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/c/fc89f66627e256939c21368ca04db28d47ea8ec0_2_100x750.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/c/fc89f66627e256939c21368ca04db28d47ea8ec0_2_134x1000.png 2x\" data-dominant-color=\"E9F2EA\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">ANALIZAGPT</span><span class=\"informations\">379×2793 158 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-20T13:04:44.463Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 15.8, "yours": false, "topic_id": 146507, "topic_slug": "need-help-with-analyzing-my-so-called-gpt", "display_username": "Kamil P", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87751, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/need-help-with-analyzing-my-so-called-gpt/146507/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210607, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-21T18:14:03.290Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-21T18:14:03.290Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 1, "readers_count": 0, "score": 0.2, "yours": false, "topic_id": 146507, "topic_slug": "need-help-with-analyzing-my-so-called-gpt", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/need-help-with-analyzing-my-so-called-gpt/146507/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi, everyone I just started programming GPT model almost all by myself after some patches it started working and now I’m worried that my layers are not connected as they should be, in the visualization(which I will upload) I can recognize some things like multi-head and linear layer, but I still think that something is messed up(please don’t hate me if something is wrong, I’m just someone who codes as a hobby)<br> <div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/f/b/fba1cfa3caeadec8c86c3cbbbc4e89e798b64dca.png" data-download-href="/uploads/short-url/zU2wtirIduLtnpi6RKyjX6ycM3g.png?dl=1" title="ANALIZA2" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/b/fba1cfa3caeadec8c86c3cbbbc4e89e798b64dca_2_273x500.png" alt="ANALIZA2" data-base62-sha1="zU2wtirIduLtnpi6RKyjX6ycM3g" width="273" height="500" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/b/fba1cfa3caeadec8c86c3cbbbc4e89e798b64dca_2_273x500.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/b/fba1cfa3caeadec8c86c3cbbbc4e89e798b64dca_2_409x750.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/b/fba1cfa3caeadec8c86c3cbbbc4e89e798b64dca_2_546x1000.png 2x" data-dominant-color="F7F8F8"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">ANALIZA2</span><span class="informations">1584×2895 304 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>I have big update, I think I fixed everything cause now the graph looks like this:<br> <div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/f/c/fc89f66627e256939c21368ca04db28d47ea8ec0.png" data-download-href="/uploads/short-url/A23Ua2BMQ7KwwIK3H66mJxMSGru.png?dl=1" title="ANALIZAGPT" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/c/fc89f66627e256939c21368ca04db28d47ea8ec0_2_67x500.png" alt="ANALIZAGPT" data-base62-sha1="A23Ua2BMQ7KwwIK3H66mJxMSGru" width="67" height="500" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/c/fc89f66627e256939c21368ca04db28d47ea8ec0_2_67x500.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/c/fc89f66627e256939c21368ca04db28d47ea8ec0_2_100x750.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/c/fc89f66627e256939c21368ca04db28d47ea8ec0_2_134x1000.png 2x" data-dominant-color="E9F2EA"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">ANALIZAGPT</span><span class="informations">379×2793 158 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
How to use a LLM for specific task
https://discuss.huggingface.co/t/how-to-use-a-llm-for-specific-task/145710
145,710
5
2025-03-14T05:59:16.057000Z
[ { "id": 209011, "name": "Mohammad Safa Kamali", "username": "safakamali", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/e274bd/{size}.png", "created_at": "2025-03-14T05:59:16.125Z", "cooked": "<p>Hello,<br>\nFor example I want my LLM learn a pdf file.<br>\nIts good to send pdf text for it or finetunning?<br>\nif I want to my llm send response in a specific format, Its good to use system-instructions or fine tune?<br>\nCan you give me a guide or some links about it?</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-14T05:59:16.125Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 56, "reads": 11, "readers_count": 10, "score": 292.2, "yours": false, "topic_id": 145710, "topic_slug": "how-to-use-a-llm-for-specific-task", "display_username": "Mohammad Safa Kamali", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87142, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-use-a-llm-for-specific-task/145710/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209038, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-14T08:46:47.081Z", "cooked": "<p>If you want to treat a PDF as text, you can simply use a Python library to extract the text data, clean it up, and use it for fine-tuning.</p>\n<p>On the other hand, if you want to treat PDFs as images that contain both text and layout, it becomes more complicated, and it is more in the realm of VLM or multimodal models than LLM. In this case, you can either convert the PDF to an image first, or use a more complicated method.</p>\n<p>Also, if you want to have a chatbot accurately interpret PDFs, it is probably easier in the end to use a system called RAG. Find a method that seems to fit your use case. I think it’s a good idea to try out various finished products in Spaces first.</p>\n<h3><a name=\"p-209038-pdf-rag-llm-vlm-spaces-1\" class=\"anchor\" href=\"#p-209038-pdf-rag-llm-vlm-spaces-1\"></a>PDF (RAG / LLM / VLM, …) Spaces</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/spaces?q=pdf&amp;sort=trending\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/spaces?q=pdf&amp;sort=trending\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/3/f/3f219d23b16d4a243a12070474512a6d6730c841.png\" class=\"thumbnail\" data-dominant-color=\"F1F1F1\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/spaces?q=pdf&amp;sort=trending\" target=\"_blank\" rel=\"noopener\">Spaces - Hugging Face</a></h3>\n\n <p>Discover amazing ML apps made by the community</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-209038-pdf-extraction-tools-2\" class=\"anchor\" href=\"#p-209038-pdf-extraction-tools-2\"></a>PDF extraction tools</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://pymupdf.readthedocs.io/en/latest/pymupdf4llm/index.html\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/b/e/bef7ad34266c53691dbc7d95bc55fdc73e3cdc7e.png\" class=\"site-icon\" data-dominant-color=\"D3A282\" width=\"48\" height=\"48\">\n\n <a href=\"https://pymupdf.readthedocs.io/en/latest/pymupdf4llm/index.html\" target=\"_blank\" rel=\"noopener\">pymupdf.readthedocs.io</a>\n </header>\n\n <article class=\"onebox-body\">\n \n\n<h3><a href=\"https://pymupdf.readthedocs.io/en/latest/pymupdf4llm/index.html\" target=\"_blank\" rel=\"noopener\">PyMuPDF4LLM - PyMuPDF 1.25.3 documentation</a></h3>\n\n <p>PyMuPDF is a high-performance Python library for data extraction, analysis, conversion &amp; manipulation of PDF (and other) documents.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox githubrepo\" data-onebox-src=\"https://github.com/py-pdf/pypdf\">\n <header class=\"source\">\n\n <a href=\"https://github.com/py-pdf/pypdf\" target=\"_blank\" rel=\"noopener\">github.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\" data-github-private-repo=\"false\">\n <img width=\"690\" height=\"344\" src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/f/cff9bc17b71237ef26e945d9c2a302dc91893ba4_2_690x344.png\" class=\"thumbnail\" data-dominant-color=\"F0F2F1\">\n\n <h3><a href=\"https://github.com/py-pdf/pypdf\" target=\"_blank\" rel=\"noopener\">GitHub - py-pdf/pypdf: A pure-python PDF library capable of splitting,...</a></h3>\n\n <p><span class=\"github-repo-description\">A pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files</span></p>\n</div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://pypi.org/project/pdf2image/\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/9/29ba7ca565bfab70e52cd554afb988545ec26dfb.png\" class=\"site-icon\" data-dominant-color=\"F4F4F2\" width=\"32\" height=\"30\">\n\n <a href=\"https://pypi.org/project/pdf2image/\" target=\"_blank\" rel=\"noopener\">PyPI</a>\n </header>\n\n <article class=\"onebox-body\">\n <img width=\"300\" height=\"300\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/6/f/6f97026709e67b2111b465be6427519ead928642.webp\" class=\"thumbnail onebox-avatar\" data-dominant-color=\"EAEBE9\">\n\n<h3><a href=\"https://pypi.org/project/pdf2image/\" target=\"_blank\" rel=\"noopener\">pdf2image</a></h3>\n\n <p>A wrapper around the pdftoppm and pdftocairo command line tools to convert PDF to a PIL Image list.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-209038-about-rag-3\" class=\"anchor\" href=\"#p-209038-about-rag-3\"></a>about RAG</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/learn/cookbook/advanced_rag\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/learn/cookbook/advanced_rag\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/e/a/ea9cb8984ae142b418ec39bae9f1aee7ee6c224b_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F2F0EB\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/learn/cookbook/advanced_rag\" target=\"_blank\" rel=\"noopener\">Advanced RAG on Hugging Face documentation using LangChain - Hugging Face...</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-209038-vlm-4\" class=\"anchor\" href=\"#p-209038-vlm-4\"></a>VLM</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/5/a50ae69cb5c99b29e45086ea5d294c85d3c7748d_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5B70A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct\" target=\"_blank\" rel=\"noopener\">Qwen/Qwen2.5-VL-7B-Instruct · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/CohereForAI/aya-vision-8b\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/CohereForAI/aya-vision-8b\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/8/3/8365321eeb1e6cb7a95c2b2ff153e3ac60089130_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5B70A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/CohereForAI/aya-vision-8b\" target=\"_blank\" rel=\"noopener\">CohereForAI/aya-vision-8b · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-14T08:46:47.081Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 5, "reads": 9, "readers_count": 8, "score": 41.8, "yours": false, "topic_id": 145710, "topic_slug": "how-to-use-a-llm-for-specific-task", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/learn/cookbook/advanced_rag", "internal": false, "reflection": false, "title": "Advanced RAG on Hugging Face documentation using LangChain - Hugging Face Open-Source AI Cookbook", "clicks": 5 }, { "url": "https://pymupdf.readthedocs.io/en/latest/pymupdf4llm/index.html", "internal": false, "reflection": false, "title": "PyMuPDF4LLM - PyMuPDF 1.25.3 documentation", "clicks": 3 }, { "url": "https://huggingface.co/spaces?q=pdf&sort=trending", "internal": false, "reflection": false, "title": "Spaces - Hugging Face", "clicks": 2 }, { "url": "https://huggingface.co/CohereForAI/aya-vision-8b", "internal": false, "reflection": false, "title": "CohereForAI/aya-vision-8b · Hugging Face", "clicks": 1 }, { "url": "https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct", "internal": false, "reflection": false, "title": "Qwen/Qwen2.5-VL-7B-Instruct · Hugging Face", "clicks": 1 }, { "url": "https://github.com/py-pdf/pypdf", "internal": false, "reflection": false, "title": "GitHub - py-pdf/pypdf: A pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files", "clicks": 0 }, { "url": "https://pypi.org/project/pdf2image/", "internal": false, "reflection": false, "title": "pdf2image · PyPI", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-use-a-llm-for-specific-task/145710/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210530, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-21T11:22:52.123Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-21T11:22:52.123Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 1, "readers_count": 0, "score": 5.2, "yours": false, "topic_id": 145710, "topic_slug": "how-to-use-a-llm-for-specific-task", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-use-a-llm-for-specific-task/145710/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello,<br> For example I want my LLM learn a pdf file.<br> Its good to send pdf text for it or finetunning?<br> if I want to my llm send response in a specific format, Its good to use system-instructions or fine tune?<br> Can you give me a guide or some links about it?</p>
<p>If you want to treat a PDF as text, you can simply use a Python library to extract the text data, clean it up, and use it for fine-tuning.</p> <p>On the other hand, if you want to treat PDFs as images that contain both text and layout, it becomes more complicated, and it is more in the realm of VLM or multimodal models than LLM. In this case, you can either convert the PDF to an image first, or use a more complicated method.</p> <p>Also, if you want to have a chatbot accurately interpret PDFs, it is probably easier in the end to use a system called RAG. Find a method that seems to fit your use case. I think it’s a good idea to try out various finished products in Spaces first.</p> <h3><a name="p-209038-pdf-rag-llm-vlm-spaces-1" class="anchor" href="#p-209038-pdf-rag-llm-vlm-spaces-1"></a>PDF (RAG / LLM / VLM, …) Spaces</h3> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/spaces?q=pdf&amp;sort=trending"> <header class="source"> <a href="https://huggingface.co/spaces?q=pdf&amp;sort=trending" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/3/f/3f219d23b16d4a243a12070474512a6d6730c841.png" class="thumbnail" data-dominant-color="F1F1F1" width="690" height="372"></div> <h3><a href="https://huggingface.co/spaces?q=pdf&amp;sort=trending" target="_blank" rel="noopener">Spaces - Hugging Face</a></h3> <p>Discover amazing ML apps made by the community</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <h3><a name="p-209038-pdf-extraction-tools-2" class="anchor" href="#p-209038-pdf-extraction-tools-2"></a>PDF extraction tools</h3> <aside class="onebox allowlistedgeneric" data-onebox-src="https://pymupdf.readthedocs.io/en/latest/pymupdf4llm/index.html"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/b/e/bef7ad34266c53691dbc7d95bc55fdc73e3cdc7e.png" class="site-icon" data-dominant-color="D3A282" width="48" height="48"> <a href="https://pymupdf.readthedocs.io/en/latest/pymupdf4llm/index.html" target="_blank" rel="noopener">pymupdf.readthedocs.io</a> </header> <article class="onebox-body"> <h3><a href="https://pymupdf.readthedocs.io/en/latest/pymupdf4llm/index.html" target="_blank" rel="noopener">PyMuPDF4LLM - PyMuPDF 1.25.3 documentation</a></h3> <p>PyMuPDF is a high-performance Python library for data extraction, analysis, conversion &amp; manipulation of PDF (and other) documents.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox githubrepo" data-onebox-src="https://github.com/py-pdf/pypdf"> <header class="source"> <a href="https://github.com/py-pdf/pypdf" target="_blank" rel="noopener">github.com</a> </header> <article class="onebox-body"> <div class="github-row" data-github-private-repo="false"> <img width="690" height="344" src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/f/cff9bc17b71237ef26e945d9c2a302dc91893ba4_2_690x344.png" class="thumbnail" data-dominant-color="F0F2F1"> <h3><a href="https://github.com/py-pdf/pypdf" target="_blank" rel="noopener">GitHub - py-pdf/pypdf: A pure-python PDF library capable of splitting,...</a></h3> <p><span class="github-repo-description">A pure-python PDF library capable of splitting, merging, cropping, and transforming the pages of PDF files</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://pypi.org/project/pdf2image/"> <header class="source"> <img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/2/9/29ba7ca565bfab70e52cd554afb988545ec26dfb.png" class="site-icon" data-dominant-color="F4F4F2" width="32" height="30"> <a href="https://pypi.org/project/pdf2image/" target="_blank" rel="noopener">PyPI</a> </header> <article class="onebox-body"> <img width="300" height="300" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/6/f/6f97026709e67b2111b465be6427519ead928642.webp" class="thumbnail onebox-avatar" data-dominant-color="EAEBE9"> <h3><a href="https://pypi.org/project/pdf2image/" target="_blank" rel="noopener">pdf2image</a></h3> <p>A wrapper around the pdftoppm and pdftocairo command line tools to convert PDF to a PIL Image list.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <h3><a name="p-209038-about-rag-3" class="anchor" href="#p-209038-about-rag-3"></a>about RAG</h3> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/learn/cookbook/advanced_rag"> <header class="source"> <a href="https://huggingface.co/learn/cookbook/advanced_rag" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/e/a/ea9cb8984ae142b418ec39bae9f1aee7ee6c224b_2_690x372.png" class="thumbnail" data-dominant-color="F2F0EB" width="690" height="372"></div> <h3><a href="https://huggingface.co/learn/cookbook/advanced_rag" target="_blank" rel="noopener">Advanced RAG on Hugging Face documentation using LangChain - Hugging Face...</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <h3><a name="p-209038-vlm-4" class="anchor" href="#p-209038-vlm-4"></a>VLM</h3> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct"> <header class="source"> <a href="https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/5/a50ae69cb5c99b29e45086ea5d294c85d3c7748d_2_690x372.png" class="thumbnail" data-dominant-color="5B70A4" width="690" height="372"></div> <h3><a href="https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct" target="_blank" rel="noopener">Qwen/Qwen2.5-VL-7B-Instruct · Hugging Face</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/CohereForAI/aya-vision-8b"> <header class="source"> <a href="https://huggingface.co/CohereForAI/aya-vision-8b" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/8/3/8365321eeb1e6cb7a95c2b2ff153e3ac60089130_2_690x372.png" class="thumbnail" data-dominant-color="5B70A4" width="690" height="372"></div> <h3><a href="https://huggingface.co/CohereForAI/aya-vision-8b" target="_blank" rel="noopener">CohereForAI/aya-vision-8b · Hugging Face</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Monthly Payment
https://discuss.huggingface.co/t/monthly-payment/146634
146,634
2
2025-03-20T13:20:46.347000Z
[ { "id": 210288, "name": "Marvin Coto", "username": "marvincoto", "avatar_template": "/user_avatar/discuss.huggingface.co/marvincoto/{size}/43707_2.png", "created_at": "2025-03-20T13:20:46.421Z", "cooked": "<p>Hello!</p>\n<p>I am currently taking the Agents course and would like to have more inference balance for extensive experimentation. I am considering upgrading to a Pro account for this purpose. Do you think the Pro account is the best choice for my needs?</p>\n<p>Additionally, I am unsure about the pricing structure. Is the cost $9/month with an annual charge, or can I cancel at any time?</p>\n<p>Thank you in advance for your help!</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-20T13:20:46.421Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 32, "reads": 10, "readers_count": 9, "score": 162, "yours": false, "topic_id": 146634, "topic_slug": "monthly-payment", "display_username": "Marvin Coto", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87849, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/monthly-payment/146634/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210297, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-20T13:50:03.350Z", "cooked": "<p>At the moment, there doesn’t seem to be a pay-as-you-go option for Inference, so if you want to complete it within HF, that seems to be the only way.</p>\n<p>The $9 payment is made on a monthly basis. I think you can cancel on a monthly basis. Also, as a common point of caution, payments will fail if you use a debit or prepaid card. For more information, it’s best to contact the following.<br>\n<a href=\"mailto:[email protected]\">[email protected]</a></p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-20T13:50:03.350Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 10, "readers_count": 9, "score": 22, "yours": false, "topic_id": 146634, "topic_slug": "monthly-payment", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/monthly-payment/146634/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210430, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-21T02:59:47.200Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-21T02:59:47.200Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 1, "yours": false, "topic_id": 146634, "topic_slug": "monthly-payment", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/monthly-payment/146634/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello!</p> <p>I am currently taking the Agents course and would like to have more inference balance for extensive experimentation. I am considering upgrading to a Pro account for this purpose. Do you think the Pro account is the best choice for my needs?</p> <p>Additionally, I am unsure about the pricing structure. Is the cost $9/month with an annual charge, or can I cancel at any time?</p> <p>Thank you in advance for your help!</p>
<p>At the moment, there doesn’t seem to be a pay-as-you-go option for Inference, so if you want to complete it within HF, that seems to be the only way.</p> <p>The $9 payment is made on a monthly basis. I think you can cancel on a monthly basis. Also, as a common point of caution, payments will fail if you use a debit or prepaid card. For more information, it’s best to contact the following.<br> <a href="mailto:[email protected]">[email protected]</a></p>
Websockets &gt;= 14 support for gardio spaces
https://discuss.huggingface.co/t/websockets-14-support-for-gardio-spaces/144693
144,693
24
2025-03-07T22:03:22.617000Z
[ { "id": 207640, "name": "Volnov Sergey", "username": "sergak0", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/{size}.png", "created_at": "2025-03-07T22:03:22.701Z", "cooked": "<p>Hey there, I am using gardio spaces to host a leaderboard and during calculating leaderboard I use libs that requires a new version of websockets lib (&gt;= 14).</p>\n<p>Unfortunately, in docker file that is used for gardio space after installing custom requirements.txt, there are going default installs that overwrite my websockets lib with the older version (12.0.1).</p>\n<p>I think it’s one of this lines:</p>\n<pre><code class=\"lang-auto\">RUN pip install --no-cache-dir pip -U &amp;&amp; \tpip install --no-cache-dir \tdatasets \t\"huggingface-hub&gt;=0.19\" \"hf-transfer&gt;=0.1.4\" \"protobuf&lt;4\" \"click&lt;8.1\" \"pydantic~=1.0\"\nRUN pip install --no-cache-dir \tgradio[oauth]==4.42.0 \t\"uvicorn&gt;=0.14.0\" \tspaces \"fastapi&lt;0.113.0\"\n</code></pre>\n<p>So, I wanted to ask whether is possible to modify this default gardio dockerfile by myself or can you add a support for the newer version of websockets?</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-07T22:03:22.701Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 23, "reads": 7, "readers_count": 6, "score": 121.4, "yours": false, "topic_id": 144693, "topic_slug": "websockets-14-support-for-gardio-spaces", "display_username": "Volnov Sergey", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/chainlit-websocket-issue-on-hugging-face-spaces-missing-websockets-in-requirements/146755/2", "internal": true, "reflection": true, "title": "Chainlit WebSocket Issue on Hugging Face Spaces: Missing websockets in Requirements?", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 5719, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/websockets-14-support-for-gardio-spaces/144693/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207670, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-08T05:06:33.054Z", "cooked": "<blockquote>\n<p>gradio[oauth]==4.42.0</p>\n</blockquote>\n<p>The culprit is probably in this line.</p>\n<p>I don’t think it’s possible to customize the Docker image for the Gradio space in detail. Of course it is possible with the Docker space.</p>\n<p>In the case of the Gradio space, if you change the sdk_version below, the Gradio version will also change, so if you use a newer version of Gradio, it should solve the problem. (Currently 5.20.0)<br>\nWell, Gradio has a lot of backward compatibility issues, so you’ll probably need to rewrite a few lines of the GUI code…</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/hub/spaces-config-reference\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/hub/spaces-config-reference\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"FAF8F2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/hub/spaces-config-reference\" target=\"_blank\" rel=\"noopener\">Spaces Configuration Reference</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<blockquote>\n<p><strong><code>sdk_version</code></strong> : <em>string</em><br>\nSpecify the version of the selected SDK (Streamlit or Gradio).<br>\nAll versions of Gradio are supported.<br>\nAll versions of Streamlit from <code>0.79.0</code> are supported.</p>\n</blockquote>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-08T05:06:33.054Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 26.6, "yours": false, "topic_id": 144693, "topic_slug": "websockets-14-support-for-gardio-spaces", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/hub/spaces-config-reference", "internal": false, "reflection": false, "title": "Spaces Configuration Reference", "clicks": 4 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/websockets-14-support-for-gardio-spaces/144693/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210294, "name": "Volnov Sergey", "username": "sergak0", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/{size}.png", "created_at": "2025-03-20T13:28:27.742Z", "cooked": "<p>Yeah, it worked, thanks</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-20T13:28:27.742Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 16.2, "yours": false, "topic_id": 144693, "topic_slug": "websockets-14-support-for-gardio-spaces", "display_username": "Volnov Sergey", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 5719, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/websockets-14-support-for-gardio-spaces/144693/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 210423, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-21T01:28:42.221Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-03-21T01:28:42.221Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 1, "yours": false, "topic_id": 144693, "topic_slug": "websockets-14-support-for-gardio-spaces", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/websockets-14-support-for-gardio-spaces/144693/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hey there, I am using gardio spaces to host a leaderboard and during calculating leaderboard I use libs that requires a new version of websockets lib (&gt;= 14).</p> <p>Unfortunately, in docker file that is used for gardio space after installing custom requirements.txt, there are going default installs that overwrite my websockets lib with the older version (12.0.1).</p> <p>I think it’s one of this lines:</p> <pre><code class="lang-auto">RUN pip install --no-cache-dir pip -U &amp;&amp; pip install --no-cache-dir datasets "huggingface-hub&gt;=0.19" "hf-transfer&gt;=0.1.4" "protobuf&lt;4" "click&lt;8.1" "pydantic~=1.0" RUN pip install --no-cache-dir gradio[oauth]==4.42.0 "uvicorn&gt;=0.14.0" spaces "fastapi&lt;0.113.0" </code></pre> <p>So, I wanted to ask whether is possible to modify this default gardio dockerfile by myself or can you add a support for the newer version of websockets?</p>
<blockquote> <p>gradio[oauth]==4.42.0</p> </blockquote> <p>The culprit is probably in this line.</p> <p>I don’t think it’s possible to customize the Docker image for the Gradio space in detail. Of course it is possible with the Docker space.</p> <p>In the case of the Gradio space, if you change the sdk_version below, the Gradio version will also change, so if you use a newer version of Gradio, it should solve the problem. (Currently 5.20.0)<br> Well, Gradio has a lot of backward compatibility issues, so you’ll probably need to rewrite a few lines of the GUI code…</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/hub/spaces-config-reference"> <header class="source"> <a href="https://huggingface.co/docs/hub/spaces-config-reference" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png" class="thumbnail" data-dominant-color="FAF8F2" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/hub/spaces-config-reference" target="_blank" rel="noopener">Spaces Configuration Reference</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <blockquote> <p><strong><code>sdk_version</code></strong> : <em>string</em><br> Specify the version of the selected SDK (Streamlit or Gradio).<br> All versions of Gradio are supported.<br> All versions of Streamlit from <code>0.79.0</code> are supported.</p> </blockquote>
Clear GPU memory of transformers.pipeline
https://discuss.huggingface.co/t/clear-gpu-memory-of-transformers-pipeline/18310
18,310
5
2022-05-24T14:46:37.426000Z
[ { "id": 36931, "name": "Simon Duerr", "username": "simonduerr", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c57346/{size}.png", "created_at": "2022-05-24T14:46:37.493Z", "cooked": "<p>Whats the best way to clear the GPU memory on Huggingface spaces? I’m using <code>transformers.pipeline</code> for one of the models, the second is custom. I tried the following:</p>\n<pre><code class=\"lang-auto\">from transformers import pipeline\nm = pipeline(\"text-generation\", model=\"xx/xx\")\nres = m( .... )\ndel m\ntorch.cuda.empty_cache()\n</code></pre>\n<p>What else can I do to free up memory after each call to one of the models?</p>", "post_number": 1, "post_type": 1, "posts_count": 7, "updated_at": "2022-05-24T14:46:37.493Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 24566, "reads": 500, "readers_count": 499, "score": 122714.4, "yours": false, "topic_id": 18310, "topic_slug": "clear-gpu-memory-of-transformers-pipeline", "display_username": "Simon Duerr", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/is-there-a-way-to-terminate-llm-generate-and-release-the-gpu-memory-for-next-prompt/138853/2", "internal": true, "reflection": true, "title": "Is there a way to terminate llm.generate and release the GPU memory for next prompt?", "clicks": 9 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 7908, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/clear-gpu-memory-of-transformers-pipeline/18310/1", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 36982, "name": "Simon Duerr", "username": "simonduerr", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c57346/{size}.png", "created_at": "2022-05-25T09:15:21.670Z", "cooked": "<pre><code class=\"lang-auto\">from numba import cuda\ndevice = cuda.get_current_device()\ndevice.reset()\n</code></pre>\n<p>For the pipeline this seems to work. GPutil shows 91% utilization before and 0% utilization afterwards and the model can be rerun multiple times.</p>\n<p>I have Runtime errors with this on Huggingface spaces though.</p>", "post_number": 2, "post_type": 1, "posts_count": 7, "updated_at": "2022-05-25T10:08:34.920Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 331, "reads": 491, "readers_count": 490, "score": 1812.6, "yours": false, "topic_id": 18310, "topic_slug": "clear-gpu-memory-of-transformers-pipeline", "display_username": "Simon Duerr", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 4 } ], "moderator": false, "admin": false, "staff": false, "user_id": 7908, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/clear-gpu-memory-of-transformers-pipeline/18310/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 2 }, { "id": "+1", "type": "emoji", "count": 1 }, { "id": "clap", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 4, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 36998, "name": "Simon Duerr", "username": "simonduerr", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c57346/{size}.png", "created_at": "2022-05-25T11:39:02.471Z", "cooked": "<p>Another solution that is more elegant and automatically does the cleanup is using <code>ray.remote</code>. I wrapped the model inference using remote and it works out of the box <img src=\"https://emoji.discourse-cdn.com/apple/slight_smile.png?v=12\" title=\":slight_smile:\" class=\"emoji\" alt=\":slight_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 3, "post_type": 1, "posts_count": 7, "updated_at": "2022-05-25T11:39:02.471Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 624, "reads": 476, "readers_count": 475, "score": 3229.6, "yours": false, "topic_id": 18310, "topic_slug": "clear-gpu-memory-of-transformers-pipeline", "display_username": "Simon Duerr", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 7908, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/clear-gpu-memory-of-transformers-pipeline/18310/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 62577, "name": "Craig Varrichio", "username": "canthony", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/f19dbf/{size}.png", "created_at": "2023-03-27T16:32:49.531Z", "cooked": "<p>This is a very interesting solution with does in fact clear up 100% of memory utilization. However, when I try to run or reconstruct my pipeline immediately after that I now get a “CUDA error: invalid argument<br>\nCUDA kernel errors might be asynchronously reported at some other API call” message which I cannot resolve. This may be the same runtime error you referred to.</p>", "post_number": 4, "post_type": 1, "posts_count": 7, "updated_at": "2023-03-27T16:32:49.531Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 410, "reads": 395, "readers_count": 394, "score": 2143.4, "yours": false, "topic_id": 18310, "topic_slug": "clear-gpu-memory-of-transformers-pipeline", "display_username": "Craig Varrichio", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 17016, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/clear-gpu-memory-of-transformers-pipeline/18310/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 7908, "username": "simonduerr", "name": "Simon Duerr", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c57346/{size}.png" }, "action_code": null, "via_email": null }, { "id": 62579, "name": "Simon Duerr", "username": "simonduerr", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c57346/{size}.png", "created_at": "2023-03-27T16:45:24.383Z", "cooked": "<p><a class=\"mention\" href=\"/u/canthony\">@canthony</a> You probably need to wrap everything inside the ray.remote actor and set max_calls=1 to ensure that it is not going to be reused.</p>\n<p>See example here <a href=\"https://huggingface.co/spaces/simonduerr/ProteinMPNN/blob/21af4a534fd0c9f767228c87028f8fe50e7a6179/app.py#L200\" class=\"inline-onebox\">app.py · simonduerr/ProteinMPNN at 21af4a534fd0c9f767228c87028f8fe50e7a6179</a></p>", "post_number": 5, "post_type": 1, "posts_count": 7, "updated_at": "2023-03-27T16:45:24.383Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 231, "reads": 368, "readers_count": 367, "score": 1248, "yours": false, "topic_id": 18310, "topic_slug": "clear-gpu-memory-of-transformers-pipeline", "display_username": "Simon Duerr", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/spaces/simonduerr/ProteinMPNN/blob/21af4a534fd0c9f767228c87028f8fe50e7a6179/app.py#L200", "internal": false, "reflection": false, "title": "app.py · simonduerr/ProteinMPNN at 21af4a534fd0c9f767228c87028f8fe50e7a6179", "clicks": 1134 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 7908, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/clear-gpu-memory-of-transformers-pipeline/18310/5", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 197613, "name": "mmm", "username": "markba", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/m/838e76/{size}.png", "created_at": "2025-01-24T16:08:54.809Z", "cooked": "<pre><code class=\"lang-auto\">with torch.no_grad():\n res = m( .... )\n</code></pre>", "post_number": 6, "post_type": 1, "posts_count": 7, "updated_at": "2025-01-24T16:08:54.809Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 14, "reads": 32, "readers_count": 31, "score": 91, "yours": false, "topic_id": 18310, "topic_slug": "clear-gpu-memory-of-transformers-pipeline", "display_username": "mmm", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 75930, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/clear-gpu-memory-of-transformers-pipeline/18310/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 210076, "name": "Daniel F. Perez-Ramirez", "username": "danfperam", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/b4bc9f/{size}.png", "created_at": "2025-03-19T14:03:17.555Z", "cooked": "<p>As I understand, you are loading your model on each ray.remote call correct? Why not passing the model object as argumnet to the ray.remote function?</p>", "post_number": 7, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-19T14:03:17.555Z", "reply_count": 0, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 16, "reads": 21, "readers_count": 20, "score": 98.8, "yours": false, "topic_id": 18310, "topic_slug": "clear-gpu-memory-of-transformers-pipeline", "display_username": "Daniel F. Perez-Ramirez", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 68005, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/clear-gpu-memory-of-transformers-pipeline/18310/7", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 7908, "username": "simonduerr", "name": "Simon Duerr", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c57346/{size}.png" }, "action_code": null, "via_email": null } ]
<p>Whats the best way to clear the GPU memory on Huggingface spaces? I’m using <code>transformers.pipeline</code> for one of the models, the second is custom. I tried the following:</p> <pre><code class="lang-auto">from transformers import pipeline m = pipeline("text-generation", model="xx/xx") res = m( .... ) del m torch.cuda.empty_cache() </code></pre> <p>What else can I do to free up memory after each call to one of the models?</p>
<p>Another solution that is more elegant and automatically does the cleanup is using <code>ray.remote</code>. I wrapped the model inference using remote and it works out of the box <img src="https://emoji.discourse-cdn.com/apple/slight_smile.png?v=12" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
TRL SFTTrainer 0.15 compute_token_accuracy error
https://discuss.huggingface.co/t/trl-sfttrainer-0-15-compute-token-accuracy-error/142011
142,011
9
2025-02-20T12:57:53.997000Z
[ { "id": 204103, "name": "Róbert Belanec", "username": "rbelanec", "avatar_template": "/user_avatar/discuss.huggingface.co/rbelanec/{size}/32117_2.png", "created_at": "2025-02-20T12:57:54.064Z", "cooked": "<p>I have updated my version of TRL from 0.11 to 0.15. When training LLaMa3.1-8b-Instruct, I get an error:</p>\n<pre><code class=\"lang-auto\">Traceback (most recent call last):\n File \"/home/jovyan/prompt-arithmetics/llama31_instruct_pt.py\", line 328, in &lt;module&gt;\n trainer.train()\n File \"/home/jovyan/my-conda-envs/tpv/lib/python3.12/site-packages/transformers/trainer.py\", line 2241, in train\n return inner_training_loop(\n ^^^^^^^^^^^^^^^^^^^^\n File \"/home/jovyan/my-conda-envs/tpv/lib/python3.12/site-packages/transformers/trainer.py\", line 2548, in _inner_training_loop\n tr_loss_step = self.training_step(model, inputs, num_items_in_batch)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/jovyan/my-conda-envs/tpv/lib/python3.12/site-packages/transformers/trainer.py\", line 3698, in training_step\n loss = self.compute_loss(model, inputs, num_items_in_batch=num_items_in_batch)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/jovyan/my-conda-envs/tpv/lib/python3.12/site-packages/trl/trainer/sft_trainer.py\", line 453, in compute_loss\n accuracy = compute_token_accuracy(shift_logits, shift_labels)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/jovyan/my-conda-envs/tpv/lib/python3.12/site-packages/trl/trainer/utils.py\", line 1664, in compute_token_accuracy\n correct_predictions = (predictions == labels) &amp; mask\n ^^^^^^^^^^^^^^^^^^^^^\nRuntimeError: The size of tensor a (355) must match the size of tensor b (255) at non-singleton dimension 1\n</code></pre>\n<p>I have traced that the compute_loss method from the transformers Trainer class was overridden by the SFTTraininr in 0.15 version. But I have no idea why this is happening. The problem is probably that the label size differs from the size of the model outputs. I have set max_seq_lenght in SFTConfig to 512.</p>\n<p>Here is how I initialize the tokenizer and model (nothing special really):</p>\n<pre><code class=\"lang-auto\"> model = AutoModelForCausalLM.from_pretrained(\n model_args.model_name_or_path,\n torch_dtype=torch.bfloat16,\n ).to(\"cuda\")\n model.active_adapters = [\n \"default\"\n ] # fix because llama has some active adapters for some reason\n model = get_peft_model(model, peft_config=peft_config)\n\n tokenizer = AutoTokenizer.from_pretrained(\n data_args.data_tokenizer_name_or_path,\n trust_remote_code=True,\n padding_side=\"right\",\n )\n tokenizer.add_special_tokens({\"pad_token\": \"&lt;|reserved_special_token_0|&gt;\"})\n model.config.pad_token_id = tokenizer.pad_token_id\n model.generation_config.pad_token_id = tokenizer.pad_token_id\n</code></pre>\n<p>Does anyone have an idea what could be causing the error?</p>\n<p>Thank you!</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-02-20T12:57:54.064Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 186, "reads": 9, "readers_count": 8, "score": 946.8, "yours": false, "topic_id": 142011, "topic_slug": "trl-sfttrainer-0-15-compute-token-accuracy-error", "display_username": "Róbert Belanec", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 65741, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/trl-sfttrainer-0-15-compute-token-accuracy-error/142011/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209787, "name": "Róbert Belanec", "username": "rbelanec", "avatar_template": "/user_avatar/discuss.huggingface.co/rbelanec/{size}/32117_2.png", "created_at": "2025-03-18T11:46:16.046Z", "cooked": "<h2><a name=\"p-209787-solution-with-explanation-1\" class=\"anchor\" href=\"#p-209787-solution-with-explanation-1\"></a><strong>Solution with explanation</strong></h2>\n<p>So, I have realized that this problem persists only when using prompt tuning with SFTTrainer and CausalLM models. This is because prompt tuning prepends trainable embeddings to the input embeddings, and due to the auto-regressive process of forward function the <em>prepended soft-prompt of length 100 was also outputted in the model outputs</em>.</p>\n<p>I am not sure if this is the problem of the PEFT library implementation of prompt tuning for CausalLM or whether this is the desired behavior and needs to be fixed on the TRL SFTTrainer side. I managed to create a quick workaround by slicing the first n_vritual_tokens of the outputs if prompt tuning is used in the compute_loss method:</p>\n<pre><code class=\"lang-auto\">def compute_loss(self, model, inputs, return_outputs=False, num_items_in_batch=None):\n \"\"\"\n Compute training loss and additionally compute token accuracies\n \"\"\"\n (loss, outputs) = super().compute_loss(\n model, inputs, return_outputs=True, num_items_in_batch=num_items_in_batch\n )\n\n # Compute token accuracy if we have labels and if the model is not using Liger (no logits)\n if \"labels\" in inputs and not self.args.use_liger:\n if isinstance(model, PeftModel) and model.peft_type == PeftType.PROMPT_TUNING:\n num_virtual_tokens = model.peft_config[\"default\"].num_virtual_tokens\n shift_logits = outputs.logits[..., :-(1+num_virtual_tokens), :].contiguous()\n else:\n shift_logits = outputs.logits[..., :-1, :].contiguous()\n \n shift_labels = inputs[\"labels\"][..., 1:].contiguous()\n</code></pre>\n<p>For some reason, the token accuracy is still really low (compared to using LoRA). I may have to investigate even further, and I will probably open a PR to fix this.</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-18T11:46:16.046Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 31, "reads": 8, "readers_count": 7, "score": 171.6, "yours": false, "topic_id": 142011, "topic_slug": "trl-sfttrainer-0-15-compute-token-accuracy-error", "display_username": "Róbert Belanec", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 65741, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/trl-sfttrainer-0-15-compute-token-accuracy-error/142011/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209921, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-18T23:46:44.650Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-18T23:46:44.650Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 6, "reads": 6, "readers_count": 5, "score": 31.2, "yours": false, "topic_id": 142011, "topic_slug": "trl-sfttrainer-0-15-compute-token-accuracy-error", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/trl-sfttrainer-0-15-compute-token-accuracy-error/142011/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I have updated my version of TRL from 0.11 to 0.15. When training LLaMa3.1-8b-Instruct, I get an error:</p> <pre><code class="lang-auto">Traceback (most recent call last): File "/home/jovyan/prompt-arithmetics/llama31_instruct_pt.py", line 328, in &lt;module&gt; trainer.train() File "/home/jovyan/my-conda-envs/tpv/lib/python3.12/site-packages/transformers/trainer.py", line 2241, in train return inner_training_loop( ^^^^^^^^^^^^^^^^^^^^ File "/home/jovyan/my-conda-envs/tpv/lib/python3.12/site-packages/transformers/trainer.py", line 2548, in _inner_training_loop tr_loss_step = self.training_step(model, inputs, num_items_in_batch) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jovyan/my-conda-envs/tpv/lib/python3.12/site-packages/transformers/trainer.py", line 3698, in training_step loss = self.compute_loss(model, inputs, num_items_in_batch=num_items_in_batch) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jovyan/my-conda-envs/tpv/lib/python3.12/site-packages/trl/trainer/sft_trainer.py", line 453, in compute_loss accuracy = compute_token_accuracy(shift_logits, shift_labels) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/jovyan/my-conda-envs/tpv/lib/python3.12/site-packages/trl/trainer/utils.py", line 1664, in compute_token_accuracy correct_predictions = (predictions == labels) &amp; mask ^^^^^^^^^^^^^^^^^^^^^ RuntimeError: The size of tensor a (355) must match the size of tensor b (255) at non-singleton dimension 1 </code></pre> <p>I have traced that the compute_loss method from the transformers Trainer class was overridden by the SFTTraininr in 0.15 version. But I have no idea why this is happening. The problem is probably that the label size differs from the size of the model outputs. I have set max_seq_lenght in SFTConfig to 512.</p> <p>Here is how I initialize the tokenizer and model (nothing special really):</p> <pre><code class="lang-auto"> model = AutoModelForCausalLM.from_pretrained( model_args.model_name_or_path, torch_dtype=torch.bfloat16, ).to("cuda") model.active_adapters = [ "default" ] # fix because llama has some active adapters for some reason model = get_peft_model(model, peft_config=peft_config) tokenizer = AutoTokenizer.from_pretrained( data_args.data_tokenizer_name_or_path, trust_remote_code=True, padding_side="right", ) tokenizer.add_special_tokens({"pad_token": "&lt;|reserved_special_token_0|&gt;"}) model.config.pad_token_id = tokenizer.pad_token_id model.generation_config.pad_token_id = tokenizer.pad_token_id </code></pre> <p>Does anyone have an idea what could be causing the error?</p> <p>Thank you!</p>
<h2><a name="p-209787-solution-with-explanation-1" class="anchor" href="#p-209787-solution-with-explanation-1"></a><strong>Solution with explanation</strong></h2> <p>So, I have realized that this problem persists only when using prompt tuning with SFTTrainer and CausalLM models. This is because prompt tuning prepends trainable embeddings to the input embeddings, and due to the auto-regressive process of forward function the <em>prepended soft-prompt of length 100 was also outputted in the model outputs</em>.</p> <p>I am not sure if this is the problem of the PEFT library implementation of prompt tuning for CausalLM or whether this is the desired behavior and needs to be fixed on the TRL SFTTrainer side. I managed to create a quick workaround by slicing the first n_vritual_tokens of the outputs if prompt tuning is used in the compute_loss method:</p> <pre><code class="lang-auto">def compute_loss(self, model, inputs, return_outputs=False, num_items_in_batch=None): """ Compute training loss and additionally compute token accuracies """ (loss, outputs) = super().compute_loss( model, inputs, return_outputs=True, num_items_in_batch=num_items_in_batch ) # Compute token accuracy if we have labels and if the model is not using Liger (no logits) if "labels" in inputs and not self.args.use_liger: if isinstance(model, PeftModel) and model.peft_type == PeftType.PROMPT_TUNING: num_virtual_tokens = model.peft_config["default"].num_virtual_tokens shift_logits = outputs.logits[..., :-(1+num_virtual_tokens), :].contiguous() else: shift_logits = outputs.logits[..., :-1, :].contiguous() shift_labels = inputs["labels"][..., 1:].contiguous() </code></pre> <p>For some reason, the token accuracy is still really low (compared to using LoRA). I may have to investigate even further, and I will probably open a PR to fix this.</p>
The dataset viewer only displays the videos and does not show other fields?
https://discuss.huggingface.co/t/the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields/145960
145,960
10
2025-03-16T07:59:20.748000Z
[ { "id": 209336, "name": "ZebangCheng", "username": "ZebangCheng", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/z/7bcc69/{size}.png", "created_at": "2025-03-16T07:59:20.828Z", "cooked": "<p>I created a Parquet file locally with the following content:</p>\n<pre><code class=\"lang-auto\"> video_id label description video_path\n0 00019.mp4 neutral It's me. test_hf_data/video/00019.mp4\n1 00020.mp4 surprise I remember it! test_hf_data/video/00020.mp4\n2 00021.mp4 anger I want to go home. test_hf_data/video/00021.mp4\n3 00022.mp4 fear I may die. test_hf_data/video/00022.mp4\n4 00024.mp4 happy I am beautiful! test_hf_data/video/00024.mp4\n</code></pre>\n<p>However, after uploading it to Hugging Face, the dataset viewer only displays the videos and does not show the <code>label</code>, <code>description</code>, <code>video_id</code>, or other fields. Why is this happening?</p>\n<blockquote>\n<p><a href=\"https://huggingface.co/datasets/ZebangCheng/test_hf_data\" class=\"inline-onebox\">ZebangCheng/test_hf_data · Datasets at Hugging Face</a></p>\n</blockquote>", "post_number": 1, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-16T07:59:20.828Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 41, "reads": 7, "readers_count": 6, "score": 216.4, "yours": false, "topic_id": 145960, "topic_slug": "the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields", "display_username": "ZebangCheng", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/datasets/ZebangCheng/test_hf_data", "internal": false, "reflection": false, "title": "ZebangCheng/test_hf_data · Datasets at Hugging Face", "clicks": 4 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 76499, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields/145960/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209342, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-16T09:05:36.538Z", "cooked": "<p>When I looked at the repository, it seems that it is not in the Hugging Face datasets library format. I think that is the cause.</p>\n<p>If you somehow load it in the datasets library and save it, it will be saved as a datasets library-style parquet automatically.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/datasets/package_reference/loading_methods#from-files\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/datasets/package_reference/loading_methods#from-files\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/5/35e852b936c2343e04e14f5d22299d4e04d553d8_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F8F5F0\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/datasets/package_reference/loading_methods#from-files\" target=\"_blank\" rel=\"noopener\">Loading methods</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"quote quote-modified\" data-post=\"1\" data-topic=\"15686\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://avatars.discourse-cdn.com/v4/letter/t/aca169/48.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/correct-way-to-create-a-dataset-from-a-csv-file/15686\">Correct way to create a Dataset from a csv file</a> <a class=\"badge-category__wrapper \" href=\"/c/beginners/5\"><span data-category-id=\"5\" style=\"--category-badge-color: #0088CC; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"Use this category for any basic question you have on any of the Hugging Face library. Don’t moderate yourself, everyone has to begin somewhere and everyone on this forum is here to help!\"><span class=\"badge-category__name\">Beginners</span></span></a>\n </div>\n <blockquote>\n Hi, Could somebody please point me to a beginner’s tutorial that \nwould enable to load a csv file in a dataset for a finetuning task. I completed such a task as a learning experience using the “opus_books” dataset and my DatasetDict takes the following form: \n\n\n\nbooks \nDatasetDict({ \ntrain: Dataset({ \nfeatures: [‘id’, ‘translation’], \nnum_rows: 127085 \n}) \n}) \n\n\n\nHowever, I’m struggling to get it right with a csv file. With the command \n\n\n\nluganda_dataset = load_dataset(‘csv’, data_files=‘Lugand…\n </blockquote>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/datasets/video_dataset\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/datasets/video_dataset\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/5/35e852b936c2343e04e14f5d22299d4e04d553d8_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F8F5F0\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/datasets/video_dataset\" target=\"_blank\" rel=\"noopener\">Create a video dataset</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-16T09:05:36.538Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 6, "reads": 7, "readers_count": 6, "score": 46.4, "yours": false, "topic_id": 145960, "topic_slug": "the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/datasets/package_reference/loading_methods#from-files", "internal": false, "reflection": false, "title": "Loading methods", "clicks": 4 }, { "url": "https://huggingface.co/docs/datasets/video_dataset", "internal": false, "reflection": false, "title": "Create a video dataset", "clicks": 2 }, { "url": "https://discuss.huggingface.co/t/correct-way-to-create-a-dataset-from-a-csv-file/15686", "internal": true, "reflection": false, "title": "Correct way to create a Dataset from a csv file", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields/145960/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209422, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-03-16T18:23:58.934Z", "cooked": "<p>Hi ! You should use a metadata file named “metadata.csv” (or .csv .parquet) with a file_name field and it will work <img src=\"https://emoji.discourse-cdn.com/apple/slight_smile.png?v=14\" title=\":slight_smile:\" class=\"emoji\" alt=\":slight_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>(Same as for image or audio datasets)</p>\n<p>I’ll update the docs soon</p>", "post_number": 3, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-16T18:23:58.934Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 36.2, "yours": false, "topic_id": 145960, "topic_slug": "the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields/145960/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209466, "name": "ZebangCheng", "username": "ZebangCheng", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/z/7bcc69/{size}.png", "created_at": "2025-03-17T01:42:17.218Z", "cooked": "<aside class=\"quote no-group\" data-username=\"lhoestq\" data-post=\"3\" data-topic=\"145960\">\n<div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lhoestq/48/52888_2.png\" class=\"avatar\"> lhoestq:</div>\n<blockquote>\n<p>metadata.csv</p>\n</blockquote>\n</aside>\n<hr>\n<p>Thank you for your reply.</p>\n<p>I used a <code>metadata.csv</code> file with the following format:</p>\n<pre><code class=\"lang-auto\">file_name,label,description \n00019.mp4,neutral,It's me. \n00020.mp4,surprise,I remember it! \n00021.mp4,anger,I want to go home. \n00022.mp4,fear,I may die. \n00024.mp4,happy,I am beautiful! \n</code></pre>\n<p>Then, I uploaded the dataset to Hugging Face using the following code:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">from datasets import load_dataset \nimport os \n\ndataset = load_dataset('csv', data_files={'train': 'test_hf_data_3/metadata.csv'}) \ndataset = dataset.map(lambda x: {\"video_path\": x['file_name']}) \n\ndataset.push_to_hub(\"ZebangCheng/test_hf_data_3\") \n</code></pre>\n<p>In the end, the uploaded data looks like this, and both <code>label</code> and <code>description</code> are displayed correctly:</p>\n<blockquote>\n<p><a href=\"https://huggingface.co/datasets/ZebangCheng/test_hf_data_3\" class=\"inline-onebox\">ZebangCheng/test_hf_data_3 · Datasets at Hugging Face</a></p>\n</blockquote>\n<p>However, the video is not displayed properly. I would like to use the Dataset Viewer to display both the video and other fields simultaneously. But this seems to be conflicting — when the video is displayed properly, the other fields (<code>label</code> and <code>description</code>) do not show, and when the other fields display correctly, the video doesn’t appear.</p>\n<p>I look forward to the updated documentation, as it would help me better understand how to handle this.</p>", "post_number": 4, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-17T01:42:17.218Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 1, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 16.4, "yours": false, "topic_id": 145960, "topic_slug": "the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields", "display_username": "ZebangCheng", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/datasets/ZebangCheng/test_hf_data_3", "internal": false, "reflection": false, "title": "ZebangCheng/test_hf_data_3 · Datasets at Hugging Face", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 76499, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields/145960/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209575, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-03-17T12:22:33.308Z", "cooked": "<p>You should upload your folder of [metadata.csv + videos] as is, I think <code>push_to_hub</code> doesn’t support video types well at the moment.</p>\n<p>e.g. using <a href=\"https://huggingface.co/docs/huggingface_hub/en/guides/upload#upload-a-folder\">HfApi().upload_folder(…)</a></p>", "post_number": 5, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-17T12:23:45.446Z", "reply_count": 2, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 26.2, "yours": false, "topic_id": 145960, "topic_slug": "the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/huggingface_hub/en/guides/upload#upload-a-folder", "internal": false, "reflection": false, "title": "Upload files to the Hub", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields/145960/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209750, "name": "ZebangCheng", "username": "ZebangCheng", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/z/7bcc69/{size}.png", "created_at": "2025-03-18T06:57:43.933Z", "cooked": "<p>Thank you for your guidance.</p>\n<p>I have found some open-source datasets and will follow their format to upload and display video data. If successful, I may write some blog posts to document the process and help others.</p>\n<p>Also, if the “documentation” you mentioned earlier is ready, please feel free to @ mention me.</p>\n<p>Thanks again!</p>", "post_number": 6, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-18T06:57:43.933Z", "reply_count": 0, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 1, "reads": 5, "readers_count": 4, "score": 21, "yours": false, "topic_id": 145960, "topic_slug": "the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields", "display_username": "ZebangCheng", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 76499, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields/145960/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 76, "username": "lhoestq", "name": "Quentin Lhoest", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png" }, "action_code": null, "via_email": null }, { "id": 209776, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-03-18T10:44:36.497Z", "cooked": "<p>The docs are ready !</p>\n<ul>\n<li>updated docs: <a href=\"https://huggingface.co/docs/datasets/video_dataset\" class=\"inline-onebox\">Create a video dataset</a></li>\n<li>example dataset: <a href=\"https://huggingface.co/datasets/lhoestq/pusht-videofolder\" class=\"inline-onebox\">lhoestq/pusht-videofolder · Datasets at Hugging Face</a></li>\n</ul>", "post_number": 7, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-18T10:44:36.497Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 4, "readers_count": 3, "score": 40.8, "yours": false, "topic_id": 145960, "topic_slug": "the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/datasets/lhoestq/pusht-videofolder", "internal": false, "reflection": false, "title": "lhoestq/pusht-videofolder · Datasets at Hugging Face", "clicks": 3 }, { "url": "https://huggingface.co/docs/datasets/video_dataset", "internal": false, "reflection": false, "title": "Create a video dataset", "clicks": 3 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields/145960/7", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 }, { "id": "hugs", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209783, "name": "ZebangCheng", "username": "ZebangCheng", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/z/7bcc69/{size}.png", "created_at": "2025-03-18T11:23:04.577Z", "cooked": "<aside class=\"quote no-group\" data-username=\"lhoestq\" data-post=\"5\" data-topic=\"145960\">\n<div class=\"title\">\n<div class=\"quote-controls\"></div>\n<img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lhoestq/48/52888_2.png\" class=\"avatar\"> lhoestq:</div>\n<blockquote>\n<p>You should upload your folder of [metadata.csv + videos] as is, I think <code>push_to_hub</code> doesn’t support video types well at the moment.</p>\n</blockquote>\n</aside>\n<p>Thank you for your reminder. I have successfully resolved this issue.</p>", "post_number": 8, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-18T11:23:04.577Z", "reply_count": 0, "reply_to_post_number": 7, "quote_count": 1, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 15.8, "yours": false, "topic_id": 145960, "topic_slug": "the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields", "display_username": "ZebangCheng", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 76499, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields/145960/8", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 76, "username": "lhoestq", "name": "Quentin Lhoest", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png" }, "action_code": null, "via_email": null }, { "id": 209918, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-18T23:23:44.095Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 9, "post_type": 3, "posts_count": 9, "updated_at": "2025-03-18T23:23:44.095Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 145960, "topic_slug": "the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/the-dataset-viewer-only-displays-the-videos-and-does-not-show-other-fields/145960/9", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I created a Parquet file locally with the following content:</p> <pre><code class="lang-auto"> video_id label description video_path 0 00019.mp4 neutral It's me. test_hf_data/video/00019.mp4 1 00020.mp4 surprise I remember it! test_hf_data/video/00020.mp4 2 00021.mp4 anger I want to go home. test_hf_data/video/00021.mp4 3 00022.mp4 fear I may die. test_hf_data/video/00022.mp4 4 00024.mp4 happy I am beautiful! test_hf_data/video/00024.mp4 </code></pre> <p>However, after uploading it to Hugging Face, the dataset viewer only displays the videos and does not show the <code>label</code>, <code>description</code>, <code>video_id</code>, or other fields. Why is this happening?</p> <blockquote> <p><a href="https://huggingface.co/datasets/ZebangCheng/test_hf_data" class="inline-onebox">ZebangCheng/test_hf_data · Datasets at Hugging Face</a></p> </blockquote>
<p>The docs are ready !</p> <ul> <li>updated docs: <a href="https://huggingface.co/docs/datasets/video_dataset" class="inline-onebox">Create a video dataset</a></li> <li>example dataset: <a href="https://huggingface.co/datasets/lhoestq/pusht-videofolder" class="inline-onebox">lhoestq/pusht-videofolder · Datasets at Hugging Face</a></li> </ul>
Problem with launching DeepSeek-R1-Distill-Qwen-32B-Uncensored-Q8_0-GGUF
https://discuss.huggingface.co/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462
145,462
13
2025-03-12T22:30:09.314000Z
[ { "id": 208673, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-12T22:30:09.373Z", "cooked": "<p>I am trying to run a large DeepSeek-R1-Distill-Qwen-32B-Uncensored-Q8_0-GGUF language model (~34.8 GB) on the Hugging Face Spaces platform using an Nvidia L40S GPU (48 GB VRAM). The model successfully loads on VRAM, but an error (runtime error) occurs while attempting to initialize, after which the model starts loading again, resulting in memory exhaustion. There are no specific error messages in the logs, and the failure occurs a few minutes after initialization starts, but with no explicit indication that the wait time has been exceeded.<br>\nI need help diagnosing and solving this problem. Below I provide all the configuration details, steps taken, and application code.</p>", "post_number": 1, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-12T22:30:09.373Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 465, "reads": 30, "readers_count": 29, "score": 2336, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208742, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-13T06:10:46.681Z", "cooked": "<p>Ollama? Llamacpp? Ollama seems to have model specific issue.</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/ollama/ollama/issues/8517\">\n <header class=\"source\">\n\n <a href=\"https://github.com/ollama/ollama/issues/8517\" target=\"_blank\" rel=\"noopener\">github.com/ollama/ollama</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/ollama/ollama/issues/8517\" target=\"_blank\" rel=\"noopener\">Missing tool support for DeepSeek-R1 Distillates based on Qwen</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2025-01-21\" data-time=\"11:10:11\" data-timezone=\"UTC\">11:10AM - 21 Jan 25 UTC</span>\n </div>\n\n\n <div class=\"user\">\n <a href=\"https://github.com/odrobnik\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/d/f/dfaf80cf5a9ecbff43b14bc4553f6cafb3c70eba.jpeg\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"74635C\">\n odrobnik\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n bug\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">### What is the issue?\n\nI tried `deepseek-r1:70B` and ollama claims that it does<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">n't support tools. \n\n```\n{\n \"error\": {\n \"message\": \"registry.ollama.ai/library/deepseek-r1:70B does not support tools\",\n \"type\": \"api_error\",\n \"param\": null,\n \"code\": null\n }\n```\n\nLooks to me like the template you have is missing the rules for tools.\n\nThe current Ollama template:\n\n```\n{{- if .System }}{{ .System }}{{ end }}\n{{- range $i, $_ := .Messages }}\n{{- $last := eq (len (slice $.Messages $i)) 1}}\n{{- if eq .Role \"user\" }}&lt;|User|&gt;{{ .Content }}\n{{- else if eq .Role \"assistant\" }}&lt;|Assistant|&gt;{{ .Content }}{{- if not $last }}&lt;|end▁of▁sentence|&gt;{{- end }}\n{{- end }}\n{{- if and $last (ne .Role \"assistant\") }}&lt;|Assistant|&gt;{{- end }}\n{{- end }}\n```\n\nThe template from https://huggingface.co/unsloth/DeepSeek-R1-Distill-Llama-70B-GGUF has tool calls stuff:\n\n```\n{% if not add_generation_prompt is defined %}\n {% set add_generation_prompt = false %}\n{% endif %}\n{% set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='') %}\n{%- for message in messages -%}\n {%- if message['role'] == 'system' -%}\n {% set ns.system_prompt = message['content'] %}\n {%- endif -%}\n{%- endfor -%}\n{{ bos_token }}{{ ns.system_prompt }}\n{%- for message in messages -%}\n {%- if message['role'] == 'user' -%}\n {%- set ns.is_tool = false -%}\n {{ '&lt;|User|&gt;' + message['content'] }}\n {%- endif -%}\n \n {%- if message['role'] == 'assistant' and message['content'] is none -%}\n {%- set ns.is_tool = false -%}\n {%- for tool in message['tool_calls'] -%}\n {%- if not ns.is_first -%}\n {{ '&lt;|Assistant|&gt;&lt;|tool▁calls▁begin|&gt;&lt;|tool▁call▁begin|&gt;' + tool['type'] + '&lt;|tool▁sep|&gt;' + tool['function']['name'] + '\\n' + '```json' + '\\n' + tool['function']['arguments'] + '\\n' + '```' + '&lt;|tool▁call▁end|&gt;' }}\n {%- set ns.is_first = true -%}\n {%- else -%}\n {{ '\\n' + '&lt;|tool▁call▁begin|&gt;' + tool['type'] + '&lt;|tool▁sep|&gt;' + tool['function']['name'] + '\\n' + '```json' + '\\n' + tool['function']['arguments'] + '\\n' + '```' + '&lt;|tool▁call▁end|&gt;' }}\n {{ '&lt;|tool▁calls▁end|&gt;&lt;|end▁of▁sentence|&gt;' }}\n {%- endif -%}\n {%- endfor -%}\n {%- endif -%}\n \n {%- if message['role'] == 'assistant' and message['content'] is not none -%}\n {%- if ns.is_tool -%}\n {{ '&lt;|tool▁outputs▁end|&gt;' + message['content'] + '&lt;|end▁of▁sentence|&gt;' }}\n {%- set ns.is_tool = false -%}\n {%- else -%}\n {% set content = message['content'] %}\n {% if '&lt;/think&gt;' in content %}\n {% set content = content.split('&lt;/think&gt;')[-1] %}\n {% endif %}\n {{ '&lt;|Assistant|&gt;' + content + '&lt;|end▁of▁sentence|&gt;' }}\n {%- endif -%}\n {%- endif -%}\n \n {%- if message['role'] == 'tool' -%}\n {%- set ns.is_tool = true -%}\n {%- if ns.is_output_first -%}\n {{ '&lt;|tool▁outputs▁begin|&gt;&lt;|tool▁output▁begin|&gt;' + message['content'] + '&lt;|tool▁output▁end|&gt;' }}\n {%- set ns.is_output_first = false -%}\n {%- else -%}\n {{ '\\n&lt;|tool▁output▁begin|&gt;' + message['content'] + '&lt;|tool▁output▁end|&gt;' }}\n {%- endif -%}\n {%- endif -%}\n{%- endfor -%}\n\n{% if ns.is_tool %}\n {{ '&lt;|tool▁outputs▁end|&gt;' }}\n{% endif %}\n\n{% if add_generation_prompt and not ns.is_tool %}\n {{ '&lt;|Assistant|&gt;' }}\n{% endif %}\n``` \n\n### OS\n\nmacOS\n\n### GPU\n\nApple\n\n### CPU\n\n_No response_\n\n### Ollama version\n\n0.5.7</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/ollama/ollama/issues/7867\">\n <header class=\"source\">\n\n <a href=\"https://github.com/ollama/ollama/issues/7867\" target=\"_blank\" rel=\"noopener\">github.com/ollama/ollama</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/ollama/ollama/issues/7867\" target=\"_blank\" rel=\"noopener\">Deepseek (various) 236b crashes on run</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-11-27\" data-time=\"23:00:55\" data-timezone=\"UTC\">11:00PM - 27 Nov 24 UTC</span>\n </div>\n\n\n <div class=\"user\">\n <a href=\"https://github.com/Maltz42\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/f/1/f1cab1e2b16dd03169fab2b4e968157a354f1c09.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"BBE5B0\">\n Maltz42\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n bug\n </span>\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n needs more info\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">### What is the issue?\n\nDeepseek V2, V2.5, and V2-coder all crash with an OOM <span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">error when loading the 236b size. Other versions of Deepseek may as well, that's all I've tested. Hardware is dual A6000's with 48GB each.\n\n```\nError: llama runner process has terminated: cudaMalloc failed: out of memory\nggml_gallocr_reserve_n: failed to allocate CUDA0 buffer of size 882903040\nllama_new_context_with_model: failed to allocate compute buffers\n```\n\n### OS\n\nLinux\n\n### GPU\n\nNvidia\n\n### CPU\n\nAMD\n\n### Ollama version\n\nv0.4.5</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-13T06:10:46.681Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 5, "reads": 29, "readers_count": 28, "score": 35.8, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/ollama/ollama/issues/8517", "internal": false, "reflection": false, "title": "Missing tool support for DeepSeek-R1 Distillates based on Qwen · Issue #8517 · ollama/ollama · GitHub", "clicks": 16 }, { "url": "https://github.com/ollama/ollama/issues/7867", "internal": false, "reflection": false, "title": "Deepseek (various) 236b crashes on run · Issue #7867 · ollama/ollama · GitHub", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209090, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-14T14:15:01.789Z", "cooked": "<p>If you know exactly how to run it, it would be easier if you tell me about it )</p>", "post_number": 3, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-14T14:15:01.789Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 20, "readers_count": 19, "score": 19, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209102, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-14T15:25:45.988Z", "cooked": "<p>I’m sorry… If I knew, I would tell you straight away, but I haven’t succeeded in building in the Hugging Face GPU Gradio space with Llamacpp-python 0.3.5 or later either. DeepSeek should require at least 0.3.5 or 0.3.6. Ollama is not available because it is not in the system to begin with. Perhaps available in the Docker space…?</p>\n<h3><a name=\"p-209102-works-but-old-1\" class=\"anchor\" href=\"#p-209102-works-but-old-1\"></a>Works but old</h3>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">https://github.com/abetlen/llama-cpp-python/releases/download/v0.3.4-cu124/llama_cpp_python-0.3.4-cp310-cp310-linux_x86_64.whl\n</code></pre>\n<h3><a name=\"p-209102-doesnt-work-or-rather-works-in-cpu-mode-2\" class=\"anchor\" href=\"#p-209102-doesnt-work-or-rather-works-in-cpu-mode-2\"></a>Doesn’t work (or rather, works in CPU mode…)</h3>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">--extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121\nllama-cpp-python\n</code></pre>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/abetlen/llama-cpp-python/issues\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/abetlen/llama-cpp-python/issues\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/344;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/e/3/e3dd1070aa552e76d25286094a47789a612c42e8_2_690x345.png\" class=\"thumbnail\" data-dominant-color=\"EBEBEC\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://github.com/abetlen/llama-cpp-python/issues\" target=\"_blank\" rel=\"noopener\">abetlen/llama-cpp-python</a></h3>\n\n <p>Python bindings for llama.cpp. Contribute to abetlen/llama-cpp-python development by creating an account on GitHub.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-14T15:27:17.378Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 21, "readers_count": 20, "score": 19.2, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/abetlen/llama-cpp-python/issues", "internal": false, "reflection": false, "title": "GitHub · Where software is built", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209127, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-14T16:57:21.560Z", "cooked": "<p>It can’t use GGUF, but I’ll leave the code I made for the Zero GPU space using Transformers and BnB. This should make the model usable. I hope Llamacpp-python will be available soon…</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/spaces/John6666/chatbot-zero\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/spaces/John6666/chatbot-zero\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/b/4/b44d5c0ed9e3c87d167e8e4c7f1826443f2b253d_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"AE6BA1\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/spaces/John6666/chatbot-zero\" target=\"_blank\" rel=\"noopener\">Chatbot Zero - a Hugging Face Space by John6666</a></h3>\n\n <p>Discover amazing ML apps made by the community</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 5, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-14T16:57:21.560Z", "reply_count": 3, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 15, "readers_count": 14, "score": 38, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/spaces/John6666/chatbot-zero", "internal": false, "reflection": false, "title": "Chatbot Zero - a Hugging Face Space by John6666", "clicks": 2 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/5", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209141, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-14T17:48:55.313Z", "cooked": "<p>huge respect )) i have been trying for 5 days to get it up and running and no way, but it’s already working thanks!</p>", "post_number": 6, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-14T17:48:55.313Z", "reply_count": 0, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 0, "reads": 14, "readers_count": 13, "score": 17.8, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209143, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-14T18:04:43.225Z", "cooked": "<p>I got excited early, I responded to a “hi” message normally once, the rest of the time it responds to me with my message and that’s it. But what’s already running is progress, I’ll look into it further.</p>\n<p>===== Application Startup at 2025-03-14 18:08:23 =====</p>\n<p>Could not load bitsandbytes native library: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version <code>GLIBCXX_3.4.32' not found (required by /usr/local/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so) Traceback (most recent call last): File \"/usr/local/lib/python3.10/site-packages/bitsandbytes/cextension.py\", line 85, in &lt;module&gt; lib = get_native_library() File \"/usr/local/lib/python3.10/site-packages/bitsandbytes/cextension.py\", line 72, in get_native_library dll = ct.cdll.LoadLibrary(str(binary_path)) File \"/usr/local/lib/python3.10/ctypes/__init__.py\", line 452, in LoadLibrary return self._dlltype(name) File \"/usr/local/lib/python3.10/ctypes/__init__.py\", line 374, in __init__ self._handle = _dlopen(self._name, mode) OSError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version </code>GLIBCXX_3.4.32’ not found (required by /usr/local/lib/python3.10/site-packages/bitsandbytes/libbitsandbytes_cpu.so)<br>\n↑ Those bitsandbytes warnings are expected on ZeroGPU ↑</p>", "post_number": 7, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-14T18:27:52.986Z", "reply_count": 0, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 1, "reads": 14, "readers_count": 13, "score": 22.8, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/7", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209175, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-14T22:55:55.716Z", "cooked": "<blockquote>\n<p><code>GLIBCXX_3.4.32' not found</code></p>\n</blockquote>\n<p>Don’t worry about what this message means. It’s just something like that.<br>\nBy the way, it was buggy, so I fixed it.<img src=\"https://emoji.discourse-cdn.com/apple/sweat_smile.png?v=14\" title=\":sweat_smile:\" class=\"emoji\" alt=\":sweat_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 8, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-14T22:55:55.716Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 9, "readers_count": 8, "score": 6.8, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/8", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209234, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-15T12:32:09.042Z", "cooked": "<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/b/f/bf8616102e66068a8186dc80e5d8b9b14c4e57fb.png\" data-download-href=\"/uploads/short-url/rkitsAVjITNa92MvAlM2yMpunPB.png?dl=1\" title=\"Снимок экрана 2025-03-15 в 19.30.01\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/b/f/bf8616102e66068a8186dc80e5d8b9b14c4e57fb_2_690x224.png\" alt=\"Снимок экрана 2025-03-15 в 19.30.01\" data-base62-sha1=\"rkitsAVjITNa92MvAlM2yMpunPB\" width=\"690\" height=\"224\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/b/f/bf8616102e66068a8186dc80e5d8b9b14c4e57fb_2_690x224.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/b/f/bf8616102e66068a8186dc80e5d8b9b14c4e57fb_2_1035x336.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/b/f/bf8616102e66068a8186dc80e5d8b9b14c4e57fb_2_1380x448.png 2x\" data-dominant-color=\"1A1A1D\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">Снимок экрана 2025-03-15 в 19.30.01</span><span class=\"informations\">4080×1326 198 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div><br>\nI use cloning your repository and end up with an AI that forwards me my messages)))</p>", "post_number": 9, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-15T12:32:09.042Z", "reply_count": 0, "reply_to_post_number": 8, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 21.6, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/9", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209235, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-15T12:47:36.237Z", "cooked": "<p>Out of 10 times, 1 time he responds normally to “hello”, but he can’t do anything more complicated than that, so I’m still looking for a solution.</p>", "post_number": 10, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-15T12:47:36.237Z", "reply_count": 0, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 0, "reads": 9, "readers_count": 8, "score": 16.8, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/10", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209236, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-15T12:50:05.758Z", "cooked": "<p>I think I probably made a mistake somewhere. I’ll check it tomorrow.</p>", "post_number": 11, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-15T12:50:05.758Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 9, "readers_count": 8, "score": 6.8, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/11", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209241, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-15T13:51:47.727Z", "cooked": "<p>thank you <img src=\"https://emoji.discourse-cdn.com/apple/+1.png?v=14\" title=\":+1:\" class=\"emoji\" alt=\":+1:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 12, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-15T13:51:47.727Z", "reply_count": 0, "reply_to_post_number": 11, "quote_count": 0, "incoming_link_count": 0, "reads": 9, "readers_count": 8, "score": 16.8, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/12", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209337, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-16T08:28:20.385Z", "cooked": "<p>Maybe fixed.</p>", "post_number": 13, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-16T08:28:20.385Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 6.6, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/13", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209366, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-16T13:02:56.069Z", "cooked": "<p>Unfortunately no, I tried to disable quantization but then the model does not fit in memory, I tried to increase quantization to 8 bits, but it did not change significantly</p>", "post_number": 14, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-16T13:02:56.069Z", "reply_count": 1, "reply_to_post_number": 13, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 21.6, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/14", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209367, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-16T13:04:07.624Z", "cooked": "<p>I tried adding a system promt, but it doesn’t affect the result either.</p>", "post_number": 15, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-16T13:04:07.624Z", "reply_count": 0, "reply_to_post_number": 14, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 16.4, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/15", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 86528, "username": "Cosmos911", "name": "Gustavo", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png" }, "action_code": null, "via_email": null }, { "id": 209368, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-16T13:09:16.009Z", "cooked": "<p>That’s strange… I wonder if it’s different from the model I’m using for testing…<br>\nI’m testing it again now. BTW, that’s normal for quantization-related things. I quantized it because I didn’t have enough VRAM.</p>", "post_number": 16, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-16T13:10:04.908Z", "reply_count": 2, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 26.4, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/16", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209373, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-16T13:45:41.275Z", "cooked": "<p>Yes, I saw in the code that you applied quantization to 4 bits, and I’m trying a different model now, I’ll report back soon.</p>", "post_number": 17, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-16T13:45:41.275Z", "reply_count": 0, "reply_to_post_number": 16, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 16.4, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/17", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209374, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-16T13:57:30.587Z", "cooked": "<p>I can not find in search Original Model: DeepSeek-R1-Distill-Qwen-32B-Uncensored I see only versions after quantization of this model, but there is no original file. or it is not available on huggingface and should be taken elsewhere ?</p>", "post_number": 18, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-16T13:57:30.587Z", "reply_count": 0, "reply_to_post_number": 16, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 16.6, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/18", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209378, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-16T15:03:06.798Z", "cooked": "<p>This one. <a href=\"https://huggingface.co/nicoboss/DeepSeek-R1-Distill-Qwen-32B-Uncensored\" class=\"inline-onebox\">nicoboss/DeepSeek-R1-Distill-Qwen-32B-Uncensored · Hugging Face</a></p>\n<p>I’ve figured out the cause, but it’s a problem with the VRAM. The standard Transformers cache implementation is easy to use, but it eats up VRAM…<br>\nI think I’ll try to implement a better version tomorrow.</p>\n<p>For now, I’ve uploaded a version that doesn’t remember the conversation history, but there are no problems with the operation.<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/f/2f2a5f87d9597083cd495e6c9accadc23de699e2.png\" data-download-href=\"/uploads/short-url/6JfdXFVA4ufy6sSqB9nVnTeBlyW.png?dl=1\" title=\"dsllama8\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/f/2f2a5f87d9597083cd495e6c9accadc23de699e2_2_690x358.png\" alt=\"dsllama8\" data-base62-sha1=\"6JfdXFVA4ufy6sSqB9nVnTeBlyW\" width=\"690\" height=\"358\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/f/2f2a5f87d9597083cd495e6c9accadc23de699e2_2_690x358.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/f/2f2a5f87d9597083cd495e6c9accadc23de699e2_2_1035x537.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/2/f/2f2a5f87d9597083cd495e6c9accadc23de699e2.png 2x\" data-dominant-color=\"1E1E21\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">dsllama8</span><span class=\"informations\">1098×571 34.5 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>", "post_number": 19, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-16T15:03:06.798Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 26.6, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/nicoboss/DeepSeek-R1-Distill-Qwen-32B-Uncensored", "internal": false, "reflection": false, "title": "nicoboss/DeepSeek-R1-Distill-Qwen-32B-Uncensored · Hugging Face", "clicks": 2 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/19", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209386, "name": "Gustavo", "username": "Cosmos911", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/c/b19c9b/{size}.png", "created_at": "2025-03-16T15:45:55.890Z", "cooked": "<p>I’m running using<br>\nNvidia 1x L40S<br>\nvCPU: 8<br>\nRAM (RAM): ~62GB<br>\nVRAM (GPU memory): 48 GB</p>\n<p>and the model responds much faster, and always responds to the first message, but it is not stable and after the first message it hangs and does not respond to the next messages.</p>", "post_number": 20, "post_type": 1, "posts_count": 33, "updated_at": "2025-03-16T15:45:55.890Z", "reply_count": 1, "reply_to_post_number": 19, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 21.2, "yours": false, "topic_id": 145462, "topic_slug": "problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf", "display_username": "Gustavo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86528, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/problem-with-launching-deepseek-r1-distill-qwen-32b-uncensored-q8-0-gguf/145462/20", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null } ]
<p>I am trying to run a large DeepSeek-R1-Distill-Qwen-32B-Uncensored-Q8_0-GGUF language model (~34.8 GB) on the Hugging Face Spaces platform using an Nvidia L40S GPU (48 GB VRAM). The model successfully loads on VRAM, but an error (runtime error) occurs while attempting to initialize, after which the model starts loading again, resulting in memory exhaustion. There are no specific error messages in the logs, and the failure occurs a few minutes after initialization starts, but with no explicit indication that the wait time has been exceeded.<br> I need help diagnosing and solving this problem. Below I provide all the configuration details, steps taken, and application code.</p>
<p>I’m running using<br> Nvidia 1x L40S<br> vCPU: 8<br> RAM (RAM): ~62GB<br> VRAM (GPU memory): 48 GB</p> <p>and the model responds much faster, and always responds to the first message, but it is not stable and after the first message it hangs and does not respond to the next messages.</p>
How to get intermeidate output images
https://discuss.huggingface.co/t/how-to-get-intermeidate-output-images/29144
29,144
63
2023-01-07T23:49:55.963000Z
[ { "id": 54044, "name": "Don Kackman", "username": "dkackman", "avatar_template": "/user_avatar/discuss.huggingface.co/dkackman/{size}/19432_2.png", "created_at": "2023-01-07T23:49:56.036Z", "cooked": "<p>Is it possible to get the images at each denoising step via the Diffusers library? I am sure I’ve seen it done but can’t find where or how.</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2023-01-07T23:49:56.036Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2942, "reads": 48, "readers_count": 47, "score": 14684.6, "yours": false, "topic_id": 29144, "topic_slug": "how-to-get-intermeidate-output-images", "display_username": "Don Kackman", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/genai-model-system-every-iteration-visible/135202/2", "internal": true, "reflection": true, "title": "GenAI Model/system every iteration visible", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 9964, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-get-intermeidate-output-images/29144/1", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 54071, "name": "Pedro Cuenca", "username": "pcuenq", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png", "created_at": "2023-01-08T11:34:39.372Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/dkackman\">@dkackman</a>!</p>\n<p>You might want to look at the <em>callback mechanism</em>, which sends intermediate latents to a function you specify. You could then decode the latents in that function and visualize them as you need.</p>\n<p><a href=\"https://github.com/fastai/diffusion-nbs/blob/master/stable_diffusion.ipynb\" rel=\"noopener nofollow ugc\">This notebook includes a section about callbacks</a> that demonstrates how to use that feature.</p>\n<p>Good luck!</p>", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2023-01-08T11:34:39.372Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 159, "reads": 49, "readers_count": 48, "score": 869.8, "yours": false, "topic_id": 29144, "topic_slug": "how-to-get-intermeidate-output-images", "display_username": "Pedro Cuenca", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/fastai/diffusion-nbs/blob/master/stable_diffusion.ipynb", "internal": false, "reflection": false, "title": "diffusion-nbs/stable_diffusion.ipynb at master · fastai/diffusion-nbs · GitHub", "clicks": 342 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 1758, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-get-intermeidate-output-images/29144/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 54094, "name": "Don Kackman", "username": "dkackman", "avatar_template": "/user_avatar/discuss.huggingface.co/dkackman/{size}/19432_2.png", "created_at": "2023-01-08T17:53:34.556Z", "cooked": "<p>Oh perfect. I was unclear on how to transform the latents into an image but this exactly what iI was looking for.</p>\n<pre><code class=\"lang-python\">vae = pipe.vae\nimages = []\n\ndef latents_callback(i, t, latents):\n latents = 1 / 0.18215 * latents\n image = vae.decode(latents).sample[0]\n image = (image / 2 + 0.5).clamp(0, 1)\n image = image.cpu().permute(1, 2, 0).numpy()\n images.extend(pipe.numpy_to_pil(image))\n\nprompt = \"Portrait painting of Jeremy Howard looking happy.\"\ntorch.manual_seed(9000)\nfinal_image = pipe(prompt, callback=latents_callback, callback_steps=12).images[0]\nimages.append(final_image)\nimage_grid(images, rows=1, cols=len(images))\n</code></pre>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2023-01-08T17:53:34.556Z", "reply_count": 1, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 90, "reads": 46, "readers_count": 45, "score": 524.2, "yours": false, "topic_id": 29144, "topic_slug": "how-to-get-intermeidate-output-images", "display_username": "Don Kackman", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 9964, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-get-intermeidate-output-images/29144/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 1758, "username": "pcuenq", "name": "Pedro Cuenca", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png" }, "action_code": null, "via_email": null }, { "id": 209658, "name": "Venkatesh Thirugnana Sambandham", "username": "venkatesh-thiru", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/v/a587f6/{size}.png", "created_at": "2025-03-17T17:55:44.846Z", "cooked": "<p>Whats with the scaling in <code>latents = 1 / 0.18215 * latents</code>? is it a constant for every VAE? can I still apply the same callback for SD3.5?</p>", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-17T17:55:44.846Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 3, "reads": 6, "readers_count": 5, "score": 31.2, "yours": false, "topic_id": 29144, "topic_slug": "how-to-get-intermeidate-output-images", "display_username": "Venkatesh Thirugnana Sambandham", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87489, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-get-intermeidate-output-images/29144/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 9964, "username": "dkackman", "name": "Don Kackman", "avatar_template": "/user_avatar/discuss.huggingface.co/dkackman/{size}/19432_2.png" }, "action_code": null, "via_email": null }, { "id": 209742, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-18T06:02:32.260Z", "cooked": "<p>I think the same method can be used for the Diffusers pipeline.</p>\n<h3><a name=\"p-209742-pipeline-callbacks-1\" class=\"anchor\" href=\"#p-209742-pipeline-callbacks-1\"></a>Pipeline callbacks</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/diffusers/using-diffusers/callback\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/diffusers/using-diffusers/callback\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/2/725f3ba0d5cc1761eed1c544dd7101393d1e4909_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F7F5EF\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/diffusers/using-diffusers/callback\" target=\"_blank\" rel=\"noopener\">Pipeline callbacks</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-209742-explanation-of-the-018215-factor-in-textual_inversion-2\" class=\"anchor\" href=\"#p-209742-explanation-of-the-018215-factor-in-textual_inversion-2\"></a>Explanation of the 0.18215 factor in textual_inversion?</h3>\n<aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/huggingface/diffusers/issues/437\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/diffusers/issues/437\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/diffusers</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/diffusers/issues/437\" target=\"_blank\" rel=\"noopener\">Explanation of the 0.18215 factor in textual_inversion?</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2022-09-09\" data-time=\"01:21:39\" data-timezone=\"UTC\">01:21AM - 09 Sep 22 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2022-09-09\" data-time=\"13:07:09\" data-timezone=\"UTC\">01:07PM - 09 Sep 22 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/garrett361\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/8/8/882ead530c2b9b4bc6ba7aa554498d658aec8a4a.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"4C4C4C\">\n garrett361\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">https://github.com/huggingface/diffusers/blob/b2b3b1a8ab83b020ecaf32f45de3ef2364<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">4331cf/examples/textual_inversion/textual_inversion.py#L501\n\nHi, just a small question about the quoted script above which is bothering me: where does this `0.18215` number come from? What computation is being done? Is it from some paper? I have seen the same factor elsewhere, too, without explanation. Any guidance would be very helpful, thanks!</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 5, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-18T06:02:32.260Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 5, "reads": 4, "readers_count": 3, "score": 25.8, "yours": false, "topic_id": 29144, "topic_slug": "how-to-get-intermeidate-output-images", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/diffusers/using-diffusers/callback", "internal": false, "reflection": false, "title": "Pipeline callbacks", "clicks": 26 }, { "url": "https://github.com/huggingface/diffusers/issues/437", "internal": false, "reflection": false, "title": "Explanation of the 0.18215 factor in textual_inversion? · Issue #437 · huggingface/diffusers · GitHub", "clicks": 13 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-get-intermeidate-output-images/29144/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null } ]
<p>Is it possible to get the images at each denoising step via the Diffusers library? I am sure I’ve seen it done but can’t find where or how.</p>
<p>Hi <a class="mention" href="/u/dkackman">@dkackman</a>!</p> <p>You might want to look at the <em>callback mechanism</em>, which sends intermediate latents to a function you specify. You could then decode the latents in that function and visualize them as you need.</p> <p><a href="https://github.com/fastai/diffusion-nbs/blob/master/stable_diffusion.ipynb" rel="noopener nofollow ugc">This notebook includes a section about callbacks</a> that demonstrates how to use that feature.</p> <p>Good luck!</p>
Serverless inference issues for a new Go library
https://discuss.huggingface.co/t/serverless-inference-issues-for-a-new-go-library/146000
146,000
64
2025-03-16T17:40:21.718000Z
[ { "id": 209416, "name": "Marc-Antoine Ruel", "username": "maruel", "avatar_template": "/user_avatar/discuss.huggingface.co/maruel/{size}/43410_2.png", "created_at": "2025-03-16T17:40:21.789Z", "cooked": "<p>I’m writing a new library in Go using the serverless inference API and I hit a few problems:</p>\n<ul>\n<li>The documentation at <a href=\"https://huggingface.co/docs/api-inference/tasks/chat-completion\" class=\"inline-onebox\">Chat Completion</a> is very focused on the python library, and doesn’t list much for the REST API. to the point that the URL format to use isn’t even listed. I use <code>\"https://router.huggingface.co/hf-inference/models/\" + model + \"/v1/chat/completions\"</code>. I do not need OpenAI compatibility, whatever is closest to native implementation is better for me.</li>\n<li>When I make a mistake, I get a whole HTML page with <code>&lt;h1&gt;503&lt;/h1&gt;</code> instead of an error message in JSON. That’s really hurting my progress. It seems there’s a reverse proxxy on the router that is eating the error messages.</li>\n<li>I failed to create a test example that works with JSON schema for structured reply. What example (in any language) would you point me to? I see that Célina and Lucain recently updated the test case test_chat_completion_with_response_format() and it’s now skipped. <a href=\"https://github.com/huggingface/huggingface_hub/blob/main/tests/test_inference_client.py#L415\" class=\"inline-onebox\" rel=\"noopener nofollow ugc\">huggingface_hub/tests/test_inference_client.py at main · huggingface/huggingface_hub · GitHub</a></li>\n</ul>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-16T17:40:21.789Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 31, "reads": 11, "readers_count": 10, "score": 152.2, "yours": false, "topic_id": 146000, "topic_slug": "serverless-inference-issues-for-a-new-go-library", "display_username": "Marc-Antoine Ruel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/huggingface_hub/blob/main/tests/test_inference_client.py#L415", "internal": false, "reflection": false, "title": "huggingface_hub/tests/test_inference_client.py at main · huggingface/huggingface_hub · GitHub", "clicks": 1 }, { "url": "https://huggingface.co/docs/api-inference/tasks/chat-completion", "internal": false, "reflection": false, "title": "Chat Completion", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87361, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/serverless-inference-issues-for-a-new-go-library/146000/1", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209498, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-17T05:26:28.152Z", "cooked": "<p>First of all, the Serverless Inference API is currently being completely overhauled, so if you have any questions about the broad changes that will be made in the future, it would be better to ask them on the github issues page.</p>\n<h3><a name=\"p-209498-library-issue-1\" class=\"anchor\" href=\"#p-209498-library-issue-1\"></a>Library issue</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/huggingface/huggingface_hub/issues\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/huggingface/huggingface_hub/issues\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/350;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/9/3/93152d4bd1ecf7bb826177a7c46c888beb440851_2_690x350.png\" class=\"thumbnail\" data-dominant-color=\"F8F5EA\" width=\"690\" height=\"350\"></div>\n\n<h3><a href=\"https://github.com/huggingface/huggingface_hub/issues\" target=\"_blank\" rel=\"noopener\">huggingface/huggingface_hub</a></h3>\n\n <p>The official Python client for the Huggingface Hub. - huggingface/huggingface_hub</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-209498-non-library-issue-2\" class=\"anchor\" href=\"#p-209498-non-library-issue-2\"></a>Non-library issue</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/huggingface/hub-docs/issues\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/huggingface/hub-docs/issues\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/344;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3fd3f6441fce3769420b6fa1078044bf8e1f2dba_2_690x345.png\" class=\"thumbnail\" data-dominant-color=\"F4F2EB\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://github.com/huggingface/hub-docs/issues\" target=\"_blank\" rel=\"noopener\">huggingface/hub-docs</a></h3>\n\n <p>Docs of the Hugging Face Hub. Contribute to huggingface/hub-docs development by creating an account on GitHub.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<blockquote>\n<p>documentation</p>\n</blockquote>\n<p>There is some.<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719.png\" data-download-href=\"/uploads/short-url/fPJdYD8id99iuPhzYvqujMs2Vfz.png?dl=1\" title=\"apicurl\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719_2_690x446.png\" alt=\"apicurl\" data-base62-sha1=\"fPJdYD8id99iuPhzYvqujMs2Vfz\" width=\"690\" height=\"446\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719_2_690x446.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719_2_1035x669.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719.png 2x\" data-dominant-color=\"131621\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">apicurl</span><span class=\"informations\">1076×697 34.5 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<blockquote>\n<p>I get a whole HTML page with <code>&lt;h1&gt;503&lt;/h1&gt;</code> instead of an error message in JSON</p>\n</blockquote>\n<p>Same here…<img src=\"https://emoji.discourse-cdn.com/apple/sob.png?v=14\" title=\":sob:\" class=\"emoji\" alt=\":sob:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-17T05:26:28.152Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 10, "readers_count": 9, "score": 22, "yours": false, "topic_id": 146000, "topic_slug": "serverless-inference-issues-for-a-new-go-library", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/huggingface_hub/issues", "internal": false, "reflection": false, "title": "GitHub · Where software is built", "clicks": 2 }, { "url": "https://github.com/huggingface/hub-docs/issues", "internal": false, "reflection": false, "title": "GitHub · Where software is built", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/serverless-inference-issues-for-a-new-go-library/146000/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209611, "name": "Marc-Antoine Ruel", "username": "maruel", "avatar_template": "/user_avatar/discuss.huggingface.co/maruel/{size}/43410_2.png", "created_at": "2025-03-17T14:51:00.455Z", "cooked": "<p>Thanks, that was super useful!</p>\n<p>Looks like it’s half-cooked:</p>\n<ul>\n<li><a href=\"https://github.com/huggingface/huggingface.js/issues/932\" class=\"inline-onebox\" rel=\"noopener nofollow ugc\">Incompatibility between OpenAI and HF's Chat Completion `response_format` · Issue #932 · huggingface/huggingface.js · GitHub</a></li>\n<li><a href=\"https://github.com/huggingface/text-generation-inference/issues/2899\" class=\"inline-onebox\" rel=\"noopener nofollow ugc\">Support `reponse_format: {\"type\": \"json_object\"}` without any constrained schema · Issue #2899 · huggingface/text-generation-inference · GitHub</a></li>\n<li><a href=\"https://github.com/huggingface/huggingface_hub/issues/2423\" class=\"inline-onebox\" rel=\"noopener nofollow ugc\">response_format with regex does not seem to work · Issue #2423 · huggingface/huggingface_hub · GitHub</a> (about regex but useful to know)</li>\n</ul>\n<p>I’m waiting for google/gemma-3-4b-it to be properly supported on serverless inference so I can test it out more coupled with vision.</p>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-17T14:51:00.455Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 16.4, "yours": false, "topic_id": 146000, "topic_slug": "serverless-inference-issues-for-a-new-go-library", "display_username": "Marc-Antoine Ruel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/huggingface_hub/issues/2423", "internal": false, "reflection": false, "title": "response_format with regex does not seem to work · Issue #2423 · huggingface/huggingface_hub · GitHub", "clicks": 0 }, { "url": "https://github.com/huggingface/text-generation-inference/issues/2899", "internal": false, "reflection": false, "title": "Support `reponse_format: {\"type\": \"json_object\"}` without any constrained schema · Issue #2899 · huggingface/text-generation-inference · GitHub", "clicks": 0 }, { "url": "https://github.com/huggingface/huggingface.js/issues/932", "internal": false, "reflection": false, "title": "Incompatibility between OpenAI and HF's Chat Completion `response_format` · Issue #932 · huggingface/huggingface.js · GitHub", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87361, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/serverless-inference-issues-for-a-new-go-library/146000/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209645, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-17T16:47:13.961Z", "cooked": "<p>As for Gemma 3, we just have to be patient until this fork is merged into main. It probably won’t take that long.</p><aside class=\"onebox githubfolder\" data-onebox-src=\"https://github.com/huggingface/transformers/tree/v4.49.0-Gemma-3\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/huggingface/transformers/tree/v4.49.0-Gemma-3\" target=\"_blank\" rel=\"noopener\">github.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <h3><a href=\"https://github.com/huggingface/transformers/tree/v4.49.0-Gemma-3\" target=\"_blank\" rel=\"noopener\">GitHub - huggingface/transformers at v4.49.0-Gemma-3</a></h3>\n\n <p><a href=\"https://github.com/huggingface/transformers/tree/v4.49.0-Gemma-3\" target=\"_blank\" rel=\"noopener\">v4.49.0-Gemma-3</a></p>\n\n <p><span class=\"label1\">🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.</span></p>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-17T16:47:13.961Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 1.4, "yours": false, "topic_id": 146000, "topic_slug": "serverless-inference-issues-for-a-new-go-library", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/transformers/tree/v4.49.0-Gemma-3", "internal": false, "reflection": false, "title": "GitHub - huggingface/transformers at v4.49.0-Gemma-3", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/serverless-inference-issues-for-a-new-go-library/146000/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209727, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-18T04:47:36.557Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-03-18T04:47:36.557Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 1, "yours": false, "topic_id": 146000, "topic_slug": "serverless-inference-issues-for-a-new-go-library", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/serverless-inference-issues-for-a-new-go-library/146000/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I’m writing a new library in Go using the serverless inference API and I hit a few problems:</p> <ul> <li>The documentation at <a href="https://huggingface.co/docs/api-inference/tasks/chat-completion" class="inline-onebox">Chat Completion</a> is very focused on the python library, and doesn’t list much for the REST API. to the point that the URL format to use isn’t even listed. I use <code>"https://router.huggingface.co/hf-inference/models/" + model + "/v1/chat/completions"</code>. I do not need OpenAI compatibility, whatever is closest to native implementation is better for me.</li> <li>When I make a mistake, I get a whole HTML page with <code>&lt;h1&gt;503&lt;/h1&gt;</code> instead of an error message in JSON. That’s really hurting my progress. It seems there’s a reverse proxxy on the router that is eating the error messages.</li> <li>I failed to create a test example that works with JSON schema for structured reply. What example (in any language) would you point me to? I see that Célina and Lucain recently updated the test case test_chat_completion_with_response_format() and it’s now skipped. <a href="https://github.com/huggingface/huggingface_hub/blob/main/tests/test_inference_client.py#L415" class="inline-onebox" rel="noopener nofollow ugc">huggingface_hub/tests/test_inference_client.py at main · huggingface/huggingface_hub · GitHub</a></li> </ul>
<p>First of all, the Serverless Inference API is currently being completely overhauled, so if you have any questions about the broad changes that will be made in the future, it would be better to ask them on the github issues page.</p> <h3><a name="p-209498-library-issue-1" class="anchor" href="#p-209498-library-issue-1"></a>Library issue</h3> <aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/huggingface/huggingface_hub/issues"> <header class="source"> <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32"> <a href="https://github.com/huggingface/huggingface_hub/issues" target="_blank" rel="noopener">GitHub</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/350;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/9/3/93152d4bd1ecf7bb826177a7c46c888beb440851_2_690x350.png" class="thumbnail" data-dominant-color="F8F5EA" width="690" height="350"></div> <h3><a href="https://github.com/huggingface/huggingface_hub/issues" target="_blank" rel="noopener">huggingface/huggingface_hub</a></h3> <p>The official Python client for the Huggingface Hub. - huggingface/huggingface_hub</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <h3><a name="p-209498-non-library-issue-2" class="anchor" href="#p-209498-non-library-issue-2"></a>Non-library issue</h3> <aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/huggingface/hub-docs/issues"> <header class="source"> <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32"> <a href="https://github.com/huggingface/hub-docs/issues" target="_blank" rel="noopener">GitHub</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/344;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3fd3f6441fce3769420b6fa1078044bf8e1f2dba_2_690x345.png" class="thumbnail" data-dominant-color="F4F2EB" width="690" height="345"></div> <h3><a href="https://github.com/huggingface/hub-docs/issues" target="_blank" rel="noopener">huggingface/hub-docs</a></h3> <p>Docs of the Hugging Face Hub. Contribute to huggingface/hub-docs development by creating an account on GitHub.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <blockquote> <p>documentation</p> </blockquote> <p>There is some.<br> <div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719.png" data-download-href="/uploads/short-url/fPJdYD8id99iuPhzYvqujMs2Vfz.png?dl=1" title="apicurl"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719_2_690x446.png" alt="apicurl" data-base62-sha1="fPJdYD8id99iuPhzYvqujMs2Vfz" width="690" height="446" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719_2_690x446.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719_2_1035x669.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/6/e/6ef992363790cf7ca3b57a726e90ebacac1aa719.png 2x" data-dominant-color="131621"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">apicurl</span><span class="informations">1076×697 34.5 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p> <blockquote> <p>I get a whole HTML page with <code>&lt;h1&gt;503&lt;/h1&gt;</code> instead of an error message in JSON</p> </blockquote> <p>Same here…<img src="https://emoji.discourse-cdn.com/apple/sob.png?v=14" title=":sob:" class="emoji" alt=":sob:" loading="lazy" width="20" height="20"></p>
Huggingface docker python packages
https://discuss.huggingface.co/t/huggingface-docker-python-packages/146096
146,096
24
2025-03-17T10:04:50.860000Z
[ { "id": 209554, "name": "KaiquanMah", "username": "KaiquanMah", "avatar_template": "/user_avatar/discuss.huggingface.co/kaiquanmah/{size}/38118_2.png", "created_at": "2025-03-17T10:04:50.920Z", "cooked": "<p>Is there a list of python packages which come with the docker container for a Streamlit/Gradio space on huggingface?</p>\n<p>Otherwise, how do we check for this? I am trying to avoid reinstalling packages in my requirements.txt if they are found in the docker container. Hopefully this will improve the build time for my Streamlit app.</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-17T10:04:50.920Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 15, "reads": 6, "readers_count": 5, "score": 91.2, "yours": false, "topic_id": 146096, "topic_slug": "huggingface-docker-python-packages", "display_username": "KaiquanMah", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 20365, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/huggingface-docker-python-packages/146096/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209563, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-17T11:29:44.217Z", "cooked": "<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/templates\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/templates\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/3/f3680f347e119820ea26156b31afa7d86d039dbe_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"050504\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/templates\" target=\"_blank\" rel=\"noopener\">templates (Templates)</a></h3>\n\n <p>Inference</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/orgs/huggingface/repositories\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/orgs/huggingface/repositories\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <img width=\"175\" height=\"175\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/9/4/9448925324eeb148df454360814c3b99a61f3d92.png\" class=\"thumbnail onebox-avatar\" data-dominant-color=\"F4CC50\">\n\n<h3><a href=\"https://github.com/orgs/huggingface/repositories\" target=\"_blank\" rel=\"noopener\">Hugging Face</a></h3>\n\n <p>The AI community building the future. Hugging Face has 300 repositories available. Follow their code on GitHub.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<p>\nIt seems like it should be there, but I can’t find it… The following is the result of using an extremely primitive method to obtain the dependencies for the Gradio 5.21.0 environment.</p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">Package Version\n------------------ -----------\naiofiles 23.2.1\naiohappyeyeballs 2.6.1\naiohttp 3.11.13\naiosignal 1.3.2\nannotated-types 0.7.0\nanyio 4.8.0\nasync-timeout 5.0.1\nattrs 25.3.0\nAuthlib 1.5.1\ncertifi 2025.1.31\ncffi 1.17.1\ncharset-normalizer 3.4.1\nclick 8.0.4\ncryptography 44.0.2\ndatasets 3.4.0\ndill 0.3.8\nexceptiongroup 1.2.2\nfastapi 0.115.11\nffmpy 0.5.0\nfilelock 3.18.0\nfrozenlist 1.5.0\nfsspec 2024.12.0\ngradio 5.21.0\ngradio_client 1.7.2\ngroovy 0.1.2\nh11 0.14.0\nhf_transfer 0.1.9\nhttpcore 1.0.7\nhttpx 0.28.1\nhuggingface-hub 0.29.3\nidna 3.10\nitsdangerous 2.2.0\nJinja2 3.1.6\nmarkdown-it-py 3.0.0\nMarkupSafe 2.1.5\nmdurl 0.1.2\nmultidict 6.1.0\nmultiprocess 0.70.16\nnumpy 2.2.4\norjson 3.10.15\npackaging 24.2\npandas 2.2.3\npillow 11.1.0\npip 25.0.1\npropcache 0.3.0\nprotobuf 3.20.3\npsutil 5.9.8\npyarrow 19.0.1\npycparser 2.22\npydantic 2.10.6\npydantic_core 2.27.2\npydub 0.25.1\nPygments 2.19.1\npython-dateutil 2.9.0.post0\npython-multipart 0.0.20\npytz 2025.1\nPyYAML 6.0.2\nrequests 2.32.3\nrich 13.9.4\nruff 0.11.0\nsafehttpx 0.1.6\nsemantic-version 2.10.0\nsetuptools 65.5.1\nshellingham 1.5.4\nsix 1.17.0\nsniffio 1.3.1\nspaces 0.32.0\nstarlette 0.46.1\ntomlkit 0.13.2\ntqdm 4.67.1\ntyper 0.15.2\ntyping_extensions 4.12.2\ntzdata 2025.1\nurllib3 2.3.0\nuvicorn 0.34.0\nwebsockets 15.0.1\nwheel 0.45.1\nxxhash 3.5.0\nyarl 1.18.3\n</code></pre>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">import gradio as gr\nimport subprocess\n\no = subprocess.run(\"pip list\", shell=True, check=False, capture_output=True)\npiplist = o.stdout.decode().strip()\n\ndef test():\n return piplist\n\nwith gr.Blocks() as demo:\n run_button = gr.Button(\"Run\", variant=\"primary\")\n info = gr.Textbox(label=\"Output\", value=\"\", show_copy_button=True)\n run_button.click(test, None, [info])\n\ndemo.launch()\n</code></pre>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-17T11:29:44.217Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 16, "yours": false, "topic_id": 146096, "topic_slug": "huggingface-docker-python-packages", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/templates", "internal": false, "reflection": false, "title": "templates (Templates)", "clicks": 0 }, { "url": "https://github.com/orgs/huggingface/repositories", "internal": false, "reflection": false, "title": "huggingface repositories · GitHub", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/huggingface-docker-python-packages/146096/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209699, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-17T23:29:57.234Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-17T23:29:57.234Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 146096, "topic_slug": "huggingface-docker-python-packages", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/huggingface-docker-python-packages/146096/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Is there a list of python packages which come with the docker container for a Streamlit/Gradio space on huggingface?</p> <p>Otherwise, how do we check for this? I am trying to avoid reinstalling packages in my requirements.txt if they are found in the docker container. Hopefully this will improve the build time for my Streamlit app.</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/templates"> <header class="source"> <a href="https://huggingface.co/templates" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/f/3/f3680f347e119820ea26156b31afa7d86d039dbe_2_690x372.png" class="thumbnail" data-dominant-color="050504" width="690" height="372"></div> <h3><a href="https://huggingface.co/templates" target="_blank" rel="noopener">templates (Templates)</a></h3> <p>Inference</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/orgs/huggingface/repositories"> <header class="source"> <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32"> <a href="https://github.com/orgs/huggingface/repositories" target="_blank" rel="noopener">GitHub</a> </header> <article class="onebox-body"> <img width="175" height="175" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/9/4/9448925324eeb148df454360814c3b99a61f3d92.png" class="thumbnail onebox-avatar" data-dominant-color="F4CC50"> <h3><a href="https://github.com/orgs/huggingface/repositories" target="_blank" rel="noopener">Hugging Face</a></h3> <p>The AI community building the future. Hugging Face has 300 repositories available. Follow their code on GitHub.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <p> It seems like it should be there, but I can’t find it… The following is the result of using an extremely primitive method to obtain the dependencies for the Gradio 5.21.0 environment.</p> <pre data-code-wrap="py"><code class="lang-py">Package Version ------------------ ----------- aiofiles 23.2.1 aiohappyeyeballs 2.6.1 aiohttp 3.11.13 aiosignal 1.3.2 annotated-types 0.7.0 anyio 4.8.0 async-timeout 5.0.1 attrs 25.3.0 Authlib 1.5.1 certifi 2025.1.31 cffi 1.17.1 charset-normalizer 3.4.1 click 8.0.4 cryptography 44.0.2 datasets 3.4.0 dill 0.3.8 exceptiongroup 1.2.2 fastapi 0.115.11 ffmpy 0.5.0 filelock 3.18.0 frozenlist 1.5.0 fsspec 2024.12.0 gradio 5.21.0 gradio_client 1.7.2 groovy 0.1.2 h11 0.14.0 hf_transfer 0.1.9 httpcore 1.0.7 httpx 0.28.1 huggingface-hub 0.29.3 idna 3.10 itsdangerous 2.2.0 Jinja2 3.1.6 markdown-it-py 3.0.0 MarkupSafe 2.1.5 mdurl 0.1.2 multidict 6.1.0 multiprocess 0.70.16 numpy 2.2.4 orjson 3.10.15 packaging 24.2 pandas 2.2.3 pillow 11.1.0 pip 25.0.1 propcache 0.3.0 protobuf 3.20.3 psutil 5.9.8 pyarrow 19.0.1 pycparser 2.22 pydantic 2.10.6 pydantic_core 2.27.2 pydub 0.25.1 Pygments 2.19.1 python-dateutil 2.9.0.post0 python-multipart 0.0.20 pytz 2025.1 PyYAML 6.0.2 requests 2.32.3 rich 13.9.4 ruff 0.11.0 safehttpx 0.1.6 semantic-version 2.10.0 setuptools 65.5.1 shellingham 1.5.4 six 1.17.0 sniffio 1.3.1 spaces 0.32.0 starlette 0.46.1 tomlkit 0.13.2 tqdm 4.67.1 typer 0.15.2 typing_extensions 4.12.2 tzdata 2025.1 urllib3 2.3.0 uvicorn 0.34.0 websockets 15.0.1 wheel 0.45.1 xxhash 3.5.0 yarl 1.18.3 </code></pre> <pre data-code-wrap="py"><code class="lang-py">import gradio as gr import subprocess o = subprocess.run("pip list", shell=True, check=False, capture_output=True) piplist = o.stdout.decode().strip() def test(): return piplist with gr.Blocks() as demo: run_button = gr.Button("Run", variant="primary") info = gr.Textbox(label="Output", value="", show_copy_button=True) run_button.click(test, None, [info]) demo.launch() </code></pre>
Getting Additional response from my RAG using HuggingFaceEndpoint inference
https://discuss.huggingface.co/t/getting-additional-response-from-my-rag-using-huggingfaceendpoint-inference/145964
145,964
5
2025-03-16T09:00:09.353000Z
[ { "id": 209341, "name": "Aamir Ansari", "username": "solo-leveling", "avatar_template": "/user_avatar/discuss.huggingface.co/solo-leveling/{size}/43389_2.png", "created_at": "2025-03-16T09:00:09.433Z", "cooked": "<p>Hi folks</p>\n<p>I am utilising remote inference using HuggingFaceEndpoint:</p>\n<pre><code class=\"lang-auto\">llm = HuggingFaceEndpoint(\n repo_id=\"huggingfaceh4/zephyr-7b-alpha\",\n task=\"text-generation\",\n temperature=0.5,\n max_new_tokens=1024\n)\n</code></pre>\n<p>I have used <code>langchain-ai/retrieval-qa-chat</code> prompt, vectorstore retriever and created rag chain using below approach:</p>\n<pre><code class=\"lang-auto\">combine_docs_chain = create_stuff_documents_chain(llm, retrieval_qa_chat_prompt)\nrag_chain = create_retrieval_chain(retriever, combine_docs_chain)\n</code></pre>\n<p><strong>Input:</strong> Which runtime does Transformers.js uses<br>\n<strong>Sample answer I am getting</strong><br>\n‘answer’: ’ to run models in the browser?\\nAssistant: Transformers.js uses ONNX Runtime to run models in the browser.’</p>\n<p>Any idea, why I am getting extra result before <strong>Assistant: Transformers.js uses ONNX Runtime to run models in the browser.</strong></p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-16T09:03:41.147Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 54, "reads": 7, "readers_count": 6, "score": 276.4, "yours": false, "topic_id": 145964, "topic_slug": "getting-additional-response-from-my-rag-using-huggingfaceendpoint-inference", "display_username": "Aamir Ansari", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87335, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/getting-additional-response-from-my-rag-using-huggingfaceendpoint-inference/145964/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209369, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-16T13:13:00.286Z", "cooked": "<p>I’ve never used LangChain, so I don’t know, but isn’t that just the output of LLM?<br>\nI think there are ways to specify a template and have it output as much as possible as is, or to parse it using OutputParser, etc.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://python.langchain.com/docs/concepts/output_parsers/\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/a/6/a6c11d41373802deca73cc066c22326bc9e2a618.png\" class=\"site-icon\" data-dominant-color=\"5D7376\" width=\"32\" height=\"32\">\n\n <a href=\"https://python.langchain.com/docs/concepts/output_parsers/\" target=\"_blank\" rel=\"noopener\">python.langchain.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/360;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/d/0d1a958541ff86ef0ce789e860655617cfab3eca_2_690x360.png\" class=\"thumbnail\" data-dominant-color=\"2F494A\" width=\"690\" height=\"360\"></div>\n\n<h3><a href=\"https://python.langchain.com/docs/concepts/output_parsers/\" target=\"_blank\" rel=\"noopener\">Output parsers | 🦜️🔗 LangChain</a></h3>\n\n <p>The information here refers to parsers that take a text output from a model try to parse it into a more structured representation.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://python.langchain.com/v0.2/api_reference/huggingface/llms/langchain_huggingface.llms.huggingface_endpoint.HuggingFaceEndpoint.html#langchain_huggingface.llms.huggingface_endpoint.HuggingFaceEndpoint\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/a/6/a6c11d41373802deca73cc066c22326bc9e2a618.png\" class=\"site-icon\" data-dominant-color=\"5D7376\" width=\"32\" height=\"32\">\n\n <a href=\"https://python.langchain.com/v0.2/api_reference/huggingface/llms/langchain_huggingface.llms.huggingface_endpoint.HuggingFaceEndpoint.html#langchain_huggingface.llms.huggingface_endpoint.HuggingFaceEndpoint\" target=\"_blank\" rel=\"noopener\">python.langchain.com</a>\n </header>\n\n <article class=\"onebox-body\">\n \n\n<h3><a href=\"https://python.langchain.com/v0.2/api_reference/huggingface/llms/langchain_huggingface.llms.huggingface_endpoint.HuggingFaceEndpoint.html#langchain_huggingface.llms.huggingface_endpoint.HuggingFaceEndpoint\" target=\"_blank\" rel=\"noopener\">HuggingFaceEndpoint — 🦜🔗 LangChain documentation</a></h3>\n\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://www.geeksforgeeks.org/how-to-build-rag-pipelines-for-llm-projects/\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/e/b/eb43f6eeac1480d83f476ebbc7b8ea0e3a29ec05.png\" class=\"site-icon\" data-dominant-color=\"2F8D46\" width=\"32\" height=\"32\">\n\n <a href=\"https://www.geeksforgeeks.org/how-to-build-rag-pipelines-for-llm-projects/\" target=\"_blank\" rel=\"noopener\" title=\"06:51PM - 14 February 2025\">GeeksforGeeks – 14 Feb 25</a>\n </header>\n\n <article class=\"onebox-body\">\n <img width=\"200\" height=\"200\" src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/5/3586e788adf651d62a60e5952aa10b60595da04b_2_200x200.webp\" class=\"thumbnail onebox-avatar\" data-dominant-color=\"3D60A0\">\n\n<h3><a href=\"https://www.geeksforgeeks.org/how-to-build-rag-pipelines-for-llm-projects/\" target=\"_blank\" rel=\"noopener\">How to Build RAG Pipelines for LLM Projects? - GeeksforGeeks</a></h3>\n\n <p>Integrating Retrieval-Augmented Generation (RAG) pipelines with Large Language Models (LLMs) enhances their ability to provide accurate, context-specific responses by incorporating external knowledge sources.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-16T13:13:00.286Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 5, "readers_count": 4, "score": 26, "yours": false, "topic_id": 145964, "topic_slug": "getting-additional-response-from-my-rag-using-huggingfaceendpoint-inference", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://www.geeksforgeeks.org/how-to-build-rag-pipelines-for-llm-projects/", "internal": false, "reflection": false, "title": "How to Build RAG Pipelines for LLM Projects? - GeeksforGeeks", "clicks": 5 }, { "url": "https://python.langchain.com/v0.2/api_reference/huggingface/llms/langchain_huggingface.llms.huggingface_endpoint.HuggingFaceEndpoint.html#langchain_huggingface.llms.huggingface_endpoint.HuggingFaceEndpoint", "internal": false, "reflection": false, "title": "HuggingFaceEndpoint — 🦜🔗 LangChain documentation", "clicks": 3 }, { "url": "https://python.langchain.com/docs/concepts/output_parsers/", "internal": false, "reflection": false, "title": "Output parsers | 🦜️🔗 LangChain", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/getting-additional-response-from-my-rag-using-huggingfaceendpoint-inference/145964/2", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209393, "name": "Aamir Ansari", "username": "solo-leveling", "avatar_template": "/user_avatar/discuss.huggingface.co/solo-leveling/{size}/43389_2.png", "created_at": "2025-03-16T16:48:44.770Z", "cooked": "<p>Thanks.</p>\n<p>The GFG link helped.<br>\nI needed to create prompt in the Zephyr format since I am using Zephyr model.</p>\n<p>This is the prompt that helped give output without additional response in the start:</p>\n<pre><code class=\"lang-auto\">chat_prompt_2 = ChatPromptTemplate.from_template(\"\"\"\n&lt;|system|&gt;\nYou are an AI Assistant that follows instructions extremely well.\nPlease be truthful and give direct answers. Please tell 'I don't know' if user query is not in context.\n&lt;/s&gt;\n&lt;|user|&gt;\nContext: {context}\n\nQuestion: {input}\n&lt;/s&gt;\n&lt;|assistant|&gt;\n\"\"\")\n</code></pre>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-16T16:48:44.770Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 1, "reads": 4, "readers_count": 3, "score": 20.8, "yours": false, "topic_id": 145964, "topic_slug": "getting-additional-response-from-my-rag-using-huggingfaceendpoint-inference", "display_username": "Aamir Ansari", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87335, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/getting-additional-response-from-my-rag-using-huggingfaceendpoint-inference/145964/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209488, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-17T04:48:49.987Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-03-17T04:48:49.987Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 145964, "topic_slug": "getting-additional-response-from-my-rag-using-huggingfaceendpoint-inference", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/getting-additional-response-from-my-rag-using-huggingfaceendpoint-inference/145964/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi folks</p> <p>I am utilising remote inference using HuggingFaceEndpoint:</p> <pre><code class="lang-auto">llm = HuggingFaceEndpoint( repo_id="huggingfaceh4/zephyr-7b-alpha", task="text-generation", temperature=0.5, max_new_tokens=1024 ) </code></pre> <p>I have used <code>langchain-ai/retrieval-qa-chat</code> prompt, vectorstore retriever and created rag chain using below approach:</p> <pre><code class="lang-auto">combine_docs_chain = create_stuff_documents_chain(llm, retrieval_qa_chat_prompt) rag_chain = create_retrieval_chain(retriever, combine_docs_chain) </code></pre> <p><strong>Input:</strong> Which runtime does Transformers.js uses<br> <strong>Sample answer I am getting</strong><br> ‘answer’: ’ to run models in the browser?\nAssistant: Transformers.js uses ONNX Runtime to run models in the browser.’</p> <p>Any idea, why I am getting extra result before <strong>Assistant: Transformers.js uses ONNX Runtime to run models in the browser.</strong></p>
<p>Thanks.</p> <p>The GFG link helped.<br> I needed to create prompt in the Zephyr format since I am using Zephyr model.</p> <p>This is the prompt that helped give output without additional response in the start:</p> <pre><code class="lang-auto">chat_prompt_2 = ChatPromptTemplate.from_template(""" &lt;|system|&gt; You are an AI Assistant that follows instructions extremely well. Please be truthful and give direct answers. Please tell 'I don't know' if user query is not in context. &lt;/s&gt; &lt;|user|&gt; Context: {context} Question: {input} &lt;/s&gt; &lt;|assistant|&gt; """) </code></pre>
Why does automodelforcausallm.from_pretrained() work on base models and not instruct models?
https://discuss.huggingface.co/t/why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models/145799
145,799
9
2025-03-14T16:31:16.797000Z
[ { "id": 209122, "name": "Qiyao Wei", "username": "QiyaoWei", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/q/8797f3/{size}.png", "created_at": "2025-03-14T16:31:16.856Z", "cooked": "<pre><code class=\"lang-auto\">from transformers import AutoModelForCausalLM, AutoTokenizer\nmodel = AutoModelForCausalLM.from_pretrained(\"meta-llama/Llama-3.1-8B\")\n</code></pre>\n<p>loads the model successfully, but</p>\n<pre><code class=\"lang-auto\">from transformers import AutoModelForCausalLM, AutoTokenizer\nmodel = AutoModelForCausalLM.from_pretrained(\"meta-llama/Llama-3.1-8B-Instruct\")\n</code></pre>\n<p>results in the following error</p>\n<pre><code class=\"lang-auto\">Error no file named pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory meta-llama/Llama-3.1-8B-Instruct.\n File \"train.py\", line 59, in &lt;module&gt;\n model = AutoModelForCausalLM.from_pretrained(\"meta-llama/Llama-3.1-8B-Instruct\", token=access_token)\nOSError: Error no file named pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory meta-llama/Llama-3.1-8B-Instruct.\n</code></pre>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-14T16:31:16.856Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 74, "reads": 10, "readers_count": 9, "score": 377, "yours": false, "topic_id": 145799, "topic_slug": "why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models", "display_username": "Qiyao Wei", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 42125, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models/145799/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209179, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-14T23:43:12.157Z", "cooked": "<p>If you try to read a file that is not in the Hugging Face format, you may get that error, but it looks like it’s in the Hugging Face format…</p>\n<p>Only the original folder has its own format…</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/meta-llama/llama-models/issues/159\">\n <header class=\"source\">\n\n <a href=\"https://github.com/meta-llama/llama-models/issues/159\" target=\"_blank\" rel=\"noopener\">github.com/meta-llama/llama-models</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/meta-llama/llama-models/issues/159\" target=\"_blank\" rel=\"noopener\">Error no file named pytorch_model.bin, model.safetensors</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-09-28\" data-time=\"11:10:12\" data-timezone=\"UTC\">11:10AM - 28 Sep 24 UTC</span>\n </div>\n\n\n <div class=\"user\">\n <a href=\"https://github.com/morbidod\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/f/0/f0810981b951b31fd5d84ee1bd330c1e78c3f7a7.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"D9B6E1\">\n morbidod\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">Hello,\n\nI successfully downloaded the model to this directory /root/.llama/che<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">ckpoints/Llama3.2-1B-Instruct\nWhen I launch the AutoModelForCausalLM.from_pretrained passing the path above I got the following error:\n\nOSError: Error no file named pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory /root/.llama/checkpoints/Llama3.2-1B-Instruct.\n\n(AutomodelForCasualLM is from latest transformers library (pip install -U transformers).\n\nThanks in advance for any suggestion.</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/4/2/4202be9a1d6b37ce693128f2e207059068ab6f2c_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5B70A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct\" target=\"_blank\" rel=\"noopener\">meta-llama/Llama-3.1-8B-Instruct · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-14T23:43:12.157Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 9, "readers_count": 8, "score": 11.8, "yours": false, "topic_id": 145799, "topic_slug": "why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/meta-llama/llama-models/issues/159", "internal": false, "reflection": false, "title": "Error no file named pytorch_model.bin, model.safetensors · Issue #159 · meta-llama/llama-models · GitHub", "clicks": 1 }, { "url": "https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct", "internal": false, "reflection": false, "title": "meta-llama/Llama-3.1-8B-Instruct · Hugging Face", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models/145799/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209200, "name": "Anirudh Gangadhar", "username": "anivader", "avatar_template": "/user_avatar/discuss.huggingface.co/anivader/{size}/42843_2.png", "created_at": "2025-03-15T03:54:08.247Z", "cooked": "<p>Weird. Do you also get this error msg with <code>Llama-3.1-70B-Instruct</code>?<br>\nI would download the model first and set the appropriate path.<br>\nWorked for me.</p>\n<pre><code class=\"lang-auto\">def download_model_to_cache(model_id: str): \n try:\n # Download full model snapshot to cache\n snapshot_download(repo_id=model_id, local_dir=None)\n print(\"\\n✓ Model successfully downloaded to cache!\")\n except Exception as e:\n print(f\"\\n❌ Error downloading {model_id}: {str(e)}\")\n raise```</code></pre>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-15T03:54:08.247Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 16.6, "yours": false, "topic_id": 145799, "topic_slug": "why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models", "display_username": "Anirudh Gangadhar", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86446, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models/145799/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209275, "name": "Qiyao Wei", "username": "QiyaoWei", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/q/8797f3/{size}.png", "created_at": "2025-03-15T19:35:26.551Z", "cooked": "<p>Same here. I managed to resolve this problem by downloading the model first with <code>huggingface-cli download xxx</code> and then explicitly pointing to the download path (as observed above you might have to <code>convert_llama_weights_to_hf.py</code> if the model weights are not in hf format.<br>\nIn sum, explicitly downloading the model works, just not sure why loading the model with <code>from_pretrained()</code> fails</p>", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-15T19:35:26.551Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 7, "readers_count": 6, "score": 36.4, "yours": false, "topic_id": 145799, "topic_slug": "why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models", "display_username": "Qiyao Wei", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 42125, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models/145799/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209333, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-16T07:35:51.378Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-03-16T07:35:51.378Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 145799, "topic_slug": "why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-does-automodelforcausallm-from-pretrained-work-on-base-models-and-not-instruct-models/145799/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<pre><code class="lang-auto">from transformers import AutoModelForCausalLM, AutoTokenizer model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B") </code></pre> <p>loads the model successfully, but</p> <pre><code class="lang-auto">from transformers import AutoModelForCausalLM, AutoTokenizer model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct") </code></pre> <p>results in the following error</p> <pre><code class="lang-auto">Error no file named pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory meta-llama/Llama-3.1-8B-Instruct. File "train.py", line 59, in &lt;module&gt; model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.1-8B-Instruct", token=access_token) OSError: Error no file named pytorch_model.bin, model.safetensors, tf_model.h5, model.ckpt.index or flax_model.msgpack found in directory meta-llama/Llama-3.1-8B-Instruct. </code></pre>
<p>Same here. I managed to resolve this problem by downloading the model first with <code>huggingface-cli download xxx</code> and then explicitly pointing to the download path (as observed above you might have to <code>convert_llama_weights_to_hf.py</code> if the model weights are not in hf format.<br> In sum, explicitly downloading the model works, just not sure why loading the model with <code>from_pretrained()</code> fails</p>
Prepaid Mastercard
https://discuss.huggingface.co/t/prepaid-mastercard/130479
130,479
12
2024-12-11T02:01:46.752000Z
[ { "id": 188107, "name": "Samir B", "username": "Singing4Jesus", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/a8b319/{size}.png", "created_at": "2024-12-11T02:01:46.814Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/meganariley\">@meganariley</a>,</p>\n<p>I already emailed <a href=\"mailto:[email protected]\">[email protected]</a> regarding the issue, but was wondering if you could sort it out for me quicker. I tried to subscribe to a pro account but I’m not seeing I have a subscription nor a badge, despite having the money deducted from my prepaid Mastercard. If you could help, that’d be great. Cheers!</p>", "post_number": 1, "post_type": 1, "posts_count": 9, "updated_at": "2024-12-11T02:01:46.814Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 121, "reads": 23, "readers_count": 22, "score": 594.6, "yours": false, "topic_id": 130479, "topic_slug": "prepaid-mastercard", "display_username": "Samir B", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 76558, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/prepaid-mastercard/130479/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 188265, "name": "Megan Riley", "username": "meganariley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png", "created_at": "2024-12-11T16:50:35.510Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/singing4jesus\">@Singing4Jesus</a> When a payment method is added to an account, we’ll validate the card with a $10 hold, but don’t worry - this is not charged and the hold should clear within a few business days.</p>", "post_number": 2, "post_type": 1, "posts_count": 9, "updated_at": "2024-12-11T16:50:35.510Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 23, "readers_count": 22, "score": 24.6, "yours": false, "topic_id": 130479, "topic_slug": "prepaid-mastercard", "display_username": "Megan Riley", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 31941, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/prepaid-mastercard/130479/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 188339, "name": "Samir B", "username": "Singing4Jesus", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/a8b319/{size}.png", "created_at": "2024-12-12T02:38:42.582Z", "cooked": "<p>But does it mean my payment was accepted?</p>", "post_number": 3, "post_type": 1, "posts_count": 9, "updated_at": "2024-12-12T02:38:42.582Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 22, "readers_count": 21, "score": 19.4, "yours": false, "topic_id": 130479, "topic_slug": "prepaid-mastercard", "display_username": "Samir B", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 76558, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/prepaid-mastercard/130479/3", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 31941, "username": "meganariley", "name": "Megan Riley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png" }, "action_code": null, "via_email": null }, { "id": 188357, "name": "Philip Martinez", "username": "philipmartinez", "avatar_template": "/user_avatar/discuss.huggingface.co/philipmartinez/{size}/37398_2.png", "created_at": "2024-12-12T03:40:01.427Z", "cooked": "<p>Dear Sirs:</p>\n<p>For security reasons I do not use a credit card, so I ask you to indicate another payment method and request that the amounts on my debit card be restored promptly.</p>", "post_number": 4, "post_type": 1, "posts_count": 9, "updated_at": "2024-12-12T03:40:01.427Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 20, "readers_count": 19, "score": 39, "yours": false, "topic_id": 130479, "topic_slug": "prepaid-mastercard", "display_username": "Philip Martinez", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 76689, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/prepaid-mastercard/130479/4", "reactions": [ { "id": "eyes", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 188748, "name": "Philip Martinez", "username": "philipmartinez", "avatar_template": "/user_avatar/discuss.huggingface.co/philipmartinez/{size}/37398_2.png", "created_at": "2024-12-13T22:11:26.369Z", "cooked": "<p>Hi everyone, I haven’t heard back. Can you help me contact someone?</p>", "post_number": 5, "post_type": 1, "posts_count": 9, "updated_at": "2024-12-13T22:11:26.369Z", "reply_count": 0, "reply_to_post_number": 4, "quote_count": 0, "incoming_link_count": 1, "reads": 18, "readers_count": 17, "score": 23.6, "yours": false, "topic_id": 130479, "topic_slug": "prepaid-mastercard", "display_username": "Philip Martinez", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 76689, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/prepaid-mastercard/130479/5", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 76689, "username": "philipmartinez", "name": "Philip Martinez", "avatar_template": "/user_avatar/discuss.huggingface.co/philipmartinez/{size}/37398_2.png" }, "action_code": null, "via_email": null }, { "id": 188862, "name": "Philip Martinez", "username": "philipmartinez", "avatar_template": "/user_avatar/discuss.huggingface.co/philipmartinez/{size}/37398_2.png", "created_at": "2024-12-14T16:27:43.643Z", "cooked": "<p>It seems strange to me that there is no quick response to this type of question, given that it is to hire a service and there is no support channel.</p>", "post_number": 7, "post_type": 1, "posts_count": 9, "updated_at": "2024-12-14T16:27:43.643Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 1, "reads": 17, "readers_count": 16, "score": 23.4, "yours": false, "topic_id": 130479, "topic_slug": "prepaid-mastercard", "display_username": "Philip Martinez", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 76689, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/prepaid-mastercard/130479/7", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 188864, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2024-12-14T16:31:02.784Z", "cooked": "<p><a class=\"mention\" href=\"/u/meganariley\">@meganariley</a> payment question or issue.</p>", "post_number": 8, "post_type": 1, "posts_count": 9, "updated_at": "2024-12-14T16:31:02.784Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 15, "readers_count": 14, "score": 18, "yours": false, "topic_id": 130479, "topic_slug": "prepaid-mastercard", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/prepaid-mastercard/130479/8", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209096, "name": "Megan Riley", "username": "meganariley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png", "created_at": "2025-03-14T14:55:58.014Z", "cooked": "<p>Hi all! If you’re having any issues with billing, please reach out to <a href=\"mailto:[email protected]\">[email protected]</a>.</p>", "post_number": 9, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-14T14:55:58.014Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 10, "readers_count": 9, "score": 27, "yours": false, "topic_id": 130479, "topic_slug": "prepaid-mastercard", "display_username": "Megan Riley", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 31941, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/prepaid-mastercard/130479/9", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209196, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-15T02:55:58.999Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 10, "post_type": 3, "posts_count": 9, "updated_at": "2025-03-15T02:55:58.999Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 8, "readers_count": 7, "score": 16.6, "yours": false, "topic_id": 130479, "topic_slug": "prepaid-mastercard", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/prepaid-mastercard/130479/10", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi <a class="mention" href="/u/meganariley">@meganariley</a>,</p> <p>I already emailed <a href="mailto:[email protected]">[email protected]</a> regarding the issue, but was wondering if you could sort it out for me quicker. I tried to subscribe to a pro account but I’m not seeing I have a subscription nor a badge, despite having the money deducted from my prepaid Mastercard. If you could help, that’d be great. Cheers!</p>
<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>
Package compatibility issues
https://discuss.huggingface.co/t/package-compatibility-issues/145725
145,725
5
2025-03-14T07:20:18.397000Z
[ { "id": 209027, "name": "Dawid Niegrebecki", "username": "DawidN", "avatar_template": "/user_avatar/discuss.huggingface.co/dawidn/{size}/41585_2.png", "created_at": "2025-03-14T07:20:18.465Z", "cooked": "<p>Hi, so I’m new to hugging face, so far it’s been greating learning how all of the diffrent libraries interact with each other.</p>\n<p>One issue that I’m constantly running into is compatibility issues between libraries. For example I’m getting an error, then the solution is to change some package’s version to X.</p>\n<p>My question is, whether there is some kind of a compatibility matrix, or how do I know which versions work together.</p>\n<p>I’m happy to get any suggestions!</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-14T07:20:18.465Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 17, "reads": 6, "readers_count": 5, "score": 101.2, "yours": false, "topic_id": 145725, "topic_slug": "package-compatibility-issues", "display_username": "Dawid Niegrebecki", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 84281, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/package-compatibility-issues/145725/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209039, "name": "Dawid Niegrebecki", "username": "DawidN", "avatar_template": "/user_avatar/discuss.huggingface.co/dawidn/{size}/41585_2.png", "created_at": "2025-03-14T08:52:43.423Z", "cooked": "<p>If anyone else will came across a similar issue. This was the cause in my case:</p>\n<p>I’m using paperspace notebooks, and I wasn’t aware that the “Start from scratch” notebook already came with pre-installed version of torch, which was 2.1.0, at the time of this the newest version is 2.6.1</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-14T08:52:43.423Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 6, "readers_count": 5, "score": 26.2, "yours": false, "topic_id": 145725, "topic_slug": "package-compatibility-issues", "display_username": "Dawid Niegrebecki", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 84281, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/package-compatibility-issues/145725/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 209160, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-14T20:53:09.126Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-14T20:53:09.126Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 0.8, "yours": false, "topic_id": 145725, "topic_slug": "package-compatibility-issues", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/package-compatibility-issues/145725/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi, so I’m new to hugging face, so far it’s been greating learning how all of the diffrent libraries interact with each other.</p> <p>One issue that I’m constantly running into is compatibility issues between libraries. For example I’m getting an error, then the solution is to change some package’s version to X.</p> <p>My question is, whether there is some kind of a compatibility matrix, or how do I know which versions work together.</p> <p>I’m happy to get any suggestions!</p>
<p>If anyone else will came across a similar issue. This was the cause in my case:</p> <p>I’m using paperspace notebooks, and I wasn’t aware that the “Start from scratch” notebook already came with pre-installed version of torch, which was 2.1.0, at the time of this the newest version is 2.6.1</p>
Model download statistics
https://discuss.huggingface.co/t/model-download-statistics/145580
145,580
23
2025-03-13T11:18:26.900000Z
[ { "id": 208816, "name": "Patrick Hallila", "username": "Ph94", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/p/df705f/{size}.png", "created_at": "2025-03-13T11:18:26.962Z", "cooked": "<p>I’m working on an academic project on how users select models when they have increasingly more options. For this, I’m collecting daily data on model downloads on Hugging Face. I, however, noticed that the total number of downloads decreases for some models between days. For example, the picture below shows it for OpenAI’s Whisper small model between 8/3/2025 and 9/3/2025.</p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/4/3/43351f0f30b3aae36b0315e63ab8e7ec1fbfbcd1.png\" data-download-href=\"/uploads/short-url/9AxNKyLobIH3eSFCKyWwUKmbYvn.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/4/3/43351f0f30b3aae36b0315e63ab8e7ec1fbfbcd1.png\" alt=\"image\" data-base62-sha1=\"9AxNKyLobIH3eSFCKyWwUKmbYvn\" width=\"690\" height=\"261\" data-dominant-color=\"F5F4F4\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">717×272 9.73 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>Could someone explain why this is the case?</p>\n<p>To collect the data, I’m running:</p>\n<p>model_list = list(api.list_models())</p>\n<p>I run that code daily at midnight.</p>\n<p>Thanks in advance!</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-13T11:18:26.962Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 72, "reads": 11, "readers_count": 10, "score": 377.2, "yours": false, "topic_id": 145580, "topic_slug": "model-download-statistics", "display_username": "Patrick Hallila", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87044, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-download-statistics/145580/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208857, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-13T14:14:20.168Z", "cooked": "<p>I think this is because it’s not the total amount of downloads, but the number of downloads in the last 30 days.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/huggingface_hub/v0.29.3/en/package_reference/hf_api#huggingface_hub.ModelInfo.downloads\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/huggingface_hub/v0.29.3/en/package_reference/hf_api#huggingface_hub.ModelInfo.downloads\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/e/cef3cd647e391927031467dbcde7613c74193f5f_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F1EFE9\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/huggingface_hub/v0.29.3/en/package_reference/hf_api#huggingface_hub.ModelInfo.downloads\" target=\"_blank\" rel=\"noopener\">HfApi Client</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<blockquote>\n<ul>\n<li><strong>downloads</strong> (<code>int</code>) — Number of downloads of the model over the last 30 days.<br>\n<strong>downloads_all_time</strong> (<code>int</code>) — Cumulated number of downloads of the model since its creation.</li>\n</ul>\n</blockquote>", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-13T14:14:20.168Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 9, "readers_count": 8, "score": 11.8, "yours": false, "topic_id": 145580, "topic_slug": "model-download-statistics", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/huggingface_hub/v0.29.3/en/package_reference/hf_api#huggingface_hub.ModelInfo.downloads", "internal": false, "reflection": false, "title": "HfApi Client", "clicks": 6 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-download-statistics/145580/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208858, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-13T14:18:19.063Z", "cooked": "<p>Also, let’s specify <strong>downloads_all_time</strong> with the <strong>expand=[“createdAt”, “likes”, “downloads”, “downloadsAllTime”]</strong> argument. Otherwise, it will usually return <strong>None</strong>.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/huggingface_hub/v0.29.3/package_reference/hf_api#huggingface_hub.HfApi.list_models.expand\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/huggingface_hub/v0.29.3/package_reference/hf_api#huggingface_hub.HfApi.list_models.expand\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/e/cef3cd647e391927031467dbcde7613c74193f5f_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F1EFE9\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/huggingface_hub/v0.29.3/package_reference/hf_api#huggingface_hub.HfApi.list_models.expand\" target=\"_blank\" rel=\"noopener\">HfApi Client</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<blockquote>\n<p><strong>expand</strong> (<code>List[ExpandModelProperty_T]</code>, <em>optional</em>) — List properties to return in the response. When used, only the properties in the list will be returned. This parameter cannot be used if <code>full</code>, <code>cardData</code> or <code>fetch_config</code> are passed. Possible values are <code>\"author\"</code>, <code>\"baseModels\"</code>, <code>\"cardData\"</code>, <code>\"childrenModelCount\"</code>, <code>\"config\"</code>, <code>\"createdAt\"</code>, <code>\"disabled\"</code>, <code>\"downloads\"</code>, <code>\"downloadsAllTime\"</code>, <code>\"gated\"</code>, <code>\"gguf\"</code>, <code>\"inference\"</code>, <code>\"inferenceProviderMapping\"</code>, <code>\"lastModified\"</code>, <code>\"library_name\"</code>, <code>\"likes\"</code>, <code>\"mask_token\"</code>, <code>\"model-index\"</code>, <code>\"pipeline_tag\"</code>, <code>\"private\"</code>, <code>\"safetensors\"</code>, <code>\"sha\"</code>, <code>\"siblings\"</code>, <code>\"spaces\"</code>, <code>\"tags\"</code>, <code>\"transformersInfo\"</code>, <code>\"trendingScore\"</code>, <code>\"widgetData\"</code>, <code>\"usedStorage\"</code> and <code>\"resourceGroup\"</code>.</p>\n</blockquote>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-13T14:20:28.656Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 21.4, "yours": false, "topic_id": 145580, "topic_slug": "model-download-statistics", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/huggingface_hub/v0.29.3/package_reference/hf_api#huggingface_hub.HfApi.list_models.expand", "internal": false, "reflection": false, "title": "HfApi Client", "clicks": 2 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-download-statistics/145580/3", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208893, "name": "Patrick Hallila", "username": "Ph94", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/p/df705f/{size}.png", "created_at": "2025-03-13T17:30:01.435Z", "cooked": "<p>Thanks that seemed to solve the issue.</p>", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-13T17:30:01.435Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 16.2, "yours": false, "topic_id": 145580, "topic_slug": "model-download-statistics", "display_username": "Patrick Hallila", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87044, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-download-statistics/145580/4", "reactions": [ { "id": "confetti_ball", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 209008, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-14T05:30:46.162Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-03-14T05:30:46.162Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 1, "yours": false, "topic_id": 145580, "topic_slug": "model-download-statistics", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-download-statistics/145580/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I’m working on an academic project on how users select models when they have increasingly more options. For this, I’m collecting daily data on model downloads on Hugging Face. I, however, noticed that the total number of downloads decreases for some models between days. For example, the picture below shows it for OpenAI’s Whisper small model between 8/3/2025 and 9/3/2025.</p> <p><div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/4/3/43351f0f30b3aae36b0315e63ab8e7ec1fbfbcd1.png" data-download-href="/uploads/short-url/9AxNKyLobIH3eSFCKyWwUKmbYvn.png?dl=1" title="image" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/4/3/43351f0f30b3aae36b0315e63ab8e7ec1fbfbcd1.png" alt="image" data-base62-sha1="9AxNKyLobIH3eSFCKyWwUKmbYvn" width="690" height="261" data-dominant-color="F5F4F4"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">717×272 9.73 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p> <p>Could someone explain why this is the case?</p> <p>To collect the data, I’m running:</p> <p>model_list = list(api.list_models())</p> <p>I run that code daily at midnight.</p> <p>Thanks in advance!</p>
<p>Also, let’s specify <strong>downloads_all_time</strong> with the <strong>expand=[“createdAt”, “likes”, “downloads”, “downloadsAllTime”]</strong> argument. Otherwise, it will usually return <strong>None</strong>.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/huggingface_hub/v0.29.3/package_reference/hf_api#huggingface_hub.HfApi.list_models.expand"> <header class="source"> <a href="https://huggingface.co/docs/huggingface_hub/v0.29.3/package_reference/hf_api#huggingface_hub.HfApi.list_models.expand" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/e/cef3cd647e391927031467dbcde7613c74193f5f_2_690x372.png" class="thumbnail" data-dominant-color="F1EFE9" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/huggingface_hub/v0.29.3/package_reference/hf_api#huggingface_hub.HfApi.list_models.expand" target="_blank" rel="noopener">HfApi Client</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <blockquote> <p><strong>expand</strong> (<code>List[ExpandModelProperty_T]</code>, <em>optional</em>) — List properties to return in the response. When used, only the properties in the list will be returned. This parameter cannot be used if <code>full</code>, <code>cardData</code> or <code>fetch_config</code> are passed. Possible values are <code>"author"</code>, <code>"baseModels"</code>, <code>"cardData"</code>, <code>"childrenModelCount"</code>, <code>"config"</code>, <code>"createdAt"</code>, <code>"disabled"</code>, <code>"downloads"</code>, <code>"downloadsAllTime"</code>, <code>"gated"</code>, <code>"gguf"</code>, <code>"inference"</code>, <code>"inferenceProviderMapping"</code>, <code>"lastModified"</code>, <code>"library_name"</code>, <code>"likes"</code>, <code>"mask_token"</code>, <code>"model-index"</code>, <code>"pipeline_tag"</code>, <code>"private"</code>, <code>"safetensors"</code>, <code>"sha"</code>, <code>"siblings"</code>, <code>"spaces"</code>, <code>"tags"</code>, <code>"transformersInfo"</code>, <code>"trendingScore"</code>, <code>"widgetData"</code>, <code>"usedStorage"</code> and <code>"resourceGroup"</code>.</p> </blockquote>
Bug in models filtering by dataset?
https://discuss.huggingface.co/t/bug-in-models-filtering-by-dataset/145550
145,550
2
2025-03-13T09:55:14.813000Z
[ { "id": 208783, "name": "Alexander Rubinstein", "username": "arubique", "avatar_template": "/user_avatar/discuss.huggingface.co/arubique/{size}/43179_2.png", "created_at": "2025-03-13T09:55:14.874Z", "cooked": "<p>Hello everyone,</p>\n<p>I noticed a potential bug in the huggingface web interface.</p>\n<p>I want to filter models by those pre-trained or fine-tuned on the specified dataset, however, I notice inconsistency in this filtering.</p>\n<p>To demonstrate this let’s use <a href=\"https://huggingface.co/datasets/stanfordnlp/imdb\">imdb dataset</a>. On the dataset page I can see the first 6 results of the mentioned filtering in the “Models trained or fine-tuned on stanfordnlp/imdb” section (please see the left part of the screenshot, left and right parts are separated by the vertical dashed line).</p>\n<p>However, when I click the link “Browse 1407 models trained on this dataset” (it has the form of: <code>https://huggingface.co/models?dataset=dataset:stanfordnlp/imdb</code>), a search with an applied filter is opened. That search results only in 81 models (please see the right part of the screenshot).</p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/5/8/580f4778b617b2833a32c7d4cfc95956a86ebcc5.jpeg\" data-download-href=\"/uploads/short-url/cz0KGa3KbXYrVYXe4UpguHg68bb.jpeg?dl=1\" title=\"Merged\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/8/580f4778b617b2833a32c7d4cfc95956a86ebcc5_2_690x215.jpeg\" alt=\"Merged\" data-base62-sha1=\"cz0KGa3KbXYrVYXe4UpguHg68bb\" width=\"690\" height=\"215\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/8/580f4778b617b2833a32c7d4cfc95956a86ebcc5_2_690x215.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/8/580f4778b617b2833a32c7d4cfc95956a86ebcc5_2_1035x322.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/8/580f4778b617b2833a32c7d4cfc95956a86ebcc5_2_1380x430.jpeg 2x\" data-dominant-color=\"0E101D\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">Merged</span><span class=\"informations\">1920×599 92.4 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>I think it is a bug because the number of found models in the right part of the screenshot - 81 - is inconsistent with the 1407 models mentioned in the link title in the left part of the screenshot.</p>\n<p>Could you please confirm whether it is a bug and suggest solutions that would allow me to see the names of all 1407 models mentioned in the left part of the screenshot (now I can see only 6 names that are explicitly shown there)?</p>\n<p>Thank you in advance for your help!</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-13T10:05:38.085Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 23, "reads": 7, "readers_count": 6, "score": 131.4, "yours": false, "topic_id": 145550, "topic_slug": "bug-in-models-filtering-by-dataset", "display_username": "Alexander Rubinstein", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 3, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/datasets/stanfordnlp/imdb", "internal": false, "reflection": false, "title": "stanfordnlp/imdb · Datasets at Hugging Face", "clicks": 2 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87029, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/bug-in-models-filtering-by-dataset/145550/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208864, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-13T14:48:40.110Z", "cooked": "<p>I think that some of the datasets that can be referenced without an author name are divided into different names like this, whether it’s a bug in Hub or a feature.<img src=\"https://emoji.discourse-cdn.com/apple/thinking.png?v=14\" title=\":thinking:\" class=\"emoji\" alt=\":thinking:\" loading=\"lazy\" width=\"20\" height=\"20\"></p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/models?dataset=dataset:imdb\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/models?dataset=dataset:imdb\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/6/266aaa24c5d2d88538c59c7e1463ef2ab94b8c64_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F6F6F8\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/models?dataset=dataset:imdb\" target=\"_blank\" rel=\"noopener\">Models - Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/models?dataset=dataset:stanfordnlp%2Fimdb\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/models?dataset=dataset:stanfordnlp%2Fimdb\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/6/266aaa24c5d2d88538c59c7e1463ef2ab94b8c64_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F6F6F8\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/models?dataset=dataset:stanfordnlp%2Fimdb\" target=\"_blank\" rel=\"noopener\">Models - Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-13T14:48:40.110Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 6, "readers_count": 5, "score": 26.2, "yours": false, "topic_id": 145550, "topic_slug": "bug-in-models-filtering-by-dataset", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/models?dataset=dataset:imdb", "internal": false, "reflection": false, "title": "Models - Hugging Face", "clicks": 3 }, { "url": "https://huggingface.co/models?dataset=dataset:stanfordnlp%2Fimdb", "internal": false, "reflection": false, "title": "Models - Hugging Face", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/bug-in-models-filtering-by-dataset/145550/2", "reactions": [ { "id": "hugs", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208865, "name": "Alexander Rubinstein", "username": "arubique", "avatar_template": "/user_avatar/discuss.huggingface.co/arubique/{size}/43179_2.png", "created_at": "2025-03-13T14:59:19.728Z", "cooked": "<p>Oh, I see thanks! In this case with IMDB I should use <code>dataset:imdb</code> when filtering in addition to <code>stanfordnlp/imdb</code> used by default. Then I find 1326 more models in addition to the 81 models I found before when using <code>stanfordnlp/imdb</code>. Together they add up to 1326 + 81 = 1407 models mentioned on the dataset page. Now it makes sense, thank you!</p>\n<p>I think that it is still a bug because there is an inconsistency between the number of models I find when following the link from the dataset page - 81 and the number of models written in the title of this link - 1407.</p>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-13T14:59:19.728Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 16.2, "yours": false, "topic_id": 145550, "topic_slug": "bug-in-models-filtering-by-dataset", "display_username": "Alexander Rubinstein", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 87029, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/bug-in-models-filtering-by-dataset/145550/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 208866, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-13T15:27:38.985Z", "cooked": "<p>I think it’s a good issue to raise either of these. I don’t know if it’s a bug or a feature, but at the very least, it can’t be called the desired behavior…</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/huggingface/hub-docs/issues\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/huggingface/hub-docs/issues\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/344;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/d/7dd349288f8a02fb251062ebc9bd14e433f67b79_2_690x345.png\" class=\"thumbnail\" data-dominant-color=\"F4F2EB\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://github.com/huggingface/hub-docs/issues\" target=\"_blank\" rel=\"noopener\">huggingface/hub-docs</a></h3>\n\n <p>Docs of the Hugging Face Hub. Contribute to huggingface/hub-docs development by creating an account on GitHub.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/huggingface/huggingface_hub/issues\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/huggingface/huggingface_hub/issues\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/350;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/9/3/93152d4bd1ecf7bb826177a7c46c888beb440851_2_690x350.png\" class=\"thumbnail\" data-dominant-color=\"F8F5EA\" width=\"690\" height=\"350\"></div>\n\n<h3><a href=\"https://github.com/huggingface/huggingface_hub/issues\" target=\"_blank\" rel=\"noopener\">huggingface/huggingface_hub</a></h3>\n\n <p>The official Python client for the Huggingface Hub. - huggingface/huggingface_hub</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-13T15:27:38.985Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 16.2, "yours": false, "topic_id": 145550, "topic_slug": "bug-in-models-filtering-by-dataset", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/hub-docs/issues", "internal": false, "reflection": false, "title": "GitHub · Where software is built", "clicks": 4 }, { "url": "https://github.com/huggingface/huggingface_hub/issues", "internal": false, "reflection": false, "title": "GitHub · Where software is built", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/bug-in-models-filtering-by-dataset/145550/4", "reactions": [ { "id": "white_check_mark", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208994, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-14T03:27:47.209Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-03-14T03:27:47.209Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 1.2, "yours": false, "topic_id": 145550, "topic_slug": "bug-in-models-filtering-by-dataset", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/bug-in-models-filtering-by-dataset/145550/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello everyone,</p> <p>I noticed a potential bug in the huggingface web interface.</p> <p>I want to filter models by those pre-trained or fine-tuned on the specified dataset, however, I notice inconsistency in this filtering.</p> <p>To demonstrate this let’s use <a href="https://huggingface.co/datasets/stanfordnlp/imdb">imdb dataset</a>. On the dataset page I can see the first 6 results of the mentioned filtering in the “Models trained or fine-tuned on stanfordnlp/imdb” section (please see the left part of the screenshot, left and right parts are separated by the vertical dashed line).</p> <p>However, when I click the link “Browse 1407 models trained on this dataset” (it has the form of: <code>https://huggingface.co/models?dataset=dataset:stanfordnlp/imdb</code>), a search with an applied filter is opened. That search results only in 81 models (please see the right part of the screenshot).</p> <p><div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/5/8/580f4778b617b2833a32c7d4cfc95956a86ebcc5.jpeg" data-download-href="/uploads/short-url/cz0KGa3KbXYrVYXe4UpguHg68bb.jpeg?dl=1" title="Merged" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/8/580f4778b617b2833a32c7d4cfc95956a86ebcc5_2_690x215.jpeg" alt="Merged" data-base62-sha1="cz0KGa3KbXYrVYXe4UpguHg68bb" width="690" height="215" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/8/580f4778b617b2833a32c7d4cfc95956a86ebcc5_2_690x215.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/8/580f4778b617b2833a32c7d4cfc95956a86ebcc5_2_1035x322.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/8/580f4778b617b2833a32c7d4cfc95956a86ebcc5_2_1380x430.jpeg 2x" data-dominant-color="0E101D"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Merged</span><span class="informations">1920×599 92.4 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p> <p>I think it is a bug because the number of found models in the right part of the screenshot - 81 - is inconsistent with the 1407 models mentioned in the link title in the left part of the screenshot.</p> <p>Could you please confirm whether it is a bug and suggest solutions that would allow me to see the names of all 1407 models mentioned in the left part of the screenshot (now I can see only 6 names that are explicitly shown there)?</p> <p>Thank you in advance for your help!</p>
<p>I think that some of the datasets that can be referenced without an author name are divided into different names like this, whether it’s a bug in Hub or a feature.<img src="https://emoji.discourse-cdn.com/apple/thinking.png?v=14" title=":thinking:" class="emoji" alt=":thinking:" loading="lazy" width="20" height="20"></p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/models?dataset=dataset:imdb"> <header class="source"> <a href="https://huggingface.co/models?dataset=dataset:imdb" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/6/266aaa24c5d2d88538c59c7e1463ef2ab94b8c64_2_690x372.png" class="thumbnail" data-dominant-color="F6F6F8" width="690" height="372"></div> <h3><a href="https://huggingface.co/models?dataset=dataset:imdb" target="_blank" rel="noopener">Models - Hugging Face</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/models?dataset=dataset:stanfordnlp%2Fimdb"> <header class="source"> <a href="https://huggingface.co/models?dataset=dataset:stanfordnlp%2Fimdb" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/6/266aaa24c5d2d88538c59c7e1463ef2ab94b8c64_2_690x372.png" class="thumbnail" data-dominant-color="F6F6F8" width="690" height="372"></div> <h3><a href="https://huggingface.co/models?dataset=dataset:stanfordnlp%2Fimdb" target="_blank" rel="noopener">Models - Hugging Face</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Model does not exist, inference API don&rsquo;t work
https://discuss.huggingface.co/t/model-does-not-exist-inference-api-dont-work/145242
145,242
9
2025-03-11T16:07:53.572000Z
[ { "id": 208387, "name": "Xavier Castle", "username": "amusktweewt", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/a/dfb087/{size}.png", "created_at": "2025-03-11T16:07:53.630Z", "cooked": "<p>Hello!</p>\n<p>I have started developing LLM style models, and honestly, things were going well, and had this one working a couple of weeks ago and my friends tried it successfully.</p>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/amusktweewt/tiny-model-500M-chat-v2\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/amusktweewt/tiny-model-500M-chat-v2\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/a/0a338de4227deadd31ba48ad821eb00c7f1c60c6_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5C71A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/amusktweewt/tiny-model-500M-chat-v2\" target=\"_blank\" rel=\"noopener\">amusktweewt/tiny-model-500M-chat-v2 · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<p>For some reason, now I can neither use my space or the inference provider, getting the following error “Server amusktweewt/tiny-model-500M-chat-v2 does not seem to support chat completion. Error: Model amusktweewt/tiny-model-500M-chat-v2 does not exist”.</p>\n<p>I don’t know what happens because I changed nothing, literally the repo is frozen around a month ago and during that time it worked well, the model also works fine locally with a pipeline.</p>\n<p>Thank you all for your time!</p>", "post_number": 1, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-11T16:07:53.630Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 424, "reads": 34, "readers_count": 33, "score": 2131.8, "yours": false, "topic_id": 145242, "topic_slug": "model-does-not-exist-inference-api-dont-work", "display_username": "Xavier Castle", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/amusktweewt/tiny-model-500M-chat-v2", "internal": false, "reflection": false, "title": "amusktweewt/tiny-model-500M-chat-v2 · Hugging Face", "clicks": 13 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86793, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-does-not-exist-inference-api-dont-work/145242/1", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208395, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-11T16:47:58.144Z", "cooked": "<p>Seems token issue or under maintain.</p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">HF_TOKEN = \"hf_my_valid_pro_token\"\n#HF_TOKEN = False # if use it, fails with 503 error\n\nfrom huggingface_hub import InferenceClient\n\nclient = InferenceClient(\n provider=\"hf-inference\",\n api_key=HF_TOKEN\n)\n\nmessages = [\n {\n \"role\": \"user\",\n \"content\": \"What is the capital of France?\"\n }\n]\n\ncompletion = client.chat.completions.create(\n model=\"amusktweewt/tiny-model-500M-chat-v2\", \n messages=messages, \n max_tokens=500,\n)\n\nprint(completion.choices[0].message)\n# ChatCompletionOutputMessage(role='assistant', content='OUP for France - reduced price comparison board (BUFF) is the payoff for carbon emissions.', tool_calls=None)\n</code></pre>", "post_number": 2, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-11T16:47:58.144Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 5, "reads": 28, "readers_count": 27, "score": 30.6, "yours": false, "topic_id": 145242, "topic_slug": "model-does-not-exist-inference-api-dont-work", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-does-not-exist-inference-api-dont-work/145242/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208414, "name": "Megan Riley", "username": "meganariley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png", "created_at": "2025-03-11T19:49:46.131Z", "cooked": "<p>Hi! We’re taking a closer look into this and I’ll update you soon. Thanks for reporting!</p>", "post_number": 3, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-11T19:49:46.131Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 19, "reads": 23, "readers_count": 22, "score": 114.6, "yours": false, "topic_id": 145242, "topic_slug": "model-does-not-exist-inference-api-dont-work", "display_username": "Megan Riley", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/hugging-face-payment-error-402-youve-exceeded-monthly-quota/144968/6", "internal": true, "reflection": true, "title": "Hugging Face Payment Error 402 & You've Exceeded Monthly Quota", "clicks": 7 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 31941, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-does-not-exist-inference-api-dont-work/145242/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208614, "name": "Megan Riley", "username": "meganariley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png", "created_at": "2025-03-12T14:39:24.585Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/amusktweewt\">@amusktweewt</a> thanks again for reporting. This is now fixed! Let us know if you continue running into issues.</p>", "post_number": 4, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-12T14:39:24.585Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 5, "reads": 19, "readers_count": 18, "score": 58.8, "yours": false, "topic_id": 145242, "topic_slug": "model-does-not-exist-inference-api-dont-work", "display_username": "Megan Riley", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 31941, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-does-not-exist-inference-api-dont-work/145242/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208622, "name": "Xavier Castle", "username": "amusktweewt", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/a/dfb087/{size}.png", "created_at": "2025-03-12T15:26:42.170Z", "cooked": "<p>Thanks! it works perfectly now, both the space and the Inference API</p>", "post_number": 5, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-12T15:26:42.170Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 19, "readers_count": 18, "score": 23.8, "yours": false, "topic_id": 145242, "topic_slug": "model-does-not-exist-inference-api-dont-work", "display_username": "Xavier Castle", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86793, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-does-not-exist-inference-api-dont-work/145242/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208710, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-13T03:27:39.213Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 6, "post_type": 3, "posts_count": 6, "updated_at": "2025-03-13T03:27:39.213Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 17, "readers_count": 16, "score": 3.4, "yours": false, "topic_id": 145242, "topic_slug": "model-does-not-exist-inference-api-dont-work", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/model-does-not-exist-inference-api-dont-work/145242/6", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello!</p> <p>I have started developing LLM style models, and honestly, things were going well, and had this one working a couple of weeks ago and my friends tried it successfully.</p> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/amusktweewt/tiny-model-500M-chat-v2"> <header class="source"> <a href="https://huggingface.co/amusktweewt/tiny-model-500M-chat-v2" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/a/0a338de4227deadd31ba48ad821eb00c7f1c60c6_2_690x372.png" class="thumbnail" data-dominant-color="5C71A4" width="690" height="372"></div> <h3><a href="https://huggingface.co/amusktweewt/tiny-model-500M-chat-v2" target="_blank" rel="noopener">amusktweewt/tiny-model-500M-chat-v2 · Hugging Face</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <p>For some reason, now I can neither use my space or the inference provider, getting the following error “Server amusktweewt/tiny-model-500M-chat-v2 does not seem to support chat completion. Error: Model amusktweewt/tiny-model-500M-chat-v2 does not exist”.</p> <p>I don’t know what happens because I changed nothing, literally the repo is frozen around a month ago and during that time it worked well, the model also works fine locally with a pipeline.</p> <p>Thank you all for your time!</p>
<p>Hi <a class="mention" href="/u/amusktweewt">@amusktweewt</a> thanks again for reporting. This is now fixed! Let us know if you continue running into issues.</p>
Recommended max size of dataset?
https://discuss.huggingface.co/t/recommended-max-size-of-dataset/144812
144,812
10
2025-03-08T21:41:33.674000Z
[ { "id": 207794, "name": "Chris Liu", "username": "Aceticia", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/{size}.png", "created_at": "2025-03-08T21:41:33.761Z", "cooked": "<p>I’m about to create a large dataset directly, about ~1B samples with each sample being about [16 x 8000] size and some small meta data. Do you foresee any issues during generation, or loading this and using it after it’s finished generating? Any ideas are welcome, thank you.</p>", "post_number": 1, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-08T21:41:33.761Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 352, "reads": 11, "readers_count": 10, "score": 1722.2, "yours": false, "topic_id": 144812, "topic_slug": "recommended-max-size-of-dataset", "display_username": "Chris Liu", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/streaming-in-dataset-uploads/148177/2", "internal": true, "reflection": true, "title": "Streaming in dataset uploads", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 2619, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/recommended-max-size-of-dataset/144812/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207830, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-09T05:01:48.981Z", "cooked": "<p>It’s probably going to be over 500TB…</p>\n<p>If you’re going to upload more than 300GB of data to Hugging Face in a single repository, it’s better to consult with HF in advance by email. <a href=\"mailto:[email protected]\">[email protected]</a></p>\n<p>Also, if you’re using a large dataset for training with Hugging Face’s library or torch, it seems that sharding the dataset will make it run more stably. <a class=\"mention\" href=\"/u/lhoestq\">@lhoestq</a></p><aside class=\"quote quote-modified\" data-post=\"1\" data-topic=\"69288\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/aaditya/48/20855_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/how-to-load-a-large-hf-dataset-efficiently/69288\">How to load a large hf dataset efficiently?</a> <a class=\"badge-category__wrapper \" href=\"/c/datasets/10\"><span data-category-id=\"10\" style=\"--category-badge-color: #F7941D; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"This category is for any question related to the datasets library. You can also file an issue.\"><span class=\"badge-category__name\">🤗Datasets</span></span></a>\n </div>\n <blockquote>\n I am trying to load a dataset <a href=\"https://huggingface.co/datasets/axiong/pmc_oa\" class=\"inline-onebox\">axiong/pmc_oa · Datasets at Hugging Face</a> The dataset size is around 22 gb and I have ram ~10 GB, the dataset object is stuck at extracting file point \n <a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/5/258c7f7c2cf40022e356b4dd87a1edcc0a5e64f0.jpeg\" data-download-href=\"/uploads/short-url/5maGhrRBHkGMuew8P2YCcOp703u.jpeg?dl=1\" title=\"Screenshot 2024-01-16 at 8.41.53 AM\" rel=\"noopener nofollow ugc\">[Screenshot 2024-01-16 at 8.41.53 AM]</a> \nI also tried streaming mode but that’s giving another error. \nfrom datasets import load_dataset\ndataset = load_dataset(\"axiong/pmc_oa\", 'pmc_oa', split='train', streaming=True)\nprint(next(iter(dataset)))\n\n <a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/a/b/ab39de6876695cf089aef3c50ac9592cb4882ad4.jpeg\" data-download-href=\"/uploads/short-url/oqJD6yPD880dfaJ9RWMREJFqsAc.jpeg?dl=1\" title=\"Screenshot 2024-01-16 at 9.22.15 AM\" rel=\"noopener nofollow ugc\">[Screenshot 2024-01-16 at 9.22.15 AM]</a> \nAny suggestion on how to deal with…\n </blockquote>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/hub/storage-limits\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/hub/storage-limits\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"FAF8F2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/hub/storage-limits\" target=\"_blank\" rel=\"noopener\">Storage limits</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-09T05:01:48.981Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 12, "reads": 11, "readers_count": 10, "score": 67.2, "yours": false, "topic_id": 144812, "topic_slug": "recommended-max-size-of-dataset", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/hub/storage-limits", "internal": false, "reflection": false, "title": "Storage limits", "clicks": 9 }, { "url": "https://discuss.huggingface.co/t/how-to-load-a-large-hf-dataset-efficiently/69288", "internal": true, "reflection": false, "title": "How to load a large hf dataset efficiently?", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/recommended-max-size-of-dataset/144812/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207835, "name": "Chris Liu", "username": "Aceticia", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/{size}.png", "created_at": "2025-03-09T05:49:30.019Z", "cooked": "<p>Hi, thanks for the quick reply! It would be just for training, so upload is not a problem. And I have individual files that I will use <code>Dataset.from_generator</code> to create a hf dataset out of, so I think the post you mentioned shouldn’t be a problem either.</p>\n<p>I guess I’m more concerned about whether <code>save_to_disk</code> would work for something this big, and whether <code>Dataset.load_from_disk</code> would be problematic in terms of the number of open files?</p>", "post_number": 3, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-09T05:49:30.019Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 10, "readers_count": 9, "score": 17, "yours": false, "topic_id": 144812, "topic_slug": "recommended-max-size-of-dataset", "display_username": "Chris Liu", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 2619, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/recommended-max-size-of-dataset/144812/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 207836, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-09T05:55:35.954Z", "cooked": "<p>When it comes to such a huge data set, that’s probably the case…</p>\n<p>It’s probably too much for those functions that use the default torch internally, so it might be more stable to use functions related to WebDataset. I think there are other backends or functions that can be used as needed for huge data sets, but I can’t remember…<img src=\"https://emoji.discourse-cdn.com/apple/sweat_smile.png?v=13\" title=\":sweat_smile:\" class=\"emoji\" alt=\":sweat_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/huggingface/datasets/issues/5337\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/datasets/issues/5337\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/datasets</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/datasets/issues/5337\" target=\"_blank\" rel=\"noopener\">Support webdataset format</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2022-12-07\" data-time=\"11:32:25\" data-timezone=\"UTC\">11:32AM - 07 Dec 22 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-03-06\" data-time=\"14:39:28\" data-timezone=\"UTC\">02:39PM - 06 Mar 24 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/lhoestq\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/c/1/c15ef2e44546273e339324b67b09334bc4e3f009.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"9D9589\">\n lhoestq\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">Webdataset is an efficient format for iterable datasets. It would be nice to sup<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">port it in `datasets`, as discussed in https://github.com/rom1504/img2dataset/issues/234.\n\nIn particular it would be awesome to be able to load one using `load_dataset` in streaming mode (either from a local directory, or from a dataset on the Hugging Face Hub). Some datasets on the Hub are already in webdataset format.\n\nIt terms of implementation, we can have something similar to the Parquet loader.\nI also think it's fine to have webdataset as an optional dependency.</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/hub/datasets-webdataset\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/hub/datasets-webdataset\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"FAF8F2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/hub/datasets-webdataset\" target=\"_blank\" rel=\"noopener\">WebDataset</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-09T05:55:35.954Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 10, "readers_count": 9, "score": 12, "yours": false, "topic_id": 144812, "topic_slug": "recommended-max-size-of-dataset", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/hub/datasets-webdataset", "internal": false, "reflection": false, "title": "WebDataset", "clicks": 4 }, { "url": "https://github.com/huggingface/datasets/issues/5337", "internal": false, "reflection": false, "title": "Support webdataset format · Issue #5337 · huggingface/datasets · GitHub", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/recommended-max-size-of-dataset/144812/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208375, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-03-11T15:22:44.824Z", "cooked": "<p><code>save_to_disk</code> / <code>load_from_disk</code> can handle big datasets, you can even use multiprocessing with <code>num_proc=</code> to accelerate <code>save_to_disk</code></p>\n<p>though performance can depend on your environment so I’d still advise you to try on smaller datasets first and see how it scales</p>", "post_number": 5, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-11T15:22:44.824Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 15, "reads": 9, "readers_count": 8, "score": 91.8, "yours": false, "topic_id": 144812, "topic_slug": "recommended-max-size-of-dataset", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/recommended-max-size-of-dataset/144812/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208644, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-12T17:48:57.403Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 6, "post_type": 3, "posts_count": 6, "updated_at": "2025-03-12T17:48:57.403Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 1.2, "yours": false, "topic_id": 144812, "topic_slug": "recommended-max-size-of-dataset", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/recommended-max-size-of-dataset/144812/6", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I’m about to create a large dataset directly, about ~1B samples with each sample being about [16 x 8000] size and some small meta data. Do you foresee any issues during generation, or loading this and using it after it’s finished generating? Any ideas are welcome, thank you.</p>
<p><code>save_to_disk</code> / <code>load_from_disk</code> can handle big datasets, you can even use multiprocessing with <code>num_proc=</code> to accelerate <code>save_to_disk</code></p> <p>though performance can depend on your environment so I’d still advise you to try on smaller datasets first and see how it scales</p>
kohya_SS (Output Interpretation)
https://discuss.huggingface.co/t/kohya-ss-output-interpretation/141979
141,979
6
2025-02-20T09:29:55.771000Z
[ { "id": 204058, "name": "Deepak Goel", "username": "deicool", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/{size}.png", "created_at": "2025-02-20T09:29:55.839Z", "cooked": "<p>Hello</p>\n<p>I have trained the kohya_ss model (stabilityai/stable-diffusion-xl-base-1.0) with 10 images. I was wondering where the output comes from (from the base model or my customized training).</p>\n<p>How much % is the final output composed of ?<br>\nEg:<br>\n(Base Model:60%, Customized Training:40%)<br>\n(Base Model:70%, Customized Training:30%)</p>\n<p>For example:<br>\nThe prompt is: DNA has to be shown in the background with a Indain-Woman-with-Mouth-Cancer in the Foreground</p>\n<p>And the image created by the program is:<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/c/2c16aabc26107647f9120afd53e4c0260c69e0cc.jpeg\" data-download-href=\"/uploads/short-url/6i1zuekEzpPLP3y3rMvLaQPWDyk.jpeg?dl=1\" title=\"DNA has to be shown in the background with a Indain-Woman-with-Mouth-Cancer in the Foreground-20thFeb2025-1.PNG\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/c/2c16aabc26107647f9120afd53e4c0260c69e0cc_2_500x500.jpeg\" alt=\"DNA has to be shown in the background with a Indain-Woman-with-Mouth-Cancer in the Foreground-20thFeb2025-1.PNG\" data-base62-sha1=\"6i1zuekEzpPLP3y3rMvLaQPWDyk\" width=\"500\" height=\"500\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/c/2c16aabc26107647f9120afd53e4c0260c69e0cc_2_500x500.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/c/2c16aabc26107647f9120afd53e4c0260c69e0cc_2_750x750.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/c/2c16aabc26107647f9120afd53e4c0260c69e0cc_2_1000x1000.jpeg 2x\" data-dominant-color=\"A46978\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">DNA has to be shown in the background with a Indain-Woman-with-Mouth-Cancer in the Foreground-20thFeb2025-1.PNG</span><span class=\"informations\">1024×1024 67.7 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>The program is:</p>\n<pre><code class=\"lang-auto\">from diffusers import AutoPipelineForText2Image, AutoencoderKL\nimport torch\nimport os\nimport numpy as np\nfrom PIL import Image\n\nprint(\"vae\")\n\n# Clear GPU memory before starting \ntorch.cuda.empty_cache() \n\n# Set seed for reproducibility \n#torch.manual_seed(6666666) \n#np.random.seed(6666666)\n\n# Define the path to the directory containing your model and LoRA weights\nprint(\"Define the path to the directory containing your model and LoRA weights\")\nmodel_dir = \"D:\\\\Ganu\\\\AIImage\\\\huggingface\\\\kohya_ss\\\\kohya_ss\\\\trained-model\\\\model\\\\\" \nlora_weights_path = os.path.join(model_dir, \"last.safetensors\")\n\n# Load the base model using StableDiffusionPipeline\nprint(\"Load the base model using StableDiffusionPipeline\")\nmodel_id = \"stabilityai/stable-diffusion-xl-base-1.0\"\nadapter_id = \"wangfuyun/PCM_SDXL_LoRAs\"\n\n#vae = AutoencoderKL.from_pretrained(\"madebyollin/sdxl-vae-fp16-fix\", torch_dtype=torch.float16)\npipeline = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float32, variant=\"fp16\").to(\"cpu\")\npipeline.enable_sequential_cpu_offload()\npipeline.enable_attention_slicing(\"max\")\n\n# Load the LoRA weights\nprint(\"Load the LoRA weights\")\ntry:\n pipeline.load_lora_weights(lora_weights_path, weight_name=\"last.safetensors\")\nexcept ValueError as e:\n print(\"Invalid LoRA checkpoint. Please check the compatibility and format of the weights file.\")\n raise e\n\n# Generate an image from a text prompt\nprint(\"Generate an image from a text prompt\")\ntext_prompt = \"DNA has to be shown in the background with a Indain-Woman-with-Mouth-Cancer in the Foreground\"\ngenerated_image = pipeline(prompt=text_prompt).images[0]\ngenerated_image.save(\"generated_image.png\")\ngenerated_image.show()\n</code></pre>", "post_number": 1, "post_type": 1, "posts_count": 17, "updated_at": "2025-02-20T09:29:55.839Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 150, "reads": 7, "readers_count": 6, "score": 746.4, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "Deepak Goel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 75045, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 204115, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-02-20T13:46:49.493Z", "cooked": "<p>Good evening. That question is essentially impossible to answer…<img src=\"https://emoji.discourse-cdn.com/apple/sweat_smile.png?v=12\" title=\":sweat_smile:\" class=\"emoji\" alt=\":sweat_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>The answer would be something like “it depends on the base model”, “it depends on what you want to express with LoRA (if it’s something like the characteristics of a person or a character, then LoRA will have a big impact)”, or “it can’t be expressed as a percentage in the first place”.</p>\n<p>This is because the base model and LoRA are <strong>fused together</strong> when inference is executed. The mixed neural network is no longer suitable for being expressed as a percentage.</p>\n<p>LoRA is not the same as full fine tuning, but it is one of the methods for training models, and there are various LoRA algorithms, each with their own strengths and weaknesses. (I am not familiar with each algorithm.)</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/peft/main/en/conceptual_guides/lora\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/peft/main/en/conceptual_guides/lora\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/f/2fe0af286a9d85cecf84e22589bf346bcd57349d_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"FAF8F2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/peft/main/en/conceptual_guides/lora\" target=\"_blank\" rel=\"noopener\">LoRA</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://arxiv.org/abs/2410.21228\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/7/7/7737f9c766957e34da6871902e1e7a9d2aca40f3.png\" class=\"site-icon\" data-dominant-color=\"B36362\" width=\"32\" height=\"32\">\n\n <a href=\"https://arxiv.org/abs/2410.21228\" target=\"_blank\" rel=\"noopener\">arXiv.org</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/402;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/d/cd49b65780faf86c14ed9761c9c522acfb73adde_2_500x500.png\" class=\"thumbnail\" data-dominant-color=\"865F5C\" width=\"500\" height=\"500\"></div>\n\n<h3><a href=\"https://arxiv.org/abs/2410.21228\" target=\"_blank\" rel=\"noopener\">LoRA vs Full Fine-tuning: An Illusion of Equivalence</a></h3>\n\n <p>Fine-tuning is a crucial paradigm for adapting pre-trained large language models to downstream tasks. Recently, methods like Low-Rank Adaptation (LoRA) have been shown to match the performance of fully fine-tuned models on various tasks with an...</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 17, "updated_at": "2025-02-20T13:46:49.493Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 6, "readers_count": 5, "score": 46.2, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://arxiv.org/abs/2410.21228", "internal": false, "reflection": false, "title": "[2410.21228] LoRA vs Full Fine-tuning: An Illusion of Equivalence", "clicks": 6 }, { "url": "https://huggingface.co/docs/peft/main/en/conceptual_guides/lora", "internal": false, "reflection": false, "title": "LoRA", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 204306, "name": "Deepak Goel", "username": "deicool", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/{size}.png", "created_at": "2025-02-21T07:22:13.587Z", "cooked": "<p>Hello</p>\n<p>Can I get the last.safetensors weights file (for the model: stabilityai/stable-diffusion-xl-base-1.0) without my customized training (the original one)? So I can check the difference from my customized training?</p>", "post_number": 3, "post_type": 1, "posts_count": 17, "updated_at": "2025-02-21T08:31:56.747Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 2, "reads": 4, "readers_count": 3, "score": 20.8, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "Deepak Goel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 75045, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/3", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 204322, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-02-21T08:31:11.913Z", "cooked": "<p>Hmmm? How do you want it to be?<img src=\"https://emoji.discourse-cdn.com/apple/thinking.png?v=12\" title=\":thinking:\" class=\"emoji\" alt=\":thinking:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 4, "post_type": 1, "posts_count": 17, "updated_at": "2025-02-21T08:31:11.913Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 5.8, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 204323, "name": "Deepak Goel", "username": "deicool", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/{size}.png", "created_at": "2025-02-21T08:32:50.366Z", "cooked": "<p>Sorry, didn’t get your question?</p>", "post_number": 5, "post_type": 1, "posts_count": 17, "updated_at": "2025-02-21T08:32:50.366Z", "reply_count": 0, "reply_to_post_number": 4, "quote_count": 0, "incoming_link_count": 2, "reads": 4, "readers_count": 3, "score": 25.8, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "Deepak Goel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 75045, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/5", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 204327, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-02-21T08:38:18.279Z", "cooked": "<p>Yea. I didn’t understand it very well. I think you want to do something for comparison…</p>", "post_number": 6, "post_type": 1, "posts_count": 17, "updated_at": "2025-02-21T08:38:18.279Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 4, "readers_count": 3, "score": 15.8, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/6", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 204328, "name": "Deepak Goel", "username": "deicool", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/{size}.png", "created_at": "2025-02-21T08:42:17.357Z", "cooked": "<p>When I do training with kohya_ss (LORA), it generates a (last.safetensors) file which I use for image generation.</p>\n<p>What I want is a original file (last.safetensors) without the changes done due to my training?</p>", "post_number": 7, "post_type": 1, "posts_count": 17, "updated_at": "2025-02-21T08:42:17.357Z", "reply_count": 1, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 20.6, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "Deepak Goel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 75045, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/7", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 204330, "name": "Deepak Goel", "username": "deicool", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/{size}.png", "created_at": "2025-02-21T09:01:34.370Z", "cooked": "<p>For example, the following code:</p>\n<pre><code class=\"lang-auto\">from diffusers import AutoPipelineForText2Image, AutoencoderKL\nimport torch\nimport os\nimport numpy as np\nfrom PIL import Image\n\nprint(\"vae\")\n\n# Clear GPU memory before starting \ntorch.cuda.empty_cache() \n\n# Set seed for reproducibility \n#torch.manual_seed(6666666) \n#np.random.seed(6666666)\n\n# Define the path to the directory containing your model and LoRA weights\nprint(\"Define the path to the directory containing your model and LoRA weights\")\nmodel_dir = \"D:\\\\Ganu\\\\AIImage\\\\huggingface\\\\kohya_ss\\\\kohya_ss\\\\trained-model\\\\model\\\\\" \nlora_weights_path = os.path.join(model_dir, \"last.safetensors\")\n\n# Load the base model using StableDiffusionPipeline\nprint(\"Load the base model using StableDiffusionPipeline\")\nmodel_id = \"stabilityai/stable-diffusion-xl-base-1.0\"\nadapter_id = \"wangfuyun/PCM_SDXL_LoRAs\"\n\n#vae = AutoencoderKL.from_pretrained(\"madebyollin/sdxl-vae-fp16-fix\", torch_dtype=torch.float16)\npipeline = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float32, variant=\"fp16\").to(\"cpu\")\npipeline.enable_sequential_cpu_offload()\npipeline.enable_attention_slicing(\"max\")\n\n# Load the LoRA weights\nprint(\"Load the LoRA weights\")\ntry:\n pipeline.load_lora_weights(lora_weights_path, weight_name=\"last.safetensors\")\nexcept ValueError as e:\n print(\"Invalid LoRA checkpoint. Please check the compatibility and format of the weights file.\")\n raise e\n\n# Generate an image from a text prompt\nprint(\"Generate an image from a text prompt\")\ntext_prompt = \"DNA has to be shown in the background, and a Indain Woman with Skin Disease in the Foreground\"\ngenerated_image = pipeline(prompt=text_prompt).images[0]\ngenerated_image.save(\"generated_image.png\")\ngenerated_image.show()\n</code></pre>\n<p>generates the image:<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/1/2/1238dba0a3126c0e29d2585abe198e0c398d2aba.jpeg\" data-download-href=\"/uploads/short-url/2BcpxJ2xiP3a0hLc3aHqqAZFA2C.jpeg?dl=1\" title=\"DNA has to be shown in the background, and a Indain Woman with Skin Disease in the Foreground - 21st Feb 2025- 2.PNG\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/2/1238dba0a3126c0e29d2585abe198e0c398d2aba_2_500x500.jpeg\" alt=\"DNA has to be shown in the background, and a Indain Woman with Skin Disease in the Foreground - 21st Feb 2025- 2.PNG\" data-base62-sha1=\"2BcpxJ2xiP3a0hLc3aHqqAZFA2C\" width=\"500\" height=\"500\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/2/1238dba0a3126c0e29d2585abe198e0c398d2aba_2_500x500.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/2/1238dba0a3126c0e29d2585abe198e0c398d2aba_2_750x750.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/2/1238dba0a3126c0e29d2585abe198e0c398d2aba_2_1000x1000.jpeg 2x\" data-dominant-color=\"A88677\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">DNA has to be shown in the background, and a Indain Woman with Skin Disease in the Foreground - 21st Feb 2025- 2.PNG</span><span class=\"informations\">1024×1024 68.6 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>Whereas the following code:</p>\n<pre><code class=\"lang-auto\">from diffusers import AutoPipelineForText2Image, AutoencoderKL\nimport torch\nimport os\nimport numpy as np\nfrom PIL import Image\n\nprint(\"vae\")\n\n# Clear GPU memory before starting \ntorch.cuda.empty_cache() \n\n# Set seed for reproducibility \n#torch.manual_seed(6666666) \n#np.random.seed(6666666)\n\n# Load the base model using StableDiffusionPipeline\nprint(\"Load the base model using StableDiffusionPipeline\")\nmodel_id = \"stabilityai/stable-diffusion-xl-base-1.0\"\nadapter_id = \"wangfuyun/PCM_SDXL_LoRAs\"\n\n#vae = AutoencoderKL.from_pretrained(\"madebyollin/sdxl-vae-fp16-fix\", torch_dtype=torch.float16)\npipeline = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float32, variant=\"fp16\").to(\"cpu\")\npipeline.enable_sequential_cpu_offload()\npipeline.enable_attention_slicing(\"max\")\n\n\n# Generate an image from a text prompt\nprint(\"Generate an image from a text prompt\")\ntext_prompt = \"DNA has to be shown in the background, and a Indain Woman with Skin Disease in the Foreground\"\ngenerated_image = pipeline(prompt=text_prompt).images[0]\ngenerated_image.save(\"generated_image.png\")\ngenerated_image.show()\n</code></pre>\n<p>generates the following image:</p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/5/0/50b0bc567de8630a8cd01b83b9767ecf9d476fdc.jpeg\" data-download-href=\"/uploads/short-url/bvOQPx0BI8s8gTLd3rXivYLNPmk.jpeg?dl=1\" title=\"AI-Image.PNG\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/0/50b0bc567de8630a8cd01b83b9767ecf9d476fdc_2_500x500.jpeg\" alt=\"AI-Image.PNG\" data-base62-sha1=\"bvOQPx0BI8s8gTLd3rXivYLNPmk\" width=\"500\" height=\"500\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/0/50b0bc567de8630a8cd01b83b9767ecf9d476fdc_2_500x500.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/0/50b0bc567de8630a8cd01b83b9767ecf9d476fdc_2_750x750.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/5/0/50b0bc567de8630a8cd01b83b9767ecf9d476fdc_2_1000x1000.jpeg 2x\" data-dominant-color=\"7B6053\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">AI-Image.PNG</span><span class=\"informations\">1024×1024 65.8 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>The two images generated are very different.</p>\n<p>I was wondering why…</p>", "post_number": 8, "post_type": 1, "posts_count": 17, "updated_at": "2025-02-21T09:01:34.370Z", "reply_count": 0, "reply_to_post_number": 7, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "Deepak Goel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 75045, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/8", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 75045, "username": "deicool", "name": "Deepak Goel", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/{size}.png" }, "action_code": null, "via_email": null }, { "id": 204361, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-02-21T10:10:49.422Z", "cooked": "<blockquote>\n<p>The two images generated are very different.</p>\n</blockquote>\n<p>I think this is because the latter code does not apply last.safetensors (LoRA). Also, if you want to keep both the pre-training and post-training models in KohyaSS, you need to specify an option…</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/kohya-ss/sd-scripts/issues/466\">\n <header class=\"source\">\n\n <a href=\"https://github.com/kohya-ss/sd-scripts/issues/466\" target=\"_blank\" rel=\"noopener\">github.com/kohya-ss/sd-scripts</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/kohya-ss/sd-scripts/issues/466\" target=\"_blank\" rel=\"noopener\">How can I continue my Lora(as well as classic fine tune) training without starting it over?</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2023-04-30\" data-time=\"07:25:26\" data-timezone=\"UTC\">07:25AM - 30 Apr 23 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2023-05-07\" data-time=\"04:34:34\" data-timezone=\"UTC\">04:34AM - 07 May 23 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/terrificdm\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/4/3/4317f45ed96be77db2ec76c53856d87cbe71783d.jpeg\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"95918F\">\n terrificdm\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">Supposed I have done the Lora training, but the result wasn't as expected, a bit<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\"> of under-fitting. My question is how can I continue the training basing on current Lora result without starting it over from beginning. BTW, I saved Lora as safetensor format. Should I use --resume or sth?\n\nAnother similar question for classic fine tune, regarding the same challenge, should I just change model.safetensors to diffuser format then point \"pretrained_model_name_or_path\" to the directory of diffusers files, and continue my training?\n\nThanks for help.</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 9, "post_type": 1, "posts_count": 17, "updated_at": "2025-02-21T10:10:49.422Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/kohya-ss/sd-scripts/issues/466", "internal": false, "reflection": false, "title": "How can I continue my Lora(as well as classic fine tune) training without starting it over? · Issue #466 · kohya-ss/sd-scripts · GitHub", "clicks": 4 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/9", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206043, "name": "Deepak Goel", "username": "deicool", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/{size}.png", "created_at": "2025-03-01T06:18:15.506Z", "cooked": "<p>Hello,</p>\n<p>I am getting great images from the program <strong>without LORA</strong>. So if I want to retain the core design (without LORA) and then apply my LORA fine-tuning on it to apply cosmetic changes (all in one go!), how can I achieve that?</p>\n<p>Please advise. Thank You.</p>", "post_number": 10, "post_type": 1, "posts_count": 17, "updated_at": "2025-03-01T06:18:15.506Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 3, "readers_count": 2, "score": 20.6, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "Deepak Goel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 75045, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/10", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206068, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-01T09:09:16.680Z", "cooked": "<p>Good evening.<img src=\"https://emoji.discourse-cdn.com/apple/grinning.png?v=12\" title=\":grinning:\" class=\"emoji\" alt=\":grinning:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>I see. You want to train and apply LoRA to the extent that it doesn’t erase the goodness of the base model.<br>\nOne way to do this is to lower the weight (scale) below 1.0 when applying LoRA that has already been trained.<br>\nAnother way is to specify, using parameters, how much of the training data to include in the training using LoRA. In the case of KohyaSS, the parameters are as follows.</p>\n<h3><a name=\"p-206068-when-applying-lora-1\" class=\"anchor\" href=\"#p-206068-when-applying-lora-1\"></a>When applying LoRA</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/diffusers/main/en/tutorials/using_peft_for_inference#merge-adapters\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/diffusers/main/en/tutorials/using_peft_for_inference#merge-adapters\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/2/725f3ba0d5cc1761eed1c544dd7101393d1e4909_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F7F5EF\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/diffusers/main/en/tutorials/using_peft_for_inference#merge-adapters\" target=\"_blank\" rel=\"noopener\">Load LoRAs for inference</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-206068-when-training-lora-2\" class=\"anchor\" href=\"#p-206068-when-training-lora-2\"></a>When training LoRA</h3>\n<aside class=\"onebox githubpullrequest\" data-onebox-src=\"https://github.com/kohya-ss/sd-scripts/pull/545\">\n <header class=\"source\">\n\n <a href=\"https://github.com/kohya-ss/sd-scripts/pull/545\" target=\"_blank\" rel=\"noopener\">github.com/kohya-ss/sd-scripts</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\" data-github-private-repo=\"false\">\n\n\n\n <div class=\"github-icon-container\" title=\"Pull Request\">\n <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 12 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M11 11.28V5c-.03-.78-.34-1.47-.94-2.06C9.46 2.35 8.78 2.03 8 2H7V0L4 3l3 3V4h1c.27.02.48.11.69.31.21.2.3.42.31.69v6.28A1.993 1.993 0 0 0 10 15a1.993 1.993 0 0 0 1-3.72zm-1 2.92c-.66 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2zM4 3c0-1.11-.89-2-2-2a1.993 1.993 0 0 0-1 3.72v6.56A1.993 1.993 0 0 0 2 15a1.993 1.993 0 0 0 1-3.72V4.72c.59-.34 1-.98 1-1.72zm-.8 10c0 .66-.55 1.2-1.2 1.2-.65 0-1.2-.55-1.2-1.2 0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2zM2 4.2C1.34 4.2.8 3.65.8 3c0-.65.55-1.2 1.2-1.2.65 0 1.2.55 1.2 1.2 0 .65-.55 1.2-1.2 1.2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n\n\n\n <h4>\n <a href=\"https://github.com/kohya-ss/sd-scripts/pull/545\" target=\"_blank\" rel=\"noopener\">Dropout and Max Norm Regularization for LoRA training</a>\n </h4>\n\n <div class=\"branches\">\n <code>dev</code> ← <code>AI-Casanova:max_norm</code>\n </div>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2023-05-29\" data-time=\"02:50:47\" data-timezone=\"UTC\">02:50AM - 29 May 23 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/AI-Casanova\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/6/0/60aa82d46437ff2045e0200e08bd9676a167899f.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"BDE2E3\">\n AI-Casanova\n </a>\n </div>\n\n <div class=\"lines\" title=\"14 commits changed 4 files with 77 additions and 9 deletions\">\n <a href=\"https://github.com/kohya-ss/sd-scripts/pull/545/files\" target=\"_blank\" rel=\"noopener\">\n <span class=\"added\">+77</span>\n <span class=\"removed\">-9</span>\n </a>\n </div>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">This PR adds Dropout and Max Norm Regularization [[Paper]](https://www.cs.toront<span class=\"show-more-container\"><a href=\"https://github.com/kohya-ss/sd-scripts/pull/545\" target=\"_blank\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">o.edu/~rsalakhu/papers/srivastava14a.pdf) to `train_network.py`\n\nDropout randomly removes some weights/neurons from calculation on both the forward and backward passes, effectively training many neural nets successively like so:\n![image](https://github.com/kohya-ss/sd-scripts/assets/54461896/728a3670-0ec3-4bdf-8d32-ed3771bd1050)\nThis encourages the LoRA to diversify its training, instead of only picking a few weights to continuously update, hopefully reducing overtraining. \n\nMax Norm Regularization calculates the L2 norm of the weights at each key and if they exceed the cutoff, scales the entire key by a factor to bring them in line, (mentioned in section 5.1 of the paper) This works because the relationships between weights in a layer seem to be more important than the total magnitude. \nWhen enabled, adds logging for TensorBoard, and an average norm value and number of keys scaled each step to the progress bar. \n\nEither option can be used independently:\n\n- Dropout suggested setting &gt;0.3\n- Max Norm suggested setting = 1 (You can also set it high enough to never trigger ie 10 to watch Tensor Board and see where a good point to set it at might be)\n\n\nExample of training with dropout [0.5,0.25,0.10.05,0] and Max Norm 1 all other settings deterministic\n![dropout](https://github.com/kohya-ss/sd-scripts/assets/54461896/766a4ba1-ff38-40d1-8145-283834856451)\n\nNotes for @kohya-ss \nDropout requires Xformers, and I didn't know how you wanted to do the assertion for that\nDropout requires the Cutlass kernel for GPUs with Capability &lt;8 (A100, 4090 etc) this has been tested on a Colab T4 with xformers 0.0.19, no idea minimum requirements.\nI believe I passed dropout in a way that won't interfere with the other trainers `(dropout=None)` in the function call, but should be checked.\nAlso I'm currently scaling lora_up and lora_down by `ratio**0.5` as a scalar should be commutative when multiplied to a matrix multiplication (ie `matmul(r*A, B) = matmul(A, B*r), matmul(sqrt(r)*A, sqrt(r)*B)`) , will do further testing to confirm whether to remain this way or only multiply up or down by the full ratio.</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/344;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/d/8/d8c00b23c4a861bdd8d8ccb4c98bac21617900ca_2_690x345.png\" class=\"thumbnail\" data-dominant-color=\"F0F2F3\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters\" target=\"_blank\" rel=\"noopener\">LoRA training parameters</a></h3>\n\n <p>Contribute to bmaltais/kohya_ss development by creating an account on GitHub.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://civitai.com/articles/3105/essential-to-advanced-guide-to-training-a-lora\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/a/e/ae876dccbecd025c15db42470ee91023622d9ade.png\" class=\"site-icon\" data-dominant-color=\"3654B9\" width=\"48\" height=\"48\">\n\n <a href=\"https://civitai.com/articles/3105/essential-to-advanced-guide-to-training-a-lora\" target=\"_blank\" rel=\"noopener\">civitai.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <img width=\"500\" height=\"500\" src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/2/12816d0d768fde63ecd2b0a7788a6a9ec51116c5_2_500x500.jpeg\" class=\"thumbnail onebox-avatar\" data-dominant-color=\"B08F85\">\n\n<h3><a href=\"https://civitai.com/articles/3105/essential-to-advanced-guide-to-training-a-lora\" target=\"_blank\" rel=\"noopener\">Essential to Advanced Guide to training a LoRA | Civitai</a></h3>\n\n <p>1. Introduction \"Fear the curses that hide in your training\" - Disclaimer: I won't teach you to make images like this one, don't worry. This aims t...</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 11, "post_type": 1, "posts_count": 17, "updated_at": "2025-03-01T09:09:16.680Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/kohya-ss/sd-scripts/pull/545", "internal": false, "reflection": false, "title": "Dropout and Max Norm Regularization for LoRA training by AI-Casanova · Pull Request #545 · kohya-ss/sd-scripts · GitHub", "clicks": 3 }, { "url": "https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters", "internal": false, "reflection": false, "title": "LoRA training parameters · bmaltais/kohya_ss Wiki · GitHub", "clicks": 3 }, { "url": "https://civitai.com/articles/3105/essential-to-advanced-guide-to-training-a-lora", "internal": false, "reflection": false, "title": "Essential to Advanced Guide to training a LoRA | Civitai", "clicks": 2 }, { "url": "https://huggingface.co/docs/diffusers/main/en/tutorials/using_peft_for_inference#merge-adapters", "internal": false, "reflection": false, "title": "Load LoRAs for inference", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/11", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206603, "name": "Deepak Goel", "username": "deicool", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/{size}.png", "created_at": "2025-03-04T04:51:41.452Z", "cooked": "<p>Hi John6666,</p>\n<p>There are a lot of “Training Parameters”. Is there a default value for all of them, or will I have to do a lot of “trial and errors” with each of them?</p>", "post_number": 12, "post_type": 1, "posts_count": 17, "updated_at": "2025-03-04T04:51:41.452Z", "reply_count": 0, "reply_to_post_number": 11, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 15.4, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "Deepak Goel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 75045, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/12", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 206604, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-04T04:58:02.897Z", "cooked": "<blockquote>\n<p>Is there a default value for all of them,</p>\n</blockquote>\n<p>Here.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/344;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/1/319a44bb4618b88714f13c1c37de638e30137095_2_690x345.png\" class=\"thumbnail\" data-dominant-color=\"F0F2F3\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters\" target=\"_blank\" rel=\"noopener\">LoRA training parameters</a></h3>\n\n <p>Contribute to bmaltais/kohya_ss development by creating an account on GitHub.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<blockquote>\n<p>or will I have to do a lot of “trial and errors” with each of them</p>\n</blockquote>\n<p>Or search parameters for similar use-case?<img src=\"https://emoji.discourse-cdn.com/apple/sweat_smile.png?v=13\" title=\":sweat_smile:\" class=\"emoji\" alt=\":sweat_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 13, "post_type": 1, "posts_count": 17, "updated_at": "2025-03-04T04:58:02.897Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 2, "readers_count": 1, "score": 35.4, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/bmaltais/kohya_ss/wiki/LoRA-training-parameters", "internal": false, "reflection": false, "title": "LoRA training parameters · bmaltais/kohya_ss Wiki · GitHub", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/13", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207149, "name": "Deepak Goel", "username": "deicool", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/{size}.png", "created_at": "2025-03-06T05:52:56.069Z", "cooked": "<p>Automated hyperparameter optimization (Optuna)?</p>", "post_number": 14, "post_type": 1, "posts_count": 17, "updated_at": "2025-03-06T05:52:56.069Z", "reply_count": 0, "reply_to_post_number": 13, "quote_count": 0, "incoming_link_count": 1, "reads": 2, "readers_count": 1, "score": 20.4, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "Deepak Goel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 75045, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/14", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 207159, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-06T05:58:53.598Z", "cooked": "<p>Existing semi-automatic training scripts such as Kohya SS and OneTrainer use parameters that are within a certain range of acceptability from the start.<br>\nSo it would probably be faster to search for know-how on how to create LoRA for similar use cases and borrow the detailed parameters.<img src=\"https://emoji.discourse-cdn.com/apple/sweat_smile.png?v=13\" title=\":sweat_smile:\" class=\"emoji\" alt=\":sweat_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>I think that Optuna and other tools are more like frameworks for finding parameters when fine-tuning models fully manually.</p>", "post_number": 15, "post_type": 1, "posts_count": 17, "updated_at": "2025-03-06T05:58:53.598Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 2, "readers_count": 1, "score": 30.4, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/15", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207172, "name": "Deepak Goel", "username": "deicool", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/{size}.png", "created_at": "2025-03-06T06:24:14.718Z", "cooked": "<p>Would this be a good start?</p>\n<p><a href=\"https://myaiforce.com/real-life-lora-training/#:~:text=Training%20a%20LoRA%20model%20involves,settings%20within%20the%20Kohya%20trainer\" class=\"inline-onebox\" rel=\"noopener nofollow ugc\">How to Train a Highly Convincing Real-Life LoRA Model - MyAIForce</a>.</p>", "post_number": 16, "post_type": 1, "posts_count": 17, "updated_at": "2025-03-06T14:43:16.878Z", "reply_count": 0, "reply_to_post_number": 15, "quote_count": 0, "incoming_link_count": 1, "reads": 2, "readers_count": 1, "score": 65.4, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "Deepak Goel", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://myaiforce.com/real-life-lora-training/#:~:text=Training%20a%20LoRA%20model%20involves,settings%20within%20the%20Kohya%20trainer", "internal": false, "reflection": false, "title": "How to Train a Highly Convincing Real-Life LoRA Model - MyAIForce", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 75045, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/16", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 208557, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-12T09:36:15.056Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 17, "post_type": 3, "posts_count": 17, "updated_at": "2025-03-12T09:36:15.056Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 1, "readers_count": 0, "score": 10.2, "yours": false, "topic_id": 141979, "topic_slug": "kohya-ss-output-interpretation", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/kohya-ss-output-interpretation/141979/17", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello</p> <p>I have trained the kohya_ss model (stabilityai/stable-diffusion-xl-base-1.0) with 10 images. I was wondering where the output comes from (from the base model or my customized training).</p> <p>How much % is the final output composed of ?<br> Eg:<br> (Base Model:60%, Customized Training:40%)<br> (Base Model:70%, Customized Training:30%)</p> <p>For example:<br> The prompt is: DNA has to be shown in the background with a Indain-Woman-with-Mouth-Cancer in the Foreground</p> <p>And the image created by the program is:<br> <div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/2/c/2c16aabc26107647f9120afd53e4c0260c69e0cc.jpeg" data-download-href="/uploads/short-url/6i1zuekEzpPLP3y3rMvLaQPWDyk.jpeg?dl=1" title="DNA has to be shown in the background with a Indain-Woman-with-Mouth-Cancer in the Foreground-20thFeb2025-1.PNG" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/c/2c16aabc26107647f9120afd53e4c0260c69e0cc_2_500x500.jpeg" alt="DNA has to be shown in the background with a Indain-Woman-with-Mouth-Cancer in the Foreground-20thFeb2025-1.PNG" data-base62-sha1="6i1zuekEzpPLP3y3rMvLaQPWDyk" width="500" height="500" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/c/2c16aabc26107647f9120afd53e4c0260c69e0cc_2_500x500.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/c/2c16aabc26107647f9120afd53e4c0260c69e0cc_2_750x750.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/c/2c16aabc26107647f9120afd53e4c0260c69e0cc_2_1000x1000.jpeg 2x" data-dominant-color="A46978"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">DNA has to be shown in the background with a Indain-Woman-with-Mouth-Cancer in the Foreground-20thFeb2025-1.PNG</span><span class="informations">1024×1024 67.7 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p> <p>The program is:</p> <pre><code class="lang-auto">from diffusers import AutoPipelineForText2Image, AutoencoderKL import torch import os import numpy as np from PIL import Image print("vae") # Clear GPU memory before starting torch.cuda.empty_cache() # Set seed for reproducibility #torch.manual_seed(6666666) #np.random.seed(6666666) # Define the path to the directory containing your model and LoRA weights print("Define the path to the directory containing your model and LoRA weights") model_dir = "D:\\Ganu\\AIImage\\huggingface\\kohya_ss\\kohya_ss\\trained-model\\model\\" lora_weights_path = os.path.join(model_dir, "last.safetensors") # Load the base model using StableDiffusionPipeline print("Load the base model using StableDiffusionPipeline") model_id = "stabilityai/stable-diffusion-xl-base-1.0" adapter_id = "wangfuyun/PCM_SDXL_LoRAs" #vae = AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16) pipeline = AutoPipelineForText2Image.from_pretrained(model_id, torch_dtype=torch.float32, variant="fp16").to("cpu") pipeline.enable_sequential_cpu_offload() pipeline.enable_attention_slicing("max") # Load the LoRA weights print("Load the LoRA weights") try: pipeline.load_lora_weights(lora_weights_path, weight_name="last.safetensors") except ValueError as e: print("Invalid LoRA checkpoint. Please check the compatibility and format of the weights file.") raise e # Generate an image from a text prompt print("Generate an image from a text prompt") text_prompt = "DNA has to be shown in the background with a Indain-Woman-with-Mouth-Cancer in the Foreground" generated_image = pipeline(prompt=text_prompt).images[0] generated_image.save("generated_image.png") generated_image.show() </code></pre>
<p>Existing semi-automatic training scripts such as Kohya SS and OneTrainer use parameters that are within a certain range of acceptability from the start.<br> So it would probably be faster to search for know-how on how to create LoRA for similar use cases and borrow the detailed parameters.<img src="https://emoji.discourse-cdn.com/apple/sweat_smile.png?v=13" title=":sweat_smile:" class="emoji" alt=":sweat_smile:" loading="lazy" width="20" height="20"></p> <p>I think that Optuna and other tools are more like frameworks for finding parameters when fine-tuning models fully manually.</p>
Sharing ArrowDataset with subfolders
https://discuss.huggingface.co/t/sharing-arrowdataset-with-subfolders/145021
145,021
10
2025-03-10T12:41:49.972000Z
[ { "id": 208069, "name": "Samir Char", "username": "samirchar", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/{size}.png", "created_at": "2025-03-10T12:41:50.036Z", "cooked": "<p>Hello everyone!</p>\n<p>I want to share multiple datasets in the same repo &lt;my_username&gt;/&lt;my_repo_name&gt;, each in its own folder. The datasets in each folder are already in <strong>sharded</strong> Arrow format (for best performance) and contain different splits, as usual. To read any of these datasets with load_dataset I would need a loading script to tell HF how to read from the folders, right? If so, should I use the ArrowBasedBuilder and how? I only see tutorials for GeneratorBaseBuilder!</p>\n<p>Thanks!</p>", "post_number": 1, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-10T13:08:58.313Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 29, "reads": 9, "readers_count": 8, "score": 161.8, "yours": false, "topic_id": 145021, "topic_slug": "sharing-arrowdataset-with-subfolders", "display_username": "Samir Char", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/streaming-in-dataset-uploads/148177/2", "internal": true, "reflection": true, "title": "Streaming in dataset uploads", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 80944, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-arrowdataset-with-subfolders/145021/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208120, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-10T15:20:45.459Z", "cooked": "<p>If it’s already been converted to a Dataset class, is <strong>datasets.concatenate_dataset</strong> sufficient…? <a class=\"mention\" href=\"/u/lhoestq\">@lhoestq</a></p><aside class=\"quote quote-modified\" data-post=\"1\" data-topic=\"28743\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://avatars.discourse-cdn.com/v4/letter/p/839c29/48.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/issue-concatenating-datasets/28743\">Issue concatenating datasets</a> <a class=\"badge-category__wrapper \" href=\"/c/datasets/10\"><span data-category-id=\"10\" style=\"--category-badge-color: #F7941D; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"This category is for any question related to the datasets library. You can also file an issue.\"><span class=\"badge-category__name\">🤗Datasets</span></span></a>\n </div>\n <blockquote>\n I am trying to concatenate two datasets \nfrom datasets import load_dataset, concatenate_datasets\n\nmovie = load_dataset(\"movie_rationales\")\nimdb = load_dataset(\"imdb\")\nimdb = imdb['train']\n\nThen I adapt the movie dataset \nmovie_imdb_format = movie['train'].map(\n lambda x: {\"text\": x[\"review\"]}\n)\nmovie_imdb_format = movie_imdb_format.remove_columns([\"review\", \"evidences\"])\n\nand aim to concatenate them \ndataset_cc = concatenate_datasets([imdb, movie_imdb_format])\n\nThese both datasets output \nDat…\n </blockquote>\n</aside>\n<aside class=\"quote\" data-post=\"1\" data-topic=\"29423\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://avatars.discourse-cdn.com/v4/letter/s/ba9def/48.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/arrowbasedbuilder-versus-generatordbasedbuilder/29423\">ArrowBasedBuilder versus GeneratorDBasedBuilder</a> <a class=\"badge-category__wrapper \" href=\"/c/datasets/10\"><span data-category-id=\"10\" style=\"--category-badge-color: #F7941D; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"This category is for any question related to the datasets library. You can also file an issue.\"><span class=\"badge-category__name\">🤗Datasets</span></span></a>\n </div>\n <blockquote>\n Could you please enumerate pros and cons for both these dataset builder classes. I couldn’t find anything in the documentation. When would I prefer one over the other. Is ArrowBasedBuilder more performant for large datasets? \nThank you!\n </blockquote>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-10T15:20:45.459Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 9, "readers_count": 8, "score": 11.8, "yours": false, "topic_id": 145021, "topic_slug": "sharing-arrowdataset-with-subfolders", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/issue-concatenating-datasets/28743", "internal": true, "reflection": false, "title": "Issue concatenating datasets", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/arrowbasedbuilder-versus-generatordbasedbuilder/29423", "internal": true, "reflection": false, "title": "ArrowBasedBuilder versus GeneratorDBasedBuilder", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-arrowdataset-with-subfolders/145021/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208145, "name": "Samir Char", "username": "samirchar", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/{size}.png", "created_at": "2025-03-10T17:21:11.704Z", "cooked": "<p><a class=\"mention\" href=\"/u/john6666\">@John6666</a> no because i dont want to concateneate the datasets! Each folder is a different dataset with different features. So do i need the arrow builder to tell HF how to load the different datasets from the subfolder?</p>", "post_number": 3, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-10T17:21:11.704Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 9, "readers_count": 8, "score": 16.8, "yours": false, "topic_id": 145021, "topic_slug": "sharing-arrowdataset-with-subfolders", "display_username": "Samir Char", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 80944, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-arrowdataset-with-subfolders/145021/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 208147, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-10T17:34:46.443Z", "cooked": "<p>Hmm…<br>\nIn that case, I thought that it would be easier for Hugging Face, which is based on one model per repo (and dataset), to work properly if the datasets with different structures were kept separate.<img src=\"https://emoji.discourse-cdn.com/apple/thinking.png?v=14\" title=\":thinking:\" class=\"emoji\" alt=\":thinking:\" loading=\"lazy\" width=\"20\" height=\"20\"><br>\nHowever, I think there was a way to merge datasets with different structures. Let’s wait for lhonestq.</p>", "post_number": 4, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-10T17:34:46.443Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 9, "readers_count": 8, "score": 6.8, "yours": false, "topic_id": 145021, "topic_slug": "sharing-arrowdataset-with-subfolders", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-arrowdataset-with-subfolders/145021/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208158, "name": "Samir Char", "username": "samirchar", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/{size}.png", "created_at": "2025-03-10T18:33:00.960Z", "cooked": "<p>Yeah, maybe. I’m hesitating to separate into different repos because the datasets are related. It’s not completely separate projects. Think of it as GLUE, which is a set of multiple datasets but they are all related to one objective or project, like shown here <a href=\"https://huggingface.co/docs/datasets/en/dataset_script\" class=\"inline-onebox\">Create a dataset loading script</a></p>", "post_number": 5, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-10T18:33:00.960Z", "reply_count": 0, "reply_to_post_number": 4, "quote_count": 0, "incoming_link_count": 4, "reads": 9, "readers_count": 8, "score": 36.8, "yours": false, "topic_id": 145021, "topic_slug": "sharing-arrowdataset-with-subfolders", "display_username": "Samir Char", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/datasets/en/dataset_script", "internal": false, "reflection": false, "title": "Create a dataset loading script", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 80944, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-arrowdataset-with-subfolders/145021/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 208199, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-03-10T23:20:32.268Z", "cooked": "<p>You can configure the subsets present in your dataset repository in YAML <img src=\"https://emoji.discourse-cdn.com/apple/slight_smile.png?v=14\" title=\":slight_smile:\" class=\"emoji\" alt=\":slight_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"> see the docs at <a href=\"https://huggingface.co/docs/hub/en/datasets-manual-configuration\" class=\"inline-onebox\">Manual Configuration</a></p>\n<p>See the GLUE dataset for example: <a href=\"https://huggingface.co/datasets/nyu-mll/glue/tree/main\" class=\"inline-onebox\">nyu-mll/glue at main</a></p>", "post_number": 6, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-10T23:21:15.665Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 41.6, "yours": false, "topic_id": 145021, "topic_slug": "sharing-arrowdataset-with-subfolders", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/hub/en/datasets-manual-configuration", "internal": false, "reflection": false, "title": "Manual Configuration", "clicks": 5 }, { "url": "https://huggingface.co/datasets/nyu-mll/glue/tree/main", "internal": false, "reflection": false, "title": "nyu-mll/glue at main", "clicks": 2 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-arrowdataset-with-subfolders/145021/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208220, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-11T03:04:10.617Z", "cooked": "<p>Thank you!</p>", "post_number": 7, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-11T03:04:10.617Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 1.6, "yours": false, "topic_id": 145021, "topic_slug": "sharing-arrowdataset-with-subfolders", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-arrowdataset-with-subfolders/145021/7", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208334, "name": "Samir Char", "username": "samirchar", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/{size}.png", "created_at": "2025-03-11T11:01:53.207Z", "cooked": "<p>This is amazing! Thank you very much.</p>", "post_number": 8, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-11T11:01:53.207Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 16.4, "yours": false, "topic_id": 145021, "topic_slug": "sharing-arrowdataset-with-subfolders", "display_username": "Samir Char", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 80944, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-arrowdataset-with-subfolders/145021/8", "reactions": [ { "id": "confetti_ball", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 76, "username": "lhoestq", "name": "Quentin Lhoest", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png" }, "action_code": null, "via_email": null }, { "id": 208446, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-11T23:02:14.104Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 9, "post_type": 3, "posts_count": 9, "updated_at": "2025-03-11T23:02:14.104Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 0.8, "yours": false, "topic_id": 145021, "topic_slug": "sharing-arrowdataset-with-subfolders", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/sharing-arrowdataset-with-subfolders/145021/9", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello everyone!</p> <p>I want to share multiple datasets in the same repo &lt;my_username&gt;/&lt;my_repo_name&gt;, each in its own folder. The datasets in each folder are already in <strong>sharded</strong> Arrow format (for best performance) and contain different splits, as usual. To read any of these datasets with load_dataset I would need a loading script to tell HF how to read from the folders, right? If so, should I use the ArrowBasedBuilder and how? I only see tutorials for GeneratorBaseBuilder!</p> <p>Thanks!</p>
<p>You can configure the subsets present in your dataset repository in YAML <img src="https://emoji.discourse-cdn.com/apple/slight_smile.png?v=14" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> see the docs at <a href="https://huggingface.co/docs/hub/en/datasets-manual-configuration" class="inline-onebox">Manual Configuration</a></p> <p>See the GLUE dataset for example: <a href="https://huggingface.co/datasets/nyu-mll/glue/tree/main" class="inline-onebox">nyu-mll/glue at main</a></p>
Decode token IDs into a list (not a single string)
https://discuss.huggingface.co/t/decode-token-ids-into-a-list-not-a-single-string/42991
42,991
11
2023-06-12T22:58:16.552000Z
[ { "id": 73700, "name": "Steven Weiss", "username": "steventrouble", "avatar_template": "/user_avatar/discuss.huggingface.co/steventrouble/{size}/16596_2.png", "created_at": "2023-06-12T22:58:16.605Z", "cooked": "<p><code>tokenizer.convert_ids_to_tokens</code> returns:</p>\n<pre><code class=\"lang-auto\">['ĠDrive', 'Ġwas', 'Ġhad', 'Ġwalked', \"'s\", ',', 'Ġlooked', ...]\n</code></pre>\n<p>I need the tokens without the special characters. <code>decode</code> does <strong>not</strong> work, because it only returns a single string.</p>\n<p>Is there a function that outputs the plain tokens as a list?</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2023-06-12T22:59:14.311Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 5231, "reads": 122, "readers_count": 121, "score": 25894.4, "yours": false, "topic_id": 42991, "topic_slug": "decode-token-ids-into-a-list-not-a-single-string", "display_username": "Steven Weiss", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 21384, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/decode-token-ids-into-a-list-not-a-single-string/42991/1", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 75317, "name": "Arthur Zucker", "username": "ArthurZ", "avatar_template": "/user_avatar/discuss.huggingface.co/arthurz/{size}/26972_2.png", "created_at": "2023-06-22T07:11:37.980Z", "cooked": "<p>Hey! Not sure I completely understand, but the tokens that you have here are the <code>plain</code> tokens, as they are in the vocab / merge. You should modify the tokenizer if you do not want it to add the <code>spiece</code> token at the beginning. Which tokenizer are you using?</p>", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2023-06-22T07:11:37.980Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 27, "reads": 118, "readers_count": 117, "score": 158.6, "yours": false, "topic_id": 42991, "topic_slug": "decode-token-ids-into-a-list-not-a-single-string", "display_username": "Arthur Zucker", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": false, "staff": true, "user_id": 7005, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/decode-token-ids-into-a-list-not-a-single-string/42991/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 75504, "name": "Steven Weiss", "username": "steventrouble", "avatar_template": "/user_avatar/discuss.huggingface.co/steventrouble/{size}/16596_2.png", "created_at": "2023-06-23T03:40:18.336Z", "cooked": "<p>Thanks for the ping!</p>\n<p>I was using the GPT byte level tokenizer.</p>\n<p>I’m not sure if this is a hack, but to get the behavior I wanted, I just passed the token ids into <code>decode_batch</code> instead, and that returned each token without the odd encoding.</p>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2023-06-23T03:41:12.456Z", "reply_count": 2, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 33, "reads": 109, "readers_count": 108, "score": 226.8, "yours": false, "topic_id": 42991, "topic_slug": "decode-token-ids-into-a-list-not-a-single-string", "display_username": "Steven Weiss", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 21384, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/decode-token-ids-into-a-list-not-a-single-string/42991/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 90411, "name": "Arthur Zucker", "username": "ArthurZ", "avatar_template": "/user_avatar/discuss.huggingface.co/arthurz/{size}/26972_2.png", "created_at": "2023-09-18T21:17:43.267Z", "cooked": "<p>It’s not a hack, but something I wish to improve! IMO <code>batch_decode</code> and <code>decode</code> should be merged into one as we only have <code>encode</code></p>", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2023-09-18T21:17:43.267Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 28, "reads": 94, "readers_count": 93, "score": 168.8, "yours": false, "topic_id": 42991, "topic_slug": "decode-token-ids-into-a-list-not-a-single-string", "display_username": "Arthur Zucker", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 7005, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/decode-token-ids-into-a-list-not-a-single-string/42991/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 21384, "username": "steventrouble", "name": "Steven Weiss", "avatar_template": "/user_avatar/discuss.huggingface.co/steventrouble/{size}/16596_2.png" }, "action_code": null, "via_email": null }, { "id": 208426, "name": "ian", "username": "lone17", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/l/ccd318/{size}.png", "created_at": "2025-03-11T20:53:56.448Z", "cooked": "<p>Wow thank you ! Faced this today and this “hack” saved me. Btw after 2 years it’s still just a “hack” haha</p>", "post_number": 5, "post_type": 1, "posts_count": 5, "updated_at": "2025-03-11T20:53:56.448Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 5, "reads": 22, "readers_count": 21, "score": 39.4, "yours": false, "topic_id": 42991, "topic_slug": "decode-token-ids-into-a-list-not-a-single-string", "display_username": "ian", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86817, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/decode-token-ids-into-a-list-not-a-single-string/42991/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 21384, "username": "steventrouble", "name": "Steven Weiss", "avatar_template": "/user_avatar/discuss.huggingface.co/steventrouble/{size}/16596_2.png" }, "action_code": null, "via_email": null } ]
<p><code>tokenizer.convert_ids_to_tokens</code> returns:</p> <pre><code class="lang-auto">['ĠDrive', 'Ġwas', 'Ġhad', 'Ġwalked', "'s", ',', 'Ġlooked', ...] </code></pre> <p>I need the tokens without the special characters. <code>decode</code> does <strong>not</strong> work, because it only returns a single string.</p> <p>Is there a function that outputs the plain tokens as a list?</p>
<p>Thanks for the ping!</p> <p>I was using the GPT byte level tokenizer.</p> <p>I’m not sure if this is a hack, but to get the behavior I wanted, I just passed the token ids into <code>decode_batch</code> instead, and that returned each token without the odd encoding.</p>
Does the REST API work with private repo?
https://discuss.huggingface.co/t/does-the-rest-api-work-with-private-repo/28987
28,987
10
2023-01-05T12:09:54.284000Z
[ { "id": 53838, "name": "Sundeep", "username": "sl02", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/ba9def/{size}.png", "created_at": "2023-01-05T12:09:54.358Z", "cooked": "<p>I was experimenting with the REST API with a private repo. Despite providing the user access token in the request header, I receive an error</p>\n<pre><code class=\"lang-auto\">import requests\nfrom dotenv import load_dotenv\nload_dotenv()\nper_token = os.getenv('API_PER_TOKEN')\nheaders = {\"Authorization\": f\"Bearer {per_token}\"}\nAPI_URL = \"https://datasets-server.huggingface.co/is-valid?dataset=sl02/np-datasets\"\ndef query():\n response = requests.request(\"GET\", API_URL, headers=headers)\n return response.json()\ndata = query()\n</code></pre>\n<p><code>{'error': 'The dataset does not exist, or is not accessible without authentication (private or gated). Please retry with authentication.'}</code><br>\nHowever, when I make the repository public, it returns <code>{'valid': True}</code>. But, when I run the <code>first-rows</code> API, I get the following message</p>\n<pre><code class=\"lang-auto\">import requests\nfrom dotenv import load_dotenv\nload_dotenv()\nper_token = os.getenv('API_PER_TOKEN')\nheaders = {\"Authorization\": f\"Bearer {per_token}\"}\nAPI_URL = \"https://datasets-server.huggingface.co/first-rows?dataset=sl02/np-datasets&amp;config=default&amp;split=train\"\ndef query():\n response = requests.request(\"GET\", API_URL)\n return response.json()\ndata = query()\n</code></pre>\n<p><code>{'error': 'The response is not ready yet. Please retry later.'}</code></p>\n<p>The <code>load_dataset()</code> works in private mode when I set the <code>use_auth_token</code> argument. Any clue what I missing here?</p>", "post_number": 1, "post_type": 1, "posts_count": 7, "updated_at": "2023-01-05T12:09:54.358Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 550, "reads": 41, "readers_count": 40, "score": 2768.2, "yours": false, "topic_id": 28987, "topic_slug": "does-the-rest-api-work-with-private-repo", "display_username": "Sundeep", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 12315, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/does-the-rest-api-work-with-private-repo/28987/1", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 53864, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2023-01-05T16:22:53.800Z", "cooked": "<p>Maybe <a class=\"mention\" href=\"/u/severo\">@severo</a> knows more, but IIRC the REST API is not available yet for private repos.</p>", "post_number": 2, "post_type": 1, "posts_count": 7, "updated_at": "2023-01-05T16:22:53.800Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 36, "readers_count": 35, "score": 22.2, "yours": false, "topic_id": 28987, "topic_slug": "does-the-rest-api-work-with-private-repo", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/does-the-rest-api-work-with-private-repo/28987/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 53865, "name": "Sylvain Lesage", "username": "severo", "avatar_template": "/user_avatar/discuss.huggingface.co/severo/{size}/27449_2.png", "created_at": "2023-01-05T16:28:07.214Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/sl02\">@sl02</a>. The REST API uses the same rule as the dataset viewer (see <a href=\"https://discuss.huggingface.co/t/the-dataset-preview-has-been-disabled-on-this-dataset/21339/6\" class=\"inline-onebox\">The Dataset Preview has been disabled on this dataset - #6 by severo</a>): it’s not available at all for the private datasets for now.</p>\n<p>re “The response is not ready yet. Please retry later”: the responses to the API endpoints are pre-computed asynchronously and can take some time to be processed, depending on the dataset itself and on the load of the servers.</p>", "post_number": 3, "post_type": 1, "posts_count": 7, "updated_at": "2023-01-05T16:28:07.214Z", "reply_count": 1, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 11, "reads": 35, "readers_count": 34, "score": 67, "yours": false, "topic_id": 28987, "topic_slug": "does-the-rest-api-work-with-private-repo", "display_username": "Sylvain Lesage", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/the-dataset-preview-has-been-disabled-on-this-dataset/21339/6", "internal": true, "reflection": false, "title": "The Dataset Preview has been disabled on this dataset", "clicks": 17 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": false, "staff": true, "user_id": 2900, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/does-the-rest-api-work-with-private-repo/28987/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 76, "username": "lhoestq", "name": "Quentin Lhoest", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png" }, "action_code": null, "via_email": null }, { "id": 205575, "name": "Yasmin Moslem", "username": "ymoslem", "avatar_template": "/user_avatar/discuss.huggingface.co/ymoslem/{size}/39872_2.png", "created_at": "2025-02-27T05:18:09.862Z", "cooked": "<p>Hello! The dataset preview is now available for the <strong>Pro</strong> accounts. Should not it be the case for the API? I cannot do something as simple as retrieving the URLs. Thanks!</p>\n<pre><code class=\"lang-auto\">headers = {\"Authorization\": f\"Bearer {API_TOKEN}\"}\n\nreseponse = requests.get(f\"https://datasets-server.huggingface.co/parquet?dataset={dataset_name}\")\njson_data = reseponse.json()\n\nurls = [f['url'] for f in json_data['parquet_files'] if f['split'] == 'test']\n</code></pre>\n<h2><a name=\"p-205575-update-1\" class=\"anchor\" href=\"#p-205575-update-1\"></a>Update</h2>\n<p>So now this works:</p>\n<pre><code class=\"lang-auto\">from datasets import load_dataset\nimport requests\n\nheaders = {\"Authorization\": f\"Bearer {API_TOKEN}\"}\nAPI_URL = f\"https://huggingface.co/api/datasets/{dataset_name}/parquet\"\n\ndef query():\n response = requests.get(API_URL, headers=headers)\n json_data = response.json()[\"default\"]\n return json_data\n\nurls = query()\nprint(urls)\n</code></pre>\n<p>However, if we try to download the retrieved URL, it does not work <code>FileNotFoundError</code></p>\n<pre><code class=\"lang-auto\">test_dataset = load_dataset(\"parquet\",\n data_files={\"test\": urls[\"test\"]},\n split=\"test\",\n token=API_TOKEN\n )\n</code></pre>\n<p>The only solution I found so far, is to manually download the retrieved URLs, something like:</p>\n<pre><code class=\"lang-auto\"># Manually download the files\n\nimport shutil\nfrom tqdm.auto import tqdm\n\nparquet_files = []\n\nfor n, url in tqdm(enumerate(urls[\"test\"]), total=len(urls[\"test\"])):\n\n response = requests.get(url, headers=headers, stream=True)\n\n with open(f\"{n}.parquet\", \"wb\") as f:\n shutil.copyfileobj(response.raw, f)\n parquet_files.append(f\"{n}.parquet\")\n\n\n# Load dataset\ntest_dataset = load_dataset(\"parquet\", data_files=parquet_files)\n\nprint(test_dataset)\n</code></pre>", "post_number": 4, "post_type": 1, "posts_count": 7, "updated_at": "2025-02-27T05:43:01.675Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 1, "reads": 5, "readers_count": 4, "score": 21, "yours": false, "topic_id": 28987, "topic_slug": "does-the-rest-api-work-with-private-repo", "display_username": "Yasmin Moslem", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 12050, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/does-the-rest-api-work-with-private-repo/28987/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 2900, "username": "severo", "name": "Sylvain Lesage", "avatar_template": "/user_avatar/discuss.huggingface.co/severo/{size}/27449_2.png" }, "action_code": null, "via_email": null }, { "id": 207011, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-03-05T14:39:59.297Z", "cooked": "<p>Hi ! you can load the parquet files from the repo directly:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">load_dataset(dataset_name, revision=\"refs/convert/parquet\")\n</code></pre>\n<p>and if you want to load specific files you can pass <code>data_files=[...]</code> (btw it accepts glob patterns)</p>", "post_number": 5, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-05T14:40:09.529Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 21, "yours": false, "topic_id": 28987, "topic_slug": "does-the-rest-api-work-with-private-repo", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/does-the-rest-api-work-with-private-repo/28987/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208012, "name": "Yasmin Moslem", "username": "ymoslem", "avatar_template": "/user_avatar/discuss.huggingface.co/ymoslem/{size}/39872_2.png", "created_at": "2025-03-10T07:18:58.722Z", "cooked": "<p>Thanks! I still receive <code>FileNotFoundError</code>. The issue, as in the original post, is that the repository is <em>private</em>. It is my repository, and I am logged in with an access token.</p>", "post_number": 6, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-10T07:18:58.722Z", "reply_count": 0, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 16.2, "yours": false, "topic_id": 28987, "topic_slug": "does-the-rest-api-work-with-private-repo", "display_username": "Yasmin Moslem", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 12050, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/does-the-rest-api-work-with-private-repo/28987/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 76, "username": "lhoestq", "name": "Quentin Lhoest", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png" }, "action_code": null, "via_email": null }, { "id": 208374, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-03-11T15:20:02.132Z", "cooked": "<p>Can you check that your token has the right permissions ? I just tried on my side and I couldn’t reproduce the <code>FileNotFoundError</code> on a the parquet branch of a private repo with a token</p>", "post_number": 7, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-11T15:20:02.132Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 4, "readers_count": 3, "score": 20.8, "yours": false, "topic_id": 28987, "topic_slug": "does-the-rest-api-work-with-private-repo", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/does-the-rest-api-work-with-private-repo/28987/7", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null } ]
<p>I was experimenting with the REST API with a private repo. Despite providing the user access token in the request header, I receive an error</p> <pre><code class="lang-auto">import requests from dotenv import load_dotenv load_dotenv() per_token = os.getenv('API_PER_TOKEN') headers = {"Authorization": f"Bearer {per_token}"} API_URL = "https://datasets-server.huggingface.co/is-valid?dataset=sl02/np-datasets" def query(): response = requests.request("GET", API_URL, headers=headers) return response.json() data = query() </code></pre> <p><code>{'error': 'The dataset does not exist, or is not accessible without authentication (private or gated). Please retry with authentication.'}</code><br> However, when I make the repository public, it returns <code>{'valid': True}</code>. But, when I run the <code>first-rows</code> API, I get the following message</p> <pre><code class="lang-auto">import requests from dotenv import load_dotenv load_dotenv() per_token = os.getenv('API_PER_TOKEN') headers = {"Authorization": f"Bearer {per_token}"} API_URL = "https://datasets-server.huggingface.co/first-rows?dataset=sl02/np-datasets&amp;config=default&amp;split=train" def query(): response = requests.request("GET", API_URL) return response.json() data = query() </code></pre> <p><code>{'error': 'The response is not ready yet. Please retry later.'}</code></p> <p>The <code>load_dataset()</code> works in private mode when I set the <code>use_auth_token</code> argument. Any clue what I missing here?</p>
<p>Hi <a class="mention" href="/u/sl02">@sl02</a>. The REST API uses the same rule as the dataset viewer (see <a href="https://discuss.huggingface.co/t/the-dataset-preview-has-been-disabled-on-this-dataset/21339/6" class="inline-onebox">The Dataset Preview has been disabled on this dataset - #6 by severo</a>): it’s not available at all for the private datasets for now.</p> <p>re “The response is not ready yet. Please retry later”: the responses to the API endpoints are pre-computed asynchronously and can take some time to be processed, depending on the dataset itself and on the load of the servers.</p>
Advice for locally run AI Assistant
https://discuss.huggingface.co/t/advice-for-locally-run-ai-assistant/145000
145,000
5
2025-03-10T10:40:30.664000Z
[ { "id": 208043, "name": "Ben Fellows", "username": "Brakish", "avatar_template": "/user_avatar/discuss.huggingface.co/brakish/{size}/42921_2.png", "created_at": "2025-03-10T10:40:30.735Z", "cooked": "<p>I am currently working on an AI assistant which can open and close apps. Most of my code at the moment is AI corrected. However I mostly try to follow tutorials, right now I am looking for 2 things<br>\n1 what model should I be using, recently I have been running mistal 7b locally on a rtx 2060 however there is a lot of delay between input and a response, is there a better option I could be using</p>\n<p>2 what TTS and speech recognition should I use for best results. I am looking to build this for free.</p>\n<p>For Context on my programing level, I am finishing my last year of GCSE python</p>", "post_number": 1, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-10T10:42:12.450Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1406, "reads": 24, "readers_count": 23, "score": 6909.8, "yours": false, "topic_id": 145000, "topic_slug": "advice-for-locally-run-ai-assistant", "display_username": "Ben Fellows", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86595, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/advice-for-locally-run-ai-assistant/145000/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208093, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-10T13:57:52.236Z", "cooked": "<p>It’s a local LLM, but I think the 7B model is a little too big for 8GB to 12GB of 2060. I recommend a model of 3B or less in terms of VRAM size and speed. Also, I think it’s better to use Ollama because there are quirks in the quantization of the 20x0 generation. It’s fast, low memory, and easy. You can also use Llamacpp-python, but it’s a little complicated.<br>\nThere are too many LLM models to say which is best, but for 3B, Llama 3.2 Instruct or Qwen 2.5 Instruct would be good.</p>\n<p>Next, for ASR models, the Whisper series is the standard. The recently released Hugging Face FastRTC is probably the most efficient in the future, but there may still be some areas that are insufficient.</p>\n<p>As for TTS, there are many, and the one that is suitable for each language changes, so it is good to look for something you like from Spaces.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/hub/ollama\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/hub/ollama\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"FAF8F2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/hub/ollama\" target=\"_blank\" rel=\"noopener\">Use Ollama with any GGUF Model on Hugging Face Hub</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/learn/audio-course/chapter7/voice-assistant\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/learn/audio-course/chapter7/voice-assistant\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/5/1535db2ced3dafa86109afa0b3b9ee06922c5453_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F1EFEA\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/learn/audio-course/chapter7/voice-assistant\" target=\"_blank\" rel=\"noopener\">Creating a voice assistant - Hugging Face Audio Course</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/fastrtc\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/fastrtc\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/d/1/d1d816617e0d401a0b322814ca8f50c12125c9fc_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"060605\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/fastrtc\" target=\"_blank\" rel=\"noopener\">fastrtc (FastRTC)</a></h3>\n\n <p>Real Time Communication for AI apps in Python</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox githubrepo\" data-onebox-src=\"https://github.com/huggingface/speech-to-speech\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/speech-to-speech\" target=\"_blank\" rel=\"noopener\">github.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\" data-github-private-repo=\"false\">\n <img width=\"690\" height=\"344\" src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/9/e/9ec3489a2c33de5f0fafc520983e09c80fb7e96a_2_690x344.png\" class=\"thumbnail\" data-dominant-color=\"F2F2ED\">\n\n <h3><a href=\"https://github.com/huggingface/speech-to-speech\" target=\"_blank\" rel=\"noopener\">GitHub - huggingface/speech-to-speech: Speech To Speech: an effort for an open-sourced...</a></h3>\n\n <p><span class=\"github-repo-description\">Speech To Speech: an effort for an open-sourced and modular GPT4-o</span></p>\n</div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/spaces\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/spaces\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/3/f/3f219d23b16d4a243a12070474512a6d6730c841.png\" class=\"thumbnail\" data-dominant-color=\"F1F1F1\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/spaces\" target=\"_blank\" rel=\"noopener\">Spaces - Hugging Face</a></h3>\n\n <p>Discover amazing ML apps made by the community</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-10T13:57:52.236Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 33, "reads": 23, "readers_count": 22, "score": 189.6, "yours": false, "topic_id": 145000, "topic_slug": "advice-for-locally-run-ai-assistant", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/learn/audio-course/chapter7/voice-assistant", "internal": false, "reflection": false, "title": "Creating a voice assistant - Hugging Face Audio Course", "clicks": 35 }, { "url": "https://huggingface.co/docs/hub/ollama", "internal": false, "reflection": false, "title": "Use Ollama with any GGUF Model on Hugging Face Hub", "clicks": 19 }, { "url": "https://github.com/huggingface/speech-to-speech", "internal": false, "reflection": false, "title": "GitHub - huggingface/speech-to-speech: Speech To Speech: an effort for an open-sourced and modular GPT4-o", "clicks": 11 }, { "url": "https://huggingface.co/spaces", "internal": false, "reflection": false, "title": "Spaces - Hugging Face", "clicks": 9 }, { "url": "https://huggingface.co/fastrtc", "internal": false, "reflection": false, "title": "fastrtc (FastRTC)", "clicks": 9 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/advice-for-locally-run-ai-assistant/145000/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208098, "name": "Ben Fellows", "username": "Brakish", "avatar_template": "/user_avatar/discuss.huggingface.co/brakish/{size}/42921_2.png", "created_at": "2025-03-10T14:05:58.540Z", "cooked": "<p>Thank you so much, I have used Ollama to setup Mistral already. Will try some smaller models, is 3b parameters going to be enough to allow for a chatty assistant which needs to have certain responses to commands to allow for control of my laptop. E g when I ask to open an app, response should be ok opening -nameOfApp-</p>", "post_number": 3, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-10T14:05:58.540Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 21, "readers_count": 20, "score": 19.2, "yours": false, "topic_id": 145000, "topic_slug": "advice-for-locally-run-ai-assistant", "display_username": "Ben Fellows", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86595, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/advice-for-locally-run-ai-assistant/145000/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 208105, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-10T14:20:38.978Z", "cooked": "<p>Oh, if you really only want the model to perform the traffic control actions of the agent, then this guy or Qwen 0.5B Instruct might be enough…<br>\nIf you’re looking for speed, then you could also just look for a smaller model. Smallness is speed.<img src=\"https://emoji.discourse-cdn.com/apple/grinning_face.png?v=14\" title=\":grinning_face:\" class=\"emoji\" alt=\":grinning_face:\" loading=\"lazy\" width=\"20\" height=\"20\"></p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/6/a65d918d3320378eb824b38b86b3f7d88e99c03d_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5C71A4\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct\" target=\"_blank\" rel=\"noopener\">HuggingFaceTB/SmolLM2-135M-Instruct · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-10T14:20:38.978Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 4, "reads": 19, "readers_count": 18, "score": 28.8, "yours": false, "topic_id": 145000, "topic_slug": "advice-for-locally-run-ai-assistant", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/HuggingFaceTB/SmolLM2-135M-Instruct", "internal": false, "reflection": false, "title": "HuggingFaceTB/SmolLM2-135M-Instruct · Hugging Face", "clicks": 12 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/advice-for-locally-run-ai-assistant/145000/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208115, "name": "Ben Fellows", "username": "Brakish", "avatar_template": "/user_avatar/discuss.huggingface.co/brakish/{size}/42921_2.png", "created_at": "2025-03-10T14:50:19.237Z", "cooked": "<p>Oh sorry, didn’t mean just controlling the laptop I want it to work to talk but also have a couple of set responses for a type of command, so that I can talk to it like a regular chatbot which will have regular conversation and advice but have a couple of commands which it will have a set response<br>\nfor my program to read and carry out</p>", "post_number": 5, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-10T14:50:19.237Z", "reply_count": 0, "reply_to_post_number": 4, "quote_count": 0, "incoming_link_count": 0, "reads": 16, "readers_count": 15, "score": 18.2, "yours": false, "topic_id": 145000, "topic_slug": "advice-for-locally-run-ai-assistant", "display_username": "Ben Fellows", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86595, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/advice-for-locally-run-ai-assistant/145000/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 208121, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-10T15:24:36.514Z", "cooked": "<p>I see. In that case, You’d want it to be at least 3B, or at most 1.5B. Without fine-tuning at 0.5B or less, the response is too inorganic…<img src=\"https://emoji.discourse-cdn.com/apple/sweat_smile.png?v=14\" title=\":sweat_smile:\" class=\"emoji\" alt=\":sweat_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 6, "post_type": 1, "posts_count": 7, "updated_at": "2025-03-10T15:24:36.514Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 16, "readers_count": 15, "score": 18.2, "yours": false, "topic_id": 145000, "topic_slug": "advice-for-locally-run-ai-assistant", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/advice-for-locally-run-ai-assistant/145000/6", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208282, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-11T08:00:04.878Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 7, "post_type": 3, "posts_count": 7, "updated_at": "2025-03-11T08:00:04.878Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 11, "readers_count": 10, "score": 17.2, "yours": false, "topic_id": 145000, "topic_slug": "advice-for-locally-run-ai-assistant", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/advice-for-locally-run-ai-assistant/145000/7", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I am currently working on an AI assistant which can open and close apps. Most of my code at the moment is AI corrected. However I mostly try to follow tutorials, right now I am looking for 2 things<br> 1 what model should I be using, recently I have been running mistal 7b locally on a rtx 2060 however there is a lot of delay between input and a response, is there a better option I could be using</p> <p>2 what TTS and speech recognition should I use for best results. I am looking to build this for free.</p> <p>For Context on my programing level, I am finishing my last year of GCSE python</p>
<p>It’s a local LLM, but I think the 7B model is a little too big for 8GB to 12GB of 2060. I recommend a model of 3B or less in terms of VRAM size and speed. Also, I think it’s better to use Ollama because there are quirks in the quantization of the 20x0 generation. It’s fast, low memory, and easy. You can also use Llamacpp-python, but it’s a little complicated.<br> There are too many LLM models to say which is best, but for 3B, Llama 3.2 Instruct or Qwen 2.5 Instruct would be good.</p> <p>Next, for ASR models, the Whisper series is the standard. The recently released Hugging Face FastRTC is probably the most efficient in the future, but there may still be some areas that are insufficient.</p> <p>As for TTS, there are many, and the one that is suitable for each language changes, so it is good to look for something you like from Spaces.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/hub/ollama"> <header class="source"> <a href="https://huggingface.co/docs/hub/ollama" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png" class="thumbnail" data-dominant-color="FAF8F2" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/hub/ollama" target="_blank" rel="noopener">Use Ollama with any GGUF Model on Hugging Face Hub</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/learn/audio-course/chapter7/voice-assistant"> <header class="source"> <a href="https://huggingface.co/learn/audio-course/chapter7/voice-assistant" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/5/1535db2ced3dafa86109afa0b3b9ee06922c5453_2_690x372.png" class="thumbnail" data-dominant-color="F1EFEA" width="690" height="372"></div> <h3><a href="https://huggingface.co/learn/audio-course/chapter7/voice-assistant" target="_blank" rel="noopener">Creating a voice assistant - Hugging Face Audio Course</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/fastrtc"> <header class="source"> <a href="https://huggingface.co/fastrtc" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/d/1/d1d816617e0d401a0b322814ca8f50c12125c9fc_2_690x372.png" class="thumbnail" data-dominant-color="060605" width="690" height="372"></div> <h3><a href="https://huggingface.co/fastrtc" target="_blank" rel="noopener">fastrtc (FastRTC)</a></h3> <p>Real Time Communication for AI apps in Python</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox githubrepo" data-onebox-src="https://github.com/huggingface/speech-to-speech"> <header class="source"> <a href="https://github.com/huggingface/speech-to-speech" target="_blank" rel="noopener">github.com</a> </header> <article class="onebox-body"> <div class="github-row" data-github-private-repo="false"> <img width="690" height="344" src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/9/e/9ec3489a2c33de5f0fafc520983e09c80fb7e96a_2_690x344.png" class="thumbnail" data-dominant-color="F2F2ED"> <h3><a href="https://github.com/huggingface/speech-to-speech" target="_blank" rel="noopener">GitHub - huggingface/speech-to-speech: Speech To Speech: an effort for an open-sourced...</a></h3> <p><span class="github-repo-description">Speech To Speech: an effort for an open-sourced and modular GPT4-o</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/spaces"> <header class="source"> <a href="https://huggingface.co/spaces" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/3/f/3f219d23b16d4a243a12070474512a6d6730c841.png" class="thumbnail" data-dominant-color="F1F1F1" width="690" height="372"></div> <h3><a href="https://huggingface.co/spaces" target="_blank" rel="noopener">Spaces - Hugging Face</a></h3> <p>Discover amazing ML apps made by the community</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Logging finetuned model using transformers mlflow flavor in azure
https://discuss.huggingface.co/t/logging-finetuned-model-using-transformers-mlflow-flavor-in-azure/144687
144,687
6
2025-03-07T21:05:50.319000Z
[ { "id": 207633, "name": "mike klink", "username": "Mikeklink01", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/m/49beb7/{size}.png", "created_at": "2025-03-07T21:05:50.389Z", "cooked": "<p>I am working in azure trying to run a job that calls a training notebook. I can train and even evaluate my model just fine within said notebook but when I try to log it at the end it throws errors. The error that I am seeing is</p>\n<p><code>[0;31mHFValidationError[0m: Repo id must be in the form 'repo_name' or 'namespace/repo_name': './models/finetuned_llama3/'. Use </code>repo_type<code> argument if needed.</code></p>\n<p>From some research it seems that this means that it is trying to pull straight from hugging face based on my artifact path. I know that the the model exists where I am referencing because I am logging the directory and can see it exists there. I have tried setting arguments and environment variables telling it not to look for a repo with no success.</p>\n<p>Here is what my logging logic looks like:</p>\n<pre><code class=\"lang-auto\">job_model_path = 'models/finetuned_llama3'\n\npeft_model = AutoPeftModelForCausalLM.from_pretrained(\n job_model_path, \n config=LoraConfig(\n r=lora_config_dict[\"r\"],\n lora_alpha=lora_config_dict[\"lora_alpha\"],\n target_modules=lora_config_dict[\"target_modules\"],\n lora_dropout=lora_config_dict[\"lora_dropout\"],\n bias=lora_config_dict[\"bias\"],\n task_type=lora_config_dict[\"task_type\"]\n ), \n device_map=\"cuda\"\n)\npeft_model.model.config.quantization_config.use_exllama = True\npeft_model.model.config.quantization_config.exllama_config = {\"version\": 2}\n\nmlflow.transformers.log_model(\n transformers_model={\"model\": peft_model, \"tokenizer\": tokenizer},\n artifact_path=\"finetuned_llama3\", # Ensure the artifact path is correct\n registered_model_name=\"huggingface-finetuned-model\",\n task=\"text-generation\" # Specify the task type here\n)\n</code></pre>\n<p>When I try to log the model in this manner in an ML studio notebook it works as expected so it’s something with how we configure the job</p>\n<p>Being that the mlflow flavor is relatively new it has been hard to find a ton of stuff out there about it. I have tried to find other posts / forums about this issue but haven’t found anything that was helpful. GPT and Copilot seem to have no clue how to solve my issue either.</p>\n<p>I’ve seen people say that my artifact path cannot look like a full URL so I have changed that variable many times from full URLs to relative ones. I have also played around with my ‘transformers_model’ argument inputs from referencing the objects to just inputting the path.</p>\n<p>I am expecting this to log a model to the azure model registry.</p>\n<p>For reference this is the model we are finetuning: (<a href=\"https://huggingface.co/astronomer/Llama-3-8B-Instruct-GPTQ-8-Bit\" class=\"inline-onebox\">astronomer/Llama-3-8B-Instruct-GPTQ-8-Bit · Hugging Face</a>)</p>", "post_number": 1, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-07T21:05:50.389Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 86, "reads": 3, "readers_count": 2, "score": 415.6, "yours": false, "topic_id": 144687, "topic_slug": "logging-finetuned-model-using-transformers-mlflow-flavor-in-azure", "display_username": "mike klink", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/astronomer/Llama-3-8B-Instruct-GPTQ-8-Bit", "internal": false, "reflection": false, "title": "astronomer/Llama-3-8B-Instruct-GPTQ-8-Bit · Hugging Face", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86334, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/logging-finetuned-model-using-transformers-mlflow-flavor-in-azure/144687/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207671, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-08T05:20:52.493Z", "cooked": "<p>Like this?</p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">#job_model_path = 'models/finetuned_llama3'\njob_model_path = './models/finetuned_llama3'\n\npeft_model = AutoPeftModelForCausalLM.from_pretrained(\n job_model_path, \n local_files_only=True, # Added\n config=LoraConfig(\n</code></pre>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/transformers/main_classes/model#transformers.PreTrainedModel.from_pretrained\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/transformers/main_classes/model#transformers.PreTrainedModel.from_pretrained\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F5F3ED\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/transformers/main_classes/model#transformers.PreTrainedModel.from_pretrained\" target=\"_blank\" rel=\"noopener\">Models</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-08T05:20:52.493Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 5.6, "yours": false, "topic_id": 144687, "topic_slug": "logging-finetuned-model-using-transformers-mlflow-flavor-in-azure", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/transformers/main_classes/model#transformers.PreTrainedModel.from_pretrained", "internal": false, "reflection": false, "title": "Models", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/logging-finetuned-model-using-transformers-mlflow-flavor-in-azure/144687/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207770, "name": "mike klink", "username": "Mikeklink01", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/m/49beb7/{size}.png", "created_at": "2025-03-08T19:31:13.324Z", "cooked": "<p>Appreciate the reply, but I am still getting the same error with the additional argument. I’m guessing it is an issue with where the model is being saved within the job. It isn’t recognizing it in the directory for some odd reason. I tried updating the packages to the newest versions available but that didn’t work either. If this is more of an azure specific question I can seek help on those forums instead.</p>", "post_number": 3, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-08T19:31:13.324Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 15.4, "yours": false, "topic_id": 144687, "topic_slug": "logging-finetuned-model-using-transformers-mlflow-flavor-in-azure", "display_username": "mike klink", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86334, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/logging-finetuned-model-using-transformers-mlflow-flavor-in-azure/144687/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 207833, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-09T05:19:12.606Z", "cooked": "<blockquote>\n<p>If this is more of an azure specific question I can seek help on those forums instead.</p>\n</blockquote>\n<p>I think that’s possible. I also encounter a lot of errors in virtual machines like Colab and HF Spaces that I don’t encounter locally.</p>\n<p>In particular, there are a lot of cases where (implicit) cache-related behavior is bad (trying to write to a directory with incorrect permissions, etc.), so in some cases you can avoid this by setting environment variables like <strong>HF_HOME</strong> yourself again. Also, the Transformers backend PyTorch has a lot of similar environment variables…</p>\n<p>Also, this is a common problem in Python, but there is a tendency for things to be more stable if you <strong>simply change the names of directories or files</strong>. If there are things with the same name in the scope, the library may malfunction.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/c/e/cef3cd647e391927031467dbcde7613c74193f5f_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F1EFE9\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables\" target=\"_blank\" rel=\"noopener\">Environment variables</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-09T05:19:12.606Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 144687, "topic_slug": "logging-finetuned-model-using-transformers-mlflow-flavor-in-azure", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables", "internal": false, "reflection": false, "title": "Environment variables", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/logging-finetuned-model-using-transformers-mlflow-flavor-in-azure/144687/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208109, "name": "mike klink", "username": "Mikeklink01", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/m/49beb7/{size}.png", "created_at": "2025-03-10T14:38:29.017Z", "cooked": "<p>Gonna mark this as solved because I figured out the solution.</p>\n<p>The issue seems to be that when working in an azure job it has issues when dealing with AutoPeftModelForCausalLM and by association I assume Peft models in general. It struggles to use the variable that you assign to the peft model with the error that I mentioned above. If you instead refer to the models location in the mlflow.transformers.log_model args you can solve the problem with some extra steps. Code here:</p>\n<pre><code class=\"lang-auto\">peft_model = AutoPeftModelForCausalLM.from_pretrained(\n 'models/finetuned_llama3', \n local_files_only=True,\n config=LoraConfig(\n r=lora_config_dict[\"r\"],\n lora_alpha=lora_config_dict[\"lora_alpha\"],\n target_modules=lora_config_dict[\"target_modules\"],\n lora_dropout=lora_config_dict[\"lora_dropout\"],\n bias=lora_config_dict[\"bias\"],\n task_type=lora_config_dict[\"task_type\"]\n ), \n device_map=\"cuda\"\n)\npeft_model.model.config.quantization_config.use_exllama = True\npeft_model.model.config.quantization_config.exllama_config = {\"version\": 2}\n\nwith open(\"models/finetuned_llama3/config.json\", \"w\") as f:\n json.dump(peft_model.config.to_dict(), f, indent=4)\n\nmlflow.transformers.log_model(\n transformers_model='models/finetuned_llama3',\n artifact_path=\"models/finetuned_llama3\",\n registered_model_name=\"huggingface-finetuned-model\",\n task=\"text-generation\",\n save_pretrained=True\n)\n</code></pre>\n<p>The extra step you need to take is adding the config file from you peft model to the directory that your model is saved in. This is because the config file you need is an attribute of the peft mode but if not in the folder that your finetuned model is saved in. The log model statement complains about that so you need to add the config file to that folder (seen in my json.dump).</p>\n<p>Hopefully if someone else has this issue I hope they find this thread.</p>", "post_number": 5, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-10T14:38:29.017Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 26, "reads": 3, "readers_count": 2, "score": 145.6, "yours": false, "topic_id": 144687, "topic_slug": "logging-finetuned-model-using-transformers-mlflow-flavor-in-azure", "display_username": "mike klink", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86334, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/logging-finetuned-model-using-transformers-mlflow-flavor-in-azure/144687/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208217, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-11T02:39:06.559Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 6, "post_type": 3, "posts_count": 6, "updated_at": "2025-03-11T02:39:06.559Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 0.4, "yours": false, "topic_id": 144687, "topic_slug": "logging-finetuned-model-using-transformers-mlflow-flavor-in-azure", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/logging-finetuned-model-using-transformers-mlflow-flavor-in-azure/144687/6", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I am working in azure trying to run a job that calls a training notebook. I can train and even evaluate my model just fine within said notebook but when I try to log it at the end it throws errors. The error that I am seeing is</p> <p><code>[0;31mHFValidationError[0m: Repo id must be in the form 'repo_name' or 'namespace/repo_name': './models/finetuned_llama3/'. Use </code>repo_type<code> argument if needed.</code></p> <p>From some research it seems that this means that it is trying to pull straight from hugging face based on my artifact path. I know that the the model exists where I am referencing because I am logging the directory and can see it exists there. I have tried setting arguments and environment variables telling it not to look for a repo with no success.</p> <p>Here is what my logging logic looks like:</p> <pre><code class="lang-auto">job_model_path = 'models/finetuned_llama3' peft_model = AutoPeftModelForCausalLM.from_pretrained( job_model_path, config=LoraConfig( r=lora_config_dict["r"], lora_alpha=lora_config_dict["lora_alpha"], target_modules=lora_config_dict["target_modules"], lora_dropout=lora_config_dict["lora_dropout"], bias=lora_config_dict["bias"], task_type=lora_config_dict["task_type"] ), device_map="cuda" ) peft_model.model.config.quantization_config.use_exllama = True peft_model.model.config.quantization_config.exllama_config = {"version": 2} mlflow.transformers.log_model( transformers_model={"model": peft_model, "tokenizer": tokenizer}, artifact_path="finetuned_llama3", # Ensure the artifact path is correct registered_model_name="huggingface-finetuned-model", task="text-generation" # Specify the task type here ) </code></pre> <p>When I try to log the model in this manner in an ML studio notebook it works as expected so it’s something with how we configure the job</p> <p>Being that the mlflow flavor is relatively new it has been hard to find a ton of stuff out there about it. I have tried to find other posts / forums about this issue but haven’t found anything that was helpful. GPT and Copilot seem to have no clue how to solve my issue either.</p> <p>I’ve seen people say that my artifact path cannot look like a full URL so I have changed that variable many times from full URLs to relative ones. I have also played around with my ‘transformers_model’ argument inputs from referencing the objects to just inputting the path.</p> <p>I am expecting this to log a model to the azure model registry.</p> <p>For reference this is the model we are finetuning: (<a href="https://huggingface.co/astronomer/Llama-3-8B-Instruct-GPTQ-8-Bit" class="inline-onebox">astronomer/Llama-3-8B-Instruct-GPTQ-8-Bit · Hugging Face</a>)</p>
<p>Gonna mark this as solved because I figured out the solution.</p> <p>The issue seems to be that when working in an azure job it has issues when dealing with AutoPeftModelForCausalLM and by association I assume Peft models in general. It struggles to use the variable that you assign to the peft model with the error that I mentioned above. If you instead refer to the models location in the mlflow.transformers.log_model args you can solve the problem with some extra steps. Code here:</p> <pre><code class="lang-auto">peft_model = AutoPeftModelForCausalLM.from_pretrained( 'models/finetuned_llama3', local_files_only=True, config=LoraConfig( r=lora_config_dict["r"], lora_alpha=lora_config_dict["lora_alpha"], target_modules=lora_config_dict["target_modules"], lora_dropout=lora_config_dict["lora_dropout"], bias=lora_config_dict["bias"], task_type=lora_config_dict["task_type"] ), device_map="cuda" ) peft_model.model.config.quantization_config.use_exllama = True peft_model.model.config.quantization_config.exllama_config = {"version": 2} with open("models/finetuned_llama3/config.json", "w") as f: json.dump(peft_model.config.to_dict(), f, indent=4) mlflow.transformers.log_model( transformers_model='models/finetuned_llama3', artifact_path="models/finetuned_llama3", registered_model_name="huggingface-finetuned-model", task="text-generation", save_pretrained=True ) </code></pre> <p>The extra step you need to take is adding the config file from you peft model to the directory that your model is saved in. This is because the config file you need is an attribute of the peft mode but if not in the folder that your finetuned model is saved in. The log model statement complains about that so you need to add the config file to that folder (seen in my json.dump).</p> <p>Hopefully if someone else has this issue I hope they find this thread.</p>
Unable to Load Dataset Using `load_dataset`
https://discuss.huggingface.co/t/unable-to-load-dataset-using-load-dataset/144579
144,579
10
2025-03-07T08:28:58.684000Z
[ { "id": 207473, "name": "Jiao-Long Cao", "username": "wyrx", "avatar_template": "/user_avatar/discuss.huggingface.co/wyrx/{size}/39157_2.png", "created_at": "2025-03-07T08:28:58.744Z", "cooked": "<p>I converted ImageNet and its corresponding depth images into Parquet format using <code>save_to_disk</code>, storing them as a <code>DatasetDict</code> object. I can successfully load the dataset using <code>load_from_disk</code> as follows:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">from datasets import load_from_disk\n\nds = load_from_disk(\"/defaultShare/pubdata/ImageNet_arrow_rgbdpa\")\nds\n</code></pre>\n<p>This returns:</p>\n<pre><code class=\"lang-auto\">DatasetDict({\n train: Dataset({\n features: ['rgb', 'd', 'label'],\n num_rows: 1281167\n })\n val: Dataset({\n features: ['rgb', 'd', 'label'],\n num_rows: 50000\n })\n})\n</code></pre>\n<p>However, during training, the data loading process intermittently stalls for a few iterations—loading is generally fast, but it randomly pauses for several seconds. To resolve this, I attempted to load the dataset using <code>load_dataset</code>, but encountered the following error:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">from datasets import load_dataset\n\nds = load_dataset(\"/defaultShare/pubdata/ImageNet_arrow_rgbdpa\")\n</code></pre>\n<pre><code class=\"lang-auto\">Failed to read file '/defaultShare/pubdata/ImageNet_arrow_rgbdpa/train/data-00000-of-00096.arrow' with error &lt;class 'datasets.table.CastError'&gt;: Couldn't cast\nrgb: struct&lt;bytes: binary, path: string&gt;\n child 0, bytes: binary\n child 1, path: string\nd: struct&lt;bytes: binary, path: string&gt;\n child 0, bytes: binary\n child 1, path: string\nlabel: int64\n-- schema metadata --\nhuggingface: '{\"info\": {\"features\": {\"rgb\": {\"mode\": \"RGB\", \"_type\": \"Ima' + 24766\nto\n{'indices': Value(dtype='uint64', id=None)}\nbecause column names don't match\n</code></pre>\n<p>I have not found a solution to this issue yet.</p>", "post_number": 1, "post_type": 1, "posts_count": 11, "updated_at": "2025-03-07T08:28:58.744Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 593, "reads": 15, "readers_count": 14, "score": 2818, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "Jiao-Long Cao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 79782, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207474, "name": "Jiao-Long Cao", "username": "wyrx", "avatar_template": "/user_avatar/discuss.huggingface.co/wyrx/{size}/39157_2.png", "created_at": "2025-03-07T08:29:37.947Z", "cooked": "<p>Detailed trace back is:</p>\n<pre><code class=\"lang-auto\">---------------------------------------------------------------------------\nCastError Traceback (most recent call last)\nFile /opt/conda/envs/cuda118/lib/python3.12/site-packages/datasets/builder.py:1854, in ArrowBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, job_id)\n 1853 _time = time.time()\n-&gt; 1854 for _, table in generator:\n 1855 if max_shard_size is not None and writer._num_bytes &gt; max_shard_size:\n\nFile /opt/conda/envs/cuda118/lib/python3.12/site-packages/datasets/packaged_modules/arrow/arrow.py:76, in Arrow._generate_tables(self, files)\n 73 # Uncomment for debugging (will print the Arrow table size and elements)\n 74 # logger.warning(f\"pa_table: {pa_table} num rows: {pa_table.num_rows}\")\n 75 # logger.warning('\\n'.join(str(pa_table.slice(i, 1).to_pydict()) for i in range(pa_table.num_rows)))\n---&gt; 76 yield f\"{file_idx}_{batch_idx}\", self._cast_table(pa_table)\n 77 except ValueError as e:\n\nFile /opt/conda/envs/cuda118/lib/python3.12/site-packages/datasets/packaged_modules/arrow/arrow.py:59, in Arrow._cast_table(self, pa_table)\n 56 if self.info.features is not None:\n 57 # more expensive cast to support nested features with keys in a different order\n 58 # allows str &lt;-&gt; int/float or str to Audio for example\n---&gt; 59 pa_table = table_cast(pa_table, self.info.features.arrow_schema)\n 60 return pa_table\n\nFile /opt/conda/envs/cuda118/lib/python3.12/site-packages/datasets/table.py:2292, in table_cast(table, schema)\n 2291 if table.schema != schema:\n-&gt; 2292 return cast_table_to_schema(table, schema)\n 2293 elif table.schema.metadata != schema.metadata:\n\nFile /opt/conda/envs/cuda118/lib/python3.12/site-packages/datasets/table.py:2240, in cast_table_to_schema(table, schema)\n 2239 if not table_column_names &lt;= set(schema.names):\n-&gt; 2240 raise CastError(\n 2241 f\"Couldn't cast\\n{_short_str(table.schema)}\\nto\\n{_short_str(features)}\\nbecause column names don't match\",\n 2242 table_column_names=table.column_names,\n 2243 requested_column_names=list(features),\n 2244 )\n 2245 arrays = [\n 2246 cast_array_to_feature(\n 2247 table[name] if name in table_column_names else pa.array([None] * len(table), type=schema.field(name).type),\n (...) 2250 for name, feature in features.items()\n 2251 ]\n\nCastError: Couldn't cast\nrgb: struct&lt;bytes: binary, path: string&gt;\n child 0, bytes: binary\n child 1, path: string\nd: struct&lt;bytes: binary, path: string&gt;\n child 0, bytes: binary\n child 1, path: string\nlabel: int64\n-- schema metadata --\nhuggingface: '{\"info\": {\"features\": {\"rgb\": {\"mode\": \"RGB\", \"_type\": \"Ima' + 24766\nto\n{'indices': Value(dtype='uint64', id=None)}\nbecause column names don't match\n\nThe above exception was the direct cause of the following exception:\n\nDatasetGenerationError Traceback (most recent call last)\nCell In[2], line 3\n 1 from datasets import load_dataset\n----&gt; 3 ds = load_dataset(\"/defaultShare/pubdata/ImageNet_arrow_rgbdpa\")\n\nFile /opt/conda/envs/cuda118/lib/python3.12/site-packages/datasets/load.py:2151, in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, keep_in_memory, save_infos, revision, token, streaming, num_proc, storage_options, trust_remote_code, **config_kwargs)\n 2148 return builder_instance.as_streaming_dataset(split=split)\n 2150 # Download and prepare data\n-&gt; 2151 builder_instance.download_and_prepare(\n 2152 download_config=download_config,\n 2153 download_mode=download_mode,\n 2154 verification_mode=verification_mode,\n 2155 num_proc=num_proc,\n 2156 storage_options=storage_options,\n 2157 )\n 2159 # Build dataset for splits\n 2160 keep_in_memory = (\n 2161 keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size)\n 2162 )\n\nFile /opt/conda/envs/cuda118/lib/python3.12/site-packages/datasets/builder.py:924, in DatasetBuilder.download_and_prepare(self, output_dir, download_config, download_mode, verification_mode, dl_manager, base_path, file_format, max_shard_size, num_proc, storage_options, **download_and_prepare_kwargs)\n 922 if num_proc is not None:\n 923 prepare_split_kwargs[\"num_proc\"] = num_proc\n--&gt; 924 self._download_and_prepare(\n 925 dl_manager=dl_manager,\n 926 verification_mode=verification_mode,\n 927 **prepare_split_kwargs,\n 928 **download_and_prepare_kwargs,\n 929 )\n 930 # Sync info\n 931 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values())\n\nFile /opt/conda/envs/cuda118/lib/python3.12/site-packages/datasets/builder.py:1000, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs)\n 996 split_dict.add(split_generator.split_info)\n 998 try:\n 999 # Prepare split will record examples associated to the split\n-&gt; 1000 self._prepare_split(split_generator, **prepare_split_kwargs)\n 1001 except OSError as e:\n 1002 raise OSError(\n 1003 \"Cannot find data file. \"\n 1004 + (self.manual_download_instructions or \"\")\n 1005 + \"\\nOriginal error:\\n\"\n 1006 + str(e)\n 1007 ) from None\n\nFile /opt/conda/envs/cuda118/lib/python3.12/site-packages/datasets/builder.py:1741, in ArrowBasedBuilder._prepare_split(self, split_generator, file_format, num_proc, max_shard_size)\n 1739 job_id = 0\n 1740 with pbar:\n-&gt; 1741 for job_id, done, content in self._prepare_split_single(\n 1742 gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args\n 1743 ):\n 1744 if done:\n 1745 result = content\n\nFile /opt/conda/envs/cuda118/lib/python3.12/site-packages/datasets/builder.py:1897, in ArrowBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, job_id)\n 1895 if isinstance(e, DatasetGenerationError):\n 1896 raise\n-&gt; 1897 raise DatasetGenerationError(\"An error occurred while generating the dataset\") from e\n 1899 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths)\n\nDatasetGenerationError: An error occurred while generating the dataset\n</code></pre>", "post_number": 2, "post_type": 1, "posts_count": 11, "updated_at": "2025-03-07T08:29:37.947Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 9, "reads": 14, "readers_count": 13, "score": 62.8, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "Jiao-Long Cao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 79782, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/2", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207478, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-07T09:04:50.677Z", "cooked": "<p>The load_dataset() function in the Hugging Face datasets library is for loading datasets that have been converted for use with HF, so you should either convert the dataset to HF format and save it, or load it using another function.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/datasets/index\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/datasets/index\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/5/35e852b936c2343e04e14f5d22299d4e04d553d8_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F8F5F0\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/datasets/index\" target=\"_blank\" rel=\"noopener\">Datasets</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<hr>\n<p>To resolve the data loading issue, follow these steps:</p>\n<ol>\n<li>\n<p><strong>Use the Correct Loading Function</strong>: Since your data is saved in the Arrow format using <code>save_to_disk</code>, you should use <code>load_from_disk</code> to load it. This function is designed for Arrow files and supports the DatasetDict structure.</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">from datasets import load_from_disk\n\nds = load_from_disk(\"/defaultShare/pubdata/ImageNet_arrow_rgbdpa\")\n</code></pre>\n</li>\n<li>\n<p><strong>Avoid Using <code>load_dataset</code> for Arrow Files</strong>: The function <code>load_dataset</code> is intended for loading from specific formats like Parquet, CSV, or JSON, not Arrow. Using it for Arrow files can lead to schema mismatches and errors.</p>\n</li>\n<li>\n<p><strong>Investigate Data Loading Performance</strong>: If you’re experiencing stalling during training, consider the following:</p>\n<ul>\n<li><strong>Caching</strong>: Ensure that your data is being read efficiently. Using <code>load_from_disk</code> may require additional optimizations for caching.</li>\n<li><strong>Disk I/O</strong>: Check if the disk where your data is stored is experiencing high latency or contention. Using faster storage solutions might help.</li>\n<li><strong>Data Sharding</strong>: If your Arrow files are large, consider sharding them into smaller files to improve parallel reading.</li>\n<li><strong>Batching</strong>: Optimize how data is batched during training to reduce I/O bottlenecks.</li>\n</ul>\n</li>\n<li>\n<p><strong>Consider Converting to Parquet</strong>: If performance remains an issue, you can convert your DatasetDict to Parquet format for potentially faster access. This involves saving each split as a Parquet file and then loading using <code>load_dataset</code> with the Parquet option.</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\"># Convert and save each split to Parquet\nds['train'].to_parquet('/path/to/train.parquet')\nds['val'].to_parquet('/path/to/val.parquet')\n\n# Load using load_dataset\ntrain_ds = load_dataset('parquet', data_files={'train': '/path/to/train.parquet'})\nval_ds = load_dataset('parquet', data_files={'val': '/path/to/val.parquet'})\n</code></pre>\n</li>\n</ol>\n<p>By adhering to these steps, you ensure compatibility with your data format and address potential performance issues during training.</p>", "post_number": 3, "post_type": 1, "posts_count": 11, "updated_at": "2025-03-07T09:05:14.176Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 6, "reads": 13, "readers_count": 12, "score": 37.6, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/datasets/index", "internal": false, "reflection": false, "title": "Datasets", "clicks": 2 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207521, "name": "Jiao-Long Cao", "username": "wyrx", "avatar_template": "/user_avatar/discuss.huggingface.co/wyrx/{size}/39157_2.png", "created_at": "2025-03-07T10:57:09.697Z", "cooked": "<p>Thank you for your response. However, the Arrow format has already been saved as Parquet, which should be compatible with Hugging Face, so this error shouldn’t occur. Additionally, even after converting to Parquet, the training process still randomly pauses for several seconds. Do you have any ideas about it?</p>", "post_number": 4, "post_type": 1, "posts_count": 11, "updated_at": "2025-03-07T10:57:09.697Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 1, "reads": 11, "readers_count": 10, "score": 22.2, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "Jiao-Long Cao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 79782, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 207547, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-07T12:55:40.349Z", "cooked": "<p>Hmm…<br>\nMaybe it would be better to shard the data set.</p><aside class=\"quote quote-modified\" data-post=\"1\" data-topic=\"69288\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/aaditya/48/20855_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/how-to-load-a-large-hf-dataset-efficiently/69288\">How to load a large hf dataset efficiently?</a> <a class=\"badge-category__wrapper \" href=\"/c/datasets/10\"><span data-category-id=\"10\" style=\"--category-badge-color: #F7941D; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"This category is for any question related to the datasets library. You can also file an issue.\"><span class=\"badge-category__name\">🤗Datasets</span></span></a>\n </div>\n <blockquote>\n I am trying to load a dataset <a href=\"https://huggingface.co/datasets/axiong/pmc_oa\" class=\"inline-onebox\">axiong/pmc_oa · Datasets at Hugging Face</a> The dataset size is around 22 gb and I have ram ~10 GB, the dataset object is stuck at extracting file point \n <a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/5/258c7f7c2cf40022e356b4dd87a1edcc0a5e64f0.jpeg\" data-download-href=\"/uploads/short-url/5maGhrRBHkGMuew8P2YCcOp703u.jpeg?dl=1\" title=\"Screenshot 2024-01-16 at 8.41.53 AM\" rel=\"noopener nofollow ugc\">[Screenshot 2024-01-16 at 8.41.53 AM]</a> \nI also tried streaming mode but that’s giving another error. \nfrom datasets import load_dataset\ndataset = load_dataset(\"axiong/pmc_oa\", 'pmc_oa', split='train', streaming=True)\nprint(next(iter(dataset)))\n\n <a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/a/b/ab39de6876695cf089aef3c50ac9592cb4882ad4.jpeg\" data-download-href=\"/uploads/short-url/oqJD6yPD880dfaJ9RWMREJFqsAc.jpeg?dl=1\" title=\"Screenshot 2024-01-16 at 9.22.15 AM\" rel=\"noopener nofollow ugc\">[Screenshot 2024-01-16 at 9.22.15 AM]</a> \nAny suggestion on how to deal with…\n </blockquote>\n</aside>\n<aside class=\"quote quote-modified\" data-post=\"1\" data-topic=\"69288\">\n <div class=\"title\">\n <div class=\"quote-controls\"></div>\n <img alt=\"\" width=\"24\" height=\"24\" src=\"https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/aaditya/48/20855_2.png\" class=\"avatar\">\n <a href=\"https://discuss.huggingface.co/t/how-to-load-a-large-hf-dataset-efficiently/69288\">How to load a large hf dataset efficiently?</a> <a class=\"badge-category__wrapper \" href=\"/c/datasets/10\"><span data-category-id=\"10\" style=\"--category-badge-color: #F7941D; --category-badge-text-color: #FFFFFF;\" data-drop-close=\"true\" class=\"badge-category \" title=\"This category is for any question related to the datasets library. You can also file an issue.\"><span class=\"badge-category__name\">🤗Datasets</span></span></a>\n </div>\n <blockquote>\n I am trying to load a dataset <a href=\"https://huggingface.co/datasets/axiong/pmc_oa\" class=\"inline-onebox\">axiong/pmc_oa · Datasets at Hugging Face</a> The dataset size is around 22 gb and I have ram ~10 GB, the dataset object is stuck at extracting file point \n <a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/5/258c7f7c2cf40022e356b4dd87a1edcc0a5e64f0.jpeg\" data-download-href=\"/uploads/short-url/5maGhrRBHkGMuew8P2YCcOp703u.jpeg?dl=1\" title=\"Screenshot 2024-01-16 at 8.41.53 AM\" rel=\"noopener nofollow ugc\">[Screenshot 2024-01-16 at 8.41.53 AM]</a> \nI also tried streaming mode but that’s giving another error. \nfrom datasets import load_dataset\ndataset = load_dataset(\"axiong/pmc_oa\", 'pmc_oa', split='train', streaming=True)\nprint(next(iter(dataset)))\n\n <a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/a/b/ab39de6876695cf089aef3c50ac9592cb4882ad4.jpeg\" data-download-href=\"/uploads/short-url/oqJD6yPD880dfaJ9RWMREJFqsAc.jpeg?dl=1\" title=\"Screenshot 2024-01-16 at 9.22.15 AM\" rel=\"noopener nofollow ugc\">[Screenshot 2024-01-16 at 9.22.15 AM]</a> \nAny suggestion on how to deal with…\n </blockquote>\n</aside>\n", "post_number": 5, "post_type": 1, "posts_count": 11, "updated_at": "2025-03-07T12:55:40.349Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 11, "readers_count": 10, "score": 17.2, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/how-to-load-a-large-hf-dataset-efficiently/69288", "internal": true, "reflection": false, "title": "How to load a large hf dataset efficiently?", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207560, "name": "Jiao-Long Cao", "username": "wyrx", "avatar_template": "/user_avatar/discuss.huggingface.co/wyrx/{size}/39157_2.png", "created_at": "2025-03-07T13:53:32.114Z", "cooked": "<p>Thanks again, but actually, when saving the dataset, I already sharded each split into 96 pieces using:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">imagenet.save_to_disk(\"./Imagenet_arrow_rgbdpa\", num_proc=96, max_shard_size=\"8GB\")\n</code></pre>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/4/e/4efa58aed6f91b5424bb65bc003d61bc2b7c5305.png\" data-download-href=\"/uploads/short-url/bgFBEVz9WTSu8GUZyfnC3Ew4Qrb.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/4/e/4efa58aed6f91b5424bb65bc003d61bc2b7c5305.png\" alt=\"image\" data-base62-sha1=\"bgFBEVz9WTSu8GUZyfnC3Ew4Qrb\" width=\"690\" height=\"491\" data-dominant-color=\"E7E7E7\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">1909×1359 258 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>Therefore, I have no clear explanation for the performance issues or the errors encountered.</p>", "post_number": 6, "post_type": 1, "posts_count": 11, "updated_at": "2025-03-07T13:53:32.114Z", "reply_count": 1, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 1, "reads": 10, "readers_count": 9, "score": 27, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "Jiao-Long Cao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 79782, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/6", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 207562, "name": "Jiao-Long Cao", "username": "wyrx", "avatar_template": "/user_avatar/discuss.huggingface.co/wyrx/{size}/39157_2.png", "created_at": "2025-03-07T13:57:08.321Z", "cooked": "<p>The complete conversion script is as follows:</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\"># rgb_paths, d_paths, and labels are lists containing image paths\nimagenet_train = Dataset.from_dict({\"rgb\": rgb_paths_train, \"d\": d_paths_train, \"label\": labels_train})\nimagenet_val = Dataset.from_dict({\"rgb\": rgb_paths_val, \"d\": d_paths_val, \"label\": labels_val})\n\n# Convert columns to appropriate data types\nimagenet_train = imagenet_train.cast_column(\"rgb\", Image(mode=\"RGB\"))\nimagenet_train = imagenet_train.cast_column(\"d\", Image(mode=\"L\"))\nimagenet_val = imagenet_val.cast_column(\"rgb\", Image(mode=\"RGB\"))\nimagenet_val = imagenet_val.cast_column(\"d\", Image(mode=\"L\"))\n\n# Assign class labels\nimagenet_train = imagenet_train.cast_column(\"label\", ClassLabel(names=list(IMAGENET2012_CLASSES.keys())))\nimagenet_train = imagenet_train.cast_column(\"label\", ClassLabel(names=list(IMAGENET2012_CLASSES.values())))\nimagenet_val = imagenet_val.cast_column(\"label\", ClassLabel(names=list(IMAGENET2012_CLASSES.keys())))\nimagenet_val = imagenet_val.cast_column(\"label\", ClassLabel(names=list(IMAGENET2012_CLASSES.values())))\n\n# Create DatasetDict and save to disk\nimagenet = DatasetDict({\"train\": imagenet_train, \"val\": imagenet_val})\nimagenet.save_to_disk(\"./Imagenet_arrow_rgbdpa\", num_proc=96, max_shard_size=\"8GB\")\n</code></pre>\n<p>This setup ensures the dataset is properly structured and efficiently sharded, yet the performance issues and errors persist.</p>", "post_number": 7, "post_type": 1, "posts_count": 11, "updated_at": "2025-03-07T13:57:08.321Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 21.6, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "Jiao-Long Cao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 79782, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/7", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 79782, "username": "wyrx", "name": "Jiao-Long Cao", "avatar_template": "/user_avatar/discuss.huggingface.co/wyrx/{size}/39157_2.png" }, "action_code": null, "via_email": null }, { "id": 207575, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-07T15:21:44.549Z", "cooked": "<p>max_shard_size may be too large.</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/huggingface/datasets/issues/4721\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/datasets/issues/4721\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/datasets</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/datasets/issues/4721\" target=\"_blank\" rel=\"noopener\">PyArrow Dataset error when calling `load_dataset`</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2022-07-20\" data-time=\"01:16:03\" data-timezone=\"UTC\">01:16AM - 20 Jul 22 UTC</span>\n </div>\n\n\n <div class=\"user\">\n <a href=\"https://github.com/piraka9011\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/2/224562efe4d0434ec851b31093d870bb01e554c2.jpeg\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"62524B\">\n piraka9011\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n bug\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">## Describe the bug\n\nI am fine tuning a wav2vec2 model following the script he<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">re using my own dataset: https://github.com/huggingface/transformers/blob/main/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py\n\nLoading my Audio dataset from the hub which was originally generated from disk results in the following PyArrow error:\n\n```sh\nFile \"/home/ubuntu/w2v2/run_speech_recognition_ctc.py\", line 227, in main\n raw_datasets = load_dataset(\nFile \"/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/datasets/load.py\", line 1679, in load_dataset\n builder_instance.download_and_prepare(\nFile \"/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/datasets/builder.py\", line 704, in download_and_prepare\n self._download_and_prepare(\nFile \"/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/datasets/builder.py\", line 793, in _download_and_prepare\n self._prepare_split(split_generator, **prepare_split_kwargs)\nFile \"/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/datasets/builder.py\", line 1268, in _prepare_split\n for key, table in logging.tqdm(\nFile \"/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/tqdm/std.py\", line 1195, in __iter__\n for obj in iterable:\nFile \"/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/datasets/packaged_modules/parquet/parquet.py\", line 68, in _generate_tables\n for batch_idx, record_batch in enumerate(\nFile \"pyarrow/_parquet.pyx\", line 1309, in iter_batches\nFile \"pyarrow/error.pxi\", line 121, in pyarrow.lib.check_status\npyarrow.lib.ArrowNotImplementedError: Nested data conversions not implemented for chunked array outputs\n```\n\n## Steps to reproduce the bug\n\nI created a dataset from a JSON lines manifest of `audio_filepath`, `text`, and `duration`.\n\nWhen creating the dataset, I do something like this:\n\n```python\nimport json\nfrom datasets import Dataset, Audio\n\n# manifest_lines is a list of dicts w/ \"audio_filepath\", \"duration\", and \"text\nfor line in manifest_lines:\n line = line.strip()\n if line:\n line_dict = json.loads(line)\n manifest_dict[\"audio\"].append(f\"{root_path}/{line_dict['audio_filepath']}\")\n manifest_dict[\"duration\"].append(line_dict[\"duration\"])\n manifest_dict[\"transcription\"].append(line_dict[\"text\"])\n\n# Create a HF dataset\ndataset = Dataset.from_dict(manifest_dict).cast_column(\n \"audio\", Audio(sampling_rate=16_000),\n)\n\n# From the docs for saving to disk\n# https://huggingface.co/docs/datasets/v2.3.2/en/package_reference/main_classes#datasets.Dataset.save_to_disk\ndef read_audio_file(example):\n with open(example[\"audio\"][\"path\"], \"rb\") as f:\n return {\"audio\": {\"bytes\": f.read()}}\n\ndataset = dataset.map(read_audio_file, num_proc=70)\ndataset.save_to_disk(f\"/audio-data/hf/{artifact_name}\")\ndataset.push_to_hub(f\"{org-name}/{artifact_name}\", max_shard_size=\"5GB\", private=True)\n```\n\nThen when I call `load_dataset()` in my training script, with the same dataset I generated above, and download from the huggingface hub I get the above stack trace.\nI am able to load the dataset fine if I use `load_from_disk()`.\n\n## Expected results\n\n`load_dataset()` should behave just like `load_from_disk()` and not cause any errors.\n\n## Actual results\n\nSee above\n\n## Environment info\n\nI am using the `huggingface/transformers-pytorch-gpu:latest` image\n- `datasets` version: 2.3.0\n- Platform: Docker/Ubuntu 20.04\n- Python version: 3.8\n- PyArrow version: 8.0.0</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 8, "post_type": 1, "posts_count": 11, "updated_at": "2025-03-07T15:21:44.549Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 8, "readers_count": 7, "score": 21.6, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/datasets/issues/4721", "internal": false, "reflection": false, "title": "PyArrow Dataset error when calling `load_dataset` · Issue #4721 · huggingface/datasets · GitHub", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/8", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208041, "name": "Jiao-Long Cao", "username": "wyrx", "avatar_template": "/user_avatar/discuss.huggingface.co/wyrx/{size}/39157_2.png", "created_at": "2025-03-10T10:04:11.695Z", "cooked": "<p>Thank you very much! I regenerated the dataset with <code>max_shard_size=\"1GB\"</code>, and now it can be loaded successfully using both <code>load_dataset</code> and <code>load_from_disk</code>.</p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/e/2e3b41c8608d9bb34586f6bcfe436670a6d3f19b.png\" data-download-href=\"/uploads/short-url/6AYV6HV2Bc59Pht7xqZCZNG08vV.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/e/2e3b41c8608d9bb34586f6bcfe436670a6d3f19b_2_690x397.png\" alt=\"image\" data-base62-sha1=\"6AYV6HV2Bc59Pht7xqZCZNG08vV\" width=\"690\" height=\"397\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/e/2e3b41c8608d9bb34586f6bcfe436670a6d3f19b_2_690x397.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/e/2e3b41c8608d9bb34586f6bcfe436670a6d3f19b_2_1035x595.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/e/2e3b41c8608d9bb34586f6bcfe436670a6d3f19b_2_1380x794.png 2x\" data-dominant-color=\"E4EEE4\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">1694×977 94.6 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>However, the training stalls remain unresolved and may be related to hardware issues. I have also discussed this in the TIMM framework forum. <a href=\"https://github.com/huggingface/pytorch-image-models/discussions/2449\" rel=\"noopener nofollow ugc\">Inconsistent Training Throughput Across Epochs · huggingface/pytorch-image-models · Discussion #2449</a></p>", "post_number": 9, "post_type": 1, "posts_count": 11, "updated_at": "2025-03-10T10:04:11.695Z", "reply_count": 0, "reply_to_post_number": 8, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 16.4, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "Jiao-Long Cao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/pytorch-image-models/discussions/2449", "internal": false, "reflection": false, "title": "Inconsistent Training Throughput Across Epochs · huggingface/pytorch-image-models · Discussion #2449 · GitHub", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 79782, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/9", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 208071, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-10T12:46:14.292Z", "cooked": "<p>Unless it’s simply a case of not having enough VRAM, it could be that the trainer’s optimization options are causing the problem. If you’re using Lightning, that could also be a factor.</p>\n<h3><a name=\"p-208071-data-type-format-issue-1\" class=\"anchor\" href=\"#p-208071-data-type-format-issue-1\"></a>Data type format issue</h3>\n<aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/huggingface/transformers/issues/28872\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/transformers/issues/28872\" target=\"_blank\" rel=\"noopener\">github.com/huggingface/transformers</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/huggingface/transformers/issues/28872\" target=\"_blank\" rel=\"noopener\">Out of Memory at Seemingly Inconsistent Steps Using Trainer and Deepspeed with Llama2 7b</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-02-05\" data-time=\"16:07:53\" data-timezone=\"UTC\">04:07PM - 05 Feb 24 UTC</span>\n </div>\n\n <div class=\"date\">\n closed <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-04-22\" data-time=\"09:12:12\" data-timezone=\"UTC\">09:12AM - 22 Apr 24 UTC</span>\n </div>\n\n <div class=\"user\">\n <a href=\"https://github.com/ianmcampbell\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/2/4/245418253a4e596a12da9ddad9be72cdb75190c3.png\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"D3E3EC\">\n ianmcampbell\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n trainer\n </span>\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n DeepSpeed\n </span>\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n bug\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">### System Info\n\n- `transformers` version: 4.37.2\n- Platform: Linux-5.14.0-16<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">2.6.1.el9_1.x86_64-x86_64-with-glibc2.34\n- Python version: 3.11.7\n- Huggingface_hub version: 0.20.3\n- Safetensors version: 0.4.2\n- Accelerate version: 0.26.1\n- Deepspeed version: 0.13.1\n- Flash-attention version: 2.5.2\n- Datasets version: 2.16.1\n- PyTorch version (GPU?): 2.1.2+cu118 (True)\n- Tensorflow version (GPU?): not installed (NA)\n- Flax version (CPU?/GPU?/TPU?): not installed (NA)\n- Jax version: not installed\n- JaxLib version: not installed\n- Using GPU in script?: Yes\n- Using distributed or parallel set-up in script?: Yes\n\n### Who can help?\n\n@pacman100 \n\n### Information\n\n- [ ] The official example scripts\n- [X] My own modified scripts\n\n### Tasks\n\n- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)\n- [X] My own task or dataset (give details below)\n\n### Reproduction\n\nI am further pre-training Llama2-7b-chat-hf on a 3,273,686,325 token corpus of my own data. However, training fails at seemingly inconsistent times. \n\nMy cluster contains GPU nodes with 4 x A100-80GB GPUs. The out of memory error occurs at seemingly inconsistent times depending on how many GPUs are used. \n\nHere is the training script:\n```\nimport datasets\nimport os\nimport torch\nimport argparse\nfrom mpi4py import MPI\nfrom transformers import Trainer, TrainingArguments, AutoTokenizer, AutoModelForCausalLM\nfrom transformers import DataCollatorForSeq2Seq, default_data_collator\ntorch.backends.cuda.matmul.allow_tf32 = True\n\ndef set_mpi(masteradd):\n \"\"\"\n Set Open MPI environment variables\n :param masteradd: Value for setting MASTER_ADDR environment variable\n :type masteradd: String\n :return: None\n \"\"\"\n comm = MPI.COMM_WORLD \n os.environ[\"LOCAL_RANK\"] = os.environ[\"OMPI_COMM_WORLD_LOCAL_RANK\"]\n os.environ[\"RANK\"] = str(comm.Get_rank())\n os.environ['WORLD_SIZE'] = str(comm.Get_size())\n os.environ[\"MASTER_ADDR\"] = masteradd\n os.environ[\"MASTER_PORT\"] = \"9978\"\n\ndef main():\n \"\"\"\n Set training parameters and train model\n :return: None\n \"\"\"\n parser = argparse.ArgumentParser()\n parser.add_argument(\"-m\", \"--master_add\", dest=\"masteradd\")\n args = parser.parse_args()\n set_mpi(args.masteradd)\n experiment_name = \"\"\n tokenizer_name = 'resized_tokenizer/'\n model_name = 'llama2-7b-chat-hf/'\n out_dir = 'out/'\n os.makedirs(out_dir, exist_ok=True)\n dataset_path = \"datasets/\"\n dataset_files = [os.path.join(dataset_path,x) for x in os.listdir(dataset_path)]\n dataset = datasets.load_dataset('json', data_files=dataset_files, split='train', cache_dir=\"cache/\")\n tokenizer = AutoTokenizer.from_pretrained(tokenizer_name, use_fast=False)\n\n training_args = TrainingArguments(\n output_dir=out_dir,\n deepspeed='multi_node_7b.json',\n do_eval=False,\n logging_strategy=\"steps\",\n logging_steps=10,\n learning_rate=2e-5,\n warmup_steps=1000,\n gradient_checkpointing=False,\n per_device_train_batch_size=1,\n gradient_accumulation_steps=4,\n tf32=True,\n bf16=True,\n weight_decay=0.1,\n save_total_limit=40,\n push_to_hub=False,\n save_strategy=\"steps\",\n num_train_epochs=1,\n save_steps=1000,\n report_to=\"tensorboard\"\n )\n model=AutoModelForCausalLM.from_pretrained(model_name,\n do_sample=True,\n attn_implementation=\"flash_attention_2\",\n torch_dtype=torch.bfloat16)\n trainer=Trainer(\n model=model,\n args=training_args,\n train_dataset=dataset,\n data_collator=DataCollatorForSeq2Seq(tokenizer)\n )\n\n trainer.train(\n resume_from_checkpoint = False,\n )\n trainer.save_model()\n\n\nif __name__ == \"__main__\":\n main()\n```\n\nHere is the Deepspeed config: \n```\n{\n \"bf16\": {\n \"enabled\": true\n },\n \"optimizer\": {\n \"type\": \"AdamW\",\n \"params\": {\n \"lr\": \"auto\",\n \"betas\": \"auto\",\n \"eps\": \"auto\",\n \"weight_decay\": \"auto\"\n }\n },\n \"scheduler\": {\n \"type\": \"WarmupLR\",\n \"params\": {\n \"warmup_min_lr\": \"auto\",\n \"warmup_max_lr\": \"auto\",\n \"warmup_num_steps\": \"auto\"\n }\n },\n \"zero_optimization\": {\n \"stage\": 1,\n \"offload_optimizer\": {\n \"device\": \"none\"\n },\n \"offload_param\": {\n \"device\": \"none\"\n },\n \"overlap_comm\": true,\n \"contiguous_gradients\": true,\n \"reduce_bucket_size\": \"auto\"\n },\n \"gradient_accumulation_steps\": 4,\n \"gradient_clipping\": \"auto\",\n \"gradient_checkpointing\": false,\n \"train_batch_size\": \"auto\",\n \"train_micro_batch_size_per_gpu\": \"auto\",\n \"steps_per_print\": 200,\n \"wall_clock_breakdown\": false\n}\n```\nI launch training from a bash script. Here is the relevant line.\n```\ndeepspeed -H hostfile --master_port 9978 --master_addr $PARENT --no_ssh_check --launcher OPENMPI --launcher_args '--oversubscribe ' deepspeed_7b_finetune.py -m $PARENT\n```\n\n```\n 19%|█▉ | 3237/16700 [3:34:12&lt;38:35:22, 10.32s/it]Traceback (most recent call last):\n File \"/home/user/Hope-Alpha/src/scripts/deepspeed_7b_finetune.py\", line 87, in &lt;module&gt;\n main()\n File \"/home/user/Hope-Alpha/src/scripts/deepspeed_7b_finetune.py\", line 80, in main\n trainer.train(\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/transformers/trainer.py\", line 1539, in train\n return inner_training_loop(\n ^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/transformers/trainer.py\", line 1869, in _inner_training_loop\n tr_loss_step = self.training_step(model, inputs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/transformers/trainer.py\", line 2772, in training_step\n loss = self.compute_loss(model, inputs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/transformers/trainer.py\", line 2795, in compute_loss\n outputs = model(**inputs)\n ^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/torch/nn/modules/module.py\", line 1518, in _wrapped_call_impl\n return self._call_impl(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/torch/nn/modules/module.py\", line 1527, in _call_impl\n return forward_call(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/deepspeed/utils/nvtx.py\", line 15, in wrapped_fn\n ret_val = func(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/deepspeed/runtime/engine.py\", line 1842, in forward\n loss = self.module(*inputs, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/torch/nn/modules/module.py\", line 1518, in _wrapped_call_impl\n return self._call_impl(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/torch/nn/modules/module.py\", line 1527, in _call_impl\n return forward_call(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/transformers/models/llama/modeling_llama.py\", line 1183, in forward\n outputs = self.model(\n ^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/torch/nn/modules/module.py\", line 1518, in _wrapped_call_impl\n return self._call_impl(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/torch/nn/modules/module.py\", line 1527, in _call_impl\n return forward_call(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/transformers/models/llama/modeling_llama.py\", line 1070, in forward\n layer_outputs = decoder_layer(\n ^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/torch/nn/modules/module.py\", line 1518, in _wrapped_call_impl\n return self._call_impl(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/torch/nn/modules/module.py\", line 1527, in _call_impl\n return forward_call(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/transformers/models/llama/modeling_llama.py\", line 795, in forward\n hidden_states = self.input_layernorm(hidden_states)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/torch/nn/modules/module.py\", line 1518, in _wrapped_call_impl\n return self._call_impl(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/torch/nn/modules/module.py\", line 1527, in _call_impl\n return forward_call(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/home/user/miniconda3/envs/train-transformers/lib/python3.11/site-packages/transformers/models/llama/modeling_llama.py\", line 116, in forward\n hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)\n ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\ntorch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 116.00 MiB. GPU 3 has a total capacty of 79.32 GiB of which 101.56 MiB is free. Including non-PyTorch memory, this process has 79.22 GiB memory in use. Of the allocated memory 75.96 GiB is allocated by PyTorch, and 1.59 GiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF\ng-10-01:2356899:2357762 [3] NCCL INFO [Service thread] Connection closed by localRank 3\ng-10-01:2356899:2356899 [3] NCCL INFO comm 0x9e8f6ea0 rank 3 nranks 12 cudaDev 3 busId e3000 - Abort COMPLETE\n```\n\nThe dataset contains 12 `.json` files which are assembled and cached. Training can complete on any one of the 12 files. However, when assembled, there is the above out of memory error. If the files are re-arranged (ie `[2,0,1,3,4,5,6,7,8,9,10,11]`), the step on which training fails changes slightly. If training is restarted from a saved checkpoint using `resume_from_checkpoint = 'checkpoint_dir'`, training errors out of memory at exactly the same step. \n\nTraining of the same dataset using `accelerate` and FSDP completes without issue. \n\nI am at a loss for what could be causing this.\n\n### Expected behavior\n\nThe expected behavior is that training does not run out of memory at inconsistent times and completes a single epoch.</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-208071-cache-issue-2\" class=\"anchor\" href=\"#p-208071-cache-issue-2\"></a>Cache issue</h3>\n<aside class=\"onebox discoursetopic\" data-onebox-src=\"https://discuss.pytorch.org/t/training-time-gradually-increases-per-epoch/126748\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/d/3/d386f40ab27c7dca80591402e0306190f57656c0.png\" class=\"site-icon\" data-dominant-color=\"F24D2D\" width=\"32\" height=\"32\">\n\n <a href=\"https://discuss.pytorch.org/t/training-time-gradually-increases-per-epoch/126748\" target=\"_blank\" rel=\"noopener\" title=\"04:47PM - 14 July 2021\">PyTorch Forums – 14 Jul 21</a>\n </header>\n\n <article class=\"onebox-body\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/2X/1/15a7e2573aeb9e6ba8995f824d3b63171a433041.png\" class=\"thumbnail onebox-avatar\" width=\"500\" height=\"500\" data-dominant-color=\"EE4C2C\">\n\n<div class=\"title-wrapper\">\n <h3><a href=\"https://discuss.pytorch.org/t/training-time-gradually-increases-per-epoch/126748\" target=\"_blank\" rel=\"noopener\">Training time gradually increases per epoch</a></h3>\n <div class=\"topic-category\">\n <span class=\"badge-wrapper bullet\">\n <span class=\"badge-category-bg\" style=\"background-color: #AB9364;\"></span>\n <span class=\"badge-category clear-badge\">\n <span class=\"category-name\">vision</span>\n </span>\n </span>\n </div>\n</div>\n\n <p>I’m training an EfficientNetV2 with the following training script: for epoch in range(Config.num_epochs): print(f\"{'-'*20} EPOCH: {epoch+1}/{Config.num_epochs} {'-'*20}\") model.train() train_prog_bar = tqdm(train_loader,...</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox discoursetopic\" data-onebox-src=\"https://discuss.pytorch.org/t/training-slow-down-as-epoch-progress/117814\">\n <header class=\"source\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/d/3/d386f40ab27c7dca80591402e0306190f57656c0.png\" class=\"site-icon\" data-dominant-color=\"F24D2D\" width=\"32\" height=\"32\">\n\n <a href=\"https://discuss.pytorch.org/t/training-slow-down-as-epoch-progress/117814\" target=\"_blank\" rel=\"noopener\" title=\"05:42PM - 11 April 2021\">PyTorch Forums – 11 Apr 21</a>\n </header>\n\n <article class=\"onebox-body\">\n <img src=\"https://us1.discourse-cdn.com/hellohellohello/original/2X/1/15a7e2573aeb9e6ba8995f824d3b63171a433041.png\" class=\"thumbnail onebox-avatar\" width=\"500\" height=\"500\" data-dominant-color=\"EE4C2C\">\n\n<div class=\"title-wrapper\">\n <h3><a href=\"https://discuss.pytorch.org/t/training-slow-down-as-epoch-progress/117814\" target=\"_blank\" rel=\"noopener\">Training slow down as epoch progress</a></h3>\n</div>\n\n <p>I have define some variables inside forward pass. Input is 3-dimension and its different channel is assigned to the different variable. One channel is assigned as self.channel_1=self.input[:,0,:,:] Second and third channel is assigned after...</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 10, "post_type": 1, "posts_count": 11, "updated_at": "2025-03-10T12:46:14.292Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 7, "readers_count": 6, "score": 31.4, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/transformers/issues/28872", "internal": false, "reflection": false, "title": "Out of Memory at Seemingly Inconsistent Steps Using Trainer and Deepspeed with Llama2 7b · Issue #28872 · huggingface/transformers · GitHub", "clicks": 0 }, { "url": "https://discuss.pytorch.org/t/training-time-gradually-increases-per-epoch/126748", "internal": false, "reflection": false, "title": "Training time gradually increases per epoch - vision - PyTorch Forums", "clicks": 0 }, { "url": "https://discuss.pytorch.org/t/training-slow-down-as-epoch-progress/117814", "internal": false, "reflection": false, "title": "Training slow down as epoch progress - PyTorch Forums", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/10", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208205, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-11T00:47:12.206Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 11, "post_type": 3, "posts_count": 11, "updated_at": "2025-03-11T00:47:12.206Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 1.2, "yours": false, "topic_id": 144579, "topic_slug": "unable-to-load-dataset-using-load-dataset", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unable-to-load-dataset-using-load-dataset/144579/11", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I converted ImageNet and its corresponding depth images into Parquet format using <code>save_to_disk</code>, storing them as a <code>DatasetDict</code> object. I can successfully load the dataset using <code>load_from_disk</code> as follows:</p> <pre data-code-wrap="python"><code class="lang-python">from datasets import load_from_disk ds = load_from_disk("/defaultShare/pubdata/ImageNet_arrow_rgbdpa") ds </code></pre> <p>This returns:</p> <pre><code class="lang-auto">DatasetDict({ train: Dataset({ features: ['rgb', 'd', 'label'], num_rows: 1281167 }) val: Dataset({ features: ['rgb', 'd', 'label'], num_rows: 50000 }) }) </code></pre> <p>However, during training, the data loading process intermittently stalls for a few iterations—loading is generally fast, but it randomly pauses for several seconds. To resolve this, I attempted to load the dataset using <code>load_dataset</code>, but encountered the following error:</p> <pre data-code-wrap="python"><code class="lang-python">from datasets import load_dataset ds = load_dataset("/defaultShare/pubdata/ImageNet_arrow_rgbdpa") </code></pre> <pre><code class="lang-auto">Failed to read file '/defaultShare/pubdata/ImageNet_arrow_rgbdpa/train/data-00000-of-00096.arrow' with error &lt;class 'datasets.table.CastError'&gt;: Couldn't cast rgb: struct&lt;bytes: binary, path: string&gt; child 0, bytes: binary child 1, path: string d: struct&lt;bytes: binary, path: string&gt; child 0, bytes: binary child 1, path: string label: int64 -- schema metadata -- huggingface: '{"info": {"features": {"rgb": {"mode": "RGB", "_type": "Ima' + 24766 to {'indices': Value(dtype='uint64', id=None)} because column names don't match </code></pre> <p>I have not found a solution to this issue yet.</p>
<p>max_shard_size may be too large.</p><aside class="onebox githubissue" data-onebox-src="https://github.com/huggingface/datasets/issues/4721"> <header class="source"> <a href="https://github.com/huggingface/datasets/issues/4721" target="_blank" rel="noopener">github.com/huggingface/datasets</a> </header> <article class="onebox-body"> <div class="github-row"> <div class="github-icon-container" title="Issue" data-github-private-repo="false"> <svg width="60" height="60" class="github-icon" viewBox="0 0 14 16" aria-hidden="true"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg> </div> <div class="github-info-container"> <h4> <a href="https://github.com/huggingface/datasets/issues/4721" target="_blank" rel="noopener">PyArrow Dataset error when calling `load_dataset`</a> </h4> <div class="github-info"> <div class="date"> opened <span class="discourse-local-date" data-format="ll" data-date="2022-07-20" data-time="01:16:03" data-timezone="UTC">01:16AM - 20 Jul 22 UTC</span> </div> <div class="user"> <a href="https://github.com/piraka9011" target="_blank" rel="noopener"> <img alt="" src="https://us1.discourse-cdn.com/hellohellohello/original/3X/2/2/224562efe4d0434ec851b31093d870bb01e554c2.jpeg" class="onebox-avatar-inline" width="20" height="20" data-dominant-color="62524B"> piraka9011 </a> </div> </div> <div class="labels"> <span style="display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;"> bug </span> </div> </div> </div> <div class="github-row"> <p class="github-body-container">## Describe the bug I am fine tuning a wav2vec2 model following the script he<span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">re using my own dataset: https://github.com/huggingface/transformers/blob/main/examples/pytorch/speech-recognition/run_speech_recognition_ctc.py Loading my Audio dataset from the hub which was originally generated from disk results in the following PyArrow error: ```sh File "/home/ubuntu/w2v2/run_speech_recognition_ctc.py", line 227, in main raw_datasets = load_dataset( File "/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/datasets/load.py", line 1679, in load_dataset builder_instance.download_and_prepare( File "/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/datasets/builder.py", line 704, in download_and_prepare self._download_and_prepare( File "/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/datasets/builder.py", line 793, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) File "/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/datasets/builder.py", line 1268, in _prepare_split for key, table in logging.tqdm( File "/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/tqdm/std.py", line 1195, in __iter__ for obj in iterable: File "/home/ubuntu/.virtualenvs/meval/lib/python3.8/site-packages/datasets/packaged_modules/parquet/parquet.py", line 68, in _generate_tables for batch_idx, record_batch in enumerate( File "pyarrow/_parquet.pyx", line 1309, in iter_batches File "pyarrow/error.pxi", line 121, in pyarrow.lib.check_status pyarrow.lib.ArrowNotImplementedError: Nested data conversions not implemented for chunked array outputs ``` ## Steps to reproduce the bug I created a dataset from a JSON lines manifest of `audio_filepath`, `text`, and `duration`. When creating the dataset, I do something like this: ```python import json from datasets import Dataset, Audio # manifest_lines is a list of dicts w/ "audio_filepath", "duration", and "text for line in manifest_lines: line = line.strip() if line: line_dict = json.loads(line) manifest_dict["audio"].append(f"{root_path}/{line_dict['audio_filepath']}") manifest_dict["duration"].append(line_dict["duration"]) manifest_dict["transcription"].append(line_dict["text"]) # Create a HF dataset dataset = Dataset.from_dict(manifest_dict).cast_column( "audio", Audio(sampling_rate=16_000), ) # From the docs for saving to disk # https://huggingface.co/docs/datasets/v2.3.2/en/package_reference/main_classes#datasets.Dataset.save_to_disk def read_audio_file(example): with open(example["audio"]["path"], "rb") as f: return {"audio": {"bytes": f.read()}} dataset = dataset.map(read_audio_file, num_proc=70) dataset.save_to_disk(f"/audio-data/hf/{artifact_name}") dataset.push_to_hub(f"{org-name}/{artifact_name}", max_shard_size="5GB", private=True) ``` Then when I call `load_dataset()` in my training script, with the same dataset I generated above, and download from the huggingface hub I get the above stack trace. I am able to load the dataset fine if I use `load_from_disk()`. ## Expected results `load_dataset()` should behave just like `load_from_disk()` and not cause any errors. ## Actual results See above ## Environment info I am using the `huggingface/transformers-pytorch-gpu:latest` image - `datasets` version: 2.3.0 - Platform: Docker/Ubuntu 20.04 - Python version: 3.8 - PyArrow version: 8.0.0</span></p> </div> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
UnexpectedError LFS Storage Used on the dataset has suddenly gone to -55034619833 Bytes
https://discuss.huggingface.co/t/unexpectederror-lfs-storage-used-on-the-dataset-has-suddenly-gone-to-55034619833-bytes/144947
144,947
10
2025-03-10T02:18:08.010000Z
[ { "id": 207975, "name": "Andrew Smith", "username": "alastandy", "avatar_template": "/user_avatar/discuss.huggingface.co/alastandy/{size}/42896_2.png", "created_at": "2025-03-10T02:18:08.064Z", "cooked": "<p>I noticed that the LFS Storage Used on the dataset has suddenly gone from some number of GB to -55034619833 Bytes</p>\n<p>The dataset is <a href=\"https://huggingface.co/datasets/alastandy/Diffuse_Map_Surfaces\" class=\"inline-onebox\">alastandy/Diffuse_Map_Surfaces · Datasets at Hugging Face</a></p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-10T02:18:08.064Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 15, "reads": 9, "readers_count": 8, "score": 91.8, "yours": false, "topic_id": 144947, "topic_slug": "unexpectederror-lfs-storage-used-on-the-dataset-has-suddenly-gone-to-55034619833-bytes", "display_username": "Andrew Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/datasets/alastandy/Diffuse_Map_Surfaces", "internal": false, "reflection": false, "title": "alastandy/Diffuse_Map_Surfaces · Datasets at Hugging Face", "clicks": 10 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86551, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unexpectederror-lfs-storage-used-on-the-dataset-has-suddenly-gone-to-55034619833-bytes/144947/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208006, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-10T06:57:57.394Z", "cooked": "<p>No matter how you look at it, these numbers are overflowing or something…<br>\nIt looks normal on the GUI, so maybe there was a mistake when acquiring the LFS information.<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/0/8/086db60dc898c18afe396a86f92516adce17369a.png\" data-download-href=\"/uploads/short-url/1cySeMBHyf4M9IzOyaZtc6HuH1M.png?dl=1\" title=\"datasetlfs\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/8/086db60dc898c18afe396a86f92516adce17369a_2_690x235.png\" alt=\"datasetlfs\" data-base62-sha1=\"1cySeMBHyf4M9IzOyaZtc6HuH1M\" width=\"690\" height=\"235\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/8/086db60dc898c18afe396a86f92516adce17369a_2_690x235.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/8/086db60dc898c18afe396a86f92516adce17369a_2_1035x352.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/0/8/086db60dc898c18afe396a86f92516adce17369a.png 2x\" data-dominant-color=\"101520\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">datasetlfs</span><span class=\"informations\">1301×444 41.8 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>If it continues, it’s probably a bug, so it might be quicker to raise an issue.</p>\n<h3><a name=\"p-208006-for-huggingface_hub-library-and-related-issue-reports-1\" class=\"anchor\" href=\"#p-208006-for-huggingface_hub-library-and-related-issue-reports-1\"></a>For <strong>huggingface_hub</strong> library and related issue reports</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/huggingface/huggingface_hub/issues\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/huggingface/huggingface_hub/issues\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/350;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/9/3/93152d4bd1ecf7bb826177a7c46c888beb440851_2_690x350.png\" class=\"thumbnail\" data-dominant-color=\"F8F5EA\" width=\"690\" height=\"350\"></div>\n\n<h3><a href=\"https://github.com/huggingface/huggingface_hub/issues\" target=\"_blank\" rel=\"noopener\">huggingface/huggingface_hub</a></h3>\n\n <p>The official Python client for the Huggingface Hub. - huggingface/huggingface_hub</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<h3><a name=\"p-208006-for-reporting-issues-related-to-hubs-and-other-general-problems-2\" class=\"anchor\" href=\"#p-208006-for-reporting-issues-related-to-hubs-and-other-general-problems-2\"></a>For reporting issues related to hubs and other general problems</h3>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://github.com/huggingface/hub-docs/issues\">\n <header class=\"source\">\n <img src=\"https://github.githubassets.com/favicons/favicon.svg\" class=\"site-icon\" width=\"32\" height=\"32\">\n\n <a href=\"https://github.com/huggingface/hub-docs/issues\" target=\"_blank\" rel=\"noopener\">GitHub</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/344;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/7/378b019132931b63212441971bdc28fbc7966fd0_2_690x345.png\" class=\"thumbnail\" data-dominant-color=\"F4F2EB\" width=\"690\" height=\"345\"></div>\n\n<h3><a href=\"https://github.com/huggingface/hub-docs/issues\" target=\"_blank\" rel=\"noopener\">huggingface/hub-docs</a></h3>\n\n <p>Docs of the Hugging Face Hub. Contribute to huggingface/hub-docs development by creating an account on GitHub.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-10T06:57:57.394Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 4, "reads": 9, "readers_count": 8, "score": 21.8, "yours": false, "topic_id": 144947, "topic_slug": "unexpectederror-lfs-storage-used-on-the-dataset-has-suddenly-gone-to-55034619833-bytes", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/huggingface_hub/issues", "internal": false, "reflection": false, "title": "GitHub · Where software is built", "clicks": 0 }, { "url": "https://github.com/huggingface/hub-docs/issues", "internal": false, "reflection": false, "title": "GitHub · Where software is built", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unexpectederror-lfs-storage-used-on-the-dataset-has-suddenly-gone-to-55034619833-bytes/144947/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 208165, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-10T18:58:11.392Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-10T18:58:11.392Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 144947, "topic_slug": "unexpectederror-lfs-storage-used-on-the-dataset-has-suddenly-gone-to-55034619833-bytes", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/unexpectederror-lfs-storage-used-on-the-dataset-has-suddenly-gone-to-55034619833-bytes/144947/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I noticed that the LFS Storage Used on the dataset has suddenly gone from some number of GB to -55034619833 Bytes</p> <p>The dataset is <a href="https://huggingface.co/datasets/alastandy/Diffuse_Map_Surfaces" class="inline-onebox">alastandy/Diffuse_Map_Surfaces · Datasets at Hugging Face</a></p>
<p>No matter how you look at it, these numbers are overflowing or something…<br> It looks normal on the GUI, so maybe there was a mistake when acquiring the LFS information.<br> <div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/0/8/086db60dc898c18afe396a86f92516adce17369a.png" data-download-href="/uploads/short-url/1cySeMBHyf4M9IzOyaZtc6HuH1M.png?dl=1" title="datasetlfs"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/8/086db60dc898c18afe396a86f92516adce17369a_2_690x235.png" alt="datasetlfs" data-base62-sha1="1cySeMBHyf4M9IzOyaZtc6HuH1M" width="690" height="235" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/8/086db60dc898c18afe396a86f92516adce17369a_2_690x235.png, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/8/086db60dc898c18afe396a86f92516adce17369a_2_1035x352.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/0/8/086db60dc898c18afe396a86f92516adce17369a.png 2x" data-dominant-color="101520"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">datasetlfs</span><span class="informations">1301×444 41.8 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p> <p>If it continues, it’s probably a bug, so it might be quicker to raise an issue.</p> <h3><a name="p-208006-for-huggingface_hub-library-and-related-issue-reports-1" class="anchor" href="#p-208006-for-huggingface_hub-library-and-related-issue-reports-1"></a>For <strong>huggingface_hub</strong> library and related issue reports</h3> <aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/huggingface/huggingface_hub/issues"> <header class="source"> <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32"> <a href="https://github.com/huggingface/huggingface_hub/issues" target="_blank" rel="noopener">GitHub</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/350;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/9/3/93152d4bd1ecf7bb826177a7c46c888beb440851_2_690x350.png" class="thumbnail" data-dominant-color="F8F5EA" width="690" height="350"></div> <h3><a href="https://github.com/huggingface/huggingface_hub/issues" target="_blank" rel="noopener">huggingface/huggingface_hub</a></h3> <p>The official Python client for the Huggingface Hub. - huggingface/huggingface_hub</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <h3><a name="p-208006-for-reporting-issues-related-to-hubs-and-other-general-problems-2" class="anchor" href="#p-208006-for-reporting-issues-related-to-hubs-and-other-general-problems-2"></a>For reporting issues related to hubs and other general problems</h3> <aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/huggingface/hub-docs/issues"> <header class="source"> <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32"> <a href="https://github.com/huggingface/hub-docs/issues" target="_blank" rel="noopener">GitHub</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/344;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/7/378b019132931b63212441971bdc28fbc7966fd0_2_690x345.png" class="thumbnail" data-dominant-color="F4F2EB" width="690" height="345"></div> <h3><a href="https://github.com/huggingface/hub-docs/issues" target="_blank" rel="noopener">huggingface/hub-docs</a></h3> <p>Docs of the Hugging Face Hub. Contribute to huggingface/hub-docs development by creating an account on GitHub.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Why is my DistilBERT model performing poorly on some classes despite hyperparameter tuning?
https://discuss.huggingface.co/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441
144,441
5
2025-03-06T13:55:06.970000Z
[ { "id": 207264, "name": "Olive Cheong Yu Xuan", "username": "Olive0982", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png", "created_at": "2025-03-06T13:55:07.030Z", "cooked": "<p>I am working on an emotion classification task using DistilBERT, with data collected from multiple sources. My dataset is balanced across all emotion categories, so class imbalance should not be a major issue.</p>\n<p>However, after trying multiple hyperparameter settings, the model consistently performs poorly overall (low accuracy: 48%) and only predicts certain categories well while failing on others.<br>\nWhat I have tried so far is:</p>\n<ol>\n<li>Using learning rates from 1e-06 to 5e-05</li>\n<li>Batch size: 16,32,64</li>\n<li>weight decay: 0.1, 0.01,0.03</li>\n<li>optimizer: Adem</li>\n<li>scheduler type: cosine, linear</li>\n<li>epoch: 2,4,5,8,10.<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/3/6/36c03548c4cf70f98f4a4fb3a86847e1cc618920.png\" data-download-href=\"/uploads/short-url/7OlAq9pttQjNlAVBRMj8hs02Zeo.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/3/6/36c03548c4cf70f98f4a4fb3a86847e1cc618920.png\" alt=\"image\" data-base62-sha1=\"7OlAq9pttQjNlAVBRMj8hs02Zeo\" width=\"667\" height=\"378\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">667×378 25 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div><br>\nCurrently, the best performance is 48%, and the classification report is as follows:<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/6/9/695c7a6ca83527706af241d0793f47fc10cc10b8.png\" data-download-href=\"/uploads/short-url/f24gCsLgteQFsx6O74ySkbhlsGk.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/6/9/695c7a6ca83527706af241d0793f47fc10cc10b8.png\" alt=\"image\" data-base62-sha1=\"f24gCsLgteQFsx6O74ySkbhlsGk\" width=\"475\" height=\"452\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">475×452 28.5 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></li>\n</ol>", "post_number": 1, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-06T13:55:07.030Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 154, "reads": 18, "readers_count": 17, "score": 768.6, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Olive Cheong Yu Xuan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 47705, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207270, "name": "Didi", "username": "ddrbcn", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png", "created_at": "2025-03-06T14:13:40.995Z", "cooked": "<p>Hello,<br>\nWhat is the size of your training set and your test set? How many samples do you have?<br>\nIt seems your learning rate is low and perhaps you will need more epochs depending on the size of your training and test set.<br>\nRegards</p>", "post_number": 2, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-06T14:17:39.853Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 15, "readers_count": 14, "score": 23, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Didi", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86149, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207276, "name": "Olive Cheong Yu Xuan", "username": "Olive0982", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png", "created_at": "2025-03-06T14:27:01.711Z", "cooked": "<p>Hi, thanks for your response.<br>\nI have about 9880 rows of training samples and 2470 rows of testing samples.</p>", "post_number": 3, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-06T14:27:01.711Z", "reply_count": 1, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 13, "readers_count": 12, "score": 22.6, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Olive Cheong Yu Xuan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 47705, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 86149, "username": "ddrbcn", "name": "Didi", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png" }, "action_code": null, "via_email": null }, { "id": 207316, "name": "Didi", "username": "ddrbcn", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png", "created_at": "2025-03-06T15:13:51.976Z", "cooked": "<p>Hi,</p>\n<p>You commented your dataset is balanced, but the model seems biased toward <code>disgust</code> and <code>shame</code>, while <code>sadness</code> and <code>joy</code> have very low recall. This could be due to ambiguous text or varied expressions making them harder to learn.</p>\n<p>Have you checked the loss curve for underfitting or overfitting? Since DistilBERT is a smaller model, it may need more than 10 epochs to generalize well. Analyzing misclassified samples might reveal patterns causing these errors. Also, you could try increasing the learning rate slightly (e.g., 5e-4 to 5e-3) to speed up learning and accelerate convergence, even if it sacrifices some fine-tuning precision.</p>\n<p>Hope this helps!</p>", "post_number": 4, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-06T15:13:51.976Z", "reply_count": 1, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 2, "reads": 13, "readers_count": 12, "score": 32.6, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Didi", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86149, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 47705, "username": "Olive0982", "name": "Olive Cheong Yu Xuan", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png" }, "action_code": null, "via_email": null }, { "id": 207340, "name": "Olive Cheong Yu Xuan", "username": "Olive0982", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png", "created_at": "2025-03-06T16:25:51.039Z", "cooked": "<p>yaa, I just checked the curve and found that the model is underfitting. I have try for 5e-3 and epoch for 12, but erm it seems like my training epoch is less and learning rate is too high, the accuracy drop to 16%.<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/3/9/398ae1bb9dc25d95a13dc0e44ad0201bbbebb2af.png\" data-download-href=\"/uploads/short-url/8d2LECSyBi9UaPYeXuOKhftKxuD.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/9/398ae1bb9dc25d95a13dc0e44ad0201bbbebb2af_2_690x483.png\" alt=\"image\" data-base62-sha1=\"8d2LECSyBi9UaPYeXuOKhftKxuD\" width=\"690\" height=\"483\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/9/398ae1bb9dc25d95a13dc0e44ad0201bbbebb2af_2_690x483.png, https://us1.discourse-cdn.com/hellohellohello/original/3X/3/9/398ae1bb9dc25d95a13dc0e44ad0201bbbebb2af.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/original/3X/3/9/398ae1bb9dc25d95a13dc0e44ad0201bbbebb2af.png 2x\" data-dominant-color=\"F9F9F8\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">730×512 32.7 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div><br>\nI might try for 5e-4 and epoch 12 first to see if it is okay.<br>\nAnyways, thanks for your help in advance.</p>", "post_number": 5, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-06T16:25:51.039Z", "reply_count": 1, "reply_to_post_number": 4, "quote_count": 0, "incoming_link_count": 2, "reads": 12, "readers_count": 11, "score": 32.4, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Olive Cheong Yu Xuan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 47705, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 86149, "username": "ddrbcn", "name": "Didi", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png" }, "action_code": null, "via_email": null }, { "id": 207356, "name": "Didi", "username": "ddrbcn", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png", "created_at": "2025-03-06T19:45:31.491Z", "cooked": "<p>Hmmm, it looks like the loss drops very fast in the first epoch and then stays flat. I guess it could indicate an issue with the data.<br>\nDo you fully trust the labels? It might be helpful to manually inspect some samples from problematic classes (e.g., anger, fear, joy) to see if there are inconsistencies or ambiguous cases.</p>\n<p>Could you also share the confusion matrix? It might give more insight into which classes the model is confusing the most.</p>", "post_number": 6, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-06T19:45:31.491Z", "reply_count": 2, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 0, "reads": 12, "readers_count": 11, "score": 27.4, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Didi", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86149, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 47705, "username": "Olive0982", "name": "Olive Cheong Yu Xuan", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png" }, "action_code": null, "via_email": null }, { "id": 207413, "name": "Olive Cheong Yu Xuan", "username": "Olive0982", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png", "created_at": "2025-03-07T01:34:14.958Z", "cooked": "<p>This is the confusion matrix when I try for 5e-3 and epoch 12<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/c/3/c3ebbbff42f3dbc47db7cee07d18acdfe10c0314.png\" data-download-href=\"/uploads/short-url/rXcaflszZYXxglDvx72R6GbzupS.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/c/3/c3ebbbff42f3dbc47db7cee07d18acdfe10c0314.png\" alt=\"image\" data-base62-sha1=\"rXcaflszZYXxglDvx72R6GbzupS\" width=\"553\" height=\"460\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">553×460 6.21 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div><br>\nWhile I try for other set, I found that there is a bias for the label anger and fear (which accuracy is 49%).</p>", "post_number": 7, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-07T01:34:14.958Z", "reply_count": 0, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 1, "reads": 11, "readers_count": 10, "score": 22.2, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Olive Cheong Yu Xuan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 47705, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/7", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 86149, "username": "ddrbcn", "name": "Didi", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png" }, "action_code": null, "via_email": null }, { "id": 207418, "name": "Olive Cheong Yu Xuan", "username": "Olive0982", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png", "created_at": "2025-03-07T01:36:18.997Z", "cooked": "<p>While the dataset for label anger and fear is come from CARER dataset, and I manually inspect for it also doesn’t seems any problem <img src=\"https://emoji.discourse-cdn.com/apple/thinking.png?v=13\" title=\":thinking:\" class=\"emoji\" alt=\":thinking:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 8, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-07T01:36:18.997Z", "reply_count": 1, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 21.6, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Olive Cheong Yu Xuan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 47705, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/8", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 86149, "username": "ddrbcn", "name": "Didi", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png" }, "action_code": null, "via_email": null }, { "id": 207427, "name": "Olive Cheong Yu Xuan", "username": "Olive0982", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png", "created_at": "2025-03-07T01:44:54.850Z", "cooked": "<p>Wait, I think I might found some reason? cause I have sorted my dataset based on the category before, so I think it will be the reason of this bias condition?</p>", "post_number": 9, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-07T01:44:54.850Z", "reply_count": 2, "reply_to_post_number": 8, "quote_count": 0, "incoming_link_count": 3, "reads": 8, "readers_count": 7, "score": 41.6, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Olive Cheong Yu Xuan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 47705, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/9", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 47705, "username": "Olive0982", "name": "Olive Cheong Yu Xuan", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png" }, "action_code": null, "via_email": null }, { "id": 207605, "name": "Didi", "username": "ddrbcn", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png", "created_at": "2025-03-07T17:44:00.183Z", "cooked": "<p>Yes, sorting the dataset by category before splitting into train and test could definitely cause this bias. If the split wasn’t random, your model might be training only on certain classes and testing on others, which would explain the poor performance on some emotions.<br>\nAlso, double-check that sorting didn’t accidentally change the alignment of texts and labels, as that could introduce incorrect labels. Try reshuffling the dataset and making sure the train-test split is random to see if performance improves.</p>", "post_number": 10, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-07T17:44:00.183Z", "reply_count": 0, "reply_to_post_number": 9, "quote_count": 0, "incoming_link_count": 1, "reads": 9, "readers_count": 8, "score": 36.8, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Didi", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86149, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/10", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 47705, "username": "Olive0982", "name": "Olive Cheong Yu Xuan", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png" }, "action_code": null, "via_email": null }, { "id": 207674, "name": "Olive Cheong Yu Xuan", "username": "Olive0982", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png", "created_at": "2025-03-08T05:49:44.848Z", "cooked": "<p>Thank you <a class=\"mention\" href=\"/u/ddrbcn\">@ddrbcn</a> I have try for reshuffling and also random train-test split, but the result also still maintain 49%, while the confusion matrix is slightly better<br>\n<div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/e/0/e0f03c7e3dc21c3a504466cf6c21bd7a3774b08a.png\" data-download-href=\"/uploads/short-url/w5TEKAMfECFETJBfjbapO5mPxR8.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/e/0/e0f03c7e3dc21c3a504466cf6c21bd7a3774b08a.png\" alt=\"image\" data-base62-sha1=\"w5TEKAMfECFETJBfjbapO5mPxR8\" width=\"319\" height=\"169\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">319×169 2.29 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div><br>\nI think is my dataset quality problem, the disgust and shame might be too easier to learn compared to other 4 category? Anyways, I will keep training while also looking for another dataset that contain for the same category as mine.</p>", "post_number": 11, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-08T05:49:44.848Z", "reply_count": 1, "reply_to_post_number": 9, "quote_count": 0, "incoming_link_count": 5, "reads": 8, "readers_count": 7, "score": 46.6, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Olive Cheong Yu Xuan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 47705, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/11", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 47705, "username": "Olive0982", "name": "Olive Cheong Yu Xuan", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png" }, "action_code": null, "via_email": null }, { "id": 207732, "name": "Didi", "username": "ddrbcn", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png", "created_at": "2025-03-08T14:25:19.804Z", "cooked": "<p>You’re welcome! I’m glad to hear that reshuffling and a random train-test split have improved the confusion matrix, even if accuracy is still low.<br>\nYou could try experimenting again with different learning rates and other hyperparameters using this new split to see if you get better results. Your idea of testing with another dataset sounds also like a good approach</p>\n<p>Regarding to your second point, disgust and shame might be easier for the model to learn, but I find it interesting that it struggles with joy. In theory, the type of text in that category should be quite distinct to all teh remaining classes. I suggest focusing on joy and checking if there might be some labeling inconsistencies or ambiguous samples in that class.</p>", "post_number": 12, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-08T14:25:19.804Z", "reply_count": 1, "reply_to_post_number": 11, "quote_count": 0, "incoming_link_count": 2, "reads": 6, "readers_count": 5, "score": 46.2, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Didi", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86149, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/12", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 47705, "username": "Olive0982", "name": "Olive Cheong Yu Xuan", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png" }, "action_code": null, "via_email": null }, { "id": 207871, "name": "Olive Cheong Yu Xuan", "username": "Olive0982", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png", "created_at": "2025-03-09T11:50:45.061Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/ddrbcn\">@ddrbcn</a>, I have manually check for the dataset again, and I found that there are a mistake when i am trying to extract the row from the original dataset, which have make the label to be mixed up and inconsistent with the original data. And now after I carefully change back the label, the accuracy is up. So sorry for making this kind of error and really appreciate for your effort and time to help me.</p>", "post_number": 13, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-09T11:50:45.061Z", "reply_count": 1, "reply_to_post_number": 12, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 21.2, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Olive Cheong Yu Xuan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 47705, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/13", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 86149, "username": "ddrbcn", "name": "Didi", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png" }, "action_code": null, "via_email": null }, { "id": 207875, "name": "Didi", "username": "ddrbcn", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png", "created_at": "2025-03-09T12:53:23.978Z", "cooked": "<p>Please do not mention it! The reason I insisted on checking the labels and suggested verifying if sorting or something else had misaligned them was because I’ve made similar mistakes in the past. Those experiences taught me valuable lessons, and learning from errors is just part of the journey.</p>\n<p>What really matters is being open to investigating issues and asking for help when needed. I’ve also received a lot of support from different tech communities over time, and that’s the beauty and the power of collective knowledge—we all grow together.</p>\n<p>It’s been a pleasure helping you, and I’m really glad you found the issue! If everything is working now, you might want to mark the topic as solved. Best of luck with your project!</p>", "post_number": 14, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-09T12:53:23.978Z", "reply_count": 1, "reply_to_post_number": 13, "quote_count": 0, "incoming_link_count": 2, "reads": 6, "readers_count": 5, "score": 31.2, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Didi", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 86149, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/14", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 47705, "username": "Olive0982", "name": "Olive Cheong Yu Xuan", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png" }, "action_code": null, "via_email": null }, { "id": 207877, "name": "Olive Cheong Yu Xuan", "username": "Olive0982", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png", "created_at": "2025-03-09T13:03:22.962Z", "cooked": "<p>Really appreciate your support! Wishing you smooth progress and great success in all your projects too!</p>", "post_number": 15, "post_type": 1, "posts_count": 16, "updated_at": "2025-03-09T13:03:22.962Z", "reply_count": 0, "reply_to_post_number": 14, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 31, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "Olive Cheong Yu Xuan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 47705, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/15", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 86149, "username": "ddrbcn", "name": "Didi", "avatar_template": "/user_avatar/discuss.huggingface.co/ddrbcn/{size}/42648_2.png" }, "action_code": null, "via_email": null }, { "id": 207963, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-10T01:03:56.355Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 16, "post_type": 3, "posts_count": 16, "updated_at": "2025-03-10T01:03:56.355Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 2, "readers_count": 1, "score": 5.4, "yours": false, "topic_id": 144441, "topic_slug": "why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-is-my-distilbert-model-performing-poorly-on-some-classes-despite-hyperparameter-tuning/144441/16", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I am working on an emotion classification task using DistilBERT, with data collected from multiple sources. My dataset is balanced across all emotion categories, so class imbalance should not be a major issue.</p> <p>However, after trying multiple hyperparameter settings, the model consistently performs poorly overall (low accuracy: 48%) and only predicts certain categories well while failing on others.<br> What I have tried so far is:</p> <ol> <li>Using learning rates from 1e-06 to 5e-05</li> <li>Batch size: 16,32,64</li> <li>weight decay: 0.1, 0.01,0.03</li> <li>optimizer: Adem</li> <li>scheduler type: cosine, linear</li> <li>epoch: 2,4,5,8,10.<br> <div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/3/6/36c03548c4cf70f98f4a4fb3a86847e1cc618920.png" data-download-href="/uploads/short-url/7OlAq9pttQjNlAVBRMj8hs02Zeo.png?dl=1" title="image" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/3/6/36c03548c4cf70f98f4a4fb3a86847e1cc618920.png" alt="image" data-base62-sha1="7OlAq9pttQjNlAVBRMj8hs02Zeo" width="667" height="378"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">667×378 25 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br> Currently, the best performance is 48%, and the classification report is as follows:<br> <div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/6/9/695c7a6ca83527706af241d0793f47fc10cc10b8.png" data-download-href="/uploads/short-url/f24gCsLgteQFsx6O74ySkbhlsGk.png?dl=1" title="image" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/6/9/695c7a6ca83527706af241d0793f47fc10cc10b8.png" alt="image" data-base62-sha1="f24gCsLgteQFsx6O74ySkbhlsGk" width="475" height="452"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">475×452 28.5 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></li> </ol>
<p>You’re welcome! I’m glad to hear that reshuffling and a random train-test split have improved the confusion matrix, even if accuracy is still low.<br> You could try experimenting again with different learning rates and other hyperparameters using this new split to see if you get better results. Your idea of testing with another dataset sounds also like a good approach</p> <p>Regarding to your second point, disgust and shame might be easier for the model to learn, but I find it interesting that it struggles with joy. In theory, the type of text in that category should be quite distinct to all teh remaining classes. I suggest focusing on joy and checking if there might be some labeling inconsistencies or ambiguous samples in that class.</p>
Best way to quickly switch ControlNet without affecting other components?
https://discuss.huggingface.co/t/best-way-to-quickly-switch-controlnet-without-affecting-other-components/144865
144,865
5
2025-03-09T09:52:19.678000Z
[ { "id": 207860, "name": "Jolin Hao", "username": "Myn1ac5022", "avatar_template": "/user_avatar/discuss.huggingface.co/myn1ac5022/{size}/41382_2.png", "created_at": "2025-03-09T09:52:19.742Z", "cooked": "<p>Hi everyone!</p>\n<p>I’m trying to quickly switch ControlNet models (e.g., from canny to depth) while keeping the rest of the pipeline (like the base model’s parameters and ip-adapter) unchanged. Currently I’m creating multiple ControlNet instances, but it’s causing high memory usage.</p>\n<p>Is there a more efficient way to do this? Maybe something to reduce VRAM usage or avoid reloading everything?</p>\n<p>Thanks in advance!</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-09T09:52:19.742Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 12, "reads": 5, "readers_count": 4, "score": 76, "yours": false, "topic_id": 144865, "topic_slug": "best-way-to-quickly-switch-controlnet-without-affecting-other-components", "display_username": "Jolin Hao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 83922, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/best-way-to-quickly-switch-controlnet-without-affecting-other-components/144865/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207863, "name": "Jolin Hao", "username": "Myn1ac5022", "avatar_template": "/user_avatar/discuss.huggingface.co/myn1ac5022/{size}/41382_2.png", "created_at": "2025-03-09T10:42:59.540Z", "cooked": "<p>I found a simple solution: passing <code>kwargs</code> to <code>.from_pipe</code> works perfectly for switching ControlNet without affecting other components. Thanks to everyone who took the time to read this</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-09T10:42:59.540Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 4, "readers_count": 3, "score": 15.8, "yours": false, "topic_id": 144865, "topic_slug": "best-way-to-quickly-switch-controlnet-without-affecting-other-components", "display_username": "Jolin Hao", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 83922, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/best-way-to-quickly-switch-controlnet-without-affecting-other-components/144865/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207958, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-09T22:43:01.184Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-09T22:43:01.184Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 144865, "topic_slug": "best-way-to-quickly-switch-controlnet-without-affecting-other-components", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/best-way-to-quickly-switch-controlnet-without-affecting-other-components/144865/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi everyone!</p> <p>I’m trying to quickly switch ControlNet models (e.g., from canny to depth) while keeping the rest of the pipeline (like the base model’s parameters and ip-adapter) unchanged. Currently I’m creating multiple ControlNet instances, but it’s causing high memory usage.</p> <p>Is there a more efficient way to do this? Maybe something to reduce VRAM usage or avoid reloading everything?</p> <p>Thanks in advance!</p>
<p>I found a simple solution: passing <code>kwargs</code> to <code>.from_pipe</code> works perfectly for switching ControlNet without affecting other components. Thanks to everyone who took the time to read this</p>
How to Train an Image Captioning Model for specific language
https://discuss.huggingface.co/t/how-to-train-an-image-captioning-model-for-specific-language/144578
144,578
5
2025-03-07T08:14:57.721000Z
[ { "id": 207472, "name": "Muhammad Fhadli", "username": "muhammadfhadli", "avatar_template": "/user_avatar/discuss.huggingface.co/muhammadfhadli/{size}/39543_2.png", "created_at": "2025-03-07T08:14:57.781Z", "cooked": "<p><strong>Hi everyone,</strong></p>\n<p>I want to train an image captioning model for my language. I already have images and captions in Indonesian, but I can only find pretrained models for other languages, especially English.</p>\n<p>Is there a code template I can use for this task? I assume image captioning follows a common structure, so having a starting point would be really helpful.</p>\n<p>Thank you!</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-07T08:14:57.781Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 18, "reads": 4, "readers_count": 3, "score": 105.8, "yours": false, "topic_id": 144578, "topic_slug": "how-to-train-an-image-captioning-model-for-specific-language", "display_username": "Muhammad Fhadli", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 3356, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-train-an-image-captioning-model-for-specific-language/144578/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207616, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-07T18:10:34.531Z", "cooked": "<p>If you have all that data, most of the work is done.</p>\n<p>All that’s left is to do the work…<br>\nI think the Course will be helpful for how to do it.<br>\nThere seem to be various ways to explore things like setting hyperparameters, from manual to automatic.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/transformers/main/en/tasks/image_captioning\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/transformers/main/en/tasks/image_captioning\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"F5F3ED\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/transformers/main/en/tasks/image_captioning\" target=\"_blank\" rel=\"noopener\">Image captioning</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/learn/computer-vision-course/en/unit0/welcome/welcome\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/learn/computer-vision-course/en/unit0/welcome/welcome\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n \n\n<h3><a href=\"https://huggingface.co/learn/computer-vision-course/en/unit0/welcome/welcome\" target=\"_blank\" rel=\"noopener\">Welcome to the Community Computer Vision Course - Hugging Face Community...</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<p>and by Hugging Chat:</p>\n<hr>\n<p>To train an image captioning model for Indonesian using the Hugging Face ecosystem, follow these organized steps:</p>\n<ol>\n<li>\n<p><strong>Data Preparation</strong>:</p>\n<ul>\n<li>Organize your dataset with images and corresponding Indonesian captions into a format compatible with the Hugging Face <code>datasets</code> library.</li>\n<li>Convert images into tensor representations and tokenize Indonesian captions using an appropriate tokenizer, such as one compatible with the chosen model.</li>\n</ul>\n</li>\n<li>\n<p><strong>Model Selection</strong>:</p>\n<ul>\n<li>Select a pre-trained image captioning model, such as BLIP, available on the Hugging Face Model Hub. This model is pre-trained on a large dataset with English captions but can be adapted.</li>\n</ul>\n</li>\n<li>\n<p><strong>Model Architecture Adjustment</strong>:</p>\n<ul>\n<li>Utilize the existing vision encoder of the BLIP model, as it handles image processing effectively.</li>\n<li>Modify or fine-tune the text decoder to suit the Indonesian language. Consider integrating an Indonesian language model or tokenizer for better text generation accuracy.</li>\n</ul>\n</li>\n<li>\n<p><strong>Tokenization Considerations</strong>:</p>\n<ul>\n<li>Ensure the tokenizer is compatible with the model. If using a different tokenizer, check for compatibility issues and adjust the text decoder accordingly.</li>\n</ul>\n</li>\n<li>\n<p><strong>Training and Fine-Tuning</strong>:</p>\n<ul>\n<li>Fine-tune the model using your Indonesian dataset. This involves retraining the text decoder while keeping the vision encoder intact, focusing on adapting the model to generate accurate Indonesian captions.</li>\n</ul>\n</li>\n<li>\n<p><strong>Computational Resources</strong>:</p>\n<ul>\n<li>Use cloud services or Hugging Face platforms for training, as they offer the necessary computational power for processing large vision-language models.</li>\n</ul>\n</li>\n<li>\n<p><strong>Research and Existing Models</strong>:</p>\n<ul>\n<li>Investigate existing research or pre-trained models adapted for Indonesian to leverage prior work and accelerate your project.</li>\n</ul>\n</li>\n<li>\n<p><strong>Evaluation and Iteration</strong>:</p>\n<ul>\n<li>After training, evaluate the model’s performance. Adjust hyperparameters or the model architecture as needed based on evaluation results.</li>\n</ul>\n</li>\n</ol>\n<p>By following these steps, you can effectively adapt an English pre-trained image captioning model to generate accurate Indonesian captions, leveraging the strengths of the Hugging Face ecosystem.</p>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-07T18:10:34.531Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 5.6, "yours": false, "topic_id": 144578, "topic_slug": "how-to-train-an-image-captioning-model-for-specific-language", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/transformers/main/en/tasks/image_captioning", "internal": false, "reflection": false, "title": "Image captioning", "clicks": 4 }, { "url": "https://huggingface.co/learn/computer-vision-course/en/unit0/welcome/welcome", "internal": false, "reflection": false, "title": "Welcome to the Community Computer Vision Course - Hugging Face Community Computer Vision Course", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-train-an-image-captioning-model-for-specific-language/144578/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207805, "name": "Muhammad Fhadli", "username": "muhammadfhadli", "avatar_template": "/user_avatar/discuss.huggingface.co/muhammadfhadli/{size}/39543_2.png", "created_at": "2025-03-08T23:44:20.596Z", "cooked": "<p>thank you, this is very helpful.<br>\nBut i’m still wondering on step 3. how can i modify or fine-tune the text decoder to suit the Indonesian language. thankyou</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-09T00:07:22.194Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 2, "readers_count": 1, "score": 15.4, "yours": false, "topic_id": 144578, "topic_slug": "how-to-train-an-image-captioning-model-for-specific-language", "display_username": "Muhammad Fhadli", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 3356, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-train-an-image-captioning-model-for-specific-language/144578/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 207869, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-09T11:44:44.316Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-03-09T11:44:44.316Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 1, "readers_count": 0, "score": 5.2, "yours": false, "topic_id": 144578, "topic_slug": "how-to-train-an-image-captioning-model-for-specific-language", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-train-an-image-captioning-model-for-specific-language/144578/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p><strong>Hi everyone,</strong></p> <p>I want to train an image captioning model for my language. I already have images and captions in Indonesian, but I can only find pretrained models for other languages, especially English.</p> <p>Is there a code template I can use for this task? I assume image captioning follows a common structure, so having a starting point would be really helpful.</p> <p>Thank you!</p>
<p>If you have all that data, most of the work is done.</p> <p>All that’s left is to do the work…<br> I think the Course will be helpful for how to do it.<br> There seem to be various ways to explore things like setting hyperparameters, from manual to automatic.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/docs/transformers/main/en/tasks/image_captioning"> <header class="source"> <a href="https://huggingface.co/docs/transformers/main/en/tasks/image_captioning" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/7/0/70d0e152f7d3fc4f2893b87211cdf6d62d6e763b_2_690x372.png" class="thumbnail" data-dominant-color="F5F3ED" width="690" height="372"></div> <h3><a href="https://huggingface.co/docs/transformers/main/en/tasks/image_captioning" target="_blank" rel="noopener">Image captioning</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/learn/computer-vision-course/en/unit0/welcome/welcome"> <header class="source"> <a href="https://huggingface.co/learn/computer-vision-course/en/unit0/welcome/welcome" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <h3><a href="https://huggingface.co/learn/computer-vision-course/en/unit0/welcome/welcome" target="_blank" rel="noopener">Welcome to the Community Computer Vision Course - Hugging Face Community...</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <p>and by Hugging Chat:</p> <hr> <p>To train an image captioning model for Indonesian using the Hugging Face ecosystem, follow these organized steps:</p> <ol> <li> <p><strong>Data Preparation</strong>:</p> <ul> <li>Organize your dataset with images and corresponding Indonesian captions into a format compatible with the Hugging Face <code>datasets</code> library.</li> <li>Convert images into tensor representations and tokenize Indonesian captions using an appropriate tokenizer, such as one compatible with the chosen model.</li> </ul> </li> <li> <p><strong>Model Selection</strong>:</p> <ul> <li>Select a pre-trained image captioning model, such as BLIP, available on the Hugging Face Model Hub. This model is pre-trained on a large dataset with English captions but can be adapted.</li> </ul> </li> <li> <p><strong>Model Architecture Adjustment</strong>:</p> <ul> <li>Utilize the existing vision encoder of the BLIP model, as it handles image processing effectively.</li> <li>Modify or fine-tune the text decoder to suit the Indonesian language. Consider integrating an Indonesian language model or tokenizer for better text generation accuracy.</li> </ul> </li> <li> <p><strong>Tokenization Considerations</strong>:</p> <ul> <li>Ensure the tokenizer is compatible with the model. If using a different tokenizer, check for compatibility issues and adjust the text decoder accordingly.</li> </ul> </li> <li> <p><strong>Training and Fine-Tuning</strong>:</p> <ul> <li>Fine-tune the model using your Indonesian dataset. This involves retraining the text decoder while keeping the vision encoder intact, focusing on adapting the model to generate accurate Indonesian captions.</li> </ul> </li> <li> <p><strong>Computational Resources</strong>:</p> <ul> <li>Use cloud services or Hugging Face platforms for training, as they offer the necessary computational power for processing large vision-language models.</li> </ul> </li> <li> <p><strong>Research and Existing Models</strong>:</p> <ul> <li>Investigate existing research or pre-trained models adapted for Indonesian to leverage prior work and accelerate your project.</li> </ul> </li> <li> <p><strong>Evaluation and Iteration</strong>:</p> <ul> <li>After training, evaluate the model’s performance. Adjust hyperparameters or the model architecture as needed based on evaluation results.</li> </ul> </li> </ol> <p>By following these steps, you can effectively adapt an English pre-trained image captioning model to generate accurate Indonesian captions, leveraging the strengths of the Hugging Face ecosystem.</p>
Streaming .arrow IterableDataset with irregular first dimension
https://discuss.huggingface.co/t/streaming-arrow-iterabledataset-with-irregular-first-dimension/140791
140,791
10
2025-02-14T04:56:00.327000Z
[ { "id": 202470, "name": "Chris Liu", "username": "Aceticia", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/{size}.png", "created_at": "2025-02-14T04:56:00.383Z", "cooked": "<p>I have a bunch of arrow files with the following feature:</p>\n<pre><code class=\"lang-auto\"> \"readings\": Array2D(\n dtype=\"float32\", shape=(-1, length_seconds)\n )\n</code></pre>\n<p>Which can be individually loaded perfectly ok. However, it fails to stream and complains of this error:</p>\n<pre><code class=\"lang-auto\">...site-packages/datasets/features/features.py\", line 760, in to_numpy\n[rank11]: numpy_arr = numpy_arr.reshape(len(self) - len(null_indices), *self.type.shape)\n[rank11]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n[rank11]: ValueError: cannot reshape array of size 2352000 into shape (10,newaxis,12000)\n</code></pre>\n<p>Digging around, it looks like <code>ArrowExamplesIterable</code> in <code>datasets/iterable_dataset.py:L259</code> tries to pre-load batches of samples but assumes the table can directly be loaded in a batched manner:</p>\n<pre><code class=\"lang-auto\"> for pa_subtable in pa_table.to_reader(max_chunksize=config.ARROW_READER_BATCH_SIZE_IN_DATASET_ITER):\n</code></pre>\n<p>This is normally ok, but clearly won’t work for irregular first dimension data. My question is: Other than manually padding the data to be the same size, are there other methods around this? I prefer to do the padding in the collate_fn since it saves disc space and there’s mostly no speed difference.</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-02-14T04:57:30.959Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 17, "reads": 5, "readers_count": 4, "score": 101, "yours": false, "topic_id": 140791, "topic_slug": "streaming-arrow-iterabledataset-with-irregular-first-dimension", "display_username": "Chris Liu", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 2619, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/streaming-arrow-iterabledataset-with-irregular-first-dimension/140791/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 202606, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-02-14T17:55:31.155Z", "cooked": "<p>I think wit should be <code>shape=(None, length_seconds)</code>, as per the <a href=\"https://huggingface.co/docs/datasets/en/about_dataset_features\">documentation</a>:</p>\n<blockquote>\n<p>The array type also allows the first dimension of the array to be dynamic. This is useful for handling sequences with variable lengths such as sentences, without having to pad or truncate the input to a uniform shape.</p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">\n&gt;&gt;&gt; features = Features({'a': Array3D(shape=(None, 5, 2), dtype='int32')})\n\n</code></pre>\n</blockquote>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-02-14T17:55:31.155Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 16, "yours": false, "topic_id": 140791, "topic_slug": "streaming-arrow-iterabledataset-with-irregular-first-dimension", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/datasets/en/about_dataset_features", "internal": false, "reflection": false, "title": "Dataset features", "clicks": 3 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/streaming-arrow-iterabledataset-with-irregular-first-dimension/140791/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207793, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-08T21:36:10.115Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-08T21:36:10.115Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 1, "readers_count": 0, "score": 0.2, "yours": false, "topic_id": 140791, "topic_slug": "streaming-arrow-iterabledataset-with-irregular-first-dimension", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/streaming-arrow-iterabledataset-with-irregular-first-dimension/140791/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I have a bunch of arrow files with the following feature:</p> <pre><code class="lang-auto"> "readings": Array2D( dtype="float32", shape=(-1, length_seconds) ) </code></pre> <p>Which can be individually loaded perfectly ok. However, it fails to stream and complains of this error:</p> <pre><code class="lang-auto">...site-packages/datasets/features/features.py", line 760, in to_numpy [rank11]: numpy_arr = numpy_arr.reshape(len(self) - len(null_indices), *self.type.shape) [rank11]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [rank11]: ValueError: cannot reshape array of size 2352000 into shape (10,newaxis,12000) </code></pre> <p>Digging around, it looks like <code>ArrowExamplesIterable</code> in <code>datasets/iterable_dataset.py:L259</code> tries to pre-load batches of samples but assumes the table can directly be loaded in a batched manner:</p> <pre><code class="lang-auto"> for pa_subtable in pa_table.to_reader(max_chunksize=config.ARROW_READER_BATCH_SIZE_IN_DATASET_ITER): </code></pre> <p>This is normally ok, but clearly won’t work for irregular first dimension data. My question is: Other than manually padding the data to be the same size, are there other methods around this? I prefer to do the padding in the collate_fn since it saves disc space and there’s mostly no speed difference.</p>
<p>I think wit should be <code>shape=(None, length_seconds)</code>, as per the <a href="https://huggingface.co/docs/datasets/en/about_dataset_features">documentation</a>:</p> <blockquote> <p>The array type also allows the first dimension of the array to be dynamic. This is useful for handling sequences with variable lengths such as sentences, without having to pad or truncate the input to a uniform shape.</p> <pre data-code-wrap="py"><code class="lang-py"> &gt;&gt;&gt; features = Features({'a': Array3D(shape=(None, 5, 2), dtype='int32')}) </code></pre> </blockquote>
How to add a new column using only streaming dataset from remote?
https://discuss.huggingface.co/t/how-to-add-a-new-column-using-only-streaming-dataset-from-remote/142991
142,991
10
2025-02-26T06:55:13.460000Z
[ { "id": 205369, "name": "HAESUNGJEON", "username": "seastar105", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/ed655f/{size}.png", "created_at": "2025-02-26T06:55:13.512Z", "cooked": "<p>I recently made a speech dataset using webdataset format then upload hf hub. but it is so hard to add new column to existing tar files, so decided to recreate whole dataset familiar with adding new column.</p>\n<p>Main concern is i have no enough storage, so i do not want to download whole dataset if i want to add new column. Is it possible using datasets parquet based dataset in hf hub? adding column using only streaming data loading.</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-02-26T06:55:13.512Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 21, "reads": 6, "readers_count": 5, "score": 116.2, "yours": false, "topic_id": 142991, "topic_slug": "how-to-add-a-new-column-using-only-streaming-dataset-from-remote", "display_username": "HAESUNGJEON", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 85069, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-add-a-new-column-using-only-streaming-dataset-from-remote/142991/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207012, "name": "Quentin Lhoest", "username": "lhoestq", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png", "created_at": "2025-03-05T14:44:49.611Z", "cooked": "<p>Yup, you can even merge two datasets with different columns together if it’s easier for you</p>\n<pre data-code-wrap=\"python\"><code class=\"lang-python\">ds = ds.add_column(\"new_col\", my_list)\n# OR\nother_ds_with_new_col = load_dataset(...)\nds = concatenate_datasets([ds, other_ds_with_new_col], axis=1)\n</code></pre>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-05T14:44:49.611Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 5, "readers_count": 4, "score": 26, "yours": false, "topic_id": 142991, "topic_slug": "how-to-add-a-new-column-using-only-streaming-dataset-from-remote", "display_username": "Quentin Lhoest", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": true, "admin": false, "staff": true, "user_id": 76, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-add-a-new-column-using-only-streaming-dataset-from-remote/142991/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 207239, "name": "HAESUNGJEON", "username": "seastar105", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/s/ed655f/{size}.png", "created_at": "2025-03-06T11:21:23.856Z", "cooked": "<p><a class=\"mention\" href=\"/u/lhoestq\">@lhoestq</a> Thanks! Adding column works as expected.<br>\none more question, is it possible to push to hub new dataset with added column not dumping whole parquets in local storage? Also, Iterabledataset does not have push_to_hub method.</p>\n<pre><code class=\"lang-auto\">dataset = load_dataset(\"...\", streaming=True) # large dataset\nnew_column_values = \"...\"\ndataset = dataset.add_column(\"new_col\", new_column_values)\n\ndataset.push_to_hub(\"...\") # error, IterableDataset has no push_to_hub\n</code></pre>\n<p>I think I can use just by pushing new column as dataset with same row order of original dataset, then use them along with concatenate_datasets. But, if there’s some way to push_to_hub concatenated iterable dataset, it would be best.</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-06T11:21:23.856Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 16, "yours": false, "topic_id": 142991, "topic_slug": "how-to-add-a-new-column-using-only-streaming-dataset-from-remote", "display_username": "HAESUNGJEON", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 85069, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-add-a-new-column-using-only-streaming-dataset-from-remote/142991/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 76, "username": "lhoestq", "name": "Quentin Lhoest", "avatar_template": "/user_avatar/discuss.huggingface.co/lhoestq/{size}/52888_2.png" }, "action_code": null, "via_email": null }, { "id": 207522, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-07T11:09:10.201Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-03-07T11:09:10.201Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 142991, "topic_slug": "how-to-add-a-new-column-using-only-streaming-dataset-from-remote", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/how-to-add-a-new-column-using-only-streaming-dataset-from-remote/142991/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I recently made a speech dataset using webdataset format then upload hf hub. but it is so hard to add new column to existing tar files, so decided to recreate whole dataset familiar with adding new column.</p> <p>Main concern is i have no enough storage, so i do not want to download whole dataset if i want to add new column. Is it possible using datasets parquet based dataset in hf hub? adding column using only streaming data loading.</p>
<p>Yup, you can even merge two datasets with different columns together if it’s easier for you</p> <pre data-code-wrap="python"><code class="lang-python">ds = ds.add_column("new_col", my_list) # OR other_ds_with_new_col = load_dataset(...) ds = concatenate_datasets([ds, other_ds_with_new_col], axis=1) </code></pre>
Help! Account Not Active Error, I made a payment and it was not activated
https://discuss.huggingface.co/t/help-account-not-active-error-i-made-a-payment-and-it-was-not-activated/144059
144,059
5
2025-03-04T17:38:47.869000Z
[ { "id": 206775, "name": "UVR", "username": "ASesYusuf1", "avatar_template": "/user_avatar/discuss.huggingface.co/asesyusuf1/{size}/42505_2.png", "created_at": "2025-03-04T17:38:47.938Z", "cooked": "<p>I wanted to pay for the Pro subscription, first it made me pay 10 dollars. I said it was probably okay, but then it asked for payment for the second time, this time it was 9 dolar, but because there was no money left in my account, it gave an insufficient balance error and the subscription was not given</p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/9/d/9da05e193403583191f34b7bb5e93005c66e90da.png\" data-download-href=\"/uploads/short-url/muqy1AbiRSJtxp2FwHhlKkRv6Vs.png?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/9/d/9da05e193403583191f34b7bb5e93005c66e90da.png\" alt=\"image\" data-base62-sha1=\"muqy1AbiRSJtxp2FwHhlKkRv6Vs\" width=\"690\" height=\"338\" data-dominant-color=\"F4F4F4\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">992×487 16.9 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p><a class=\"mention\" href=\"/u/meganariley\">@meganariley</a>.</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-04T17:59:04.151Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 56, "reads": 12, "readers_count": 11, "score": 227.4, "yours": false, "topic_id": 144059, "topic_slug": "help-account-not-active-error-i-made-a-payment-and-it-was-not-activated", "display_username": "UVR", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/huggingface-pro-subscription/148587", "internal": true, "reflection": true, "title": "Huggingface pro subscription", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 85879, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-account-not-active-error-i-made-a-payment-and-it-was-not-activated/144059/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206782, "name": "UVR", "username": "ASesYusuf1", "avatar_template": "/user_avatar/discuss.huggingface.co/asesyusuf1/{size}/42505_2.png", "created_at": "2025-03-04T17:59:36.198Z", "cooked": "<p><a class=\"mention\" href=\"/u/meganariley\">@meganariley</a>.</p>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-04T17:59:36.198Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 12, "readers_count": 11, "score": 27.4, "yours": false, "topic_id": 144059, "topic_slug": "help-account-not-active-error-i-made-a-payment-and-it-was-not-activated", "display_username": "UVR", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 85879, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-account-not-active-error-i-made-a-payment-and-it-was-not-activated/144059/2", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206803, "name": "Megan Riley", "username": "meganariley", "avatar_template": "/user_avatar/discuss.huggingface.co/meganariley/{size}/20596_2.png", "created_at": "2025-03-04T20:29:04.125Z", "cooked": "<p>Hey! Thanks for posting. When a payment method is added to an account, we’ll validate the card with a $10 hold, but don’t worry - this is not charged and the hold should clear within a few business days. Rest assured you have not yet been charged.</p>\n<p>I responded to your support email with additional information about the transaction.</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-04T20:29:04.125Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 1, "reads": 12, "readers_count": 11, "score": 37.4, "yours": false, "topic_id": 144059, "topic_slug": "help-account-not-active-error-i-made-a-payment-and-it-was-not-activated", "display_username": "Megan Riley", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://discuss.huggingface.co/t/payment-processed-but-pro-subscription-not-activated/144873/2", "internal": true, "reflection": true, "title": "Payment Processed but PRO Subscription Not Activated", "clicks": 4 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 31941, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-account-not-active-error-i-made-a-payment-and-it-was-not-activated/144059/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 85879, "username": "ASesYusuf1", "name": "UVR", "avatar_template": "/user_avatar/discuss.huggingface.co/asesyusuf1/{size}/42505_2.png" }, "action_code": null, "via_email": null }, { "id": 206959, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-05T11:02:58.392Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-03-05T11:02:58.392Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 9, "readers_count": 8, "score": 6.8, "yours": false, "topic_id": 144059, "topic_slug": "help-account-not-active-error-i-made-a-payment-and-it-was-not-activated", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-account-not-active-error-i-made-a-payment-and-it-was-not-activated/144059/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I wanted to pay for the Pro subscription, first it made me pay 10 dollars. I said it was probably okay, but then it asked for payment for the second time, this time it was 9 dolar, but because there was no money left in my account, it gave an insufficient balance error and the subscription was not given</p> <p><div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/9/d/9da05e193403583191f34b7bb5e93005c66e90da.png" data-download-href="/uploads/short-url/muqy1AbiRSJtxp2FwHhlKkRv6Vs.png?dl=1" title="image" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/original/3X/9/d/9da05e193403583191f34b7bb5e93005c66e90da.png" alt="image" data-base62-sha1="muqy1AbiRSJtxp2FwHhlKkRv6Vs" width="690" height="338" data-dominant-color="F4F4F4"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">992×487 16.9 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p> <p><a class="mention" href="/u/meganariley">@meganariley</a>.</p>
<p>Hey! Thanks for posting. When a payment method is added to an account, we’ll validate the card with a $10 hold, but don’t worry - this is not charged and the hold should clear within a few business days. Rest assured you have not yet been charged.</p> <p>I responded to your support email with additional information about the transaction.</p>
Dialogpt with irrelevant and weird response
https://discuss.huggingface.co/t/dialogpt-with-irrelevant-and-weird-response/143371
143,371
5
2025-02-28T09:02:34.427000Z
[ { "id": 205845, "name": "Olive Cheong Yu Xuan", "username": "Olive0982", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/o/bc8723/{size}.png", "created_at": "2025-02-28T09:02:34.509Z", "cooked": "<p>Hi guys, currently I am a really fresh junior which is now working on finetuning DialoGPT with my own dataset to develop a conversational chatbot, but yet I found that the response generated is very irrelevant. At first I thought that maybe is my dataset problem, and I try to change it to larger dataset but it still not working.</p>\n<p>So, I try the original DialoGPT to check if is the model problem, and I found the response generated is also very weird like the response below. So is it the base model problem or just my technical problem? I actually think off changing into other model like GPT2 model (which can be finetuned in Google Colab T4GPU), but I have also try for GPT2 model inference before finetuning, but it also generate something weird like i input “Hi” , it responses with the following. If anyone can point out what am I missing or doing wrong I will be really appreciated. Thanks in advance.</p>\n<p>Chatbot: , “I know you’re a great person and you’re here to do what’s right.”</p>\n<p>“No, I’m not,” said I, “I’m not here to do what’s right.”</p>\n<p>“No, I’m not here to do what’s right,” said I, “I’m not here to do what’s right.”</p>\n<p>“No, I’m not here to do what’s right.”</p>\n<p>\"No, I’m not here to do what’s right</p>\n<h1><a name=\"p-205845-response-from-dialogpt-1\" class=\"anchor\" href=\"#p-205845-response-from-dialogpt-1\"></a>Response from DialoGPT</h1>\n<p>User:do you have a good day<br>\nDialoGPT: I do, thank you.<br>\nUser:i feel not bad today also<br>\nDialoGPT: I feel good today.<br>\nUser:i done a bad job in my last year<br>\nDialoGPT: i feel bad today<br>\nUser:can you give me some adavice?<br>\nDialoGPT: i feel bad today</p>\n<p>The code is getting from other side, I just adjust for the top_p and top_k value.</p>\n<p>import torch</p>\n<p>from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline</p>\n<p>tokenizer = AutoTokenizer.from_pretrained(“microsoft/DialoGPT-large”)<br>\nmodel = AutoModelForCausalLM.from_pretrained(“microsoft/DialoGPT-large”)</p>\n<p>for step in range(5):<br>\nnew_user_input_ids = tokenizer.encode(input(“&gt;&gt; User:”) + tokenizer.eos_token, return_tensors=‘pt’)<br>\nprint(f’user_token:{new_user_input_ids}')<br>\nbot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step &gt; 0 else new_user_input_ids</p>\n<pre><code>chat_history_ids = model.generate(\n bot_input_ids,\n max_length=2000,\n top_k=50, \n top_p=0.9,\n pad_token_id=tokenizer.eos_token_id,\n )\nprint(f'chat_history_ids:{bot_input_ids}')\nprint(\"DialoGPT: {}\".format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)))\n</code></pre>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-02-28T09:02:34.509Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 53, "reads": 4, "readers_count": 3, "score": 270.8, "yours": false, "topic_id": 143371, "topic_slug": "dialogpt-with-irrelevant-and-weird-response", "display_username": "Olive Cheong Yu Xuan", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 47705, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/dialogpt-with-irrelevant-and-weird-response/143371/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 205868, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-02-28T11:09:21.545Z", "cooked": "<pre data-code-wrap=\"py\"><code class=\"lang-py\">#bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step &gt; 0 else new_user_input_ids\nbot_input_ids = new_user_input_ids\n</code></pre>\n<p>The main cause seems to be the line above. The conversation history is not being processed as a conversation history. Since the Transformers specification has changed since Microsoft wrote the sample, I’ve tried rewriting it in a more modern style.</p>\n<p>It’s much better now, but I think the model itself is strange… especially with the default settings.<img src=\"https://emoji.discourse-cdn.com/apple/sweat_smile.png?v=12\" title=\":sweat_smile:\" class=\"emoji\" alt=\":sweat_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">import torch\nfrom transformers import AutoModelForCausalLM, AutoTokenizer, pipeline\n\ndevice = \"cuda\" if torch.cuda.is_available() else \"cpu\"\ntokenizer = AutoTokenizer.from_pretrained(\"microsoft/DialoGPT-large\", torch_dtype=torch.bfloat16)\nmodel = AutoModelForCausalLM.from_pretrained(\"microsoft/DialoGPT-large\").to(device)\n\nquestions = [\"do you have a good day\", \"i feel not bad today also\", \"i done a bad job in my last year\", \"can you give me some adavice?\"]\nhistory = []\n\nfor q in questions:\n history.append({\"role\": \"user\", \"content\": q})\n msg = tokenizer.apply_chat_template(history, tokenize=False, add_generation_prompt=True)\n new_user_input_ids = tokenizer.encode(msg + tokenizer.eos_token, return_tensors='pt')\n bot_input_ids = new_user_input_ids\n\n chat_history_ids = model.generate(\n bot_input_ids.to(device),\n max_new_tokens=1024,\n do_sample=True,\n temperature=0.7,\n top_k=50,\n top_p=0.9,\n pad_token_id=tokenizer.eos_token_id,\n )\n \n output = tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True)\n history.append({\"role\": \"assistant\", \"content\": output})\n\n print(\"User: {}\".format(q))\n print(\"DialoGPT: {}\".format(output))\n</code></pre>\n<pre><code class=\"lang-auto\">User: do you have a good day\nDialoGPT: You're pretty bad at trolling, are you?\nUser: i feel not bad today also\nDialoGPT: You are a good troll.\nUser: i done a bad job in my last year\nDialoGPT: I think you're doing a good job.\nUser: can you give me some adavice?\nDialoGPT: yes, but it's a little bit tough to get\n</code></pre>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-02-28T11:09:21.545Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 4, "reads": 4, "readers_count": 3, "score": 35.8, "yours": false, "topic_id": 143371, "topic_slug": "dialogpt-with-irrelevant-and-weird-response", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/dialogpt-with-irrelevant-and-weird-response/143371/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206882, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-05T05:27:05.129Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-05T05:27:05.129Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 1, "readers_count": 0, "score": 5.2, "yours": false, "topic_id": 143371, "topic_slug": "dialogpt-with-irrelevant-and-weird-response", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/dialogpt-with-irrelevant-and-weird-response/143371/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi guys, currently I am a really fresh junior which is now working on finetuning DialoGPT with my own dataset to develop a conversational chatbot, but yet I found that the response generated is very irrelevant. At first I thought that maybe is my dataset problem, and I try to change it to larger dataset but it still not working.</p> <p>So, I try the original DialoGPT to check if is the model problem, and I found the response generated is also very weird like the response below. So is it the base model problem or just my technical problem? I actually think off changing into other model like GPT2 model (which can be finetuned in Google Colab T4GPU), but I have also try for GPT2 model inference before finetuning, but it also generate something weird like i input “Hi” , it responses with the following. If anyone can point out what am I missing or doing wrong I will be really appreciated. Thanks in advance.</p> <p>Chatbot: , “I know you’re a great person and you’re here to do what’s right.”</p> <p>“No, I’m not,” said I, “I’m not here to do what’s right.”</p> <p>“No, I’m not here to do what’s right,” said I, “I’m not here to do what’s right.”</p> <p>“No, I’m not here to do what’s right.”</p> <p>"No, I’m not here to do what’s right</p> <h1><a name="p-205845-response-from-dialogpt-1" class="anchor" href="#p-205845-response-from-dialogpt-1"></a>Response from DialoGPT</h1> <p>User:do you have a good day<br> DialoGPT: I do, thank you.<br> User:i feel not bad today also<br> DialoGPT: I feel good today.<br> User:i done a bad job in my last year<br> DialoGPT: i feel bad today<br> User:can you give me some adavice?<br> DialoGPT: i feel bad today</p> <p>The code is getting from other side, I just adjust for the top_p and top_k value.</p> <p>import torch</p> <p>from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline</p> <p>tokenizer = AutoTokenizer.from_pretrained(“microsoft/DialoGPT-large”)<br> model = AutoModelForCausalLM.from_pretrained(“microsoft/DialoGPT-large”)</p> <p>for step in range(5):<br> new_user_input_ids = tokenizer.encode(input(“&gt;&gt; User:”) + tokenizer.eos_token, return_tensors=‘pt’)<br> print(f’user_token:{new_user_input_ids}')<br> bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step &gt; 0 else new_user_input_ids</p> <pre><code>chat_history_ids = model.generate( bot_input_ids, max_length=2000, top_k=50, top_p=0.9, pad_token_id=tokenizer.eos_token_id, ) print(f'chat_history_ids:{bot_input_ids}') print("DialoGPT: {}".format(tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True))) </code></pre>
<pre data-code-wrap="py"><code class="lang-py">#bot_input_ids = torch.cat([chat_history_ids, new_user_input_ids], dim=-1) if step &gt; 0 else new_user_input_ids bot_input_ids = new_user_input_ids </code></pre> <p>The main cause seems to be the line above. The conversation history is not being processed as a conversation history. Since the Transformers specification has changed since Microsoft wrote the sample, I’ve tried rewriting it in a more modern style.</p> <p>It’s much better now, but I think the model itself is strange… especially with the default settings.<img src="https://emoji.discourse-cdn.com/apple/sweat_smile.png?v=12" title=":sweat_smile:" class="emoji" alt=":sweat_smile:" loading="lazy" width="20" height="20"></p> <pre data-code-wrap="py"><code class="lang-py">import torch from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline device = "cuda" if torch.cuda.is_available() else "cpu" tokenizer = AutoTokenizer.from_pretrained("microsoft/DialoGPT-large", torch_dtype=torch.bfloat16) model = AutoModelForCausalLM.from_pretrained("microsoft/DialoGPT-large").to(device) questions = ["do you have a good day", "i feel not bad today also", "i done a bad job in my last year", "can you give me some adavice?"] history = [] for q in questions: history.append({"role": "user", "content": q}) msg = tokenizer.apply_chat_template(history, tokenize=False, add_generation_prompt=True) new_user_input_ids = tokenizer.encode(msg + tokenizer.eos_token, return_tensors='pt') bot_input_ids = new_user_input_ids chat_history_ids = model.generate( bot_input_ids.to(device), max_new_tokens=1024, do_sample=True, temperature=0.7, top_k=50, top_p=0.9, pad_token_id=tokenizer.eos_token_id, ) output = tokenizer.decode(chat_history_ids[:, bot_input_ids.shape[-1]:][0], skip_special_tokens=True) history.append({"role": "assistant", "content": output}) print("User: {}".format(q)) print("DialoGPT: {}".format(output)) </code></pre> <pre><code class="lang-auto">User: do you have a good day DialoGPT: You're pretty bad at trolling, are you? User: i feel not bad today also DialoGPT: You are a good troll. User: i done a bad job in my last year DialoGPT: I think you're doing a good job. User: can you give me some adavice? DialoGPT: yes, but it's a little bit tough to get </code></pre>
Why the model provide an error response ever time
https://discuss.huggingface.co/t/why-the-model-provide-an-error-response-ever-time/143724
143,724
5
2025-03-02T23:10:24.094000Z
[ { "id": 206342, "name": "ThalesLuo", "username": "ThalesLuo", "avatar_template": "/user_avatar/discuss.huggingface.co/thalesluo/{size}/42348_2.png", "created_at": "2025-03-02T23:10:24.158Z", "cooked": "<p>I tried to download some distill models from Huggingface, after run. I found that they cannot reponse me correctly. Why? Below an example:</p>\n<p>C:\\work\\Ollama\\Models\\blobs&gt;ollama show DeepSeek-R1-Distill-Qwen-32B-Q8_0<br>\nModel<br>\narchitecture qwen2<br>\nparameters 32.8B<br>\ncontext length 131072<br>\nembedding length 5120<br>\nquantization Q8_0</p>\n<p>C:\\work\\Ollama\\Models\\blobs&gt;ollama run DeepSeek-R1-Distill-Qwen-32B-Q8_0 --verbose<br>\n<strong>&gt;&gt;&gt; hi</strong></p>\n<p>Okay, so I have to figure out how to solve this problem where I need to find the area of a triangle when I know<br>\ntwo sides and the included angle. Hmm, let me recall what formulas I know for the area of a triangle.</p>\n<p>I remember that the basic formula is (base * height) / 2, but in this case, I don’t have the height; instead, I<br>\nhave two sides and the angle between them. Maybe there’s another way to calculate the area with that information.</p>\n<p><strong>&gt;&gt;&gt; can u help to translate</strong><br>\nthis? * (b * sin θ), which simplifies to (1/2)ab sin θ. Yeah, that makes sense.</p>\n<p>Let me test this with an example I know. Suppose I have a right-angled triangle with sides 3 and 4, and the<br>\nincluded angle is 90 degrees. Then, according to this formula, area should be (1/2)<em>3</em>4*sin(90).</p>\n<p>I had tried below with similar case, that cannot response correctly</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/9/3927d79ded16011227ac5898f55f176c3eb59507_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5C71A5\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF\" target=\"_blank\" rel=\"noopener\">bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/bartowski/huihui-ai_DeepSeek-R1-Distill-Llama-70B-abliterated-GGUF\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/bartowski/huihui-ai_DeepSeek-R1-Distill-Llama-70B-abliterated-GGUF\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/d/0d166822d793344a281dcd3d8abdbcec73b11e6b_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5F74A5\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/bartowski/huihui-ai_DeepSeek-R1-Distill-Llama-70B-abliterated-GGUF\" target=\"_blank\" rel=\"noopener\">bartowski/huihui-ai_DeepSeek-R1-Distill-Llama-70B-abliterated-GGUF · Hugging...</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 1, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-03T14:28:23.324Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 16, "reads": 6, "readers_count": 5, "score": 141.2, "yours": false, "topic_id": 143724, "topic_slug": "why-the-model-provide-an-error-response-ever-time", "display_username": "ThalesLuo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/bartowski/huihui-ai_DeepSeek-R1-Distill-Llama-70B-abliterated-GGUF", "internal": false, "reflection": false, "title": "bartowski/huihui-ai_DeepSeek-R1-Distill-Llama-70B-abliterated-GGUF · Hugging Face", "clicks": 2 }, { "url": "https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF", "internal": false, "reflection": false, "title": "bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF · Hugging Face", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 85631, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-the-model-provide-an-error-response-ever-time/143724/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206344, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-02T23:10:25.315Z", "cooked": "", "post_number": 2, "post_type": 3, "posts_count": 6, "updated_at": "2025-03-02T23:10:25.315Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 1.4, "yours": false, "topic_id": 143724, "topic_slug": "why-the-model-provide-an-error-response-ever-time", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-the-model-provide-an-error-response-ever-time/143724/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "visible.disabled", "via_email": null }, { "id": 206492, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-03T14:28:23.352Z", "cooked": "", "post_number": 3, "post_type": 3, "posts_count": 6, "updated_at": "2025-03-03T14:28:23.352Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 1.4, "yours": false, "topic_id": 143724, "topic_slug": "why-the-model-provide-an-error-response-ever-time", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-the-model-provide-an-error-response-ever-time/143724/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "visible.enabled", "via_email": null }, { "id": 206537, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-03T16:32:20.382Z", "cooked": "<p>Possibly Ollama specific compatibility issue.</p><aside class=\"onebox githubissue\" data-onebox-src=\"https://github.com/ollama/ollama/issues/5245\">\n <header class=\"source\">\n\n <a href=\"https://github.com/ollama/ollama/issues/5245\" target=\"_blank\" rel=\"noopener\">github.com/ollama/ollama</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"github-row\">\n <div class=\"github-icon-container\" title=\"Issue\" data-github-private-repo=\"false\">\n\t <svg width=\"60\" height=\"60\" class=\"github-icon\" viewBox=\"0 0 14 16\" aria-hidden=\"true\"><path fill-rule=\"evenodd\" d=\"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z\"></path></svg>\n </div>\n\n <div class=\"github-info-container\">\n <h4>\n <a href=\"https://github.com/ollama/ollama/issues/5245\" target=\"_blank\" rel=\"noopener\">Allow importing multi-file GGUF models</a>\n </h4>\n\n <div class=\"github-info\">\n <div class=\"date\">\n opened <span class=\"discourse-local-date\" data-format=\"ll\" data-date=\"2024-06-23\" data-time=\"21:45:41\" data-timezone=\"UTC\">09:45PM - 23 Jun 24 UTC</span>\n </div>\n\n\n <div class=\"user\">\n <a href=\"https://github.com/jmorganca\" target=\"_blank\" rel=\"noopener\">\n <img alt=\"\" src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/e/4/e458458f5c7fcb99680ab5aa38fe982f0033ca0f.jpeg\" class=\"onebox-avatar-inline\" width=\"20\" height=\"20\" data-dominant-color=\"B7ABA3\">\n jmorganca\n </a>\n </div>\n </div>\n\n <div class=\"labels\">\n <span style=\"display:inline-block;margin-top:2px;background-color: #B8B8B8;padding: 2px;border-radius: 4px;color: #fff;margin-left: 3px;\">\n bug\n </span>\n </div>\n </div>\n</div>\n\n <div class=\"github-row\">\n <p class=\"github-body-container\">### What is the issue?\n\nCurrently Ollama can [import GGUF files](https://github.<span class=\"show-more-container\"><a href=\"\" rel=\"noopener\" class=\"show-more\">…</a></span><span class=\"excerpt hidden\">com/ollama/ollama/blob/main/docs/import.md). However, larger models are sometimes split into separate files. Ollama should support loading multiple GGUF files similar to loading safetensor files.\n\n\n### OS\n\n_No response_\n\n### GPU\n\n_No response_\n\n### CPU\n\n_No response_\n\n### Ollama version\n\n_No response_</span></p>\n </div>\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-03T16:32:20.382Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 6.2, "yours": false, "topic_id": 143724, "topic_slug": "why-the-model-provide-an-error-response-ever-time", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/ollama/ollama/issues/5245", "internal": false, "reflection": false, "title": "Allow importing multi-file GGUF models · Issue #5245 · ollama/ollama · GitHub", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-the-model-provide-an-error-response-ever-time/143724/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206690, "name": "ThalesLuo", "username": "ThalesLuo", "avatar_template": "/user_avatar/discuss.huggingface.co/thalesluo/{size}/42348_2.png", "created_at": "2025-03-04T11:14:53.365Z", "cooked": "<p>Thanks for your reply. I go throug the link and problem sovled, through adding below in Modelfile. The root cause is PARAMETER missing at the original Modelfile:</p>\n<p>FROM DeepSeek-R1-Distill-Qwen-32B-Q8_0<br>\nTEMPLATE “”“{{- if .System }}{{ .System }}{{ end }}<br>\n{{- range <span class=\"math\">i, </span>_ := .Messages }}<br>\n{{- <span class=\"math\">last := eq (len (slice </span>.Messages $i)) 1}}<br>\n{{- if eq .Role “user” }}&lt;|User|&gt;{{ .Content }}<br>\n{{- else if eq .Role “assistant” }}&lt;|Assistant|&gt;{{ .Content }}{{- if not $last }}&lt;|end▁of▁sentence|&gt;{{- end }}<br>\n{{- end }}<br>\n{{- if and $last (ne .Role “assistant”) }}&lt;|Assistant|&gt;{{- end }}<br>\n{{- end }}”“”<br>\nPARAMETER stop &lt;|begin▁of▁sentence|&gt;<br>\nPARAMETER stop &lt;|end▁of▁sentence|&gt;<br>\nPARAMETER stop &lt;|User|&gt;<br>\nPARAMETER stop &lt;|Assistant|&gt;</p>", "post_number": 5, "post_type": 1, "posts_count": 6, "updated_at": "2025-03-04T11:15:59.481Z", "reply_count": 0, "reply_to_post_number": 4, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 15.6, "yours": false, "topic_id": 143724, "topic_slug": "why-the-model-provide-an-error-response-ever-time", "display_username": "ThalesLuo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 85631, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-the-model-provide-an-error-response-ever-time/143724/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 206824, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-04T23:15:02.148Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 6, "post_type": 3, "posts_count": 6, "updated_at": "2025-03-04T23:15:02.148Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 1, "readers_count": 0, "score": 0.2, "yours": false, "topic_id": 143724, "topic_slug": "why-the-model-provide-an-error-response-ever-time", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/why-the-model-provide-an-error-response-ever-time/143724/6", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I tried to download some distill models from Huggingface, after run. I found that they cannot reponse me correctly. Why? Below an example:</p> <p>C:\work\Ollama\Models\blobs&gt;ollama show DeepSeek-R1-Distill-Qwen-32B-Q8_0<br> Model<br> architecture qwen2<br> parameters 32.8B<br> context length 131072<br> embedding length 5120<br> quantization Q8_0</p> <p>C:\work\Ollama\Models\blobs&gt;ollama run DeepSeek-R1-Distill-Qwen-32B-Q8_0 --verbose<br> <strong>&gt;&gt;&gt; hi</strong></p> <p>Okay, so I have to figure out how to solve this problem where I need to find the area of a triangle when I know<br> two sides and the included angle. Hmm, let me recall what formulas I know for the area of a triangle.</p> <p>I remember that the basic formula is (base * height) / 2, but in this case, I don’t have the height; instead, I<br> have two sides and the angle between them. Maybe there’s another way to calculate the area with that information.</p> <p><strong>&gt;&gt;&gt; can u help to translate</strong><br> this? * (b * sin θ), which simplifies to (1/2)ab sin θ. Yeah, that makes sense.</p> <p>Let me test this with an example I know. Suppose I have a right-angled triangle with sides 3 and 4, and the<br> included angle is 90 degrees. Then, according to this formula, area should be (1/2)<em>3</em>4*sin(90).</p> <p>I had tried below with similar case, that cannot response correctly</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF"> <header class="source"> <a href="https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/9/3927d79ded16011227ac5898f55f176c3eb59507_2_690x372.png" class="thumbnail" data-dominant-color="5C71A5" width="690" height="372"></div> <h3><a href="https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF" target="_blank" rel="noopener">bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF · Hugging Face</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/bartowski/huihui-ai_DeepSeek-R1-Distill-Llama-70B-abliterated-GGUF"> <header class="source"> <a href="https://huggingface.co/bartowski/huihui-ai_DeepSeek-R1-Distill-Llama-70B-abliterated-GGUF" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/0/d/0d166822d793344a281dcd3d8abdbcec73b11e6b_2_690x372.png" class="thumbnail" data-dominant-color="5F74A5" width="690" height="372"></div> <h3><a href="https://huggingface.co/bartowski/huihui-ai_DeepSeek-R1-Distill-Llama-70B-abliterated-GGUF" target="_blank" rel="noopener">bartowski/huihui-ai_DeepSeek-R1-Distill-Llama-70B-abliterated-GGUF · Hugging...</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
<p>Thanks for your reply. I go throug the link and problem sovled, through adding below in Modelfile. The root cause is PARAMETER missing at the original Modelfile:</p> <p>FROM DeepSeek-R1-Distill-Qwen-32B-Q8_0<br> TEMPLATE “”“{{- if .System }}{{ .System }}{{ end }}<br> {{- range <span class="math">i, </span>_ := .Messages }}<br> {{- <span class="math">last := eq (len (slice </span>.Messages $i)) 1}}<br> {{- if eq .Role “user” }}&lt;|User|&gt;{{ .Content }}<br> {{- else if eq .Role “assistant” }}&lt;|Assistant|&gt;{{ .Content }}{{- if not $last }}&lt;|end▁of▁sentence|&gt;{{- end }}<br> {{- end }}<br> {{- if and $last (ne .Role “assistant”) }}&lt;|Assistant|&gt;{{- end }}<br> {{- end }}”“”<br> PARAMETER stop &lt;|begin▁of▁sentence|&gt;<br> PARAMETER stop &lt;|end▁of▁sentence|&gt;<br> PARAMETER stop &lt;|User|&gt;<br> PARAMETER stop &lt;|Assistant|&gt;</p>
What is an efficient method to manually create image descriptions?
https://discuss.huggingface.co/t/what-is-an-efficient-method-to-manually-create-image-descriptions/113452
113,452
5
2024-10-22T19:52:08.855000Z
[ { "id": 164581, "name": "Ryan Belcher", "username": "rmbmail", "avatar_template": "/user_avatar/discuss.huggingface.co/rmbmail/{size}/33293_2.png", "created_at": "2024-10-22T19:52:08.917Z", "cooked": "<p>I want to add descriptions to a few thousand images and I’m looking for an efficient way to do this. Ideally I’d like something on Android where I see the image, I can speak the description, it gets transcribed to text and stored in some way with the image. Then I click next/OK, see the next image and repeat.</p>\n<p>Has anyone done something similar or have an idea of how they would do it?</p>", "post_number": 1, "post_type": 1, "posts_count": 5, "updated_at": "2024-10-22T19:52:08.917Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 72, "reads": 8, "readers_count": 7, "score": 351.6, "yours": false, "topic_id": 113452, "topic_slug": "what-is-an-efficient-method-to-manually-create-image-descriptions", "display_username": "Ryan Belcher", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 68200, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/what-is-an-efficient-method-to-manually-create-image-descriptions/113452/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 164621, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2024-10-23T00:13:51.334Z", "cooked": "<p>The process of adding descriptions to a large number of images is usually done semi-automatically by a tool or VLM like the following, for example, but it is a rare use case when it is only done manually…<br>\nI think it is possible to achieve your flow using an ASR model such as Whisper, but I have not seen such a finished product in Spaces, so I think the only way is to create one. If you want to find or create something similar, I can provide you with information.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/Wi-zz/joy-caption-pre-alpha\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/Wi-zz/joy-caption-pre-alpha\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/9/6/96699e8fd6417ecb1685657bd173ca4a29d4ebe1_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"5E72A0\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/Wi-zz/joy-caption-pre-alpha\" target=\"_blank\" rel=\"noopener\">Wi-zz/joy-caption-pre-alpha · Hugging Face</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/spaces/John6666/joy-caption-pre-alpha-mod\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/spaces/John6666/joy-caption-pre-alpha-mod\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/e/2e360fb5938e6fc9703f7c304b5b2c964fc41be9_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"AF6382\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/spaces/John6666/joy-caption-pre-alpha-mod\" target=\"_blank\" rel=\"noopener\">Joy Caption Alpha Two Mod - a Hugging Face Space by John6666</a></h3>\n\n <p>Discover amazing ML apps made by the community</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 5, "updated_at": "2024-10-23T00:13:51.334Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 7, "readers_count": 6, "score": 16.4, "yours": false, "topic_id": 113452, "topic_slug": "what-is-an-efficient-method-to-manually-create-image-descriptions", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/Wi-zz/joy-caption-pre-alpha", "internal": false, "reflection": false, "title": "Wi-zz/joy-caption-pre-alpha · Hugging Face", "clicks": 8 }, { "url": "https://huggingface.co/spaces/John6666/joy-caption-pre-alpha-mod", "internal": false, "reflection": false, "title": "Joy Caption Alpha Two Mod - a Hugging Face Space by John6666", "clicks": 3 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/what-is-an-efficient-method-to-manually-create-image-descriptions/113452/2", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 164812, "name": "Ryan Belcher", "username": "rmbmail", "avatar_template": "/user_avatar/discuss.huggingface.co/rmbmail/{size}/33293_2.png", "created_at": "2024-10-23T15:43:45.764Z", "cooked": "<p>Thanks for the input, John. If I end up building something it seems like Whisper would be the best option for the ASR portion.</p>", "post_number": 3, "post_type": 1, "posts_count": 5, "updated_at": "2024-10-23T15:43:45.764Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 4, "readers_count": 3, "score": 15.8, "yours": false, "topic_id": 113452, "topic_slug": "what-is-an-efficient-method-to-manually-create-image-descriptions", "display_username": "Ryan Belcher", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 68200, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/what-is-an-efficient-method-to-manually-create-image-descriptions/113452/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 164821, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2024-10-23T16:15:48.417Z", "cooked": "<p>If you are going to use Whisper, the following one seems to be fast and good, although it requires a GPU.<br>\nThe flow of the program that I personally thought of is to put 1000 image files in a private dataset repo in HF, display one of them in the GUI, accept voice input in Whisper and put it in a text box, and improve the contents of the text box by combining an appropriate grammar checker, When the Submit button is pressed, a .txt file is saved in the dataset repo with the same name as the image file, only with a different extension. and the following image is displayed. Images for which .txt is found are not displayed because they have already been processed.<br>\nI think you can make something like this using only common existing functions.<br>\nIt would be nice to put an appropriate VLM or tagger in front of Whisper to aid input.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/spaces/KingNish/Realtime-whisper-large-v3-turbo\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/spaces/KingNish/Realtime-whisper-large-v3-turbo\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/c/3cec4740470473961a7715a0692112d63e249f60_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"9B4187\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/spaces/KingNish/Realtime-whisper-large-v3-turbo\" target=\"_blank\" rel=\"noopener\">Realtime Whisper Turbo - a Hugging Face Space by KingNish</a></h3>\n\n <p>Realtime implementation of Whisper large turbo</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 4, "post_type": 1, "posts_count": 5, "updated_at": "2024-10-23T16:15:48.417Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 3, "readers_count": 2, "score": 0.6, "yours": false, "topic_id": 113452, "topic_slug": "what-is-an-efficient-method-to-manually-create-image-descriptions", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/spaces/KingNish/Realtime-whisper-large-v3-turbo", "internal": false, "reflection": false, "title": "Realtime Whisper Turbo - a Hugging Face Space by KingNish", "clicks": 1 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/what-is-an-efficient-method-to-manually-create-image-descriptions/113452/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206784, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-04T18:41:37.222Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 5, "post_type": 3, "posts_count": 5, "updated_at": "2025-03-04T18:41:37.222Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 1, "readers_count": 0, "score": 5.2, "yours": false, "topic_id": 113452, "topic_slug": "what-is-an-efficient-method-to-manually-create-image-descriptions", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/what-is-an-efficient-method-to-manually-create-image-descriptions/113452/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>I want to add descriptions to a few thousand images and I’m looking for an efficient way to do this. Ideally I’d like something on Android where I see the image, I can speak the description, it gets transcribed to text and stored in some way with the image. Then I click next/OK, see the next image and repeat.</p> <p>Has anyone done something similar or have an idea of how they would do it?</p>
<p>The process of adding descriptions to a large number of images is usually done semi-automatically by a tool or VLM like the following, for example, but it is a rare use case when it is only done manually…<br> I think it is possible to achieve your flow using an ASR model such as Whisper, but I have not seen such a finished product in Spaces, so I think the only way is to create one. If you want to find or create something similar, I can provide you with information.</p><aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/Wi-zz/joy-caption-pre-alpha"> <header class="source"> <a href="https://huggingface.co/Wi-zz/joy-caption-pre-alpha" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/9/6/96699e8fd6417ecb1685657bd173ca4a29d4ebe1_2_690x372.png" class="thumbnail" data-dominant-color="5E72A0" width="690" height="372"></div> <h3><a href="https://huggingface.co/Wi-zz/joy-caption-pre-alpha" target="_blank" rel="noopener">Wi-zz/joy-caption-pre-alpha · Hugging Face</a></h3> <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside> <aside class="onebox allowlistedgeneric" data-onebox-src="https://huggingface.co/spaces/John6666/joy-caption-pre-alpha-mod"> <header class="source"> <a href="https://huggingface.co/spaces/John6666/joy-caption-pre-alpha-mod" target="_blank" rel="noopener">huggingface.co</a> </header> <article class="onebox-body"> <div class="aspect-image" style="--aspect-ratio:690/372;"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/2/e/2e360fb5938e6fc9703f7c304b5b2c964fc41be9_2_690x372.png" class="thumbnail" data-dominant-color="AF6382" width="690" height="372"></div> <h3><a href="https://huggingface.co/spaces/John6666/joy-caption-pre-alpha-mod" target="_blank" rel="noopener">Joy Caption Alpha Two Mod - a Hugging Face Space by John6666</a></h3> <p>Discover amazing ML apps made by the community</p> </article> <div class="onebox-metadata"> </div> <div style="clear: both"></div> </aside>
Help Needed: Extracting Blood Pressure &amp; Glucose Readings Using ML
https://discuss.huggingface.co/t/help-needed-extracting-blood-pressure-glucose-readings-using-ml/142783
142,783
69
2025-02-25T05:39:56.791000Z
[ { "id": 205107, "name": "MD Mehedi Hasan Sarkar", "username": "mhsarkar", "avatar_template": "/user_avatar/discuss.huggingface.co/mhsarkar/{size}/41917_2.png", "created_at": "2025-02-25T05:39:56.845Z", "cooked": "<p>Hi everyone,</p>\n<p>I’m working on a project where I need to extract readings from Blood Pressure and Glucose Machines using Machine Learning. These devices typically display values using 7-segment digits, which makes OCR challenging.</p>\n<p>What I’ve Tried So Far:</p>\n<ol>\n<li>Open-source OCR models (e.g., Hugging Face, Tesseract, EasyOCR) – but they struggle with 7-segment digits.</li>\n<li>Google Cloud Vision API – This gives much better accuracy, but the problem is:</li>\n</ol>\n<ul>\n<li>Different devices show varying amounts of information (e.g., time, date, previous readings, current readings, etc.).</li>\n<li>The API returns a long string, making it difficult to extract the specific readings I need.</li>\n</ul>\n<p>Additional Challenge:</p>\n<p>I also attempted to fine-tune an open-source AI model that accepts image data, but I couldn’t train it on Google Colab’s T4 GPU due to memory limitations.<br>\nNeed Help With:</p>\n<ol>\n<li>How can I accurately extract the correct values (e.g., systolic, diastolic, BPM, glucose level) from the text output of Cloud Vision API?</li>\n<li>Are there any efficient open-source models or techniques that handle 7-segment OCR better?</li>\n<li>Any recommendations on training an AI model on a lower-memory environment?</li>\n</ol>\n<p>I’d really appreciate any guidance or suggestions to overcome these issues. Thanks in advance!</p>", "post_number": 1, "post_type": 1, "posts_count": 9, "updated_at": "2025-02-25T05:39:56.845Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 45, "reads": 9, "readers_count": 8, "score": 231.8, "yours": false, "topic_id": 142783, "topic_slug": "help-needed-extracting-blood-pressure-glucose-readings-using-ml", "display_username": "MD Mehedi Hasan Sarkar", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 84908, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-needed-extracting-blood-pressure-glucose-readings-using-ml/142783/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 205137, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-02-25T07:56:51.953Z", "cooked": "<p>There also seem to be some lightweight methods that extract using image processing with OpenCV etc. without using ML, but how about trying out VLM, which is provided by Google, Microsoft, etc.?<br>\nThese models are relatively small, so training them doesn’t take as much resources as larger models.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/blog/paligemma\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/blog/paligemma\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/388;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/a/1/a1ba26dc467cdb98aa51ec074ceba18141e758c0_2_690x388.jpeg\" class=\"thumbnail\" data-dominant-color=\"EEEFE9\" width=\"690\" height=\"388\"></div>\n\n<h3><a href=\"https://huggingface.co/blog/paligemma\" target=\"_blank\" rel=\"noopener\">PaliGemma – Google's Cutting-Edge Open Vision Language Model</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n<aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/spaces?category=visual-qa\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/spaces?category=visual-qa\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/3/f/3f219d23b16d4a243a12070474512a6d6730c841.png\" class=\"thumbnail\" data-dominant-color=\"F1F1F1\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/spaces?category=visual-qa\" target=\"_blank\" rel=\"noopener\">Spaces - Hugging Face</a></h3>\n\n <p>Discover amazing ML apps made by the community</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 9, "updated_at": "2025-02-25T07:56:51.953Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 46.6, "yours": false, "topic_id": 142783, "topic_slug": "help-needed-extracting-blood-pressure-glucose-readings-using-ml", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/blog/paligemma", "internal": false, "reflection": false, "title": "PaliGemma – Google's Cutting-Edge Open Vision Language Model", "clicks": 3 }, { "url": "https://huggingface.co/spaces?category=visual-qa", "internal": false, "reflection": false, "title": "Spaces - Hugging Face", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-needed-extracting-blood-pressure-glucose-readings-using-ml/142783/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 205163, "name": "Simon Pagezy", "username": "pagezyhf", "avatar_template": "/user_avatar/discuss.huggingface.co/pagezyhf/{size}/29572_2.png", "created_at": "2025-02-25T09:42:27.986Z", "cooked": "<p>Hello,<br>\nthanks for your question!<br>\n+1 to <a class=\"mention\" href=\"/u/john6666\">@John6666</a> response.</p>\n<p>For a super quick prototype, I tried to search for famous vision language models available as serverless: <a href=\"https://huggingface.co/models?inference_provider=all&amp;pipeline_tag=image-text-to-text&amp;sort=trending\" class=\"inline-onebox\">Models - Hugging Face</a>.</p>\n<p>I gave a try with a few images like these: <a href=\"https://www.google.com/search?sca_esv=d03a084c8dceab01&amp;q=readings+from+Blood+Pressure+and+Glucose+Machines&amp;udm=2&amp;fbs=ABzOT_CWdhQLP1FcmU5B0fn3xuWpA-dk4wpBWOGsoR7DG5zJBtmuEdhfywyzhendkLDnhco1Jja6WgaV8JNR1doqqtW2S_5gb7QsW0uFi47Vo6C5a1esz_7kRiumVwvN5DVG98VdTTXyF04iHskep44P_Cv_DFMttOw3QEO_asNv_K9ktkm3sOM5xq8MvzGYiBRaj0f7CWta&amp;sa=X&amp;ved=2ahUKEwirypaww96LAxX6Q6QEHWTRDJcQtKgLegQIDhAB&amp;biw=1920&amp;bih=958&amp;dpr=2#vhid=5UXxTDdpuGmaCM&amp;vssid=mosaic\" class=\"inline-onebox\">readings from Blood Pressure and Glucose Machines - Google Search</a></p>\n<p>Qwen 2 VL got every value right. You can try with Qwen 2.5 VL too once available, or self-host it.</p>\n<p>No training needed</p>", "post_number": 3, "post_type": 1, "posts_count": 9, "updated_at": "2025-02-25T09:42:27.986Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 51.6, "yours": false, "topic_id": 142783, "topic_slug": "help-needed-extracting-blood-pressure-glucose-readings-using-ml", "display_username": "Simon Pagezy", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://www.google.com/search?sca_esv=d03a084c8dceab01&q=readings+from+Blood+Pressure+and+Glucose+Machines&udm=2&fbs=ABzOT_CWdhQLP1FcmU5B0fn3xuWpA-dk4wpBWOGsoR7DG5zJBtmuEdhfywyzhendkLDnhco1Jja6WgaV8JNR1doqqtW2S_5gb7QsW0uFi47Vo6C5a1esz_7kRiumVwvN5DVG98VdTTXyF04iHskep44P_Cv_DFMttOw3QEO_asNv_K9ktkm3sOM5xq8MvzGYiBRaj0f7CWta&sa=X&ved=2ahUKEwirypaww96LAxX6Q6QEHWTRDJcQtKgLegQIDhAB&biw=1920&bih=958&dpr=2#vhid=5UXxTDdpuGmaCM&vssid=mosaic", "internal": false, "reflection": false, "title": "readings from Blood Pressure and Glucose Machines - Google Search", "clicks": 3 }, { "url": "https://huggingface.co/models?inference_provider=all&pipeline_tag=image-text-to-text&sort=trending", "internal": false, "reflection": false, "title": "Models - Hugging Face", "clicks": 1 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 3 } ], "moderator": true, "admin": false, "staff": true, "user_id": 58546, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-needed-extracting-blood-pressure-glucose-readings-using-ml/142783/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 3 } ], "current_user_reaction": null, "reaction_users_count": 3, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 205995, "name": "MD Mehedi Hasan Sarkar", "username": "mhsarkar", "avatar_template": "/user_avatar/discuss.huggingface.co/mhsarkar/{size}/41917_2.png", "created_at": "2025-02-28T20:53:57.611Z", "cooked": "<p>Hi, Thanks for trying to help me. But when I wnat to run Qwen2-VL-2B / 3B/ 7B or others, there is some common problem I face is,</p>\n<pre><code class=\"lang-auto\">OutOfMemoryError: CUDA out of memory. Tried to allocate 230.66 GiB. GPU 0 has a total capacity of 39.56 GiB of which 3.03 GiB is free. Process 24867 has 36.52 GiB memory in use. Of the allocated memory 35.26 GiB is allocated by PyTorch, and 774.31 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True to avoid fragmentation. See documentation for Memory Management (https://pytorch.org/docs/stable/notes/cuda.html#environment-variables)\n</code></pre>\n<p>While I have used Colab Pro using a 40GB GPU. I have no idea how I can fix this. I do some optimization to save GPU. But nothing positive happened.</p>\n<p>Can you tell me how I can fix this issue or run this model on Colab?</p>", "post_number": 4, "post_type": 1, "posts_count": 9, "updated_at": "2025-02-28T20:53:57.611Z", "reply_count": 0, "reply_to_post_number": 3, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 16.4, "yours": false, "topic_id": 142783, "topic_slug": "help-needed-extracting-blood-pressure-glucose-readings-using-ml", "display_username": "MD Mehedi Hasan Sarkar", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 84908, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-needed-extracting-blood-pressure-glucose-readings-using-ml/142783/4", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 58546, "username": "pagezyhf", "name": "Simon Pagezy", "avatar_template": "/user_avatar/discuss.huggingface.co/pagezyhf/{size}/29572_2.png" }, "action_code": null, "via_email": null }, { "id": 206040, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-01T06:06:23.219Z", "cooked": "<p>Can you release the code for the model loading part?</p>\n<p>According to the error message, it seems that the program is trying to allocate about 230GB of VRAM, which is strange no matter how you look at it…<br>\nOr, are you loading the model itself multiple times in the loop?</p>", "post_number": 5, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-01T06:07:32.151Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 8, "readers_count": 7, "score": 21.6, "yours": false, "topic_id": 142783, "topic_slug": "help-needed-extracting-blood-pressure-glucose-readings-using-ml", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-needed-extracting-blood-pressure-glucose-readings-using-ml/142783/5", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206289, "name": "MD Mehedi Hasan Sarkar", "username": "mhsarkar", "avatar_template": "/user_avatar/discuss.huggingface.co/mhsarkar/{size}/41917_2.png", "created_at": "2025-03-02T16:15:18.308Z", "cooked": "<p>Here is the model loading part.</p>\n<pre><code class=\"lang-auto\"># Fix PyTorch &amp; torchvision CUDA mismatch\n!pip uninstall -y torch torchvision torchaudio\n!pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118\n\n# Install required libraries\n!pip install transformers accelerate peft safetensors\n!pip install openai qwen-vl\n\nimport torch\nfrom transformers import AutoProcessor, AutoModelForVision2Seq\n\n# Model name\nmodel_name = \"Qwen/Qwen2-VL-7B\"\n\n# Load processor (for handling both text and images)\nprocessor = AutoProcessor.from_pretrained(model_name)\n\n# Load model (correct model type for VL tasks)\nmodel = AutoModelForVision2Seq.from_pretrained(model_name, torch_dtype=torch.float16, device_map=\"auto\")\n\n# Move to GPU\nmodel.to(\"cuda\")\n\n</code></pre>\n<p>This model loading part runs on my GPU with around 15GB or less. However, when I provide an image for processing, I encounter a CUDA out-of-memory error.</p>\n<pre><code class=\"lang-auto\">def generate_text(prompt,image, max_new_tokens=1000):\n inputs = processor(images=image,text=prompt, return_tensors=\"pt\").to(\"cuda\")\n with torch.no_grad():\n output = model.generate(**inputs, max_new_tokens=max_new_tokens)\n return processor.batch_decode(output, skip_special_tokens=True)[0]\n\n\nfrom google.colab import files\nfrom PIL import Image\n\n# Upload image\nuploaded = files.upload()\nimage_path = list(uploaded.keys())[0]\n\n# Open &amp; resize image\nimage = Image.open(image_path)#.resize((512, 512)) # Reduce resolution\nprompt = \"describe and give me full reading from this picture!\"\noutput_text = generate_text(prompt, image)\n</code></pre>\n<p>Is any optimization needed to fix this issue?</p>", "post_number": 6, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-02T16:15:18.463Z", "reply_count": 0, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 2, "reads": 8, "readers_count": 7, "score": 26.6, "yours": false, "topic_id": 142783, "topic_slug": "help-needed-extracting-blood-pressure-glucose-readings-using-ml", "display_username": "MD Mehedi Hasan Sarkar", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 2, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 84908, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": "Automatically removed quote of whole previous post.", "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-needed-extracting-blood-pressure-glucose-readings-using-ml/142783/6", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 206312, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-02T19:33:25.347Z", "cooked": "<p>It seems that the error was probably just the result of forgetting to apply the Chat Template. The pipeline will handle all of that for you, but in many cases it is more memory efficient to do it manually.</p>\n<pre data-code-wrap=\"py\"><code class=\"lang-py\">import torch\nfrom transformers import AutoProcessor, AutoModelForVision2Seq\n\n# Model name\n#model_name = \"Qwen/Qwen2-VL-7B\"\nmodel_name = \"Qwen/Qwen2-VL-2B-Instruct\"\n# Load processor (for handling both text and images)\nprocessor = AutoProcessor.from_pretrained(model_name)\n# Load model (correct model type for VL tasks)\nmodel = AutoModelForVision2Seq.from_pretrained(model_name, torch_dtype=torch.float16, device_map=\"auto\")\n# Move to GPU\nmodel#.to(\"cuda\") # If you do this, there is no point in having device_map=“auto”, so delete one of them.\n\ndef generate_text(prompt, image, max_new_tokens=1000):\n import gc\n inputs = processor(images=[image], text=[prompt], return_tensors=\"pt\").to(\"cuda\")\n with torch.no_grad():\n output = model.generate(**inputs, max_new_tokens=max_new_tokens)\n # Clear GPU cache\n inputs.to(\"cpu\")\n del inputs\n gc.collect()\n torch.cuda.empty_cache()\n return processor.batch_decode(output, skip_special_tokens=True)[0]\n\n#from google.colab import files\nfrom PIL import Image\n\n# Upload image\n#uploaded = files.upload()\n#image_path = list(uploaded.keys())[0]\n\n# Open &amp; resize image\n#image = Image.open(image_path)#.resize((512, 512)) # Reduce resolution\n\nprompt = \"describe and give me full reading from this picture!\"\n\nimport requests\nfrom io import BytesIO\nurl = \"https://huggingface.co/qresearch/llama-3-vision-alpha-hf/resolve/main/assets/demo-2.jpg\"\nresponse = requests.get(url)\nimage = Image.open(BytesIO(response.content)).convert(\"RGB\")\nmessages = [{\"role\": \"user\", \"content\": [{\"type\": \"image\", \"image\": url}, {\"type\": \"text\", \"text\": prompt}]}]\ntext = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)\n\noutput_text = generate_text(text, image)\nprint(output_text)\n</code></pre>", "post_number": 7, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-02T19:33:25.347Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1, "reads": 8, "readers_count": 7, "score": 41.6, "yours": false, "topic_id": 142783, "topic_slug": "help-needed-extracting-blood-pressure-glucose-readings-using-ml", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-needed-extracting-blood-pressure-glucose-readings-using-ml/142783/7", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 }, { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206400, "name": "MD Mehedi Hasan Sarkar", "username": "mhsarkar", "avatar_template": "/user_avatar/discuss.huggingface.co/mhsarkar/{size}/41917_2.png", "created_at": "2025-03-03T06:11:37.125Z", "cooked": "<p>Thanks. This codebase resolves the issue. but upload image gets old error.</p>", "post_number": 8, "post_type": 1, "posts_count": 9, "updated_at": "2025-03-03T06:11:37.125Z", "reply_count": 0, "reply_to_post_number": 7, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 16.4, "yours": false, "topic_id": 142783, "topic_slug": "help-needed-extracting-blood-pressure-glucose-readings-using-ml", "display_username": "MD Mehedi Hasan Sarkar", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 84908, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-needed-extracting-blood-pressure-glucose-readings-using-ml/142783/8", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 52272, "username": "John6666", "name": "John Smith", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png" }, "action_code": null, "via_email": null }, { "id": 206551, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-03T18:12:02.495Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 9, "post_type": 3, "posts_count": 9, "updated_at": "2025-03-03T18:12:02.495Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 1.2, "yours": false, "topic_id": 142783, "topic_slug": "help-needed-extracting-blood-pressure-glucose-readings-using-ml", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/help-needed-extracting-blood-pressure-glucose-readings-using-ml/142783/9", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hi everyone,</p> <p>I’m working on a project where I need to extract readings from Blood Pressure and Glucose Machines using Machine Learning. These devices typically display values using 7-segment digits, which makes OCR challenging.</p> <p>What I’ve Tried So Far:</p> <ol> <li>Open-source OCR models (e.g., Hugging Face, Tesseract, EasyOCR) – but they struggle with 7-segment digits.</li> <li>Google Cloud Vision API – This gives much better accuracy, but the problem is:</li> </ol> <ul> <li>Different devices show varying amounts of information (e.g., time, date, previous readings, current readings, etc.).</li> <li>The API returns a long string, making it difficult to extract the specific readings I need.</li> </ul> <p>Additional Challenge:</p> <p>I also attempted to fine-tune an open-source AI model that accepts image data, but I couldn’t train it on Google Colab’s T4 GPU due to memory limitations.<br> Need Help With:</p> <ol> <li>How can I accurately extract the correct values (e.g., systolic, diastolic, BPM, glucose level) from the text output of Cloud Vision API?</li> <li>Are there any efficient open-source models or techniques that handle 7-segment OCR better?</li> <li>Any recommendations on training an AI model on a lower-memory environment?</li> </ol> <p>I’d really appreciate any guidance or suggestions to overcome these issues. Thanks in advance!</p>
<p>It seems that the error was probably just the result of forgetting to apply the Chat Template. The pipeline will handle all of that for you, but in many cases it is more memory efficient to do it manually.</p> <pre data-code-wrap="py"><code class="lang-py">import torch from transformers import AutoProcessor, AutoModelForVision2Seq # Model name #model_name = "Qwen/Qwen2-VL-7B" model_name = "Qwen/Qwen2-VL-2B-Instruct" # Load processor (for handling both text and images) processor = AutoProcessor.from_pretrained(model_name) # Load model (correct model type for VL tasks) model = AutoModelForVision2Seq.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto") # Move to GPU model#.to("cuda") # If you do this, there is no point in having device_map=“auto”, so delete one of them. def generate_text(prompt, image, max_new_tokens=1000): import gc inputs = processor(images=[image], text=[prompt], return_tensors="pt").to("cuda") with torch.no_grad(): output = model.generate(**inputs, max_new_tokens=max_new_tokens) # Clear GPU cache inputs.to("cpu") del inputs gc.collect() torch.cuda.empty_cache() return processor.batch_decode(output, skip_special_tokens=True)[0] #from google.colab import files from PIL import Image # Upload image #uploaded = files.upload() #image_path = list(uploaded.keys())[0] # Open &amp; resize image #image = Image.open(image_path)#.resize((512, 512)) # Reduce resolution prompt = "describe and give me full reading from this picture!" import requests from io import BytesIO url = "https://huggingface.co/qresearch/llama-3-vision-alpha-hf/resolve/main/assets/demo-2.jpg" response = requests.get(url) image = Image.open(BytesIO(response.content)).convert("RGB") messages = [{"role": "user", "content": [{"type": "image", "image": url}, {"type": "text", "text": prompt}]}] text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) output_text = generate_text(text, image) print(output_text) </code></pre>
Add additional conditioning info
https://discuss.huggingface.co/t/add-additional-conditioning-info/30195
30,195
63
2023-01-23T02:25:37.962000Z
[ { "id": 55472, "name": "James Maxwell", "username": "jbmaxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png", "created_at": "2023-01-23T02:25:38.031Z", "cooked": "<p>Hi All,</p>\n<p>Does anybody have any guidance as to how/where to add further conditioning info to the HF stable diffusion training/inference pipelines? Everything I’ve read about stable diffusion seems to suggest that multiple different types of conditioning should be possible, but I’m not sure how to integrate it. Since the text embeddings are integrated using self-attention I feel like it should probably be added there, but how? Would I concatenate it to the text embeddings, for example?</p>\n<p>Any thoughts appreciated.</p>", "post_number": 1, "post_type": 1, "posts_count": 22, "updated_at": "2023-01-23T02:25:38.031Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 6510, "reads": 118, "readers_count": 117, "score": 32478.6, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "James Maxwell", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 4235, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/1", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 55665, "name": "Pedro Cuenca", "username": "pcuenq", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png", "created_at": "2023-01-24T11:12:21.725Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/jbmaxwell\">@jbmaxwell</a>! That’s an excellent question.</p>\n<p>The easiest way, I think, would be to leverage the <code>UNet2DConditionModel</code> and indicate <a href=\"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L123\" rel=\"noopener nofollow ugc\">here</a> that you’ll be using custom class embeddings. Similar to what you suspected, these embeddings are simply <a href=\"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L88-L89\" rel=\"noopener nofollow ugc\">added to the timestep embeddings</a>. If you use the <code>\"timestep\"</code> <code>class_embed_type</code>, for example, then you need to <a href=\"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L398\" rel=\"noopener nofollow ugc\">pass your custom class labels</a> during the <code>forward</code> pass and then those values are <a href=\"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L464-L472\" rel=\"noopener nofollow ugc\">passed through an embedding layer and added to the timestep embeddings</a>.</p>\n<p>I hope that’s enough to get you started! Please, do share if it works as well as what you are trying to achieve (if you can make it public).</p>", "post_number": 2, "post_type": 1, "posts_count": 22, "updated_at": "2023-01-24T11:12:21.725Z", "reply_count": 4, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 110, "reads": 112, "readers_count": 111, "score": 652.4, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "Pedro Cuenca", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L123", "internal": false, "reflection": false, "title": "diffusers/unet_2d_condition.py at main · huggingface/diffusers · GitHub", "clicks": 324 }, { "url": "https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L88-L89", "internal": false, "reflection": false, "title": "diffusers/unet_2d_condition.py at main · huggingface/diffusers · GitHub", "clicks": 132 }, { "url": "https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L398", "internal": false, "reflection": false, "title": "diffusers/unet_2d_condition.py at main · huggingface/diffusers · GitHub", "clicks": 115 }, { "url": "https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L464-L472", "internal": false, "reflection": false, "title": "diffusers/unet_2d_condition.py at main · huggingface/diffusers · GitHub", "clicks": 88 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 4 } ], "moderator": true, "admin": false, "staff": true, "user_id": 1758, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 3 }, { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 4, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 55718, "name": "James Maxwell", "username": "jbmaxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png", "created_at": "2023-01-24T16:22:31.971Z", "cooked": "<p>Excellent, thanks so much <a class=\"mention\" href=\"/u/pcuenq\">@pcuenq</a>!</p>", "post_number": 3, "post_type": 1, "posts_count": 22, "updated_at": "2023-01-24T16:22:31.971Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 16, "reads": 105, "readers_count": 104, "score": 101, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "James Maxwell", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 4235, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 1758, "username": "pcuenq", "name": "Pedro Cuenca", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png" }, "action_code": null, "via_email": null }, { "id": 56637, "name": "James Maxwell", "username": "jbmaxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png", "created_at": "2023-02-01T01:29:01.531Z", "cooked": "<p>Okay, I’ve got a bit further…</p>\n<p>I’ve trained a VQ-VAE to generate my conditioning embeddings, but I’m wondering whether I can/should pass the (integer) latent code straight in as my “custom class labels”, or if I should/must normalize them first? If I normalize them, is it (0,1), or (-1, 1), or… ? <img src=\"https://emoji.discourse-cdn.com/apple/slight_smile.png?v=12\" title=\":slight_smile:\" class=\"emoji\" alt=\":slight_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>Any help appreciated.</p>\n<p>—Oh!.. Also, this tensor contains duplicates. Should I remove duplicates? (My concern here is that it will change the shape…)</p>", "post_number": 4, "post_type": 1, "posts_count": 22, "updated_at": "2023-02-01T01:31:09.225Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 54, "reads": 101, "readers_count": 100, "score": 290.2, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "James Maxwell", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 4235, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 1758, "username": "pcuenq", "name": "Pedro Cuenca", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png" }, "action_code": null, "via_email": null }, { "id": 56736, "name": "James Maxwell", "username": "jbmaxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png", "created_at": "2023-02-01T16:08:40.908Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/pcuenq\">@pcuenq</a>, I’ve just come back to this to work on today and I think your links above have changed/moved—i.e., the code was maybe updated so they no longer point to the right lines. Just an fyi since the answer might be a bit confusing for future readers (I went through it the other day, so not a huge deal right away). Not sure if there’s a way to avoid this in future… ?</p>", "post_number": 5, "post_type": 1, "posts_count": 22, "updated_at": "2023-02-01T16:08:40.908Z", "reply_count": 1, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 54, "reads": 91, "readers_count": 90, "score": 293.2, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "James Maxwell", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 4235, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/5", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 1758, "username": "pcuenq", "name": "Pedro Cuenca", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png" }, "action_code": null, "via_email": null }, { "id": 56800, "name": "Pedro Cuenca", "username": "pcuenq", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png", "created_at": "2023-02-02T07:57:34.108Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/jbmaxwell\">@jbmaxwell</a>!</p>\n<p>You are right, I should have used a tag instead of <code>main</code>. Sorry about that.</p>\n<p>Since we last talked we’ve added optional class conditioning to <code>UNet2DModel</code>, in addition to what was available in <code>UNet2DConditionModel</code>. The difference is that <code>UNet2DModel</code> is simpler because it doesn’t use text conditioning (for text to image generation). So if you don’t need to train your model for text to image tasks, you can use <code>UNet2DModel</code> instead and training should be faster. <a href=\"https://github.com/huggingface/diffusers/pull/2080/files\" rel=\"noopener nofollow ugc\">This is the revision where that feature was added</a> – and it’s from the PR so it should outlive future changes in <code>main</code> :). You’d use it the same way we discussed:</p>\n<ul>\n<li>You select a class-conditioning embedding type when you create the UNet.</li>\n<li>You pass your custom class labels in the forward pass.</li>\n</ul>", "post_number": 6, "post_type": 1, "posts_count": 22, "updated_at": "2023-02-02T07:57:34.108Z", "reply_count": 1, "reply_to_post_number": 5, "quote_count": 0, "incoming_link_count": 28, "reads": 89, "readers_count": 88, "score": 207.8, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "Pedro Cuenca", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/diffusers/pull/2080/files", "internal": false, "reflection": false, "title": "Allow `UNet2DModel` to use arbitrary class embeddings by pcuenca · Pull Request #2080 · huggingface/diffusers · GitHub", "clicks": 108 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 3 } ], "moderator": true, "admin": false, "staff": true, "user_id": 1758, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/6", "reactions": [ { "id": "heart", "type": "emoji", "count": 3 } ], "current_user_reaction": null, "reaction_users_count": 3, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 4235, "username": "jbmaxwell", "name": "James Maxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png" }, "action_code": null, "via_email": null }, { "id": 56871, "name": "James Maxwell", "username": "jbmaxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png", "created_at": "2023-02-02T23:14:47.061Z", "cooked": "<p>This is great, thanks. I will be using both text and this new conditioning info (which I’ll pass via the class-conditioning mechanism), so I’ll stick with <code>UNet2DConditionModel</code>… But it’s cool that <code>UNet2DModel</code> has the option for class-conditioning now, so thanks for the heads-up!</p>", "post_number": 7, "post_type": 1, "posts_count": 22, "updated_at": "2023-02-02T23:14:47.061Z", "reply_count": 1, "reply_to_post_number": 6, "quote_count": 0, "incoming_link_count": 18, "reads": 80, "readers_count": 79, "score": 126, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "James Maxwell", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 4235, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/7", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 1758, "username": "pcuenq", "name": "Pedro Cuenca", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png" }, "action_code": null, "via_email": null }, { "id": 57500, "name": "James Maxwell", "username": "jbmaxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png", "created_at": "2023-02-09T20:54:05.847Z", "cooked": "<p>Hi again, <a class=\"mention\" href=\"/u/pcuenq\">@pcuenq</a>.</p>\n<p>I think I managed to run some training with my additional conditioning info, and now I’m trying to test inference. Is there a straightforward way to use the “class labels” during inference—i.e., in one of the pipelines? I didn’t see anything obvious, so I’ve been working on an adaptation of StableDiffusionPipeline to do it… But It thought I’d ask, in case there’s something simpler I can make use of.</p>\n<p>Thanks!</p>", "post_number": 8, "post_type": 1, "posts_count": 22, "updated_at": "2023-02-09T20:54:05.847Z", "reply_count": 1, "reply_to_post_number": 7, "quote_count": 0, "incoming_link_count": 24, "reads": 82, "readers_count": 81, "score": 131.4, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "James Maxwell", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 4235, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/8", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 4235, "username": "jbmaxwell", "name": "James Maxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png" }, "action_code": null, "via_email": null }, { "id": 57515, "name": "James Maxwell", "username": "jbmaxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png", "created_at": "2023-02-10T01:11:17.191Z", "cooked": "<p>Unfortunately, it seems like there’s a significant missing piece here.</p>\n<p>I thought I had trained on my data, with the class embeddings, but I don’t think I did. Stepping through the code, it looks like the class embeddings will be silently skipped if <code>class_embed_type</code> isn’t set (yes, you did mention this), but trying to set it manually I crash with the following error:</p>\n<pre><code class=\"lang-auto\">File \"/home/james/anaconda3/envs/riffusion/lib/python3.9/site-packages/torch/nn/modules/module.py\", line 987, in convert\n return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)\nNotImplementedError: Cannot copy out of meta tensor; no data!\n</code></pre>\n<p>I tried by both setting the class embedding type in the <code>config.json</code> and adding it when I instantiate the unet, as an argument to <code>from_pretrained()</code>, but I’m guessing maybe it fails because there are no weights in the <code>diffusion_pytorch_model.bin</code> for the class embeddings, so it can’t instantiate it.</p>\n<p>So perhaps I’m forced to train from scratch… which is actually fine, but how do I do that???</p>\n<hr>\n<p>Okay, I think I worked out a way to get started:</p>\n<pre><code class=\"lang-auto\">unet = UNet2DConditionModel(class_embed_type='timestep')\n</code></pre>\n<p>And I have a feeling this works, because I run out of CUDA memory when trying to process it with my embedding! <img src=\"https://emoji.discourse-cdn.com/apple/rofl.png?v=12\" title=\":rofl:\" class=\"emoji\" alt=\":rofl:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>(Fortunately I now have access to a bigger GPU, so I’ll give it a try on that…)</p>\n<p>But please let me know if there’s another (or a better) way!</p>\n<hr>\n<p>Another update. I had mistakenly assumed the unet was using the default values; adding the non-default values (from <code>config.json</code>) to the init got me further:</p>\n<pre><code class=\"lang-auto\">unet = UNet2DConditionModel(sample_size=64, cross_attention_dim=768, class_embed_type='timestep')\n</code></pre>\n<p>However, I’m running into problems with shapes when using the <code>timestep</code> type. I’ve been able to at least get the model training by using <code>identity</code>, then adding a block in the unet’s <code>forward</code> to adjust the shape of my custom conditioning embedding, like so:</p>\n<pre><code class=\"lang-auto\">class_emb = self.class_embedding(class_labels).to(dtype=self.dtype)\nif not class_emb.shape == emb.shape:\n emb_len = emb.nelement()\n cl_emb_len = class_emb.nelement()\n if cl_emb_len &gt; emb_len:\n # here we can only truncate\n class_emb = class_emb[:emb_len]\n else:\n # here we can repeat, pad, and reshape to match emb\n cl_emb_repeat = emb_len // cl_emb_len\n cl_em_pad_len = emb_len - (cl_emb_repeat * cl_emb_len)\n cl_em_pad = torch.zeros(cl_em_pad_len).to(emb.device)\n class_emb = class_emb.repeat(cl_emb_repeat)\n class_emb = torch.cat((class_emb, cl_em_pad), 0)\n class_emb = class_emb.reshape(emb.shape)\n \nemb = emb + class_emb\n</code></pre>\n<p>This at least allows me to use the <code>class_labels</code> argument to pass in my (non-class) custom conditioning embedding. If this is clearly a bad idea, any help would be greatly appreciated.</p>", "post_number": 9, "post_type": 1, "posts_count": 22, "updated_at": "2023-02-10T17:56:34.370Z", "reply_count": 1, "reply_to_post_number": 8, "quote_count": 0, "incoming_link_count": 87, "reads": 81, "readers_count": 80, "score": 496.2, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "James Maxwell", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 4, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 3 } ], "moderator": false, "admin": false, "staff": false, "user_id": 4235, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/9", "reactions": [ { "id": "heart", "type": "emoji", "count": 3 } ], "current_user_reaction": null, "reaction_users_count": 3, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 4235, "username": "jbmaxwell", "name": "James Maxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png" }, "action_code": null, "via_email": null }, { "id": 57708, "name": "James Maxwell", "username": "jbmaxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png", "created_at": "2023-02-12T18:46:16.084Z", "cooked": "<p>Okay, some real progress!</p>\n<p>I trained a model with this type of conditioning and it does seem to be working. However, although it’s difficult to say for certain, I seem to be getting less influence from my custom conditioning that I would like. Basically, the text seems to have much more impact than my conditioning, and I’m wondering how to balance things out.</p>\n<p>One thing I’d thought of was to move my conditioning from being added to the time embedding, <code>emb</code>, to being added to the text embedding, <code>encoder_hidden_states</code>, perhaps adding a parameter to adjust the “mix” of the two. I may try this anyway, but if anybody has any thoughts, please share.</p>\n<p>On that note, <a class=\"mention\" href=\"/u/pcuenq\">@pcuenq</a>, I realize I’m not really clear on the roles/functions of the time embedding and the text embedding. Intuitively, it seems to me that the time embedding is related to the basic task of generating <em>anything</em>, and impacts directly on the denoising process, whereas the text embedding is an additional feature used to kind of “focus” the generation in the latent space. Is that roughly correct?</p>", "post_number": 10, "post_type": 1, "posts_count": 22, "updated_at": "2023-02-12T18:46:51.498Z", "reply_count": 1, "reply_to_post_number": 9, "quote_count": 0, "incoming_link_count": 19, "reads": 71, "readers_count": 70, "score": 114.2, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "James Maxwell", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 4235, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/10", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 4235, "username": "jbmaxwell", "name": "James Maxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png" }, "action_code": null, "via_email": null }, { "id": 57766, "name": "Pedro Cuenca", "username": "pcuenq", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png", "created_at": "2023-02-13T11:05:15.253Z", "cooked": "<p>Hi <a class=\"mention\" href=\"/u/jbmaxwell\">@jbmaxwell</a>! Congrats on making progress on this task!</p>\n<p>I think your intuition is correct. The time embeddings provide a hint to the model about the step in the (de)noising process we are. Because timesteps are semantically related to one another (they follow a progression, so <code>4</code> is a time instance larger than <code>3</code> but smaller than <code>5</code>), they are encoded using a fancy method that tries to preserve that relationship - those are the sinusoidal embeddings that you’d probably have seen in the code.</p>\n<p>Depending on the nature of your additional conditioning, you may not need to capture a similar relationship on your data, and that’s probably why you didn’t see great results when using the <code>timestep</code> conditioning type, which applies the same sinusoidal method to your custom conditioning data.</p>\n<p>For example, if you were training a model to generate 5 different classes of objects, the numerical representations of those 5 categories do not bear any relationship with one another. In this case, you might want to explore the <code>None</code> <code>class_embed_type</code>, but indicate that your <code>num_class_embeds</code> is <code>5</code>. (<code>None</code> is probably not a good choice for this use-case, as it appears that only <code>timestep</code> or <code>identity</code> are supported, but it’s actually a <em>third</em> choice you can use). If you use this method, your model will learn to differentiate about those 5 categories, and then you can request to generate one of your desired subjects by supplying the class information at inference time.</p>\n<p>Let us know if that’s something that sounds useful for your project! <img src=\"https://emoji.discourse-cdn.com/apple/slight_smile.png?v=12\" title=\":slight_smile:\" class=\"emoji\" alt=\":slight_smile:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>", "post_number": 11, "post_type": 1, "posts_count": 22, "updated_at": "2023-02-13T11:05:15.253Z", "reply_count": 2, "reply_to_post_number": 10, "quote_count": 0, "incoming_link_count": 10, "reads": 70, "readers_count": 69, "score": 104, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "Pedro Cuenca", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": true, "admin": false, "staff": true, "user_id": 1758, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/11", "reactions": [ { "id": "heart", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 4235, "username": "jbmaxwell", "name": "James Maxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png" }, "action_code": null, "via_email": null }, { "id": 57857, "name": "James Maxwell", "username": "jbmaxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png", "created_at": "2023-02-13T22:11:56.375Z", "cooked": "<p>Thanks for the info. Very helpful!</p>", "post_number": 12, "post_type": 1, "posts_count": 22, "updated_at": "2023-02-13T22:11:56.375Z", "reply_count": 1, "reply_to_post_number": 11, "quote_count": 0, "incoming_link_count": 10, "reads": 62, "readers_count": 61, "score": 82.4, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "James Maxwell", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 4235, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/12", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 1758, "username": "pcuenq", "name": "Pedro Cuenca", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png" }, "action_code": null, "via_email": null }, { "id": 66594, "name": "pang", "username": "linpang", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/l/45deac/{size}.png", "created_at": "2023-04-25T23:55:48.979Z", "cooked": "<p>Hi, have you successfully made adding conditional embedding working ? if it works, do you mind to share the script? thank you.</p>", "post_number": 13, "post_type": 1, "posts_count": 22, "updated_at": "2023-04-25T23:55:48.979Z", "reply_count": 1, "reply_to_post_number": 12, "quote_count": 0, "incoming_link_count": 10, "reads": 58, "readers_count": 57, "score": 66.6, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "pang", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 16270, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/13", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 4235, "username": "jbmaxwell", "name": "James Maxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png" }, "action_code": null, "via_email": null }, { "id": 66597, "name": "pang", "username": "linpang", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/l/45deac/{size}.png", "created_at": "2023-04-26T00:09:43.741Z", "cooked": "<p>Hi, thanks for all of these discussions. I have one question: for the conditional text embedding, can I replace it as image embedding ( for instance, I would like to replace image A to the part of image B which is already generated without text input. ) Hope my question is clear.</p>", "post_number": 14, "post_type": 1, "posts_count": 22, "updated_at": "2023-04-26T00:09:43.741Z", "reply_count": 0, "reply_to_post_number": 11, "quote_count": 0, "incoming_link_count": 7, "reads": 58, "readers_count": 57, "score": 46.6, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "pang", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 16270, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/14", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 1758, "username": "pcuenq", "name": "Pedro Cuenca", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png" }, "action_code": null, "via_email": null }, { "id": 66599, "name": "James Maxwell", "username": "jbmaxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png", "created_at": "2023-04-26T00:28:33.517Z", "cooked": "<p>I did get a version of this to “work”, but the effect was pretty subtle. It did seem to do <em>something</em>, but not what I was after, and the result was overwhelmingly dominated by the text prompt… I don’t think I have the code for that anymore, as I re-wrote that script with a version that added to the text embedding—which was spectacularly bad, so I abandoned the effort. <img src=\"https://emoji.discourse-cdn.com/apple/joy.png?v=12\" title=\":joy:\" class=\"emoji\" alt=\":joy:\" loading=\"lazy\" width=\"20\" height=\"20\"></p>\n<p>You should have a look into ControlNet for what it sounds like you’re trying to do. I think there’s a ton of room for experimenting with different types of conditioning using that approach.</p>", "post_number": 15, "post_type": 1, "posts_count": 22, "updated_at": "2023-04-26T00:28:33.517Z", "reply_count": 1, "reply_to_post_number": 13, "quote_count": 0, "incoming_link_count": 9, "reads": 62, "readers_count": 61, "score": 77.4, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "James Maxwell", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 4235, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/15", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 16270, "username": "linpang", "name": "pang", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/l/45deac/{size}.png" }, "action_code": null, "via_email": null }, { "id": 66765, "name": "pang", "username": "linpang", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/l/45deac/{size}.png", "created_at": "2023-04-26T19:39:19.493Z", "cooked": "<p>Thank, I will read more and ask again if I have any more questions.</p>", "post_number": 16, "post_type": 1, "posts_count": 22, "updated_at": "2023-04-26T19:39:19.493Z", "reply_count": 0, "reply_to_post_number": 15, "quote_count": 0, "incoming_link_count": 7, "reads": 60, "readers_count": 59, "score": 47, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "pang", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 16270, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/16", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 4235, "username": "jbmaxwell", "name": "James Maxwell", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/5daacb/{size}.png" }, "action_code": null, "via_email": null }, { "id": 69744, "name": "barry chen", "username": "barry556652", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/b/b77776/{size}.png", "created_at": "2023-05-16T13:30:19.668Z", "cooked": "<p>Hello, I also have four different classes that I want to train. Here, my <code>num_class_embedds</code> is set to 4 and <code>class_embed_type</code> is set to None. However, I’m having trouble writing the <code>class_labels</code> , which is causing an error in the line <code>hidden_states = hidden_states + temb</code> . Can you please tell me how to create the <code>class_labels</code> ?</p>\n<p>This is my class_labels code<br>\ndef class_label_tensor(examples, is_train=True):</p>\n<pre><code> def class_tokenizer(text):\n class_names = [['C0201'], ['R0201'], ['L2016'], ['F1210']]\n class_label = text \n num_classes = len(class_names)\n class_vector = torch.zeros(num_classes, dtype=torch.int)\n class_index = class_names.index(class_label)\n class_vector[class_index] = 1\n class_tensor = class_vector.view(1, num_classes)\n return class_tensor\n \n captions = []\n for caption in examples[caption_column]:\n if isinstance(caption, str):\n captions.append(caption)\n elif isinstance(caption, (list, np.ndarray)):\n # take a random caption if there are multiple\n captions.append(random.choice(caption) if is_train else caption[0])\n else:\n raise ValueError(\n f\"Caption column `{caption_column}` should contain either strings or lists of strings.\"\n )\n label_tensor = class_tokenizer(captions)\n return label_tensor\n</code></pre>\n<p>I always get <strong>RuntimeError: The size of tensor a (64) must match the size of tensor b (320) at non-singleton dimension 4</strong>in my case.</p>\n<p>Thx!</p>", "post_number": 17, "post_type": 1, "posts_count": 22, "updated_at": "2023-05-16T13:30:19.668Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 14, "reads": 57, "readers_count": 56, "score": 81.4, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "barry chen", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 15951, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/17", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 90137, "name": "Aditya Prakash", "username": "Meghnad", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/m/7ea924/{size}.png", "created_at": "2023-09-17T15:29:34.387Z", "cooked": "<p><a class=\"mention\" href=\"/u/pcuenq\">@pcuenq</a> I am trying to make an EEG to Image model, my EEG encoder is a separate model and I intend to use Stable Diffusion without text conditioning, the idea is I’ll map the EEGs to their corresponding images. Would you please guide me in this regard, where and how do I attach this encoder model?</p>", "post_number": 18, "post_type": 1, "posts_count": 22, "updated_at": "2023-09-17T15:29:34.387Z", "reply_count": 1, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 10, "reads": 47, "readers_count": 46, "score": 79.4, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "Aditya Prakash", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 29153, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/18", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 1758, "username": "pcuenq", "name": "Pedro Cuenca", "avatar_template": "/user_avatar/discuss.huggingface.co/pcuenq/{size}/32135_2.png" }, "action_code": null, "via_email": null }, { "id": 114083, "name": "Mehmet Ali Özer", "username": "maliozer", "avatar_template": "/user_avatar/discuss.huggingface.co/maliozer/{size}/23902_2.png", "created_at": "2024-02-16T00:22:09.171Z", "cooked": "<p>how about added_cond_kwargs , can we pass the embeddings we have to make another condition here what do you think ?</p>\n<aside class=\"onebox githubblob\" data-onebox-src=\"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_2d_condition.py#L852\">\n <header class=\"source\">\n\n <a href=\"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_2d_condition.py#L852\" target=\"_blank\" rel=\"noopener nofollow ugc\">github.com</a>\n </header>\n\n <article class=\"onebox-body\">\n <h4><a href=\"https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_2d_condition.py#L852\" target=\"_blank\" rel=\"noopener nofollow ugc\">huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_2d_condition.py#L852</a></h4>\n\n\n\n <pre class=\"onebox\"><code class=\"lang-py\">\n <ol class=\"start lines\" start=\"842\" style=\"counter-reset: li-counter 841 ;\">\n <li></li>\n <li>def forward(</li>\n <li> self,</li>\n <li> sample: torch.FloatTensor,</li>\n <li> timestep: Union[torch.Tensor, float, int],</li>\n <li> encoder_hidden_states: torch.Tensor,</li>\n <li> class_labels: Optional[torch.Tensor] = None,</li>\n <li> timestep_cond: Optional[torch.Tensor] = None,</li>\n <li> attention_mask: Optional[torch.Tensor] = None,</li>\n <li> cross_attention_kwargs: Optional[Dict[str, Any]] = None,</li>\n <li class=\"selected\"> added_cond_kwargs: Optional[Dict[str, torch.Tensor]] = None,</li>\n <li> down_block_additional_residuals: Optional[Tuple[torch.Tensor]] = None,</li>\n <li> mid_block_additional_residual: Optional[torch.Tensor] = None,</li>\n <li> down_intrablock_additional_residuals: Optional[Tuple[torch.Tensor]] = None,</li>\n <li> encoder_attention_mask: Optional[torch.Tensor] = None,</li>\n <li> return_dict: bool = True,</li>\n <li>) -&gt; Union[UNet2DConditionOutput, Tuple]:</li>\n <li> r\"\"\"</li>\n <li> The [`UNet2DConditionModel`] forward method.</li>\n <li></li>\n <li> Args:</li>\n </ol>\n </code></pre>\n\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n\n<p><a class=\"mention\" href=\"/u/pcuenq\">@pcuenq</a></p>", "post_number": 19, "post_type": 1, "posts_count": 22, "updated_at": "2024-02-16T00:22:39.990Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 33, "reads": 39, "readers_count": 38, "score": 167.8, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "Mehmet Ali Özer", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unets/unet_2d_condition.py#L852", "internal": false, "reflection": false, "title": "diffusers/src/diffusers/models/unets/unet_2d_condition.py at main · huggingface/diffusers · GitHub", "clicks": 8 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 41136, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/19", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 139028, "name": "Reese Kneeland", "username": "reesekneeland", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/r/4bbf92/{size}.png", "created_at": "2024-06-20T19:29:07.174Z", "cooked": "<p>Hello, I’m curious if you ever made progress on this idea? I am looking to tackle a similar idea for fMRI, where I will train a new encoder (brain → embedding) end to end with the diffusion model that I am fine tuning to reconstruct the original image with my conditioning info. Let me know if you have any insights on this front.</p>", "post_number": 20, "post_type": 1, "posts_count": 22, "updated_at": "2024-06-20T19:29:07.174Z", "reply_count": 0, "reply_to_post_number": 18, "quote_count": 0, "incoming_link_count": 10, "reads": 25, "readers_count": 24, "score": 55, "yours": false, "topic_id": 30195, "topic_slug": "add-additional-conditioning-info", "display_username": "Reese Kneeland", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 54895, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/add-additional-conditioning-info/30195/20", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 29153, "username": "Meghnad", "name": "Aditya Prakash", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/m/7ea924/{size}.png" }, "action_code": null, "via_email": null } ]
<p>Hi All,</p> <p>Does anybody have any guidance as to how/where to add further conditioning info to the HF stable diffusion training/inference pipelines? Everything I’ve read about stable diffusion seems to suggest that multiple different types of conditioning should be possible, but I’m not sure how to integrate it. Since the text embeddings are integrated using self-attention I feel like it should probably be added there, but how? Would I concatenate it to the text embeddings, for example?</p> <p>Any thoughts appreciated.</p>
<p>Hi <a class="mention" href="/u/jbmaxwell">@jbmaxwell</a>! That’s an excellent question.</p> <p>The easiest way, I think, would be to leverage the <code>UNet2DConditionModel</code> and indicate <a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L123" rel="noopener nofollow ugc">here</a> that you’ll be using custom class embeddings. Similar to what you suspected, these embeddings are simply <a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L88-L89" rel="noopener nofollow ugc">added to the timestep embeddings</a>. If you use the <code>"timestep"</code> <code>class_embed_type</code>, for example, then you need to <a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L398" rel="noopener nofollow ugc">pass your custom class labels</a> during the <code>forward</code> pass and then those values are <a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/unet_2d_condition.py#L464-L472" rel="noopener nofollow ugc">passed through an embedding layer and added to the timestep embeddings</a>.</p> <p>I hope that’s enough to get you started! Please, do share if it works as well as what you are trying to achieve (if you can make it public).</p>
[Tokenizers]What this max_length number?
https://discuss.huggingface.co/t/tokenizers-what-this-max-length-number/28484
28,484
5
2022-12-27T02:30:17.023000Z
[ { "id": 53112, "name": "seonjong Yoo", "username": "Ssunbell", "avatar_template": "/user_avatar/discuss.huggingface.co/ssunbell/{size}/17521_2.png", "created_at": "2022-12-27T02:30:17.163Z", "cooked": "<p>When I called FastTokenizer, I could see the strange number of “model_max_length” as “1000000000000000019884624838656”. What is the meaning of the strange model max length?</p>\n<pre><code class=\"lang-auto\">from transformers import AutoTokenizer\nmodel_name = 'microsoft/mdeberta-v3-base'\n\ntokenizer = AutoTokenizer.from_pretrained(model_name)\nvars(tokenizer)\n</code></pre>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3.png\" data-download-href=\"/uploads/short-url/e3i0gb4nLeZTex76igfKIib8Yev.png?dl=1\" title=\"스크린샷 2022-12-27 오전 11.01.30\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3_2_690x316.png\" alt=\"스크린샷 2022-12-27 오전 11.01.30\" data-base62-sha1=\"e3i0gb4nLeZTex76igfKIib8Yev\" width=\"690\" height=\"316\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3_2_690x316.png, https://us1.discourse-cdn.com/hellohellohello/optimized/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3_2_1035x474.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3_2_1380x632.png 2x\" data-dominant-color=\"3A3939\"><div class=\"meta\">\n<svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">스크린샷 2022-12-27 오전 11.01.30</span><span class=\"informations\">2772×1272 359 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg>\n</div></a></div></p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2022-12-27T02:30:17.163Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 1978, "reads": 78, "readers_count": 77, "score": 9880.6, "yours": false, "topic_id": 28484, "topic_slug": "tokenizers-what-this-max-length-number", "display_username": "seonjong Yoo", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://us1.discourse-cdn.com/hellohellohello/original/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3.png", "internal": false, "reflection": false, "title": "627da761e13dfae0b4b87dd456554f4bd09e59a3.png", "clicks": 0 }, { "url": "https://discuss.huggingface.co/t/why-do-i-get-unboundlocalerror-local-variable-batch-idx-referenced-before-assignment-when-using-interleaved-data-sets-with-hugging-face-hf/69573/3", "internal": true, "reflection": true, "title": "Why do I get UnboundLocalError: local variable 'batch_idx' referenced before assignment when using interleaved data sets with Hugging Face (HF)?", "clicks": 0 } ], "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 13429, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/tokenizers-what-this-max-length-number/28484/1", "reactions": [ { "id": "heart", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 53125, "name": "Sylvain Gugger", "username": "sgugger", "avatar_template": "/user_avatar/discuss.huggingface.co/sgugger/{size}/2291_2.png", "created_at": "2022-12-27T07:19:44.954Z", "cooked": "<p>It’s just the largest integer in this precision, because this model does not have a max length.</p>", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2022-12-27T07:19:44.954Z", "reply_count": 1, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 13, "reads": 73, "readers_count": 72, "score": 144.6, "yours": false, "topic_id": 28484, "topic_slug": "tokenizers-what-this-max-length-number", "display_username": "Sylvain Gugger", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 4 } ], "moderator": false, "admin": false, "staff": false, "user_id": 6, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/tokenizers-what-this-max-length-number/28484/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 4 } ], "current_user_reaction": null, "reaction_users_count": 4, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 109119, "name": "Brando Miranda", "username": "brando", "avatar_template": "/user_avatar/discuss.huggingface.co/brando/{size}/30114_2.png", "created_at": "2024-01-18T23:32:50.442Z", "cooked": "<p>fyi this can happen for llama2-7b.</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2024-01-18T23:32:50.442Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 3, "reads": 41, "readers_count": 40, "score": 23.2, "yours": false, "topic_id": 28484, "topic_slug": "tokenizers-what-this-max-length-number", "display_username": "Brando Miranda", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 3664, "hidden": false, "trust_level": 2, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/tokenizers-what-this-max-length-number/28484/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206446, "name": "Ali keram", "username": "alikeram", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/a/d78d45/{size}.png", "created_at": "2025-03-03T10:20:17.940Z", "cooked": "<p>I see similar behavior for <code>mt5-large</code>. Does the model support inputs of any size?</p>", "post_number": 4, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-03T10:20:17.940Z", "reply_count": 0, "reply_to_post_number": 2, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 16.2, "yours": false, "topic_id": 28484, "topic_slug": "tokenizers-what-this-max-length-number", "display_username": "Ali keram", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 2507, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/tokenizers-what-this-max-length-number/28484/4", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": { "id": 6, "username": "sgugger", "name": "Sylvain Gugger", "avatar_template": "/user_avatar/discuss.huggingface.co/sgugger/{size}/2291_2.png" }, "action_code": null, "via_email": null } ]
<p>When I called FastTokenizer, I could see the strange number of “model_max_length” as “1000000000000000019884624838656”. What is the meaning of the strange model max length?</p> <pre><code class="lang-auto">from transformers import AutoTokenizer model_name = 'microsoft/mdeberta-v3-base' tokenizer = AutoTokenizer.from_pretrained(model_name) vars(tokenizer) </code></pre> <p><div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3.png" data-download-href="/uploads/short-url/e3i0gb4nLeZTex76igfKIib8Yev.png?dl=1" title="스크린샷 2022-12-27 오전 11.01.30" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3_2_690x316.png" alt="스크린샷 2022-12-27 오전 11.01.30" data-base62-sha1="e3i0gb4nLeZTex76igfKIib8Yev" width="690" height="316" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3_2_690x316.png, https://us1.discourse-cdn.com/hellohellohello/optimized/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3_2_1035x474.png 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/2X/6/627da761e13dfae0b4b87dd456554f4bd09e59a3_2_1380x632.png 2x" data-dominant-color="3A3939"><div class="meta"> <svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">스크린샷 2022-12-27 오전 11.01.30</span><span class="informations">2772×1272 359 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg> </div></a></div></p>
<p>It’s just the largest integer in this precision, because this model does not have a max length.</p>
Public archive of data for preservation
https://discuss.huggingface.co/t/public-archive-of-data-for-preservation/143567
143,567
10
2025-03-01T17:52:35.068000Z
[ { "id": 206144, "name": "Paul", "username": "pebxcvi", "avatar_template": "/user_avatar/discuss.huggingface.co/pebxcvi/{size}/52445_2.png", "created_at": "2025-03-01T17:52:35.126Z", "cooked": "<p>how much money do i need to be able to upload a 300GB public repo (could get to 450-500GB), archive of data for a preservation project? thousands? do i need to be a millionaire? do i need to have connections? start a business? what do i need to do?</p>\n<p><div class=\"lightbox-wrapper\"><a class=\"lightbox\" href=\"https://us1.discourse-cdn.com/hellohellohello/original/3X/1/a/1aae158ffdb7a44ea28a0e5089bb62f6bfda0eb6.jpeg\" data-download-href=\"/uploads/short-url/3O1o3mjwngcOTQQ9OzhbKM77vkG.jpeg?dl=1\" title=\"image\" rel=\"noopener nofollow ugc\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/a/1aae158ffdb7a44ea28a0e5089bb62f6bfda0eb6_2_517x249.jpeg\" alt=\"image\" data-base62-sha1=\"3O1o3mjwngcOTQQ9OzhbKM77vkG\" width=\"517\" height=\"249\" srcset=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/a/1aae158ffdb7a44ea28a0e5089bb62f6bfda0eb6_2_517x249.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/a/1aae158ffdb7a44ea28a0e5089bb62f6bfda0eb6_2_775x373.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/a/1aae158ffdb7a44ea28a0e5089bb62f6bfda0eb6_2_1034x498.jpeg 2x\" data-dominant-color=\"F8F9F8\"><div class=\"meta\"><svg class=\"fa d-icon d-icon-far-image svg-icon\" aria-hidden=\"true\"><use href=\"#far-image\"></use></svg><span class=\"filename\">image</span><span class=\"informations\">1920×924 139 KB</span><svg class=\"fa d-icon d-icon-discourse-expand svg-icon\" aria-hidden=\"true\"><use href=\"#discourse-expand\"></use></svg></div></a></div></p>\n<p>i just attempted to upload a 40GB folder with 75k files but it said “10000 file in directory limit + a rate limit” splitting the directories is not something i want to do.</p>", "post_number": 1, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-02T07:33:44.805Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 17, "reads": 8, "readers_count": 7, "score": 96.6, "yours": false, "topic_id": 143567, "topic_slug": "public-archive-of-data-for-preservation", "display_username": "Paul", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 60891, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/public-archive-of-data-for-preservation/143567/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206211, "name": "John Smith", "username": "John6666", "avatar_template": "/user_avatar/discuss.huggingface.co/john6666/{size}/27664_2.png", "created_at": "2025-03-02T04:07:47.447Z", "cooked": "<p>If you don’t mind using it in public, it’s free (best effort) to $9 per month. If you want to use it privately, it’s a little more expensive.</p><aside class=\"onebox allowlistedgeneric\" data-onebox-src=\"https://huggingface.co/docs/hub/storage-limits\">\n <header class=\"source\">\n\n <a href=\"https://huggingface.co/docs/hub/storage-limits\" target=\"_blank\" rel=\"noopener\">huggingface.co</a>\n </header>\n\n <article class=\"onebox-body\">\n <div class=\"aspect-image\" style=\"--aspect-ratio:690/372;\"><img src=\"https://us1.discourse-cdn.com/hellohellohello/optimized/3X/3/f/3f13c6d0ad455fac9516b1c7edd35fc94c89d63a_2_690x372.png\" class=\"thumbnail\" data-dominant-color=\"FAF8F2\" width=\"690\" height=\"372\"></div>\n\n<h3><a href=\"https://huggingface.co/docs/hub/storage-limits\" target=\"_blank\" rel=\"noopener\">Storage limits</a></h3>\n\n <p>We’re on a journey to advance and democratize artificial intelligence through open source and open science.</p>\n\n\n </article>\n\n <div class=\"onebox-metadata\">\n \n \n </div>\n\n <div style=\"clear: both\"></div>\n</aside>\n", "post_number": 2, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-03T14:28:43.637Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 1.4, "yours": false, "topic_id": 143567, "topic_slug": "public-archive-of-data-for-preservation", "display_username": "John Smith", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": [ { "url": "https://huggingface.co/docs/hub/storage-limits", "internal": false, "reflection": false, "title": "Storage limits", "clicks": 0 } ], "read": true, "user_title": "Regular", "bookmarked": false, "actions_summary": [], "moderator": false, "admin": false, "staff": false, "user_id": 52272, "hidden": false, "trust_level": 3, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/public-archive-of-data-for-preservation/143567/2", "reactions": [ { "id": "heart", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": false, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206248, "name": "Paul", "username": "pebxcvi", "avatar_template": "/user_avatar/discuss.huggingface.co/pebxcvi/{size}/52445_2.png", "created_at": "2025-03-02T10:04:40.608Z", "cooked": "<p>sorry, this was posted in fustration and also, to make aware that i might need more than 300GB up to 500GB. i sent an email.</p>\n<p>I gUeSs i WiLl SpLiT tHe fILeS Up by 0-9 A-F</p>\n<p>interestingly, a NAS’s file station does the exact opposite and has a folder limit of 10k folders.</p>\n<p>0 5449<br>\n1 5067<br>\n2 4825<br>\n3 4983<br>\n4 4871<br>\n5 4856<br>\n6 4802<br>\n7 4605<br>\n8 4817<br>\n9 4724<br>\nA 4473<br>\nB 4583<br>\nC 4637<br>\nD 4293<br>\nE 4314<br>\nF 4098</p>", "post_number": 3, "post_type": 1, "posts_count": 4, "updated_at": "2025-03-02T10:04:40.608Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 7, "readers_count": 6, "score": 31.4, "yours": false, "topic_id": 143567, "topic_slug": "public-archive-of-data-for-preservation", "display_username": "Paul", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 2 } ], "moderator": false, "admin": false, "staff": false, "user_id": 60891, "hidden": false, "trust_level": 0, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/public-archive-of-data-for-preservation/143567/3", "reactions": [ { "id": "+1", "type": "emoji", "count": 2 } ], "current_user_reaction": null, "reaction_users_count": 2, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206336, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-02T22:05:18.092Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 4, "post_type": 3, "posts_count": 4, "updated_at": "2025-03-02T22:05:18.092Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 6, "readers_count": 5, "score": 1.2, "yours": false, "topic_id": 143567, "topic_slug": "public-archive-of-data-for-preservation", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/public-archive-of-data-for-preservation/143567/4", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>how much money do i need to be able to upload a 300GB public repo (could get to 450-500GB), archive of data for a preservation project? thousands? do i need to be a millionaire? do i need to have connections? start a business? what do i need to do?</p> <p><div class="lightbox-wrapper"><a class="lightbox" href="https://us1.discourse-cdn.com/hellohellohello/original/3X/1/a/1aae158ffdb7a44ea28a0e5089bb62f6bfda0eb6.jpeg" data-download-href="/uploads/short-url/3O1o3mjwngcOTQQ9OzhbKM77vkG.jpeg?dl=1" title="image" rel="noopener nofollow ugc"><img src="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/a/1aae158ffdb7a44ea28a0e5089bb62f6bfda0eb6_2_517x249.jpeg" alt="image" data-base62-sha1="3O1o3mjwngcOTQQ9OzhbKM77vkG" width="517" height="249" srcset="https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/a/1aae158ffdb7a44ea28a0e5089bb62f6bfda0eb6_2_517x249.jpeg, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/a/1aae158ffdb7a44ea28a0e5089bb62f6bfda0eb6_2_775x373.jpeg 1.5x, https://us1.discourse-cdn.com/hellohellohello/optimized/3X/1/a/1aae158ffdb7a44ea28a0e5089bb62f6bfda0eb6_2_1034x498.jpeg 2x" data-dominant-color="F8F9F8"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1920×924 139 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p> <p>i just attempted to upload a 40GB folder with 75k files but it said “10000 file in directory limit + a rate limit” splitting the directories is not something i want to do.</p>
<p>sorry, this was posted in fustration and also, to make aware that i might need more than 300GB up to 500GB. i sent an email.</p> <p>I gUeSs i WiLl SpLiT tHe fILeS Up by 0-9 A-F</p> <p>interestingly, a NAS’s file station does the exact opposite and has a folder limit of 10k folders.</p> <p>0 5449<br> 1 5067<br> 2 4825<br> 3 4983<br> 4 4871<br> 5 4856<br> 6 4802<br> 7 4605<br> 8 4817<br> 9 4724<br> A 4473<br> B 4583<br> C 4637<br> D 4293<br> E 4314<br> F 4098</p>
HF accelerate DeepSpeed plugin does not use custom optimizer or scheduler
https://discuss.huggingface.co/t/hf-accelerate-deepspeed-plugin-does-not-use-custom-optimizer-or-scheduler/143459
143,459
18
2025-02-28T17:06:29.125000Z
[ { "id": 205969, "name": "Jean-Philippe Corbeil", "username": "jpcorb20", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/{size}.png", "created_at": "2025-02-28T17:06:29.177Z", "cooked": "<p>Hello,</p>\n<p>I am trying to launch the training of a large model in multi-node/multi-gpu setting with “accelerate” using DeepSpeed plugin (no DS config file) with 8-bit adam and LR cosine annealing scheduler. Yet, deepspeed doesn’t seem to use the 8-bit adam from BnB set in my python script but rather regular AdamW, while the documentation seems to indicate that this should work for custom optimizer/scheduler… Any idea what’s happening here? Is there a specific setup for this?</p>\n<p>thanks</p>", "post_number": 1, "post_type": 1, "posts_count": 3, "updated_at": "2025-02-28T17:06:29.177Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 34, "reads": 6, "readers_count": 5, "score": 171.2, "yours": false, "topic_id": 143459, "topic_slug": "hf-accelerate-deepspeed-plugin-does-not-use-custom-optimizer-or-scheduler", "display_username": "Jean-Philippe Corbeil", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 5347, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/hf-accelerate-deepspeed-plugin-does-not-use-custom-optimizer-or-scheduler/143459/1", "reactions": [ { "id": "eyes", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": false, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206138, "name": "Jean-Philippe Corbeil", "username": "jpcorb20", "avatar_template": "https://avatars.discourse-cdn.com/v4/letter/j/f4b2a3/{size}.png", "created_at": "2025-03-01T16:23:13.005Z", "cooked": "<p>looks like there is an implementation with the trainer by setting the training argument <code>optim=\"adam_bnb_8bit\"</code> and this way it works … Not sure why the custom instantiation is not working …</p>", "post_number": 2, "post_type": 1, "posts_count": 3, "updated_at": "2025-03-01T16:23:13.005Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 2, "reads": 5, "readers_count": 4, "score": 26, "yours": false, "topic_id": 143459, "topic_slug": "hf-accelerate-deepspeed-plugin-does-not-use-custom-optimizer-or-scheduler", "display_username": "Jean-Philippe Corbeil", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [ { "id": 2, "count": 1 } ], "moderator": false, "admin": false, "staff": false, "user_id": 5347, "hidden": false, "trust_level": 1, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/hf-accelerate-deepspeed-plugin-does-not-use-custom-optimizer-or-scheduler/143459/2", "reactions": [ { "id": "+1", "type": "emoji", "count": 1 } ], "current_user_reaction": null, "reaction_users_count": 1, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": true, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": null, "via_email": null }, { "id": 206216, "name": "system", "username": "system", "avatar_template": "https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png", "created_at": "2025-03-02T04:23:14.245Z", "cooked": "<p>This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.</p>", "post_number": 3, "post_type": 3, "posts_count": 3, "updated_at": "2025-03-02T04:23:14.245Z", "reply_count": 0, "reply_to_post_number": null, "quote_count": 0, "incoming_link_count": 0, "reads": 5, "readers_count": 4, "score": 1, "yours": false, "topic_id": 143459, "topic_slug": "hf-accelerate-deepspeed-plugin-does-not-use-custom-optimizer-or-scheduler", "display_username": "system", "primary_group_name": null, "flair_name": null, "flair_url": null, "flair_bg_color": null, "flair_color": null, "flair_group_id": null, "badges_granted": [], "version": 1, "can_edit": false, "can_delete": false, "can_recover": false, "can_see_hidden_post": false, "can_wiki": false, "link_counts": null, "read": true, "user_title": null, "bookmarked": false, "actions_summary": [], "moderator": true, "admin": true, "staff": true, "user_id": -1, "hidden": false, "trust_level": 4, "deleted_at": null, "user_deleted": false, "edit_reason": null, "can_view_edit_history": true, "wiki": false, "post_url": "/t/hf-accelerate-deepspeed-plugin-does-not-use-custom-optimizer-or-scheduler/143459/3", "reactions": [], "current_user_reaction": null, "reaction_users_count": 0, "current_user_used_main_reaction": false, "can_accept_answer": false, "can_unaccept_answer": false, "accepted_answer": false, "topic_accepted_answer": true, "can_vote": null, "title_is_group": null, "reply_to_user": null, "action_code": "autoclosed.enabled", "via_email": null } ]
<p>Hello,</p> <p>I am trying to launch the training of a large model in multi-node/multi-gpu setting with “accelerate” using DeepSpeed plugin (no DS config file) with 8-bit adam and LR cosine annealing scheduler. Yet, deepspeed doesn’t seem to use the 8-bit adam from BnB set in my python script but rather regular AdamW, while the documentation seems to indicate that this should work for custom optimizer/scheduler… Any idea what’s happening here? Is there a specific setup for this?</p> <p>thanks</p>
<p>looks like there is an implementation with the trainer by setting the training argument <code>optim="adam_bnb_8bit"</code> and this way it works … Not sure why the custom instantiation is not working …</p>