├── oss-idp-agentic-flow
├── bc.png
├── docling-extract.py
├── requirements.txt
├── se.png
├── vision-model.py
└── workflow.png
├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── demo-apps
├── health-app
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── client
│ │ ├── README.md
│ │ ├── eslint.config.js
│ │ ├── index.html
│ │ ├── package-lock.json
│ │ ├── package.json
│ │ ├── postcss.config.js
│ │ ├── src
│ │ │ ├── App.css
│ │ │ ├── App.tsx
│ │ │ ├── assets
│ │ │ │ ├── avatars
│ │ │ │ │ ├── Dr. Davis.png
│ │ │ │ │ ├── Dr. Johnson.png
│ │ │ │ │ ├── Dr. Smith.png
│ │ │ │ │ └── Dr. Williams.png
│ │ │ │ ├── aws-logo.svg
│ │ │ │ └── fonts
│ │ │ │ │ └── amazon-ember.css
│ │ │ ├── components
│ │ │ │ ├── AgentActions.tsx
│ │ │ │ ├── AgentVisualiser.tsx
│ │ │ │ ├── ChatBox.tsx
│ │ │ │ ├── ChatMessage.tsx
│ │ │ │ ├── ChatRow.tsx
│ │ │ │ ├── ConnectedHeader.tsx
│ │ │ │ ├── FixedTypingIndicator.tsx
│ │ │ │ ├── NavBar.tsx
│ │ │ │ ├── StatusBar.tsx
│ │ │ │ ├── StatusDisplay.tsx
│ │ │ │ ├── WelcomeScreen.tsx
│ │ │ │ └── tools
│ │ │ │ │ ├── BookingSummaryWidget.tsx
│ │ │ │ │ ├── DoctorAppointmentsWidget.tsx
│ │ │ │ │ ├── DoctorDisplay.tsx
│ │ │ │ │ ├── ToolDisplay.tsx
│ │ │ │ │ ├── ToolMagic.tsx
│ │ │ │ │ └── ToolStatus.tsx
│ │ │ ├── libs
│ │ │ │ └── audio.ts
│ │ │ ├── main.tsx
│ │ │ ├── providers
│ │ │ │ ├── RTVIProvider.tsx
│ │ │ │ └── ThemeProvider.tsx
│ │ │ ├── styles.css
│ │ │ ├── types.ts
│ │ │ ├── utils
│ │ │ │ ├── collections.ts
│ │ │ │ ├── date.tsx
│ │ │ │ ├── doctorAvatars.ts
│ │ │ │ ├── strings.ts
│ │ │ │ └── tailwind.ts
│ │ │ └── vite-env.d.ts
│ │ ├── tailwind.config.js
│ │ ├── tsconfig.json
│ │ ├── tsconfig.node.json
│ │ └── vite.config.ts
│ ├── data
│ │ ├── bedrock-kb.png
│ │ ├── chunking.png
│ │ ├── datasource.png
│ │ ├── embedding.png
│ │ ├── kb.png
│ │ ├── store.db
│ │ └── sync.png
│ └── server
│ │ ├── .env.example
│ │ ├── .python-version
│ │ ├── bot.py
│ │ ├── data
│ │ ├── kb
│ │ │ ├── common_conditions.md
│ │ │ └── common_conditions.md.metadata.json
│ │ └── store.db
│ │ ├── index.html
│ │ ├── init_db.py
│ │ ├── logger_config.py
│ │ ├── notebook.ipynb
│ │ ├── prompt.txt
│ │ ├── prompt_manager.py
│ │ ├── pyproject.toml
│ │ ├── requirements.txt
│ │ ├── runner.py
│ │ ├── server.py
│ │ └── tools.py
└── travel-app
│ ├── README.md
│ ├── backend
│ ├── .gitignore
│ ├── DEPLOYMENT_GUIDE.md
│ ├── README.md
│ ├── api_config.json
│ ├── data-setup
│ │ ├── dsql
│ │ │ ├── data
│ │ │ │ ├── seed_dsql.py
│ │ │ │ └── src
│ │ │ │ │ ├── database
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── activity_generator.py
│ │ │ │ │ ├── data_generator.py
│ │ │ │ │ ├── db_manager.py
│ │ │ │ │ ├── hybrid_adapter.py
│ │ │ │ │ └── models.py
│ │ │ │ │ ├── knowledge_base
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ └── kb_adapter.py
│ │ │ │ │ └── models
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ └── travel_plan.py
│ │ │ ├── schemas
│ │ │ │ └── dsql_schema.sql
│ │ │ └── setup_dsql.sh
│ │ └── knowledge_base
│ │ │ └── create_kb_documents.py
│ ├── lambda
│ │ ├── __init__.py
│ │ ├── handler.py
│ │ ├── orchestrator_wrapper.py
│ │ ├── proxy_handler.py
│ │ ├── tools
│ │ │ ├── __init__.py
│ │ │ ├── activities.py
│ │ │ ├── budget.py
│ │ │ ├── destinations.py
│ │ │ ├── flights.py
│ │ │ ├── hotels.py
│ │ │ └── itinerary.py
│ │ └── utils
│ │ │ ├── __init__.py
│ │ │ ├── agent_tracker.py
│ │ │ ├── dsql.py
│ │ │ └── status_tracker.py
│ ├── requirements-lambda.txt
│ ├── requirements.txt
│ └── scripts
│ │ ├── deploy.sh
│ │ ├── deploy_all.sh
│ │ ├── deploy_complete.sh
│ │ ├── deploy_proxy.sh
│ │ ├── package.sh
│ │ ├── setup_api_gateway.sh
│ │ └── update_orchestrator_permissions.sh
│ └── frontend
│ ├── .env.local
│ ├── README.md
│ ├── build
│ ├── asset-manifest.json
│ ├── index.html
│ ├── manifest.json
│ └── static
│ │ ├── css
│ │ ├── main.2a72a2cb.css
│ │ └── main.2a72a2cb.css.map
│ │ └── js
│ │ ├── main.c8efce8a.js
│ │ ├── main.c8efce8a.js.LICENSE.txt
│ │ └── main.c8efce8a.js.map
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ ├── index.html
│ └── manifest.json
│ ├── src
│ ├── App.tsx
│ ├── components
│ │ ├── WebSocketStatus.tsx
│ │ ├── common
│ │ │ ├── Footer.tsx
│ │ │ ├── Header.tsx
│ │ │ ├── Notifications.tsx
│ │ │ ├── WebSocketStatus.tsx
│ │ │ └── index.ts
│ │ └── travel
│ │ │ ├── AgentLegendPanel.tsx
│ │ │ ├── ChatInput.tsx
│ │ │ ├── OutputDisplay.tsx
│ │ │ ├── PlanCompletedTransition.tsx
│ │ │ ├── TravelPlanRenderer.tsx
│ │ │ ├── VisualizationArea.tsx
│ │ │ ├── animation.css
│ │ │ ├── result-items
│ │ │ ├── AccommodationResultItem.tsx
│ │ │ ├── ActivityResultItem.tsx
│ │ │ ├── FlightResultItem.tsx
│ │ │ └── ItineraryResultItem.tsx
│ │ │ └── visualization
│ │ │ ├── AgentLegend.tsx
│ │ │ ├── AgentLegendHorizontal.tsx
│ │ │ ├── AnimationTest.tsx
│ │ │ ├── ConnectionLine.tsx
│ │ │ ├── DynamicLoopVisualization.tsx
│ │ │ ├── PlannerBrain.tsx
│ │ │ ├── SpecialistAgent.tsx
│ │ │ ├── UpdateIndicator.tsx
│ │ │ ├── UpdateNotificationManager.tsx
│ │ │ └── WorkflowStage.tsx
│ ├── context
│ │ └── ChatContext.tsx
│ ├── hooks
│ │ ├── index.ts
│ │ ├── useNotifications.ts
│ │ ├── useTravelPlan.ts
│ │ └── useWebSocket.ts
│ ├── index.css
│ ├── index.tsx
│ ├── models
│ │ ├── TravelPlan.ts
│ │ └── WorkflowUpdate.ts
│ ├── pages
│ │ ├── AboutPage.tsx
│ │ ├── DemoPage.tsx
│ │ └── HomePage.tsx
│ ├── services
│ │ ├── SharePrintService.ts
│ │ ├── api
│ │ │ └── BackendStrandsApiClient.ts
│ │ ├── common
│ │ │ ├── NotificationService.ts
│ │ │ ├── apiClient.ts
│ │ │ └── config.ts
│ │ ├── data
│ │ │ └── DataTransformationService.ts
│ │ ├── index.ts
│ │ ├── polling
│ │ │ └── PollingService.ts
│ │ ├── travel
│ │ │ ├── InteractionService.ts
│ │ │ ├── SampleTravelData.ts
│ │ │ └── TravelPlanService.ts
│ │ └── websocket
│ │ │ ├── BackendStrandsAdapter.ts
│ │ │ ├── WebSocketService.ts
│ │ │ └── WorkflowUpdateService.ts
│ ├── theme.ts
│ └── utils
│ │ ├── formatters.ts
│ │ └── testHelpers.ts
│ └── tsconfig.json
├── infrastructure
├── .DS_Store
├── README.md
├── cost-efficient-model-inference-sagemaker-graviton
│ ├── build_and_push.sh
│ ├── buildspec.yml
│ ├── code
│ │ ├── inference.py
│ │ └── requirements.txt
│ ├── deploy-SLMs-with-sagemaker-inference-graviton-DeepSeek-R1-Distilled.ipynb
│ └── stack.png
├── efficient model inference
│ ├── .DS_Store
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.md
│ ├── LICENSE
│ ├── README.md
│ ├── base_eks_setup
│ │ ├── prometheus-monitoring.yaml
│ │ └── provision-v2.sh
│ ├── deepseek
│ │ ├── deepseek_on_graviton.py
│ │ └── deepseek_on_graviton.sh
│ ├── dockerfiles
│ │ ├── benchmark
│ │ │ ├── Dockerfile
│ │ │ ├── perf_benchmark.go
│ │ │ └── prompts.txt
│ │ └── ray-llama-cpp
│ │ │ ├── Dockerfile.arm
│ │ │ └── Dockerfile.intel
│ ├── karpenter-pools
│ │ ├── karpenter-cpu-inference-arm.yaml
│ │ ├── karpenter-cpu-inference.yaml
│ │ └── karpenter-cpu.yaml
│ ├── ray-server
│ │ ├── local-requirements.txt
│ │ └── serve-llama.py
│ └── ray-services
│ │ ├── .DS_Store
│ │ ├── ingress
│ │ ├── add-sg-lb-eks.sh
│ │ └── ingress-cpu.yaml
│ │ ├── ray-service-llama-3.2-CPU-LLAMA-Graviton.yaml
│ │ └── ray-service-llama-3.2-CPU-LLAMA-x86.yaml
├── inference_component_scale_to_zero
│ ├── README.md
│ ├── __init__.py
│ ├── app.py
│ ├── cdk.json
│ ├── inference_component_cdk
│ │ ├── __init__.py
│ │ └── inference_component_cdk_stack.py
│ ├── inference_component_cdk_stack.py
│ ├── requirements-dev.txt
│ ├── requirements.txt
│ └── source.bat
├── notebooklm-with-bedrock-and-amazon-eks
│ ├── README.md
│ ├── images
│ │ ├── Notebook-lm-on-AWS.jpg
│ │ └── notebooklm.gif
│ ├── kokoro
│ │ └── deployment
│ │ │ └── kokoro-tts.yaml
│ ├── llama3-8b
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── deployment
│ │ │ ├── openai-webui-deployment.yaml
│ │ │ └── vllm-rayserve-deployment.yaml
│ │ └── openai-client.py
│ ├── notebook-lm
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── build.sh
│ │ ├── deployment
│ │ │ ├── notebook-lm-deployment.yaml
│ │ │ └── notebooklm-sa.yaml
│ │ ├── poetry.lock
│ │ ├── pyproject.toml
│ │ ├── requirements.txt
│ │ ├── run-standalone.sh
│ │ └── src
│ │ │ ├── app.py
│ │ │ ├── constants.py
│ │ │ ├── prompts.py
│ │ │ ├── schema.py
│ │ │ └── utils.py
│ └── whisper-asr
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── build.sh
│ │ ├── deployment
│ │ └── whisper-asr.yaml
│ │ ├── images
│ │ └── Architecture.png
│ │ ├── requirements.txt
│ │ └── whisper-transformers.py
└── train_openclip_with_hyperpod
│ ├── README.md
│ ├── open_clip_trn.tar.gz
│ └── open_clip_trn
│ ├── .gitignore
│ ├── CITATION.cff
│ ├── Dockerfile
│ ├── HISTORY.md
│ ├── LICENSE
│ ├── MANIFEST.in
│ ├── Makefile
│ ├── README.md
│ ├── distributed_train.sh
│ ├── only_compile.sh
│ ├── only_compile_dis.sh
│ ├── only_train.sh
│ ├── only_train_dis.sh
│ ├── pytest.ini
│ ├── requirements-test.txt
│ ├── requirements-training.txt
│ ├── requirements.txt
│ ├── setup.sh
│ ├── setup_mfsq.py
│ ├── setup_openclip.py
│ ├── src
│ ├── open_clip
│ │ ├── __init__.py
│ │ ├── bpe_simple_vocab_16e6.txt.gz
│ │ ├── coca_model.py
│ │ ├── constants.py
│ │ ├── convert.py
│ │ ├── factory.py
│ │ ├── hf_configs.py
│ │ ├── hf_model.py
│ │ ├── loss.py
│ │ ├── model.py
│ │ ├── model_configs
│ │ │ ├── EVA01-g-14-plus.json
│ │ │ ├── EVA01-g-14.json
│ │ │ ├── EVA02-B-16.json
│ │ │ ├── EVA02-E-14-plus.json
│ │ │ ├── EVA02-E-14.json
│ │ │ ├── EVA02-L-14-336.json
│ │ │ ├── EVA02-L-14.json
│ │ │ ├── MobileCLIP-B.json
│ │ │ ├── MobileCLIP-S1.json
│ │ │ ├── MobileCLIP-S2.json
│ │ │ ├── RN101-quickgelu.json
│ │ │ ├── RN101.json
│ │ │ ├── RN50-quickgelu.json
│ │ │ ├── RN50.json
│ │ │ ├── RN50x16.json
│ │ │ ├── RN50x4.json
│ │ │ ├── RN50x64.json
│ │ │ ├── ViT-B-16-SigLIP-256.json
│ │ │ ├── ViT-B-16-SigLIP-384.json
│ │ │ ├── ViT-B-16-SigLIP-512.json
│ │ │ ├── ViT-B-16-SigLIP-i18n-256.json
│ │ │ ├── ViT-B-16-SigLIP.json
│ │ │ ├── ViT-B-16-plus-240.json
│ │ │ ├── ViT-B-16-plus.json
│ │ │ ├── ViT-B-16-quickgelu.json
│ │ │ ├── ViT-B-16.json
│ │ │ ├── ViT-B-32-256.json
│ │ │ ├── ViT-B-32-plus-256.json
│ │ │ ├── ViT-B-32-quickgelu.json
│ │ │ ├── ViT-B-32.json
│ │ │ ├── ViT-H-14-378-quickgelu.json
│ │ │ ├── ViT-H-14-CLIPA-336.json
│ │ │ ├── ViT-H-14-CLIPA.json
│ │ │ ├── ViT-H-14-quickgelu.json
│ │ │ ├── ViT-H-14.json
│ │ │ ├── ViT-H-16.json
│ │ │ ├── ViT-L-14-280.json
│ │ │ ├── ViT-L-14-336.json
│ │ │ ├── ViT-L-14-CLIPA-336.json
│ │ │ ├── ViT-L-14-CLIPA.json
│ │ │ ├── ViT-L-14-quickgelu.json
│ │ │ ├── ViT-L-14.json
│ │ │ ├── ViT-L-16-320.json
│ │ │ ├── ViT-L-16-SigLIP-256.json
│ │ │ ├── ViT-L-16-SigLIP-384.json
│ │ │ ├── ViT-L-16.json
│ │ │ ├── ViT-M-16-alt.json
│ │ │ ├── ViT-M-16.json
│ │ │ ├── ViT-M-32-alt.json
│ │ │ ├── ViT-M-32.json
│ │ │ ├── ViT-S-16-alt.json
│ │ │ ├── ViT-S-16.json
│ │ │ ├── ViT-S-32-alt.json
│ │ │ ├── ViT-S-32.json
│ │ │ ├── ViT-SO400M-14-SigLIP-384.json
│ │ │ ├── ViT-SO400M-14-SigLIP.json
│ │ │ ├── ViT-bigG-14-CLIPA-336.json
│ │ │ ├── ViT-bigG-14-CLIPA.json
│ │ │ ├── ViT-bigG-14.json
│ │ │ ├── ViT-e-14.json
│ │ │ ├── ViT-g-14.json
│ │ │ ├── ViTamin-B-LTT.json
│ │ │ ├── ViTamin-B.json
│ │ │ ├── ViTamin-L-256.json
│ │ │ ├── ViTamin-L-336.json
│ │ │ ├── ViTamin-L.json
│ │ │ ├── ViTamin-L2-256.json
│ │ │ ├── ViTamin-L2-336.json
│ │ │ ├── ViTamin-L2.json
│ │ │ ├── ViTamin-S-LTT.json
│ │ │ ├── ViTamin-S.json
│ │ │ ├── ViTamin-XL-256.json
│ │ │ ├── ViTamin-XL-336.json
│ │ │ ├── ViTamin-XL-384.json
│ │ │ ├── coca_ViT-B-32.json
│ │ │ ├── coca_ViT-L-14.json
│ │ │ ├── coca_base.json
│ │ │ ├── coca_roberta-ViT-B-32.json
│ │ │ ├── convnext_base.json
│ │ │ ├── convnext_base_w.json
│ │ │ ├── convnext_base_w_320.json
│ │ │ ├── convnext_large.json
│ │ │ ├── convnext_large_d.json
│ │ │ ├── convnext_large_d_320.json
│ │ │ ├── convnext_small.json
│ │ │ ├── convnext_tiny.json
│ │ │ ├── convnext_xlarge.json
│ │ │ ├── convnext_xxlarge.json
│ │ │ ├── convnext_xxlarge_320.json
│ │ │ ├── mt5-base-ViT-B-32.json
│ │ │ ├── mt5-xl-ViT-H-14.json
│ │ │ ├── nllb-clip-base-siglip.json
│ │ │ ├── nllb-clip-base.json
│ │ │ ├── nllb-clip-large-siglip.json
│ │ │ ├── nllb-clip-large.json
│ │ │ ├── roberta-ViT-B-32.json
│ │ │ ├── swin_base_patch4_window7_224.json
│ │ │ ├── vit_medium_patch16_gap_256.json
│ │ │ ├── vit_relpos_medium_patch16_cls_224.json
│ │ │ ├── xlm-roberta-base-ViT-B-32.json
│ │ │ └── xlm-roberta-large-ViT-H-14.json
│ │ ├── modified_resnet.py
│ │ ├── openai.py
│ │ ├── pos_embed.py
│ │ ├── pretrained.py
│ │ ├── push_to_hf_hub.py
│ │ ├── timm_model.py
│ │ ├── tokenizer.py
│ │ ├── transform.py
│ │ ├── transformer.py
│ │ ├── utils.py
│ │ ├── version.py
│ │ ├── zero_shot_classifier.py
│ │ └── zero_shot_metadata.py
│ └── open_clip_train
│ │ ├── __init__.py
│ │ ├── data.py
│ │ ├── distributed.py
│ │ ├── file_utils.py
│ │ ├── logger.py
│ │ ├── main.py
│ │ ├── params.py
│ │ ├── precision.py
│ │ ├── profiler.py
│ │ ├── scheduler.py
│ │ ├── train.py
│ │ └── zero_shot.py
│ ├── submit-openclip.sh
│ └── weighted_training
│ ├── __init__.py
│ ├── cfg
│ ├── e5-base.json
│ ├── e5-large-multi.json
│ ├── e5-large-v2.json
│ ├── e5-large.json
│ ├── e5-small-proj.json
│ ├── e5-small-unsupervised.json
│ ├── e5-small-v2.json
│ ├── e5-small.json
│ ├── gte-base.json
│ ├── gte-large.json
│ └── roberta-base-hf.json
│ ├── main.py
│ ├── models.py
│ ├── params.py
│ └── utils.py
├── integration
├── MCP
│ ├── Bedrock_QWEN.png
│ ├── Bedrock_marketplace_with_mcp_and_langchain.ipynb
│ └── deployment.png
├── README.md
├── genaiops-langfuse-on-aws
│ ├── README.md
│ ├── config.py
│ ├── lab1
│ │ ├── images
│ │ │ ├── langfuse-dashboard-use-case-1.png
│ │ │ ├── langfuse-link-prompt.png
│ │ │ ├── langfuse-prompt-management.png
│ │ │ ├── langfuse-trace-guardrail-denied-topic.png
│ │ │ ├── langfuse-trace-guardrail-pii-configuration.png
│ │ │ ├── langfuse-trace-guardrail-pii.png
│ │ │ ├── langfuse-trace-guardrail-prompt-injection.png
│ │ │ ├── langfuse-trace-tool-use-vision.png
│ │ │ ├── langfuse-trace-tool-use.png
│ │ │ ├── langfuse-trace-use-case-1.png
│ │ │ ├── langfuse-trace-use-case-2.png
│ │ │ ├── langfuse-trace-use-case-3.png
│ │ │ ├── langfuse-trace-use-case-4.png
│ │ │ ├── trace-observation-ui.png
│ │ │ ├── trace-observation.png
│ │ │ ├── trace-scores.png
│ │ │ ├── trace-sessions-ui.png
│ │ │ ├── trace-sessions.png
│ │ │ └── ws-event-outputs.png
│ │ ├── lab1-langfuse-basics.ipynb
│ │ └── lab1-langfuse-basics.ja.ipynb
│ ├── lab2
│ │ ├── README.md
│ │ ├── datasets
│ │ │ ├── LICENSE
│ │ │ ├── corpus
│ │ │ │ ├── 1973_oil_crisis.txt
│ │ │ │ ├── Amazon_rainforest.txt
│ │ │ │ ├── Black_Death.txt
│ │ │ │ ├── Civil_disobedience.txt
│ │ │ │ ├── Computational_complexity_theory.txt
│ │ │ │ ├── Construction.txt
│ │ │ │ ├── Ctenophora.txt
│ │ │ │ ├── European_Union_law.txt
│ │ │ │ ├── Fresno,_California.txt
│ │ │ │ ├── Geology.txt
│ │ │ │ ├── Huguenot.txt
│ │ │ │ ├── Normans.txt
│ │ │ │ ├── Oxygen.txt
│ │ │ │ ├── Packet_switching.txt
│ │ │ │ ├── Pharmacy.txt
│ │ │ │ ├── Private_school.txt
│ │ │ │ ├── Sky_(United_Kingdom).txt
│ │ │ │ ├── Southern_California.txt
│ │ │ │ ├── Steam_engine.txt
│ │ │ │ └── Victoria_(Australia).txt
│ │ │ └── qa.manifest.jsonl
│ │ ├── images
│ │ │ └── bedrock-kbs
│ │ │ │ ├── 01-bedrock-kb-console.png
│ │ │ │ ├── 02a-create-kb-basics.png
│ │ │ │ ├── 02b-create-kb-data-source.png
│ │ │ │ ├── 02c-create-kb-index.png
│ │ │ │ ├── 03-kb-detail-page.png
│ │ │ │ ├── 04a-kb-data-source-after-sync.png
│ │ │ │ ├── 04b-kb-data-sync-details.png
│ │ │ │ ├── 04c-kb-main-page.png
│ │ │ │ ├── 04d-langfuse-single-eval-trace-no-score.png
│ │ │ │ ├── 04e-langfuse-single-eval-trace-score.png
│ │ │ │ ├── 05-kb-select-model-claude-3-sonnet.png
│ │ │ │ ├── 06a-kb-test.png
│ │ │ │ └── score-with-sampling.png
│ │ ├── lab2-rag-langfuse.ipynb
│ │ └── lab2-rag-langfuse.ja.ipynb
│ ├── lab3
│ │ ├── README.md
│ │ ├── images
│ │ │ ├── langfuse-trace-guardrail-denied-topic.png
│ │ │ ├── langfuse-trace-guardrail-pii-configuration.png
│ │ │ ├── langfuse-trace-guardrail-pii.png
│ │ │ ├── langfuse-trace-guardrail-prompt-injection.png
│ │ │ ├── product_description_traces.png
│ │ │ ├── scored_trace.png
│ │ │ └── ws-event-outputs.png
│ │ ├── lab3.1-model-based-eval.ipynb
│ │ ├── lab3.1-model-based-eval.ja.ipynb
│ │ ├── lab3.2-bedrock-guardrials.ipynb
│ │ └── lab3.2-bedrock-guardrials.ja.ipynb
│ └── utils.py
└── langfuse
│ ├── images
│ ├── trace-observation.png
│ └── trace-sessions.png
│ └── langfuse-genaiops.ipynb
└── operations
├── sagemaker-mlflow-model-registry
├── requirements.txt
└── sm-mlflow_model_registry_register_model_shared_model_group.ipynb
├── sagemaker-mlflow-trace-evaluate-langgraph-agent
├── .env_sample
├── .gitignore
├── LICENSE
├── README.md
├── additional_evaluations_with_ragas.ipynb
├── data.py
├── evaluations.ipynb
├── golden_questions_answer.jsonl
├── graph.py
├── graph_diagram.png
├── mlflow_prompts.py
├── pyproject.toml
├── requirements.txt
├── run.py
├── tools.py
├── utils.py
└── uv.lock
└── sagemaker-unified-model-registry
├── .DS_Store
├── AbaloneExample.ipynb
├── Directmarketing.ipynb
└── bank-additional-full.csv
/ oss-idp-agentic-flow/bc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/ oss-idp-agentic-flow/bc.png
--------------------------------------------------------------------------------
/ oss-idp-agentic-flow/docling-extract.py:
--------------------------------------------------------------------------------
1 |
2 | from docling.document_converter import DocumentConverter
3 |
4 |
5 |
6 |
7 | source = "se.png"
8 | converter = DocumentConverter()
9 | result = converter.convert(source)
10 |
11 | print(result.document.export_to_html())
--------------------------------------------------------------------------------
/ oss-idp-agentic-flow/requirements.txt:
--------------------------------------------------------------------------------
1 | docling
2 | langgraph
3 | langchain-openai
4 | langchain
5 | langfuse
6 |
--------------------------------------------------------------------------------
/ oss-idp-agentic-flow/se.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/ oss-idp-agentic-flow/se.png
--------------------------------------------------------------------------------
/ oss-idp-agentic-flow/workflow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/ oss-idp-agentic-flow/workflow.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Jupyter Notebook
2 | .ipynb_checkpoints
3 | */.ipynb_checkpoints/*
4 | __pycache__/
5 |
6 | # IDE
7 | .idea/
8 | .vscode/
9 | *.swp
10 | *.swo
11 |
12 | # Environment
13 | .env
14 | .venv
15 | env/
16 | venv/
17 | ENV/
18 | env.bak/
19 | venv.bak/
20 |
21 | # OS
22 | .DS_Store
23 | Thumbs.db
24 |
25 | # Logs and databases
26 | *.log
27 | *.sqlite
28 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | ## Code of Conduct
2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4 | opensource-codeofconduct@amazon.com with any additional questions or comments.
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT No Attribution
2 |
3 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so.
10 |
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
13 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17 |
18 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## AWS GenAI ML Platform Examples
2 |
3 | This repository contains a collection of examples and resources to help you get started with the AWS Generative AI (GenAI)/ML Platform.
4 |
5 | ### Overview
6 | The AWS GenAI/ML Platform is a collection of tools and examples that enables you to build, train, and deploy models at scale. This repository provides a set of sample notebooks, scripts, and configurations to help you explore different aspects of the platform, including:
7 |
8 | - Data management: Examples for ingesting, preprocessing, and managing data for your GenAI models.
9 | - Governance: Samples for implementing governance and compliance best practices.
10 | - Infrastructure: Configuration templates for provisioning the necessary AWS resources.
11 | - Integration: Demonstrations of integrating opensource frameworks with AWS services.
12 | - Operations: Guidance on model lifecycle management.
13 |
14 | ### Getting Started
15 | To get started, follow these steps:
16 |
17 | Clone the repository to your local machine:
18 |
19 | ```
20 | git clone https://github.com/aws-samples/genai-ml-platform-examples.git
21 | ```
22 |
23 | Navigate to the repository directory:
24 |
25 | ```
26 | cd genai-ml-platform-examples
27 | ```
28 |
29 |
30 | Explore the contents of the repository and follow the instructions in the `README.md` files within each subdirectory.
31 |
32 | ### Contributing
33 |
34 | We welcome contributions to this repository! If you have any examples, improvements, or bug fixes to share, please see [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
35 |
36 | ## License
37 |
38 | This library is licensed under the MIT-0 License. See the LICENSE file.
39 |
40 |
--------------------------------------------------------------------------------
/demo-apps/health-app/LICENSE:
--------------------------------------------------------------------------------
1 | MIT No Attribution
2 |
3 | Copyright (c) 2025
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this
6 | software and associated documentation files (the "Software"), to deal in the Software
7 | without restriction, including without limitation the rights to use, copy, modify,
8 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
9 | permit persons to whom the Software is furnished to do so.
10 |
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
12 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
13 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
14 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
15 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
16 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/demo-apps/health-app/client/README.md:
--------------------------------------------------------------------------------
1 | # React Implementation
2 |
3 | Basic implementation using the [Pipecat React SDK](https://docs.pipecat.ai/client/react/introduction).
4 |
5 | ## Setup
6 |
7 | 1. Run the bot server; see [README](../../README).
8 |
9 | 2. Navigate to the `client/react` directory:
10 |
11 | ```bash
12 | cd client/react
13 | ```
14 |
15 | 3. Install dependencies:
16 |
17 | ```bash
18 | npm install
19 | ```
20 |
21 | 4. Run the client app:
22 |
23 | ```
24 | npm run dev
25 | ```
26 |
27 | 5. Visit http://localhost:5173 in your browser.
28 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/eslint.config.js:
--------------------------------------------------------------------------------
1 | import js from '@eslint/js'
2 | import globals from 'globals'
3 | import reactHooks from 'eslint-plugin-react-hooks'
4 | import reactRefresh from 'eslint-plugin-react-refresh'
5 | import tseslint from 'typescript-eslint'
6 |
7 | export default tseslint.config(
8 | { ignores: ['dist'] },
9 | {
10 | extends: [js.configs.recommended, ...tseslint.configs.recommended],
11 | files: ['**/*.{ts,tsx}'],
12 | languageOptions: {
13 | ecmaVersion: 2020,
14 | globals: globals.browser,
15 | },
16 | plugins: {
17 | 'react-hooks': reactHooks,
18 | 'react-refresh': reactRefresh,
19 | },
20 | rules: {
21 | ...reactHooks.configs.recommended.rules,
22 | 'react-refresh/only-export-components': [
23 | 'warn',
24 | { allowConstantExport: true },
25 | ],
26 | },
27 | },
28 | )
29 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | AWS AI Health Assistant
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "tsc && vite build",
9 | "lint": "eslint .",
10 | "preview": "vite preview"
11 | },
12 | "dependencies": {
13 | "@aws-amplify/ui-react": "^6.11.1",
14 | "@cloudscape-design/chat-components": "^1.0.44",
15 | "@cloudscape-design/components": "^3.0.968",
16 | "@cloudscape-design/design-tokens": "^3.0.57",
17 | "@cloudscape-design/global-styles": "^1.0.43",
18 | "@emotion/react": "^11.14.0",
19 | "@emotion/styled": "^11.14.0",
20 | "@mui/icons-material": "^7.1.0",
21 | "@mui/material": "^7.1.0",
22 | "@pipecat-ai/client-js": "^0.3.5",
23 | "@pipecat-ai/client-react": "^0.3.5",
24 | "@pipecat-ai/daily-transport": "^0.3.8",
25 | "@tailwindcss/vite": "^4.1.7",
26 | "clsx": "^2.1.1",
27 | "motion": "^12.12.1",
28 | "react": "^18.3.1",
29 | "react-dom": "^18.3.1",
30 | "react-icons": "^5.5.0",
31 | "react-type-animation": "^3.2.0",
32 | "tailwind-merge": "^3.3.0"
33 | },
34 | "devDependencies": {
35 | "@eslint/js": "^9.15.0",
36 | "@types/react": "^18.3.12",
37 | "@types/react-dom": "^18.3.1",
38 | "@vitejs/plugin-react": "^4.3.4",
39 | "autoprefixer": "^10.4.21",
40 | "eslint": "^9.15.0",
41 | "eslint-plugin-react-hooks": "^5.0.0",
42 | "eslint-plugin-react-refresh": "^0.4.14",
43 | "globals": "^15.12.0",
44 | "postcss": "^8.5.3",
45 | "tailwindcss": "^3.4.17",
46 | "typescript": "~5.6.2",
47 | "typescript-eslint": "^8.15.0",
48 | "vite": "^6.0.9"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/postcss.config.js:
--------------------------------------------------------------------------------
1 | export default {
2 | plugins: {
3 | tailwindcss: {},
4 | autoprefixer: {},
5 | },
6 | }
7 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/App.css:
--------------------------------------------------------------------------------
1 | * {
2 | box-sizing: border-box;
3 | }
4 |
5 | html,
6 | body {
7 | margin: 0;
8 | padding: 0;
9 | font-family: Arial, sans-serif;
10 | background-color: #f0f0f0;
11 | overflow-x: hidden;
12 | height: 100%;
13 | width: 100%;
14 | }
15 |
16 | body {
17 | position: relative;
18 | }
19 |
20 | .app {
21 | width: 100%;
22 | height: 100vh;
23 | position: relative;
24 | display: flex;
25 | flex-direction: column;
26 | }
27 |
28 | .status-bar {
29 | display: flex;
30 | justify-content: space-between;
31 | align-items: center;
32 | padding: 10px;
33 | background-color: #fff;
34 | border-radius: 8px;
35 | margin-bottom: 20px;
36 | }
37 |
38 | .controls button {
39 | padding: 8px 16px;
40 | margin-left: 10px;
41 | border: none;
42 | border-radius: 4px;
43 | cursor: pointer;
44 | }
45 |
46 | button:disabled {
47 | opacity: 0.5;
48 | cursor: not-allowed;
49 | }
50 |
51 | .connect-btn {
52 | background-color: #4caf50;
53 | color: white;
54 | }
55 |
56 | .disconnect-btn {
57 | background-color: #f44336;
58 | color: white;
59 | }
60 |
61 | .main-content {
62 | background-color: #fff;
63 | border-radius: 8px;
64 | padding: 20px;
65 | margin-bottom: 20px;
66 | }
67 |
68 | .bot-container {
69 | display: flex;
70 | flex-direction: column;
71 | align-items: center;
72 | }
73 |
74 | .video-container {
75 | width: 640px;
76 | height: 360px;
77 | background-color: #ddd;
78 | margin-bottom: 20px;
79 | border-radius: 8px;
80 | overflow: hidden;
81 | }
82 |
83 | .video-container video {
84 | width: 100%;
85 | height: 100%;
86 | object-fit: cover;
87 | }
88 |
89 | .mic-enabled {
90 | background-color: #4caf50;
91 | color: white;
92 | }
93 |
94 | .mic-disabled {
95 | background-color: #f44336;
96 | color: white;
97 | }
98 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/assets/avatars/Dr. Davis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/client/src/assets/avatars/Dr. Davis.png
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/assets/avatars/Dr. Johnson.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/client/src/assets/avatars/Dr. Johnson.png
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/assets/avatars/Dr. Smith.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/client/src/assets/avatars/Dr. Smith.png
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/assets/avatars/Dr. Williams.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/client/src/assets/avatars/Dr. Williams.png
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/assets/fonts/amazon-ember.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'Amazon Ember';
3 | src: url('https://m.media-amazon.com/images/G/01/AmazonUI/fonts/amazonember_rg-cc7ebaa05a2cd3b02c0929ac0475a44ab30b7efa._V2_.woff2') format('woff2'),
4 | url('https://m.media-amazon.com/images/G/01/AmazonUI/fonts/amazonember_rg-cb7f64bb6cde397b119ea106551893deedb8975d._V2_.woff') format('woff');
5 | font-weight: 400;
6 | font-style: normal;
7 | font-display: swap;
8 | }
9 |
10 | @font-face {
11 | font-family: 'Amazon Ember';
12 | src: url('https://m.media-amazon.com/images/G/01/AmazonUI/fonts/amazonember_bd-46b91bda68161c14e554a779643ef4957431987b._V2_.woff2') format('woff2'),
13 | url('https://m.media-amazon.com/images/G/01/AmazonUI/fonts/amazonember_bd-a344921ffd52563d3c1590dace4ef09c14c0d9a3._V2_.woff') format('woff');
14 | font-weight: 700;
15 | font-style: normal;
16 | font-display: swap;
17 | }
18 |
19 | @font-face {
20 | font-family: 'Amazon Ember';
21 | src: url('https://m.media-amazon.com/images/G/01/AmazonUI/fonts/amazonember_lt-9cc1bb64eb270135f1691c71588a5c5ff7e2420c._V2_.woff2') format('woff2'),
22 | url('https://m.media-amazon.com/images/G/01/AmazonUI/fonts/amazonember_lt-b605de63d0843593ad5c0cfeddee29ac251b528d._V2_.woff') format('woff');
23 | font-weight: 300;
24 | font-style: normal;
25 | font-display: swap;
26 | }
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/components/ChatMessage.tsx:
--------------------------------------------------------------------------------
1 | import { cn } from "../utils/tailwind";
2 |
3 | type ChatMessageProps = {
4 | message: string,
5 | sender: 'user' | 'assistant'
6 | };
7 |
8 | export default function ChatMessage(props: ChatMessageProps) {
9 | return (
10 |
11 | {props.message}
12 |
13 | )
14 | }
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/components/ChatRow.tsx:
--------------------------------------------------------------------------------
1 | import { MdHealthAndSafety } from "react-icons/md";
2 | import { cn } from "../utils/tailwind";
3 | import Avatar from "@cloudscape-design/chat-components/avatar";
4 |
5 | type ChatRowProps = {
6 | sender: 'user' | 'assistant'
7 | hideIcon: boolean;
8 | timestamp: Date
9 | children: React.ReactNode
10 | };
11 |
12 | export default function ChatRow(props: ChatRowProps) {
13 |
14 | return (
15 |
16 | {/* Icon */}
17 |
18 | {
19 | props.sender === 'user' ? (
20 |
28 | ) : (
29 |
30 |
31 |
32 | )
33 | }
34 |
35 |
36 | {/* Message Box */}
37 |
38 | {props.children}
39 |
{props.timestamp.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
40 |
41 |
42 | )
43 | }
44 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/components/ConnectedHeader.tsx:
--------------------------------------------------------------------------------
1 | import { cn } from "../utils/tailwind";
2 |
3 | type ConnectedHeaderProps = {
4 | connected: boolean
5 | onBtnClick: () => void
6 | };
7 |
8 | export default function ConnectedHeader(props: ConnectedHeaderProps) {
9 | return (
10 |
11 |
12 |
13 | Connected to AI Health Assistant
14 |
15 |
16 |
17 |
18 |
25 |
26 |
27 | )
28 | }
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/components/NavBar.tsx:
--------------------------------------------------------------------------------
1 | import { MdHealthAndSafety } from "react-icons/md";
2 | import awsLogo from "../assets/aws-logo.svg";
3 |
4 | export default function NavBar() {
5 | return (
6 |
7 |
8 |
9 |

10 |
11 |
12 |
13 |
AI Health Assistant
14 |
Powered by Amazon Nova Sonic
15 |
16 |
17 |
18 | )
19 | }
20 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/components/StatusBar.tsx:
--------------------------------------------------------------------------------
1 | import { FaMicrophone } from "react-icons/fa";
2 |
3 | type StatusBarProps = {
4 | onMicClick: () => void,
5 | onDisplayProcessingClick: () => void,
6 | status: 'LISTENING' | 'CONNECTING' | 'PROCESSING' | 'SPEAKING'
7 | };
8 |
9 | const statusMessages = {
10 | 'LISTENING': 'Listening ...',
11 | 'CONNECTING': 'Connecting',
12 | 'PROCESSING': 'Processing',
13 | 'SPEAKING': 'Speaking',
14 | }
15 |
16 | export function StatusBar(props: StatusBarProps) {
17 | return (
18 |
19 |
20 |
23 |
24 |
25 | {statusMessages[props.status]}
26 |
27 |
28 | )
29 | }
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/components/StatusDisplay.tsx:
--------------------------------------------------------------------------------
1 | import { useRTVIClientTransportState } from '@pipecat-ai/client-react';
2 | import { Chip, useTheme } from '@mui/material';
3 | import CheckCircleIcon from '@mui/icons-material/CheckCircle';
4 | import ErrorIcon from '@mui/icons-material/Error';
5 | import SyncIcon from '@mui/icons-material/Sync';
6 |
7 | export function StatusDisplay() {
8 | const transportState = useRTVIClientTransportState();
9 | const theme = useTheme();
10 |
11 | // Determine color and icon based on state
12 | let color = theme.palette.grey[500];
13 | let icon = ;
14 | let label = transportState;
15 |
16 | if (transportState === 'connected') {
17 | color = theme.palette.success.main;
18 | icon = ;
19 | } else if (transportState === 'disconnected') {
20 | color = theme.palette.error.main;
21 | icon = ;
22 | } else if (transportState === 'connecting') {
23 | color = theme.palette.warning.main;
24 | }
25 |
26 | return (
27 |
41 | );
42 | }
43 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/components/WelcomeScreen.tsx:
--------------------------------------------------------------------------------
1 | import Spinner from "@cloudscape-design/components/spinner";
2 | import { motion } from "motion/react";
3 | import { MdHealthAndSafety } from "react-icons/md";
4 | import { cn } from "../utils/tailwind";
5 |
6 | type WelcomeScreenProps = {
7 | connecting: boolean;
8 | transportState: string;
9 | micClick: () => void
10 | };
11 |
12 | export default function WelcomeScreen(props: WelcomeScreenProps) {
13 | return (
14 |
15 |
16 |
Welcome to AWS AI Health Assistant
17 |
Ask questions about symptoms, medications, or get health recommendations.
18 |
19 |
20 | {props.connecting ? (
21 |
23 | Connecting, please wait
24 |
25 | ) : (
26 |
Talk to assistant
33 | )}
34 | {props.transportState === 'error' &&
Unable to connect at the moment, please try again shortly
}
35 |
36 |
37 |
38 | )
39 | }
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/components/tools/DoctorDisplay.tsx:
--------------------------------------------------------------------------------
1 |
2 | import Avatar from "@cloudscape-design/chat-components/avatar";
3 | import Rating from "@mui/material/Rating";
4 | import { cn } from "../../utils/tailwind";
5 |
6 | type DoctorDisplayProps = {
7 | doctorAvatar?: string | null
8 | doctorName: string
9 | theme?: 'dark' | 'light'
10 | };
11 |
12 | export default function DoctorDisplay(props: DoctorDisplayProps) {
13 | return (
14 |
15 | {props.doctorAvatar ? (
16 |
17 |

23 |
24 | ) : (
25 |
31 | )}
32 |
33 |
{props.doctorName}
34 |
General Practitioner
35 |
36 |
37 |
38 | )
39 | }
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/components/tools/ToolDisplay.tsx:
--------------------------------------------------------------------------------
1 | import BookingSummaryWidget from "./BookingSummaryWidget";
2 | import DoctorAppointments, { shouldAddDoctorsAppointment } from "./DoctorAppointmentsWidget";
3 |
4 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
5 | export const availableTools: Record boolean> = {
6 | 'get_non_clashing_slots': shouldAddDoctorsAppointment,
7 | 'book_appointment': () => true
8 | };
9 |
10 | type ToolDisplayProps = {
11 | type: string,
12 | timestamp: Date,
13 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
14 | data: any
15 | };
16 |
17 | export default function ToolDisplay(props: ToolDisplayProps) {
18 | if (props.type === 'get_non_clashing_slots') {
19 | return
20 | } else if (props.type === 'book_appointment') {
21 | return
22 | } else return null;
23 | }
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/libs/audio.ts:
--------------------------------------------------------------------------------
1 | export async function getAudioDevices() {
2 | console.log('getting audio devices');
3 | const devices: MediaDeviceInfo[] =
4 | await navigator.mediaDevices.enumerateDevices();
5 | const microphones = devices.filter((device: MediaDeviceInfo) => {
6 | return (
7 | device.kind === 'audioinput' &&
8 | device.deviceId !== '' &&
9 | device.label !== ''
10 | );
11 | });
12 | const speakers = devices.filter((device: MediaDeviceInfo) => {
13 | return (
14 | device.kind === 'audiooutput' &&
15 | device.deviceId !== '' &&
16 | device.label !== ''
17 | );
18 | });
19 | return {
20 | input: microphones,
21 | output: speakers,
22 | };
23 | }
24 |
25 | export async function askPermission() {
26 | return await navigator.mediaDevices
27 | .getUserMedia({ audio: true, video: false })
28 | .then((stream) => {
29 | return true;
30 | })
31 | // If there is an error, we can't get access to the mic
32 | .catch((err) => {
33 | if (err instanceof DOMException && err.name === 'NotAllowedError') {
34 | return false;
35 | } else {
36 | throw new Error('Unexpected error getting microphone access');
37 | }
38 | });
39 | }
40 |
41 | export async function getCurrentPermissions() {
42 | let permissionState: PermissionState = 'prompt';
43 |
44 | if (navigator?.permissions) {
45 | await navigator.permissions
46 | ?.query({ name: 'microphone' })
47 | .then((result) => {
48 | permissionState = result.state;
49 | })
50 | .catch((err) => {
51 | if (err) {
52 | console.log(err);
53 | }
54 | console.log('error with permission query');
55 | });
56 | }
57 |
58 | return permissionState;
59 | }
60 |
61 | export function getDeviceById(deviceId: string) {
62 | return navigator.mediaDevices.getUserMedia({
63 | audio: { deviceId: { exact: deviceId } },
64 | });
65 | }
66 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/main.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import App from './App';
4 | import { RTVIProvider } from './providers/RTVIProvider';
5 |
6 | ReactDOM.createRoot(document.getElementById('root')!).render(
7 |
8 |
9 |
10 |
11 |
12 | );
13 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/providers/ThemeProvider.tsx:
--------------------------------------------------------------------------------
1 | import { ThemeProvider as MUIThemeProvider, createTheme } from '@mui/material/styles';
2 | import { PropsWithChildren } from 'react';
3 |
4 | const theme = createTheme({
5 | typography: {
6 | fontFamily: '"Amazon Ember", sans-serif',
7 | },
8 | });
9 |
10 | export function ThemeProvider({ children }: PropsWithChildren) {
11 | return {children};
12 | }
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/styles.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 | /* You can add global styles to this file, and also import other style files */
5 |
6 | body,
7 | html {
8 | width: 100%;
9 | height: 100%;
10 | margin: 0;
11 | font-family: "Roboto", "Helvetica", "Arial", sans-serif;
12 | }
13 |
14 | #root {
15 | height: 100%;
16 | }
17 |
18 | @keyframes pulse {
19 | 0% {
20 | transform: scale(1);
21 | }
22 | 50% {
23 | transform: scale(1.1);
24 | }
25 | 100% {
26 | transform: scale(1);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/types.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable @typescript-eslint/no-explicit-any */
2 | type Message = {
3 | text: string;
4 | };
5 |
6 | export type ToolEvent = {
7 | toolId: string;
8 | invocationId: string;
9 | payload: any;
10 | };
11 |
12 | export type Event = (
13 | | {
14 | type: "message";
15 | data: Message;
16 | }
17 | | {
18 | type: "tool";
19 | data: ToolEvent;
20 | }
21 | ) & {
22 | id: string;
23 | sender: "user" | "assistant";
24 | timestamp: Date;
25 | };
26 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/utils/collections.ts:
--------------------------------------------------------------------------------
1 | type MapValuesToKeysIfAllowed = {
2 | [K in keyof T]: T[K] extends PropertyKey ? K : never;
3 | };
4 | type Filter = MapValuesToKeysIfAllowed[keyof T];
5 |
6 | export function groupBy<
7 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
8 | T extends Record,
9 | Key extends Filter
10 | >(arr: T[], key: Key): Record {
11 | return arr.reduce((accumulator, val) => {
12 | const groupedKey = val[key];
13 | if (!accumulator[groupedKey]) {
14 | accumulator[groupedKey] = [];
15 | }
16 | accumulator[groupedKey].push(val);
17 | return accumulator;
18 | }, {} as Record);
19 | }
20 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/utils/date.tsx:
--------------------------------------------------------------------------------
1 | export const formatDateBooking = (dateString: string) => {
2 | const dateObj = new Date(dateString);
3 | const day = dateObj.getDate();
4 | const month = dateObj.toLocaleDateString('en-US', { month: 'long', year: 'numeric' });
5 | const dayOfWeek = dateObj.toLocaleDateString('en-US', { weekday: 'long' });
6 |
7 | function getOrdinalSuffix(day: number) {
8 | if (day >= 11 && day <= 13) {
9 | return 'th';
10 | }
11 | switch (day % 10) {
12 | case 1: return 'st';
13 | case 2: return 'nd';
14 | case 3: return 'rd';
15 | default: return 'th';
16 | }
17 | }
18 |
19 | return <>{dayOfWeek}, {day}{getOrdinalSuffix(day)} {month}>;
20 | }
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/utils/doctorAvatars.ts:
--------------------------------------------------------------------------------
1 | import drSmith from '../assets/avatars/Dr. Smith.png';
2 | import drWilliams from '../assets/avatars/Dr. Williams.png';
3 | import drJohnson from '../assets/avatars/Dr. Johnson.png';
4 | import drDavis from '../assets/avatars/Dr. Davis.png';
5 |
6 | // Map of doctor names to their avatar images
7 | const doctorAvatars: Record = {
8 | 'Dr. Smith': drSmith,
9 | 'Dr. Williams': drWilliams,
10 | 'Dr. Johnson': drJohnson,
11 | 'Dr. Davis': drDavis,
12 | };
13 |
14 | // Default avatar to use when no specific avatar is found
15 | const defaultAvatar = drSmith;
16 |
17 | /**
18 | * Get the avatar image for a specific doctor
19 | * @param doctorName Full name of the doctor
20 | * @returns URL to the doctor's avatar image
21 | */
22 | export const getDoctorAvatar = (doctorName: string): string => {
23 | // Check for exact matches
24 | if (doctorAvatars[doctorName]) {
25 | return doctorAvatars[doctorName];
26 | }
27 |
28 | // Check for partial matches
29 | for (const [name, avatar] of Object.entries(doctorAvatars)) {
30 | if (doctorName.includes(name)) {
31 | return avatar;
32 | }
33 | }
34 |
35 | // Return default avatar if no match found
36 | return defaultAvatar;
37 | };
38 |
39 | export default doctorAvatars;
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/utils/strings.ts:
--------------------------------------------------------------------------------
1 | export function capitalize(text: string) {
2 | return text.charAt(0).toUpperCase() + text.slice(1);
3 | }
4 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/utils/tailwind.ts:
--------------------------------------------------------------------------------
1 | import { twMerge } from 'tailwind-merge';
2 | import { ClassValue, clsx } from 'clsx';
3 |
4 | export const cn = (...inputs: ClassValue[]) => {
5 | return twMerge(clsx(inputs));
6 | };
7 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 |
3 | declare module "*.svg" {
4 | import React from "react";
5 | const SVG: React.FC>;
6 | export default SVG;
7 | }
8 |
9 | declare module "*.png" {
10 | const value: string;
11 | export default value;
12 | }
13 |
14 | declare module "*.jpg" {
15 | const value: string;
16 | export default value;
17 | }
18 |
19 | declare module "*.jpeg" {
20 | const value: string;
21 | export default value;
22 | }
--------------------------------------------------------------------------------
/demo-apps/health-app/client/tailwind.config.js:
--------------------------------------------------------------------------------
1 | const { join } = require('path');
2 |
3 | /** @type {import('tailwindcss').Config} */
4 | module.exports = {
5 | content: [
6 | "./index.html",
7 | "./src/**/*.{js,ts,jsx,tsx}",
8 | ],
9 | theme: {
10 | extend: {
11 | colors: {
12 | 'aws-dark-blue': '#232F3E',
13 | 'aws-dark-blue-light': '#31465F',
14 | 'aws-dark-blue-dark': '#1A242F',
15 | 'aws-orange': '#FF9900',
16 | 'aws-orange-light': '#FFA827',
17 | 'aws-orange-dark': '#E68A00',
18 | },
19 | },
20 | },
21 | plugins: [],
22 | };
23 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
6 | "module": "ESNext",
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "bundler",
11 | "allowImportingTsExtensions": true,
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "noEmit": true,
15 | "jsx": "react-jsx",
16 |
17 | /* Linting */
18 | "strict": true,
19 | "noUnusedLocals": true,
20 | "noUnusedParameters": true,
21 | "noFallthroughCasesInSwitch": true
22 | },
23 | "include": ["src"],
24 | "references": [{ "path": "./tsconfig.node.json" }]
25 | }
26 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/demo-apps/health-app/client/vite.config.ts:
--------------------------------------------------------------------------------
1 | import { defineConfig } from "vite";
2 | import react from "@vitejs/plugin-react";
3 |
4 | // https://vite.dev/config/
5 | export default defineConfig({
6 | plugins: [react()],
7 | });
8 |
--------------------------------------------------------------------------------
/demo-apps/health-app/data/bedrock-kb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/data/bedrock-kb.png
--------------------------------------------------------------------------------
/demo-apps/health-app/data/chunking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/data/chunking.png
--------------------------------------------------------------------------------
/demo-apps/health-app/data/datasource.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/data/datasource.png
--------------------------------------------------------------------------------
/demo-apps/health-app/data/embedding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/data/embedding.png
--------------------------------------------------------------------------------
/demo-apps/health-app/data/kb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/data/kb.png
--------------------------------------------------------------------------------
/demo-apps/health-app/data/store.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/data/store.db
--------------------------------------------------------------------------------
/demo-apps/health-app/data/sync.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/data/sync.png
--------------------------------------------------------------------------------
/demo-apps/health-app/server/.env.example:
--------------------------------------------------------------------------------
1 | # AI Health Assistant Environment Configuration
2 | # Copy this file to .env and fill in your actual values
3 |
4 | # Daily.co API Key
5 | # Get this from: https://dashboard.daily.co/developers
6 | # Used for audio/video communication between client and server
7 | DAILY_API_KEY=your_daily_api_key_here
8 |
9 | # AWS Credentials
10 | # These are required for AWS Bedrock access
11 | # You can get these from AWS IAM console or use AWS CLI configuration
12 | AWS_ACCESS_KEY_ID=your_aws_access_key_here
13 | AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key_here
14 |
15 | # AWS Region
16 | # The region where your Bedrock services are available
17 | # Nova Sonic is available in specific regions - check AWS documentation
18 | AWS_REGION=us-east-1
19 |
20 | # Amazon Bedrock Knowledge Base ID
21 | # Create a Knowledge Base in AWS Bedrock console and use its ID here
22 | # The Knowledge Base should contain health-related content for symptom guidance
23 | # Format: Usually looks like "XXXXXXXXXX" (10 characters)
24 | AMAZON_BEDROCK_KB_ID=your_bedrock_knowledge_base_id_here
25 |
26 | # Optional: Database Path (defaults to server/health_assistant.db if not set)
27 | # DB_PATH=./health_assistant.db
28 |
29 | # Optional: Log Level (defaults to INFO if not set)
30 | # LOG_LEVEL=INFO
--------------------------------------------------------------------------------
/demo-apps/health-app/server/.python-version:
--------------------------------------------------------------------------------
1 | 3.12
2 |
--------------------------------------------------------------------------------
/demo-apps/health-app/server/data/store.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/health-app/server/data/store.db
--------------------------------------------------------------------------------
/demo-apps/health-app/server/logger_config.py:
--------------------------------------------------------------------------------
1 | from loguru import logger
2 | import sys
3 |
4 |
5 | logger.remove(0)
6 | logger.add(sys.stderr, level="DEBUG")
--------------------------------------------------------------------------------
/demo-apps/health-app/server/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "server"
3 | version = "0.1.0"
4 | description = "Add your description here"
5 | readme = "README.md"
6 | requires-python = ">=3.12"
7 | dependencies = [
8 | "boto3>=1.38.18",
9 | "fastapi[all]>=0.115.12",
10 | "pipecat-ai[aws-nova-sonic,daily,silero,webrtc]",
11 | "python-dotenv>=1.1.0",
12 | "uvicorn>=0.34.2",
13 | "websockets==13.1",
14 | ]
15 |
16 | [tool.uv.sources]
17 | pipecat-ai = { git = "https://github.com/adithyaxx/pipecat.git", rev = "emit-func-call-event" }
18 |
--------------------------------------------------------------------------------
/demo-apps/health-app/server/requirements.txt:
--------------------------------------------------------------------------------
1 | python-dotenv
2 | fastapi[all]
3 | uvicorn
4 | websockets==13.1
5 | boto3
6 | git+https://github.com/adithyaxx/pipecat.git@emit-func-call-event#egg=pipecat-ai[daily,aws-nova-sonic,silero,webrtc]
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/.gitignore:
--------------------------------------------------------------------------------
1 | # Python
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 | *.so
6 | .Python
7 | build/
8 | develop-eggs/
9 | dist/
10 | downloads/
11 | eggs/
12 | .eggs/
13 | lib/
14 | lib64/
15 | parts/
16 | sdist/
17 | var/
18 | wheels/
19 | *.egg-info/
20 | .installed.cfg
21 | *.egg
22 |
23 | # Virtual Environment
24 | venv/
25 | ENV/
26 | env/
27 | .venv
28 |
29 | # Lambda packages
30 | *.zip
31 | travel-planner-lambda.zip
32 |
33 | # AWS
34 | .aws/
35 | response.json
36 | test-event.json
37 |
38 | # IDE
39 | .vscode/
40 | .idea/
41 | *.swp
42 | *.swo
43 | *~
44 |
45 | # OS
46 | .DS_Store
47 | Thumbs.db
48 |
49 | # Logs
50 | *.log
51 |
52 | # Environment variables
53 | .env
54 | .env.local
55 | .env.*.local
56 |
57 | # Test coverage
58 | htmlcov/
59 | .coverage
60 | .coverage.*
61 | coverage.xml
62 | *.cover
63 | .hypothesis/
64 | .pytest_cache/
65 |
66 | # Temporary files
67 | *.tmp
68 | *.bak
69 | .cache/
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/api_config.json:
--------------------------------------------------------------------------------
1 | {
2 | "api_id": "djvk0wal4m",
3 | "api_endpoint": "https://djvk0wal4m.execute-api.us-west-2.amazonaws.com/prod",
4 | "region": "us-west-2",
5 | "stage": "prod",
6 | "proxy_function": "travel-planner-proxy"
7 | }
8 |
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/data-setup/dsql/data/src/database/__init__.py:
--------------------------------------------------------------------------------
1 | """Database module for travel planning demo."""
2 |
3 | from .db_manager import DatabaseManager
4 | from .data_generator import DataGenerator
5 | from .models import City, Airline, Hotel, Flight, Activity
6 |
7 | __all__ = [
8 | 'DatabaseManager',
9 | 'DataGenerator',
10 | 'City',
11 | 'Airline',
12 | 'Hotel',
13 | 'Flight',
14 | 'Activity'
15 | ]
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/data-setup/dsql/data/src/knowledge_base/__init__.py:
--------------------------------------------------------------------------------
1 | """Knowledge Base module for AWS Bedrock Knowledge Base integration."""
2 |
3 | from .kb_adapter import KnowledgeBaseAdapter
4 |
5 | __all__ = ['KnowledgeBaseAdapter']
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/data-setup/dsql/data/src/models/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/demo-apps/travel-app/backend/data-setup/dsql/data/src/models/__init__.py
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/lambda/__init__.py:
--------------------------------------------------------------------------------
1 | # Lambda package root
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/lambda/tools/__init__.py:
--------------------------------------------------------------------------------
1 | """Travel planning tools for the orchestrator."""
2 |
3 | from .destinations import search_destinations
4 | from .flights import search_flights
5 | from .hotels import search_hotels
6 | from .activities import search_activities
7 | from .budget import analyze_budget
8 | from .itinerary import compile_itinerary
9 |
10 | __all__ = [
11 | 'search_destinations',
12 | 'search_flights',
13 | 'search_hotels',
14 | 'search_activities',
15 | 'analyze_budget',
16 | 'compile_itinerary'
17 | ]
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/lambda/utils/__init__.py:
--------------------------------------------------------------------------------
1 | """Utility modules for Lambda."""
2 |
3 | from .dsql import dsql, search_flights, search_hotels, search_activities, get_city_info
4 |
5 | __all__ = [
6 | 'dsql',
7 | 'search_flights',
8 | 'search_hotels',
9 | 'search_activities',
10 | 'get_city_info'
11 | ]
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/requirements-lambda.txt:
--------------------------------------------------------------------------------
1 | # Core dependencies for Lambda
2 | strands-agents>=0.1.6
3 | boto3>=1.38.27
4 | psycopg2-binary>=2.9.9
5 | pydantic>=2.5.0
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/requirements.txt:
--------------------------------------------------------------------------------
1 | boto3>=1.38.27
2 | psycopg2-binary>=2.9.9
3 | psycopg2
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/scripts/deploy_complete.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Complete deployment script: Package and Deploy Lambda with DSQL integration
4 | set -e
5 |
6 | echo "🚀 Complete Travel Planner Lambda Deployment"
7 | echo "============================================="
8 |
9 | # Change to project root
10 | cd "$(dirname "$0")/.."
11 |
12 | # Step 1: Package the Lambda
13 | echo ""
14 | echo "📦 Step 1: Packaging Lambda function..."
15 | ./scripts/package.sh
16 |
17 | # Step 2: Deploy the Lambda
18 | echo ""
19 | echo "🚀 Step 2: Deploying Lambda function..."
20 | ./scripts/deploy.sh
21 |
22 | echo ""
23 | echo "🎉 Complete deployment finished!"
24 | echo ""
25 | echo "📚 Usage Examples:"
26 | echo " Find hotels: /usr/local/bin/aws lambda invoke --function-name travel-planner-orchestrator --payload '{\"prompt\":\"Find luxury hotels in Paris\"}' /tmp/response.json"
27 | echo " Search destinations: /usr/local/bin/aws lambda invoke --function-name travel-planner-orchestrator --payload '{\"prompt\":\"Recommend romantic destinations in Europe\"}' /tmp/response.json"
28 | echo " Plan trip: /usr/local/bin/aws lambda invoke --function-name travel-planner-orchestrator --payload '{\"prompt\":\"Plan a 5-day trip to Tokyo for $3000\"}' /tmp/response.json"
--------------------------------------------------------------------------------
/demo-apps/travel-app/backend/scripts/package.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Package Lambda function with layers for deployment
4 | # Based on strands example approach
5 |
6 | set -e
7 |
8 | echo "🚀 Packaging Travel Planner Lambda with layers..."
9 |
10 | # Colors for output
11 | GREEN='\033[0;32m'
12 | YELLOW='\033[1;33m'
13 | RED='\033[0;31m'
14 | NC='\033[0m' # No Color
15 |
16 | # Configuration
17 | LAMBDA_DIR="lambda"
18 | PACKAGING_DIR="packaging"
19 | APP_ZIP="packaging/app.zip"
20 | DEPS_ZIP="packaging/dependencies.zip"
21 |
22 | # Clean previous build
23 | echo -e "${YELLOW}Cleaning previous build...${NC}"
24 | rm -rf $PACKAGING_DIR
25 | mkdir -p $PACKAGING_DIR
26 |
27 | # Install dependencies with correct platform
28 | echo -e "${YELLOW}Installing dependencies for Lambda...${NC}"
29 | pip install -r requirements-lambda.txt \
30 | --platform manylinux2014_x86_64 \
31 | --target $PACKAGING_DIR/_dependencies \
32 | --python-version 3.12 \
33 | --implementation cp \
34 | --only-binary=:all: \
35 | --upgrade
36 |
37 | # Create dependencies layer zip
38 | echo -e "${YELLOW}Creating dependencies layer...${NC}"
39 | cd $PACKAGING_DIR/_dependencies
40 | # Lambda layers expect dependencies in python/ directory
41 | mkdir -p ../python
42 | cp -r * ../python/
43 | cd ../
44 | zip -r dependencies.zip python -q
45 | rm -rf python _dependencies
46 | cd ..
47 |
48 | # Create application zip
49 | echo -e "${YELLOW}Creating application package...${NC}"
50 | cd $LAMBDA_DIR
51 | zip -r ../$APP_ZIP . -q
52 | cd ..
53 |
54 | # Get package sizes
55 | APP_SIZE=$(du -h $APP_ZIP | cut -f1)
56 | DEPS_SIZE=$(du -h $DEPS_ZIP | cut -f1)
57 |
58 | echo -e "${GREEN}✅ Lambda packages created successfully!${NC}"
59 | echo -e " Application: $APP_ZIP ($APP_SIZE)"
60 | echo -e " Dependencies: $DEPS_ZIP ($DEPS_SIZE)"
61 |
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/.env.local:
--------------------------------------------------------------------------------
1 |
2 | REACT_APP_USE_SIMULATION=false
3 | REACT_APP_API_ENDPOINT=https://your-api.us-west-2.amazonaws.com/prod
4 | REACT_APP_USE_BACKEND_STRANDS=true
5 | REACT_APP_WEBSOCKET_ENDPOINT=
6 |
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/build/asset-manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "files": {
3 | "main.css": "/static/css/main.2a72a2cb.css",
4 | "main.js": "/static/js/main.c8efce8a.js",
5 | "index.html": "/index.html",
6 | "main.2a72a2cb.css.map": "/static/css/main.2a72a2cb.css.map",
7 | "main.c8efce8a.js.map": "/static/js/main.c8efce8a.js.map"
8 | },
9 | "entrypoints": [
10 | "static/css/main.2a72a2cb.css",
11 | "static/js/main.c8efce8a.js"
12 | ]
13 | }
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/build/index.html:
--------------------------------------------------------------------------------
1 | AWS Travel Planning Demo
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/build/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Travel Demo",
3 | "name": "AWS Travel Planning Demo",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#1976d2",
24 | "background_color": "#ffffff"
25 | }
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "Travel Demo",
3 | "name": "AWS Travel Planning Demo",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#1976d2",
24 | "background_color": "#ffffff"
25 | }
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { Routes, Route } from 'react-router-dom';
3 | import Box from '@mui/material/Box';
4 | import { ThemeProvider } from '@mui/material/styles';
5 | import CssBaseline from '@mui/material/CssBaseline';
6 | import Header from './components/common/Header';
7 | import Footer from './components/common/Footer';
8 | import HomePage from './pages/HomePage';
9 | import DemoPage from './pages/DemoPage';
10 | import AboutPage from './pages/AboutPage';
11 | import { ChatProvider } from './context/ChatContext';
12 | import { Notifications, WebSocketStatus } from './components/common';
13 | import theme from './theme';
14 |
15 | const App: React.FC = () => {
16 | return (
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | } />
25 | } />
26 | } />
27 |
28 |
29 |
30 |
31 | {/* Real-time features from task 7.5 */}
32 |
33 |
34 |
35 |
36 |
37 | );
38 | };
39 |
40 | export default App;
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/src/components/common/Footer.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import Box from '@mui/material/Box';
3 | import Typography from '@mui/material/Typography';
4 | import Container from '@mui/material/Container';
5 | import Link from '@mui/material/Link';
6 |
7 | const Footer: React.FC = () => {
8 | return (
9 | theme.palette.primary.main,
16 | color: 'white',
17 | }}
18 | >
19 |
20 |
21 | {'AWS Travel Planning Demo - Powered by '}
22 |
23 | Amazon Bedrock
24 | {', '}
25 |
26 | Amazon DSQL
27 | {', and '}
28 |
29 | AWS Strands Agents
30 |
31 | {' - '}
32 | {new Date().getFullYear()}
33 |
34 |
35 | This demo showcases model-driven AI agent orchestration with serverless scalability.
36 |
37 |
38 |
39 | );
40 | };
41 |
42 | export default Footer;
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/src/components/common/index.ts:
--------------------------------------------------------------------------------
1 | export { default as WebSocketStatus } from './WebSocketStatus';
2 | export { default as Notifications } from './Notifications';
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/src/hooks/index.ts:
--------------------------------------------------------------------------------
1 | export { default as useWebSocket } from './useWebSocket';
2 | export { default as useNotifications } from './useNotifications';
3 | export { default as useTravelPlan } from './useTravelPlan';
4 |
5 | // Re-export hook types
6 | export type { } from './useWebSocket';
7 | export type { } from './useNotifications';
8 | export type { } from './useTravelPlan';
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import { BrowserRouter } from 'react-router-dom';
4 | import CssBaseline from '@mui/material/CssBaseline';
5 | import { ThemeProvider } from '@mui/material/styles';
6 | import App from './App';
7 | import theme from './theme';
8 | import './index.css';
9 |
10 | const root = ReactDOM.createRoot(
11 | document.getElementById('root') as HTMLElement
12 | );
13 |
14 | root.render(
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | );
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/src/utils/testHelpers.ts:
--------------------------------------------------------------------------------
1 | /**
2 | * Helper functions for testing simulation behavior
3 | */
4 |
5 | /**
6 | * Logs the current state of the simulation
7 | * @param stageActive Whether the workflow stage is not 'idle'
8 | * @param connectionActive Whether the connection is active
9 | * @param activeAgents List of active agents
10 | */
11 | export const logSimulationState = (
12 | stageActive: boolean,
13 | connectionActive: boolean,
14 | activeAgents: string[]
15 | ): void => {
16 | console.log('---- Simulation State Check ----');
17 | console.log(`Workflow Active: ${stageActive ? 'YES' : 'NO'}`);
18 | console.log(`Connection Active: ${connectionActive ? 'YES' : 'NO'}`);
19 | console.log(`Active Agents: ${activeAgents.length ? activeAgents.join(', ') : 'None'}`);
20 | console.log('-------------------------------');
21 | };
22 |
23 | /**
24 | * Verifies that the simulation is in the correct state
25 | *
26 | * Use in development to check if simulation only starts after user input
27 | */
28 | export const verifySimulationBehavior = (): void => {
29 | // Check localStorage for our test flag
30 | const hasUserInput = localStorage.getItem('travelPlannerUserInput') === 'true';
31 | const simulationActive = localStorage.getItem('travelPlannerSimulationActive') === 'true';
32 |
33 | console.log('---- Simulation Behavior Check ----');
34 | console.log(`User Has Provided Input: ${hasUserInput ? 'YES' : 'NO'}`);
35 | console.log(`Simulation Is Active: ${simulationActive ? 'YES' : 'NO'}`);
36 |
37 | if (simulationActive && !hasUserInput) {
38 | console.error('ERROR: Simulation is active before user input!');
39 | } else if (simulationActive && hasUserInput) {
40 | console.log('CORRECT: Simulation started after user input');
41 | } else if (!simulationActive && !hasUserInput) {
42 | console.log('CORRECT: Simulation not active before user input');
43 | }
44 | console.log('----------------------------------');
45 | };
--------------------------------------------------------------------------------
/demo-apps/travel-app/frontend/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "jsx": "react-jsx"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
--------------------------------------------------------------------------------
/infrastructure/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/.DS_Store
--------------------------------------------------------------------------------
/infrastructure/cost-efficient-model-inference-sagemaker-graviton/buildspec.yml:
--------------------------------------------------------------------------------
1 | version: 0.2
2 |
3 | phases:
4 | pre_build:
5 | commands:
6 | - echo Logging in to Amazon ECR...
7 | - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
8 | - aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin 763104351884.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
9 | - REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$ECR_REPO_NAME
10 | - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
11 | - IMAGE_TAG=${COMMIT_HASH:=latest}
12 | build:
13 | commands:
14 | - echo Build started on `date`
15 | - echo Building the Docker image...
16 | - docker build -t $REPOSITORY_URI:latest .
17 | - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
18 | post_build:
19 | commands:
20 | - echo Build completed on `date`
21 | - echo Pushing the Docker images...
22 | - docker push $REPOSITORY_URI:latest
23 | - docker push $REPOSITORY_URI:$IMAGE_TAG
24 | - echo Writing image definitions file...
25 | - printf '{"ImageURI":"%s"}' $REPOSITORY_URI:$IMAGE_TAG > imageDefinitions.json
26 | artifacts:
27 | files:
28 | - imageDefinitions.json
29 |
--------------------------------------------------------------------------------
/infrastructure/cost-efficient-model-inference-sagemaker-graviton/code/inference.py:
--------------------------------------------------------------------------------
1 | import json
2 | import logging
3 | import os
4 | from llama_cpp import Llama
5 | from multiprocessing import cpu_count
6 |
7 | worker_count = os.environ.get('SAGEMAKER_MODEL_SERVER_WORKERS', cpu_count())
8 | model_file = os.environ.get('MODEL_FILE_GGUF', 'DeepSeek-R1-Distill-Llama-8B-Q4_0.gguf')
9 |
10 | def input_fn(request_body, request_content_type, context):
11 | return json.loads(request_body)
12 |
13 | def model_fn(model_dir):
14 | model=Llama(
15 | model_path=f"{model_dir}/{model_file}",
16 | verbose=False,
17 | n_threads=cpu_count() // int(worker_count) # Graviton has 1 vCPU = 1 physical core
18 | )
19 | logging.info("Loaded model successfully")
20 | return model
21 |
22 | def predict_fn(input_data, model, context):
23 | response = model.create_chat_completion(
24 | **input_data
25 | )
26 | return response
27 |
28 | def output_fn(prediction, response_content_type, context):
29 | return json.dumps(prediction)
30 |
--------------------------------------------------------------------------------
/infrastructure/cost-efficient-model-inference-sagemaker-graviton/code/requirements.txt:
--------------------------------------------------------------------------------
1 | huggingface-hub
2 |
--------------------------------------------------------------------------------
/infrastructure/cost-efficient-model-inference-sagemaker-graviton/stack.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/cost-efficient-model-inference-sagemaker-graviton/stack.png
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/efficient model inference/.DS_Store
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | ## Code of Conduct
2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct).
3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact
4 | opensource-codeofconduct@amazon.com with any additional questions or comments.
5 |
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/LICENSE:
--------------------------------------------------------------------------------
1 | MIT No Attribution
2 |
3 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so.
10 |
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
13 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
17 |
18 |
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/README.md:
--------------------------------------------------------------------------------
1 | # EKS-LLM
2 |
3 |
4 |
5 | ## Getting started
6 |
7 | The main goal for this repo is to make it easier for the audience to test and validate multiple LLMs with different runtime engines on EKS.
8 | This repo aims to provide the following.
9 | 1. A simple script to deploy EKS with Karpenter NodePools for CPU, Kuberay and OSS observability stack. This script is available at base_eks_setup folder. Make sure you have authenticated with aws cli before running this. The script will provision a cluster in the Sydney region, install Grafna/Prometheus and KubeRay to serve models.
10 | 2. Ray Servers to serve LLama.cpp (CPU) and VLLM models (GPU). The ray-server folder contains the python code that enables RayServe to serve the model usin gLLaMa.cpp engine.
11 | 3. Ray Services to deploy clusters on EKS. Ray cluster configuration is available at ray-services folder.
12 | 4. Once you deploy your Ray clutser, you can provision load balancer via ra-services/ingress folder.
13 | 5. Performace scripts to capture and select what works for you. The docketfiles/benchmark folder a GO program to hit the deploymed model over HTTP
14 |
15 | >> *Warning
16 | >> Make sure to change the HF ID in the ray-services/ray-service-vllm-llama-3.2-CPU-LLAMA.yaml and ray-service-vllm-llama-3.2-CPU-LLAMA-arm.yaml files
17 |
18 | Please refer to the blog XXX that utilises thses scripts for a measurements of Intel vs Graviton.
19 |
20 | ## Contact
21 | Please contact wangaws@ or fmamazon@ if you want to know more and/or contribute.
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/base_eks_setup/prometheus-monitoring.yaml:
--------------------------------------------------------------------------------
1 | ---
2 | apiVersion: monitoring.coreos.com/v1
3 | kind: ServiceMonitor
4 | metadata:
5 | name: vllm
6 | namespace: monitoring
7 | labels:
8 | release: kube-prometheus-stack
9 | spec:
10 | endpoints:
11 | - path: '/metrics/'
12 | port: metrics
13 | selector:
14 | matchLabels:
15 | app.kubernetes.io/name: kuberay
16 | ---
17 | apiVersion: monitoring.coreos.com/v1
18 | kind: PodMonitor
19 | metadata:
20 | labels:
21 | release: prometheus
22 | name: kuberay-cluster
23 | namespace: monitoring # ns where prometheus is deployed
24 | spec:
25 | podMetricsEndpoints:
26 | - port: metrics
27 | path: '/metrics/'
28 | namespaceSelector:
29 | matchNames:
30 | - kuberay-system # ns where Ray cluster is deployed
31 | selector:
32 | matchLabels:
33 | app.kubernetes.io/name: kuberay
34 | ---
35 | apiVersion: monitoring.coreos.com/v1
36 | kind: PodMonitor
37 | metadata:
38 | name: ray-workers-monitor
39 | namespace: monitoring
40 | labels:
41 | # `release: $HELM_RELEASE`: Prometheus can only detect PodMonitor with this label.
42 | release: prometheus
43 | spec:
44 | jobLabel: ray-workers
45 | # Only select Kubernetes Pods in the "default" namespace.
46 | namespaceSelector:
47 | matchNames:
48 | - kuberay-system
49 | # Only select Kubernetes Pods with "matchLabels".
50 | selector:
51 | matchLabels:
52 | ray.io/node-type: worker
53 | # A list of endpoints allowed as part of this PodMonitor.
54 | podMetricsEndpoints:
55 | - port: metrics
56 | path: '/metrics/'
57 | relabelings:
58 | - sourceLabels: [__meta_kubernetes_pod_label_ray_io_cluster]
59 | targetLabel: ray_io_cluster
60 |
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/deepseek/deepseek_on_graviton.py:
--------------------------------------------------------------------------------
1 | import json
2 | import argparse
3 |
4 | from llama_cpp import Llama
5 |
6 | parser = argparse.ArgumentParser()
7 | parser.add_argument("-m", "--model", type=str, default="DeepSeek-R1-Distill-Llama-70B-Q4_0.gguf")
8 | args = parser.parse_args()
9 |
10 | # for example, for a .16xlarge instance, set n_threads=64
11 | llm = Llama(model_path=args.model,
12 | n_threads=64)
13 |
14 | output = llm(
15 | "Question: How to build a visually appealing website in ten steps? Answer: ",
16 | max_tokens=512,
17 | echo=True,
18 | )
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/deepseek/deepseek_on_graviton.sh:
--------------------------------------------------------------------------------
1 | # Clone llama.cpp
2 | git clone https://github.com/ggerganov/llama.cpp
3 | cd llama.cpp
4 |
5 | # build with cmake
6 | mkdir build
7 | cd build
8 | cmake .. -DCMAKE_CXX_FLAGS="-mcpu=native" -DCMAKE_C_FLAGS="-mcpu=native"
9 | cmake --build . -v --config Release -j `nproc`
10 |
11 | # Download model
12 | cd bin
13 | wget https://huggingface.co/bartowski/DeepSeek-R1-Distill-Llama-70B-GGUF/resolve/main/DeepSeek-R1-Distill-Llama-70B-Q4_0.gguf
14 |
15 | # Running model inference with llama.cpp cli
16 | ./llama-cli -m DeepSeek-R1-Distill-Llama-70B-Q4_0.gguf -p "Building a visually appealing website can be done in ten simple steps:/" -n 512 -t 64
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/dockerfiles/benchmark/Dockerfile:
--------------------------------------------------------------------------------
1 | # Build stage
2 | FROM golang:1.21-alpine AS builder
3 |
4 | WORKDIR /app
5 | COPY . .
6 | RUN CGO_ENABLED=0 GOOS=linux go build -o benchmark perf_benchmark.go
7 |
8 | # Run stage
9 | FROM alpine:latest
10 |
11 | WORKDIR /app
12 | COPY --from=builder /app/benchmark .
13 | COPY prompts.txt /app
14 |
15 | ENV URL="http://localhost:8000/v1/chat/completions"
16 | ENV REQUESTS_PER_PROMPT=10
17 | ENV NUM_WARMUP_REQUESTS=3
18 |
19 | CMD ["./benchmark"]
20 |
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/dockerfiles/benchmark/prompts.txt:
--------------------------------------------------------------------------------
1 | In about 150 tokens, explain how generative AI models create new content from training data.
2 | Using approximately 150 tokens, describe the key differences between GPT-3 and GPT-4 architectures.
3 | In around 150 tokens, explain how temperature affects AI model output diversity.
4 | Describe, in about 150 tokens, the role attention mechanisms play in transformer models.
5 | In approximately 150 tokens, outline the process of fine-tuning a language model.
6 | Using about 150 tokens, explain how RAG improves AI model accuracy and knowledge.
7 | In roughly 150 tokens, discuss the main challenges in prompt engineering.
8 | Explain the concept of zero-shot learning in AI models, using about 150 tokens.
9 | In approximately 150 tokens, describe how embeddings represent text in vector space.
10 | Discuss the significance of context length in LLMs, using about 150 tokens.
11 | In around 150 tokens, describe the token limitation problem in language models.
12 | Explain how few-shot learning works in generative AI, using approximately 150 tokens.
13 | In about 150 tokens, outline the benefits of model quantization.
14 | Using roughly 150 tokens, explain the concept of knowledge distillation in AI.
15 | In approximately 150 tokens, describe how RLHF improves AI model outputs.
16 | Discuss the key metrics for evaluating GenAI models, using about 150 tokens.
17 | In around 150 tokens, describe the challenges of AI model hallucination.
18 | Explain how prompt injection affects model security, using approximately 150 tokens.
19 | In about 150 tokens, discuss the role of tokenization in language models.
20 | Using approximately 150 tokens, explain the concept of model alignment in AI.
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/dockerfiles/ray-llama-cpp/Dockerfile.intel:
--------------------------------------------------------------------------------
1 | FROM rayproject/ray:2.39.0-py312-cpu
2 | USER root
3 | RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends \
4 | ninja-build \
5 | cmake \
6 | libopenblas-dev \
7 | build-essential \
8 | && apt-get clean \
9 | && rm -rf /var/lib/apt/lists/* /tmp/*
10 |
11 |
12 | RUN apt-get update -y \
13 | && apt-get install -y git wget vim numactl gcc-12 g++-12 python3 python3-pip libtcmalloc-minimal4 \
14 | && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12
15 |
16 | RUN apt-get install -y libopenblas-dev ccache libomp-dev
17 |
18 | USER ray
19 | RUN python3 -m pip install --upgrade pip
20 |
21 |
22 | RUN pip install intel-openmp
23 | RUN pip install --pre --upgrade ipex-llm[cpp]
24 |
25 | #ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4:/usr/local/lib/libiomp5.so:$LD_PRELOAD"
26 |
27 | #RUN pip install https://intel-extension-for-pytorch.s3.amazonaws.com/ipex_dev/cpu/intel_extension_for_pytorch-2.3.100%2Bgit0eb3473-cp310-cp310-linux_x86_64.whl
28 |
29 | RUN pip install --upgrade pip \
30 | && pip install wheel packaging ninja "setuptools>=49.4.0" numpy
31 |
32 | # https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors
33 | RUN python3 -m pip install --upgrade pip pytest cmake scikit-build setuptools fastapi uvicorn sse-starlette pydantic-settings starlette-context
34 | ENV CMAKE_ARGS="-DCMAKE_CXX_FLAGS=-fopenmp -DGGML_BLAS=ON -DGGML_BLAS_VENDOR=OpenBLAS"
35 | ENV FORCE_CMAKE=1
36 | ENV GGML_BLAS_VENDOR=OpenBLAS
37 | RUN CMAKE_ARGS="-DCMAKE_CXX_FLAGS=-fopenmp" LLAMA_OPENBLAS=1 python3 -m pip install llama-cpp-python==0.3.2 --verbose
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/ray-server/local-requirements.txt:
--------------------------------------------------------------------------------
1 | llama_cpp_python==0.3.2
2 | transformers==4.48.0
3 | fastapi[all]
4 | ray==2.43.0
5 | starlette==0.41.3
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/ray-services/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/efficient model inference/ray-services/.DS_Store
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/ray-services/ingress/add-sg-lb-eks.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 |
4 | REGION=ap-southeast-2
5 | CLUSTER_NAME=llm-eks-cluster
6 | ALB_NAME=llama-cpp-cpu-lb
7 | export AWS_DEFAULT_REGION=$REGION
8 |
9 | CLUSTER_SG=$(aws eks describe-cluster \
10 | --name $CLUSTER_NAME \
11 | --query 'cluster.resourcesVpcConfig.clusterSecurityGroupId' \
12 | --output text)
13 |
14 | ALB_SG=$(aws elbv2 describe-load-balancers \
15 | --names $ALB_NAME \
16 | --query 'LoadBalancers[0].SecurityGroups[0]' \
17 | --output text)
18 |
19 | aws ec2 authorize-security-group-ingress \
20 | --group-id $CLUSTER_SG \
21 | --source-group $ALB_SG \
22 | --protocol tcp \
23 | --port-range 0-65535
--------------------------------------------------------------------------------
/infrastructure/efficient model inference/ray-services/ingress/ingress-cpu.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: networking.k8s.io/v1
2 | kind: Ingress
3 | metadata:
4 | name: llama-3-8b-cpu-llama-serve-ingress
5 | namespace: kuberay-system
6 | annotations:
7 | alb.ingress.kubernetes.io/scheme: internet-facing
8 | alb.ingress.kubernetes.io/target-type: ip
9 | alb.ingress.kubernetes.io/load-balancer-name: "llama-cpp-cpu-lb"
10 | alb.ingress.kubernetes.io/healthcheck-protocol: HTTP
11 | alb.ingress.kubernetes.io/healthcheck-port: "8265"
12 | alb.ingress.kubernetes.io/healthcheck-path: "/"
13 | alb.ingress.kubernetes.io/success-codes: "200"
14 | spec:
15 | ingressClassName: alb
16 | rules:
17 | - http:
18 | paths:
19 | - path: /
20 | pathType: Prefix
21 | backend:
22 | service:
23 | name: llama-3-8b-cpu-llama-head-svc
24 | port:
25 | number: 8000
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/infrastructure/inference_component_scale_to_zero/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/inference_component_scale_to_zero/__init__.py
--------------------------------------------------------------------------------
/infrastructure/inference_component_scale_to_zero/app.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | import aws_cdk as cdk
3 |
4 | from inference_component_cdk.inference_component_cdk_stack import InferenceComponentCdkStack
5 |
6 |
7 | app = cdk.App()
8 | InferenceComponentCdkStack(app, "InferenceComponentCdkStack",
9 | # If you don't specify 'env', this stack will be environment-agnostic.
10 | # Account/Region-dependent features and context lookups will not work,
11 | # but a single synthesized template can be deployed anywhere.
12 |
13 | # Uncomment the next line to specialize this stack for the AWS Account
14 | # and Region that are implied by the current CLI configuration.
15 |
16 | #env=cdk.Environment(account=os.getenv('CDK_DEFAULT_ACCOUNT'), region=os.getenv('CDK_DEFAULT_REGION')),
17 |
18 | # Uncomment the next line if you know exactly what Account and Region you
19 | # want to deploy the stack to. */
20 |
21 | #env=cdk.Environment(account='123456789012', region='us-east-1'),
22 |
23 | # For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
24 | )
25 |
26 | app.synth()
27 |
--------------------------------------------------------------------------------
/infrastructure/inference_component_scale_to_zero/inference_component_cdk/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/inference_component_scale_to_zero/inference_component_cdk/__init__.py
--------------------------------------------------------------------------------
/infrastructure/inference_component_scale_to_zero/requirements-dev.txt:
--------------------------------------------------------------------------------
1 | pytest==6.2.5
2 |
--------------------------------------------------------------------------------
/infrastructure/inference_component_scale_to_zero/requirements.txt:
--------------------------------------------------------------------------------
1 | aws-cdk-lib==2.166.0
2 | constructs>=10.0.0,<11.0.0
3 |
--------------------------------------------------------------------------------
/infrastructure/inference_component_scale_to_zero/source.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | rem The sole purpose of this script is to make the command
4 | rem
5 | rem source .venv/bin/activate
6 | rem
7 | rem (which activates a Python virtualenv on Linux or Mac OS X) work on Windows.
8 | rem On Windows, this command just runs this batch file (the argument is ignored).
9 | rem
10 | rem Now we don't need to document a Windows command for activating a virtualenv.
11 |
12 | echo Executing .venv\Scripts\activate.bat for you
13 | .venv\Scripts\activate.bat
14 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/images/Notebook-lm-on-AWS.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/notebooklm-with-bedrock-and-amazon-eks/images/Notebook-lm-on-AWS.jpg
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/images/notebooklm.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/notebooklm-with-bedrock-and-amazon-eks/images/notebooklm.gif
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/kokoro/deployment/kokoro-tts.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: kokoro-service
5 | spec:
6 | selector:
7 | app: kokoro-tts
8 | ports:
9 | - protocol: TCP
10 | port: 8880
11 | targetPort: 8880
12 | type: ClusterIP
13 | ---
14 | apiVersion: apps/v1
15 | kind: Deployment
16 | metadata:
17 | name: kokoro-deployment
18 | spec:
19 | replicas: 1
20 | selector:
21 | matchLabels:
22 | app: kokoro-tts
23 | template:
24 | metadata:
25 | labels:
26 | app: kokoro-tts
27 | spec:
28 | containers:
29 | - name: kokoro-container
30 | image: ghcr.io/remsky/kokoro-fastapi-gpu:v0.2.2
31 | ports:
32 | - containerPort: 8880
33 | resources:
34 | limits:
35 | memory: "8Gi"
36 | cpu: "4"
37 | nvidia.com/gpu: 1
38 | requests:
39 | memory: "8Gi"
40 | cpu: "4"
41 | nvidia.com/gpu: 1
42 | tolerations:
43 | - key: "nvidia.com/gpu"
44 | operator: "Exists"
45 | effect: "NoSchedule"
46 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/llama3-8b/README.md:
--------------------------------------------------------------------------------
1 | # Deploying Llama-3-8b LLM model on Inferentia
2 | This is one of the sample from [Data-on-EKS Project](https://awslabs.github.io/data-on-eks/docs/gen-ai/inference/Neuron/vllm-ray-inf2)
3 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/notebook-lm/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.11-slim
2 |
3 | WORKDIR /app
4 |
5 |
6 | # Install FFmpeg and Python dependencies
7 | RUN apt-get update && \
8 | apt-get install -y ffmpeg&& \
9 | apt-get clean && \
10 | rm -rf /var/lib/apt/lists/*
11 |
12 | RUN pip3 --no-cache-dir install poetry
13 |
14 | COPY pyproject.toml poetry.lock .
15 |
16 | # Install dependencies without creating virtualenv
17 | RUN poetry config virtualenvs.create false \
18 | && poetry install --no-root --no-interaction --no-ansi
19 |
20 |
21 | COPY src src
22 | EXPOSE 7860
23 |
24 | ENV PYTHONPATH=/app
25 | ENV PYTHONUNBUFFERED=1
26 |
27 |
28 | # CMD ["tail", "-f", "/dev/null"]
29 | CMD ["python3", "/app/src/app.py"]
30 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/notebook-lm/README.md:
--------------------------------------------------------------------------------
1 | - Built on top of [Bedrock Sample application](https://github.com/aws-samples/amazon-nova-samples/tree/main/multimodal-understanding/sample-apps/02-bedrock-notebook-lm).
2 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/notebook-lm/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Build Image
4 | echo "Building notebooklm image.."
5 | docker build -t opennotebooklm:latest .
6 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/notebook-lm/deployment/notebook-lm-deployment.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: Deployment
3 | metadata:
4 | name: notebooklm
5 | spec:
6 | replicas: 1
7 | selector:
8 | matchLabels:
9 | app: notebooklm
10 | template:
11 | metadata:
12 | labels:
13 | app: notebooklm
14 | spec:
15 | containers:
16 | - name: notebooklm
17 | image: 0123456789.dkr.ecr.us-west-2.amazonaws.com/genai/opennotebooklm:latest
18 | ports:
19 | - name: tcp
20 | containerPort: 7860
21 | env:
22 | - name: KOKORO_ENDPOINT
23 | value: "kokoro-service"
24 | serviceAccount: notebooklm-sa
25 | serviceAccountName: notebooklm-sa
26 | ---
27 | apiVersion: v1
28 | kind: Service
29 | metadata:
30 | name: notebooklm-svc
31 | spec:
32 | ports:
33 | - port: 7860
34 | targetPort: 7860
35 | protocol: TCP
36 | type: ClusterIP
37 | selector:
38 | app: notebooklm
39 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/notebook-lm/deployment/notebooklm-sa.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ServiceAccount
3 | metadata:
4 | annotations:
5 | eks.amazonaws.com/role-arn: arn:aws:iam::0123456789:role/arun-notebooklm-bedrock-access
6 | name: notebooklm-sa
7 | namespace: default
8 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/notebook-lm/pyproject.toml:
--------------------------------------------------------------------------------
1 | [tool.poetry]
2 | name = "bedrock-notebooklm"
3 | version = "0.1.0"
4 | description = ""
5 | authors = ["Your Name "]
6 | readme = "README.md"
7 |
8 | [tool.poetry.dependencies]
9 | python = "^3.11"
10 | gradio = "^5.11.0"
11 | pypdf = "^5.1.0"
12 | scipy = "^1.14.1"
13 | langchain-aws = "^0.2.7"
14 | loguru = "^0.7.2"
15 | openai = "1.50.2"
16 |
17 |
18 | [build-system]
19 | requires = ["poetry-core"]
20 | build-backend = "poetry.core.masonry.api"
21 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/notebook-lm/run-standalone.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Check if an argument is provided
4 | if [ $# -eq 0 ]; then
5 | echo "No arguments provided. Please provide an argument."
6 | exit 1
7 | fi
8 |
9 | # Assign the input argument to a variable
10 | input=$1
11 |
12 | # Execute commands based on the input argument
13 | case $input in
14 | build)
15 | echo "Building image..."
16 | docker build -t opennotebooklm:latest .
17 | ;;
18 | run)
19 | echo "Running the app..."
20 | docker run -d -p 7860:7860 -v ~/.aws:/root/.aws --name opennotebooklm opennotebooklm:latest
21 | ;;
22 | stop)
23 | echo "Stopping the app..."
24 | docker stop opennotebooklm
25 | docker rm opennotebooklm
26 | # Command to check the status of a service
27 | # e.g., sudo systemctl status myservice
28 | ;;
29 | *)
30 | echo "Invalid argument. Please use build, run or stop."
31 | exit 1
32 | ;;
33 | esac
34 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/notebook-lm/src/schema.py:
--------------------------------------------------------------------------------
1 | """
2 | schema.py
3 | """
4 |
5 | from typing import List, Literal
6 |
7 | from pydantic import BaseModel, Field
8 |
9 |
10 | class DialogueItem(BaseModel):
11 | """A single dialogue item."""
12 |
13 | speaker: Literal["Host", "Guest"]
14 | text: str
15 |
16 |
17 | class ShortDialogue(BaseModel):
18 | """The conversation between the host and guest. Input arguments are scratchpad, name_of_guest and dialogue"""
19 |
20 | scratchpad: str
21 |
22 | dialogue: List[DialogueItem] = Field(
23 | description="A list of dialogue items, typically between 11 to 17 items."
24 | )
25 |
26 |
27 | class MediumDialogue(BaseModel):
28 | """The conversation between the host and guest. Input arguments are scratchpad, name_of_guest and dialogue"""
29 |
30 | scratchpad: str
31 | dialogue: List[DialogueItem] = Field(
32 | description="A list of dialogue items, typically between 19 to 29 items for each speaker."
33 | )
34 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/whisper-asr/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use the base image
2 | FROM rayproject/ray:2.24.0-py310-cu118
3 |
4 | # Maintainer label
5 | LABEL maintainer="arunnark"
6 |
7 | # Set environment variables to non-interactive (this prevents some prompts)
8 | ENV DEBIAN_FRONTEND=non-interactive
9 |
10 | # Set LD_LIBRARY_PATH to include the directory with libpython3.10.so.1.0
11 | ENV LD_LIBRARY_PATH=/home/ray/anaconda3/lib:$LD_LIBRARY_PATH
12 |
13 | # Set the working directory
14 | WORKDIR /app
15 |
16 | COPY requirements.txt /app/requirements.txt
17 |
18 | # Install vLLM and other dependencies in a single RUN command to reduce layers
19 | RUN pip install -r /app/requirements.txt
20 |
21 | # Copy the serving script into the container
22 | COPY whisper-transformers.py /app/whisper-transformers.py
23 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/whisper-asr/README.md:
--------------------------------------------------------------------------------
1 | # Instructions for Whisper ASR standalone setup
2 |
3 | ## Architecture
4 | This sample architecture demonstrates how to automatically transcribe multiple audio files using Whisper ASR.
5 | 
6 |
7 |
8 | ## Deploying EKS Cluster
9 | 1. Clone the repo
10 | ```
11 | git clone https://github.com/awslabs/data-on-eks.git
12 | ```
13 |
14 | 2. Update region
15 | Update region in `variables.tf` and also set the environment variable:
16 | ```
17 | export AWS_DEFAULT_REGION=""
18 | ```
19 |
20 | 3. Run the installation script, which will deploy new EKS Cluster, along with all the addons, operators & tools
21 |
22 | ```
23 | cd data-on-eks/ai-ml/jark-stack/terraform && chmod +x install.sh
24 | ./install.sh
25 | ```
26 |
27 | 4. Update kubeconfig
28 | ```
29 | aws eks --region us-west-2 update-kubeconfig --name jark-stack
30 | ```
31 |
32 | 5. Verify resources
33 | ```
34 | kubectl get nodes
35 | kubectl get nodepools
36 | kubectl get pods -n nvidia-device-plugin
37 | kubectl get pods -n kuberay-operator
38 | ```
39 |
40 | ## Build and push Whisper Image
41 |
42 | ```
43 | docker build -t genai/ray-whisper:v1 .
44 | docker tag genai/ray-whisper:v1 <>/ray-whisper:v1
45 | docker push <>/ray-whisper:v1
46 | ```
47 |
48 | ## Deploy Whisper ASR as Ray Serve Application
49 | Remember to update the `image` under `headGroupSpec.template.spec.containers` and `workerGroupSpecs.template.spec.containers`
50 | ```
51 | kubectl apply -f whisper-stand.yaml
52 | ```
53 | Check RayCluster
54 | ```
55 | kubectl get raycluster
56 | kubectl get pods
57 | kubectl get svc
58 | ```
59 |
60 |
61 |
62 | Invoke Whisper-ASR
63 | ```
64 | curl -X POST -H 'Content-Type: application/json' whisper-stand-raycluster-xqm4m-head-svc:8000/whisper/ -d '{"file_path": "audio.mp3"}'
65 | ```
66 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/whisper-asr/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Build Image
4 | echo "Building whisper ASR image.."
5 | docker build -t ray-whisper:latest .
6 |
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/whisper-asr/images/Architecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/notebooklm-with-bedrock-and-amazon-eks/whisper-asr/images/Architecture.png
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/whisper-asr/requirements.txt:
--------------------------------------------------------------------------------
1 | faster_whisper
2 | # ray[serve]
3 | transformers
4 | torch
5 | pydub
6 | numpy
7 | librosa
8 | vllm==0.7.2
9 | huggingface_hub==0.23.4
--------------------------------------------------------------------------------
/infrastructure/notebooklm-with-bedrock-and-amazon-eks/whisper-asr/whisper-transformers.py:
--------------------------------------------------------------------------------
1 | import ray
2 | from ray import serve
3 | from transformers import WhisperProcessor, WhisperForConditionalGeneration
4 | import librosa
5 |
6 | @serve.deployment
7 | class WhisperModel:
8 | def __init__(self, model_id: str):
9 | self.processor = WhisperProcessor.from_pretrained(model_id)
10 | self.model = WhisperForConditionalGeneration.from_pretrained(model_id)
11 |
12 | async def __call__(self, request):
13 | data = await request.json()
14 | file_path = data.get("file_path")
15 |
16 | if not file_path:
17 | return {"error": "No file_path provided"}
18 |
19 | try:
20 | # Load the audio file
21 | audio, sr = librosa.load(file_path, sr=16000)
22 |
23 | # Process the audio with Whisper
24 | input_features = self.processor(audio, sampling_rate=16000, return_tensors="pt").input_features
25 | generated_ids = self.model.generate(input_features)
26 | transcription = self.processor.batch_decode(generated_ids, skip_special_tokens=True)
27 |
28 | return {"transcription": transcription[0]}
29 | except Exception as e:
30 | return {"error": str(e)}
31 |
32 | app = WhisperModel.bind(model_id="openai/whisper-tiny")
33 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/train_openclip_with_hyperpod/open_clip_trn.tar.gz
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/CITATION.cff:
--------------------------------------------------------------------------------
1 | cff-version: 1.1.0
2 | message: If you use this software, please cite it as below.
3 | authors:
4 | - family-names: Ilharco
5 | given-names: Gabriel
6 | - family-names: Wortsman
7 | given-names: Mitchell
8 | - family-names: Wightman
9 | given-names: Ross
10 | - family-names: Gordon
11 | given-names: Cade
12 | - family-names: Carlini
13 | given-names: Nicholas
14 | - family-names: Taori
15 | given-names: Rohan
16 | - family-names: Dave
17 | given-names: Achal
18 | - family-names: Shankar
19 | given-names: Vaishaal
20 | - family-names: Namkoong
21 | given-names: Hongseok
22 | - family-names: Miller
23 | given-names: John
24 | - family-names: Hajishirzi
25 | given-names: Hannaneh
26 | - family-names: Farhadi
27 | given-names: Ali
28 | - family-names: Schmidt
29 | given-names: Ludwig
30 | title: OpenCLIP
31 | version: v0.1
32 | doi: 10.5281/zenodo.5143773
33 | date-released: 2021-07-28
34 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.8-slim-buster
2 |
3 | # Update the package list and install basic dependencies
4 | RUN apt-get update && apt-get install -y \
5 | make \
6 | awscli \
7 | git \
8 | build-essential \
9 | && apt-get clean && rm -rf /var/lib/apt/lists/*
10 |
11 | WORKDIR /app/ml/code
12 |
13 | COPY requirements.txt .
14 |
15 | RUN pip install --upgrade pip && pip install -r requirements.txt
16 |
17 | COPY requirements-training.txt .
18 |
19 | RUN pip install -r requirements-training.txt
20 |
21 | COPY README.md .
22 | COPY MANIFEST.in .
23 | COPY setup.sh .
24 | COPY setup_mfsq.py .
25 | COPY setup_openclip.py .
26 | COPY src src
27 |
28 | RUN chmod +x setup.sh
29 | RUN ./setup.sh
30 |
31 | COPY weighted_training weighted_training
32 |
33 | # Set the final working directory to where the main script is located
34 | WORKDIR /app/ml/code/weighted_training
35 |
36 | ENV PYTHONPATH "/app/ml/code"
37 |
38 | # Set the entrypoint to the main training script
39 | ENTRYPOINT ["python", "docker_main.py"]
40 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012-2021 Gabriel Ilharco, Mitchell Wortsman,
2 | Nicholas Carlini, Rohan Taori, Achal Dave, Vaishaal Shankar,
3 | John Miller, Hongseok Namkoong, Hannaneh Hajishirzi, Ali Farhadi,
4 | Ludwig Schmidt
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining
7 | a copy of this software and associated documentation files (the
8 | "Software"), to deal in the Software without restriction, including
9 | without limitation the rights to use, copy, modify, merge, publish,
10 | distribute, sublicense, and/or sell copies of the Software, and to
11 | permit persons to whom the Software is furnished to do so, subject to
12 | the following conditions:
13 |
14 | The above copyright notice and this permission notice shall be
15 | included in all copies or substantial portions of the Software.
16 |
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include src/open_clip/bpe_simple_vocab_16e6.txt.gz
2 | include src/open_clip/model_configs/*.json
3 |
4 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/Makefile:
--------------------------------------------------------------------------------
1 | install: ## [Local development] Upgrade pip, install requirements, install package.
2 | python -m pip install -U pip
3 | python -m pip install -e .
4 |
5 | install-training:
6 | python -m pip install -r requirements-training.txt
7 |
8 | install-test: ## [Local development] Install test requirements
9 | python -m pip install -r requirements-test.txt
10 |
11 | test: ## [Local development] Run unit tests
12 | python -m pytest -x -s -v tests
13 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/README.md:
--------------------------------------------------------------------------------
1 |
2 | ### Installation
3 | ```
4 | ./setup.sh
5 | ```
6 |
7 | ### Compilation run
8 | ```
9 | ./distributed_train.sh
10 | ```
11 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/only_compile.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | rm -r ./compiler_cache
4 |
5 | DISTRIBUTED_ARGS="--nproc_per_node 32 --nnodes 1 --node_rank 0"
6 | echo $DISTRIBUTED_ARGS
7 | rm -r ./logs/
8 |
9 | # Compile process.
10 | MALLOC_ARENA_MAX=64 NEURON_NUM_RECENT_MODELS_TO_KEEP=4 NEURON_RT_ASYNC_EXEC_MAX_INFLIGHT_REQUESTS=3 XLA_USE_BF16=1 NEURON_CC_FLAGS="--model-type=transformer --cache_dir=./compiler_cache --enable-saturate-infinity" neuron_parallel_compile torchrun $DISTRIBUTED_ARGS weighted_training/main.py \
11 | --train-data Marqo/marqo-ge-sample \
12 | --warmup 10000 \
13 | --epochs 200 \
14 | --lr 1e-5 \
15 | --precision fp32 \
16 | --workers 0 \
17 | --model ViT-B-16 \
18 | --pretrained laion2b_s34b_b88k \
19 | --batch-size 64 \
20 | --wd 0.001 \
21 | --name "VITB16" \
22 | --dataset-type hf \
23 | --hf-split-key google_shopping \
24 | --hf-img-key image \
25 | --hf-caption-key title \
26 | --save-frequency 1 \
27 | --save-most-recent \
28 | --log-every-n-steps 10 \
29 | --grad-checkpointing --local-loss --gather-with-grad \
30 | --steps-this-run 10 \
31 | --logit-scale 100
32 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/only_train.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | DISTRIBUTED_ARGS="--nproc_per_node 32 --nnodes 1 --node_rank 0"
4 | echo $DISTRIBUTED_ARGS
5 | rm -r ./logs/
6 |
7 | # Train CLIP using a cached compiled model graph.
8 | MALLOC_ARENA_MAX=64 NEURON_NUM_RECENT_MODELS_TO_KEEP=4 NEURON_RT_ASYNC_EXEC_MAX_INFLIGHT_REQUESTS=3 XLA_USE_BF16=1 NEURON_CC_FLAGS="--model-type=transformer --cache_dir=./compiler_cache --enable-saturate-infinity" torchrun $DISTRIBUTED_ARGS weighted_training/main.py \
9 | --train-data Marqo/marqo-ge-sample \
10 | --warmup 10000 \
11 | --epochs 100 \
12 | --lr 1e-5 \
13 | --precision fp32 \
14 | --workers 0 \
15 | --model ViT-B-16 \
16 | --pretrained laion2b_s34b_b88k \
17 | --batch-size 64 \
18 | --wd 0.001 \
19 | --name "VITB16" \
20 | --dataset-type hf \
21 | --hf-split-key google_shopping \
22 | --hf-img-key image \
23 | --hf-caption-key title \
24 | --save-frequency 1 \
25 | --save-most-recent \
26 | --log-every-n-steps 10 \
27 | --grad-checkpointing --local-loss --gather-with-grad \
28 | --logit-scale 100
29 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/only_train_dis.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | CACHE_DIR=/home/ubuntu/compiler_cache
3 |
4 |
5 | export LD_LIBRARY_PATH=/opt/amazon/efa/lib:/opt/amazon/openmpi/lib:$LD_LIBRARY_PATH
6 |
7 | export FI_EFA_USE_DEVICE_RDMA=1 # use for p4de
8 | export FI_PROVIDER=efa
9 | export NCCL_PROTO=simple
10 | export NCCL_ALGO=Tree
11 | export FI_EFA_FORK_SAFE=1
12 | export FI_LOG_LEVEL=1
13 | export RDMAV_FORK_SAFE=1
14 | export FI_EFA_ENABLE_SHM_TRANSFER=1
15 | export NCCL_DEBUG=INFO
16 |
17 |
18 | rm -r ./logs/
19 |
20 | NODEID=$SLURM_NODEID
21 | NTASKS=$SLURM_NTASKS
22 | MASTER_ADDR=(`scontrol show hostnames \$SLURM_JOB_NODELIST | head -n 1`)
23 | MASTER_PORT=$(expr 10000 + $(echo -n $SLURM_JOBID | tail -c 4))
24 |
25 | export PROCESSES_PER_NODE=32
26 |
27 | export DISTRIBUTED_ARGS="--nproc_per_node $PROCESSES_PER_NODE \
28 | --nnodes $NTASKS \
29 | --node_rank $NODEID \
30 | --master_addr $MASTER_ADDR \
31 | --master_port $MASTER_PORT \
32 | "
33 | echo $DISTRIBUTED_ARGS
34 |
35 | MALLOC_ARENA_MAX=64 NEURON_NUM_RECENT_MODELS_TO_KEEP=4 \
36 | NEURON_RT_ASYNC_EXEC_MAX_INFLIGHT_REQUESTS=3 \
37 | XLA_USE_BF16=1 \
38 | NEURON_CC_FLAGS="--model-type=transformer --cache_dir=$CACHE_DIR --enable-saturate-infinity" \
39 | torchrun $DISTRIBUTED_ARGS weighted_training/main.py \
40 | --train-data Marqo/marqo-ge-sample \
41 | --warmup 10000 \
42 | --epochs 100 \
43 | --lr 1e-5 \
44 | --precision fp32 \
45 | --workers 0 \
46 | --model ViT-B-16 \
47 | --pretrained laion2b_s34b_b88k \
48 | --batch-size 32 \
49 | --wd 0.001 \
50 | --name "VITB16" \
51 | --dataset-type hf \
52 | --hf-split-key google_shopping \
53 | --hf-img-key image \
54 | --hf-caption-key title \
55 | --save-frequency 1 \
56 | --save-most-recent \
57 | --log-every-n-steps 10 \
58 | --grad-checkpointing --local-loss --gather-with-grad \
59 | --logit-scale 100
60 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/pytest.ini:
--------------------------------------------------------------------------------
1 | [pytest]
2 | markers =
3 | regression_test
4 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/requirements-test.txt:
--------------------------------------------------------------------------------
1 | pytest-split==0.8.0
2 | pytest==7.2.0
3 | transformers
4 | timm==0.6.11
5 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/requirements-training.txt:
--------------------------------------------------------------------------------
1 | torch>=1.9.0
2 | torchvision
3 | webdataset>=0.2.5
4 | regex
5 | ftfy
6 | tqdm
7 | pandas
8 | braceexpand
9 | huggingface_hub
10 | transformers
11 | timm
12 | fsspec
13 | pyarrow
14 | datasets
15 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/requirements.txt:
--------------------------------------------------------------------------------
1 | torch>=1.9.0
2 | torchvision
3 | regex
4 | ftfy
5 | tqdm
6 | huggingface_hub
7 | sentencepiece
8 | protobuf<4
9 | timm
10 | datasets
11 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/setup.sh:
--------------------------------------------------------------------------------
1 | cp setup_mfsq.py setup.py
2 | pip install .
3 |
4 | cp setup_openclip.py setup.py
5 | pip install .[training]
6 |
7 | rm setup.py
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/setup_mfsq.py:
--------------------------------------------------------------------------------
1 | import os
2 | import os.path as osp
3 | import shutil
4 | import sys
5 | import warnings
6 | from setuptools import find_packages, setup
7 |
8 | if __name__ == '__main__':
9 | setup(
10 | name='weighted_training',
11 | version='0.0.1',
12 | description='Weighted Contrastive learning',
13 | long_description='Weighted Contrastive learning',
14 | long_description_content_type='text/markdown',
15 | author='Alan',
16 | author_email='tianyuzhu52@gmail.com',
17 | keywords='computer vision, object detection, rotation detection',
18 | url='',
19 | packages=find_packages(exclude=('configs', 'tools', 'demo')),
20 | include_package_data=True,
21 | zip_safe=False)
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/__init__.py:
--------------------------------------------------------------------------------
1 | from .version import __version__
2 |
3 | from .coca_model import CoCa
4 | from .constants import OPENAI_DATASET_MEAN, OPENAI_DATASET_STD
5 | from .factory import create_model, create_model_and_transforms, create_model_from_pretrained, get_tokenizer, create_loss
6 | from .factory import list_models, add_model_config, get_model_config, load_checkpoint
7 | from .loss import ClipLoss, DistillClipLoss, CoCaLoss
8 | from .model import CLIP, CustomTextCLIP, CLIPTextCfg, CLIPVisionCfg, \
9 | convert_weights_to_lp, convert_weights_to_fp16, trace_model, get_cast_dtype, get_input_dtype, \
10 | get_model_tokenize_cfg, get_model_preprocess_cfg, set_model_preprocess_cfg
11 | from .openai import load_openai_model, list_openai_models
12 | from .pretrained import list_pretrained, list_pretrained_models_by_tag, list_pretrained_tags_by_model, \
13 | get_pretrained_url, download_pretrained_from_url, is_pretrained_cfg, get_pretrained_cfg, download_pretrained
14 | from .push_to_hf_hub import push_pretrained_to_hf_hub, push_to_hf_hub
15 | from .tokenizer import SimpleTokenizer, tokenize, decode
16 | from .transform import image_transform, AugmentationCfg
17 | from .zero_shot_classifier import build_zero_shot_classifier, build_zero_shot_classifier_legacy
18 | from .zero_shot_metadata import OPENAI_IMAGENET_TEMPLATES, SIMPLE_IMAGENET_TEMPLATES, IMAGENET_CLASSNAMES
19 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/bpe_simple_vocab_16e6.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/bpe_simple_vocab_16e6.txt.gz
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/constants.py:
--------------------------------------------------------------------------------
1 | OPENAI_DATASET_MEAN = (0.48145466, 0.4578275, 0.40821073)
2 | OPENAI_DATASET_STD = (0.26862954, 0.26130258, 0.27577711)
3 | IMAGENET_MEAN = (0.485, 0.456, 0.406)
4 | IMAGENET_STD = (0.229, 0.224, 0.225)
5 | INCEPTION_MEAN = (0.5, 0.5, 0.5)
6 | INCEPTION_STD = (0.5, 0.5, 0.5)
7 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/EVA01-g-14-plus.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "timm_model_name": "eva_giant_patch14_224",
6 | "timm_model_pretrained": false,
7 | "timm_pool": "token",
8 | "timm_proj": null
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 1024,
14 | "heads": 16,
15 | "layers": 24
16 | },
17 | "custom_text": true
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/EVA01-g-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "timm_model_name": "eva_giant_patch14_224",
6 | "timm_model_pretrained": false,
7 | "timm_pool": "token",
8 | "timm_proj": null
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 768,
14 | "heads": 12,
15 | "layers": 12
16 | },
17 | "custom_text": true
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/EVA02-B-16.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "timm_model_name": "eva02_base_patch16_clip_224",
6 | "timm_model_pretrained": false,
7 | "timm_pool": "token",
8 | "timm_proj": null
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 512,
14 | "heads": 8,
15 | "layers": 12
16 | },
17 | "custom_text": true
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/EVA02-E-14-plus.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "timm_model_name": "eva02_enormous_patch14_clip_224",
6 | "timm_model_pretrained": false,
7 | "timm_pool": "token",
8 | "timm_proj": null
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 1280,
14 | "heads": 20,
15 | "layers": 32
16 | },
17 | "custom_text": true
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/EVA02-E-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "timm_model_name": "eva02_enormous_patch14_clip_224",
6 | "timm_model_pretrained": false,
7 | "timm_pool": "token",
8 | "timm_proj": null
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 1024,
14 | "heads": 16,
15 | "layers": 24
16 | },
17 | "custom_text": true
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/EVA02-L-14-336.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 336,
5 | "timm_model_name": "eva02_large_patch14_clip_336",
6 | "timm_model_pretrained": false,
7 | "timm_pool": "token",
8 | "timm_proj": null
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 768,
14 | "heads": 12,
15 | "layers": 12
16 | },
17 | "custom_text": true
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/EVA02-L-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "timm_model_name": "eva02_large_patch14_clip_224",
6 | "timm_model_pretrained": false,
7 | "timm_pool": "token",
8 | "timm_proj": null
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 768,
14 | "heads": 12,
15 | "layers": 12
16 | },
17 | "custom_text": true
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/MobileCLIP-B.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "timm_model_name": "vit_base_mci_224",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "token",
7 | "timm_proj": null,
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.0,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 512,
16 | "heads": 8,
17 | "layers": 12,
18 | "no_causal_mask": false
19 | },
20 | "custom_text": true
21 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/MobileCLIP-S1.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "timm_model_name": "fastvit_mci1",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "avg",
7 | "timm_proj": null,
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.0,
10 | "image_size": 256
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 512,
16 | "heads": 8,
17 | "layers": 12,
18 | "no_causal_mask": true
19 | },
20 | "custom_text": true
21 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/MobileCLIP-S2.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "timm_model_name": "fastvit_mci2",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "avg",
7 | "timm_proj": null,
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.0,
10 | "image_size": 256
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 512,
16 | "heads": 8,
17 | "layers": 12,
18 | "no_causal_mask": true
19 | },
20 | "custom_text": true
21 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/RN101-quickgelu.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": [
7 | 3,
8 | 4,
9 | 23,
10 | 3
11 | ],
12 | "width": 64,
13 | "patch_size": null
14 | },
15 | "text_cfg": {
16 | "context_length": 77,
17 | "vocab_size": 49408,
18 | "width": 512,
19 | "heads": 8,
20 | "layers": 12
21 | }
22 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/RN101.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": [
6 | 3,
7 | 4,
8 | 23,
9 | 3
10 | ],
11 | "width": 64,
12 | "patch_size": null
13 | },
14 | "text_cfg": {
15 | "context_length": 77,
16 | "vocab_size": 49408,
17 | "width": 512,
18 | "heads": 8,
19 | "layers": 12
20 | }
21 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/RN50-quickgelu.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": [
7 | 3,
8 | 4,
9 | 6,
10 | 3
11 | ],
12 | "width": 64,
13 | "patch_size": null
14 | },
15 | "text_cfg": {
16 | "context_length": 77,
17 | "vocab_size": 49408,
18 | "width": 512,
19 | "heads": 8,
20 | "layers": 12
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/RN50.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": [
6 | 3,
7 | 4,
8 | 6,
9 | 3
10 | ],
11 | "width": 64,
12 | "patch_size": null
13 | },
14 | "text_cfg": {
15 | "context_length": 77,
16 | "vocab_size": 49408,
17 | "width": 512,
18 | "heads": 8,
19 | "layers": 12
20 | }
21 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/RN50x16.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 384,
5 | "layers": [
6 | 6,
7 | 8,
8 | 18,
9 | 8
10 | ],
11 | "width": 96,
12 | "patch_size": null
13 | },
14 | "text_cfg": {
15 | "context_length": 77,
16 | "vocab_size": 49408,
17 | "width": 768,
18 | "heads": 12,
19 | "layers": 12
20 | }
21 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/RN50x4.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 640,
3 | "vision_cfg": {
4 | "image_size": 288,
5 | "layers": [
6 | 4,
7 | 6,
8 | 10,
9 | 6
10 | ],
11 | "width": 80,
12 | "patch_size": null
13 | },
14 | "text_cfg": {
15 | "context_length": 77,
16 | "vocab_size": 49408,
17 | "width": 640,
18 | "heads": 10,
19 | "layers": 12
20 | }
21 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/RN50x64.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 448,
5 | "layers": [
6 | 3,
7 | 15,
8 | 36,
9 | 10
10 | ],
11 | "width": 128,
12 | "patch_size": null
13 | },
14 | "text_cfg": {
15 | "context_length": 77,
16 | "vocab_size": 49408,
17 | "width": 1024,
18 | "heads": 16,
19 | "layers": 12
20 | }
21 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-16-SigLIP-256.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "init_logit_bias": -10,
4 | "custom_text": true,
5 | "vision_cfg": {
6 | "image_size": 256,
7 | "timm_model_name": "vit_base_patch16_siglip_256",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "context_length": 64,
14 | "vocab_size": 32000,
15 | "hf_tokenizer_name": "timm/ViT-B-16-SigLIP",
16 | "tokenizer_kwargs": {
17 | "clean": "canonicalize"
18 | },
19 | "width": 768,
20 | "heads": 12,
21 | "layers": 12,
22 | "no_causal_mask": true,
23 | "proj_bias": true,
24 | "pool_type": "last",
25 | "norm_kwargs":{
26 | "eps": 1e-6
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-16-SigLIP-384.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "init_logit_bias": -10,
4 | "custom_text": true,
5 | "vision_cfg": {
6 | "image_size": 384,
7 | "timm_model_name": "vit_base_patch16_siglip_384",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "context_length": 64,
14 | "vocab_size": 32000,
15 | "hf_tokenizer_name": "timm/ViT-B-16-SigLIP",
16 | "tokenizer_kwargs": {
17 | "clean": "canonicalize"
18 | },
19 | "width": 768,
20 | "heads": 12,
21 | "layers": 12,
22 | "no_causal_mask": true,
23 | "proj_bias": true,
24 | "pool_type": "last",
25 | "norm_kwargs":{
26 | "eps": 1e-6
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-16-SigLIP-512.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "init_logit_bias": -10,
4 | "custom_text": true,
5 | "vision_cfg": {
6 | "image_size": 512,
7 | "timm_model_name": "vit_base_patch16_siglip_512",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "context_length": 64,
14 | "vocab_size": 32000,
15 | "hf_tokenizer_name": "timm/ViT-B-16-SigLIP",
16 | "tokenizer_kwargs": {
17 | "clean": "canonicalize"
18 | },
19 | "width": 768,
20 | "heads": 12,
21 | "layers": 12,
22 | "no_causal_mask": true,
23 | "proj_bias": true,
24 | "pool_type": "last",
25 | "norm_kwargs":{
26 | "eps": 1e-6
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-16-SigLIP-i18n-256.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "init_logit_bias": -10,
4 | "custom_text": true,
5 | "vision_cfg": {
6 | "image_size": 256,
7 | "timm_model_name": "vit_base_patch16_siglip_256",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "context_length": 64,
14 | "vocab_size": 250000,
15 | "hf_tokenizer_name": "timm/ViT-B-16-SigLIP-i18n-256",
16 | "tokenizer_kwargs": {
17 | "clean": "canonicalize"
18 | },
19 | "width": 768,
20 | "heads": 12,
21 | "layers": 12,
22 | "no_causal_mask": true,
23 | "proj_bias": true,
24 | "pool_type": "last",
25 | "norm_kwargs":{
26 | "eps": 1e-6
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-16-SigLIP.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "init_logit_bias": -10,
4 | "custom_text": true,
5 | "vision_cfg": {
6 | "image_size": 224,
7 | "timm_model_name": "vit_base_patch16_siglip_224",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "context_length": 64,
14 | "vocab_size": 32000,
15 | "hf_tokenizer_name": "timm/ViT-B-16-SigLIP",
16 | "tokenizer_kwargs": {
17 | "clean": "canonicalize"
18 | },
19 | "width": 768,
20 | "heads": 12,
21 | "layers": 12,
22 | "no_causal_mask": true,
23 | "proj_bias": true,
24 | "pool_type": "last",
25 | "norm_kwargs":{
26 | "eps": 1e-6
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-16-plus-240.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 640,
3 | "vision_cfg": {
4 | "image_size": 240,
5 | "layers": 12,
6 | "width": 896,
7 | "patch_size": 16
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 640,
13 | "heads": 10,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-16-plus.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 640,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 896,
7 | "patch_size": 16
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 640,
13 | "heads": 10,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-16-quickgelu.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 12,
7 | "width": 768,
8 | "patch_size": 16
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 512,
14 | "heads": 8,
15 | "layers": 12
16 | }
17 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-16.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 768,
7 | "patch_size": 16
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 512,
13 | "heads": 8,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-32-256.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 256,
5 | "layers": 12,
6 | "width": 768,
7 | "patch_size": 32
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 512,
13 | "heads": 8,
14 | "layers": 12
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-32-plus-256.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 640,
3 | "vision_cfg": {
4 | "image_size": 256,
5 | "layers": 12,
6 | "width": 896,
7 | "patch_size": 32
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 640,
13 | "heads": 10,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-32-quickgelu.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 12,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 512,
14 | "heads": 8,
15 | "layers": 12
16 | }
17 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-B-32.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 768,
7 | "patch_size": 32
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 512,
13 | "heads": 8,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-H-14-378-quickgelu.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 378,
6 | "layers": 32,
7 | "width": 1280,
8 | "head_width": 80,
9 | "patch_size": 14
10 | },
11 | "text_cfg": {
12 | "context_length": 77,
13 | "vocab_size": 49408,
14 | "width": 1024,
15 | "heads": 16,
16 | "layers": 24
17 | }
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-H-14-CLIPA-336.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 336,
5 | "layers": 32,
6 | "width": 1280,
7 | "head_width": 80,
8 | "patch_size": 14,
9 | "no_ln_pre": true,
10 | "pool_type": "avg",
11 | "final_ln_after_pool": true
12 | },
13 | "text_cfg": {
14 | "context_length": 32,
15 | "vocab_size": 32000,
16 | "hf_tokenizer_name": "bert-base-uncased",
17 | "tokenizer_kwargs": {
18 | "strip_sep_token": true
19 | },
20 | "width": 1024,
21 | "heads": 16,
22 | "layers": 24,
23 | "pool_type": "last",
24 | "no_causal_mask": true
25 | }
26 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-H-14-CLIPA.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 32,
6 | "width": 1280,
7 | "head_width": 80,
8 | "patch_size": 14,
9 | "no_ln_pre": true,
10 | "pool_type": "avg",
11 | "final_ln_after_pool": true
12 | },
13 | "text_cfg": {
14 | "context_length": 32,
15 | "vocab_size": 32000,
16 | "hf_tokenizer_name": "bert-base-uncased",
17 | "tokenizer_kwargs": {
18 | "strip_sep_token": true
19 | },
20 | "width": 1024,
21 | "heads": 16,
22 | "layers": 24,
23 | "pool_type": "last",
24 | "no_causal_mask": true
25 | }
26 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-H-14-quickgelu.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 32,
7 | "width": 1280,
8 | "head_width": 80,
9 | "patch_size": 14
10 | },
11 | "text_cfg": {
12 | "context_length": 77,
13 | "vocab_size": 49408,
14 | "width": 1024,
15 | "heads": 16,
16 | "layers": 24
17 | }
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-H-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 32,
6 | "width": 1280,
7 | "head_width": 80,
8 | "patch_size": 14
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 1024,
14 | "heads": 16,
15 | "layers": 24
16 | }
17 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-H-16.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 32,
6 | "width": 1280,
7 | "head_width": 80,
8 | "patch_size": 16
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 1024,
14 | "heads": 16,
15 | "layers": 24
16 | }
17 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-L-14-280.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 280,
5 | "layers": 24,
6 | "width": 1024,
7 | "patch_size": 14
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 768,
13 | "heads": 12,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-L-14-336.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 336,
5 | "layers": 24,
6 | "width": 1024,
7 | "patch_size": 14
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 768,
13 | "heads": 12,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-L-14-CLIPA-336.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 336,
5 | "layers": 24,
6 | "width": 1024,
7 | "patch_size": 14,
8 | "no_ln_pre": true,
9 | "pool_type": "avg",
10 | "final_ln_after_pool": true
11 | },
12 | "text_cfg": {
13 | "context_length": 32,
14 | "vocab_size": 32000,
15 | "hf_tokenizer_name": "bert-base-uncased",
16 | "tokenizer_kwargs": {
17 | "strip_sep_token": true
18 | },
19 | "width": 768,
20 | "heads": 12,
21 | "layers": 12,
22 | "pool_type": "last",
23 | "no_causal_mask": true
24 | }
25 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-L-14-CLIPA.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 24,
6 | "width": 1024,
7 | "patch_size": 14,
8 | "no_ln_pre": true,
9 | "pool_type": "avg",
10 | "final_ln_after_pool": true
11 | },
12 | "text_cfg": {
13 | "context_length": 32,
14 | "vocab_size": 32000,
15 | "hf_tokenizer_name": "bert-base-uncased",
16 | "tokenizer_kwargs": {
17 | "strip_sep_token": true
18 | },
19 | "width": 768,
20 | "heads": 12,
21 | "layers": 12,
22 | "pool_type": "last",
23 | "no_causal_mask": true
24 | }
25 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-L-14-quickgelu.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 24,
7 | "width": 1024,
8 | "patch_size": 14
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 768,
14 | "heads": 12,
15 | "layers": 12
16 | }
17 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-L-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 24,
6 | "width": 1024,
7 | "patch_size": 14
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 768,
13 | "heads": 12,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-L-16-320.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 320,
5 | "layers": 24,
6 | "width": 1024,
7 | "patch_size": 16
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 768,
13 | "heads": 12,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-L-16-SigLIP-256.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "init_logit_bias": -10,
4 | "custom_text": true,
5 | "vision_cfg": {
6 | "image_size": 256,
7 | "timm_model_name": "vit_large_patch16_siglip_256",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "context_length": 64,
14 | "vocab_size": 32000,
15 | "hf_tokenizer_name": "timm/ViT-B-16-SigLIP",
16 | "tokenizer_kwargs": {
17 | "clean": "canonicalize"
18 | },
19 | "width": 1024,
20 | "heads": 16,
21 | "layers": 24,
22 | "no_causal_mask": true,
23 | "proj_bias": true,
24 | "pool_type": "last",
25 | "norm_kwargs":{
26 | "eps": 1e-6
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-L-16-SigLIP-384.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "init_logit_bias": -10,
4 | "custom_text": true,
5 | "vision_cfg": {
6 | "image_size": 384,
7 | "timm_model_name": "vit_large_patch16_siglip_384",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "context_length": 64,
14 | "vocab_size": 32000,
15 | "hf_tokenizer_name": "timm/ViT-B-16-SigLIP",
16 | "tokenizer_kwargs": {
17 | "clean": "canonicalize"
18 | },
19 | "width": 1024,
20 | "heads": 16,
21 | "layers": 24,
22 | "no_causal_mask": true,
23 | "proj_bias": true,
24 | "pool_type": "last",
25 | "norm_kwargs":{
26 | "eps": 1e-6
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-L-16.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 24,
6 | "width": 1024,
7 | "patch_size": 16
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 768,
13 | "heads": 12,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-M-16-alt.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 384,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 512,
7 | "patch_size": 16,
8 | "ls_init_value": 1e-4
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 384,
14 | "heads": 6,
15 | "layers": 12
16 | }
17 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-M-16.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 512,
7 | "patch_size": 16
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 512,
13 | "heads": 8,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-M-32-alt.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 384,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 512,
7 | "patch_size": 32
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 384,
13 | "heads": 6,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-M-32.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 512,
7 | "patch_size": 32
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 512,
13 | "heads": 8,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-S-16-alt.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 256,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 384,
7 | "patch_size": 16
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 256,
13 | "heads": 4,
14 | "layers": 10
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-S-16.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 384,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 384,
7 | "patch_size": 16
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 384,
13 | "heads": 6,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-S-32-alt.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 256,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 384,
7 | "patch_size": 32
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 256,
13 | "heads": 4,
14 | "layers": 10
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-S-32.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 384,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 384,
7 | "patch_size": 32
8 | },
9 | "text_cfg": {
10 | "context_length": 77,
11 | "vocab_size": 49408,
12 | "width": 384,
13 | "heads": 6,
14 | "layers": 12
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-SO400M-14-SigLIP-384.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1152,
3 | "init_logit_bias": -10,
4 | "custom_text": true,
5 | "vision_cfg": {
6 | "image_size": 384,
7 | "timm_model_name": "vit_so400m_patch14_siglip_384",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "context_length": 64,
14 | "vocab_size": 32000,
15 | "hf_tokenizer_name": "timm/ViT-B-16-SigLIP",
16 | "tokenizer_kwargs": {
17 | "clean": "canonicalize"
18 | },
19 | "width": 1152,
20 | "heads": 16,
21 | "layers": 27,
22 | "mlp_ratio": 3.7362,
23 | "no_causal_mask": true,
24 | "proj_bias": true,
25 | "pool_type": "last",
26 | "norm_kwargs":{
27 | "eps": 1e-6
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-SO400M-14-SigLIP.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1152,
3 | "init_logit_bias": -10,
4 | "custom_text": true,
5 | "vision_cfg": {
6 | "image_size": 224,
7 | "timm_model_name": "vit_so400m_patch14_siglip_224",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "context_length": 16,
14 | "vocab_size": 32000,
15 | "hf_tokenizer_name": "timm/ViT-B-16-SigLIP",
16 | "tokenizer_kwargs": {
17 | "clean": "canonicalize"
18 | },
19 | "width": 1152,
20 | "heads": 16,
21 | "layers": 27,
22 | "mlp_ratio": 3.7362,
23 | "no_causal_mask": true,
24 | "proj_bias": true,
25 | "pool_type": "last",
26 | "norm_kwargs":{
27 | "eps": 1e-6
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-bigG-14-CLIPA-336.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1280,
3 | "vision_cfg": {
4 | "image_size": 336,
5 | "layers": 48,
6 | "width": 1664,
7 | "head_width": 104,
8 | "mlp_ratio": 4.9231,
9 | "patch_size": 14,
10 | "no_ln_pre": true,
11 | "pool_type": "avg",
12 | "final_ln_after_pool": true
13 | },
14 | "text_cfg": {
15 | "context_length": 32,
16 | "vocab_size": 32000,
17 | "hf_tokenizer_name": "bert-base-uncased",
18 | "tokenizer_kwargs": {
19 | "strip_sep_token": true
20 | },
21 | "width": 1280,
22 | "heads": 20,
23 | "layers": 32,
24 | "pool_type": "last",
25 | "no_causal_mask": true
26 | }
27 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-bigG-14-CLIPA.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1280,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 48,
6 | "width": 1664,
7 | "head_width": 104,
8 | "mlp_ratio": 4.9231,
9 | "patch_size": 14,
10 | "no_ln_pre": true,
11 | "pool_type": "avg",
12 | "final_ln_after_pool": true
13 | },
14 | "text_cfg": {
15 | "context_length": 32,
16 | "vocab_size": 32000,
17 | "hf_tokenizer_name": "bert-base-uncased",
18 | "tokenizer_kwargs": {
19 | "strip_sep_token": true
20 | },
21 | "width": 1280,
22 | "heads": 20,
23 | "layers": 32,
24 | "pool_type": "last",
25 | "no_causal_mask": true
26 | }
27 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-bigG-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1280,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 48,
6 | "width": 1664,
7 | "head_width": 104,
8 | "mlp_ratio": 4.9231,
9 | "patch_size": 14
10 | },
11 | "text_cfg": {
12 | "context_length": 77,
13 | "vocab_size": 49408,
14 | "width": 1280,
15 | "heads": 20,
16 | "layers": 32
17 | }
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-e-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1280,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 56,
6 | "width": 1792,
7 | "head_width": 112,
8 | "mlp_ratio": 8.5715,
9 | "patch_size": 14
10 | },
11 | "text_cfg": {
12 | "context_length": 77,
13 | "vocab_size": 49408,
14 | "width": 1280,
15 | "heads": 20,
16 | "layers": 36
17 | }
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViT-g-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 40,
6 | "width": 1408,
7 | "head_width": 88,
8 | "mlp_ratio": 4.3637,
9 | "patch_size": 14
10 | },
11 | "text_cfg": {
12 | "context_length": 77,
13 | "vocab_size": 49408,
14 | "width": 1024,
15 | "heads": 16,
16 | "layers": 24
17 | }
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-B-LTT.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_base_224",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 768,
16 | "heads": 12,
17 | "layers": 12
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-B.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_base_224",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 512,
16 | "heads": 8,
17 | "layers": 12
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-L-256.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_large_256",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 256
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 768,
16 | "heads": 12,
17 | "layers": 12
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-L-336.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_large_336",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 336
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 768,
16 | "heads": 12,
17 | "layers": 12
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-L.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_large_224",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 768,
16 | "heads": 12,
17 | "layers": 12
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-L2-256.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_large2_256",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 256
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 1024,
16 | "heads": 16,
17 | "layers": 24
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-L2-336.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_large2_336",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 336
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 1024,
16 | "heads": 16,
17 | "layers": 24
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-L2.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_large2_224",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 1024,
16 | "heads": 16,
17 | "layers": 24
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-S-LTT.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_small_224",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 768,
16 | "heads": 12,
17 | "layers": 12
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-S.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 384,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_small_224",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 384,
16 | "heads": 6,
17 | "layers": 12
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-XL-256.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1152,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_xlarge_256",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 256
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 1152,
16 | "heads": 16,
17 | "layers": 27
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-XL-336.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1152,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_xlarge_336",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 336
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 1152,
16 | "heads": 16,
17 | "layers": 27
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/ViTamin-XL-384.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1152,
3 | "vision_cfg": {
4 | "timm_model_name": "vitamin_xlarge_384",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 256
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 1152,
16 | "heads": 16,
17 | "layers": 27
18 | },
19 | "custom_text": true
20 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/coca_ViT-B-32.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 768,
7 | "patch_size": 32,
8 | "attentional_pool": true,
9 | "attn_pooler_heads": 8,
10 | "output_tokens": true
11 | },
12 | "text_cfg": {
13 | "context_length": 76,
14 | "vocab_size": 49408,
15 | "width": 512,
16 | "heads": 8,
17 | "layers": 12,
18 | "embed_cls": true,
19 | "output_tokens": true
20 | },
21 | "multimodal_cfg": {
22 | "context_length": 76,
23 | "vocab_size": 49408,
24 | "width": 512,
25 | "heads": 8,
26 | "layers": 12,
27 | "attn_pooler_heads": 8
28 | },
29 | "custom_text": true
30 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/coca_ViT-L-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 24,
6 | "width": 1024,
7 | "patch_size": 14,
8 | "attentional_pool": true,
9 | "attn_pooler_heads": 8,
10 | "output_tokens": true
11 | },
12 | "text_cfg": {
13 | "context_length": 76,
14 | "vocab_size": 49408,
15 | "width": 768,
16 | "heads": 12,
17 | "layers": 12,
18 | "embed_cls": true,
19 | "output_tokens": true
20 | },
21 | "multimodal_cfg": {
22 | "context_length": 76,
23 | "vocab_size": 49408,
24 | "width": 768,
25 | "heads": 12,
26 | "layers": 12,
27 | "attn_pooler_heads": 12
28 | },
29 | "custom_text": true
30 | }
31 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/coca_base.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "multimodal_cfg": {
4 | "width": 768,
5 | "context_length": 76,
6 | "vocab_size": 64000,
7 | "mlp_ratio": 4,
8 | "layers": 12,
9 | "dim_head": 64,
10 | "heads": 12,
11 | "n_queries": 256,
12 | "attn_pooler_heads": 8
13 | },
14 | "vision_cfg": {
15 | "image_size": 288,
16 | "layers": 12,
17 | "width": 768,
18 | "patch_size": 18,
19 | "output_tokens": true
20 | },
21 | "text_cfg": {
22 | "context_length": 76,
23 | "vocab_size": 64000,
24 | "layers": 12,
25 | "heads": 12,
26 | "width": 768,
27 | "embed_cls": true,
28 | "output_tokens": true
29 | },
30 | "custom_text": true
31 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/coca_roberta-ViT-B-32.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 768,
7 | "patch_size": 32,
8 | "output_tokens": true
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "roberta-base",
12 | "hf_tokenizer_name": "roberta-base",
13 | "hf_proj_type": "linear",
14 | "width": 768,
15 | "output_tokens": true
16 | },
17 | "multimodal_cfg": {
18 | "context_length": 76,
19 | "width": 768,
20 | "heads": 8,
21 | "layers": 12
22 | },
23 | "custom_text": true
24 | }
25 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_base.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_base",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 512,
16 | "heads": 8,
17 | "layers": 12
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_base_w.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 640,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_base",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 256
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 640,
16 | "heads": 10,
17 | "layers": 12
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_base_w_320.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 640,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_base",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 320
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 640,
16 | "heads": 10,
17 | "layers": 12
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_large.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_large",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 768,
16 | "heads": 12,
17 | "layers": 12
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_large_d.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_large",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "mlp",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 256
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 768,
16 | "heads": 12,
17 | "layers": 16
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_large_d_320.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_large",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "mlp",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 320
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 768,
16 | "heads": 12,
17 | "layers": 16
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_small.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_small",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 512,
16 | "heads": 8,
17 | "layers": 12
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_tiny.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_tiny",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 224
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 512,
16 | "heads": 8,
17 | "layers": 12
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_xlarge.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_xlarge",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 256
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 1024,
16 | "heads": 16,
17 | "layers": 20
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_xxlarge.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_xxlarge",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 256
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 1024,
16 | "heads": 16,
17 | "layers": 24
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/convnext_xxlarge_320.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "timm_model_name": "convnext_xxlarge",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "timm_drop": 0.0,
9 | "timm_drop_path": 0.1,
10 | "image_size": 320
11 | },
12 | "text_cfg": {
13 | "context_length": 77,
14 | "vocab_size": 49408,
15 | "width": 1024,
16 | "heads": 16,
17 | "layers": 24
18 | }
19 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/mt5-base-ViT-B-32.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 768,
7 | "patch_size": 32
8 | },
9 | "text_cfg": {
10 | "hf_model_name": "google/mt5-base",
11 | "hf_tokenizer_name": "google/mt5-base",
12 | "hf_pooler_type": "mean_pooler"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/mt5-xl-ViT-H-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 32,
6 | "width": 1280,
7 | "head_width": 80,
8 | "patch_size": 14
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "google/mt5-xl",
12 | "hf_tokenizer_name": "google/mt5-xl",
13 | "hf_pooler_type": "mean_pooler"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/nllb-clip-base-siglip.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "custom_text": true,
4 | "init_logit_bias": -10,
5 | "vision_cfg": {
6 | "image_size": 384,
7 | "timm_model_name": "vit_base_patch16_siglip_384",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "hf_model_name": "facebook/nllb-200-distilled-600M",
14 | "hf_tokenizer_name": "facebook/nllb-200-distilled-600M",
15 | "hf_proj_type": "linear",
16 | "hf_pooler_type": "cls_pooler"
17 | }
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/nllb-clip-base.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 768,
7 | "patch_size": 32
8 | },
9 | "text_cfg": {
10 | "hf_model_name": "facebook/nllb-200-distilled-600M",
11 | "hf_tokenizer_name": "facebook/nllb-200-distilled-600M",
12 | "hf_proj_type": "linear",
13 | "hf_pooler_type": "cls_pooler"
14 | }
15 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/nllb-clip-large-siglip.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1152,
3 | "custom_text": true,
4 | "init_logit_bias": -10,
5 | "vision_cfg": {
6 | "image_size": 384,
7 | "timm_model_name": "vit_so400m_patch14_siglip_384",
8 | "timm_model_pretrained": false,
9 | "timm_pool": "map",
10 | "timm_proj": "none"
11 | },
12 | "text_cfg": {
13 | "hf_model_name": "facebook/nllb-200-distilled-1.3B",
14 | "hf_tokenizer_name": "facebook/nllb-200-distilled-1.3B",
15 | "hf_proj_type": "linear",
16 | "hf_pooler_type": "cls_pooler"
17 | }
18 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/nllb-clip-large.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 32,
6 | "width": 1280,
7 | "head_width": 80,
8 | "patch_size": 14
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "facebook/nllb-200-distilled-1.3B",
12 | "hf_tokenizer_name": "facebook/nllb-200-distilled-1.3B",
13 | "hf_proj_type": "linear",
14 | "hf_pooler_type": "cls_pooler"
15 | }
16 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/roberta-ViT-B-32.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 12,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "roberta-base",
12 | "hf_tokenizer_name": "roberta-base",
13 | "hf_pooler_type": "mean_pooler"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/swin_base_patch4_window7_224.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 640,
3 | "vision_cfg": {
4 | "timm_model_name": "swin_base_patch4_window7_224",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "image_size": 224
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 640,
14 | "heads": 10,
15 | "layers": 12
16 | }
17 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/vit_medium_patch16_gap_256.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "timm_model_name": "vit_medium_patch16_gap_256",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "image_size": 256
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 512,
14 | "heads": 8,
15 | "layers": 12
16 | }
17 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/vit_relpos_medium_patch16_cls_224.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "timm_model_name": "vit_relpos_medium_patch16_cls_224",
5 | "timm_model_pretrained": false,
6 | "timm_pool": "",
7 | "timm_proj": "linear",
8 | "image_size": 224
9 | },
10 | "text_cfg": {
11 | "context_length": 77,
12 | "vocab_size": 49408,
13 | "width": 512,
14 | "heads": 8,
15 | "layers": 12
16 | }
17 | }
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/xlm-roberta-base-ViT-B-32.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 512,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 12,
6 | "width": 768,
7 | "patch_size": 32
8 | },
9 | "text_cfg": {
10 | "hf_model_name": "xlm-roberta-base",
11 | "hf_tokenizer_name": "xlm-roberta-base",
12 | "hf_pooler_type": "mean_pooler"
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/model_configs/xlm-roberta-large-ViT-H-14.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "vision_cfg": {
4 | "image_size": 224,
5 | "layers": 32,
6 | "width": 1280,
7 | "head_width": 80,
8 | "patch_size": 14
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "xlm-roberta-large",
12 | "hf_tokenizer_name": "xlm-roberta-large",
13 | "hf_pooler_type": "mean_pooler"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip/version.py:
--------------------------------------------------------------------------------
1 | __version__ = '2.26.1'
2 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip_train/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip_train/__init__.py
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip_train/logger.py:
--------------------------------------------------------------------------------
1 | import logging
2 |
3 |
4 | def setup_logging(log_file, level, include_host=False):
5 | if include_host:
6 | import socket
7 | hostname = socket.gethostname()
8 | formatter = logging.Formatter(
9 | f'%(asctime)s | {hostname} | %(levelname)s | %(message)s', datefmt='%Y-%m-%d,%H:%M:%S')
10 | else:
11 | formatter = logging.Formatter('%(asctime)s | %(levelname)s | %(message)s', datefmt='%Y-%m-%d,%H:%M:%S')
12 |
13 | logging.root.setLevel(level)
14 | loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]
15 | for logger in loggers:
16 | logger.setLevel(level)
17 |
18 | stream_handler = logging.StreamHandler()
19 | stream_handler.setFormatter(formatter)
20 | logging.root.addHandler(stream_handler)
21 |
22 | if log_file:
23 | file_handler = logging.FileHandler(filename=log_file)
24 | file_handler.setFormatter(formatter)
25 | logging.root.addHandler(file_handler)
26 |
27 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/src/open_clip_train/precision.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from contextlib import suppress
3 |
4 |
5 | def get_autocast(precision):
6 | if precision == 'amp':
7 | return lambda: torch.autocast(dtype=torch.bfloat16, device_type='cuda')#torch.cuda.amp.autocast
8 | elif precision == 'amp_bfloat16' or precision == 'amp_bf16':
9 | # amp_bfloat16 is more stable than amp float16 for clip training
10 | return lambda: torch.cuda.amp.autocast(dtype=torch.bfloat16)
11 | else:
12 | return suppress
13 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/submit-openclip.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #SBATCH -N 2
3 | #SBATCH --exclusive
4 | #SBATCH -o openclip.out
5 |
6 | export OMP_NUM_THREADS=1
7 |
8 | srun only_compile_dis.sh
9 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/__init__.py
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/e5-base.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "intfloat/e5-base",
12 | "hf_tokenizer_name": "intfloat/e5-base",
13 | "proj": null,
14 | "pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/e5-large-multi.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "intfloat/multilingual-e5-large",
12 | "hf_tokenizer_name": "intfloat/multilingual-e5-large",
13 | "proj": null,
14 | "pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/e5-large-v2.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "intfloat/e5-large-v2",
12 | "hf_tokenizer_name": "intfloat/e5-large-v2",
13 | "hf_proj_type": null,
14 | "hf_pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/e5-large.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "intfloat/e5-large",
12 | "hf_tokenizer_name": "intfloat/e5-large",
13 | "proj": null,
14 | "pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/e5-small-proj.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 384,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "intfloat/e5-small",
12 | "hf_tokenizer_name": "intfloat/e5-small",
13 | "proj": "mlp",
14 | "pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/e5-small-unsupervised.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 384,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "intfloat/e5-small-unsupervised",
12 | "hf_tokenizer_name": "intfloat/e5-small-unsupervised",
13 | "proj": null,
14 | "pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/e5-small-v2.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 384,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "intfloat/e5-small-v2",
12 | "hf_tokenizer_name": "intfloat/e5-small-v2",
13 | "hf_proj_type": null,
14 | "hf_pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/e5-small.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 384,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "intfloat/e5-small",
12 | "hf_tokenizer_name": "intfloat/e5-small",
13 | "proj": null,
14 | "pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/gte-base.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "thenlper/gte-base",
12 | "hf_tokenizer_name": "thenlper/gte-base",
13 | "proj": null,
14 | "pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/gte-large.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 1024,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "thenlper/gte-large",
12 | "hf_tokenizer_name": "thenlper/gte-large",
13 | "proj": null,
14 | "pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/cfg/roberta-base-hf.json:
--------------------------------------------------------------------------------
1 | {
2 | "embed_dim": 768,
3 | "quick_gelu": true,
4 | "vision_cfg": {
5 | "image_size": 224,
6 | "layers": 1,
7 | "width": 768,
8 | "patch_size": 32
9 | },
10 | "text_cfg": {
11 | "hf_model_name": "roberta-base",
12 | "hf_tokenizer_name": "roberta-base",
13 | "proj": null,
14 | "pooler_type": "mean_pooler"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/models.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | import torch.utils.data
4 |
5 |
6 | from open_clip_train.train import *
7 |
8 |
9 | def unwrap_model(model):
10 | if hasattr(model, 'module'):
11 | if hasattr(model.module, 'model'):
12 | return model.module.model
13 | else:
14 | return model.module
15 | else:
16 | if hasattr(model, 'model'):
17 | return model.model
18 | else:
19 | return model
--------------------------------------------------------------------------------
/infrastructure/train_openclip_with_hyperpod/open_clip_trn/weighted_training/utils.py:
--------------------------------------------------------------------------------
1 |
2 | import torch.utils.data
3 |
4 | from open_clip_train.data import *
5 | from open_clip_train.train import *
6 |
7 | from open_clip.factory import _natural_key
8 | from pathlib import Path
9 | import torch_xla.core.xla_model as xm
10 | import torch_xla.distributed.parallel_loader as pl
11 | import torch_xla.distributed.xla_backend
12 |
13 | torch.cuda.is_bf16_supported = lambda: True
14 |
15 | def scan_model_configs():
16 | _MODEL_CONFIG_PATHS = [Path(__file__).parent / f"cfg/"]
17 | _MODEL_CONFIGS = {}
18 | config_ext = ('.json',)
19 | config_files = []
20 | for config_path in _MODEL_CONFIG_PATHS:
21 | if config_path.is_file() and config_path.suffix in config_ext:
22 | config_files.append(config_path)
23 | elif config_path.is_dir():
24 | for ext in config_ext:
25 | config_files.extend(config_path.glob(f'*{ext}'))
26 |
27 | for cf in config_files:
28 | with open(cf, 'r') as f:
29 | model_cfg = json.load(f)
30 | if all(a in model_cfg for a in ('embed_dim', 'vision_cfg', 'text_cfg')):
31 | _MODEL_CONFIGS[cf.stem] = model_cfg
32 |
33 | _MODEL_CONFIGS = {k: v for k, v in sorted(_MODEL_CONFIGS.items(), key=lambda x: _natural_key(x[0]))}
34 |
35 | return _MODEL_CONFIGS
36 |
37 |
38 | # NON-TRAINING UTILS
39 | def print_metric_data(metric_name, metric_value):
40 | print(
41 | METRIC_LOGS_PREFIX + ": " + metric_name + "=" + str(metric_value) + ";", flush=True
42 | )
43 |
--------------------------------------------------------------------------------
/integration/MCP/Bedrock_QWEN.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/MCP/Bedrock_QWEN.png
--------------------------------------------------------------------------------
/integration/MCP/deployment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/MCP/deployment.png
--------------------------------------------------------------------------------
/integration/README.md:
--------------------------------------------------------------------------------
1 | ## Integration
2 |
3 | ## Security
4 |
5 | See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
6 |
7 | ## License
8 |
9 | This library is licensed under the MIT-0 License. See the LICENSE file.
10 |
11 |
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/README.md:
--------------------------------------------------------------------------------
1 | # genaiops-langfuse-on-aws
2 |
3 |
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/config.py:
--------------------------------------------------------------------------------
1 | MODEL_CONFIG = {
2 | "nova_pro": {
3 | "model_id": "us.amazon.nova-pro-v1:0",
4 | "inferenceConfig": {"maxTokens": 4096, "temperature": 0},
5 | },
6 | "nova_lite": {
7 | "model_id": "us.amazon.nova-lite-v1:0",
8 | "inferenceConfig": {"maxTokens": 2048, "temperature": 0},
9 | },
10 | "nova_micro": {
11 | "model_id": "us.amazon.nova-micro-v1:0",
12 | "inferenceConfig": {"maxTokens": 2048, "temperature": 0},
13 | },
14 | }
15 |
16 |
17 | GUARDRAIL_CONFIG = {
18 | "guardrailIdentifier": "", # TODO: Fill the value using "GuardrailId" from the Event Outputs
19 | "guardrailVersion": "1",
20 | "trace": "enabled",
21 | }
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-dashboard-use-case-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-dashboard-use-case-1.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-link-prompt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-link-prompt.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-prompt-management.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-prompt-management.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-guardrail-denied-topic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-guardrail-denied-topic.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-guardrail-pii-configuration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-guardrail-pii-configuration.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-guardrail-pii.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-guardrail-pii.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-guardrail-prompt-injection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-guardrail-prompt-injection.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-tool-use-vision.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-tool-use-vision.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-tool-use.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-tool-use.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-use-case-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-use-case-1.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-use-case-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-use-case-2.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-use-case-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-use-case-3.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-use-case-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/langfuse-trace-use-case-4.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/trace-observation-ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/trace-observation-ui.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/trace-observation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/trace-observation.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/trace-scores.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/trace-scores.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/trace-sessions-ui.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/trace-sessions-ui.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/trace-sessions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/trace-sessions.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab1/images/ws-event-outputs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab1/images/ws-event-outputs.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/README.md:
--------------------------------------------------------------------------------
1 | # Lab 2: Building a RAG system
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/01-bedrock-kb-console.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/01-bedrock-kb-console.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/02a-create-kb-basics.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/02a-create-kb-basics.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/02b-create-kb-data-source.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/02b-create-kb-data-source.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/02c-create-kb-index.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/02c-create-kb-index.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/03-kb-detail-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/03-kb-detail-page.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/04a-kb-data-source-after-sync.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/04a-kb-data-source-after-sync.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/04b-kb-data-sync-details.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/04b-kb-data-sync-details.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/04c-kb-main-page.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/04c-kb-main-page.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/04d-langfuse-single-eval-trace-no-score.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/04d-langfuse-single-eval-trace-no-score.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/04e-langfuse-single-eval-trace-score.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/04e-langfuse-single-eval-trace-score.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/05-kb-select-model-claude-3-sonnet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/05-kb-select-model-claude-3-sonnet.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/06a-kb-test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/06a-kb-test.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/score-with-sampling.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab2/images/bedrock-kbs/score-with-sampling.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab3/README.md:
--------------------------------------------------------------------------------
1 | # Lab 3: LLM evaluations
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab3/images/langfuse-trace-guardrail-denied-topic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab3/images/langfuse-trace-guardrail-denied-topic.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab3/images/langfuse-trace-guardrail-pii-configuration.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab3/images/langfuse-trace-guardrail-pii-configuration.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab3/images/langfuse-trace-guardrail-pii.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab3/images/langfuse-trace-guardrail-pii.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab3/images/langfuse-trace-guardrail-prompt-injection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab3/images/langfuse-trace-guardrail-prompt-injection.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab3/images/product_description_traces.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab3/images/product_description_traces.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab3/images/scored_trace.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab3/images/scored_trace.png
--------------------------------------------------------------------------------
/integration/genaiops-langfuse-on-aws/lab3/images/ws-event-outputs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/genaiops-langfuse-on-aws/lab3/images/ws-event-outputs.png
--------------------------------------------------------------------------------
/integration/langfuse/images/trace-observation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/langfuse/images/trace-observation.png
--------------------------------------------------------------------------------
/integration/langfuse/images/trace-sessions.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/integration/langfuse/images/trace-sessions.png
--------------------------------------------------------------------------------
/operations/sagemaker-mlflow-model-registry/requirements.txt:
--------------------------------------------------------------------------------
1 | mlflow==2.16.0
2 | sagemaker-mlflow==0.1.0
--------------------------------------------------------------------------------
/operations/sagemaker-mlflow-trace-evaluate-langgraph-agent/.env_sample:
--------------------------------------------------------------------------------
1 | PROJECT="AgentOpsAWS"
2 | MLFLOW_URI_SMAI = "arn:aws:sagemaker:us-west-2::mlflow-tracking-server/agentops-langraph-mlflow"
3 | MLFLOW_EXPERIMENT_ID = "agentops_experiment_langgraph"
4 | VERSION = "1.3.2"
5 | MODELID = 'anthropic.claude-3-5-haiku-20241022-v1:0'
6 | AWS_REGION = 'us-west-2'
--------------------------------------------------------------------------------
/operations/sagemaker-mlflow-trace-evaluate-langgraph-agent/.gitignore:
--------------------------------------------------------------------------------
1 | # Python-generated files
2 | __pycache__/
3 | *.py[oc]
4 | build/
5 | dist/
6 | wheels/
7 | *.egg-info
8 | __pycache__
9 |
10 | # Virtual environments
11 | .venv
12 | .env
13 |
--------------------------------------------------------------------------------
/operations/sagemaker-mlflow-trace-evaluate-langgraph-agent/LICENSE:
--------------------------------------------------------------------------------
1 | MIT No Attribution
2 |
3 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so.
10 |
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
13 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
14 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
15 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/operations/sagemaker-mlflow-trace-evaluate-langgraph-agent/data.py:
--------------------------------------------------------------------------------
1 |
2 | # Sample data as a datastore for the agent tool
3 | STOCK_PRICE = {
4 | "AAPL": 244.99,
5 | "NVDA": 139.19,
6 | "MSFT": 414.98,
7 | "AMZN": 226.70,
8 | "META": 703.80,
9 | "TSLA": 360.31,
10 | "GOOGL": 187.10,
11 | "AVGO": 228.70,
12 | "GOOG": 186.14,
13 | "BRK.B": 479.63,
14 | "JPM": 266.14,
15 | "LLY": 875.46,
16 | "V": 349.52,
17 | "XOM": 110.30,
18 | "UNH": 501.95,
19 | "MA": 559.52,
20 | "COST": 1038.45,
21 | "PG": 166.46,
22 | "WMT": 97.29,
23 | "HD": 394.77,
24 | "NFLX": 1043.75,
25 | "JNJ": 157.94,
26 | "CRM": 318.99,
27 | "ABBV": 197.30,
28 | "BAC": 46.03,
29 | "ORCL": 175.85,
30 | "MRK": 87.08,
31 | "CVX": 158.66,
32 | "KO": 69.90,
33 | "CSCO": 64.38
34 | }
35 |
--------------------------------------------------------------------------------
/operations/sagemaker-mlflow-trace-evaluate-langgraph-agent/graph_diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/operations/sagemaker-mlflow-trace-evaluate-langgraph-agent/graph_diagram.png
--------------------------------------------------------------------------------
/operations/sagemaker-mlflow-trace-evaluate-langgraph-agent/pyproject.toml:
--------------------------------------------------------------------------------
1 | [project]
2 | name = "agentops-traceevaluate-langgraph-mlflow"
3 | version = "0.1.0"
4 | description = "Add your description here"
5 | readme = "README.md"
6 | requires-python = ">=3.13"
7 | dependencies = [
8 | "dask>=2025.2.0",
9 | "evaluate>=0.4.3",
10 | "ipykernel>=6.29.5",
11 | "langchain-aws>=0.2.14",
12 | "langgraph>=0.3.2",
13 | "mlflow>=2.20.2",
14 | "nltk>=3.9.1",
15 | "psutil>=7.0.0",
16 | "python-dotenv>=1.0.1",
17 | "ragas==0.2.13",
18 | "rouge-score>=0.1.2",
19 | "sagemaker-mlflow>=0.1.0",
20 | "textstat>=0.7.5",
21 | "tf-keras>=2.15.0",
22 | "tiktoken>=0.9.0",
23 | "torch>=2.6.0",
24 | "tqdm>=4.67.1",
25 | "transformers>=4.49.0",
26 | ]
27 |
--------------------------------------------------------------------------------
/operations/sagemaker-mlflow-trace-evaluate-langgraph-agent/requirements.txt:
--------------------------------------------------------------------------------
1 | boto3>=1.38.0
2 | datasets>=3.6.0
3 | evaluate>=0.4.3
4 | ipykernel>=6.29.5
5 | langchain-aws>=0.2.14
6 | langgraph>=0.3.2
7 | mlflow==2.20.2
8 | nltk>=3.9.1
9 | pandas>=2.2.0
10 | psutil>=7.0.0
11 | python-dotenv>=1.0.1
12 | ragas==0.2.13
13 | rouge-score>=0.1.2
14 | sagemaker-mlflow>=0.1.0
15 | textstat>=0.7.5
16 | tiktoken>=0.9.0
17 | torch
18 | tqdm>=4.67.1
19 | transformers>=4.49.0
--------------------------------------------------------------------------------
/operations/sagemaker-mlflow-trace-evaluate-langgraph-agent/run.py:
--------------------------------------------------------------------------------
1 | from utils import run_evaluation_mlflow, register_agent
2 |
3 | def main():
4 | print("Evaluate agentops-traceevaluate-langgraph-mlflow!")
5 |
6 | # Export all results to sagemaker MLFlow tracking server
7 | # Evaluation using only MLFlow
8 | run_evaluation_mlflow()
9 | #register_agent("graph.py")
10 |
11 |
12 | if __name__ == "__main__":
13 | main()
14 |
--------------------------------------------------------------------------------
/operations/sagemaker-mlflow-trace-evaluate-langgraph-agent/tools.py:
--------------------------------------------------------------------------------
1 | from langchain_core.tools import tool
2 |
3 | from data import STOCK_PRICE
4 |
5 | # Define the tools for the agent to use
6 |
7 | @tool
8 | def get_stock_price_data(symbol: str) -> float:
9 | """Fetches the current stock price for a given symbol.
10 |
11 | Args:
12 | symbol: The name of the stock symbol (e.g., 'AMZN', 'AAPL', 'NVDA').
13 |
14 | Returns:
15 | float: The current price of the stock in dollars per stock.
16 |
17 | Raises:
18 | KeyError: If the specified stock is not found in the data source.
19 | """
20 | try:
21 | stock_name = symbol.upper().strip()
22 | if stock_name not in STOCK_PRICE:
23 | raise KeyError(
24 | f"Stock symbol'{stock_name}' not found. Available stock symbols: {', '.join(STOCK_PRICE.keys())}"
25 | )
26 | return STOCK_PRICE[stock_name]
27 | except Exception as e:
28 | raise Exception(f"Error fetching Stock price: {str(e)}")
29 |
--------------------------------------------------------------------------------
/operations/sagemaker-unified-model-registry/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aws-samples/genai-ml-platform-examples/64e16cd9e590f1b6b0b84bf0d8b7626299e81d98/operations/sagemaker-unified-model-registry/.DS_Store
--------------------------------------------------------------------------------