File size: 1,495 Bytes
e386da4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
license: apache-2.0
base_model: Qwen/Qwen3-4B
tags:
- merged
- lora
- chinese
- novel
- text-generation
library_name: transformers
pipeline_tag: text-generation
---

# Qwen Novel Generation Model (LoRA Merged)

这是一个基于 Qwen/Qwen3-4B 和自定义LoRA适配器合并的模型,专门用于中文小说生成。

## 模型详情

- **基础模型**: Qwen/Qwen3-4B
- **用途**: 中文文本生成
- **语言**: 中文

## 使用方法

```python
from transformers import AutoModelForCausalLM, AutoTokenizer

# 加载模型和tokenizer
model = AutoModelForCausalLM.from_pretrained("your-username/model-name")
tokenizer = AutoTokenizer.from_pretrained("your-username/model-name")

# 生成文本
def generate_story(prompt, max_length=500):
    inputs = tokenizer(prompt, return_tensors="pt")
    outputs = model.generate(
        **inputs,
        max_length=max_length,
        temperature=0.7,
        do_sample=True,
        top_p=0.9,
        repetition_penalty=1.1
    )
    return tokenizer.decode(outputs[0], skip_special_tokens=True)

# 示例
story = generate_story("请写一个关于友情的故事:")
print(story)
```

## 生成示例

**输入**: "请写一个关于友情的故事:"

**输出**: [模型会生成相应的故事内容]

## 注意事项

- 这是一个合并后的完整模型,包含了LoRA的所有改进
- 适合用于中文创作场景
- 建议使用适当的生成参数以获得最佳效果

## 许可证

本模型遵循Apache 2.0许可证。