Spaces:
Runtime error
Runtime error
changing model as a test
Browse files
app.py
CHANGED
@@ -28,12 +28,13 @@ DEFAULT_MAX_NEW_TOKENS = 1024
|
|
28 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
29 |
|
30 |
|
31 |
-
text_splitter = RecursiveCharacterTextSplitter(chunk_size=350, chunk_overlap=10)
|
32 |
-
|
33 |
embeddings = HuggingFaceHubEmbeddings()
|
34 |
|
35 |
-
model_id = "HuggingFaceH4/zephyr-7b-beta"
|
36 |
-
|
|
|
37 |
model = AutoModelForCausalLM.from_pretrained(
|
38 |
model_id,
|
39 |
device_map="auto",
|
@@ -41,9 +42,9 @@ model = AutoModelForCausalLM.from_pretrained(
|
|
41 |
)
|
42 |
|
43 |
print( "initalized model")
|
44 |
-
|
45 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
46 |
-
|
47 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=10)
|
48 |
hf = HuggingFacePipeline(pipeline=pipe)
|
49 |
|
|
|
28 |
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "4096"))
|
29 |
|
30 |
|
31 |
+
# text_splitter = RecursiveCharacterTextSplitter(chunk_size=350, chunk_overlap=10)
|
32 |
+
|
33 |
embeddings = HuggingFaceHubEmbeddings()
|
34 |
|
35 |
+
# model_id = "HuggingFaceH4/zephyr-7b-beta"
|
36 |
+
model_id = "meta-llama/Llama-2-7b-chat-hf"
|
37 |
+
|
38 |
model = AutoModelForCausalLM.from_pretrained(
|
39 |
model_id,
|
40 |
device_map="auto",
|
|
|
42 |
)
|
43 |
|
44 |
print( "initalized model")
|
45 |
+
|
46 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
47 |
+
|
48 |
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer, max_new_tokens=10)
|
49 |
hf = HuggingFacePipeline(pipeline=pipe)
|
50 |
|