Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | שירותי האינטרנט של אמזון

Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | שירותי האינטרנט של אמזון

היום, אנו נרגשים לבשר כי Mixtral-8x7B מודל שפה גדול (LLM), שפותח על ידי Mistral AI, זמין עבור לקוחות דרך אמזון SageMaker JumpStart לפרוס בלחיצה אחת להפעלת הסקה. ה-Mixtral-8x7B LLM הוא תערובת דלילה מאומנת מראש של מודל מומחים, המבוססת על עמוד שדרה של 7 מיליארד פרמטרים עם שמונה מומחים לכל שכבת הזנה קדימה. אתה יכול לנסות את המודל הזה עם SageMaker JumpStart, רכזת למידת מכונה (ML) המספקת גישה לאלגוריתמים ומודלים כדי שתוכל להתחיל במהירות עם ML. בפוסט זה, אנו עוברים דרך כיצד לגלות ולפרוס את דגם Mixtral-8x7B.

מה זה Mixtral-8x7B

Mixtral-8x7B הוא מודל יסוד שפותח על ידי Mistral AI, התומך בטקסט באנגלית, צרפתית, גרמנית, איטלקית וספרדית, עם יכולות יצירת קוד. הוא תומך במגוון מקרי שימוש כגון סיכום טקסט, סיווג, השלמת טקסט והשלמת קוד. הוא מתנהג היטב במצב צ'אט. כדי להדגים את יכולת ההתאמה האישית הפשוטה של ​​המודל, Mistral AI פרסמה גם מודל הוראות Mixtral-8x7B עבור מקרי שימוש בצ'אט, מכוונן באמצעות מגוון מערכי נתונים של שיחות זמינים לציבור. לדגמי Mixtral יש אורך הקשר גדול של עד 32,000 אסימונים.

Mixtral-8x7B מספק שיפורים משמעותיים בביצועים בהשוואה לדגמים חדישים קודמים. התערובת הדלילה של ארכיטקטורת מומחים מאפשרת לו להשיג תוצאת ביצועים טובה יותר ב-9 מתוך 12 מדדי עיבוד שפה טבעית (NLP) שנבדקו על ידי Mistral AI. Mixtral תואם או עולה על הביצועים של דגמים עד פי 10 מגודלו. על ידי ניצול רק של חלק מפרמטרים לכל אסימון, הוא משיג מהירויות הסקה מהירות יותר ועלות חישוב נמוכה יותר בהשוואה לדגמים צפופים בגדלים שווים - לדוגמה, עם 46.7 מיליארד פרמטרים בסך הכל אך רק 12.9 מיליארד בשימוש לכל אסימון. שילוב זה של ביצועים גבוהים, תמיכה רב-לשונית ויעילות חישובית הופכים את Mixtral-8x7B לבחירה מושכת עבור יישומי NLP.

הדגם זמין תחת רישיון Apache 2.0 המתירני, לשימוש ללא הגבלות.

מה זה SageMaker JumpStart

עם SageMaker JumpStart, מתרגלי ML יכולים לבחור מתוך רשימה הולכת וגדלה של דגמי יסוד עם הביצועים הטובים ביותר. מתרגלי ML יכולים לפרוס מודלים של בסיס למסורים אמזון SageMaker מופעים בתוך סביבה מבודדת רשת, ולהתאים אישית מודלים באמצעות SageMaker להדרכה ופריסה של מודלים.

כעת תוכל לגלות ולפרוס את Mixtral-8x7B בכמה לחיצות פנימה סטודיו SageMaker של אמזון או באופן פרוגרמטי דרך SageMaker Python SDK, מה שמאפשר לך להפיק ביצועי מודל ובקרות MLOps עם תכונות SageMaker כגון צינורות SageMaker של אמזון, באגים של SageMaker באמזון, או יומני מיכל. המודל נפרס בסביבה מאובטחת של AWS ותחת בקרות ה-VPC שלך, ועוזר להבטיח אבטחת נתונים.

גלה דגמים

אתה יכול לגשת לדגמי היסוד של Mixtral-8x7B דרך SageMaker JumpStart בממשק המשתמש של SageMaker Studio ו- SageMaker Python SDK. בחלק זה נעבור על איך לגלות את הדגמים בסטודיו SageMaker.

SageMaker Studio הוא סביבת פיתוח משולבת (IDE) המספקת ממשק חזותי אחד מבוסס אינטרנט שבו אתה יכול לגשת לכלים ייעודיים לביצוע כל שלבי הפיתוח של ML, מהכנת נתונים ועד לבנייה, הדרכה ופריסה של מודלי ה-ML שלך. לפרטים נוספים כיצד להתחיל ולהגדיר את SageMaker Studio, עיין ב סטודיו SageMaker של אמזון.

ב- SageMaker Studio, תוכל לגשת ל- SageMaker JumpStart על ידי בחירה קפיצת פתיחה בחלונית הניווט.

Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. חיפוש אנכי. איי.

מדף הנחיתה של SageMaker JumpStart, אתה יכול לחפש "Mixtral" בתיבת החיפוש. תראה תוצאות חיפוש המציגות Mixtral 8x7B ו- Mixtral 8x7B Instruct.

Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. חיפוש אנכי. איי.

אתה יכול לבחור את כרטיס הדגם כדי להציג פרטים על הדגם כגון רישיון, נתונים המשמשים לאימון ואופן השימוש. תמצא גם את לפרוס לחצן, שבו אתה יכול להשתמש כדי לפרוס את המודל וליצור נקודת קצה.

Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. חיפוש אנכי. איי.

פרוס מודל

הפריסה מתחילה כשאתה בוחר לפרוס. לאחר סיום הפריסה, נוצרה לך נקודת קצה. אתה יכול לבדוק את נקודת הקצה על ידי העברת מטען של בקשת מסקנות לדוגמה או בחירת אפשרות הבדיקה שלך באמצעות SDK. כאשר תבחר באפשרות להשתמש ב-SDK, תראה קוד לדוגמה שתוכל להשתמש בו בעורך המחברת המועדף עליך ב-SageMaker Studio.

כדי לפרוס באמצעות SDK, אנו מתחילים בבחירת דגם Mixtral-8x7B, שצוין על ידי model_id with value huggingface-llm-mixtral-8x7b. אתה יכול לפרוס כל אחד מהדגמים שנבחרו ב- SageMaker עם הקוד הבא. באופן דומה, אתה יכול לפרוס הוראת Mixtral-8x7B באמצעות מזהה דגם משלה:

from sagemaker.jumpstart.model import JumpStartModel model = JumpStartModel(model_id="huggingface-llm-mixtral-8x7b")
predictor = model.deploy()

זה פורס את המודל ב- SageMaker עם תצורות ברירת מחדל, כולל סוג המופע המוגדר כברירת מחדל ותצורות ברירת המחדל של VPC. אתה יכול לשנות תצורות אלה על ידי ציון ערכים שאינם ברירת מחדל ב JumpStartModel.

לאחר הפריסה, אתה יכול להפעיל מסקנות נגד נקודת הקצה שנפרסה באמצעות מנבא SageMaker:

payload = {"inputs": "Hello!"} predictor.predict(payload)

הנחיות לדוגמה

אתה יכול לקיים אינטראקציה עם מודל Mixtral-8x7B כמו כל מודל יצירת טקסט סטנדרטי, שבו המודל מעבד רצף קלט ומוציא את המילים הבאות החזויות ברצף. בחלק זה, אנו מספקים הנחיות לדוגמה.

יצירת קוד

באמצעות הדוגמה הקודמת, אנו יכולים להשתמש בהנחיות ליצירת קוד כמו הבאות:

# Code generation
payload = { "inputs": "Write a program to compute factorial in python:", "parameters": { "max_new_tokens": 200, },
}
predictor.predict(payload)

אתה מקבל את הפלט הבא:

Input Text: Write a program to compute factorial in python:
Generated Text:
Factorial of a number is the product of all the integers from 1 to that number. For example, factorial of 5 is 1*2*3*4*5 = 120. Factorial of 0 is 1. Factorial of a negative number is not defined. The factorial of a number can be written as n!. For example, 5! = 120. ## Write a program to compute factorial in python ```
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1) print(factorial(5))
``` Output: ```
120
``` ## Explanation: In the above program, we have defined a function called factorial which takes a single argument n. If n is equal to 0, then we return 1. Otherwise, we return n multiplied by the factorial of n-1. We then call the factorial function with the argument 5 and print the result. The output of the program is 120, which is the factorial of 5. ## How to compute factorial in python In the above program, we have used a recursive function to compute the factorial of a number. A recursive function is a function that calls itself. In this case, the factorial function calls itself with the argument n-1. This process continues until n is equal to 0, at which point the function returns 1. The factorial of a number can also be computed using a loop. For example, the following program uses a for loop to compute the factorial of a number: ```
def factorial(n):
result = 1
for i in range(1, n+1):
result *= i
return result

הנחיה לניתוח סנטימנטים

אתה יכול לבצע ניתוח סנטימנט באמצעות הנחיה כמו הבאה עם Mixtral 8x7B:

payload = { "inputs": """
Tweet: "I hate it when my phone battery dies."
Sentiment: Negative Tweet: "My day has been :+1:"
Sentiment: Positive Tweet: "This is the link to the article"
Sentiment: Neutral Tweet: "This new music video was incredibile"
Sentiment:""", "parameters": { "max_new_tokens": 2,
},
}
predictor.predict(payload)

אתה מקבל את הפלט הבא:

Input Text: Tweet: "I hate it when my phone battery dies."
Sentiment: Negative
###
Tweet: "My day has been :+1:"
Sentiment: Positive
###
Tweet: "This is the link to the article"
Sentiment: Neutral
###
Tweet: "This new music video was incredibile"
Sentiment:
Generated Text:  Positive

הנחיות לתשובות לשאלות

אתה יכול להשתמש בבקשת תשובה לשאלה כמו הבאה עם Mixtral-8x7B:

# Question answering
payload = { "inputs": "Could you remind me when was the C programming language invented?", "parameters": { "max_new_tokens": 100, },
}
query_endpoint(payload)

אתה מקבל את הפלט הבא:

Input Text: Could you remind me when was the C programming language invented?
Generated Text: C was invented in 1972 by Dennis Ritchie at Bell Labs. C is a general-purpose programming language. It was invented to write the UNIX operating system. C is a structured programming language. It is a middle-level language. It is a procedural language. C is a compiled language. It is a portable language. C is a case-sensitive language. It is a free-form language

Mixtral-8x7B הדרכה

הגרסה המכווננת להוראות של Mixtral-8x7B מקבלת הוראות מעוצבות שבהן תפקידי השיחה חייבים להתחיל בהנחיית משתמש ולחלופין בין הוראת משתמש לעוזרת (דגם התשובה). יש לכבד את פורמט ההוראות, אחרת המודל יפיק פלטים לא אופטימליים. התבנית המשמשת לבניית הנחיה עבור מודל Instruct מוגדרת באופן הבא:

<s> [INST] Instruction [/INST] Model answer</s> [INST] Follow-up instruction [/INST]]

שים לב כי <s> ו </s> הם אסימונים מיוחדים לתחילת המיתר (BOS) ולסוף המיתר (EOS), ואילו [INST] ו [/INST] הם מיתרים רגילים.

הקוד הבא מראה כיצד ניתן לעצב את הבקשה בפורמט הוראות:

from typing import Dict, List def format_instructions(instructions: List[Dict[str, str]]) -> List[str]: """Format instructions where conversation roles must alternate user/assistant/user/assistant/...""" prompt: List[str] = [] for user, answer in zip(instructions[::2], instructions[1::2]): prompt.extend(["<s>", "[INST] ", (user["content"]).strip(), " [/INST] ", (answer["content"]).strip(), "</s>"]) prompt.extend(["<s>", "[INST] ", (instructions[-1]["content"]).strip(), " [/INST] ","</s>"]) return "".join(prompt) def print_instructions(prompt: str, response: str) -> None: bold, unbold = '33[1m', '33[0m' print(f"{bold}> Input{unbold}n{prompt}nn{bold}> Output{unbold}n{response[0]['generated_text']}n")

אחזור ידע

אתה יכול להשתמש בקוד הבא לבקשת אחזור ידע:

instructions = [{"role": "user", "content": "what is the recipe of mayonnaise?"}]
prompt = format_instructions(instructions)
payload = { "inputs": prompt, "parameters": {"max_new_tokens": 315, "do_sample": True}
}
response=predictor.predict(payload)
print_instructions(prompt, response)

אתה מקבל את הפלט הבא:

> Input
<s>[INST] what is the recipe of mayonnaise? [/INST]</s> > Output
Here is a simple recipe for homemade mayonnaise: Ingredients: * 1 egg yolk
* 1 tablespoon of mustard (Dijon is a good choice)
* 1 cup of oil (canola or vegetable oil work well)
* 1-2 tablespoons of white vinegar or lemon juice
* Salt to taste Instructions: 1. In a medium bowl, whisk together the egg yolk and mustard. It is important that these ingredients are at room temperature.
2. Start adding the oil drop by drop, whisking continuously. This step is crucial to ensure that the mayonnaise emulsifies and does not separate.
3. Once you have added about a quarter of the oil and the mixture has thickened, you can start adding the oil in a thin stream, still whisking constantly.
4. When all the oil has been incorporated and the mayonnaise is thick, whisk in the vinegar or lemon juice and salt to taste.
5. If the mayonnaise is too thick, you can thin it with a little water.
6. Store the mayonnaise in the refrigerator and use within a few days. Note: It is important to use pasteurized eggs or egg yolks when making homemade mayonnaise to reduce the risk of foodborne illness.

סִמוּל

מודלים של Mixtral יכולים להדגים נקודות חוזק בביצוע משימות קידוד, כפי שמוצג בקוד הבא:

instructions = [
{ "role": "user", "content": "In Bash, how do I list all text files in the current directory (excluding subdirectories) that have been modified in the last month?",
}
]
prompt = format_instructions(instructions)
payload = { "inputs": prompt, "parameters": {"max_new_tokens": 256, "do_sample": True, "temperature": 0.2}
}
response=predictor.predict(payload)
print_instructions(prompt, response)

אתה מקבל את הפלט הבא:

> Input
<s>[INST] In Bash, how do I list all text files in the current directory (excluding subdirectories) that have been modified in the last month? [/INST]</s>
> Output
ef{0.15cm} To list all text files in the current directory that have been modified in the last month, you can use a combination of the `find` and `grep` commands in Bash. Here's the command you're looking for: ```bash
find . -maxdepth 1 -type f -name "*.txt" -mtime -30
``` Let's break down this command: - `find .` starts a search in the current directory.
- `-maxdepth 1` limits the search to the current directory only (excluding subdirectories).
- `-type f` specifies that you're looking for files.
- `-name "*.txt"` filters the results to only include files with a `.txt` extension.
- `-mtime -30` filters the results to only include files modified within the last 30 days. This command will output the paths of all text files in the current directory that have been modified in the last month.

מתמטיקה והיגיון

מודלים של Mixtral מדווחים גם על חוזקות ברמת הדיוק במתמטיקה:

instructions = [
{ "role": "user", "content": "I bought an ice cream for 6 kids. Each cone was $1.25 and I paid with a $10 bill. How many dollars did I get back? Explain first before answering.",
}
]
prompt = format_instructions(instructions)
payload = { "inputs": prompt, "parameters": {"max_new_tokens": 600, "do_sample": True, "temperature": 0.2}
}
response=predictor.predict(payload)
print_instructions(prompt, response)

מודלים של Mixtral יכולים לספק הבנה כפי שמוצג בפלט הבא עם ההיגיון המתמטי:

> Input
<s>[INST] I bought an ice cream for 6 kids. Each cone was $1.25 and I paid with a $10 bill. How many dollars did I get back? Explain first before answering. [/INST] </s>
> Output
First, let's calculate the total cost of the ice cream cones. Since each cone costs $1.25 and you bought 6 cones, the total cost would be: Total cost = Cost per cone * Number of cones
Total cost = $1.25 * 6
Total cost = $7.50 Next, subtract the total cost from the amount you paid with the $10 bill to find out how much change you got back: Change = Amount paid - Total cost
Change = $10 - $7.50
Change = $2.50 So, you got $2.50 back.

לנקות את

לאחר שתסיים להפעיל את המחברת, מחק את כל המשאבים שיצרת בתהליך כדי שהחיוב שלך יופסק. השתמש בקוד הבא:

predictor.delete_model()
predictor.delete_endpoint()

סיכום

בפוסט הזה, הראינו לכם איך להתחיל עם Mixtral-8x7B ב-SageMaker Studio ולפרוס את המודל להסקת מסקנות. מכיוון שדגמי היסודות הוכשרו מראש, הם יכולים לסייע בהורדת עלויות ההדרכה והתשתית ולאפשר התאמה אישית למקרה השימוש שלך. בקר עכשיו ב- SageMaker JumpStart ב- SageMaker Studio כדי להתחיל.

משאבים


על המחברים

Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. חיפוש אנכי. איי.רחנה צ'דהא הוא ארכיטקט פתרונות ראשי AI/ML בחשבונות אסטרטגיים ב-AWS. רחנה היא אופטימית המאמינה ששימוש אתי ואחראי בבינה מלאכותית יכול לשפר את החברה בעתיד ולהביא לשגשוג כלכלי וחברתי. בזמנה הפנוי, רחנה אוהבת לבלות עם משפחתה, לטייל ולהאזין למוזיקה.

Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. חיפוש אנכי. איי.ד"ר קייל אולריך הוא מדען יישומי עם אלגוריתמים מובנים של Amazon SageMaker קְבוּצָה. תחומי המחקר שלו כוללים אלגוריתמים של למידת מכונה ניתנים להרחבה, ראייה ממוחשבת, סדרות זמן, אי-פרמטריות בייסיאניות ותהליכי גאוס. הדוקטורט שלו הוא מאוניברסיטת דיוק והוא פרסם מאמרים ב-NeurIPS, Cell, and Neuron.

Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. חיפוש אנכי. איי.כריסטופר וויטן הוא מפתח תוכנה בצוות JumpStart. הוא עוזר להגדיל את בחירת הדגמים ולשלב דגמים עם שירותי SageMaker אחרים. כריס נלהב להאיץ את הנפוצה של AI במגוון תחומים עסקיים.

Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. חיפוש אנכי. איי.ד"ר פאביו נונאטו דה פאולה הוא מנהל בכיר, Specialist GenAI SA, שעוזר לספקי דגמים וללקוחות להרחיב את הבינה המלאכותית הגנרטיבית ב-AWS. לפאביו יש תשוקה לדמוקרטיזציה של גישה לטכנולוגיית AI גנרטיבית. מחוץ לעבודה, אתה יכול למצוא את פאביו רוכב על האופנוע שלו בגבעות של עמק סונומה או קורא ComiXology.

Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. חיפוש אנכי. איי.ד"ר אשיש חתן הוא מדען יישומי בכיר עם אלגוריתמים מובנים של Amazon SageMaker ועוזר בפיתוח אלגוריתמים של למידת מכונה. הוא קיבל את הדוקטורט שלו מאוניברסיטת אילינוי אורבנה-שמפיין. הוא חוקר פעיל בלמידת מכונה והסקה סטטיסטית, ופרסם מאמרים רבים בכנסים NeurIPS, ICML, ICLR, JMLR, ACL ו-EMNLP.

Mixtral-8x7B זמין כעת באמזון SageMaker JumpStart | Amazon Web Services PlatoBlockchain Data Intelligence. חיפוש אנכי. איי.קרל אלברטסן מוביל מוצר, הנדסה ומדע עבור אלגוריתמים של אמזון SageMaker ו-JumpStart, מרכז למידת המכונה של SageMaker. הוא נלהב ליישם למידת מכונה כדי לפתוח ערך עסקי.

בול זמן:

עוד מ למידת מכונות AWS