Aleph Alpha
Aleph Alpha
Aleph Alpha는 사람과 같은 텍스트를 생성할 수 있는 강력한 언어 모델이에요. 여러 언어와 스타일로 텍스트를 생성할 수 있고, 특정 도메인의 텍스트를 생성하도록 미세조정할 수 있어요.
Colab에서 이 노트북을 여는 경우라면 LlamaIndex 🦙 설치가 필요할 거예요.
%pip install llama-index-llms-alephalpha
!pip install llama-index
출처: 문서
본문
Aleph Alpha 토큰 설정
import os
os.environ["AA_TOKEN"] = "your_token_here"
프롬프트로 complete 호출
from llama_index.llms.alephalpha import AlephAlpha
# To customize your token, do this
# otherwise it will lookup AA_TOKEN from your env variable
# llm = AlephAlpha(token="<aa_token>")
llm = AlephAlpha(model="luminous-base-control")
resp = llm.complete("Paul Graham is ")
print(resp)
a well-known computer scientist and entrepreneur. He is the co-founder of PayPal and a co-founder of the Y Combinator startup accelerator. He has also co-authored the book "Programming the Web". Paul Graham is also a frequent speaker and writer on topics related to computer science, entrepreneurship, and startups. He has written several blog posts on the topic of "Why Startups Fail". In this post, I will summarize some of the key points from Paul Graham's blog post on why startups fail.
1. Lack of a clear vision: Startups often lack a clear vision of what they
추가 응답 정보 (Additional Response Details)
로그 확률 같은 상세 응답 정보에 접근하려면 AlephAlpha 인스턴스를 log_probs 파라미터와 함께 초기화해야 해요. 이 데이터는 CompletionResponse의 logprobs 속성에 들어 있어요. 모델 버전이나 원시 완료 텍스트 같은 다른 정보는 응답의 일부이거나 additional_kwargs를 통해 접근할 수 있어요.
from llama_index.llms.alephalpha import AlephAlpha
llm = AlephAlpha(model="luminous-base-control", log_probs=0)
resp = llm.complete("Paul Graham is ")
if resp.logprobs is not None:
print("\nLog Probabilities:")
for lp_list in resp.logprobs:
for lp in lp_list:
print(f"Token: {lp.token}, LogProb: {lp.logprob}")
if "model_version" in resp.additional_kwargs:
print("\nModel Version:")
print(resp.additional_kwargs["model_version"])
if "raw_completion" in resp.additional_kwargs:
print("\nRaw Completion:")
print(resp.additional_kwargs["raw_completion"])
Log Probabilities:
Token: a, LogProb: -0.95955
Token: well, LogProb: -1.9219251
Token: -, LogProb: -0.1312752
Token: known, LogProb: -0.022855662
Token: computer, LogProb: -0.9569155
Token: scientist, LogProb: -0.06721641
Token: and, LogProb: -0.56296504
Token: entrepreneur, LogProb: -0.65574974
Token: ., LogProb: -0.5926046
Token: He, LogProb: -0.1885516
Token: is, LogProb: -0.3927348
Token: the, LogProb: -0.46820825
Token: co, LogProb: -0.465878
Token: -, LogProb: -0.024082167
Token: founder, LogProb: -0.009869587
Token: of, LogProb: -0.31641242
Token: PayPal, LogProb: -1.0825713
Token: and, LogProb: -0.39408743
Token: a, LogProb: -1.45493
Token: co, LogProb: -1.0837904
Token: -, LogProb: -0.0011430404
Token: founder, LogProb: -0.074010715
Token: of, LogProb: -0.038962167
Token: the, LogProb: -1.7761776
Token: Y, LogProb: -0.41853565
Token: Combin, LogProb: -0.17868777
Token: ator, LogProb: -2.0265374e-05
Token: startup, LogProb: -0.24595682
Token: acceler, LogProb: -0.5855012
Token: ator, LogProb: -6.675698e-06
Token: ., LogProb: -0.022597663
Token: He, LogProb: -0.8310143
Token: has, LogProb: -1.5842702
Token: also, LogProb: -0.5774656
Token: been, LogProb: -1.3938092
Token: a, LogProb: -0.67207164
Token: professor, LogProb: -1.0511048
Token: at, LogProb: -0.13273911
Token: the, LogProb: -0.7993539
Token: MIT, LogProb: -1.2281163
Token: Media, LogProb: -0.7707413
Token: Lab, LogProb: -0.06716257
Token: ., LogProb: -0.9140582
Token: Paul, LogProb: -0.8244309
Token: Graham, LogProb: -0.15202633
Token: has, LogProb: -1.3735206
Token: written, LogProb: -0.77148163
Token: several, LogProb: -0.7167357
Token: books, LogProb: -0.24542983
Token: on, LogProb: -0.77700675
Token: computer, LogProb: -0.8485363
Token: science, LogProb: -0.026196867
Token: and, LogProb: -0.4796574
Token: entrepreneurs, LogProb: -0.48952234
Token: hip, LogProb: -1.0847986e-05
Token: ,, LogProb: -0.1426171
Token: including, LogProb: -0.10799221
Token: ", LogProb: -0.4733107
Token: Program, LogProb: -0.9295699
Token: ming, LogProb: -0.00090034
Token: the, LogProb: -1.5219054
Token: Universe, LogProb: -1.2475122
Token: ", LogProb: -0.8377396
Token: and, LogProb: -0.014596111
Token: ", LogProb: -0.0034322182
Token: The, LogProb: -0.97810173
Token: Art, LogProb: -1.4708842
Token: of, LogProb: -0.0017665509
Token: Computer, LogProb: -0.027323013
Token: Programming, LogProb: -0.09090222
Token: "., LogProb: -0.2312944
Token: He, LogProb: -0.9431941
Token: is, LogProb: -0.52350885
Token: also, LogProb: -0.8409716
Token: the, LogProb: -1.2813272
Token: founder, LogProb: -0.8080497
Token: of, LogProb: -0.12735468
Token: the, LogProb: -0.26858208
Token: startup, LogProb: -1.7183943
Token: incub, LogProb: -0.71643037
Token: ator, LogProb: -0.00013922676
Token: ,, LogProb: -1.6374074
Token: Y, LogProb: -1.3464186
Token: Combin, LogProb: -0.043204635
Token: ator, LogProb: -1.490105e-05
Token: ., LogProb: -0.48073012
Token: <|endoftext|>, LogProb: -0.30235213
Model Version:
20240215
Raw Completion:
a well-known computer scientist and entrepreneur. He is the co-founder of PayPal and a co-founder of the Y Combinator startup accelerator. He has also been a professor at the MIT Media Lab. Paul Graham has written several books on computer science and entrepreneurship, including "Programming the Universe" and "The Art of Computer Programming". He is also the founder of the startup incubator, Y Combinator.
비동기 (Async)
from llama_index.llms.alephalpha import AlephAlpha
llm = AlephAlpha(model="luminous-base-control")
resp = await llm.acomplete("Paul Graham is ")
print(resp)
a computer scientist and entrepreneur who is known for his work in the field of artificial intelligence and computer science. He is the co-founder of the company Y Combinator, which is a startup accelerator that helps startups get funding and resources. Paul Graham has also written several books on computer science and entrepreneurship, including "Programming: Principles and Practice" and "The Art of Computer Programming". He is a well-known figure in the computer science community and has made significant contributions to the field.