vuminhtue commited on
Commit
e226697
ยท
verified ยท
1 Parent(s): 8308bc0

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +198 -0
README.md ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Qwen3 Text Generator
3
+ emoji: ๐Ÿค–
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: gradio
7
+ sdk_version: "4.0.0"
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+ # Qwen3 Text Generator
13
+
14
+ A text generation application using the Qwen3 0.6B model trained on TinyStories dataset.
15
+
16
+ โœจ **The model automatically downloads from HuggingFace** - no need to upload large files! Model repository: [vuminhtue/qwen3_sentiment_tinystories](https://huggingface.co/vuminhtue/qwen3_sentiment_tinystories)
17
+
18
+ ## ๐Ÿš€ Quick Start
19
+
20
+ ### Running Locally
21
+
22
+ 1. Make sure you have the required files:
23
+ - `app.py` - The Gradio interface (automatically downloads model)
24
+ - `Qwen3_model.py` - The model architecture
25
+ - `requirements.txt` - Python dependencies
26
+
27
+ 2. Install dependencies:
28
+ ```bash
29
+ pip install -r requirements.txt
30
+ ```
31
+
32
+ 3. Run the app:
33
+ ```bash
34
+ python app.py
35
+ ```
36
+
37
+ 4. The app will automatically download the model from HuggingFace (first run only)
38
+ 5. Open your browser to the URL shown (usually http://127.0.0.1:7860)
39
+
40
+ ## ๐Ÿ“ค Deploying to HuggingFace Spaces
41
+
42
+ ### Step 1: Prepare Your Files
43
+
44
+ You only need these **3 files** (total ~40KB):
45
+ - `app.py` - Main application (downloads model automatically)
46
+ - `Qwen3_model.py` - Model architecture
47
+ - `requirements.txt` - Dependencies (includes huggingface_hub)
48
+ - `README.md` - This file (optional but recommended)
49
+
50
+ **Note**: The model (`Qwen3_200k_model_params.pt`) is automatically downloaded from the HuggingFace model repository, so you don't need to upload it!
51
+
52
+ ### Step 2: Create a HuggingFace Space
53
+
54
+ 1. Go to https://huggingface.co/new-space
55
+ 2. Fill in the details:
56
+ - **Space name**: Choose a name (e.g., "qwen3-text-generator")
57
+ - **License**: Select your preferred license
58
+ - **Select the SDK**: Choose **Gradio**
59
+ - **Space hardware**: Start with "CPU basic" (free)
60
+
61
+ 3. Click "Create Space"
62
+
63
+ ### Step 3: Upload Your Files
64
+
65
+ You have two options:
66
+
67
+ #### Option A: Using Git (Recommended)
68
+
69
+ ```bash
70
+ # Clone your new space
71
+ git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
72
+ cd YOUR_SPACE_NAME
73
+
74
+ # Copy your 3 files (model downloads automatically!)
75
+ cp /path/to/app.py .
76
+ cp /path/to/Qwen3_model.py .
77
+ cp /path/to/requirements.txt .
78
+ cp /path/to/README.md . # Optional but recommended
79
+
80
+ # Commit and push (fast - only ~40KB!)
81
+ git add .
82
+ git commit -m "Initial commit: Add Qwen3 text generator"
83
+ git push
84
+ ```
85
+
86
+ #### Option B: Using the Web Interface
87
+
88
+ 1. On your Space page, click "Files" โ†’ "Add file" โ†’ "Upload files"
89
+ 2. Drag and drop or select all your files
90
+ 3. Click "Commit to main"
91
+
92
+ ### Step 4: Wait for Build
93
+
94
+ - HuggingFace will automatically build and deploy your app
95
+ - This may take 5-10 minutes
96
+ - You'll see build logs in the "App" tab
97
+
98
+ ### Step 5: Test Your App
99
+
100
+ Once the build is complete, your app will be live at:
101
+ `https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME`
102
+
103
+ ## ๐ŸŽฎ How to Use the App
104
+
105
+ 1. **Enter Starting Text**: Type the beginning of your story (e.g., "Once upon a time")
106
+
107
+ 2. **Adjust Max New Tokens**:
108
+ - Controls how much text to generate
109
+ - 10-50: Short continuation
110
+ - 50-100: Medium paragraph
111
+ - 100-200: Long passage
112
+
113
+ 3. **Adjust Temperature**:
114
+ - 0.1-0.7: More predictable, focused text
115
+ - 0.8-1.0: Balanced creativity
116
+ - 1.1-2.0: Very creative, more random
117
+
118
+ 4. **Click Generate**: Watch as the model continues your story!
119
+
120
+ ## ๐Ÿ“Š Model Information
121
+
122
+ - **Architecture**: Qwen3 0.6B
123
+ - **Parameters**: 596 million (unique parameters)
124
+ - **Training Data**: TinyStories dataset
125
+ - **Best For**: Simple narratives, children's stories, everyday situations
126
+
127
+ ## ๐Ÿ”ง Troubleshooting
128
+
129
+ ### Model Download Issues
130
+
131
+ If the model doesn't download automatically:
132
+ - Check that the model repository is public: https://huggingface.co/vuminhtue/qwen3_sentiment_tinystories
133
+ - Verify internet connectivity on HuggingFace Spaces
134
+ - Check the build logs for specific error messages
135
+ - Make sure `requirements.txt` includes `huggingface_hub>=0.16.0`
136
+
137
+ ### Out of Memory Error
138
+
139
+ If you get memory errors:
140
+ 1. Go to your Space settings
141
+ 2. Upgrade to a better hardware tier (may require payment)
142
+ 3. The Qwen3 0.6B model requires about 2-3GB RAM
143
+
144
+ ### App Not Loading
145
+
146
+ 1. Check the build logs in the "App" tab
147
+ 2. Make sure all files are uploaded correctly
148
+ 3. Verify `requirements.txt` has all necessary packages
149
+ 4. Check that file names match exactly (case-sensitive)
150
+
151
+ ## ๐Ÿ’ก Tips for Better Results
152
+
153
+ 1. **Good Prompts**: Start with clear, simple sentences
154
+ - โœ… "Once upon a time, there was a little girl"
155
+ - โŒ "Explain quantum physics"
156
+
157
+ 2. **Temperature Selection**:
158
+ - Use lower temperature (0.5-0.7) for coherent stories
159
+ - Use higher temperature (1.0-1.5) for creative variety
160
+
161
+ 3. **Token Length**:
162
+ - Start with 30-50 tokens to see the style
163
+ - Increase if you want longer passages
164
+
165
+ ## ๐Ÿ“ File Structure
166
+
167
+ **Files to upload to HuggingFace Spaces:**
168
+ ```
169
+ .
170
+ โ”œโ”€โ”€ app.py # Main Gradio application (downloads model)
171
+ โ”œโ”€โ”€ Qwen3_model.py # Model architecture and helpers
172
+ โ”œโ”€โ”€ requirements.txt # Python dependencies (includes huggingface_hub)
173
+ โ””โ”€โ”€ README.md # This file (optional)
174
+ ```
175
+
176
+ **Model file** (`Qwen3_200k_model_params.pt`) is automatically downloaded from HuggingFace, no need to upload!
177
+
178
+ ## ๐Ÿค Contributing
179
+
180
+ Feel free to:
181
+ - Report issues
182
+ - Suggest improvements
183
+ - Share your generated stories!
184
+
185
+ ## ๐Ÿ“œ License
186
+
187
+ This project uses the Qwen3 architecture. Please check the license for your specific use case.
188
+
189
+ ## ๐Ÿ™ Acknowledgments
190
+
191
+ - Qwen3 architecture from Alibaba Cloud
192
+ - Training approach inspired by "LLMs from Scratch"
193
+ - TinyStories dataset for training data
194
+
195
+ ---
196
+
197
+ **Enjoy generating creative stories! ๐Ÿ“šโœจ**
198
+