nmarafo commited on
Commit
a629429
verified
1 Parent(s): ad5faaa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -5,7 +5,7 @@ from threading import Thread
5
  import os
6
 
7
  # Cargar el token de Hugging Face desde los secretos
8
- token = os.environ["HF_TOKEN"]
9
 
10
  # Configurar la cuantizaci贸n con bitsandbytes para reducir el uso de memoria
11
  bnb_config = BitsAndBytesConfig(
@@ -15,9 +15,12 @@ bnb_config = BitsAndBytesConfig(
15
  bnb_4bit_compute_dtype=torch.bfloat16
16
  )
17
 
18
- # Cargar el modelo cuantizado y el tokenizer
19
  model_id = "PrunaAI/google-shieldgemma-2b-bnb-4bit-smashed"
20
- tokenizer = AutoTokenizer.from_pretrained(model_id, token=token)
 
 
 
21
  model = AutoModelForCausalLM.from_pretrained(
22
  model_id,
23
  torch_dtype=torch.bfloat16,
 
5
  import os
6
 
7
  # Cargar el token de Hugging Face desde los secretos
8
+ token = os.environ.get("HF_TOKEN")
9
 
10
  # Configurar la cuantizaci贸n con bitsandbytes para reducir el uso de memoria
11
  bnb_config = BitsAndBytesConfig(
 
15
  bnb_4bit_compute_dtype=torch.bfloat16
16
  )
17
 
18
+ # Cargar el modelo cuantizado y forzar el uso de un tokenizador compatible
19
  model_id = "PrunaAI/google-shieldgemma-2b-bnb-4bit-smashed"
20
+ tokenizer_id = "google/shieldgemma-2b" # Usar el tokenizador del modelo base
21
+ tokenizer = AutoTokenizer.from_pretrained(tokenizer_id, token=token)
22
+
23
+ # Cargar el modelo cuantizado
24
  model = AutoModelForCausalLM.from_pretrained(
25
  model_id,
26
  torch_dtype=torch.bfloat16,