Spaces:
Running
on
Zero
Running
on
Zero
Update main.py
Browse files
main.py
CHANGED
@@ -26,7 +26,7 @@ EXAMPLE_QUERIES = [
|
|
26 |
"What is known about different modes for human-AI teaming?",
|
27 |
]
|
28 |
EMBEDDING_MODEL_NAME = "allenai-specter"
|
29 |
-
LLM_MODEL_NAME = "Qwen/Qwen2-7B-Instruct
|
30 |
|
31 |
# Load the dataset and convert to pandas
|
32 |
data = pandas.read_parquet("hf://datasets/ccm/publications/data/train-00000-of-00001.parquet")
|
@@ -42,12 +42,12 @@ data.reset_index(inplace=True)
|
|
42 |
model = sentence_transformers.SentenceTransformer(EMBEDDING_MODEL_NAME)
|
43 |
|
44 |
# Create an LLM pipeline that we can send queries to
|
45 |
-
tokenizer = transformers.AutoTokenizer.from_pretrained(LLM_MODEL_NAME
|
46 |
streamer = transformers.TextIteratorStreamer(
|
47 |
-
tokenizer, skip_prompt=True, skip_special_tokens=True
|
48 |
)
|
49 |
chatmodel = transformers.AutoModelForCausalLM.from_pretrained(
|
50 |
-
LLM_MODEL_NAME, device_map="auto", torch_dtype=
|
51 |
)
|
52 |
|
53 |
# Create a FAISS index for fast similarity search
|
|
|
26 |
"What is known about different modes for human-AI teaming?",
|
27 |
]
|
28 |
EMBEDDING_MODEL_NAME = "allenai-specter"
|
29 |
+
LLM_MODEL_NAME = "Qwen/Qwen2-7B-Instruct"
|
30 |
|
31 |
# Load the dataset and convert to pandas
|
32 |
data = pandas.read_parquet("hf://datasets/ccm/publications/data/train-00000-of-00001.parquet")
|
|
|
42 |
model = sentence_transformers.SentenceTransformer(EMBEDDING_MODEL_NAME)
|
43 |
|
44 |
# Create an LLM pipeline that we can send queries to
|
45 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained(LLM_MODEL_NAME)
|
46 |
streamer = transformers.TextIteratorStreamer(
|
47 |
+
tokenizer, skip_prompt=True, skip_special_tokens=True
|
48 |
)
|
49 |
chatmodel = transformers.AutoModelForCausalLM.from_pretrained(
|
50 |
+
LLM_MODEL_NAME, device_map="auto", torch_dtype="auto"
|
51 |
)
|
52 |
|
53 |
# Create a FAISS index for fast similarity search
|