Spaces:
Configuration error
Configuration error
Orel MAZOR commited on
Commit Β·
3cce64e
1
Parent(s): 08f3a23
readme
Browse filesFiles changed (3)
- .DS_Store
- .github/workflows/sync_to_hf_space.ymlAdded+20
- README.md+177-15
1234567891011121314151617181920name: Sync to Hugging Face Spaceon: push: branches: [main]jobs: sync-to-hub: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 lfs: true - name: Push to Hugging Face Space env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: | git config --global user.email "you@example.com" git config --global user.name "Your Name" git remote add space https://huggingface.co/spaces/Coool2/Final_Assignment_Template git push -f https://Coool2:$HF_TOKEN@huggingface.co/spaces/Coool2/Final_Assignment_Template main123456789101112131415---title: Template Final Assignmentemoji: π΅π»ββοΈcolorFrom: indigocolorTo: indigosdk: gradiosdk_version: 5.25.2app_file: app.pypinned: falsehf_oauth: true# optional, default duration is 8 hours/480 minutes. Max duration is 30 days/43200 minutes.hf_oauth_expiration_minutes: 480---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177# π€ Advanced GAIA Agents Challenge SolutionA comprehensive solution for the [Hugging Face Agents Course Unit 4 GAIA Challenge](https://huggingface.co/learn/agents-course/unit4/hands-on), featuring advanced multimodal AI agents with dynamic RAG capabilities, quantized models for Kaggle compatibility, and both synchronous/asynchronous execution modes.## π Features### π§ Dual Agent Architecture- **Agent 1 (LlamaIndex)**: Advanced multimodal agent with dynamic knowledge base and hybrid reranking- **Agent 2 (Smolagents)**: Gemini-powered agent with BM25 retrieval and observability### Features for Agent 1### π― Multimodal Capabilities- **BAAI Visualized Embedding**: BGE-M3 based multimodal embeddings running on cuda:1- **Pixtral 12B Quantized**: FP8/4-bit quantized vision-language model for resource-constrained environments- **Hybrid Retrieval**: Text + visual content processing with ColPali and SentenceTransformer reranking### β‘ Execution Modes- **Asynchronous Mode**: Concurrent question processing for maximum speed- **Kaggle Compatibility**: Optimized for resource-constrained environments### π Advanced RAG System- **Dynamic Knowledge Base**: Automatically updated with web search results- **Multimodal Parsing**: Handles text, images, PDFs, audio, and video files- **Smart Reranking**: Hybrid approach combining text and visual rerankers## ποΈ Architecture```ββββββββββββββββββββββββββββββββββββββββββββββββ APP ββ (Async/Sync Modes) ββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββ΄ββββββββββ βββββββΌβββββ ββββββΌββββββAgent 1 β βAgent 2 ββLlamaIdx β βSmolagentβββββββ¬βββββ ββββββ¬ββββββ βββββββΌβββββ ββββββΌββββββDynamic β βBM25 + ββRAG + β βLangfuse ββHybrid β βObserv. ββRerank β β ββββββββββββ βββββββββββ```## π Quick Start### Prerequisites### Installation1. **Clone the repository**:```bashgit clone https://github.com/yourusername/gaia-agents-challengecd gaia-agents-challenge```2. **Install FlagEmbedding with visual support**:```bashgit clone https://github.com/FlagOpen/FlagEmbedding.gitcd FlagEmbedding/research/visual_bgepip install -e .cd ../../..```3. **Install additional dependencies**:#### For Agent 1:```bashpip install -r requirements.txt```#### For Agent 2:```bashpip install -r requirements2.txt```4. **Set environment variables**:```bashexport GOOGLE_API_KEY="your_gemini_api_key"export HUGGINGFACEHUB_API_TOKEN="your_hf_token"export LANGFUSE_PUBLIC_KEY="your_langfuse_public_key" # Optionalexport LANGFUSE_SECRET_KEY="your_langfuse_secret_key" # Optional```### Usage```bash# LlamaIndex Agentpython agent.py# Smolagents Agentpython agent2.py```## π Project Structure```βββ agent.py # LlamaIndex-based agent with dynamic RAGβββ agent2.py # Smolagents-based agent with observabilityβββ appasync.py # Original async Gradio interfaceβββ app.py # Original sync Gradio interfaceβββ custom_models.py # Custom model implementationsβββ requirements.txt # Python dependenciesβββ README.md # This file```## π§ͺ Testing### Run Individual Components```bash# Test BAAI embeddingpython -c "from custom_models import BaaiMultimodalEmbedding; print('BAAI OK')"# Test Pixtral quantizedpython -c "from custom_models import PixtralQuantizedLLM; print('Pixtral OK')"# Test agentspython agent.pypython agent2.py```### Run GAIA Evaluation```bash# Through the web interfacepython app.py# Or programmaticallypython -c "from agent2 import GAIAAgentagent = GAIAAgent()result = agent.solve_gaia_question({'Question': 'Test question', 'task_id': 'test'})print(result)"```## οΏ½οΏ½οΏ½ Customization### Adding New Models1. Create a new class in `custom_models.py`2. Implement the required interfaces3. Update the agent configuration### Modifying RAG Behavior- Edit `DynamicQueryEngineManager` in `agent.py`- Adjust reranking strategies in `HybridReranker`- Configure search parameters in `enhanced_web_search_tool`### UI Customization- Modify `app_unified.py` for interface changes- Add new execution modes- Integrate additional observability tools## π Troubleshooting### Common Issues#### Model Loading Failures- Check internet connectivity for model downloads- Verify HuggingFace token permissions- Clear model cache: `rm -rf ~/.cache/huggingface/`#### Visual BGE Import Errors```bash# Ensure proper installationcd FlagEmbedding/research/visual_bgepip install -e .```## π References- [GAIA Benchmark](https://huggingface.co/datasets/gaia-benchmark/GAIA)- [LlamaIndex](https://github.com/run-llama/llama_index)- [BGE Models](https://github.com/FlagOpen/FlagEmbedding)- [Gradio](https://github.com/gradio-app/gradio)
.DS_Store
.github/workflows/sync_to_hf_space.ymlAdded+20
README.md+177-15