Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide documentation for instructions to call a python function with named parameters #6

Open
mighty-phoenix opened this issue Jan 28, 2025 · 2 comments

Comments

@mighty-phoenix
Copy link

mighty-phoenix commented Jan 28, 2025

Could not download 'speaker-diarization-3.1' pipeline.
It might be because the pipeline is private or gated so make
sure to authenticate. Visit https://hf.co/settings/tokens to
create your access token and retry with:

   >>> Pipeline.from_pretrained('speaker-diarization-3.1',
   ...                          use_auth_token=YOUR_AUTH_TOKEN)

I tried several patterns and failed to figure how to call the function correctly. Here is the code I was trying:

// Assign speaker labels
const diarizeModel = this.whisperx.DiarizationPipeline("speaker-diarization-3.1", {use_auth_token: process.env.HF_TOKEN})

I also tried using kw to pass the use_auth_token param but still failed.

const diarizeModel = this.whisperx.DiarizationPipeline("speaker-diarization-3.1", kw`use_auth_token=${process.env.HF_TOKEN}`)

Quick advice would be highly appreciated.
Thanks!

@mighty-phoenix
Copy link
Author

@codehz

@codehz
Copy link
Owner

codehz commented Jan 28, 2025

try basic test code:

const { Test } = python.runModule(`
class Test:
  def test(self, *args, **kwargs):
    return all([len(args) == 3, "name" in kwargs])
`);
    const t = new Test();

    const d = python.dict({ a: 1, b: 2 });
    const v = t.test(1, 2, kw`name=${"vampire"}`, d);
    console.log(v)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants