api-inference-community icon indicating copy to clipboard operation
api-inference-community copied to clipboard

👷 Automatically dispatch tasks to hf.js

Open coyotte508 opened this issue 1 year ago • 7 comments

This will send a dispatch even to hf.js, where we need to create a matching action to receive the event with repository_dispatch: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch

This will allow us to automate updating https://github.com/huggingface/huggingface.js/blob/main/packages/tasks/src/library-to-tasks.ts (with an action that will open a PR to this file)

cc @pcuenca @mishig25 @osanseviero @julien-c

cc @Wauplin in case you might want that too for some reason

Migration

Set a REPO_DISPATCH_TOKEN secret, a PAT that has read/write & metadata on huggingface/huggingface.js

coyotte508 avatar Nov 28 '23 15:11 coyotte508

Thanks for the ping @coyotte508. We don't have a LIBRARY_TASK_MAPPING_EXCLUDING_TRANSFORMERS equivalent in Python but good to know :+1:

Wauplin avatar Nov 28 '23 15:11 Wauplin

This dispatch thing looks really cool! I haven't used this feature but the code seems reasonable.

xianbaoqian avatar Dec 05 '23 11:12 xianbaoqian

@glegendre01 now that the PR is approved can you handle that please :pray: ?

Set a REPO_DISPATCH_TOKEN secret, a PAT that has read/write & metadata on huggingface/huggingface.js

(don't have admin access on the repo and we probably want a token from machineuser)

coyotte508 avatar Dec 05 '23 12:12 coyotte508

@coyotte508, secret created. can you test it ?

glegendre01 avatar Dec 05 '23 15:12 glegendre01

@julien-c fair point; let's pause this PR as a bunch of this might be unneeded in a couple of weeks and this is mostly to update a .ts file that does not change very often (just when a new task is added in this API)

osanseviero avatar Dec 05 '23 15:12 osanseviero

ok for the record @glegendre01 the token works (reran job with :heavy_check_mark:)

coyotte508 avatar Dec 05 '23 16:12 coyotte508

ok, keep me informed if we need to clean up the token finally

glegendre01 avatar Dec 05 '23 17:12 glegendre01