Fix optional dependency loading and tokenizer handling - #116
Open
AyushRanjanRoy-01 wants to merge 1 commit into
Open
Fix optional dependency loading and tokenizer handling#116AyushRanjanRoy-01 wants to merge 1 commit into
AyushRanjanRoy-01 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #99.
Addresses #100.
Summary
requirements.txtPyPDF2/pypdfusage with a singlepypdfcode pathutils.pyWhy these changes are needed
Issue #99 reports that a fresh install is missing runtime dependencies required by the current codebase. The repo also imports optional AgentRxiv and TensorFlow paths during normal CLI startup, which forces users to install packages they do not need for the main workflow.
This PR separates core and optional runtime paths:
ai_lab_repo.pyworkflow can start without Flask, SQLAlchemy, sentence-transformers, or TensorFlowIssue #100 reports intermittent tokenization errors during cost estimation. This PR fixes that by centralizing tokenizer lookup and using explicit encoding fallbacks for models like DeepSeek and the OpenAI reasoning family.
Verification
python -m unittest discover -s testspython -m compileall ai_lab_repo.py app.py common_imports.py inference.py tokenization.py utils.pyinferenceandutils.count_tokens(...)successfully in a clean Python 3.12 environmentpython ai_lab_repo.py --yaml-location "experiment_configs/MATH_agentlab.yaml"and confirmed it progresses into the research workflow instead of failing at startupNotes