DIY AI 第三部分:環境設置及庫安裝指南

Ai




DIY AI 第三部分:設置環境和安裝庫

如果你一直在跟隨本系列的前幾部分,並且擁有足夠的計算能力,我們可以繼續進行我們的人工智能項目。在這部分,我們將討論如何設置環境和安裝我們需要的庫,以便為下一步做好準備。這部分過程快速且簡單,但至關重要,包含許多有用的信息。

安裝 Visual Studio Code 並設置虛擬環境

在這個項目中,我們將使用 Visual Studio Code(VS Code)編輯器,你可以從他們的網站免費獲取。它功能強大、輕量且全面,與我們將要使用的編程語言 Python 配合得很好。

如果你需要安裝 Visual Studio Code 的幫助,我們有相關指導。

一旦你啟動了 VS Code,創建一個名為你的 DIY AI 的項目文件夾(My_DIY_AI)。然後,設置你的虛擬環境。

如果你需要設置虛擬環境的幫助,我們也有相應的指導。

安裝庫

當你的虛擬環境設置好後,就可以開始安裝我們項目所需的庫了。

– **os 和 shutil**
os 和 shutil 是 Python 中預裝的庫,因此我們不需要安裝它們,但由於我們將使用它們進行文件和目錄管理,以及複製、移動和刪除文件和目錄,這是必需的。

– **Pandas**
Pandas 非常適合處理大型數據集,支持多種數據格式,並能與其他 Python 庫無縫集成。

– **PyPDF2 和 fitz**
PyPDF2 和 fitz 是用於讀取和寫入 PDF 文件的庫。

– **python-magic**
python-magic 將通過檢查文件內容而不僅僅是文件擴展名來幫助檢測文件類型,這有助於確保準確識別,不受命名慣例的影響。

– **Whoosh**
Whoosh 非常適合在本地或嵌入式應用程序中創建和管理搜索功能。它允許你高效地索引文件並檢索內容。

– **Transformers 和 Torch**
Transformers 和 Torch 是支持自然語言處理任務的庫,例如摘要生成、情感分析和文本分類。Transformers 包含針對問題回答、文本生成和摘要等任務的預訓練模型。Torch 是一個廣泛用於深度學習的機器學習框架,支持自定義 NLP 模型的訓練。

– **Numpy 和 Scipy**
Numpy 和 Scipy 是數學庫,對於任何數據科學或機器學習項目中的計算和預處理都至關重要。它們負責處理數組、矩陣和大型數據集。

– **FastAPI 和 Uvicorn**
FastAPI 和 Uvicorn 用於構建快速、輕量的 API,以便離線提供數據或機器學習模型。

要安裝這些庫,請在虛擬環境中使用以下命令在終端執行。安裝完這些庫後,我們的人工智能項目基礎已經搭建完成。在下一個指導中,我們將創建文件結構,並接近於實際運行它。

在這裡,我想補充的是,隨著人工智能技術的迅速發展,開發者們不僅要掌握編程語言和工具,還需要具備良好的問題解決能力和創新思維。這不僅僅是技術上的挑戰,更是思維方式的轉變。未來的開發者應該更加注重跨學科的學習,融合數據科學、機器學習和人文社會科學的知識,才能在這個快速變化的領域中立於不敗之地。

以上文章由特價GPT API KEY所翻譯及撰寫。而圖片則由FLUX根據內容自動生成。

🎬 YouTube Premium 家庭 Plan成員一位 只需 HK$148/年

不用提供密碼、不用VPN、無需轉區
直接升級你的香港帳號 ➜ 即享 YouTube + YouTube Music 無廣告播放

立即升級 🔗

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *

🎨 Nano Banana Pro 圖像生成器|打幾句說話就出圖

想畫人像、產品圖、插畫?SSFuture 圖像生成器支援 Flux Gemini Nano Banana Pro 改圖 / 合成, 打廣東話都得,仲可以沿用上一張圖繼續微調。

🆓 Flux 模型即玩,不用登入
🤖 登入後解鎖 Gemini 改圖
📷 支援上載參考圖再生成
⚡ 每天免費額度任你玩
✨ 即刻玩 AI 畫圖
A male model, dressed in a brown bomber jacket, dark trousers, is perched on the edge of a fire escape platform. One leg dangles freely while the other is bent. He looks contemplatively into the distance. Monogrammed duffel bag rests nearby. Urban street background, soft ambient lighting.
Keep the face 100% exact same as I uploaded no alteration, no blurry. The same person, the same face, unaltered features. An almost hyperrealistic image with sharp detail, a stylish photograph captures a model standing against a backdrop of pristine white volcanic rocks. The stones are expertly arranged, revealing natural cracks in the beige hue. In a medium-length shot, the balance of luxury and meticulous attention to detail is striking. She wears a carefully tailored white suit: a jacket with a structured fabric, high shoulders, and precise waist trim, a deep V-neck that elegantly reveals the neckline without being contrived, and matching skirts that maintain clean lines and lend the look a classic, understated elegance. The head is covered by a wide-brimmed white straw hat, its high angle pointing forward and adorned with a bouquet of red and white roses resting on the front brim, adding a touch of drama and romance. Green eyes, professional makeup, full lips, and long, sleek blonde hair cascading over her shoulders. Her right hand lifts the brim of the hat as if adjusting it, while her left hand crosses her chest in a confident pose that reflects a strong feminine presence. The fabric's lines and texture are carefully highlighted with a long, graceful touch of movement. The fabric details are delicate and soft, with subtle ripples and hidden seams that enhance the sense of high craftsmanship. Soft lighting from the left creates a long shadow on the wall, giving the image depth and body without compromising the purity of the white. Shades of white blend with a touch of warm gray, and the red roses stand out as a focal point, adding warmth and visual dimension. The stone background creates a calming effect, allowing the fine details of the hat, suit, and roses to stand out. White volcanic stones. Natural fissures. Keywords: Luxury, High Fashion, Studio Photography, High Definition, Photographic Realism, Blonde Hair, Green Eyes, Professional Makeup, Cinematic Look, Color Balance. Negative Prompt: Blurry, Low Quality, Deformed Hands, Ugly, Plastic Look, Watermark, Oversaturated, Underexposed, Noise, Grain, Artifacts, Cropped, Halo, Glow 電影感、外景特寫人物肖像,16:9比例,4K超高解析度:

場景設定於溫暖柔和的秋日下午,陽光灑落在海邊蜿蜒小徑上,光線溫柔金黃。一位年輕亞洲女性作為主角,擁有甜美明亮的微笑,肌膚細膩、面容生動自然,眼中蘊含溫暖的神采。她穿著一件質感細膩、寬鬆舒適且露肩的米白色短版毛衣,下身搭配貼身黑色牛仔褲,整體造型時尚休閒、比肩電影主角。

她輕鬆自然地斜倚在一道鮮豔、復古感十足的藍色木製欄杆之上,姿態優雅隨性。畫面使用85mm焦段F1.4大光圈鏡頭,中景3/4身構圖,主體人物清晰細緻、膚質呈現柔和光澤感。前景有一層淡淡、模糊的蘆葦或芒草,透過淺景深帶來層次感與夢幻氛圍。背景遠處則是晃動的模糊海岸線與蔚藍晴空,景色朦朧詩意。

整體色調以溫暖自然、略帶金色餘暉為主,黑柔濾鏡效果減低對比,尤其在高光處展現細膩的光暈與膚質柔化,氛圍極具電影感和藝術氛圍。畫面細節豐富,請強調人物情感表達與場景的詩意氛圍。