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 argparse | |
import random | |
import time | |
import os | |
import torch | |
import torch.distributed as dist | |
import numpy as np | |
from functools import partial | |
from typing import Optional |
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 argparse | |
import os | |
import time | |
import torch | |
import torch.distributed as dist | |
# noinspection PyUnresolvedReferences | |
import deep_ep | |
from utils import init_dist, bench, bench_kineto, calc_diff, create_grouped_scores, inplace_unique, per_token_cast_to_fp8, per_token_cast_back, hash_tensor |
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 os | |
import torch | |
import torch.distributed as dist | |
from typing import Callable, List, Tuple, Optional, Union | |
# noinspection PyUnresolvedReferences | |
import deep_ep_cpp | |
# noinspection PyUnresolvedReferences | |
from deep_ep_cpp import Config, EventHandle | |
from .utils import EventOverlap, check_nvlink_connections |
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 time | |
from vllm import LLM, SamplingParams | |
from vllm.outputs import PoolingRequestOutput, RequestOutput | |
from typing import Union | |
import threading | |
from threading import Event | |
class MyLLM(LLM): | |
def keep_running( | |
self, |
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 torch | |
# set seed | |
torch.manual_seed(42) | |
B, T, D = 1, 4, 10 # batch size, sequence length, vocab size | |
tensor = torch.rand(B, T, D, requires_grad=True) | |
labels = torch.Tensor([[1, 2, 3, 4]]).long() | |
print("="*100) |
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
""" | |
# Convert HF to TorchTitan DCP | |
python convert.py hf_to_dcp --input-path meta-llama/Meta-Llama-3.1-8B --output-path ./torchtitan_model | |
# Convert TorchTitan DCP to HF (works with any checkpoint structure) | |
python convert.py dcp_to_hf --input-path ./torchtitan_model --output-path ./hf_model | |
# Model structure | |
If you run the following code, you will get the model structure. |
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
absl-py==2.3.0 | |
aiohappyeyeballs==2.6.1 | |
aiohttp==3.12.13 | |
aiosignal==1.3.2 | |
annotated-types==0.7.0 | |
anyio==4.9.0 | |
attrs==25.3.0 | |
azure-core==1.34.0 | |
azure-identity==1.23.0 | |
azure-storage-blob==12.25.1 |
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
# SPDX-License-Identifier: Apache-2.0 | |
"""Example for starting a Gradio OpenAI Chatbot Webserver | |
Start vLLM API server: | |
vllm serve allenai/OLMo-2-0425-1B-Instruct | |
Start Gradio OpenAI Chatbot Webserver: | |
python x1.py -m allenai/OLMo-2-0425-1B-Instruct --model-url http://ceres-cs-aus-441:8000/v1 | |
Note that `pip install --upgrade gradio` is needed to run this example. | |
More details: https://github.com/gradio-app/gradio |
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
for seed in 1 2; do | |
for lr in 5e-7 7e-7 9e-7; do | |
python update_command_args.py scripts/train/olmo2/grpo_7b.sh \ | |
--priority urgent \ | |
--workspace ai2/olmo-instruct \ | |
--exp_name 0423_grpo_seed_${seed}_lr_${lr} \ | |
--model_name_or_path allenai/OLMo-2-0425-1B-DPO \ | |
--model_revision main \ | |
--tokenizer_name_or_path allenai/OLMo-2-1124-7B-DPO \ |
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
TEMPLATE = """ | |
--- | |
license: apache-2.0 | |
language: | |
- en | |
datasets: | |
- {{dataset}} | |
base_model: | |
- {{base_model}} | |
pipeline_tag: text-generation |
NewerOlder