Skip to content

Commit 9da98d8

Browse files
authored
1 parent c35bd61 commit 9da98d8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ const _keras_hub_causal_lm = (modelId: string): string => `
443443
import keras_hub
444444
445445
# Load CausalLM model (optional: use half precision for inference)
446-
causal_lm = keras_hub.models.CausalLM.from_preset(${modelId}, dtype="bfloat16")
446+
causal_lm = keras_hub.models.CausalLM.from_preset("${modelId}", dtype="bfloat16")
447447
causal_lm.compile(sampler="greedy") # (optional) specify a sampler
448448
449449
# Generate text
@@ -454,7 +454,7 @@ const _keras_hub_text_to_image = (modelId: string): string => `
454454
import keras_hub
455455
456456
# Load TextToImage model (optional: use half precision for inference)
457-
text_to_image = keras_hub.models.TextToImage.from_preset(${modelId}, dtype="bfloat16")
457+
text_to_image = keras_hub.models.TextToImage.from_preset("${modelId}", dtype="bfloat16")
458458
459459
# Generate images with a TextToImage model.
460460
text_to_image.generate("Astronaut in a jungle")
@@ -465,7 +465,7 @@ import keras_hub
465465
466466
# Load TextClassifier model
467467
text_classifier = keras_hub.models.TextClassifier.from_preset(
468-
${modelId},
468+
"${modelId}",
469469
num_classes=2,
470470
)
471471
# Fine-tune
@@ -480,7 +480,7 @@ import keras
480480
481481
# Load ImageClassifier model
482482
image_classifier = keras_hub.models.ImageClassifier.from_preset(
483-
${modelId},
483+
"${modelId}",
484484
num_classes=2,
485485
)
486486
# Fine-tune
@@ -503,14 +503,14 @@ const _keras_hub_task_without_example = (task: string, modelId: string): string
503503
import keras_hub
504504
505505
# Create a ${task} model
506-
task = keras_hub.models.${task}.from_preset(${modelId})
506+
task = keras_hub.models.${task}.from_preset("${modelId}")
507507
`;
508508

509509
const _keras_hub_generic_backbone = (modelId: string): string => `
510510
import keras_hub
511511
512512
# Create a Backbone model unspecialized for any task
513-
backbone = keras_hub.models.Backbone.from_preset(${modelId})
513+
backbone = keras_hub.models.Backbone.from_preset("${modelId}")
514514
`;
515515

516516
export const keras_hub = (model: ModelData): string[] => {

0 commit comments

Comments
 (0)