Skip to content

Instantly share code, notes, and snippets.

@nishio
Created May 31, 2024 13:53
Show Gist options
  • Save nishio/b5e54d84a080fa7397559f32ee48dc84 to your computer and use it in GitHub Desktop.
Save nishio/b5e54d84a080fa7397559f32ee48dc84 to your computer and use it in GitHub Desktop.
Traceback (most recent call last):
File "/Users/nishio/talk-to-the-city-reports/scatter/pipeline/steps/translation.py", line 119, in translate_batch
return translate_batch(batch, lang_prompt, model, retries - 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/pipeline/steps/translation.py", line 119, in translate_batch
return translate_batch(batch, lang_prompt, model, retries - 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/pipeline/steps/translation.py", line 119, in translate_batch
return translate_batch(batch, lang_prompt, model, retries - 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Previous line repeated 958 more times]
File "/Users/nishio/talk-to-the-city-reports/scatter/pipeline/steps/translation.py", line 96, in translate_batch
response = llm(messages=messages(lang_prompt, input)).content.strip()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/langchain/chat_models/base.py", line 608, in __call__
generation = self.generate(
^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/langchain/chat_models/base.py", line 359, in generate
raise e
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/langchain/chat_models/base.py", line 349, in generate
self._generate_with_cache(
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/langchain/chat_models/base.py", line 501, in _generate_with_cache
return self._generate(
^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/langchain/chat_models/openai.py", line 345, in _generate
response = self.completion_with_retry(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/langchain/chat_models/openai.py", line 284, in completion_with_retry
return _completion_with_retry(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/tenacity/__init__.py", line 330, in wrapped_f
return self(f, *args, **kw)
^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/tenacity/__init__.py", line 467, in __call__
do = self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/tenacity/__init__.py", line 368, in iter
result = action(retry_state)
^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/tenacity/__init__.py", line 390, in <lambda>
self._add_action_func(lambda rs: rs.outcome.result())
^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/tenacity/__init__.py", line 470, in __call__
result = fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/langchain/chat_models/openai.py", line 282, in _completion_with_retry
return self.client.create(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/openai/api_resources/chat_completion.py", line 25, in create
return super().create(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 155, in create
response, _, api_key = requestor.request(
^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/openai/api_requestor.py", line 289, in request
result = self.request_raw(
^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/openai/api_requestor.py", line 606, in request_raw
result = _thread_context.session.request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/requests/adapters.py", line 667, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 793, in urlopen
response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 537, in _make_request
response = conn.getresponse()
^^^^^^^^^^^^^^^^^^
File "/Users/nishio/talk-to-the-city-reports/scatter/venv/lib/python3.12/site-packages/urllib3/connection.py", line 466, in getresponse
httplib_response = super().getresponse()
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 1423, in getresponse
response.begin()
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 350, in begin
self.headers = self.msg = parse_headers(self.fp)
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 249, in parse_headers
return _parse_header_lines(headers, _class)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/http/client.py", line 243, in _parse_header_lines
return email.parser.Parser(_class=_class).parsestr(hstring)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/email/parser.py", line 64, in parsestr
return self.parse(StringIO(text), headersonly=headersonly)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/email/parser.py", line 53, in parse
feedparser.feed(data)
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/email/feedparser.py", line 174, in feed
self._call_parse()
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/email/feedparser.py", line 178, in _call_parse
self._parse()
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/email/feedparser.py", line 293, in _parsegen
if self._cur.get_content_maintype() == 'message':
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/email/message.py", line 626, in get_content_maintype
ctype = self.get_content_type()
^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/email/message.py", line 610, in get_content_type
value = self.get('content-type', missing)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/email/message.py", line 503, in get
return self.policy.header_fetch_parse(k, v)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/email/_policybase.py", line 316, in header_fetch_parse
return self._sanitize_header(name, value)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/python@3.12/3.12.2_1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/email/_policybase.py", line 287, in _sanitize_header
if _has_surrogates(value):
^^^^^^^^^^^^^^^^^^^^^^
RecursionError: maximum recursion depth exceeded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment