Skip to content

Commit ed1af1f

Browse files
Merge branch 'main' into main
2 parents 827093f + 71aee92 commit ed1af1f

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

packages/tasks/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@huggingface/tasks",
33
"packageManager": "[email protected]",
4-
"version": "0.18.8",
4+
"version": "0.18.9",
55
"description": "List of ML tasks for huggingface.co/tasks",
66
"repository": "https://github.com/huggingface/huggingface.js.git",
77
"publishConfig": {

packages/tasks/src/model-libraries-snippets.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,23 @@ export const paddlenlp = (model: ModelData): string[] => {
681681
}
682682
};
683683

684+
export const perception_encoder = (model: ModelData): string[] => {
685+
const clip_model = `# Use PE-Core models as CLIP models
686+
import core.vision_encoder.pe as pe
687+
688+
model = pe.CLIP.from_config("${model.id}", pretrained=True)`;
689+
690+
const vision_encoder = `# Use any PE model as a vision encoder
691+
import core.vision_encoder.pe as pe
692+
693+
model = pe.VisionTransformer.from_config("${model.id}", pretrained=True)`;
694+
695+
if (model.id.includes("Core"))
696+
return [clip_model, vision_encoder];
697+
else
698+
return [vision_encoder];
699+
};
700+
684701
export const pyannote_audio_pipeline = (model: ModelData): string[] => [
685702
`from pyannote.audio import Pipeline
686703

packages/tasks/src/model-libraries.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
633633
filter: true,
634634
countDownloads: `path:"adapter_config.json"`,
635635
},
636+
"perception-encoder": {
637+
prettyLabel: "PerceptionEncoder",
638+
repoName: "PerceptionModels",
639+
repoUrl: "https://github.com/facebookresearch/perception_models",
640+
filter: false,
641+
snippets: snippets.perception_encoder,
642+
countDownloads: `path_extension:"pt"`,
643+
},
636644
pxia: {
637645
prettyLabel: "pxia",
638646
repoName: "pxia",

0 commit comments

Comments
 (0)