이제 Amazon SageMaker JumpStart에서 Meta Llama 3 모델을 사용할 수 있습니다 | 아마존 웹 서비스

이제 Amazon SageMaker JumpStart에서 Meta Llama 3 모델을 사용할 수 있습니다 | 아마존 웹 서비스

오늘 Meta Llama 3 기본 모델을 다음을 통해 사용할 수 있다는 소식을 발표하게 되어 기쁘게 생각합니다. Amazon SageMaker 점프스타트 추론을 배포하고 실행합니다. Llama 3 모델은 사전 훈련되고 미세 조정된 생성 텍스트 모델의 모음입니다.

이 게시물에서는 SageMaker JumpStart를 통해 Llama 3 모델을 검색하고 배포하는 방법을 안내합니다.

메타라마3란 무엇인가요?

Llama 3는 8K 컨텍스트 길이의 70B와 8B라는 두 가지 매개변수 크기로 제공되며 추론, 코드 생성 및 명령 따르기 기능이 향상되어 광범위한 사용 사례를 지원할 수 있습니다. Llama 3는 디코더 전용 변환기 아키텍처와 128k 크기로 향상된 모델 성능을 제공하는 새로운 토크나이저를 사용합니다. 또한 Meta는 허위 거부율을 크게 줄이고 정렬을 개선하며 모델 응답의 다양성을 높이는 훈련 후 절차를 개선했습니다. 이제 SageMaker 파이프라인, SageMaker 디버거 또는 컨테이너 로그와 같은 Amazon SageMaker 기능을 통해 Llama 3 성능 및 MLOps 제어의 결합된 이점을 얻을 수 있습니다. 또한 모델은 VPC 제어 하에 AWS 보안 환경에 배포되어 데이터 보안을 제공하는 데 도움이 됩니다.

SageMaker JumpStart란?

SageMaker JumpStart를 사용하면 공개적으로 사용 가능한 다양한 기초 모델 중에서 선택할 수 있습니다. ML 실무자는 네트워크 격리 환경에서 전용 SageMaker 인스턴스에 기초 모델을 배포하고 모델 교육 및 배포를 위해 SageMaker를 사용하여 모델을 사용자 지정할 수 있습니다. 이제 몇 번의 클릭만으로 Llama 3 모델을 검색하고 배포할 수 있습니다. 아마존 세이지 메이커 스튜디오 또는 SageMaker Python SDK를 통해 프로그래밍 방식으로 다음과 같은 SageMaker 기능으로 모델 성능 및 MLOps 컨트롤을 파생할 수 있습니다. SageMaker 파이프 라인, SageMaker 디버거또는 컨테이너 로그. 이 모델은 AWS 보안 환경과 VPC 제어에 배포되어 데이터 보안을 제공하는 데 도움이 됩니다. Llama 3 모델은 현재 Amazon SageMaker Studio에서 배포 및 추론할 수 있습니다. us-east-1 (버지니아 북부), us-east-2 (오하이오), us-west-2 (오레곤), eu-west-1 (아일랜드) 및 ap-northeast-1 (도쿄) AWS 리전.

모델 살펴보기

SageMaker Studio UI 및 SageMaker Python SDK에서 SageMaker JumpStart를 통해 기초 모델에 액세스할 수 있습니다. 이 섹션에서는 SageMaker Studio에서 모델을 검색하는 방법을 살펴봅니다.

SageMaker Studio는 데이터 준비에서 ML 모델 구축, 교육 및 배포에 이르기까지 모든 ML 개발 단계를 수행하기 위해 특별히 제작된 도구에 액세스할 수 있는 단일 웹 기반 시각적 인터페이스를 제공하는 통합 개발 환경(IDE)입니다. SageMaker Studio 시작 및 설정 방법에 대한 자세한 내용은 다음을 참조하십시오. 아마존 세이지 메이커 스튜디오.

SageMaker Studio에서는 사전 훈련된 모델, 노트북 및 사전 구축된 솔루션이 포함된 SageMaker JumpStart에 액세스할 수 있습니다. 사전 구축 및 자동화된 솔루션.

이제 Amazon SageMaker JumpStart에서 Meta Llama 3 모델을 사용할 수 있습니다 | Amazon Web Services PlatoBlockchain 데이터 인텔리전스. 수직 검색. 일체 포함.

SageMaker JumpStart 랜딩 페이지에서 모델 공급자의 이름을 딴 다양한 허브를 탐색하여 다양한 모델을 쉽게 검색할 수 있습니다. Meta 허브에서 Llama 3 모델을 찾아보실 수 있습니다. Llama 3 모델이 표시되지 않으면 종료했다가 다시 시작해 SageMaker Studio 버전을 업데이트하십시오. 자세한 내용은 다음을 참조하세요. Studio Classic 앱 종료 및 업데이트.

이제 Amazon SageMaker JumpStart에서 Meta Llama 3 모델을 사용할 수 있습니다 | Amazon Web Services PlatoBlockchain 데이터 인텔리전스. 수직 검색. 일체 포함.

왼쪽 상단 검색창에 "Meta-llama-3"을 검색하시면 Llama 3 모델을 찾으실 수 있습니다.

이제 Amazon SageMaker JumpStart에서 Meta Llama 3 모델을 사용할 수 있습니다 | Amazon Web Services PlatoBlockchain 데이터 인텔리전스. 수직 검색. 일체 포함.

Meta 허브를 클릭하면 SageMaker JumpStart에서 사용 가능한 모든 메타 모델을 검색할 수 있습니다.

이제 Amazon SageMaker JumpStart에서 Meta Llama 3 모델을 사용할 수 있습니다 | Amazon Web Services PlatoBlockchain 데이터 인텔리전스. 수직 검색. 일체 포함.

모델 카드를 클릭하면 해당 모델 세부 정보 페이지가 열리고, 여기에서 모델을 쉽게 배포할 수 있습니다.

이제 Amazon SageMaker JumpStart에서 Meta Llama 3 모델을 사용할 수 있습니다 | Amazon Web Services PlatoBlockchain 데이터 인텔리전스. 수직 검색. 일체 포함.

모델 배포

당신이 선택할 때 배포 EULA 조건을 승인하면 배포가 시작됩니다.

이제 Amazon SageMaker JumpStart에서 Meta Llama 3 모델을 사용할 수 있습니다 | Amazon Web Services PlatoBlockchain 데이터 인텔리전스. 수직 검색. 일체 포함.

배포 버튼을 클릭하면 표시되는 페이지에서 배포 진행 상황을 모니터링할 수 있습니다.

이제 Amazon SageMaker JumpStart에서 Meta Llama 3 모델을 사용할 수 있습니다 | Amazon Web Services PlatoBlockchain 데이터 인텔리전스. 수직 검색. 일체 포함.

또는 선택할 수 있습니다 노트북 열기 예제 노트북을 통해 배포합니다. 예제 노트북은 추론을 위해 모델을 배포하고 리소스를 정리하는 방법에 대한 엔드투엔드 지침을 제공합니다.

노트북을 사용하여 배포하려면 먼저 다음에서 지정한 적절한 모델을 선택합니다. model_id. 다음 코드를 사용하여 SageMaker에서 선택한 모델을 배포할 수 있습니다.

from sagemaker.jumpstart.model import JumpStartModel

model = JumpStartModel(model_id = "meta-textgeneration-llama-3-70b-instruct")
predictor = model.deploy(accept_eula=False)

기본적으로 accept_eulaFalse. 엔드포인트를 성공적으로 배포하려면 EULA에 수동으로 동의해야 합니다. 그렇게 하면 사용자 라이센스 계약 및 사용 제한 정책에 동의하게 됩니다. 라이센스 계약도 찾을 수 있습니다 라마 웹사이트. 그러면 기본 인스턴스 유형 및 기본 VPC 구성을 포함한 기본 구성으로 SageMaker에 모델이 배포됩니다. 기본값이 아닌 값을 지정하여 이러한 구성을 변경할 수 있습니다. JumpStartModel. 자세한 내용은 다음을 참조하세요. 선적 서류 비치.

다음 표에는 SageMaker JumpStart에서 사용할 수 있는 모든 Llama 3 모델이 나열되어 있습니다. model_ids, 기본 인스턴스 유형 및 각 모델에 대해 지원되는 총 토큰의 최대 수(입력 토큰 수와 생성된 토큰 수의 합계)입니다.

모델 이름 모델 ID 최대 총 토큰 기본 인스턴스 유형
메타-라마-3-8B 메타 텍스트 생성-라마-3-8B 8192 ml.g5.12xlarge
메타-라마-3-8B-지시 메타 텍스트 생성-라마-3-8B-지시 8192 ml.g5.12xlarge
메타-라마-3-70B 메타 텍스트 생성 라마-3-70b 8192 ml.p4d.24xlarge
메타-라마-3-70B-지시 메타 텍스트 생성-라마-3-70b-지시 8192 ml.p4d.24xlarge

추론 실행

모델을 배포한 후 SageMaker 예측기를 통해 배포된 엔드포인트에 대해 추론을 실행할 수 있습니다. 미세 조정된 지시 모델(Llama 3: 8B Instruct 및 70B Instruct)은 사용자와 채팅 도우미 간의 채팅 기록을 수락하고 후속 채팅을 생성합니다. 사전 훈련된 모델(Llama 3: 8B 및 70B)에는 문자열 프롬프트가 필요하며 제공된 프롬프트에서 텍스트 완성을 수행합니다.

predictor.predict(payload)

추론 매개변수는 엔드포인트에서 텍스트 생성 프로세스를 제어합니다. Max 새 토큰은 모델에서 생성된 출력의 크기를 제어합니다. 이는 모델의 어휘가 영어 어휘와 동일하지 않고 각 토큰이 영어 단어가 아닐 수 있으므로 단어 수와 동일하지 않습니다. 온도 매개변수는 출력의 무작위성을 제어합니다. 온도가 높을수록 더 창의적이고 환각적인 출력이 생성됩니다. 모든 추론 매개변수는 선택사항입니다.

70B 모델에 대한 예시 프롬프트

모든 텍스트의 텍스트 완성을 위해 Llama 3 모델을 사용할 수 있습니다. 텍스트 생성을 통해 질문 답변, 언어 번역, 감정 분석 등 다양한 작업을 수행할 수 있습니다. 엔드포인트에 대한 입력 페이로드는 다음 코드와 같습니다.

payload = {
    “inputs”: str,
   (optional)"parameters":{"max_new_tokens":int, "top_p":float, "temperature":float}
}

다음은 몇 가지 샘플 예제 프롬프트와 모델에서 생성된 텍스트입니다. 모든 출력은 추론 매개변수로 생성됩니다. {"max_new_tokens":64, "top_p":0.9, "temperature":0.6}.

Input: Simply put, the theory of relativity states that
Output: 1) the laws of physics are the same for all observers, and 2) the speed of light is constant for all observers. The first part of the theory is known as the special theory of relativity, and the second part is known as the general theory of relativity.nThe special theory of relativity states

Input: I believe the meaning of life is
Output:  to live a life of purpose, on purpose. I believe that we are all here to make a difference in the world, and that we are all here to make a difference in the lives of others. I believe that we are all here to make a difference in the world, and that we are all here to mak

Input: A brief message congratulating the team on the launch:nnHi everyone,nnI just 
Output: wanted to say congratulations on the launch of the new website! It looks great and I'm sure it will be a valuable resource for our customers. I know that a lot of hard work went into making this happen, so thank you all for your efforts.nnBest regards,nJohn Doen

다음 예에서는 모델에 사용할 수 있는 훈련 샘플을 제공하는 상황 내 학습이 거의 없는 Llama 3 모델을 사용하는 방법을 보여줍니다. 배포된 모델과 이 프로세스 중에만 추론을 실행하며 모델 가중치는 변경되지 않습니다.

Input:
Translate English to French:nsea otter => loutre de mernpeppermint => menthe poivréenplush girafe => girafe peluchencheese =>
Output:  fromagenpanda => pandanpenguin => pingouinnpolar bear => ours polairenpuffin => macareuxnsloth => paresseuxnwalrus => morsenwhale => baleinenzebra => zu00e8brenTranslate English to German:n

70B-Instruct 모델에 대한 예시 프롬프트

대화 사용 사례에 최적화된 Llama 3 지시 모델을 사용하면 지시 모델 엔드포인트에 대한 입력은 채팅 도우미와 사용자 간의 이전 기록입니다. 지금까지 진행된 대화의 맥락에 맞는 질문을 할 수 있습니다. 채팅 도우미의 동작을 정의하는 페르소나와 같은 시스템 구성을 제공할 수도 있습니다. 입력 페이로드 형식은 사전 학습된 기본 모델과 동일하지만 입력 텍스트의 형식은 다음 방식으로 지정되어야 합니다.

<|begin_of_text|><|start_header_id|>system<|end_header_id|>

[SYSTEM_TEXT]<|eot_id|><|start_header_id|>user<|end_header_id|>

[USER_TEXT]<|eot_id|><|start_header_id|>assistant<|end_header_id|>

이 지침 템플릿에서는 선택적으로 system 역할을 선택하고 턴제 역사에 원하는 만큼 교대 역할을 포함합니다. 최종 역할은 항상 assistant 두 개의 새로운 줄 바꿈으로 끝납니다.

다음으로, 모델의 몇 가지 예시 프롬프트와 응답을 고려해보세요. 다음 예에서 사용자는 어시스턴트에게 간단한 질문을 하고 있습니다.

Input: <|begin_of_text|><|start_header_id|>user<|end_header_id|>nnwhat is the recipe of mayonnaise?<|eot_id|><|start_header_id|>assistant<|end_header_id|>nn
Output: The classic condiment! Mayonnaise is a thick, creamy emulsion sauce made from a combination of oil, egg yolks, acid (such as vinegar or lemon juice), and seasonings. Here's a simple recipe to make mayonnaise at home:nn**Ingredients:**nn* 2 egg yolksn* 1 tablespoon lemon juice or vinegar (such as apple cider vinegar or white wine vinegar)n* 1/2 teaspoon Dijon mustard (optional, but recommended for flavor)n* 1/2 cup (120 ml) neutral-tasting oil, such as canola, grapeseed, or sunflower oiln* Salt, to tastenn**Instructions:**nn1. **Start with room temperature ingredients**: This is crucial for emulsification to occur.n2. **In a medium-sized bowl**, whisk together the egg yolks, lemon juice or vinegar, and Dijon mustard (if using) until well combined.n3. **Slowly add the oil**: While continuously whisking the egg yolk mixture, slowly pour in the oil in a thin, steady stream. Start with a very slow drizzle and gradually increase the flow as the mixture thickens.n4. **Whisk constantly**: Keep whisking until the mixture has doubled in volume and has a thick, creamy consistency. This should take about 5-7 minutes.n5. **Check the consistency**: Stop whisking when the mayonnaise has reached the desired consistency. It should be smooth, thick, and hold its shape when the whisk is lifted.n6. **Season with salt**: Add salt to taste, and whisk until well combined.n7. **Taste and adjust**: If the mayonnaise is too thick, add a little water. If it's not thick enough, add a little more oil.nn**Tips and Variations:**nn* Use a neutral-tasting oil to avoid flavoring the mayonnaise.n* If you're using a stand mixer, use the whisk attachment and start with a slow speed, increasing as needed.n* Add flavorings like minced garlic, chopped fresh herbs (e.g., parsley, dill, or tarragon), or grated ginger to create different flavor profiles.n* For a lighter mayonnaise, use only 1 egg yolk or add a little water to thin it out.n* If the mayonnaise breaks or separates, don't worry! Simply start again with a new egg yolk and slowly whisk in the broken mayonnaise.nn**Homemade Mayonnaise vs. Store-Bought:**nnWhile store-bought mayonnaise is convenient, homemade mayonnaise offers several advantages:nn* Freshness: Homemade mayonnaise is made to order, ensuring optimal flavor and texture.n* Customization: You can tailor the flavor to your liking with various seasonings and ingredients.n* No preservatives: Homemade mayonnaise doesn't contain added preservatives, making it a healthier option.nnEnjoy your freshly made mayonnaise!

다음 예에서 사용자는 어시스턴트와 파리의 관광 명소에 대해 대화를 나눕니다. 그런 다음 사용자는 채팅 도우미가 권장하는 첫 번째 옵션에 대해 문의합니다.

Input: <|begin_of_text|><|start_header_id|>user<|end_header_id|>nnI am going to Paris, what should I see?<|eot_id|><|start_header_id|>assistant<|end_header_id|>nnParis, the capital of France, is known for its stunning architecture, art museums, historical landmarks, and romantic atmosphere. Here are some of the top attractions to see in Paris:nn1. The Eiffel Tower: The iconic Eiffel Tower is one of the most recognizable landmarks in the world and offers breathtaking views of the city.n2. The Louvre Museum: The Louvre is one of the world's largest and most famous museums, housing an impressive collection of art and artifacts, including the Mona Lisa.n3. Notre-Dame Cathedral: This beautiful cathedral is one of the most famous landmarks in Paris and is known for its Gothic architecture and stunning stained glass windows.nnThese are just a few of the many attractions that Paris has to offer. With so much to see and do, it's no wonder that Paris is one of the most popular tourist destinations in the world.<|eot_id|><|start_header_id|>user<|end_header_id|>nnWhat is so great about #1?<|eot_id|><|start_header_id|>assistant<|end_header_id|>nn
Output: The Eiffel Tower! It's an iconic symbol of Paris and one of the most recognizable landmarks in the world. Here are some reasons why it's so great:nn1. **Engineering marvel**: When it was built for the 1889 World's Fair, the Eiffel Tower was a groundbreaking feat of engineering. It was the tallest structure in the world at the time, standing at 324 meters (1,063 feet).n2. **Panoramic views**: The Eiffel Tower offers breathtaking 360-degree views of the city from its observation decks. You can see many of Paris' famous landmarks, such as the Seine River, the Louvre, and Montmartre.n3. **Romantic atmosphere**: The Eiffel Tower is often associated with romance and is a popular spot for proposals, weddings, and romantic dinners. The tower's iron latticework and twinkling lights at night add to its romantic ambiance.n4. **Historical significance**: The Eiffel Tower has played a significant role in French history, serving as a communication tower during World War I and a symbol of French culture and engineering.n5. **Accessibility**: The Eiffel Tower is easily accessible by public transportation or on foot, and there are various ways to experience it, including taking the stairs, elevator, or a guided tour.n6. **Nighttime spectacle**: The Eiffel Tower is even more magical at night, when it's illuminated with thousands of twinkling lights. The light show, known as the "Eiffel Tower Sparkle," takes place every hour on the hour from dusk to midnight.n7. **Iconic status**: The Eiffel Tower has been featured in countless films, literature, and art, making it an instantly recognizable symbol of Paris and France.nnOverall, the Eiffel Tower is a must-visit attraction in Paris, offering a unique combination of history, engineering, romance, and stunning views.

다음 예에서는 시스템 구성을 설정합니다.

Input: <|begin_of_text|><|start_header_id|>system<|end_header_id|>nnAlways answer with Haiku<|eot_id|><|start_header_id|>user<|end_header_id|>nnI am going to Paris, what should I see?<|eot_id|><|start_header_id|>assistant<|end_header_id|>nn
Output: Eiffel's iron lacenRiver Seine's gentle flow bynMontmartre's charm calls
Input: <|begin_of_text|><|start_header_id|>system<|end_header_id|>nnAlways answer with emojis<|eot_id|><|start_header_id|>user<|end_header_id|>nnHow to go from Beijing to NY?<|eot_id|><|start_header_id|>assistant<|end_header_id|>nn
Output: ✈️🛬️🇺🇸

정리

노트북 실행을 마친 후에는 청구가 중지되도록 프로세스에서 생성한 모든 리소스를 삭제해야 합니다. 다음 코드를 사용하세요.

predictor.delete_model()
predictor.delete_endpoint()

결론

이 게시물에서는 SageMaker Studio에서 Llama 3 모델을 시작하는 방법을 보여 주었습니다. 이제 수십억 개의 매개변수가 포함된 3개의 Llama XNUMX 기반 모델에 액세스할 수 있습니다. 기초 모델은 사전 훈련되어 있으므로 훈련 및 인프라 비용을 낮추고 사용 사례에 맞게 사용자 정의할 수 있습니다. 확인해 보세요 세이지메이커 점프스타트 지금 SageMaker Studio에서 시작해 보세요.


저자 정보

카일 울리히 AWS의 Applied Scientist II입니다.
신황 AWS의 수석 응용 과학자입니다
칭란 AWS의 수석 소프트웨어 개발자 엔지니어입니다.
안하오티안 AWS의 소프트웨어 개발자 엔지니어 II입니다.
크리스토퍼 휘튼 AWS의 소프트웨어 개발 엔지니어 II입니다.
타일러 오스터버그 저는 AWS의 소프트웨어 개발 엔지니어입니다.
마난 샤 AWS의 소프트웨어 개발 관리자입니다
조나단 기네가뉴 AWS의 수석 소프트웨어 개발자 엔지니어입니다.
아드리아나 시몬스 AWS의 수석 제품 마케팅 관리자입니다.
준원 AWS의 수석 제품 관리자입니다.
아시시 케탄 AWS의 수석 응용 과학자입니다
라크나 차다 AWS의 AI/ML 수석 솔루션 설계자입니다.
디팍 루파쿨라 AWS의 수석 GTM 전문가입니다.

타임 스탬프 :

더보기 AWS 기계 학습