Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some typo fix and cuda param reset #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cuda/test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from torch.utils.cpp_extension import load
import torch
reorder_layer_norm_fp16 = load(
'reorder_layernorm_fp16', ['reorder_layernorm.cu'],
'reorder_layer_norm_fp16', ['reorder_layernorm.cu'],
extra_cuda_cflags=['--use_fast_math'],
extra_ldflags=["-L/usr/local/cuda/lib64/"])

Expand All @@ -16,8 +16,7 @@ def add_cuda_op(x, y,w,b):
index[1]=31
index[31]=2
dst_index=torch.argsort(index)
var,mean=torch.var_mean(x,0)
reorder_layer_norm_fp16.forward(x, output,mean,var,w,b,dst_index)
reorder_layer_norm_fp16.forward(x, output,w,b,dst_index)
return output

bias=torch.arange(0,32,1,device='cuda').half()
Expand Down
12 changes: 6 additions & 6 deletions datautils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def set_seed(seed):
def get_wikitext2(nsamples, seed, seqlen, model,cache_dir):
print("get_wikitext2")
from datasets import load_dataset
traindata = load_dataset('wikitext', 'wikitext-2-raw-v1',cache_dir='/datasets/tmp/wikitext/', split='train')
testdata = load_dataset('wikitext', 'wikitext-2-raw-v1',cache_dir='/datasets/tmp/wikitext/', split='test')
traindata = load_dataset('wikitext', 'wikitext-2-raw-v1',cache_dir='./datasets/tmp/wikitext/', split='train')
testdata = load_dataset('wikitext', 'wikitext-2-raw-v1',cache_dir='./datasets/tmp/wikitext/', split='test')

from transformers import AutoTokenizer
if "llama" in model:
Expand All @@ -39,8 +39,8 @@ def get_wikitext2(nsamples, seed, seqlen, model,cache_dir):
def get_ptb(nsamples, seed, seqlen, model,cache_dir):
print("get_ptb")
from datasets import load_dataset
traindata = load_dataset('ptb_text_only', 'penn_treebank',cache_dir='/datasets/tmp/ptb_text_only/', split='train')
valdata = load_dataset('ptb_text_only', 'penn_treebank',cache_dir='/datasets/tmp/ptb_text_only/', split='validation')
traindata = load_dataset('ptb_text_only', 'penn_treebank',cache_dir='./datasets/tmp/ptb_text_only/', split='train')
valdata = load_dataset('ptb_text_only', 'penn_treebank',cache_dir='./datasets/tmp/ptb_text_only/', split='validation')

from transformers import AutoTokenizer
if "llama" in model:
Expand All @@ -67,10 +67,10 @@ def get_c4(nsamples, seed, seqlen, model,cache_dir):
print("get_c4")
from datasets import load_dataset
traindata = load_dataset(
'allenai/c4', 'allenai--c4', cache_dir='/datasets/tmp/allenai--c4/', data_files={'train': 'en/c4-train.00000-of-01024.json.gz'}, split='train'
'allenai/c4', 'allenai--c4', cache_dir='./datasets/tmp/allenai--c4/', data_files={'train': 'en/c4-train.00000-of-01024.json.gz'}, split='train'
)
valdata = load_dataset(
'allenai/c4', 'allenai--c4', cache_dir='/datasets/tmp/allenai--c4/',data_files={'validation': 'en/c4-validation.00000-of-00008.json.gz'}, split='validation'
'allenai/c4', 'allenai--c4', cache_dir='./datasets/tmp/allenai--c4/',data_files={'validation': 'en/c4-validation.00000-of-00008.json.gz'}, split='validation'
)

from transformers import AutoTokenizer
Expand Down
2 changes: 1 addition & 1 deletion quantize/reorder_layer_norm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
USE_CUDA=False
if USE_CUDA:
reorder_layer_norm_fp16 = load(
'reorder_layernorm_fp16', ['./cuda/reorder_layernorm.cu'],
'reorder_layer_norm_fp16', ['./cuda/reorder_layernorm.cu'],
extra_cuda_cflags=['--use_fast_math'],
extra_ldflags=["-L/usr/local/cuda/lib64/"])

Expand Down