Hemasagar commited on
Commit
7c57aa9
1 Parent(s): 9aca64d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -7,8 +7,11 @@ import transformers
7
 
8
  # model_from_hugging_face = transformers.pipeline("text-generation", model="TheBloke/Llama-2-7B-Chat-GGML")
9
  # Load model directly
10
- from transformers import AutoModel
11
- model_from_hugging_face = AutoModel.from_pretrained("TheBloke/Llama-2-7B-Chat-GGML")
 
 
 
12
  # # from langchain.llms import CTransformers
13
  # from langchain_community.llms import CTransformers
14
 
@@ -27,10 +30,7 @@ def getLLMResponse(form_input,email_sender,email_recipient,email_style):
27
 
28
  #C Transformers is the Python library that provides bindings for transformer models implemented in C/C++ using the GGML library
29
 
30
- llm = CTransformers(model_from_hugging_face, # models/llama-2-7b-chat.ggmlv3.q8_0.bin, #https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/tree/main
31
- model_type='llama',
32
- config={'max_new_tokens': 256,
33
- 'temperature': 0.01})
34
 
35
 
36
  #Template for building the PROMPT
 
7
 
8
  # model_from_hugging_face = transformers.pipeline("text-generation", model="TheBloke/Llama-2-7B-Chat-GGML")
9
  # Load model directly
10
+ # with ctransformers, you can load from Hugging Face Hub directly and specify a model file (.bin or .gguf files) using:
11
+
12
+ from ctransformers import AutoModelForCausalLM
13
+
14
+ llm = AutoModelForCausalLM.from_pretrained("TheBloke/Llama-2-7B-Chat-GGML", model_file="llama-2-7b-chat.ggmlv3.q8_0.bin")
15
  # # from langchain.llms import CTransformers
16
  # from langchain_community.llms import CTransformers
17
 
 
30
 
31
  #C Transformers is the Python library that provides bindings for transformer models implemented in C/C++ using the GGML library
32
 
33
+ llm = AutoModelForCausalLM.from_pretrained("TheBloke/Llama-2-7B-Chat-GGML", model_file="llama-2-7b-chat.ggmlv3.q8_0.bin")
 
 
 
34
 
35
 
36
  #Template for building the PROMPT