pivovalera2012 commited on
Commit
ceeeacc
1 Parent(s): 8d469af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -1,5 +1,21 @@
 
1
  import gradio as gr
2
- import transformers
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  def generate_text(prompt):
5
  return 'Привет'
 
1
+ import torch
2
  import gradio as gr
3
+ from transformers import AutoModelForCausalLM, AutoTokenizer
4
+
5
+ MODEL_NAME = 'meta-llama/Llama-2-7b-chat-hf'
6
+ ADAPTERS_NAME = 'pivovalera2012/Llama-2-7b-Dr-Hous-test'
7
+
8
+ model_trained = AutoModelForCausalLM.from_pretrained(
9
+ MODEL_NAME,
10
+ device_map=device_map,
11
+ trust_remote_code=True,
12
+ quantization_config=bnb_config,
13
+ )
14
+
15
+ model_trained = PeftModel.from_pretrained(model_trained, ADAPTERS_NAME)
16
+ model_trained = model_trained.merge_and_unload()
17
+ tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
18
+
19
 
20
  def generate_text(prompt):
21
  return 'Привет'