Skip to content

Commit 4805fce

Browse files
authored
💚 No failing tests when external pull requests (#684)
1 parent 9a4d4e2 commit 4805fce

File tree

3 files changed

+33
-31
lines changed

3 files changed

+33
-31
lines changed

‎e2e/deno/index.ts‎

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,28 @@
11
import { HfInference } from "npm:@huggingface/inference@*";
22
import { whoAmI, listFiles } from "npm:@huggingface/hub@*";
33

4-
const token = Deno.env.get("HF_TOKEN");
5-
6-
if (!token) {
7-
console.error("Please set the HF_TOKEN environment variable.");
8-
Deno.exit(1);
9-
}
10-
114
const info = await whoAmI({ credentials: { accessToken: "hf_hub.js" }, hubUrl: "https://hub-ci.huggingface.co" });
125
console.log(info);
136

147
for await (const file of listFiles({ credentials: { accessToken: "hf_hub.js" }, repo: "gpt2" })) {
158
console.log(file);
169
}
1710

18-
const hf = new HfInference(token);
19-
20-
const tokenInfo = await whoAmI({ credentials: { accessToken: token } });
21-
console.log(tokenInfo);
22-
23-
const sum = await hf.summarization({
24-
model: "facebook/bart-large-cnn",
25-
inputs:
26-
"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.",
27-
parameters: {
28-
max_length: 100,
29-
},
30-
});
31-
32-
console.log(sum);
11+
const token = Deno.env.get("HF_TOKEN");
12+
if (token) {
13+
const hf = new HfInference(token);
14+
15+
const tokenInfo = await whoAmI({ credentials: { accessToken: token } });
16+
console.log(tokenInfo);
17+
18+
const sum = await hf.summarization({
19+
model: "facebook/bart-large-cnn",
20+
inputs:
21+
"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.",
22+
parameters: {
23+
max_length: 100,
24+
},
25+
});
26+
27+
console.log(sum);
28+
}

‎e2e/ts/src/index.ts‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ const hf = new HfInference(hfToken);
99
const info = await whoAmI({ credentials: { accessToken: "hf_hub.js" }, hubUrl: "https://hub-ci.huggingface.co" });
1010
console.log(info);
1111

12-
const sum = await hf.summarization({
13-
model: "facebook/bart-large-cnn",
14-
inputs:
15-
"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.",
16-
parameters: {
17-
max_length: 100,
18-
},
19-
});
12+
if (hfToken) {
13+
const sum = await hf.summarization({
14+
model: "facebook/bart-large-cnn",
15+
inputs:
16+
"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.",
17+
parameters: {
18+
max_length: 100,
19+
},
20+
});
2021

21-
console.log(sum);
22+
console.log(sum);
23+
}
2224
})();

‎packages/hub/src/index.ts‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ export type {
1818
SpaceStage,
1919
} from "./types/public";
2020
export { HubApiError, InvalidApiResponseFormatError } from "./error";
21+
/**
22+
* Only exported for E2Es convenience
23+
*/
24+
export { sha256 as __internal_sha256 } from "./utils/sha256";

0 commit comments

Comments
 (0)