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

Use path separator for Windows compatibility #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
6 changes: 3 additions & 3 deletions entropix/torch_weights.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import List, NamedTuple


import os
import torch
import jax
import jax.numpy as jnp
Expand Down Expand Up @@ -53,7 +53,7 @@ def load_weights(ckpt_dir: Path = Path('weights/1B-Instruct'), n_layers: int = 1
layer_weights = []
with torch.inference_mode():
for file in ckpt_dir.glob("*.npy"):
name = '.'.join(str(file).split('/')[-1].split('.')[:-1])
name = '.'.join(str(file).split(os.sep)[-1].split('.')[:-1])
jax_weight = jnp.load(file=file, mmap_mode='r', allow_pickle=True)
#print(f'JAX output (first 30): {jax_weight.flatten()[:30]}')
np_weight = np.array(jax_weight).astype(np.float32)
Expand All @@ -80,4 +80,4 @@ def load_weights(ckpt_dir: Path = Path('weights/1B-Instruct'), n_layers: int = 1
layer_weights=layer_weights
)

return xfmr_weights
return xfmr_weights