无法使拥抱face的/whoami端点工作。我正在使用curl,并在Authorization头中传递从UI中获得的令牌。
$ curl https://huggingface.co/api/whoami -H "Authorization: Bearer <token>"
> { "error": "Unauthorized" }同时,我可以使用相同的标记来获取私有模型。
$ curl https://huggingface.co/api/models/private/model -H "Authorization: Bearer <token>"
> {"id": "private/model", "modelId": "private/model", ...}我做错什么了吗?
发布于 2022-03-18 13:30:19
谢谢你提出这个!
端点被更新为whoami-v2,似乎我们错过了更新文档页面。下面是一个有用的例子
curl https://huggingface.co/api/whoami-v2 -H "Authorization: Bearer your_token"注意,如果有用的话,我们还有一个带有whoami方法的Python库。https://github.com/huggingface/huggingface_hub/tree/main/src/huggingface_hub
https://stackoverflow.com/questions/70932914
复制相似问题