Skip to content
Merged
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
14 changes: 13 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
[project]
name = "scratchgpt"
version = "0.3.0"
description = "Add your description here"
description = "A small-scale transformer-based language model implemented from scratch in Python."
authors = [
{ name = "Aleksandr Yeganov", email = "ayeganov@gmail.com"},
{ name = "Dario Cazzani", email ="dariocazzani@gmail.com" }
]
readme = "README.md"
requires-python = ">=3.12"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dependencies = [
"numpy>=2.3.2",
"ptflops>=0.7.5",
Expand All @@ -19,6 +25,10 @@ dependencies = [
"types-tqdm>=4.67.0.20250809",
]

[project.urls]
Homepage = "https://github.com/LabStrangeLoop/scratchgpt"
Repository = "https://github.com/LabStrangeLoop/scratchgpt"

[project.optional-dependencies]
hf-tokenizers = [
"tokenizers>=0.19.0",
Expand All @@ -32,6 +42,8 @@ dev = [
"mypy>=1.17.1",
"pytest>=8.4.1",
"ruff>=0.1.0",
"tokenizers>=0.19.0",
"huggingface-hub>=0.34.4",
]

[tool.pytest.ini_options]
Expand Down
72 changes: 72 additions & 0 deletions scratchgpt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
"""
ScratchGPT: A small-scale transformer-based language model implemented from scratch.
"""

from scratchgpt.config import (
ScratchGPTArchitecture,
ScratchGPTConfig,
ScratchGPTTraining,
)
from scratchgpt.data.datasource import (
ByteSizableDataSource,
DataSource,
FileDataSource,
FolderDataSource,
LineByLineFileDataSource,
)
from scratchgpt.model.model import TransformerLanguageModel
from scratchgpt.model_io import (
ModelLoadFailedError,
TokenizerLoadFailedError,
get_best_model_weights_path,
get_latest_model_weights_path,
get_tokenizer,
get_tokenizer_path,
load_model,
load_tokenizer,
save_tokenizer,
)
from scratchgpt.tokenizer.base_tokenizer import (
SerializableTokenizer,
Tokenizer,
register_tokenizer,
)
from scratchgpt.tokenizer.char_tokenizer import CharTokenizer, Utf8Tokenizer
from scratchgpt.tokenizer.hf_tokenizer import HuggingFaceTokenizer
from scratchgpt.tokenizer.tiktoken import TiktokenWrapper
from scratchgpt.training.trainer import Trainer, get_dtype_for_vocab_size

__all__ = [
# Core Model and Config
"TransformerLanguageModel",
"ScratchGPTConfig",
"ScratchGPTArchitecture",
"ScratchGPTTraining",
# Data Sources
"DataSource",
"ByteSizableDataSource",
"FileDataSource",
"FolderDataSource",
"LineByLineFileDataSource",
# Model I/O
"load_model",
"load_tokenizer",
"save_tokenizer",
"get_tokenizer",
"get_best_model_weights_path",
"get_latest_model_weights_path",
"get_tokenizer_path",
"ModelLoadFailedError",
"TokenizerLoadFailedError",
# Tokenizers
"Tokenizer",
"SerializableTokenizer",
"register_tokenizer",
"CharTokenizer",
"Utf8Tokenizer",
"HuggingFaceTokenizer",
"TiktokenWrapper",
# Training
"Trainer",
"get_dtype_for_vocab_size",
]
Loading