Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
braisedpork1964 committed Nov 6, 2024
1 parent 6715757 commit 4c23e2a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 34 deletions.
2 changes: 1 addition & 1 deletion examples/run_async_agent_vllm.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
asyncio.set_event_loop(loop)
# initialize the model
model = AsyncVllmModel(
path='internlm/internlm2_5-7b-chat',
path='Qwen/Qwen2-7B-Instruct',
meta_template=INTERNLM2_META,
tp=1,
top_k=1,
Expand Down
32 changes: 0 additions & 32 deletions lagent/agents/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,35 +314,3 @@ async def forward(self, message: AgentMessage, session_id=0, **kwargs):
iter(self.interpreter_executor.actions.values()))
if interpreter.name == 'AsyncIPythonInterpreter':
await interpreter.close_session(session_id)


if __name__ == '__main__':
from lagent.llms import GPTAPI

interpreter_prompt = (
'Below is a math problem. Please solve it step by step with the assistance of Python programming. Consider using Sympy or Numpy library '
'to facilitate your derivation, calculation and equation solving. Utilize the "pi" symbol and "Rational" from Sympy '
'for $$\pi$$ and fractions, and simplify all fractions and square roots without converting them to decimal values. '
'Please encapsulate each generated Jupyter Python code block with tags "{begin}" and "{end}". Conclude the '
r'final answer when observations are sufficient and encapsulate the numerical result with LaTeX syntax "\boxed{{}}" '
'without any unit, and end your conclusion with the special token "[END]" to denote the completion of your response. '
'Keep the following points in mind:\n'
'- You must alternately use human and programming languages in the chain of thought;\n'
'- The number of your reasoning steps should not exceed **three**, which means you may merge some intermediate steps when the original answer is tedious.'
)

llm = dict(
type=GPTAPI,
model_type='gpt-4o-2024-05-13',
retry=50,
key=None,
max_new_tokens=2048,
stop_words=['</python'],
)
agent = MathCoder(
llm=llm,
output_format=InterpreterParser(
template=interpreter_prompt, begin='<python>', end='</python>'),
aggregator=InternLMToolAggregator(
environment_begin='<output>\n', environment_end='\n</output>'),
finish_condition=lambda m: '[END]' in m.content)
2 changes: 1 addition & 1 deletion requirements/runtime.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jsonschema
jupyter==1.0.0
jupyter_core==5.7.2
jupyter_client==8.6.2
pydantic==2.6.4
requests
stdlib_list==0.10.0
streamlit
termcolor
tiktoken
timeout-decorator
Expand Down

0 comments on commit 4c23e2a

Please sign in to comment.