{"id":25290596,"url":"https://github.com/wesslen/huggingface-sagemaker-snowflake-deployment","last_synced_at":"2025-04-06T18:22:33.568Z","repository":{"id":226292877,"uuid":"766578157","full_name":"wesslen/huggingface-sagemaker-snowflake-deployment","owner":"wesslen","description":"Deploying a Huggingface model to AWS SageMaker with Snowflake connector.","archived":false,"fork":false,"pushed_at":"2024-03-03T19:36:13.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-13T00:30:26.225Z","etag":null,"topics":["aws-sagemaker","deployment","snowflake"],"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/wesslen.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}},"created_at":"2024-03-03T16:45:57.000Z","updated_at":"2024-05-24T17:47:57.000Z","dependencies_parsed_at":"2024-03-06T21:52:19.697Z","dependency_job_id":null,"html_url":"https://github.com/wesslen/huggingface-sagemaker-snowflake-deployment","commit_stats":null,"previous_names":["wesslen/huggingface-sagemaker-snowflake-deployment"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesslen%2Fhuggingface-sagemaker-snowflake-deployment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesslen%2Fhuggingface-sagemaker-snowflake-deployment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesslen%2Fhuggingface-sagemaker-snowflake-deployment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wesslen%2Fhuggingface-sagemaker-snowflake-deployment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wesslen","download_url":"https://codeload.github.com/wesslen/huggingface-sagemaker-snowflake-deployment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247527339,"owners_count":20953234,"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":["aws-sagemaker","deployment","snowflake"],"created_at":"2025-02-13T00:26:53.747Z","updated_at":"2025-04-06T18:22:33.544Z","avatar_url":"https://github.com/wesslen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deployed app\n\nDeploying a Huggingface model to AWS SageMaker with Snowflake connector.\n\n\u003e [!NOTE]\n\u003e This repo converts [Phil Schmid's Hugging Face Repo](https://github.com/huggingface/huggingface-sagemaker-snowflake-example) to AWS CLI V2.\n\n# Instructions\n\n## 1. AWS Setup\n  \n[Create AWS account, setup AWS CDK, and setup IAM Identity](https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html)\n\n\u003e [!WARNING]\n\u003e This can be the most time-consuming part. Make sure to use AWS CLI v2 and carefully follow the steps.\n\n## 2. Clone and setup virtual environment\n\nThe `cdk.json` file tells the CDK Toolkit how to execute your app.\n\nThis project is set up like a standard Python project.  The initialization\nprocess also creates a virtualenv within this project, stored under the `.venv`\ndirectory.  To create the virtualenv it assumes that there is a `python3`\n(or `python` for Windows) executable in your path with access to the `venv`\npackage. If for any reason the automatic creation of the virtualenv fails,\nyou can create the virtualenv manually.\n\nTo manually create a virtualenv on MacOS and Linux:\n\n```\n$ python3 -m venv .venv\n```\n\nAfter the init process completes and the virtualenv is created, you can use the following\nstep to activate your virtualenv.\n\n```\n$ source .venv/bin/activate\n```\n\nIf you are a Windows platform, you would activate the virtualenv like this:\n\n```\n% .venv\\Scripts\\activate.bat\n```\n\nOnce the virtualenv is activated, you can install the required dependencies.\n\n```\n$ pip install -r requirements.txt\n```\n\nAt this point you can now synthesize the CloudFormation template for this code.\n\n```\n$ cdk synth\n```\n\nTo add additional dependencies, for example other CDK libraries, just add\nthem to your `setup.py` file and rerun the `pip install -r requirements.txt`\ncommand.\n\n## 3. Bootstrap\n\n```\ncdk bootstrap \\\n   -c model=\"distilbert-base-uncased-finetuned-sst-2-english\" \\\n   -c task=\"text-classification\"\n```\n\n## 4. Deploy\n\n```\ncdk deploy \\\n   -c model=\"distilbert-base-uncased-finetuned-sst-2-english\" \\\n   -c task=\"text-classification\"\n```\n\n## 5. Inference\n\nTest your endpoint with curl:\n\n```\ncurl --request POST \\\n  --url {HuggingfaceSagemakerEndpoint.hfapigwEndpointE75D67B4} \\\n  --header 'Content-Type: application/json' \\\n  --data '{\"data\":{\n        \"inputs\": \"Hugging Face, the winner of VentureBeat’s Innovation in Natural Language Process/Understanding Award for 2021, is looking to level the playing field. The team, launched by Clément Delangue and Julien Chaumond in 2016, was recognized for its work in democratizing NLP, the global market value for which is expected to hit $35.1 billion by 2026. This week, Google’s former head of Ethical AI Margaret Mitchell joined the team.\"}\n}'\n# {\"data\": [[\"i\", [\"n\", \"POSITIVE\", 0.9506378173828125]]]}\n```\n\n## 6. API Integration with Snowflake\n\nFollow [these instructions](https://github.com/huggingface/huggingface-sagemaker-snowflake-example?tab=readme-ov-file#2-create-api-integration-in-snowflake).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesslen%2Fhuggingface-sagemaker-snowflake-deployment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwesslen%2Fhuggingface-sagemaker-snowflake-deployment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwesslen%2Fhuggingface-sagemaker-snowflake-deployment/lists"}