baconnier commited on
Commit
b8b99ae
·
verified ·
1 Parent(s): 213cdcd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -55,11 +55,23 @@ model_id = "baconnier/Napoleon_4B_V0.0"
55
  # Charger la configuration
56
  config = AutoConfig.from_pretrained(model_id)
57
 
58
- # Ajouter l'attribut vocab_size manuellement si nécessaire
59
  if not hasattr(config, "vocab_size"):
60
- config.vocab_size = 32000 # Valeur standard pour les modèles basés sur Llama
 
61
  if not hasattr(config, "hidden_size"):
62
- config.hidden_size = 2560 # Valeur standard pour les modèles 4B
 
 
 
 
 
 
 
 
 
 
 
63
 
64
  tokenizer = AutoTokenizer.from_pretrained(model_id)
65
  model = AutoModelForCausalLM.from_pretrained(
 
55
  # Charger la configuration
56
  config = AutoConfig.from_pretrained(model_id)
57
 
58
+ # Ajouter les attributs manquants
59
  if not hasattr(config, "vocab_size"):
60
+ config.vocab_size = 262208 # Valeur correcte pour Gemma 3
61
+
62
  if not hasattr(config, "hidden_size"):
63
+ config.hidden_size = 2560 # Valeur correcte pour Gemma 3 4B
64
+
65
+ if not hasattr(config, "num_hidden_layers"):
66
+ config.num_hidden_layers = 34 # Valeur correcte pour Gemma 3 4B
67
+
68
+ # Autres attributs potentiellement nécessaires
69
+ if not hasattr(config, "intermediate_size"):
70
+ config.intermediate_size = 10240 # Valeur correcte pour Gemma 3 4B
71
+
72
+ if not hasattr(config, "num_attention_heads"):
73
+ config.num_attention_heads = 10 # Valeur correcte pour Gemma 3 4B
74
+
75
 
76
  tokenizer = AutoTokenizer.from_pretrained(model_id)
77
  model = AutoModelForCausalLM.from_pretrained(