{"id":26372713,"url":"https://github.com/bits-bytes-nn/bedrock-model-finetuner","last_synced_at":"2025-03-17T01:18:58.667Z","repository":{"id":261638010,"uuid":"860947653","full_name":"bits-bytes-nn/bedrock-model-finetuner","owner":"bits-bytes-nn","description":"A helper library for fine-tuning Amazon Bedrock models. This toolkit assists in generating Q\u0026A datasets from documents and streamlines the LLM fine-tuning process.","archived":false,"fork":false,"pushed_at":"2024-11-07T15:51:05.000Z","size":86,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-19T12:28:21.017Z","etag":null,"topics":["amazon-bedrock","llm-finetuning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bits-bytes-nn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-21T15:38:13.000Z","updated_at":"2024-11-27T21:12:55.000Z","dependencies_parsed_at":"2024-11-07T16:53:50.508Z","dependency_job_id":null,"html_url":"https://github.com/bits-bytes-nn/bedrock-model-finetuner","commit_stats":null,"previous_names":["aldente0630/bedrock-model-finetuner","bits-bytes-nn/bedrock-model-finetuner"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bits-bytes-nn%2Fbedrock-model-finetuner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bits-bytes-nn%2Fbedrock-model-finetuner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bits-bytes-nn%2Fbedrock-model-finetuner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bits-bytes-nn%2Fbedrock-model-finetuner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bits-bytes-nn","download_url":"https://codeload.github.com/bits-bytes-nn/bedrock-model-finetuner/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243955782,"owners_count":20374373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-bedrock","llm-finetuning"],"created_at":"2025-03-17T01:18:58.104Z","updated_at":"2025-03-17T01:18:58.653Z","avatar_url":"https://github.com/bits-bytes-nn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bedrock Model Fine-tuner\n\nBedrock Model Fine-tuner is a helper library for fine-tuning Amazon Bedrock models. This toolkit assists in generating Q\u0026A datasets from documents and streamlines the LLM fine-tuning process.\n\n## Features\n\n- Wrapper classes for easy fine-tuning and deployment of Bedrock models using boto3 (currently limited to Claude 3 Haiku model)\n- Q\u0026A dataset generation from documents for Claude 3 Haiku model fine-tuning\n- Dataset validation to ensure compliance with Claude 3 Haiku model fine-tuning format and constraints\n\n## Usage\n\n### Step 1: Generate Q\u0026A Dataset from Documents (Optional)\n\n```python\nimport boto3\nfrom core import ChatModelId, QaDatasetGenerator, get_llm\n\nboto_session = boto3.Session(region_name=\"us-west-2\")\n\nllm = get_llm(\n    ChatModelId.CLAUDE_V3_5_SONNET,\n    region_name=\"us-west-2\",\n)\nqa_dataset_generator = QaDatasetGenerator.from_jsonl(llm, \"../assets/docs.jsonl\")\n\ntrain_dataset = qa_dataset_generator.generate(dataset_type=\"train\")\n_ = qa_dataset_generator.save_and_upload(\n    train_dataset,\n    \"../assets/train_dataset.jsonl\",\n    boto_session=boto_session,\n    bucket_name=\"\u003cYOUR-S3-BUCKET-NAME\u003e\",\n)\n```\n\n### Step 2: Validate Q\u0026A Dataset\n\n```python\nfrom core import QaDatasetValidator\n\nqa_dataset_validator = QaDatasetValidator()\nqa_dataset_validator.validate_data(\"../assets/train_dataset.jsonl\")\n```\n\n### Step 3: Fine-tune and Deploy Model\n\n```python\nfrom core import BedrockModelFinetuner\n\nbedrock_model_finetuner = BedrockModelFinetuner(aws_region_name=\"us-west-2\")\n\n_ = bedrock_model_finetuner.finetune(\"s3://\u003cYOUR-S3-BUCKET-NAME\u003e/datasets/train_dataset.jsonl\")\n_ = bedrock_model_finetuner.deploy()\n```\n\n### Step 4: Delete Provisioned Model (Optional)\n\n```python\n_ = bedrock_model_finetuner.delete()\n```\n\nFor detailed usage examples, please refer to the notebook files in the `samples` directory.\n\n## Additional Resources\n\n- [Amazon Bedrock Custom Models Documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html)\n- [AWS Samples](https://github.com/aws-samples/amazon-bedrock-samples/tree/main/custom-models/bedrock-fine-tuning/claude-haiku)\n- [Fine-tune Anthropic's Claude 3 Haiku in Amazon Bedrock to Boost Model Accuracy and Quality](https://aws.amazon.com/ko/blogs/machine-learning/fine-tune-anthropics-claude-3-haiku-in-amazon-bedrock-to-boost-model-accuracy-and-quality/)\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbits-bytes-nn%2Fbedrock-model-finetuner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbits-bytes-nn%2Fbedrock-model-finetuner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbits-bytes-nn%2Fbedrock-model-finetuner/lists"}