# CJSHS AI Course Week 3 ## 之前的課程連結 - Week 1: https://hackmd.io/@Titi/ByNUY-x2kx - Week 2: https://hackmd.io/@Titi/S18ym5M6ke ## Week 3 課程 ## Large Language Model (大型語言模型) ### 開啟 Colab - https://colab.research.google.com/ - 設定使用GPU運算 1. 執行階段 2. 變更執行階段類型 3. 選擇 "T4 GPU" 4. 儲存 ### DeepSeek R1 1.5B - 安裝必要套件 ```python= !pip install -q transformers ``` - 使用 Huggingface 套件,建立high-level的pipeline - [Huggingface-DeepSeek-R1](https://huggingface.co/collections/deepseek-ai/deepseek-r1-678e1e131c0169c0bc89728d) ```python= from transformers import pipeline pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B") ``` - 輸入prompt,並取得回覆。(可重複修改content內容) ```python= content = "Who are you?" messages = [ {"role": "user", "content": content}, ] reply = pipe(messages) print(reply[0]["generated_text"][1]['content']) ``` ## 作業 1. 成功執行以上程式碼。 2. 建立長榮中學GPT資料庫 - https://hackmd.io/@Titi/HJpsfnM6kg