01。
概述
02。
训练效率与性能
fromtransformersimportAutoTokenizer,AutoModelForCausalLM
importtorch
model_id="cerebras/Llama3-DocChat-1.0-8B"
tokenizer=AutoTokenizer.from_pretrained(model_id)
model=AutoModelForCausalLM.from_pretrained(model_id,torch_dtype=torch.float16,device_map="auto")
system="Thisisachatbetweenauserandanartificialintelligenceassistant.Theassistantgiveshelpful,detailed,andpoliteanswerstotheuser'squestionsbasedonthecontext.Theassistantshouldalsoindicatewhentheanswercannotbefoundinthecontext."
instruction="
leasegiveafullandcompleteanswerforthequestion."
document="""
#CerebrasWafer-ScaleCluster
Exa-scaleperformance,singledevicesimplicity
##AISupercomputers
CondorGalaxy(CG),thesupercomputerbuiltbyG42andCerebras,isthesimplestandfastestwaytobuildAImodelsinthecloud.Withover16ExaFLOPsofAIcompute,CondorGalaxytrainsthemostdemandingmodelsinhoursratherthandays.TheterabytescaleMemoryXsystemnativelyaccommodates100billion+parametermodels,makinglargescaletrainingsimpleandefficient.
|Cluster|ExaFLOPs|Systems|Memory|
|--------|--------|--------|------|
|CG1|4|64CS-2s|82TB|
|CG2|4|64CS-2s|82TB|
|CG3|8|64CS-3s|108TB|
"""
question="HowmanytotalCSsystemsdoesCondorGalaxy1,2,and3havecombined,andhowmanyflopsdoesthiscorrespondto?"
user_turn=f"""<context>
{document}
</context>
{instruction}{question}"""
messages=[
{"role":"system","content":system},
{"role":"user","content":user_turn}
]
input_ids=tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
terminators=[
tokenizer.eos_token_id,
tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs=model.generate(
input_ids,
max_new_tokens=256,
eos_token_id=terminators,
)
response=outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response,skip_special_tokens=True))
03。
开源承诺
04。
基准比较
05。
面临的挑战与未来展望
| 欢迎光临 链载Ai (https://www.lianzai.com/) | Powered by Discuz! X3.5 |