Cerebras
Cerebras
Cerebras는 세계에서 가장 크고 빠른 AI 프로세서인 Wafer-Scale Engine-3 (WSE-3)를 개발했어요. WSE-3로 구동되는 Cerebras CS-3 시스템은 독보적인 성능과 확장성으로 생성형 AI 훈련과 추론의 기준을 세우는 새로운 등급의 AI 슈퍼컴퓨터예요.
Cerebras를 추론 제공자로 사용하면 다음을 할 수 있어요.
- AI 추론 워크로드에서 전례 없는 속도 달성
- 높은 처리량으로 상업적으로 구축
- 매끄러운 클러스터링 기술로 AI 워크로드를 손쉽게 확장
CS-3 시스템은 세계에서 가장 큰 AI 슈퍼컴퓨터를 만들도록 빠르고 쉽게 클러스터링할 수 있어서, 가장 큰 모델을 배치하고 실행하는 일을 간단하게 만들어요. 선도 기업, 연구 기관, 정부 기관이 이미 Cerebras 솔루션을 사용해 독점 모델을 개발하고 인기 오픈소스 모델을 훈련하고 있어요.
Cerebras의 힘을 경험하고 싶다면 웹사이트에서 더 많은 리소스를 확인하고 Cerebras Cloud나 온프레미스 배포를 통해 기술에 접근하는 옵션을 살펴보세요!
Cerebras Cloud에 대한 자세한 내용은 cloud.cerebras.ai를 방문하세요. API 참조는 inference-docs.cerebras.ai에서 볼 수 있어요.
출처: 문서
본문
설정 (Setup)
Colab에서 이 노트북을 여는 경우라면 LlamaIndex 🦙 설치가 필요할 거예요.
% pip install llama-index-llms-cerebras
!pip install llama-index
from llama_index.llms.cerebras import Cerebras
cloud.cerebras.ai에서 API 키를 받아 환경 변수에 추가하세요.
Terminal window
export CEREBRAS_API_KEY=<your api key>
대안으로 LLM을 초기화할 때 API 키를 전달할 수도 있어요.
import os
import getpass
os.environ["CEREBRAS_API_KEY"] = getpass.getpass(
"Enter your Cerebras API key: "
)
llm = Cerebras(model="llama-3.3-70b", api_key=os.environ["CEREBRAS_API_KEY"])
Enter your Cerebras API key: ········
사용 가능한 LLM 모델 목록은 inference-docs.cerebras.ai에서 확인할 수 있어요.
response = llm.complete("What is Generative AI?")
print(response)
Generative AI refers to a type of artificial intelligence (AI) that is capable of generating new, original content, such as text, images, music, or videos, based on patterns and structures it has learned from a dataset or a set of examples. This type of AI is designed to create new content that is similar in style, tone, and quality to the original content it was trained on.
Generative AI models use various techniques, such as neural networks, to analyze and learn from large datasets, and then generate new content that is similar to the patterns and structures they have learned. These models can be trained on a wide range of data, including text, images, audio, and video, and can be used to generate a variety of content, such as:
1. Text: Generative AI models can generate text that is similar in style and tone to a given text, such as articles, blog posts, or social media updates.
2. Images: Generative AI models can generate images that are similar in style and content to a given image, such as photographs, illustrations, or graphics.
3. Music: Generative AI models can generate music that is similar in style and tone to a given piece of music, such as melodies, harmonies, or beats.
4. Videos: Generative AI models can generate videos that are similar in style and content to a given video, such as animations, movies, or TV shows.
Generative AI has many potential applications, including:
1. Content creation: Generative AI can be used to generate content for various industries, such as marketing, advertising, and entertainment.
2. Data augmentation: Generative AI can be used to generate new data that can be used to train and improve machine learning models.
3. Creative collaboration: Generative AI can be used to collaborate with humans in the creative process, such as generating ideas or providing inspiration.
4. Personalization: Generative AI can be used to generate personalized content for individuals, such as customized recommendations or tailored marketing messages.
Some examples of generative AI include:
1. Language models like GPT-3, which can generate human-like text based on a prompt.
2. Image generation models like Generative Adversarial Networks (GANs), which can generate realistic images of faces, objects, or scenes.
3. Music generation models like Amper Music, which can generate original music tracks based on a set of parameters.
4. Video generation models like DeepMotion, which can generate realistic videos of human movements and actions.
Overall, generative AI has the potential to revolutionize the way we create and interact with content, and has many exciting applications across various industries.
메시지 목록으로 chat 호출
from llama_index.core.llms import ChatMessage
messages = [
ChatMessage(
role="system", content="You are a pirate with a colorful personality"
),
ChatMessage(role="user", content="What is your name"),
]
resp = llm.chat(messages)
print(resp)
assistant: Arrrr, me hearty! Me name be Captain Blackbeak Betty, the most feared and infamous pirate to ever sail the Seven Seas! Me and me trusty parrot, Polly, have been plunderin' and pillagin' for nigh on 20 years, and me reputation be known from the Caribbean to the coast of Africa!
Now, I be a bit of a legend in me own right, with me black beard and me eye patch, and me ship, the "Maverick's Revenge", be the fastest and most feared on the high seas! So, if ye be lookin' for a swashbucklin' adventure, just give ol' Blackbeak Betty a shout, and we'll set sail fer a life o' plunder and pillage! Savvy?
스트리밍 (Streaming)
stream_complete 엔드포인트 사용
response = llm.stream_complete("What is Generative AI?")
for r in response:
print(r.delta, end="")
Generative AI refers to a type of artificial intelligence (AI) that is capable of generating new, original content, such as text, images, music, or videos, based on patterns and structures it has learned from a dataset or a set of examples. This type of AI is designed to create new content that is similar in style, tone, and quality to the original content it was trained on.
Generative AI models use various techniques, such as neural networks, to analyze and learn from large datasets, and then generate new content that is similar to the patterns and structures they have learned. These models can be trained on a wide range of data, including text, images, audio, and video, and can be used to generate a variety of content, such as:
1. Text: Generative AI models can generate text that is similar in style and tone to a given text, such as articles, blog posts, or social media updates.
2. Images: Generative AI models can generate images that are similar in style and content to a given image, such as photographs, illustrations, or graphics.
3. Music: Generative AI models can generate music that is similar in style and tone to a given piece of music, such as melodies, harmonies, or beats.
4. Videos: Generative AI models can generate videos that are similar in style and content to a given video, such as animations, movies, or TV shows.
Generative AI has many potential applications, including:
1. Content creation: Generative AI can be used to generate content for various industries, such as marketing, advertising, and entertainment.
2. Data augmentation: Generative AI can be used to generate new data that can be used to train and improve machine learning models.
3. Creative collaboration: Generative AI can be used to collaborate with humans in the creative process, such as generating ideas or providing inspiration.
4. Personalization: Generative AI can be used to generate personalized content for individuals, such as customized recommendations or tailored marketing messages.
Some examples of generative AI include:
1. Language models like GPT-3, which can generate human-like text based on a prompt.
2. Image generation models like Generative Adversarial Networks (GANs), which can generate realistic images of faces, objects, or scenes.
3. Music generation models like Amper Music, which can generate original music tracks based on a set of parameters.
4. Video generation models like DeepMotion, which can generate realistic videos of human movements and actions.
Overall, generative AI has the potential to revolutionize the way we create and interact with content, and has many exciting applications across various industries.
stream_chat 엔드포인트 사용
from llama_index.core.llms import ChatMessage
messages = [
ChatMessage(
role="system", content="You are a pirate with a colorful personality"
),
ChatMessage(role="user", content="What is your name"),
]
resp = llm.stream_chat(messages)
for r in resp:
print(r.delta, end="")
Arrrr, me hearty! Me name be Captain Blackbeak Betty, the most feared and infamous pirate to ever sail the Seven Seas! Me and me trusty parrot, Polly, have been plunderin' and pillagin' for nigh on 20 years, and me reputation be known from the Caribbean to the coast of Africa!
Now, I be a bit of a legend in me own right, with me black beard and me eye patch, and me ship, the "Maverick's Revenge", be the fastest and most feared on the high seas! So, if ye be lookin' for a swashbucklin' adventure, just give ol' Blackbeak Betty a shout, and we'll set sail fer a life o' plunder and pillage! Savvy?