-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
💚 No failing tests when external pull requests (#684)
- Loading branch information
1 parent
9a4d4e2
commit 4805fce
Showing
3 changed files
with
33 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
import { HfInference } from "npm:@huggingface/inference@*"; | ||
import { whoAmI, listFiles } from "npm:@huggingface/hub@*"; | ||
|
||
const token = Deno.env.get("HF_TOKEN"); | ||
|
||
if (!token) { | ||
console.error("Please set the HF_TOKEN environment variable."); | ||
Deno.exit(1); | ||
} | ||
|
||
const info = await whoAmI({ credentials: { accessToken: "hf_hub.js" }, hubUrl: "https://hub-ci.huggingface.co" }); | ||
console.log(info); | ||
|
||
for await (const file of listFiles({ credentials: { accessToken: "hf_hub.js" }, repo: "gpt2" })) { | ||
console.log(file); | ||
} | ||
|
||
const hf = new HfInference(token); | ||
|
||
const tokenInfo = await whoAmI({ credentials: { accessToken: token } }); | ||
console.log(tokenInfo); | ||
|
||
const sum = await hf.summarization({ | ||
model: "facebook/bart-large-cnn", | ||
inputs: | ||
"The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930.", | ||
parameters: { | ||
max_length: 100, | ||
}, | ||
}); | ||
|
||
console.log(sum); | ||
const token = Deno.env.get("HF_TOKEN"); | ||
if (token) { | ||
const hf = new HfInference(token); | ||
|
||
const tokenInfo = await whoAmI({ credentials: { accessToken: token } }); | ||
console.log(tokenInfo); | ||
|
||
const sum = await hf.summarization({ | ||
model: "facebook/bart-large-cnn", | ||
inputs: | ||
"The tower is 324 metres (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 metres (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930.", | ||
parameters: { | ||
max_length: 100, | ||
}, | ||
}); | ||
|
||
console.log(sum); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters