Skip to content

Commit c4e381d

Browse files
authored
mindsearch教程中新增把代码更新到huggingface space (#1776)
* huggingface space更新代码
1 parent 894bc87 commit c4e381d

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

docs/L2/MindSearch/readme_github.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MindSearch 部署的到 Hugging Face Space
1+
# MindSearch 部署到Github Codespace 和 Hugging Face Space
22

33
[原有的CPU版本](https://github.com/InternLM/Tutorial/blob/camp3/docs/L2/MindSearch/readme.md)相比区别是把internstudio换成了github codespace。
44

@@ -277,4 +277,54 @@ demo.launch(server_name='0.0.0.0',
277277
share=True)
278278
```
279279

280-
在最后,将 /root/mindsearch/mindsearch_deploy 目录下的文件(使用 git)提交到 HuggingFace Space 即可完成部署了。注意将代码提交到huggingface space中需要配置hugginface的token。
280+
在最后,将 /root/mindsearch/mindsearch_deploy 目录下的文件(使用 git)提交到 HuggingFace Space 即可完成部署了。将代码提交到huggingface space的流程如下:
281+
282+
首先创建一个有写权限的token。
283+
284+
![image](https://github.com/user-attachments/assets/3a918dc1-9600-433b-a916-d6ef4caa73fe)
285+
286+
然后从huggingface把空的代码仓库clone到codespace。
287+
288+
```
289+
/workspaces/codespaces-blank
290+
git clone https://huggingface.co/spaces/<你的名字>/<仓库名称>
291+
# 把token挂到仓库上,让自己有写权限
292+
git remote set-url space https://<你的名字>:<上面创建的token>@huggingface.co/spaces/<你的名字>/<仓库名称>
293+
```
294+
295+
现在codespace就是本地仓库,huggingface space是远程仓库,接下来使用方法就和常规的git一样了。
296+
297+
```
298+
cd <仓库名称>
299+
# 把刚才准备的文件都copy进来
300+
cp /workspaces/mindsearch/mindsearch_deploy/* .
301+
```
302+
303+
最终的文件目录是这样。
304+
305+
![image](https://github.com/user-attachments/assets/22a9efb4-c189-4b19-8a9e-ef54d0666040)
306+
307+
注意mindsearch文件夹其实是Mindsearch项目中的一个子文件夹,如果把这个Mindsearch的整个目录copy进来会有很多问题(git submodule无法提交代码,space中项目启动失败等)。
308+
309+
![image](https://github.com/user-attachments/assets/25619052-224b-42df-863f-a80ef35d6d60)
310+
311+
最后把代码提交到huggingface space会自动启动项目。
312+
313+
```
314+
git add .
315+
git commit -m "update"
316+
git push
317+
```
318+
319+
然后就可以测试啦。
320+
321+
<img width="1511" alt="image" src="https://github.com/user-attachments/assets/308a7c47-a7c2-4d7d-8d35-f433cf44cf5f">
322+
323+
<img width="1550" alt="image" src="https://github.com/user-attachments/assets/8d584918-6509-4b72-9a6b-fa3158012098">
324+
325+
<img width="1521" alt="image" src="https://github.com/user-attachments/assets/82c63fda-e790-4dbd-8f1c-c0e7f5ce1c26">
326+
327+
不仅搜到了最近火热的黑悟空,还搜到了龙珠超中的黑悟空,非常给力!
328+
329+
330+

0 commit comments

Comments
 (0)