Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitac8d308

Browse files
committed
add 02
1 parent58498fb commitac8d308

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

‎01.GPTChat/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33

44

5-
##run
5+
6+
7+
##run it
68

79
python >= 3.9
810

911
```pip3 install -r requirements.txt```
1012

13+
1114
```bash
1215
python3 gptchat.py
13-
1416
```
1517

16-
thenopenurl:http://localhost:8888
18+
openhttp://localhost:8888
1719

1820

‎02.ChatWithGemma7b /README.md

Whitespace-only changes.

‎02.ChatWithGemma7b /gemmachat.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# pip install accelerate
2+
fromtransformersimportAutoTokenizer,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]))

‎02.ChatWithGemma7b /requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
accelerate
2+
transformers

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp