@@ -443,7 +443,7 @@ const _keras_hub_causal_lm = (modelId: string): string => `
443
443
import keras_hub
444
444
445
445
# 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")
447
447
causal_lm.compile(sampler="greedy") # (optional) specify a sampler
448
448
449
449
# Generate text
@@ -454,7 +454,7 @@ const _keras_hub_text_to_image = (modelId: string): string => `
454
454
import keras_hub
455
455
456
456
# 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")
458
458
459
459
# Generate images with a TextToImage model.
460
460
text_to_image.generate("Astronaut in a jungle")
@@ -465,7 +465,7 @@ import keras_hub
465
465
466
466
# Load TextClassifier model
467
467
text_classifier = keras_hub.models.TextClassifier.from_preset(
468
- ${ modelId } ,
468
+ " ${ modelId } " ,
469
469
num_classes=2,
470
470
)
471
471
# Fine-tune
@@ -480,7 +480,7 @@ import keras
480
480
481
481
# Load ImageClassifier model
482
482
image_classifier = keras_hub.models.ImageClassifier.from_preset(
483
- ${ modelId } ,
483
+ " ${ modelId } " ,
484
484
num_classes=2,
485
485
)
486
486
# Fine-tune
@@ -503,14 +503,14 @@ const _keras_hub_task_without_example = (task: string, modelId: string): string
503
503
import keras_hub
504
504
505
505
# Create a ${ task } model
506
- task = keras_hub.models.${ task } .from_preset(${ modelId } )
506
+ task = keras_hub.models.${ task } .from_preset(" ${ modelId } " )
507
507
` ;
508
508
509
509
const _keras_hub_generic_backbone = ( modelId : string ) : string => `
510
510
import keras_hub
511
511
512
512
# 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 } " )
514
514
` ;
515
515
516
516
export const keras_hub = ( model : ModelData ) : string [ ] => {
0 commit comments