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

Multi-input, multi-mask calls to the fill_mask endpoint are not supported. #3

Closed
Kardbord opened this issue Feb 20, 2022 · 0 comments
Closed
Labels
wontfix This will not be worked on

Comments

@Kardbord
Copy link
Owner

The Issue

hfapigo calls to fill_mask endpoints do not support multi-input, multi-mask arguments. Supported arguments are multi-input or multi-mask, but not both at the same time.

To be clear, some HuggingFace models do support these calls, but this library does not.

For example, the following calls are supported by this library.

// Supported
hfapigo.SendFillMaskRequest(hfapigo.RecommendedFillMaskModel, &hfapigo.FillMaskRequest{
	Inputs:  [
		"The answer to life, the universe, and everything is [MASK].",
        ],
})

// Supported
hfapigo.SendFillMaskRequest(hfapigo.RecommendedFillMaskModel, &hfapigo.FillMaskRequest{
	Inputs:  [
		"The answer to life, the universe, and everything is [MASK].",
		"So long, and thanks for all the [MASK].",
        ],
})

// Supported
hfapigo.SendFillMaskRequest(hfapigo.RecommendedFillMaskModel, &hfapigo.FillMaskRequest{
	Inputs:  [
		"The answer to life, the [MASK], and everything is [MASK].",
        ],
})

And the following calls are not supported by this library.

// NOT Supported
hfapigo.SendFillMaskRequest(hfapigo.RecommendedFillMaskModel, &hfapigo.FillMaskRequest{
	Inputs:  [
		"The answer to life, the [MASK], and everything is [MASK].",
                "So [MASK] and thanks for all the [MASK]",
        ],
})

// NOT Supported
hfapigo.SendFillMaskRequest(hfapigo.RecommendedFillMaskModel, &hfapigo.FillMaskRequest{
	Inputs:  [
		"The answer to life, the [MASK], and everything is [MASK].",
                "The answer to life, the [MASK], and everything is 42.",
        ],
})

The reason these types of calls are not supported is that it quickly becomes non-trivial to deduce the structure of the response. I'm sure it is possible, but I don't foresee myself having time to work on this in the near future.

Workaround

If you need to make a call of this type to the API, you can build your FillMaskRequest and manually make the call to MakeHFAPIRequest, which will give you the appropriate JSON response. From there it is up to you to deduce the structure of the returned JSON and unmarshal it.

@Kardbord Kardbord added the wontfix This will not be worked on label Feb 20, 2022
@Kardbord Kardbord pinned this issue Apr 7, 2023
@Kardbord Kardbord closed this as completed Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant