Spaces:
Runtime error
Runtime error
Fixed
Browse files- app.py +7 -1
- requirements.txt +5 -3
app.py
CHANGED
|
@@ -10,6 +10,7 @@ Original file is located at
|
|
| 10 |
|
| 11 |
|
| 12 |
# Import Libraries
|
|
|
|
| 13 |
from langchain_community.vectorstores import Chroma
|
| 14 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
| 15 |
from langchain.llms import HuggingFacePipeline
|
|
@@ -20,6 +21,9 @@ from langchain.text_splitter import CharacterTextSplitter
|
|
| 20 |
from langchain.schema import Document
|
| 21 |
from transformers import BitsAndBytesConfig
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
# ByteCode Data (as context)
|
| 24 |
bytecode_info = """
|
| 25 |
You are a ByteCode helpful GenZ AI assistant. Be concise, friendly, and practical.
|
|
@@ -130,7 +134,9 @@ model_name = "google/gemma-2b-it"
|
|
| 130 |
model = AutoModelForCausalLM.from_pretrained(
|
| 131 |
model_name,
|
| 132 |
device_map="auto",
|
| 133 |
-
quantization_config=quant_config
|
|
|
|
|
|
|
| 134 |
)
|
| 135 |
|
| 136 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
# Import Libraries
|
| 13 |
+
import os
|
| 14 |
from langchain_community.vectorstores import Chroma
|
| 15 |
from langchain_community.embeddings import HuggingFaceEmbeddings
|
| 16 |
from langchain.llms import HuggingFacePipeline
|
|
|
|
| 21 |
from langchain.schema import Document
|
| 22 |
from transformers import BitsAndBytesConfig
|
| 23 |
|
| 24 |
+
|
| 25 |
+
login(token=os.getenv("HF_TOKEN"))
|
| 26 |
+
|
| 27 |
# ByteCode Data (as context)
|
| 28 |
bytecode_info = """
|
| 29 |
You are a ByteCode helpful GenZ AI assistant. Be concise, friendly, and practical.
|
|
|
|
| 134 |
model = AutoModelForCausalLM.from_pretrained(
|
| 135 |
model_name,
|
| 136 |
device_map="auto",
|
| 137 |
+
quantization_config=quant_config,
|
| 138 |
+
token=os.getenv("HF_TOKEN")
|
| 139 |
+
|
| 140 |
)
|
| 141 |
|
| 142 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
requirements.txt
CHANGED
|
@@ -1,8 +1,10 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
langchain
|
| 3 |
langchain-community
|
| 4 |
-
|
|
|
|
| 5 |
bitsandbytes
|
| 6 |
accelerate
|
| 7 |
chromadb
|
| 8 |
-
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
huggingface_hub
|
| 3 |
langchain
|
| 4 |
langchain-community
|
| 5 |
+
langchain-huggingface
|
| 6 |
+
sentence-transformers
|
| 7 |
bitsandbytes
|
| 8 |
accelerate
|
| 9 |
chromadb
|
| 10 |
+
gradio
|