[Python] IPython 互動界面中換行的方法簡記
前言
IPython 是一個提供互動式運算的系統,可以在各種 shell 跟視覺化界面整合在一起;比方說我們可以透過終端機使用 ipython(前題是這個模組有裝)、或是使用如 VS Code 和 PyCharm 這類的圖形化界面編輯器/IDE。
IPython 是一個提供互動式運算的系統,可以在各種 shell 跟視覺化界面整合在一起;比方說我們可以透過終端機使用 ipython(前題是這個模組有裝)、或是使用如 VS Code 和 PyCharm 這類的圖形化界面編輯器/IDE。
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
You are given the array paths, where paths[i] = [cityAi, cityBi] means there exists a direct path going from cityAi to cityBi. Return the destination city, that is, the city without any path outgoing to another city.
You are given a 0-indexed m x n binary matrix grid.
A 0-indexed m x n difference matrix diff is created with the following procedure:
昨晚,我在改進一段將模型融合的程式碼時,由於個人設備資源不足,我採取分層合併的方法,一次只取一層的記憶體進行合併,以此減少系統同時保存的模型記憶體大小。然而,我發現模型雖然在 GPU 中的記憶體很容易被刪除、但是 CPU 中的記憶體被回收是十分不容易的。這涉及到了 Python 的資源回收器的設計。
Read More »[PyTorch] 將模型刪除後,釋放 GPU / CPU 的記憶體空間今天在閱讀 DreamBooth 訓練原始碼時,發現了 tempfile 這個模組;剛巧手邊又在做一個模型分層合併的的腳本改寫,頓時想到使用這個模組的話能夠讓程式碼優雅一些,便順手做了個紀錄。
vLLM 是加州柏克萊分校所開發的一種大型語言模型(Large Language Model, LLM)加速推理框架。它主要是利用 PagedAttention 機制提高了 GPU VRAM 的使用率,並且這一方法無須更改模型的架構。
Read More »使用 vLLM 進行大型語言模型(LLM)的高速推理Given the root of a binary tree, construct a string consisting of parenthesis and integers from a binary tree with the preorder traversal way, and return it.
You are given a string num, representing a large integer. Return the largest-valued odd integer (as a string) that is a non-empty substring of num, or an empty string "" if no odd integer exists.