repo_full_name
stringlengths
6
93
repo_url
stringlengths
25
112
repo_api_url
stringclasses
28 values
owner
stringclasses
28 values
repo_name
stringclasses
28 values
description
stringclasses
28 values
stars
int64
617
98.8k
forks
int64
31
355
watchers
int64
990
999
license
stringclasses
2 values
default_branch
stringclasses
2 values
repo_created_at
timestamp[s]date
2012-07-24 23:12:50
2025-06-16 08:07:28
repo_updated_at
timestamp[s]date
2026-02-23 15:23:15
2026-05-03 18:52:12
repo_topics
listlengths
0
13
repo_languages
unknown
is_fork
bool
1 class
open_issues
int64
3
104
file_path
stringlengths
3
208
file_name
stringclasses
509 values
file_extension
stringclasses
1 value
file_size_bytes
int64
101
84k
file_url
stringclasses
627 values
file_raw_url
stringclasses
627 values
file_sha
stringclasses
624 values
language
stringclasses
8 values
parsed_at
stringdate
2026-05-04 01:12:36
2026-05-04 19:41:55
text
stringlengths
100
102k
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-cache/graphrag_cache/json_cache.py
null
null
null
null
null
null
Python
2026-05-04T02:24:07.537926
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'JsonCache' model.""" import json from typing import Any from graphrag_storage import Storage, StorageConfig, create_storage from graphrag_cache.cache import Cache class JsonCache(Cache): """File pipeline cache...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-cache/graphrag_cache/noop_cache.py
null
null
null
null
null
null
Python
2026-05-04T02:24:07.540284
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """NoopCache implementation.""" from typing import Any from graphrag_cache.cache import Cache class NoopCache(Cache): """A no-op implementation of Cache, usually useful for testing.""" def __init__(self, **kwargs: Any) -> None: ...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-cache/graphrag_cache/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:24:07.541309
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """The GraphRAG Cache package.""" from graphrag_cache.cache import Cache from graphrag_cache.cache_config import CacheConfig from graphrag_cache.cache_factory import create_cache, register_cache from graphrag_cache.cache_key import CacheKeyC...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-cache/graphrag_cache/cache.py
null
null
null
null
null
null
Python
2026-05-04T02:24:07.542219
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Abstract base class for cache.""" from __future__ import annotations from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from graphrag_storage import Storage class Cache(ABC): """Provide...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-cache/graphrag_cache/memory_cache.py
null
null
null
null
null
null
Python
2026-05-04T02:24:07.547738
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """MemoryCache implementation.""" from typing import Any from graphrag_cache.cache import Cache class MemoryCache(Cache): """In memory cache class definition.""" _cache: dict[str, Any] _name: str def __init__(self, **kwa...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-cache/graphrag_cache/cache_config.py
null
null
null
null
null
null
Python
2026-05-04T02:24:07.550961
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Cache configuration model.""" from graphrag_storage import StorageConfig, StorageType from pydantic import BaseModel, ConfigDict, Field from graphrag_cache.cache_type import CacheType class CacheConfig(BaseModel): """The configurat...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-cache/graphrag_cache/cache_key.py
null
null
null
null
null
null
Python
2026-05-04T02:24:07.551964
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Create cache key.""" from typing import Any, Protocol, runtime_checkable from graphrag_common.hasher import hash_data @runtime_checkable class CacheKeyCreator(Protocol): """Create cache key function protocol. Args ---- ...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-cache/graphrag_cache/cache_factory.py
null
null
null
null
null
null
Python
2026-05-04T02:24:07.600497
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Cache factory implementation.""" from collections.abc import Callable from graphrag_common.factory import Factory, ServiceScope from graphrag_storage import Storage, create_storage from graphrag_cache.cache import Cache from graphrag_c...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-chunking/graphrag_chunking/chunker.py
null
null
null
null
null
null
Python
2026-05-04T02:24:08.587412
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing the 'Chunker' class.""" from abc import ABC, abstractmethod from collections.abc import Callable from typing import Any from graphrag_chunking.text_chunk import TextChunk class Chunker(ABC): """Abstract base cla...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-chunking/graphrag_chunking/token_chunker.py
null
null
null
null
null
null
Python
2026-05-04T02:24:08.591196
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'TokenChunker' class.""" from collections.abc import Callable from typing import Any from graphrag_chunking.chunker import Chunker from graphrag_chunking.create_chunk_results import create_chunk_results from graphrag_...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-chunking/graphrag_chunking/chunking_config.py
null
null
null
null
null
null
Python
2026-05-04T02:24:08.592399
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Parameterization settings for the default configuration.""" from pydantic import BaseModel, ConfigDict, Field from graphrag_chunking.chunk_strategy_type import ChunkerType class ChunkingConfig(BaseModel): """Configuration section f...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-chunking/graphrag_chunking/chunk_strategy_type.py
null
null
null
null
null
null
Python
2026-05-04T02:24:08.598138
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Chunk strategy type enumeration.""" from enum import StrEnum class ChunkerType(StrEnum): """ChunkerType class definition.""" Tokens = "tokens" Sentence = "sentence"
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-chunking/graphrag_chunking/bootstrap_nltk.py
null
null
null
null
null
null
Python
2026-05-04T02:24:08.599323
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Bootstrap definition.""" import warnings # Ignore warnings from numba warnings.filterwarnings("ignore", message=".*The 'nopython' keyword.*") warnings.filterwarnings("ignore", message=".*Use no seed for parallelism.*") initialized_nltk ...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-chunking/graphrag_chunking/create_chunk_results.py
null
null
null
null
null
null
Python
2026-05-04T02:24:08.600428
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'create_chunk_results' function.""" from collections.abc import Callable from graphrag_chunking.text_chunk import TextChunk def create_chunk_results( chunks: list[str], transform: Callable[[str], str] | None...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-chunking/graphrag_chunking/chunker_factory.py
null
null
null
null
null
null
Python
2026-05-04T02:24:08.612591
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'ChunkerFactory', 'register_chunker', and 'create_chunker'.""" from collections.abc import Callable from graphrag_common.factory.factory import Factory, ServiceScope from graphrag_chunking.chunk_strategy_type import ...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-chunking/graphrag_chunking/sentence_chunker.py
null
null
null
null
null
null
Python
2026-05-04T02:24:08.642077
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'SentenceChunker' class.""" from collections.abc import Callable from typing import Any import nltk from graphrag_chunking.bootstrap_nltk import bootstrap from graphrag_chunking.chunker import Chunker from graphrag_c...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-chunking/graphrag_chunking/text_chunk.py
null
null
null
null
null
null
Python
2026-05-04T02:24:08.643674
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """The TextChunk dataclass.""" from dataclasses import dataclass @dataclass class TextChunk: """Result of chunking a document.""" original: str """Raw original text chunk before any transformation.""" text: str """The...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-common/graphrag_common/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:24:09.401536
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """GraphRAG Common package."""
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-common/graphrag_common/config/load_config.py
null
null
null
null
null
null
Python
2026-05-04T02:24:09.402176
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Load configuration.""" import json import os from collections.abc import Callable from pathlib import Path from string import Template from typing import Any, TypeVar import yaml from dotenv import load_dotenv T = TypeVar("T", covariant...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-common/graphrag_common/hasher/hasher.py
null
null
null
null
null
null
Python
2026-05-04T02:24:09.403629
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """The GraphRAG hasher module.""" import hashlib from collections.abc import Callable from typing import Any import yaml Hasher = Callable[[str], str] """Type alias for a hasher function (data: str) -> str.""" def sha256_hasher(data: str...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-common/graphrag_common/config/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:24:09.405327
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """The GraphRAG config module.""" from graphrag_common.config.load_config import ConfigParsingError, load_config __all__ = ["ConfigParsingError", "load_config"]
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-common/graphrag_common/factory/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:24:09.416806
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """The GraphRAG factory module.""" from graphrag_common.factory.factory import Factory, ServiceScope __all__ = ["Factory", "ServiceScope"]
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/csv.py
null
null
null
null
null
null
Python
2026-05-04T02:24:09.417351
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'CSVFileReader' model.""" import csv import io import logging import sys from graphrag_input.structured_file_reader import StructuredFileReader from graphrag_input.text_document import TextDocument logger = logging.g...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-common/graphrag_common/factory/factory.py
null
null
null
null
null
null
Python
2026-05-04T02:24:09.418214
# Copyright (c) 2025 Microsoft Corporation. # Licensed under the MIT License """Factory ABC.""" from abc import ABC from collections.abc import Callable from dataclasses import dataclass from typing import Any, ClassVar, Generic, Literal, TypeVar from graphrag_common.hasher import hash_data T = TypeVar("T", covaria...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-common/graphrag_common/hasher/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:24:09.419852
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """The GraphRAG hasher module.""" from graphrag_common.hasher.hasher import ( Hasher, hash_data, make_yaml_serializable, sha256_hasher, ) __all__ = [ "Hasher", "hash_data", "make_yaml_serializable", "sha256_h...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:24:10.094931
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """GraphRAG input document loading package.""" from graphrag_input.get_property import get_property from graphrag_input.input_config import InputConfig from graphrag_input.input_reader import InputReader from graphrag_input.input_reader_fact...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-chunking/graphrag_chunking/transformers.py
null
null
null
null
null
null
Python
2026-05-04T02:24:10.129099
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A collection of useful built-in transformers you can use for chunking.""" from collections.abc import Callable from typing import Any def add_metadata( metadata: dict[str, Any], delimiter: str = ": ", line_delimiter: str = "...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/parquet.py
null
null
null
null
null
null
Python
2026-05-04T02:24:11.640849
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'ParquetFileReader' model.""" import io import logging import pyarrow.parquet as pq from graphrag_input.structured_file_reader import StructuredFileReader from graphrag_input.text_document import TextDocument logger...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/markitdown.py
null
null
null
null
null
null
Python
2026-05-04T02:24:11.759844
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'TextFileReader' model.""" import logging from io import BytesIO from pathlib import Path from markitdown import MarkItDown, StreamInfo from graphrag_input.hashing import gen_sha512_hash from graphrag_input.input_rea...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/structured_file_reader.py
null
null
null
null
null
null
Python
2026-05-04T02:24:12.319177
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'StructuredFileReader' model.""" import logging from typing import Any from graphrag_input.get_property import get_property from graphrag_input.hashing import gen_sha512_hash from graphrag_input.input_reader import In...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/text.py
null
null
null
null
null
null
Python
2026-05-04T02:24:12.390338
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'TextFileReader' model.""" import logging from pathlib import Path from graphrag_input.hashing import gen_sha512_hash from graphrag_input.input_reader import InputReader from graphrag_input.text_document import TextDo...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/text_document.py
null
null
null
null
null
null
Python
2026-05-04T02:24:12.941673
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """TextDocument dataclass.""" import logging from dataclasses import dataclass from typing import Any from graphrag_input.get_property import get_property logger = logging.getLogger(__name__) @dataclass class TextDocument: """The Tex...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-llm/graphrag_llm/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:24:13.027686
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """GraphRAG LLM Package.""" import nest_asyncio2 nest_asyncio2.apply() # noqa: RUF067
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-llm/graphrag_llm/cache/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:24:13.562281
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Cache module.""" from graphrag_llm.cache.create_cache_key import create_cache_key __all__ = [ "create_cache_key", ]
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-llm/graphrag_llm/cache/create_cache_key.py
null
null
null
null
null
null
Python
2026-05-04T02:24:13.636240
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Create cache key.""" from typing import Any from graphrag_cache import create_cache_key as default_create_cache_key _CACHE_VERSION = 4 """ If there's a breaking change in what we cache, we should increment this version number to invalid...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-llm/graphrag_llm/completion/__init__.py
null
null
null
null
null
null
Python
2026-05-04T02:24:14.174175
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Completion module for graphrag-llm.""" from graphrag_llm.completion.completion import LLMCompletion from graphrag_llm.completion.completion_factory import ( create_completion, register_completion, ) __all__ = [ "LLMCompletion...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-llm/graphrag_llm/completion/completion.py
null
null
null
null
null
null
Python
2026-05-04T02:24:14.287334
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Completion Abstract Base Class.""" from abc import ABC, abstractmethod from contextlib import contextmanager from typing import TYPE_CHECKING, Any, Unpack from graphrag_llm.threading.completion_thread_runner import completion_thread_runn...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-llm/graphrag_llm/completion/completion_factory.py
null
null
null
null
null
null
Python
2026-05-04T02:24:14.764923
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Completion factory.""" from collections.abc import Callable from typing import TYPE_CHECKING, Any from graphrag_common.factory import Factory from graphrag_llm.cache import create_cache_key from graphrag_llm.config.tokenizer_config impo...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-llm/graphrag_llm/completion/lite_llm_completion.py
null
null
null
null
null
null
Python
2026-05-04T02:24:14.908813
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """LLMCompletion based on litellm.""" from collections.abc import AsyncIterator, Iterator from typing import TYPE_CHECKING, Any, Unpack import litellm from azure.identity import DefaultAzureCredential, get_bearer_token_provider from litellm...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/input_reader.py
null
null
null
null
null
null
Python
2026-05-04T02:24:15.074829
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'InputReader' model.""" from __future__ import annotations import logging import re from abc import ABCMeta, abstractmethod from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import AsyncIter...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/input_config.py
null
null
null
null
null
null
Python
2026-05-04T02:24:15.085833
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Parameterization settings for the default configuration.""" from pydantic import BaseModel, ConfigDict, Field from graphrag_input.input_type import InputType class InputConfig(BaseModel): """The default configuration section for In...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/json.py
null
null
null
null
null
null
Python
2026-05-04T02:24:15.089850
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'JSONFileReader' model.""" import json import logging from graphrag_input.structured_file_reader import StructuredFileReader from graphrag_input.text_document import TextDocument logger = logging.getLogger(__name__) ...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/get_property.py
null
null
null
null
null
null
Python
2026-05-04T02:24:15.090882
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Utility for retrieving properties from nested dictionaries.""" from typing import Any def get_property(data: dict[str, Any], path: str) -> Any: """Retrieve a property from a dictionary using dot notation. Parameters -------...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/input_reader_factory.py
null
null
null
null
null
null
Python
2026-05-04T02:24:15.093109
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'InputReaderFactory' model.""" import logging from collections.abc import Callable from graphrag_common.factory import Factory from graphrag_common.factory.factory import ServiceScope from graphrag_storage.storage imp...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/jsonl.py
null
null
null
null
null
null
Python
2026-05-04T02:24:15.094503
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing 'JSONLinesFileReader' model.""" import json import logging from graphrag_input.structured_file_reader import StructuredFileReader from graphrag_input.text_document import TextDocument logger = logging.getLogger(__nam...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/input_type.py
null
null
null
null
null
null
Python
2026-05-04T02:24:15.106432
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """A module containing input file type enum.""" from enum import StrEnum class InputType(StrEnum): """The input file type for the pipeline.""" Csv = "csv" """The CSV input type.""" Text = "text" """The text input type....
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-input/graphrag_input/hashing.py
null
null
null
null
null
null
Python
2026-05-04T02:24:15.136635
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Hashing utilities.""" from collections.abc import Iterable from hashlib import sha512 from typing import Any def gen_sha512_hash(item: dict[str, Any], hashcode: Iterable[str]) -> str: """Generate a SHA512 hash. Parameters -...
microsoft/graphrag
https://github.com/microsoft/graphrag
null
null
null
null
32,744
null
null
mit
null
null
null
null
null
null
null
packages/graphrag-llm/graphrag_llm/completion/mock_llm_completion.py
null
null
null
null
null
null
Python
2026-05-04T02:24:15.348030
# Copyright (c) 2024 Microsoft Corporation. # Licensed under the MIT License """Mock LLMCompletion.""" from typing import TYPE_CHECKING, Any, Unpack import litellm from graphrag_llm.completion.completion import LLMCompletion from graphrag_llm.utils import ( create_completion_response, structure_completion_r...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/beautiful_mnist_multigpu.py
null
null
null
null
null
null
Python
2026-05-04T02:24:17.961050
# model based off https://towardsdatascience.com/going-beyond-99-mnist-handwritten-digits-recognition-cfff96337392 from typing import List, Callable from tinygrad import Tensor, TinyJit, nn, GlobalCounters, Device from tinygrad.helpers import getenv, colored, trange from tinygrad.nn.datasets import mnist GPUS = tuple(...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/anthropic_challenge.py
null
null
null
null
null
null
Python
2026-05-04T02:24:17.968804
from tinygrad import Tensor, dtypes, Context, getenv, UOp, fetch from tinygrad.uop.ops import Ops, PatternMatcher, UPat from tinygrad.uop.symbolic import symbolic from tinygrad.codegen import Renderer from tinygrad.codegen.opt import Opt, OptOps # ************************* implementation of the problem ***************...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/beautiful_cartpole.py
null
null
null
null
null
null
Python
2026-05-04T02:24:17.971643
from typing import Tuple import time from tinygrad import Tensor, TinyJit, nn import gymnasium as gym from tinygrad.helpers import trange import numpy as np # TODO: remove numpy import ENVIRONMENT_NAME = 'CartPole-v1' #ENVIRONMENT_NAME = 'LunarLander-v2' #import examples.rl.lightupbutton #ENVIRONMENT_NAME = 'PressTh...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/beautiful_mnist.py
null
null
null
null
null
null
Python
2026-05-04T02:24:17.974172
# model based off https://medium.com/data-science/going-beyond-99-mnist-handwritten-digits-recognition-cfff96337392 from typing import Callable from tinygrad import Tensor, TinyJit, nn, GlobalCounters, function from tinygrad.helpers import getenv, colored, trange from tinygrad.nn.datasets import mnist class Model: d...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/audio_helpers.py
null
null
null
null
null
null
Python
2026-05-04T02:24:17.982802
from typing import Optional from tinygrad import Tensor from tinygrad.dtype import DTypeLike, dtypes import math # rewritten from numpy def rfftfreq(n: int, d: float = 1.0, device=None) -> Tensor: val = 1.0 / (n * d) N = n // 2 + 1 results = Tensor.arange(N, device=device) return results * val # just like in ...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
docs/abstractions4.py
null
null
null
null
null
null
Python
2026-05-04T02:24:17.988569
# tinygrad allows you to write kernels at many different abstractions levels. # This is for RDNA3, but if you don't have one you can run with the emulator # PYTHONPATH="." DEV=MOCKPCI+AMD from tinygrad import Tensor, Context, GlobalCounters, UOp, Device from tinygrad.helpers import DEV, DEBUG, getenv from tinygrad.uop...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/benchmark_onnx.py
null
null
null
null
null
null
Python
2026-05-04T02:24:17.989930
import sys, time from tinygrad import TinyJit, GlobalCounters, fetch, getenv from tinygrad.nn.onnx import OnnxRunner from extra.onnx_helpers import get_example_inputs, validate def load_onnx_model(onnx_file): run_onnx = OnnxRunner(onnx_file) run_onnx_jit = TinyJit(lambda **kwargs: next(iter(run_onnx({k:v.to(None) ...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/beautiful_cifar.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.015304
import time start_tm = time.perf_counter() import math from typing import Tuple, cast from tinygrad import Tensor, nn, GlobalCounters, TinyJit, dtypes, Device from tinygrad.helpers import partition, trange, getenv, Context from extra.lr_scheduler import OneCycleLR GPUS = [f'{Device.DEFAULT}:{i}' for i in range(getenv(...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
docs/abstractions3.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.045136
# abstractions2 goes from back to front, here we will go from front to back # ***** # 0. Load mnist on the device from tinygrad.nn.datasets import mnist X_train, Y_train, _, _ = mnist() X_train = X_train.float() X_train -= X_train.mean() # ***** # 1. Define an MNIST model. from tinygrad import Tensor l1 = Tensor.k...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/compile_efficientnet.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.567921
from pathlib import Path from extra.models.efficientnet import EfficientNet from tinygrad.tensor import Tensor from tinygrad.device import Device from tinygrad.nn.state import get_state_dict, safe_save, safe_load, load_state_dict from extra.export_model import export_model from tinygrad.helpers import fetch import ast ...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/gpt2.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.587697
#!/usr/bin/env python3 import os, argparse, contextlib from typing import Optional, Union with contextlib.suppress(ImportError): import tiktoken from tinygrad import Tensor, TinyJit, Device, GlobalCounters, Variable, dtypes from tinygrad.uop.ops import UOp from tinygrad.helpers import Timing, DEBUG, JIT, getenv, fetch,...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/compile_tensorflow.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.597535
# An example to compile a small Tensorflow model to extremely portable C code import os, sys os.environ["CPU"] = '1' os.environ["JIT"] = '2' import numpy as np import subprocess import tensorflow as tf import tf2onnx from tinygrad.nn.onnx import OnnxRunner from tinygrad.tensor import Tensor from tinygrad.helpers impo...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/gradaccum_mnist.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.624743
import itertools from typing import Callable from tinygrad import nn, Tensor, dtypes, Device, TinyJit from tinygrad.helpers import getenv, trange, partition class Model: def __init__(self): self.layers: list[Callable[[Tensor], Tensor]] = [ nn.Conv2d(1, 32, 5), Tensor.relu, nn.Conv2d(32, 32, 5), Tenso...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/hlb_cifar10.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.627907
#!/usr/bin/env python3 # tinygrad implementation of https://github.com/tysam-code/hlb-CIFAR10/blob/main/main.py # https://myrtle.ai/learn/how-to-train-your-resnet-8-bag-of-tricks/ # https://siboehm.com/articles/22/CUDA-MMM import random, time import numpy as np from typing import Optional from extra.lr_scheduler impor...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/llama.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.638913
#!/usr/bin/env python3 # pip3 install sentencepiece tiktoken blobfile #import typeguard.importhook #typeguard.importhook.install_import_hook('tinygrad') from pathlib import Path from typing import List, Optional import argparse, json from tinygrad import Tensor, Device, GlobalCounters, nn from tinygrad.helpers import ...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/llm.c/train_gpt2.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.643476
#!/usr/bin/env python3 import os, math, time import numpy as np from tinygrad import Tensor, nn, fetch, Device, TinyJit, GlobalCounters from dataclasses import dataclass @dataclass class GPTConfig: block_size: int = 1024 vocab_size: int = 50257 padded_vocab_size: int = 50304 n_layer: int = 12 n_head: int = 1...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mamba.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.645663
import os, sys, math, argparse, time sys.path.append(os.getcwd()) from typing import Any, Optional, Dict from tinygrad import Tensor, TinyJit, nn from tinygrad.helpers import fetch from tinygrad.nn.state import load_state_dict, torch_load from tqdm import tqdm from transformers import AutoTokenizer MODELS = { "130...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/llm.c/export.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.647047
#!/usr/bin/env python3 import os if "NOOPT" not in os.environ: os.environ["NOOPT"] = "1" from tinygrad import Device, nn, Tensor, dtypes from train_gpt2 import GPT, GPTConfig from tinygrad.helpers import DEV, dedup, flatten, getenv, GlobalCounters, to_function_name from tinygrad.engine.realize import get_kernel from ti...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/llama3.py
null
null
null
null
null
null
Python
2026-05-04T02:24:18.674897
from pathlib import Path from typing import List import json, argparse, random, time, os from extra.models.llama import Transformer, convert_from_huggingface, convert_from_gguf, fix_bf16 from tinygrad.llm.gguf import gguf_load from tinygrad.nn.state import safe_load, torch_load, load_state_dict, get_parameters from tin...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mixtral.py
null
null
null
null
null
null
Python
2026-05-04T02:24:19.241054
import functools, argparse, pathlib from tinygrad import Tensor, nn, Device, GlobalCounters, Variable from tinygrad.helpers import Timing, Profiling, CI, tqdm from tinygrad.nn.state import torch_load, get_state_dict from extra.models.llama import FeedForward, Transformer from extra.bench_log import BenchEvent, WallTime...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/minrf.py
null
null
null
null
null
null
Python
2026-05-04T02:24:19.259767
# much taken from https://github.com/cloneofsimo/minRF from tinygrad import Tensor, nn, GlobalCounters, TinyJit from tinygrad.helpers import getenv, trange from extra.models.llama import Attention, FeedForward, precompute_freqs_cis def modulate(x:Tensor, shift:Tensor, scale:Tensor) -> Tensor: return x * (1 + scale.uns...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/dataloader.py
null
null
null
null
null
null
Python
2026-05-04T02:24:19.264972
import os, random, pickle, queue, struct, math, functools, hashlib, time from typing import List from pathlib import Path from multiprocessing import Queue, Process, shared_memory, connection, Lock, cpu_count import numpy as np from tinygrad import dtypes, Tensor from tinygrad.helpers import getenv, prod, Context, rou...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/metrics.py
null
null
null
null
null
null
Python
2026-05-04T02:24:19.266493
import re, string from collections import Counter from tinygrad import Tensor def levenshtein(a, b): n, m = len(a), len(b) if n > m: a, b, n, m = b, a, m, n current = list(range(n + 1)) for i in range(1, m + 1): previous, current = current, [i] + [0] * n for j in range(1, n + 1): add, delete...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/initializers.py
null
null
null
null
null
null
Python
2026-05-04T02:24:19.267791
import math from typing import Union from tinygrad import Tensor, nn, dtypes from tinygrad.helpers import prod, argfix, Context from tinygrad.nn.state import get_parameters from extra.models.unet import UNetModel # rejection sampling truncated randn def rand_truncn(*shape, dtype=None, truncstds=2, **kwargs) -> Tensor...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/lr_schedulers.py
null
null
null
null
null
null
Python
2026-05-04T02:24:19.289223
import math from tinygrad import dtypes, Tensor from tinygrad.nn.optim import Optimizer from extra.lr_scheduler import LR_Scheduler from typing import Callable # https://github.com/mlcommons/training/blob/e237206991d10449d9675d95606459a3cb6c21ad/image_classification/tensorflow2/lars_util.py class PolynomialDecayWithW...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/helpers.py
null
null
null
null
null
null
Python
2026-05-04T02:24:19.335139
from collections import OrderedDict import unicodedata from typing import Optional import math import numpy as np from tinygrad.nn import state from tinygrad.tensor import Tensor, dtypes from tinygrad.helpers import getenv # # checkpointing utils # def invert_dict(d): return {v: k for k, v in reversed(d.items())} def...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/model_spec.py
null
null
null
null
null
null
Python
2026-05-04T02:24:19.336314
# load each model here, quick benchmark from tinygrad import Tensor, GlobalCounters from tinygrad.helpers import getenv import numpy as np def test_model(model, *inputs): GlobalCounters.reset() out = model(*inputs) if isinstance(out, Tensor): out = out.numpy() # TODO: return event future to still get the time_...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/model_eval.py
null
null
null
null
null
null
Python
2026-05-04T02:24:19.354334
import time, math, os start = time.perf_counter() from pathlib import Path import numpy as np from tinygrad import Tensor, Device, dtypes, GlobalCounters, TinyJit from tinygrad.nn.state import get_parameters, load_state_dict, safe_load from tinygrad.helpers import getenv, Context, prod from extra.bench_log import Bench...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/losses.py
null
null
null
null
null
null
Python
2026-05-04T02:24:19.378034
from examples.mlperf.metrics import dice_score from tinygrad import Tensor def dice_ce_loss(pred, tgt): ce = pred.permute(0, 2, 3, 4, 1).sparse_categorical_crossentropy(tgt.squeeze(1)) dice = (1.0 - dice_score(pred, tgt, argmax=False, to_one_hot_x=False)).mean() return (dice + ce) / 2 def sigmoid_focal_loss(pre...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/olmoe.py
null
null
null
null
null
null
Python
2026-05-04T02:24:20.239591
# https://arxiv.org/pdf/2409.02060 import time, functools import numpy as np np.set_printoptions(suppress=True, linewidth=1000) from tinygrad import Tensor, nn, Device, GlobalCounters from tinygrad.helpers import Timing, getenv from extra.models.llama import Transformer, convert_from_huggingface class MixtureFeedForwa...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mnist_gan.py
null
null
null
null
null
null
Python
2026-05-04T02:24:20.241174
from pathlib import Path import torch from torchvision.utils import make_grid, save_image from tinygrad.nn.state import get_parameters from tinygrad.tensor import Tensor from tinygrad.helpers import trange from tinygrad.nn import optim from tinygrad.nn.datasets import mnist class LinearGen: def __init__(self): s...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/optim.py
null
null
null
null
null
null
Python
2026-05-04T02:24:20.242716
from tinygrad.tensor import Tensor from tinygrad.dtype import dtypes from tinygrad.nn.optim import Optimizer from tinygrad.helpers import FUSE_OPTIM, getenv from tinygrad.uop.ops import UOp, Ops STOCHASTIC_ROUND = getenv("STOCHASTIC_ROUND", 0) MASTER_WEIGHTS = getenv("MASTER_WEIGHTS", 0) def stochastic_round_bf16(x:T...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/models/flat_llama.py
null
null
null
null
null
null
Python
2026-05-04T02:24:20.248889
import math, os if __name__ == "__main__": os.environ["DEFAULT_FLOAT"] = "bfloat16" os.environ["OPTIM_DTYPE"] = "bfloat16" if "DEV" not in os.environ: os.environ["DEV"] = "NULL" # CDNA os.environ["EMULATE"] = "AMD_CDNA4" os.environ["DEVICE_IN_FUNCTION_BUG"] = "1" os.environ["ALL2ALL"] = "1" os.environ["...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/models/test_flat_llama.py
null
null
null
null
null
null
Python
2026-05-04T02:24:20.250582
import os os.environ["WQKV"] = "1" import unittest import numpy as np from tinygrad import Tensor, nn, dtypes from tinygrad.nn.state import get_parameters from tinygrad.device import is_dtype_supported, Device from examples.mlperf.models.llama import Transformer from examples.mlperf.models.flat_llama import FlatTransfo...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/openpilot/compile3.py
null
null
null
null
null
null
Python
2026-05-04T02:24:20.251902
import os, sys, pickle, time, re import numpy as np if "JIT_BATCH_SIZE" not in os.environ: os.environ["JIT_BATCH_SIZE"] = "0" from tinygrad import fetch, Tensor, TinyJit, Context, GlobalCounters, Device, dtypes from tinygrad.helpers import DEBUG, getenv from tinygrad.uop.ops import Ops from tinygrad.nn.onnx import Onn...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/openpilot/load_pickle.py
null
null
null
null
null
null
Python
2026-05-04T02:24:20.261573
import sys, pickle from extra.bench_log import WallTimeEvent, BenchEvent from tinygrad.helpers import getenv PKL = sys.argv[1] if len(sys.argv) > 1 else "/tmp/openpilot.pkl" load_times = [] for _ in range(10): with WallTimeEvent(BenchEvent.STEP) as wte: pickle.load(open(PKL, 'rb')) load_times.append(wte.time) ...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/mlperf/model_train.py
null
null
null
null
null
null
Python
2026-05-04T02:24:20.264488
import os, time, math, functools, random, contextlib from pathlib import Path import multiprocessing from tinygrad import Device, GlobalCounters, Tensor, TinyJit, dtypes from tinygrad.helpers import getenv, BEAM, WINO, round_up, diskcache_clear, Profiling, profile_marker, DEBUG from tinygrad.nn.state import get_parame...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/qwq.py
null
null
null
null
null
null
Python
2026-05-04T02:24:20.442961
import argparse import os import sys from transformers import AutoTokenizer from pathlib import Path from typing import Dict, Union from extra.models.llama import Transformer, convert_from_huggingface, fix_bf16 from examples.llama3 import load from tinygrad import nn, Tensor, Device from tinygrad.helpers import fetch...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/other_mnist/beautiful_mnist_torch.py
null
null
null
null
null
null
Python
2026-05-04T02:24:20.445178
from tinygrad import dtypes, getenv, Device from tinygrad.helpers import trange, colored, DEBUG, temp from tinygrad.nn.datasets import mnist import torch from torch import nn, optim class Model(nn.Module): def __init__(self): super().__init__() self.c1 = nn.Conv2d(1, 32, 5) self.c2 = nn.Conv2d(32, 32, 5)...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/stunning_mnist.py
null
null
null
null
null
null
Python
2026-05-04T02:24:21.050803
# beautiful mnist in the new "one-shot" style # one realize in the whole graph # depends on: # - "big graph" UOp scheduling # - symbolic removal from examples.beautiful_mnist import Model from tinygrad import Tensor, nn, getenv, GlobalCounters, Variable from tinygrad.nn.datasets import mnist from tinygrad.helpers im...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/sdxl.py
null
null
null
null
null
null
Python
2026-05-04T02:24:21.072189
# This file incorporates code from the following: # Github Name | License | Link # Stability-AI/generative-models | MIT | https://github.com/Stability-AI/generative-models/blob/fbdc58cab9f4ee2be7a5e1f2e2787ecd9311942f/LICENSE-CODE # mlfoundations/open_clip | MIT | https://github.com/ml...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/sdv2.py
null
null
null
null
null
null
Python
2026-05-04T02:24:21.252601
from tinygrad import Tensor, dtypes, TinyJit from tinygrad.helpers import fetch from tinygrad.nn.state import safe_load, load_state_dict, get_state_dict from examples.stable_diffusion import AutoencoderKL, get_alphas_cumprod from examples.sdxl import DPMPP2MSampler, append_dims, LegacyDDPMDiscretization from extra.mode...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/tools/gpuburn.py
null
null
null
null
null
null
Python
2026-05-04T02:24:21.253519
from tinygrad import Tensor, Device, TinyJit, dtypes GPUS = Device[Device.DEFAULT].count() N = 6144 @TinyJit def many_matmul(A, B): out = A for _ in range(8): out = out@B return out if __name__ == "__main__": A = Tensor.ones(GPUS, N, N, dtype=dtypes.half).shard(devices=tuple([f"{Device.DEFAULT}:{i}" for i in...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/tinychat/tinychat-browser/compile.py
null
null
null
null
null
null
Python
2026-05-04T02:24:21.254260
import os, json, hashlib, math from extra.export_model import export_model from examples.llama3 import build_transformer, Tokenizer from tinygrad.nn.state import get_state_dict, load_state_dict from tinygrad import Device, Variable, Tensor, dtypes, TinyJit from tinygrad.helpers import DEV, fetch, Context from tiktoken....
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/torch_cuda_kernel.py
null
null
null
null
null
null
Python
2026-05-04T02:24:21.254733
#!POPCORN leaderboard grayscale #!POPCORN gpu A100 # not a stable API, but works import torch from tinygrad import Tensor, TinyJit, Device from tinygrad.helpers import Context, OSX from tinygrad.dtype import _from_torch_dtype @TinyJit def f(tg_out, tg_data): return tg_out.assign(tg_data[:, :, 0] * 0.2989 + tg_data[:,...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/stable_diffusion.py
null
null
null
null
null
null
Python
2026-05-04T02:24:21.261106
# https://arxiv.org/pdf/2112.10752.pdf # https://github.com/ekagra-ranjan/huggingface-blog/blob/main/stable_diffusion.md import tempfile from pathlib import Path import argparse, time from collections import namedtuple from typing import Dict, Any import numpy as np from tinygrad import Device, GlobalCounters, dtypes,...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/test_pkl_imagenet.py
null
null
null
null
null
null
Python
2026-05-04T02:24:21.267199
import sys, pickle from tinygrad import GlobalCounters from tinygrad.helpers import fetch, getenv from examples.test_onnx_imagenet import imagenet_dataloader if __name__ == "__main__": with open(fetch(sys.argv[1]), "rb") as f: run_onnx_jit = pickle.load(f) input_name = run_onnx_jit.captured.expected_names[0] ...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/tools/bandwidth_test.py
null
null
null
null
null
null
Python
2026-05-04T02:24:21.267691
#!/usr/bin/env python3 from tinygrad import Tensor, Device, GlobalCounters, Context, dtypes from tinygrad.helpers import getenv, colored SZ = 8_000_000_000 GPUS = getenv("GPUS", 4) # TODO: expose a way in tinygrad to access this if __name__ == "__main__": # create tensors tens = [Tensor.ones(SZ, dtype=dtypes.uint...
tinygrad/tinygrad
https://github.com/tinygrad/tinygrad
null
null
null
null
32,608
null
null
mit
null
null
null
null
null
null
null
examples/test_onnx_imagenet.py
null
null
null
null
null
null
Python
2026-05-04T02:24:21.268420
import random, sys import numpy as np from extra.datasets.imagenet import get_imagenet_categories, get_val_files, center_crop from examples.benchmark_onnx import load_onnx_model from PIL import Image from tinygrad import Tensor, dtypes, GlobalCounters from tinygrad.helpers import fetch, getenv # works: # ~70% - https...
yunjey/pytorch-tutorial
https://github.com/yunjey/pytorch-tutorial
null
null
null
null
32,309
null
null
mit
null
null
null
null
null
null
null
tutorials/02-intermediate/bidirectional_recurrent_neural_network/main.py
null
null
null
null
null
null
Python
2026-05-04T02:24:24.402904
import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms # Device configuration device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Hyper-parameters sequence_length = 28 input_size = 28 hidden_size = 128 num_layers = 2 num_classes = 10 batch_size = 100 nu...
yunjey/pytorch-tutorial
https://github.com/yunjey/pytorch-tutorial
null
null
null
null
32,309
null
null
mit
null
null
null
null
null
null
null
tutorials/02-intermediate/recurrent_neural_network/main.py
null
null
null
null
null
null
Python
2026-05-04T02:24:24.426088
import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms # Device configuration device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Hyper-parameters sequence_length = 28 input_size = 28 hidden_size = 128 num_layers = 2 num_classes = 10 batch_size = 100 nu...
yunjey/pytorch-tutorial
https://github.com/yunjey/pytorch-tutorial
null
null
null
null
32,309
null
null
mit
null
null
null
null
null
null
null
tutorials/01-basics/linear_regression/main.py
null
null
null
null
null
null
Python
2026-05-04T02:24:24.429820
import torch import torch.nn as nn import numpy as np import matplotlib.pyplot as plt # Hyper-parameters input_size = 1 output_size = 1 num_epochs = 60 learning_rate = 0.001 # Toy dataset x_train = np.array([[3.3], [4.4], [5.5], [6.71], [6.93], [4.168], [9.779], [6.182], [7.59], [2.167], [7.042]...