Export Gemma 2 from Keras to Saved Model?
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
- Type d'issue
- Fonctionnalité
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- python
- Domaine
- machine-learning
Piste de recherche
Commencez par le script Python, en particulier par l'appel à model_from_json qui échoue sur GemmaBackbone, et examinez les fichiers config.json, model.weights.h5 et tokenizer.json téléchargés. Déterminez si ce dépôt prend en charge l'exportation de ce package Gemma 2 vers SavedModel ; le travail est terminé lorsqu'un workflow pris en charge est documenté ou qu'il est clairement expliqué que cela n'est pas pris en charge.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Ok, downloaded Gemma2 from
https://www.kaggle.com/models/google/gemma-2/keras
-unpacked and got the following files:
/assets
config.json
metadata.json
model.weights.h5
tokenizer.json
-tried to load model by using following Python script:
import json
from tensorflow import keras
# 1. Path to the config and weights:
config_path = "d:/Install/TensorFlow/models/Gemma_2/config.json"
weights_path = "d:/Install/TensorFlow/models/Gemma_2/model.weights.h5"
saved_model_dir = "d:/Install/TensorFlow/models/Gemma_2/gemma2_saved_model"
# 2. load model configuration
with open(config_path, 'r') as f:
model_config = json.load(f)
# 3. Reconstruct the model:
model = keras.models.model_from_json(json.dumps(model_config))
# 4. Load the weights:
model.load_weights(weights_path)
# 5. Finally, save model as TensorFlow SavedModel format:
model.save(saved_model_dir, save_format="tf")
print("Model saved to the :", saved_model_dir)
-at the line
model = keras.models.model_from_json(json.dumps(model_config))
got following error:
ValueError: Unknown layer: GemmaBackbone. Please ensure this object is passed to the custom_objectsargument. See https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object for details.
Questions:
- Can someone confirm that I'm on the right track?
- Looked at
- https://www.tensorflow.org/guide/keras/save_and_serialize#registering_the_custom_object
but not sure what to do with GemmaBackbone...huh?
any help?
- Langage dominant
- Java
- Étoiles
- 928
- Forks
- 227
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de tensorflow/java
-
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
tensorflow/java#653 · 1 commentaire · 4 réactions ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
tensorflow/java#621 · 4 commentaires ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
tensorflow/java#617 · 3 commentaires ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 55/100
tensorflow/java#615 · 1 commentaire ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
tensorflow/java#614 · 1 commentaire ·
Toutes les issues de tensorflow/java
Issues similaires
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
Cannot differ own consent and managed consents in My Consents view and detailed consent view. Ouverte1.0.0-alpha2 Type/Improvement
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
wso2/dpdp-accelerator#272 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
infinispan/infinispan#18150 ·
-
area/frontend
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100