{"id":26528888,"url":"https://github.com/edcalderin/huggingface_ragflow","last_synced_at":"2025-07-15T14:07:03.347Z","repository":{"id":281970554,"uuid":"946895840","full_name":"edcalderin/HuggingFace_RAGFlow","owner":"edcalderin","description":"This project implements a classic Retrieval-Augmented Generation (RAG) system using HuggingFace models with quantization techniques. The system processes PDF documents, extracts their content, and enables interactive question-answering through a Streamlit web application.","archived":false,"fork":false,"pushed_at":"2025-03-20T20:10:14.000Z","size":114,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-20T20:54:54.071Z","etag":null,"topics":["bitsandbytes","cuda","huggingface","huggingface-embeddings","langchain","langchain-community","large-language-models","llm","nf4","python","qdrant","quantization","rag","retrieval-augmented-generation","ruff","streamlit","text-generation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edcalderin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-11T21:01:33.000Z","updated_at":"2025-03-20T20:14:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"051364fe-325c-485f-a519-60ff3546f3dd","html_url":"https://github.com/edcalderin/HuggingFace_RAGFlow","commit_stats":null,"previous_names":["edcalderin/historiacard_ragflow","edcalderin/huggingface_ragflow"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edcalderin%2FHuggingFace_RAGFlow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edcalderin%2FHuggingFace_RAGFlow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edcalderin%2FHuggingFace_RAGFlow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edcalderin%2FHuggingFace_RAGFlow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edcalderin","download_url":"https://codeload.github.com/edcalderin/HuggingFace_RAGFlow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244825655,"owners_count":20516592,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitsandbytes","cuda","huggingface","huggingface-embeddings","langchain","langchain-community","large-language-models","llm","nf4","python","qdrant","quantization","rag","retrieval-augmented-generation","ruff","streamlit","text-generation"],"created_at":"2025-03-21T16:19:03.176Z","updated_at":"2025-07-15T14:07:03.337Z","avatar_url":"https://github.com/edcalderin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HuggingFace RAGFlow\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n## Overview\nThis project implements a classic Retrieval-Augmented Generation (RAG) system using HuggingFace models with quantization techniques. The system processes PDF documents, extracts their content, and enables interactive question-answering through a Streamlit web application.\n\n## Prerequisites\n- [Anaconda](https://www.anaconda.com/download/) or [Miniconda](https://docs.conda.io/en/latest/miniconda.html) installed on your system\n- Python 3.12 or higher\n\n## Installation\n\n### 1. Clone the repository\n```bash\ngit clone https://github.com/edcalderin/HuggingFace_RAGFlow.git\ncd HuggingFace_RAGFlow\n```\n\n### 2. Create and activate the Conda environment\n```bash\n# Create a new Conda environment\nconda env create -n hg_ragflow --file requirements.txt\n\n# Activate the environment\nconda activate hg_ragflow\n```\n\nOn Windows, you might need to use:\n```bash\nsource activate hg_ragflow\n```\n\nIf you have GPU\n```\npip3 install torch --index-url https://download.pytorch.org/whl/cu126\n```\n\n### 3. Verify the installation\n```bash\n# Verify that the environment is active\nconda info --envs\n\n# The active environment should be marked with an asterisk (*)\n```\n\n## Usage\n\n### Development workflow\n1. Rename `.env.example` to `.env` and set the `HUGGINGFACE_TOKEN` variable with your own HuggingFace token https://huggingface.co/settings/tokens\n\n2. Load embeddings to Qdrant Vector Store:\n   ```bash\n   python -m core.data_loader.vector_store\n   ```\n\n3. Run Streamlit app:\n    ```bash\n    python -m streamlit run app/streamlit.py\n    ```\n\n### Configuration\nLocated `core/config.py` and feel free to edit these global parameters:\n\n```python\n@dataclass(frozen=True)\nclass LLMConfig:\n    EMBEDDING_MODEL_NAME: str = \"sentence-transformers/all-mpnet-base-v2\" \u003c-- embedding model\n    COLLECTION_NAME: str = \"historiacard_docs\"\n    QDRANT_STORE_PATH: str = \"./tmp\" \u003c-- directory to Qdrant vector store\n\n    # Model\n    MODEL_NAME: str = \"meta-llama/Llama-3.2-3B-Instruct\"\n    MODEL_TASK: str = \"text-generation\" \u003c-- task type\n    TEMPERATURE: float = 0.1\n    MAX_NEW_TOKENS: int = 1024\n```\n### Lint\nStyle the code with Ruff:\n\n```bash\nruff format .\nruff check . --fix\n```\n### Deactivating the environment\nWhen you're done working on the project, deactivate the Conda environment:\n\n```bash\nconda deactivate\n```\n\n**Last but not least:**  \nLocate you cache directory and remove embedding and model directory used by the project, as these may occupy several gigabytes of storage.\n\n## Environment Configuration\n\n### Requirements\nThe project includes an `requirements.txt` file that defines all required dependencies. Here's what it looks like:\n\n```bash\naccelerate==1.5.2\nbitsandbytes==0.45.3\nlangchain-community==0.3.19\nlangchain-core==0.3.44\nlangchain-huggingface==0.1.2\nlangchain-qdrant==0.2.0\npypdf==5.3.1\npython-dotenv==1.0.1\nruff==0.9.10\nstreamlit==1.43.2\ntorch==2.6.0+cu126\ntransformers==4.49.0\n```\n\n## Project Structure\n```\nHuggingFace_RAGFlow/\n├── app/                   # Streamlit app\n│   ├── streamlit.py       # Main application entry point\n├── core/                  # LLM stuff\n│   ├── chain_creator/     # Files to create conversational chain and memory management\n│   └── data_loader/       # Files to save embeddings to Vector Store.\n│   └── model/             # LLM Model and Embeddings\n│   └── retrieval/         # Vector Store Retriever\n│   └── utils/             # Logging configuration\n│   └── config.py          # Global configuration parameters\n└── README.md              # This file\n```\n\n## Contact\n**LinkedIn:** https://www.linkedin.com/in/erick-calderin-5bb6963b/  \n**e-mail:** edcm.erick@gmail.com\n\nJust in case, feel free to create an issue 😊\n\n## Enjoyed this content?\nExplore more of my work on [Medium](https://medium.com/@erickcalderin) \n\nI regularly share insights, tutorials, and reflections on tech, AI, and more. Your feedback and thoughts are always welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedcalderin%2Fhuggingface_ragflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedcalderin%2Fhuggingface_ragflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedcalderin%2Fhuggingface_ragflow/lists"}