LLMproj1 commited on
Commit
d51c84c
·
verified ·
1 Parent(s): d9b7a16

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -1,10 +1,25 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
 
 
3
 
 
 
 
 
 
 
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
7
- client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
 
 
 
 
 
 
 
8
 
9
 
10
  def respond(
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
+ import os
4
+ os.system('pip install peft transformers')
5
 
6
+
7
+ import spaces
8
+ from transformers import GemmaTokenizer, AutoModelForCausalLM
9
+ from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
10
+ from threading import Thread
11
+ HF_TOKEN = os.environ.get("HF_TOKEN", None)
12
  """
13
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
14
  """
15
+
16
+ # Load the tokenizer and model
17
+ tokenizer = AutoTokenizer.from_pretrained("LLMproj1/mypersona-llama3-8b")
18
+ model = AutoModelForCausalLM.from_pretrained("LLMproj1/mypersona-llama3-8b", device_map="auto")
19
+ terminators = [
20
+ tokenizer.eos_token_id,
21
+ tokenizer.convert_tokens_to_ids("<|eot_id|>")
22
+ ]
23
 
24
 
25
  def respond(