投資コストに対して得られる計算量は、GPUと演算強度(Arithmetic Intensity)によって大きく異なります。Runpodの価格設定に基づき、`batch_size=1024` (tokens) でLLMを事前学習した場合、0.5Bパラメータ未満のモデルではL4が、それ以上の規模ではH100が圧倒的なコストパフォーマンスを示します。
Compute obtained per dollar varies significantly by GPU and arithmetic intensity. According to Runpod's pricing, when pre-training LLMs with `batch_size=1024` (tokens), the L4 offers superior cost-performance for models under 0.5B parameters, while the H100 dominates for larger scales.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| import json | |
| import textwrap | |
| import time | |
| from openai import OpenAI | |
| client = OpenAI() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| init_std, lr = 0.02, 2e-5 # example | |
| """ Redundant """ | |
| indices = df["init_std"] == init_std) & (df["lr"] == lr) | |
| print(df[(indices]) | |
| """ Concise """ | |
| query = f"{init_std=} & {lr=}".replace("=", "==") | |
| print(df.query(query)) # "init_std==0.02 & lr==2e-05" |
Mar 10, 2024.
See pytorch.org/xla for up-to-date info and implementation with multiple TPUs
# Usually pre-installed on TPU instances
pip install torch_xla[tpu] -f https://storage.googleapis.com/libtpu-releases/index.html
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import gzip | |
| def gzip_search(query: str, candidate_chunks: list[str], top_k: int=1): | |
| """ | |
| 文字列ベースで類似したテキストチャンクを推定するアルゴリズム. | |
| `query`, `chunk`, および`query + " " + chunk`をそれぞれgzipで圧縮し、編集距離のようなものをベースに評価する. | |
| Parameters: | |
| query (str): 検索クエリとして使用する文字列. | |
| top_k (int, optional): 返される類似チャンクの上位k個を指定する (default: 1). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder

