{"id":27129488,"url":"https://github.com/ajagtapdev/capitalx_model","last_synced_at":"2025-04-07T19:56:29.424Z","repository":{"id":285162271,"uuid":"957249925","full_name":"ajagtapdev/capitalx_model","owner":"ajagtapdev","description":"Data + model for CapitalX using Modal and HF.","archived":false,"fork":false,"pushed_at":"2025-03-29T22:55:12.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T23:25:21.587Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ajagtapdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-29T22:41:33.000Z","updated_at":"2025-03-29T22:55:16.000Z","dependencies_parsed_at":"2025-03-29T23:25:22.912Z","dependency_job_id":"7263a846-0fc6-4c21-8ea2-1170df980d45","html_url":"https://github.com/ajagtapdev/capitalx_model","commit_stats":null,"previous_names":["ajagtapdev/capitalx_model"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajagtapdev%2Fcapitalx_model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajagtapdev%2Fcapitalx_model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajagtapdev%2Fcapitalx_model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajagtapdev%2Fcapitalx_model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajagtapdev","download_url":"https://codeload.github.com/ajagtapdev/capitalx_model/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247721923,"owners_count":20985084,"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":[],"created_at":"2025-04-07T19:56:28.830Z","updated_at":"2025-04-07T19:56:29.414Z","avatar_url":"https://github.com/ajagtapdev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"UTF-8\"\u003e\n  \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003ch1\u003eCapitalX Credit Card Recommendation System\u003c/h1\u003e\n\n  \u003cdiv class=\"overview\"\u003e\n    \u003cp\u003eA fine-tuned LLM system that recommends optimal credit cards for specific transactions based on rewards, APR, and other factors.\u003c/p\u003e\n  \u003c/div\u003e\n\n  \u003ch2\u003e📋 Overview\u003c/h2\u003e\n  \u003cp\u003e\n    This system employs Parameter-Efficient Fine-Tuning (PEFT) to adapt foundation models for intelligent credit card recommendations, analyzing transaction details against multiple card options to maximize customer benefits.\n  \u003c/p\u003e\n\n  \u003ch2\u003e🏗️ Architecture\u003c/h2\u003e\n  \u003cdiv class=\"architecture\"\u003e\n    \u003cul\u003e\n      \u003cli\u003e\u003cstrong\u003eBase Model:\u003c/strong\u003e \u003ccode\u003emeta-llama/Meta-Llama-3-70B\u003c/code\u003e (70B parameter language model)\u003c/li\u003e\n      \u003cli\u003e\u003cstrong\u003eDistributed Training:\u003c/strong\u003e Modal cloud with DeepSpeed ZeRO-3 optimization\u003c/li\u003e\n      \u003cli\u003e\u003cstrong\u003eMemory Optimization:\u003c/strong\u003e QLoRA (Quantized Low-Rank Adaptation) with 4-bit quantization\u003c/li\u003e\n      \u003cli\u003e\u003cstrong\u003eHardware Requirements:\u003c/strong\u003e 8x H100 GPUs for training, 1x H100 for inference\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/div\u003e\n\n  \u003ch2\u003e⚙️ Technical Details\u003c/h2\u003e\n\n  \u003ch3\u003eTraining Configuration\u003c/h3\u003e\n  \u003ctable\u003e\n    \u003ctr\u003e\n      \u003cth\u003eParameter\u003c/th\u003e\n      \u003cth\u003eValue\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eLearning Rate\u003c/td\u003e\n      \u003ctd\u003e5e-6\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eTraining Epochs\u003c/td\u003e\n      \u003ctd\u003e2\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eLoRA Rank (r)\u003c/td\u003e\n      \u003ctd\u003e16\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eLoRA Alpha\u003c/td\u003e\n      \u003ctd\u003e32\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eBatch Size Per Device\u003c/td\u003e\n      \u003ctd\u003e2\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003eGradient Accumulation Steps\u003c/td\u003e\n      \u003ctd\u003e4\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\n  \u003ch3\u003eData Processing\u003c/h3\u003e\n  \u003cp\u003e\n    Each training example follows a standardized instruction format:\n  \u003c/p\u003e\n\n  \u003cpre\u003eYou are a credit card recommendation assistant. Analyze the cards and transaction, then recommend the BEST card with a clear explanation.\n\nCards:\nFreedom Flex: APR 15.0%, Credit Limit 5000, Rewards: base 1.0, dining 3.0%, groceries 5.0%\nSapphire Preferred: APR 18.0%, Credit Limit 10000, Rewards: base 1.0, travel 4.0%, dining 3.0%\n\nTransaction:\nProduct: Dinner, Category: dining, Vendor: Restaurant, Price: 75.0\n\nOutput: \u003c/pre\u003e\n\n  \u003ch2\u003e🚀 Implementation\u003c/h2\u003e\n\n  \u003cdiv class=\"prerequisites\"\u003e\n    \u003ch4\u003ePrerequisites\u003c/h4\u003e\n    \u003cul\u003e\n      \u003cli\u003eHugging Face API token with access to required models\u003c/li\u003e\n      \u003cli\u003eModal cloud account configured with GPU access\u003c/li\u003e\n      \u003cli\u003ePython 3.8+ with required dependencies\u003c/li\u003e\n    \u003c/ul\u003e\n  \u003c/div\u003e\n\n  \u003ch3\u003eEnvironment Setup\u003c/h3\u003e\n\n  \u003cpre\u003e# Create .env file with Hugging Face token\necho \"HUGGING_FACE_TOKEN=your_token_here\" \u003e .env\n\n# Run the script\nmodal run capitalx.py\u003c/pre\u003e\n\n  \u003ch3\u003eCommand-line Options\u003c/h3\u003e\n\n  \u003ctable\u003e\n    \u003ctr\u003e\n      \u003cth\u003eOption\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003e--model_name\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eSpecify a different base model (default: meta-llama/Meta-Llama-3-70B)\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003e--test_auth\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eTest Hugging Face authentication only\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003e--test_gpus\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eTest GPU setup and compatibility only\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\n  \u003ch2\u003e💡 Example Output\u003c/h2\u003e\n\n  \u003cpre\u003e{\n  \"test_case_1\": \"Best card: Freedom Flex. Explanation: Both cards offer the same 3% rewards on dining, but Freedom Flex has a lower APR (15.0% vs 18.0%), making it the better choice for this transaction.\",\n  \"test_case_2\": \"Best card: Freedom Flex. Explanation: Freedom Flex offers 5% cash back on groceries compared to no specific grocery rewards with Sapphire Preferred, resulting in $6.00 in rewards versus just $1.20 with the base rate.\"\n}\u003c/pre\u003e\n\n  \u003ch2\u003e🔍 System Workflow\u003c/h2\u003e\n\n  \u003cdiv class=\"workflow\"\u003e\n    \u003col\u003e\n      \u003cli\u003e\u003cstrong\u003eGPU Testing:\u003c/strong\u003e Validates CUDA availability and multi-GPU setup\u003c/li\u003e\n      \u003cli\u003e\u003cstrong\u003eData Preprocessing:\u003c/strong\u003e Formats training data with instruction prefixes\u003c/li\u003e\n      \u003cli\u003e\u003cstrong\u003eModel Loading:\u003c/strong\u003e Initializes the base model with 4-bit quantization\u003c/li\u003e\n      \u003cli\u003e\u003cstrong\u003eFine-Tuning:\u003c/strong\u003e Applies LoRA to adapt the model using DeepSpeed ZeRO-3\u003c/li\u003e\n      \u003cli\u003e\u003cstrong\u003eEvaluation:\u003c/strong\u003e Tests the trained model on sample credit card recommendation scenarios\u003c/li\u003e\n      \u003cli\u003e\u003cstrong\u003eResult Reporting:\u003c/strong\u003e Displays recommendation results for validation\u003c/li\u003e\n    \u003c/ol\u003e\n  \u003c/div\u003e\n\n  \u003ch2\u003e📝 License \u0026 Acknowledgements\u003c/h2\u003e\n  \u003cp\u003e\n    This project uses the Meta-Llama-3-70B model from Meta under their model license. Please ensure you have proper access rights and comply with the model's usage terms.\n  \u003c/p\u003e\n\n  \u003cdiv class=\"footer\"\u003e\n    \u003cp\u003eFor questions or contributions, please open an issue in the repository.\u003c/p\u003e\n  \u003c/div\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajagtapdev%2Fcapitalx_model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajagtapdev%2Fcapitalx_model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajagtapdev%2Fcapitalx_model/lists"}