Upto12forenglish commited on
Commit
0a6aa83
1 Parent(s): ce3c9da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -5,15 +5,13 @@ print("Token loaded")
5
  import transformers
6
  import torch
7
 
8
- #Loading llama3 model
9
- model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
10
-
11
- pipeline = transformers.pipeline(
12
- "text-generation",
13
- model=model_id,
14
- model_kwargs={"torch_dtype": torch.bfloat16},
15
- device="cuda",
16
- )
17
 
18
  print("llama download successfully")
19
 
 
5
  import transformers
6
  import torch
7
 
8
+ # Load the tokenizer and model
9
+ tokenizer = AutoTokenizer.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct")
10
+ model = AutoModelForCausalLM.from_pretrained("meta-llama/Meta-Llama-3-8B-Instruct", device_map="auto") # to("cuda:0")
11
+ terminators = [
12
+ tokenizer.eos_token_id,
13
+ tokenizer.convert_tokens_to_ids("<|eot_id|>")
14
+ ]
 
 
15
 
16
  print("llama download successfully")
17