alex-abb commited on
Commit
5c63df0
·
verified ·
1 Parent(s): 629597f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -14,11 +14,13 @@ model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
14
  @spaces.GPU(duration=240)
15
 
16
  # Charger le modèle en spécifiant le token d'accès
17
- pipeline = transformers.AutoModelForCausalLM.from_pretrained(
18
- model_id,
19
- token=api_token, # Utiliser votre token d'accès ici
20
- torch_dtype=torch.bfloat16, # Exemple d'utilisation de torch_dtype avec bfloat16
21
- device_map="auto", # Sélection automatique du device (CPU ou GPU)
 
 
22
  )
23
 
24
  # Créer un pipeline pour la génération de texte
 
14
  @spaces.GPU(duration=240)
15
 
16
  # Charger le modèle en spécifiant le token d'accès
17
+
18
+ pipeline = transformers.pipeline(
19
+ "text-generation",
20
+ model=model_id,
21
+ token = api_token,
22
+ model_kwargs={"torch_dtype": torch.bfloat16},
23
+ device_map="auto",
24
  )
25
 
26
  # Créer un pipeline pour la génération de texte