File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed
Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 22
33
44
5- ## run
5+
6+
7+ ## run it
68
79python >= 3.9
810
911``` pip3 install -r requirements.txt ```
1012
13+
1114``` bash
1215python3 gptchat.py
13-
1416```
1517
16- then open url: http://localhost:8888
18+ open http://localhost:8888
1719
1820
Original file line number Diff line number Diff line change 1+ # pip install accelerate
2+ from transformers import AutoTokenizer , AutoModelForCausalLM
3+
4+ tokenizer = AutoTokenizer .from_pretrained ("google/gemma-7b-it" )
5+ model = AutoModelForCausalLM .from_pretrained ("google/gemma-7b-it" , device_map = "auto" )
6+
7+ input_text = "Write me a poem about Machine Learning."
8+ input_ids = tokenizer (input_text , return_tensors = "pt" ).to ("cuda" )
9+
10+ outputs = model .generate (** input_ids )
11+ print (tokenizer .decode (outputs [0 ]))
Original file line number Diff line number Diff line change 1+ accelerate
2+ transformers
You can’t perform that action at this time.
0 commit comments