Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions packages/tasks/src/model-libraries-snippets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1535,6 +1535,23 @@ image = sana(
) `,
];

export const videoprism = (model: ModelData): string[] => [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If each model is in its own repo, then you can use model.id in the snippet to get the model name and retrieve the weights.

`# Install from https://github.com/google-deepmind/videoprism
import jax
import jax.numpy as jnp
from videoprism import models as vp

# Models available: ['videoprism_public_v1_base_hf', 'videoprism_public_v1_large_hf']
MODEL_NAME = 'videoprism_public_v1_base_hf'

flax_model = vp.MODELS[MODEL_NAME]()
loaded_state = vp.load_pretrained_weights(MODEL_NAME)

@jax.jit
def forward_fn(inputs, train=False):
return flax_model.apply(loaded_state, inputs, train=train)`,
];

export const vfimamba = (model: ModelData): string[] => [
`from Trainer_finetune import Model

Expand Down
7 changes: 7 additions & 0 deletions packages/tasks/src/model-libraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
countDownloads: `path_extension:"pth"`,
snippets: snippets.sana,
},
"videoprism": {
prettyLabel: "VideoPrism",
repoName: "VideoPrism",
repoUrl: "https://github.com/google-deepmind/videoprism",
countDownloads: `path_extension:"npz"`,
snippets: snippets.videoprism,
},
"vfi-mamba": {
prettyLabel: "VFIMamba",
repoName: "VFIMamba",
Expand Down
Loading