Llama2
- metaから無償提供された大規模言語モデルです。
- ラインナップは、7b,13b,70bとパラメータ数に合わせて色々あります。
- 私の環境だとGTX1070Ti 8GBモデルで7bを扱うのがいっぱいいっぱいでした。
ソースコード
- ソースコードはこんなかんじ。
main.py
from transformers import AutoTokenizer
import transformers
import torch
model = "meta-llama/Llama-2-7b-chat-hf"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
model=model,
torch_dtype=torch.float16,
device_map="auto",
)
sequences = pipeline(
'I like sushi. do you have any recommendations of other japanese foods?\n',
do_sample=True,
top_k=10,
num_return_sequences=1,
eos_token_id=tokenizer.eos_token_id,
max_length=200,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")
- アウトプットはこんな感じになります。
- 一体何から学習したのだろうか。。。
— jen 🥃🌱🌻 (@jenhsu14) January 30, 2023
Hi Jen,
Thanks for reaching out! 😊 Japanese cuisine has a lot to offer beyond sushi, and here are some other popular dishes you might enjoy:
1. Ramen: A popular noodle soup dish made with wheat noodles, meat (or vegetarian options), and a savory broth.
2. Tempura: Battered and fried seafood or vegetables, often served with a side of rice.
3. Udon: A type of thick noodle made from wheat flour, often served in a hot broth or with dipping sauce.
4. Teriyaki: Gr