MadryLab / context-cite

Attribute (or cite) statements generated by LLMs back to in-context information.
https://gradientscience.org/contextcite/
MIT License
146 stars 14 forks source link

Having trouble using package loading in python version 3.9 #1

Open cngvng opened 6 months ago

cngvng commented 6 months ago

After loading in pip, I proceed to import package:

from context_cite import ContextCiter

However, this error tells me that:

`TypeError Traceback (most recent call last)

Cell In[1], [line 3](vscode-notebook-cell:? Execution_count=1&line=3)

[1](vscode-notebook-cell:? Execution_count=1&line=1) from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline

----> [3](vscode-notebook-cell:? Execution_count=1&line=3) from context_cite import ContextCiter

File ~/anaconda3/envs/edutex/lib/python3.9/site-packages/context_cite/init.py:1

----> 1 from .context_citer import ContextCiter

3 version = “0.0.1”

4 VERSION = version

File ~/anaconda3/envs/edutex/lib/python3.9/site-packages/context_cite/context_citer.py:24

20 DEFAULT_GENERATE_KWARGS = {"max_new_tokens": 512, "do_sample": False}

21 DEFAULT_PROMPT_TEMPLATE = "Context: {context}\n\nQuery: {query}”

---> 24 class ContextCiter:

25 def init(

26 self,

27 model: Any,

(…)

38 partitioner: Optional[BaseContextPartitioner] = None,

39 ) -> None:

40 “”"

41 Initializes a new instance of the ContextCiter class, which is designed

42 to assist in generating contextualized responses using a given machine

(…)

284 Otherwise, return a stylized dataframe in sorted order.

285 “”"

286 if self.num_sources == 0:

TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and ‘_SpecialForm'`

bencw99 commented 6 months ago

Hi, thanks for raising! It should work with python 3.10. We will release a fix for earlier versions of python shortly.