kh-CHEUNG commited on
Commit
69ae2e7
1 Parent(s): 1ac2a58

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -21,15 +21,18 @@ from langchain_text_splitters import SentenceTransformersTokenTextSplitter
21
 
22
  from PIL import Image
23
 
 
 
24
  # from transformers import LlavaNextProcessor, LlavaNextForConditionalGeneration, TextIteratorStreamer
25
  # processor = LlavaNextProcessor.from_pretrained("llava-hf/llava-v1.6-mistral-7b-hf")
26
  # model = LlavaNextForConditionalGeneration.from_pretrained("llava-hf/llava-v1.6-mistral-7b-hf", torch_dtype=torch.float16, low_cpu_mem_usage=True)
27
  from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
28
  model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
29
- tokenizer = AutoTokenizer.from_pretrained(model_id)
30
  model = AutoModelForCausalLM.from_pretrained(
31
  model_id,
32
  device_map="auto",
 
33
  ).to("cuda:0")
34
  terminators = [
35
  tokenizer.eos_token_id,
 
21
 
22
  from PIL import Image
23
 
24
+ HF_TOKEN = os.environ.get("Inference_Calls", None)
25
+
26
  # from transformers import LlavaNextProcessor, LlavaNextForConditionalGeneration, TextIteratorStreamer
27
  # processor = LlavaNextProcessor.from_pretrained("llava-hf/llava-v1.6-mistral-7b-hf")
28
  # model = LlavaNextForConditionalGeneration.from_pretrained("llava-hf/llava-v1.6-mistral-7b-hf", torch_dtype=torch.float16, low_cpu_mem_usage=True)
29
  from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
30
  model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
31
+ tokenizer = AutoTokenizer.from_pretrained(model_id, token=HF_TOKEN)
32
  model = AutoModelForCausalLM.from_pretrained(
33
  model_id,
34
  device_map="auto",
35
+ token=HF_TOKEN
36
  ).to("cuda:0")
37
  terminators = [
38
  tokenizer.eos_token_id,