This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
ENDPOINT = "huggingface-pytorch-tgi-inference-" | |
sagemaker_runtime = boto3.client("sagemaker-runtime", region_name='us-east-1') | |
def lambda_handler(event, context): | |
query_params = event['queryStringParameters'] | |
query = query_params['query'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import boto3 | |
import botocore.config | |
from datetime import datetime | |
### AWS BEDROCK CALL ### | |
# { | |
# "modelId": "meta.llama4-scout-17b-instruct-v1:0", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
content_writer: | |
role: > | |
Educational Content Writer | |
goal: > | |
Create engaging, informative content that thoroughly explains the assigned topic | |
and provides valuable insights to the reader | |
backstory: > | |
You are a talented educational writer with expertise in creating clear, engaging | |
content. You have a gift for explaining complex concepts in accessible language | |
and organizing information in a way that helps readers build their understanding. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You can use mlflow context manager to log any param or metric values. One example is shown below | |
with mlflow.start_run(): | |
mlflow.log_param("param_name", param_value) | |
mlflow.log_metric("metric_name", metric_value) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Check the GPU | |
!nvidia-smi | |
#Check the packages installed | |
!pip freeze | |
#tensorflow-gpu package is by default installed in Colab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import warnings | |
with warnings.catch_warnings(): | |
warnings.filterwarnings('ignore', category=FutureWarning) | |
import h5py | |
import os | |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '1' | |
import tensorflow as tf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It is highly recommended to use Pandas for such data processing problems | |
import pandas as pd | |
import numpy as np | |
dataset = {'feature1': np.random.rand(5000), | |
'feature2': np.random.rand(5000), | |
'feature3': np.random.rand(5000) | |
} |