sail-sg / CLoT

CVPR'24, Official Codebase of our Paper: "Let's Think Outside the Box: Exploring Leap-of-Thought in Large Language Models with Creative Humor Generation".
https://zhongshsh.github.io/CLoT
296 stars 12 forks source link

install and use #4

Closed JZZZ1314 closed 5 months ago

JZZZ1314 commented 6 months ago

Can you provide a complete usage process? For example, the required dependency environment can be found in the published model weights related to qwen. How should we use this aspect

zhongshsh commented 6 months ago

No problem! We have updated the usage guide at https://github.com/sail-sg/CLoT?tab=readme-ov-file#-quickstart.

The packages transformers and peft are necessary. If you also want to use the web UI, you'll also need to install gradio.

JZZZ1314 commented 6 months ago

Traceback (most recent call last): File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 712, in urlopen self._prepare_proxy(conn) File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 1012, in _prepare_proxy conn.connect() File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 419, in connect self.sock = ssl_wrapsocket( File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\ssl.py", line 449, in ssl_wrap_socket ssl_sock = _ssl_wrap_socketimpl( File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\ssl.py", line 493, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 513, in wrap_socket return self.sslsocket_class._create( File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1071, in _create self.do_handshake() File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\ssl.py", line 1342, in do_handshake self._sslobj.do_handshake() ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1007)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 799, in urlopen retries = retries.increment( File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='qianwen-res.oss-cn-beijing.aliyuncs.com', port=443): Max retries exceeded with url: /Qwen-VL/assets/SimSun.ttf (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1007)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "d:\clot\CLoT\CLoT-cn\gradio_demo.py", line 367, in main() File "d:\clot\CLoT\CLoT-cn\gradio_demo.py", line 363, in main _launch_demo(args) File "d:\clot\CLoT\CLoT-cn\gradio_demo.py", line 112, in _launch_demo model, tokenizer = _load_model_tokenizer(args.checkpoint_path) File "d:\clot\CLoT\CLoT-cn\gradio_demo.py", line 63, in _load_model_tokenizer tokenizer = AutoTokenizer.from_pretrained( File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 806, in from_pretrained tokenizer_class = get_class_from_dynamic_module(class_ref, pretrained_model_name_or_path, kwargs) File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\dynamic_module_utils.py", line 500, in get_class_from_dynamic_module return get_class_in_module(class_name, final_module.replace(".py", "")) File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\dynamic_module_utils.py", line 200, in get_class_in_module module = importlib.import_module(module_path) File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\importlib__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 883, in exec_module File "", line 241, in _call_with_frames_removed File "C:\Users\orangecat.cache\huggingface\modules\transformers_modules\zhongshsh\CLoT-cn\20a6a772dc427b28dad422802321e14360fcbbc2\tokenization_qwen.py", line 33, in ttf = requests.get("https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/SimSun.ttf") File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 73, in get return request("get", url, params=params, kwargs) File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, kwargs) File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 589, in request resp = self.send(prep, send_kwargs) File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 703, in send r = adapter.send(request, **kwargs) File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 517, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host='qianwen-res.oss-cn-beijing.aliyuncs.com', port=443): Max retries exceeded with url: /Qwen-VL/assets/SimSun.ttf (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1007)')))

JZZZ1314 commented 6 months ago

PS D:\clot\CLoT\CLoT-cn> d:; cd 'd:\clot\CLoT\CLoT-cn'; & 'c:\Users\orangecat\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\orangecat.vscode\extensions\ms-python.debugpy-2024.2.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher' '56983' '--' 'd:\clot\CLoT\CLoT-cn\gradio_demo.py' Traceback (most recent call last): File "d:\clot\CLoT\CLoT-cn\gradio_demo.py", line 367, in main() File "d:\clot\CLoT\CLoT-cn\gradio_demo.py", line 363, in main _launch_demo(args) File "d:\clot\CLoT\CLoT-cn\gradio_demo.py", line 112, in _launch_demo model, tokenizer = _load_model_tokenizer(args.checkpoint_path) File "d:\clot\CLoT\CLoT-cn\gradio_demo.py", line 63, in _load_model_tokenizer tokenizer = AutoTokenizer.from_pretrained( File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 810, in from_pretrained return tokenizer_class.from_pretrained( File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\tokenization_utils_base.py", line 2048, in from_pretrained return cls._from_pretrained( File "c:\Users\orangecat\AppData\Local\Programs\Python\Python310\lib\site-packages\transformers\tokenization_utils_base.py", line 2287, in _from_pretrained tokenizer = cls(*init_inputs, **init_kwargs) File "C:\Users\orangecat.cache\huggingface\modules\transformers_modules\zhongshsh\CLoT-cn\20a6a772dc427b28dad422802321e14360fcbbc2\tokenization_qwen.py", line 140, in init self.mergeable_ranks = _load_tiktoken_bpe(vocab_file) # type: dict[bytes, int] File "C:\Users\orangecat.cache\huggingface\modules\transformers_modules\zhongshsh\CLoT-cn\20a6a772dc427b28dad422802321e14360fcbbc2\tokenization_qwen.py", line 54, in _load_tiktoken_bpe with open(tiktoken_bpe_file, "rb") as f: TypeError: expected str, bytes or os.PathLike object, not NoneType

zhongshsh commented 6 months ago

(1) 443 ERROR is caused by the network issue. (2) Try to download qwen.tiktoken and put it into the checkpoint dir. Maybe you can try to update the version of transformers pip install -U transformers.