Skip to content

Commit

Permalink
Fix some issues with circular and relative imports (#1658)
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt authored Aug 6, 2024
1 parent 9722fdb commit 4558463
Show file tree
Hide file tree
Showing 15 changed files with 15 additions and 16 deletions.
3 changes: 1 addition & 2 deletions litgpt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import torch
import yaml
from typing_extensions import Self

import litgpt.model
from litgpt.utils import find_multiple


Expand Down Expand Up @@ -144,6 +142,7 @@ def from_checkpoint(cls, path: Path, **kwargs: Any) -> Self:
@property
def mlp_class(self) -> Type:
# `self.mlp_class_name` cannot be the type to keep the config serializable
import litgpt.model
return getattr(litgpt.model, self.mlp_class_name)

@property
Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from torch import Tensor
from torch.utils.data import Dataset

from litgpt import Tokenizer
from litgpt.tokenizer import Tokenizer
from litgpt.prompts import PromptStyle


Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/deita.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import torch
from torch.utils.data import DataLoader

from litgpt import PromptStyle
from litgpt.prompts import PromptStyle
from litgpt.data import DataModule, SFTDataset, get_sft_collate_fn
from litgpt.tokenizer import Tokenizer

Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/dolly.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import torch
from torch.utils.data import random_split

from litgpt import PromptStyle
from litgpt.prompts import PromptStyle
from litgpt.data import Alpaca, SFTDataset

_URL: str = "https://huggingface.co/datasets/databricks/databricks-dolly-15k/resolve/main/databricks-dolly-15k.jsonl"
Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/flan.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import torch
from torch.utils.data import DataLoader

from litgpt import PromptStyle
from litgpt.prompts import PromptStyle
from litgpt.data import DataModule, SFTDataset, get_sft_collate_fn
from litgpt.data.alpaca import download_if_missing
from litgpt.tokenizer import Tokenizer
Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/json_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import torch
from torch.utils.data import DataLoader, random_split

from litgpt import PromptStyle
from litgpt.prompts import PromptStyle
from litgpt.data import DataModule, SFTDataset, get_sft_collate_fn
from litgpt.tokenizer import Tokenizer

Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/lima.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import torch
from torch.utils.data import DataLoader, random_split

from litgpt import PromptStyle
from litgpt.prompts import PromptStyle
from litgpt.data import DataModule, SFTDataset, get_sft_collate_fn
from litgpt.tokenizer import Tokenizer

Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/lit_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from torch.utils.data import DataLoader

from litgpt import Tokenizer
from litgpt.tokenizer import Tokenizer
from litgpt.data import DataModule


Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/longform.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import torch
from torch.utils.data import DataLoader

from litgpt import PromptStyle
from litgpt.prompts import PromptStyle
from litgpt.data import DataModule, SFTDataset, get_sft_collate_fn
from litgpt.data.alpaca import download_if_missing
from litgpt.tokenizer import Tokenizer
Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/openwebtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from torch.utils.data import DataLoader

from litgpt import Tokenizer
from litgpt.tokenizer import Tokenizer
from litgpt.data import DataModule


Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/prepare_slimpajama.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import time
from pathlib import Path

from litgpt import Tokenizer
from litgpt.tokenizer import Tokenizer
from litgpt.data.prepare_starcoder import DataChunkRecipe
from litgpt.utils import CLI, extend_checkpoint_dir

Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/prepare_starcoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from lightning_utilities.core.imports import RequirementCache

from litgpt import Tokenizer
from litgpt.tokenizer import Tokenizer
from litgpt.utils import CLI, extend_checkpoint_dir

_LITDATA_AVAILABLE = RequirementCache("litdata")
Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/text_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from torch.utils.data import DataLoader

from litgpt import Tokenizer
from litgpt.tokenizer import Tokenizer
from litgpt.data import DataModule


Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/tinyllama.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from torch.utils.data import DataLoader

from litgpt import Tokenizer
from litgpt.tokenizer import Tokenizer
from litgpt.data import DataModule


Expand Down
2 changes: 1 addition & 1 deletion litgpt/data/tinystories.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from torch.utils.data import DataLoader
from tqdm import tqdm

from litgpt import Tokenizer
from litgpt.tokenizer import Tokenizer
from litgpt.data import DataModule
from litgpt.data.alpaca import download_if_missing
from litgpt.data.text_files import validate_tokenizer
Expand Down

0 comments on commit 4558463

Please sign in to comment.