Spaces:
Runtime error
Runtime error
[update]edit main
Browse files
main.py
CHANGED
@@ -37,7 +37,7 @@ def get_args():
|
|
37 |
description = """
|
38 |
## Qwen-7B
|
39 |
|
40 |
-
基于 [Qwen-7B](https://huggingface.co/qgyd2021/Qwen-7B) 模型, 在 [chinese_modern_poetry](https://huggingface.co/datasets/Iess/chinese_modern_poetry)
|
41 |
|
42 |
可用于生成现代诗. 如下:
|
43 |
使用下列意象写一首现代诗:智慧,刀刃.
|
@@ -46,7 +46,10 @@ description = """
|
|
46 |
|
47 |
examples = [
|
48 |
"使用下列意象写一首现代诗:石头,森林",
|
49 |
-
"使用下列意象写一首现代诗:花,纱布"
|
|
|
|
|
|
|
50 |
|
51 |
]
|
52 |
|
@@ -100,6 +103,8 @@ def main():
|
|
100 |
return [(text, response)]
|
101 |
|
102 |
def fn_stream(text: str):
|
|
|
|
|
103 |
input_ids = tokenizer(
|
104 |
text,
|
105 |
return_tensors="pt",
|
@@ -127,7 +132,8 @@ def main():
|
|
127 |
|
128 |
output = ""
|
129 |
for output_ in streamer:
|
130 |
-
output_ = output_.
|
|
|
131 |
|
132 |
output += output_
|
133 |
|
|
|
37 |
description = """
|
38 |
## Qwen-7B
|
39 |
|
40 |
+
基于 [Qwen-7B](https://huggingface.co/qgyd2021/Qwen-7B) 模型, 在 [chinese_modern_poetry](https://huggingface.co/datasets/Iess/chinese_modern_poetry) 数据集上训练了 2 个 epoch.
|
41 |
|
42 |
可用于生成现代诗. 如下:
|
43 |
使用下列意象写一首现代诗:智慧,刀刃.
|
|
|
46 |
|
47 |
examples = [
|
48 |
"使用下列意象写一首现代诗:石头,森林",
|
49 |
+
"使用下列意象写一首现代诗:花,纱布",
|
50 |
+
"使用下列意象写一首现代诗:山壁,彩虹,诗句,山坡,泪",
|
51 |
+
"使用下列意象写一首现代诗:味道,黄金,名字,银子,女人",
|
52 |
+
"使用下列意象写一首现代诗:乳房,触感,车速,星星,路灯"
|
53 |
|
54 |
]
|
55 |
|
|
|
103 |
return [(text, response)]
|
104 |
|
105 |
def fn_stream(text: str):
|
106 |
+
text = str(text).strip()
|
107 |
+
|
108 |
input_ids = tokenizer(
|
109 |
text,
|
110 |
return_tensors="pt",
|
|
|
132 |
|
133 |
output = ""
|
134 |
for output_ in streamer:
|
135 |
+
output_ = output_.replace(text, "")
|
136 |
+
output_ = output_.replace(tokenizer.eos_token, "")
|
137 |
|
138 |
output += output_
|
139 |
|