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

code snippets mismatch across different tasks #1243

Open
2 tasks
not-lain opened this issue Feb 28, 2025 · 1 comment
Open
2 tasks

code snippets mismatch across different tasks #1243

not-lain opened this issue Feb 28, 2025 · 1 comment

Comments

@not-lain
Copy link
Contributor

(mostly due to inputs needing to be replaced by text in the python client, but it's not limited to that)
here are some examples of some of my findings

  • text-classification
    this does not work
    Image
    as for the hub implementation
from huggingface_hub import InferenceClient

client = InferenceClient(
	provider="hf-inference",
+	model="ProsusAI/finbert",
+	provider="hf-inference",
	api_key="hf_xxxxxxxxxxxxxxxxxxxxxxxx"
)

result = client.text_classification(
-	model="ProsusAI/finbert",
-	inputs="I like you. I love you",
- 	provider="hf-inference",
+	text="I like you. I love you",
)

print(result)
  • translation
  • python
from huggingface_hub import InferenceClient

client = InferenceClient(
+	model="facebook/mbart-large-50-many-to-many-mmt",
	provider="hf-inference",
	api_key="hf_xxxxxxxxxxxxxxxxxxxxxxxx"
)

result = client.translation(
-	model="facebook/mbart-large-50-many-to-many-mmt",
-	inputs="Меня зовут Вольфганг и я живу в Берлине",
+ 	text ="Меня зовут Вольфганг и я живу в Берлине", 
+ 	src_lang="ru_RU",
+ 	tgt_lang ="en_XX"
-	provider="hf-inference",
)

print(result)
  • js
import { HfInference } from "@huggingface/inference";

const client = new HfInference("hf_xxxxxxxxxxxxxxxxxxxxxxxx");

const output = await client.translation({
    model: "facebook/mbart-large-50-many-to-many-mmt",
    provider: "hf-inference",
    inputs: "comment allez vous ?",
+    parameters: {
+        src_lang: "fr_XX",
+        tgt_lang: "en_XX"
+    }
});

console.log(output);
@coyotte508
Copy link
Member

cc @Wauplin for viz

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