@huggingface/tasks 0.19.3 → 0.19.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/gguf.d.ts +48 -4
- package/dist/commonjs/gguf.d.ts.map +1 -1
- package/dist/commonjs/gguf.js +138 -8
- package/dist/commonjs/model-libraries-snippets.d.ts +3 -0
- package/dist/commonjs/model-libraries-snippets.d.ts.map +1 -1
- package/dist/commonjs/model-libraries-snippets.js +68 -8
- package/dist/commonjs/model-libraries.d.ts +24 -1
- package/dist/commonjs/model-libraries.d.ts.map +1 -1
- package/dist/commonjs/model-libraries.js +23 -0
- package/dist/commonjs/tasks/index.js +1 -1
- package/dist/esm/gguf.d.ts +48 -4
- package/dist/esm/gguf.d.ts.map +1 -1
- package/dist/esm/gguf.js +136 -7
- package/dist/esm/model-libraries-snippets.d.ts +3 -0
- package/dist/esm/model-libraries-snippets.d.ts.map +1 -1
- package/dist/esm/model-libraries-snippets.js +63 -6
- package/dist/esm/model-libraries.d.ts +24 -1
- package/dist/esm/model-libraries.d.ts.map +1 -1
- package/dist/esm/model-libraries.js +23 -0
- package/dist/esm/tasks/index.js +1 -1
- package/package.json +1 -2
- package/src/gguf.ts +154 -9
- package/src/model-libraries-snippets.ts +68 -6
- package/src/model-libraries.ts +23 -0
- package/src/tasks/index.ts +1 -1
- package/src/tasks/reinforcement-learning/about.md +1 -1
|
@@ -237,6 +237,20 @@ output = model.generate(text)
|
|
|
237
237
|
sf.write("simple.mp3", output, 44100)`,
|
|
238
238
|
];
|
|
239
239
|
|
|
240
|
+
export const describe_anything = (model: ModelData): string[] => [
|
|
241
|
+
`# pip install git+https://github.com/NVlabs/describe-anything
|
|
242
|
+
from huggingface_hub import snapshot_download
|
|
243
|
+
from dam import DescribeAnythingModel
|
|
244
|
+
|
|
245
|
+
snapshot_download(${model.id}, local_dir="checkpoints")
|
|
246
|
+
|
|
247
|
+
dam = DescribeAnythingModel(
|
|
248
|
+
model_path="checkpoints",
|
|
249
|
+
conv_mode="v1",
|
|
250
|
+
prompt_mode="focal_prompt",
|
|
251
|
+
)`,
|
|
252
|
+
];
|
|
253
|
+
|
|
240
254
|
const diffusersDefaultPrompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k";
|
|
241
255
|
|
|
242
256
|
const diffusers_default = (model: ModelData) => [
|
|
@@ -727,6 +741,17 @@ model = pe.VisionTransformer.from_config("${model.id}", pretrained=True)`;
|
|
|
727
741
|
return [vision_encoder];
|
|
728
742
|
}
|
|
729
743
|
};
|
|
744
|
+
export const phantom_wan = (model: ModelData): string[] => [
|
|
745
|
+
`from huggingface_hub import snapshot_download
|
|
746
|
+
from phantom_wan import WANI2V, configs
|
|
747
|
+
|
|
748
|
+
checkpoint_dir = snapshot_download("${model.id}")
|
|
749
|
+
wan_i2v = WanI2V(
|
|
750
|
+
config=configs.WAN_CONFIGS['i2v-14B'],
|
|
751
|
+
checkpoint_dir=checkpoint_dir,
|
|
752
|
+
)
|
|
753
|
+
video = wan_i2v.generate(text_prompt, image_prompt)`,
|
|
754
|
+
];
|
|
730
755
|
|
|
731
756
|
export const pyannote_audio_pipeline = (model: ModelData): string[] => [
|
|
732
757
|
`from pyannote.audio import Pipeline
|
|
@@ -1117,13 +1142,31 @@ export const transformers = (model: ModelData): string[] => {
|
|
|
1117
1142
|
}
|
|
1118
1143
|
|
|
1119
1144
|
if (model.pipeline_tag && LIBRARY_TASK_MAPPING.transformers?.includes(model.pipeline_tag)) {
|
|
1120
|
-
const pipelineSnippet = [
|
|
1145
|
+
const pipelineSnippet = [
|
|
1146
|
+
"# Use a pipeline as a high-level helper",
|
|
1147
|
+
"from transformers import pipeline",
|
|
1148
|
+
"",
|
|
1149
|
+
`pipe = pipeline("${model.pipeline_tag}", model="${model.id}"` + remote_code_snippet + ")",
|
|
1150
|
+
];
|
|
1121
1151
|
|
|
1122
|
-
if (model.tags.includes("conversational")
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1152
|
+
if (model.tags.includes("conversational")) {
|
|
1153
|
+
if (model.tags.includes("image-text-to-text")) {
|
|
1154
|
+
pipelineSnippet.push(
|
|
1155
|
+
"messages = [",
|
|
1156
|
+
[
|
|
1157
|
+
" {",
|
|
1158
|
+
' "role": "user",',
|
|
1159
|
+
' "content": [',
|
|
1160
|
+
' {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},',
|
|
1161
|
+
' {"type": "text", "text": "What animal is on the candy?"}',
|
|
1162
|
+
" ]",
|
|
1163
|
+
" },",
|
|
1164
|
+
].join("\n"),
|
|
1165
|
+
"]"
|
|
1166
|
+
);
|
|
1167
|
+
} else {
|
|
1168
|
+
pipelineSnippet.push("messages = [", ' {"role": "user", "content": "Who are you?"},', "]");
|
|
1169
|
+
}
|
|
1127
1170
|
pipelineSnippet.push("pipe(messages)");
|
|
1128
1171
|
}
|
|
1129
1172
|
|
|
@@ -1482,4 +1525,23 @@ export const hezar = (model: ModelData): string[] => [
|
|
|
1482
1525
|
|
|
1483
1526
|
model = Model.load("${model.id}")`,
|
|
1484
1527
|
];
|
|
1528
|
+
|
|
1529
|
+
export const zonos = (model: ModelData): string[] => [
|
|
1530
|
+
`# pip install git+https://github.com/Zyphra/Zonos.git
|
|
1531
|
+
import torchaudio
|
|
1532
|
+
from zonos.model import Zonos
|
|
1533
|
+
from zonos.conditioning import make_cond_dict
|
|
1534
|
+
|
|
1535
|
+
model = Zonos.from_pretrained("${model.id}", device="cuda")
|
|
1536
|
+
|
|
1537
|
+
wav, sr = torchaudio.load("speaker.wav") # 5-10s reference clip
|
|
1538
|
+
speaker = model.make_speaker_embedding(wav, sr)
|
|
1539
|
+
|
|
1540
|
+
cond = make_cond_dict(text="Hello, world!", speaker=speaker, language="en-us")
|
|
1541
|
+
codes = model.generate(model.prepare_conditioning(cond))
|
|
1542
|
+
|
|
1543
|
+
audio = model.autoencoder.decode(codes)[0].cpu()
|
|
1544
|
+
torchaudio.save("sample.wav", audio, model.autoencoder.sampling_rate)
|
|
1545
|
+
`,
|
|
1546
|
+
];
|
|
1485
1547
|
//#endregion
|
package/src/model-libraries.ts
CHANGED
|
@@ -230,6 +230,13 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
230
230
|
filter: false,
|
|
231
231
|
countDownloads: `path:"scin_dataset_precomputed_embeddings.npz" OR path:"saved_model.pb"`,
|
|
232
232
|
},
|
|
233
|
+
"describe-anything": {
|
|
234
|
+
prettyLabel: "Describe Anything",
|
|
235
|
+
repoName: "Describe Anything",
|
|
236
|
+
repoUrl: "https://github.com/NVlabs/describe-anything",
|
|
237
|
+
snippets: snippets.describe_anything,
|
|
238
|
+
filter: false,
|
|
239
|
+
},
|
|
233
240
|
"dia-tts": {
|
|
234
241
|
prettyLabel: "Dia",
|
|
235
242
|
repoName: "Dia",
|
|
@@ -662,6 +669,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
662
669
|
snippets: snippets.perception_encoder,
|
|
663
670
|
countDownloads: `path_extension:"pt"`,
|
|
664
671
|
},
|
|
672
|
+
"phantom-wan": {
|
|
673
|
+
prettyLabel: "Phantom",
|
|
674
|
+
repoName: "Phantom",
|
|
675
|
+
repoUrl: "https://github.com/Phantom-video/Phantom",
|
|
676
|
+
snippets: snippets.phantom_wan,
|
|
677
|
+
filter: false,
|
|
678
|
+
countDownloads: `path_extension:"pth"`,
|
|
679
|
+
},
|
|
665
680
|
pxia: {
|
|
666
681
|
prettyLabel: "pxia",
|
|
667
682
|
repoName: "pxia",
|
|
@@ -1009,6 +1024,14 @@ export const MODEL_LIBRARIES_UI_ELEMENTS = {
|
|
|
1009
1024
|
countDownloads: `path_extension:"pt" OR path_extension:"safetensors"`,
|
|
1010
1025
|
snippets: snippets.ultralytics,
|
|
1011
1026
|
},
|
|
1027
|
+
zonos: {
|
|
1028
|
+
prettyLabel: "Zonos",
|
|
1029
|
+
repoName: "Zonos",
|
|
1030
|
+
repoUrl: "https://github.com/Zyphra/Zonos",
|
|
1031
|
+
docsUrl: "https://github.com/Zyphra/Zonos",
|
|
1032
|
+
snippets: snippets.zonos,
|
|
1033
|
+
filter: false,
|
|
1034
|
+
},
|
|
1012
1035
|
"3dtopia-xl": {
|
|
1013
1036
|
prettyLabel: "3DTopia-XL",
|
|
1014
1037
|
repoName: "3DTopia-XL",
|
package/src/tasks/index.ts
CHANGED
|
@@ -184,7 +184,7 @@ export const TASKS_MODEL_LIBRARIES: Record<PipelineType, ModelLibraryKey[]> = {
|
|
|
184
184
|
/**
|
|
185
185
|
* Return the whole TaskData object for a certain task.
|
|
186
186
|
* If the partialTaskData argument is left undefined,
|
|
187
|
-
* the default
|
|
187
|
+
* the default placeholder data will be used.
|
|
188
188
|
*/
|
|
189
189
|
function getData(type: PipelineType, partialTaskData: TaskDataCustom = placeholder): TaskData {
|
|
190
190
|
return {
|
|
@@ -111,7 +111,7 @@ env = gym.make("LunarLander-v2")
|
|
|
111
111
|
# Loading the saved model
|
|
112
112
|
model = PPO.load("PPO-LunarLander-v2",env=env)
|
|
113
113
|
|
|
114
|
-
#
|
|
114
|
+
# Initializing the evaluation environment
|
|
115
115
|
eval_env = gym.make("LunarLander-v2")
|
|
116
116
|
|
|
117
117
|
# Running the trained agent on eval_env for 10 time steps and getting the mean reward
|