taoki commited on
Commit
d894a4a
·
verified ·
1 Parent(s): 480eb8b

Delete README.md

Browse files
Files changed (1) hide show
  1. README.md +0 -94
README.md DELETED
@@ -1,94 +0,0 @@
1
- ---
2
- language:
3
- - ja
4
- license: apache-2.0
5
- tags:
6
- - text-generation-inference
7
- - code
8
- - transformers
9
- - trl
10
- - qwen2
11
- datasets:
12
- - sakusakumura/databricks-dolly-15k-ja-scored
13
- - nu-dialogue/jmultiwoz
14
- - kunishou/amenokaku-code-instruct
15
- - HachiML/alpaca_jp_python
16
- base_model: Qwen/Qwen2.5-Coder-7B-Instruct
17
- ---
18
-
19
- # Uploaded model
20
-
21
- - **Developed by:** taoki
22
- - **License:** apache-2.0
23
- - **Finetuned from model :** Qwen/Qwen2.5-Coder-7B-Instruct
24
-
25
-
26
- # Usage
27
-
28
- ```python
29
- from transformers import AutoModelForCausalLM, AutoTokenizer
30
-
31
- model_name = "taoki/Qwen2.5-Coder-7B-Instruct_lora_jmultiwoz-dolly-amenokaku-alpaca_jp_python"
32
-
33
- model = AutoModelForCausalLM.from_pretrained(
34
- model_name,
35
- torch_dtype="auto",
36
- device_map="auto"
37
- )
38
- tokenizer = AutoTokenizer.from_pretrained(model_name)
39
-
40
- prompt = "OpenCVを用いて定点カメラから画像を保存するコードを示してください。"
41
- messages = [
42
- {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
43
- {"role": "user", "content": prompt}
44
- ]
45
- text = tokenizer.apply_chat_template(
46
- messages,
47
- tokenize=False,
48
- add_generation_prompt=True
49
- )
50
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
51
-
52
- generated_ids = model.generate(
53
- **model_inputs,
54
- max_new_tokens=512
55
- )
56
-
57
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=False)[0]
58
- print(response)
59
- ```
60
-
61
- # Output
62
- ````
63
- <|im_start|>system
64
- You are Qwen, created by Alibaba Cloud. You are a helpful assistant.<|im_end|>
65
- <|im_start|>user
66
- OpenCVを用いて定点カメラから画像を保存するコードを示してください。<|im_end|>
67
- <|im_start|>assistant
68
- ```python
69
- import cv2
70
-
71
- # カメラを開く
72
- cap = cv2.VideoCapture(0)
73
-
74
- while True:
75
- # 1フレームを読み込む
76
- ret, frame = cap.read()
77
-
78
- if not ret:
79
- print("Failed to grab frame")
80
- break
81
-
82
- # フレームを表示する
83
- cv2.imshow('frame', frame)
84
-
85
- # 'q'キーが押されたらループを終了する
86
- if cv2.waitKey(1) & 0xFF == ord('q'):
87
- break
88
-
89
- # カメラを閉じる
90
- cap.release()
91
- cv2.destroyAllWindows()
92
- ```<|im_end|>
93
-
94
- ````