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
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_content_security_policy.py
test_content_security_policy.py
.py
1,280
https://github.com/TypeError/secure/blob/main/tests/headers/test_content_security_policy.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_content_security_policy.py
a9f8d8620818d9245083b65aaa2bb87bdc2a677c
Python
2026-05-04T01:20:25.487779
import unittest from secure.headers import ContentSecurityPolicy from secure.headers.base_header import HeaderDefaultValue class TestContentSecurityPolicy(unittest.TestCase): def test_default_csp(self): """Test default Content-Security-Policy header.""" csp = ContentSecurityPolicy() self....
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_cross_origin_embedder_policy.py
test_cross_origin_embedder_policy.py
.py
1,681
https://github.com/TypeError/secure/blob/main/tests/headers/test_cross_origin_embedder_policy.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_cross_origin_embedder_policy.py
583079652cc628307f59e348668d640d6a8a5dc6
Python
2026-05-04T01:20:26.708442
import unittest from secure.headers import CrossOriginEmbedderPolicy from secure.headers.base_header import HeaderDefaultValue class TestCrossOriginEmbedderPolicy(unittest.TestCase): def test_default_value(self) -> None: """Default COEP should be `require-corp`.""" policy = CrossOriginEmbedderPol...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_cross_origin_opener_policy.py
test_cross_origin_opener_policy.py
.py
1,460
https://github.com/TypeError/secure/blob/main/tests/headers/test_cross_origin_opener_policy.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_cross_origin_opener_policy.py
8a3d478270bd6d761b943ffdd3c77e8371661c43
Python
2026-05-04T01:20:28.016291
import unittest from secure.headers import CrossOriginOpenerPolicy class TestCrossOriginOpenerPolicy(unittest.TestCase): def test_default_coop(self): """Test default Cross-Origin-Opener-Policy header.""" coop = CrossOriginOpenerPolicy() self.assertEqual(coop.header_value, "same-origin") ...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_custom_header.py
test_custom_header.py
.py
1,056
https://github.com/TypeError/secure/blob/main/tests/headers/test_custom_header.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_custom_header.py
0c7eb59c4aaeb13c3d6987bda968d6a3061613f8
Python
2026-05-04T01:20:29.337582
import unittest from secure.headers import CustomHeader class TestCustomHeader(unittest.TestCase): def test_custom_header_initialization(self): """Test initialization of a custom header with name and value.""" custom_header = CustomHeader("X-Custom-Header", "custom-value") self.assertEqua...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_header_contracts_extended.py
test_header_contracts_extended.py
.py
11,674
https://github.com/TypeError/secure/blob/main/tests/headers/test_header_contracts_extended.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_header_contracts_extended.py
fa426abf889c4c92c9c4ad7861579e84db18ebca
Python
2026-05-04T01:20:32.142268
from collections.abc import Callable from dataclasses import dataclass from typing import ClassVar import unittest from secure.headers import ( CacheControl, ContentSecurityPolicy, CrossOriginEmbedderPolicy, CrossOriginOpenerPolicy, CrossOriginResourcePolicy, CustomHeader, PermissionsPolicy...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_permissions_policy.py
test_permissions_policy.py
.py
1,241
https://github.com/TypeError/secure/blob/main/tests/headers/test_permissions_policy.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_permissions_policy.py
c7df34118919853f13b1de0694548c6027bf93c7
Python
2026-05-04T01:20:33.549436
import unittest from secure.headers import PermissionsPolicy class TestPermissionsPolicy(unittest.TestCase): def test_default_permissions_policy(self): """Test the default Permissions-Policy header.""" policy = PermissionsPolicy() self.assertEqual( policy.header_value, ...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_referrer_policy.py
test_referrer_policy.py
.py
2,864
https://github.com/TypeError/secure/blob/main/tests/headers/test_referrer_policy.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_referrer_policy.py
a625ab9118f865832bab8135b608bd910405753b
Python
2026-05-04T01:20:34.802726
import unittest from secure.headers import ReferrerPolicy class TestReferrerPolicy(unittest.TestCase): def test_default_referrer_policy(self): """Test default Referrer-Policy header.""" referrer_policy = ReferrerPolicy() self.assertEqual(referrer_policy.header_value, "strict-origin-when-c...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_server.py
test_server.py
.py
759
https://github.com/TypeError/secure/blob/main/tests/headers/test_server.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_server.py
b6888c1132359903514f1c7e99efbe0524844b9c
Python
2026-05-04T01:20:36.104964
import unittest from secure.headers import Server class TestServerHeader(unittest.TestCase): def test_default_server(self): """Test default Server header value.""" server_header = Server() self.assertEqual(server_header.header_value, "") def test_set_custom_server(self): """T...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_strict_transport_security.py
test_strict_transport_security.py
.py
1,087
https://github.com/TypeError/secure/blob/main/tests/headers/test_strict_transport_security.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_strict_transport_security.py
4ea0dec559bf59cc3a8a27e6eab6a32cc862586d
Python
2026-05-04T01:20:37.244497
import unittest from secure.headers import StrictTransportSecurity class TestStrictTransportSecurity(unittest.TestCase): def test_default_hsts(self): """Test default Strict-Transport-Security header.""" hsts = StrictTransportSecurity() self.assertEqual(hsts.header_name, "Strict-Transport-...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_x_content_type_options.py
test_x_content_type_options.py
.py
1,162
https://github.com/TypeError/secure/blob/main/tests/headers/test_x_content_type_options.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_x_content_type_options.py
b07f2dac621b3fea7c876db756956e9c89945f97
Python
2026-05-04T01:20:38.460639
import unittest from secure.headers import XContentTypeOptions class TestXContentTypeOptions(unittest.TestCase): def test_default_x_content_type_options(self): """Test default X-Content-Type-Options header.""" x_content_type_options = XContentTypeOptions() self.assertEqual(x_content_type_...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/headers/test_x_frame_options.py
test_x_frame_options.py
.py
722
https://github.com/TypeError/secure/blob/main/tests/headers/test_x_frame_options.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/headers/test_x_frame_options.py
91d8f9a941f506b2e66166a529d394290245f1f5
Python
2026-05-04T01:20:39.688914
import unittest from secure.headers import XFrameOptions class TestXFrameOptions(unittest.TestCase): def test_default_x_frame_options(self): """Test default X-Frame-Options value (SAMEORIGIN).""" xfo = XFrameOptions() self.assertEqual(xfo.header_value, "SAMEORIGIN") def test_set_deny...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/middleware/test_middleware.py
test_middleware.py
.py
6,038
https://github.com/TypeError/secure/blob/main/tests/middleware/test_middleware.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/middleware/test_middleware.py
13fc47d3c723da11b48b343f5a01113412bc1960
Python
2026-05-04T01:20:41.019124
import asyncio from typing import Any, Literal, TypedDict, cast from secure import CustomHeader, Secure from secure.middleware import SecureASGIMiddleware, SecureWSGIMiddleware def _find_header_values(headers: list[tuple[str, str]], name: str) -> list[str]: lc = name.lower() return [value for key, value in h...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/middleware/test_secure_protocols.py
test_secure_protocols.py
.py
2,067
https://github.com/TypeError/secure/blob/main/tests/middleware/test_secure_protocols.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/middleware/test_secure_protocols.py
98e1c25cdb73f14e983c769d86ab7e020b0f15df
Python
2026-05-04T01:20:42.352156
import asyncio from typing import TYPE_CHECKING import unittest from secure import CustomHeader, Secure if TYPE_CHECKING: from collections.abc import MutableMapping class HeadersOnlyResponse: def __init__(self) -> None: self.headers: MutableMapping[str, str] = {} class SetHeaderResponse: def _...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/secure_tests/test_exports.py
test_exports.py
.py
2,140
https://github.com/TypeError/secure/blob/main/tests/secure_tests/test_exports.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/secure_tests/test_exports.py
9434783461d60191a0209a2a1586e0fa9d0ecd17
Python
2026-05-04T01:20:43.683093
import unittest import secure import secure.headers import secure.middleware class TestExportSurface(unittest.TestCase): def test_secure_package_exports(self) -> None: expected = { "COMMA_JOIN_OK", "DEFAULT_ALLOWED_HEADERS", "MULTI_OK", "CacheControl", ...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/secure_tests/test_headers.py
test_headers.py
.py
5,086
https://github.com/TypeError/secure/blob/main/tests/secure_tests/test_headers.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/secure_tests/test_headers.py
fee88849d25895604e6710cb57fae9a28bbcbd85
Python
2026-05-04T01:20:45.020686
import unittest from secure.headers import ( CacheControl, ContentSecurityPolicy, CrossOriginEmbedderPolicy, CrossOriginOpenerPolicy, CrossOriginResourcePolicy, CustomHeader, PermissionsPolicy, ReferrerPolicy, Server, StrictTransportSecurity, XContentTypeOptions, XDnsPre...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/secure_tests/test_internal_helpers.py
test_internal_helpers.py
.py
2,930
https://github.com/TypeError/secure/blob/main/tests/secure_tests/test_internal_helpers.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/secure_tests/test_internal_helpers.py
a3bf6d28252e7b4457292b289366d483537add33
Python
2026-05-04T01:20:46.244778
import asyncio import unittest from unittest import mock from secure import DEFAULT_ALLOWED_HEADERS, MULTI_OK from secure._internal.emit import set_headers_async from secure._internal.normalize import normalize_header_items from secure._internal.policy import allowlist_header_objects, deduplicate_header_objects from s...
TypeError/secure
https://github.com/TypeError/secure
https://api.github.com/repos/TypeError/secure
TypeError
secure
Modern Python library for HTTP security headers with safe defaults, configurable presets, and first-class ASGI/WSGI middleware (FastAPI, Django, Flask, Shiny, and more).
993
31
993
mit
main
2018-11-27T00:59:09
2026-05-02T04:21:58
[ "asgi", "content-security-policy", "django", "fastapi", "flask", "http-headers", "python", "security", "security-headers", "shiny", "strict-transport-security", "web-security", "wsgi" ]
{ "Python": 230402 }
false
4
tests/secure_tests/test_secure.py
test_secure.py
.py
31,352
https://github.com/TypeError/secure/blob/main/tests/secure_tests/test_secure.py
https://raw.githubusercontent.com/TypeError/secure/main/tests/secure_tests/test_secure.py
58ac70a59ddc3eb644a2e50e92ee374f9f180f6b
Python
2026-05-04T01:20:47.655275
import asyncio from collections.abc import Awaitable, Callable, Generator import unittest import secure as secure_pkg from secure import ( ContentSecurityPolicy, CustomHeader, Preset, Secure, Server, StrictTransportSecurity, ) from secure.secure import ( COMMA_JOIN_OK, DEFAULT_ALLOWED_H...
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
benchmarks/benchmark_nsa.py
benchmark_nsa.py
.py
3,150
https://github.com/fla-org/native-sparse-attention/blob/main/benchmarks/benchmark_nsa.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/benchmarks/benchmark_nsa.py
8b55b28b86ad77db906b56632bcef50d57d4e70b
Python
2026-05-04T01:20:51.772497
# -*- coding: utf-8 -*- import torch import triton from flash_attn import flash_attn_func from native_sparse_attention.ops.parallel import parallel_nsa @triton.testing.perf_report( triton.testing.Benchmark( # argument names to use as an x-axis for the plot x_names=['T'], # different poss...
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
native_sparse_attention/__init__.py
__init__.py
.py
551
https://github.com/fla-org/native-sparse-attention/blob/main/native_sparse_attention/__init__.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/native_sparse_attention/__init__.py
331ed06cabd42b6ba99155cf359cf8e5a4f54d31
Python
2026-05-04T01:20:53.000550
# -*- coding: utf-8 -*- from transformers import AutoConfig, AutoModel, AutoModelForCausalLM from native_sparse_attention.configuration_nsa import NSAConfig from native_sparse_attention.modeling_nsa import NSAForCausalLM, NSAModel from native_sparse_attention.ops.parallel import parallel_nsa AutoConfig.register(NSAC...
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
native_sparse_attention/configuration_nsa.py
configuration_nsa.py
.py
2,391
https://github.com/fla-org/native-sparse-attention/blob/main/native_sparse_attention/configuration_nsa.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/native_sparse_attention/configuration_nsa.py
f4d9de31e3feb49ff20cd3d06143d05ca41eb6c6
Python
2026-05-04T01:20:54.230377
# -*- coding: utf-8 -*- from typing import Optional from transformers.configuration_utils import PretrainedConfig class NSAConfig(PretrainedConfig): model_type = 'nsa' keys_to_ignore_at_inference = ['past_key_values'] def __init__( self, hidden_size: int = 2048, num_hidden_laye...
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
native_sparse_attention/modeling_nsa.py
modeling_nsa.py
.py
21,760
https://github.com/fla-org/native-sparse-attention/blob/main/native_sparse_attention/modeling_nsa.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/native_sparse_attention/modeling_nsa.py
3a63c31d7f027da4e58d4b95b20c727848df007d
Python
2026-05-04T01:20:55.770975
# -*- coding: utf-8 -*- from __future__ import annotations import math import warnings from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union import torch import torch.nn as nn import torch.utils.checkpoint from einops import rearrange from transformers.generation import GenerationMixin from transforme...
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
native_sparse_attention/ops/__init__.py
__init__.py
.py
141
https://github.com/fla-org/native-sparse-attention/blob/main/native_sparse_attention/ops/__init__.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/native_sparse_attention/ops/__init__.py
591b81438fbd7687f906cedb4a9be7ac45c1cf3d
Python
2026-05-04T01:20:56.995240
# -*- coding: utf-8 -*- from .naive import naive_nsa from .parallel import parallel_nsa __all__ = [ 'naive_nsa', 'parallel_nsa', ]
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
native_sparse_attention/ops/naive.py
naive.py
.py
15,739
https://github.com/fla-org/native-sparse-attention/blob/main/native_sparse_attention/ops/naive.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/native_sparse_attention/ops/naive.py
e58428515cc5cb28b6526d2c8e836892ffc8032b
Python
2026-05-04T01:20:58.736130
# -*- coding: utf-8 -*- # Copyright (c) 2023-2025, Songlin Yang, Yu Zhang import math from typing import Optional, Union import torch import torch.nn.functional as F from einops import rearrange, repeat @torch.compile def compression( k: torch.Tensor, v: torch.Tensor, block_size: int ) -> torch.Tensor: ...
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
native_sparse_attention/ops/parallel.py
parallel.py
.py
44,368
https://github.com/fla-org/native-sparse-attention/blob/main/native_sparse_attention/ops/parallel.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/native_sparse_attention/ops/parallel.py
e3bfff926c32906ab13fb7650a339d3605ab7fb9
Python
2026-05-04T01:21:00.886463
# -*- coding: utf-8 -*- # Copyright (c) 2023-2025, Songlin Yang, Yu Zhang import warnings from typing import Optional, Union import torch import triton import triton.language as tl from einops import rearrange from fla.ops.common.utils import prepare_chunk_indices, prepare_chunk_offsets, prepare_lens, prepare_token_...
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
native_sparse_attention/ops/utils.py
utils.py
.py
3,260
https://github.com/fla-org/native-sparse-attention/blob/main/native_sparse_attention/ops/utils.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/native_sparse_attention/ops/utils.py
bc0a389cb74021c3f44516fb33bb76c336486f34
Python
2026-05-04T01:21:02.218227
# -*- coding: utf-8 -*- # Copyright (c) 2023-2025, Songlin Yang, Yu Zhang # Implements argsort based on bitonic sort. # [What is bitonic sort?](https://en.wikipedia.org/wiki/Bitonic_sorter) # Code adapted from https://github.com/triton-lang/triton/issues/3698#issuecomment-2067681396 import triton import triton.langu...
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
setup.py
setup.py
.py
1,417
https://github.com/fla-org/native-sparse-attention/blob/main/setup.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/setup.py
95d41121dc16d03686d5e2c13764f4b76ea12b56
Python
2026-05-04T01:21:03.851155
# -*- coding: utf-8 -*- import ast import os import re from pathlib import Path from setuptools import find_packages, setup with open('README.md') as f: long_description = f.read() def get_package_version(): with open(Path(os.path.dirname(os.path.abspath(__file__))) / 'native_sparse_attention' / '__init__....
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
tests/test_nsa.py
test_nsa.py
.py
7,649
https://github.com/fla-org/native-sparse-attention/blob/main/tests/test_nsa.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/tests/test_nsa.py
c94c90907dac1067ff9e49c0a75bcd11f0b9f397
Python
2026-05-04T01:21:05.597088
# -*- coding: utf-8 -*- import os import pytest import torch import triton from fla.ops.common.utils import prepare_token_indices from native_sparse_attention.ops.naive import naive_nsa from native_sparse_attention.ops.parallel import parallel_nsa def get_abs_err(x, y): return (x-y).flatten().abs().max().item(...
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
tests/test_nsa_with_compression.py
test_nsa_with_compression.py
.py
6,754
https://github.com/fla-org/native-sparse-attention/blob/main/tests/test_nsa_with_compression.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/tests/test_nsa_with_compression.py
0a884ad9a60fbffe43fe7ee77e51cb3c7b91ef5d
Python
2026-05-04T01:21:07.132739
# -*- coding: utf-8 -*- import os import pytest import torch from native_sparse_attention.ops.naive import naive_nsa_with_compression from native_sparse_attention.ops.parallel import parallel_nsa_with_compression def get_abs_err(x, y): return (x-y).flatten().abs().max().item() def get_err_ratio(x, y): er...
fla-org/native-sparse-attention
https://github.com/fla-org/native-sparse-attention
https://api.github.com/repos/fla-org/native-sparse-attention
fla-org
native-sparse-attention
🐳 Efficient Triton implementations for "Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attention"
993
52
993
mit
main
2025-02-21T18:27:44
2026-04-28T13:00:38
[]
{ "Python": 142367, "Shell": 2847 }
false
5
train.py
train.py
.py
35,187
https://github.com/fla-org/native-sparse-attention/blob/main/train.py
https://raw.githubusercontent.com/fla-org/native-sparse-attention/main/train.py
67cfba5c6e2c1f70598853608ad0b753e2558081
Python
2026-05-04T01:21:08.877691
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import json import os import time from datetime import timedelta import torch from datasets import interleave_...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/learning/batcher.py
batcher.py
.py
11,281
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/learning/batcher.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/learning/batcher.py
d94e621a0ea84f6db4a34e17248feb429d7b8245
Python
2026-05-04T01:21:13.482569
import random from typing import Dict, Iterable, List, Optional, Tuple import torch from signal_slot.signal_slot import EventLoop, signal from sample_factory.algo.utils.env_info import EnvInfo from sample_factory.algo.utils.heartbeat import HeartbeatStoppableEventLoopObject from sample_factory.algo.utils.shared_buffe...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/learning/learner.py
learner.py
.py
48,659
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/learning/learner.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/learning/learner.py
c5e509366c2ad5fc8e3ef0c9da683146507d4e39
Python
2026-05-04T01:21:15.129015
from __future__ import annotations import glob import os import time from abc import ABC, abstractmethod from os.path import join from typing import Callable, Dict, Optional, Tuple import numpy as np import torch from torch import Tensor from torch.nn import Module from sample_factory.algo.learning.rnn_utils import ...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/learning/learner_worker.py
learner_worker.py
.py
5,691
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/learning/learner_worker.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/learning/learner_worker.py
cb2ded364887baf35113564e14c532b376aa6e79
Python
2026-05-04T01:21:17.904462
from __future__ import annotations import os from threading import Thread from typing import Dict, Optional import psutil import torch from signal_slot.signal_slot import EventLoop, Timer, signal from torch import Tensor from sample_factory.algo.learning.batcher import Batcher from sample_factory.algo.learning.learn...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/learning/rnn_utils.py
rnn_utils.py
.py
6,962
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/learning/rnn_utils.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/learning/rnn_utils.py
5c5c73a3eb86df34eef8dfc9c170241245cf4d61
Python
2026-05-04T01:21:19.235559
from typing import Tuple import torch # noinspection PyPep8Naming from torch.nn.utils.rnn import PackedSequence, invert_permutation from sample_factory.utils.utils import log def _build_pack_info_from_dones( dones: torch.Tensor, T: int ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor, torch.Te...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/runners/runner.py
runner.py
.py
32,480
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/runners/runner.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/runners/runner.py
de8b0fb002f362088fa2baffa56ea056d8a32c8f
Python
2026-05-04T01:21:20.710203
from __future__ import annotations import json import math import shutil import time from collections import OrderedDict, deque from os.path import isdir, join from typing import Any, Callable, Deque, Dict, List, Optional, Tuple import numpy as np from signal_slot.signal_slot import EventLoop, EventLoopObject, EventL...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/runners/runner_parallel.py
runner_parallel.py
.py
2,369
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/runners/runner_parallel.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/runners/runner_parallel.py
b16f190da771c489712ebd2ddcc741239d90f487
Python
2026-05-04T01:21:23.327908
from typing import List from signal_slot.signal_slot import EventLoop, EventLoopProcess from sample_factory.algo.learning.learner_worker import init_learner_process from sample_factory.algo.runners.runner import Runner from sample_factory.algo.sampling.sampler import ParallelSampler from sample_factory.algo.utils.con...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/runners/runner_serial.py
runner_serial.py
.py
1,154
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/runners/runner_serial.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/runners/runner_serial.py
ad99a8b2252a64278f2fa42aa35433ff7f3d3794
Python
2026-05-04T01:21:24.643427
from sample_factory.algo.runners.runner import Runner from sample_factory.algo.sampling.sampler import SerialSampler from sample_factory.algo.utils.misc import ExperimentStatus from sample_factory.algo.utils.torch_utils import init_torch_runtime from sample_factory.utils.typing import StatusCode class SerialRunner(Ru...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/sampling/batched_sampling.py
batched_sampling.py
.py
17,686
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/sampling/batched_sampling.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/sampling/batched_sampling.py
185de4e7b000be5f12501e7ef2cd98decf30c032
Python
2026-05-04T01:21:26.183085
from __future__ import annotations import numbers from queue import Empty from typing import Dict, List, Optional, Tuple import gymnasium as gym import numpy as np import torch from torch import Tensor from sample_factory.algo.sampling.sampling_utils import VectorEnvRunner, record_episode_statistics_wrapper_stats fr...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/sampling/evaluation_sampling_api.py
evaluation_sampling_api.py
.py
13,394
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/sampling/evaluation_sampling_api.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/sampling/evaluation_sampling_api.py
7524b1b25ffb81c75bca80123c18b472941bc99b
Python
2026-05-04T01:21:27.616123
from __future__ import annotations import math import time from collections import OrderedDict from threading import Thread from typing import Callable, Dict, Iterable, List, Optional, Tuple import numpy as np from signal_slot.signal_slot import EventLoop, EventLoopObject, EventLoopStatus, signal from torch import Te...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/sampling/inference_worker.py
inference_worker.py
.py
17,069
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/sampling/inference_worker.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/sampling/inference_worker.py
3a122fa8421ce20f4302a5182b88b4dea4c02303
Python
2026-05-04T01:21:28.902276
from __future__ import annotations import copy import os import time from collections import deque from queue import Empty from typing import Callable, Dict, List, Optional, Tuple import numpy as np import psutil import torch from signal_slot.signal_slot import TightLoop, Timer, signal from sample_factory.algo.utils...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/sampling/non_batched_sampling.py
non_batched_sampling.py
.py
31,367
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/sampling/non_batched_sampling.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/sampling/non_batched_sampling.py
54b26b85f3c419e82e3fcfb5a719febc199572a6
Python
2026-05-04T01:21:30.379150
from __future__ import annotations import random from queue import Empty from typing import Any, Dict, List, Optional, Tuple import gymnasium as gym import numpy as np from sample_factory.algo.sampling.sampling_utils import VectorEnvRunner, record_episode_statistics_wrapper_stats from sample_factory.algo.utils.agent...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/sampling/rollout_worker.py
rollout_worker.py
.py
14,913
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/sampling/rollout_worker.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/sampling/rollout_worker.py
f32dc1bf116eff23c1cd0a82e22c33ee0c665c44
Python
2026-05-04T01:21:31.881257
from __future__ import annotations import os import time from typing import Any, Dict, List, Optional import psutil import torch from signal_slot.signal_slot import signal from sample_factory.algo.sampling.batched_sampling import BatchedVectorEnvRunner from sample_factory.algo.sampling.non_batched_sampling import No...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/sampling/sampler.py
sampler.py
.py
12,914
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/sampling/sampler.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/sampling/sampler.py
23dbd3a2a7746ed5a0cd4306a706038363226350
Python
2026-05-04T01:21:33.398810
from abc import ABC from typing import Callable, Dict, List from signal_slot.queue_utils import get_queue from signal_slot.signal_slot import BoundMethod, EventLoop, EventLoopObject, EventLoopProcess, signal from sample_factory.algo.sampling.inference_worker import InferenceWorker, init_inference_process from sample_...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/sampling/sampling_utils.py
sampling_utils.py
.py
2,773
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/sampling/sampling_utils.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/sampling/sampling_utils.py
31345f04e6a9a56708004706d12fcd31f5bffe14
Python
2026-05-04T01:21:34.781612
from __future__ import annotations from typing import Dict, List, Optional, Tuple import torch from sample_factory.algo.utils.env_info import EnvInfo from sample_factory.cfg.configurable import Configurable from sample_factory.utils.attr_dict import AttrDict from sample_factory.utils.gpu_utils import gpus_for_proces...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/sampling/stats.py
stats.py
.py
1,319
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/sampling/stats.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/sampling/stats.py
f8271dc67c35d6798396c39202c6059e09754984
Python
2026-05-04T01:21:36.024723
""" Some reusable code for stats collection. StatsObservers are usually "Runner" objects, but they can be anything that can accumulate stats, see evaluation_sampling_api.py for an example of a custom stats observer. """ from collections import deque from typing import Any from sample_factory.algo.utils.misc import SA...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/sampling/sync_sampling_api.py
sync_sampling_api.py
.py
2,754
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/sampling/sync_sampling_api.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/sampling/sync_sampling_api.py
5a92420891a0a3c03542c817cd4ec677b981ed93
Python
2026-05-04T01:21:37.457293
from __future__ import annotations from queue import Empty, Full, Queue from threading import Thread from typing import Dict, Iterable, Optional from sample_factory.algo.sampling.evaluation_sampling_api import SamplingLoop from sample_factory.algo.utils.env_info import EnvInfo from sample_factory.algo.utils.model_sha...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/action_distributions.py
action_distributions.py
.py
12,169
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/action_distributions.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/action_distributions.py
b279aeb3ab8b35a17d92e4e8c1eb53a4c0c5d9aa
Python
2026-05-04T01:21:38.818518
import math import gymnasium as gym import numpy as np import torch from torch import Tensor from torch.distributions import Independent, Normal from torch.nn import functional from sample_factory.utils.typing import ActionSpace from sample_factory.utils.utils import log def calc_num_actions(action_space): if i...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/agent_policy_mapping.py
agent_policy_mapping.py
.py
2,839
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/agent_policy_mapping.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/agent_policy_mapping.py
b6043b7da0a2fb3bc2c2b1f3837d56aef07d006c
Python
2026-05-04T01:21:40.004235
import random import numpy as np from sample_factory.algo.utils.env_info import EnvInfo from sample_factory.algo.utils.rl_utils import total_num_envs from sample_factory.utils.typing import Config class AgentPolicyMapping: """ This class currently implements the most simple mapping between agents in the env...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/context.py
context.py
.py
1,155
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/context.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/context.py
50426d1996bf3732402b9809dcc36b22e6ea572a
Python
2026-05-04T01:21:41.643055
from typing import Dict from sample_factory.model.model_factory import ModelFactory from sample_factory.utils.typing import CreateEnvFunc class SampleFactoryContext: def __init__(self): self.env_registry = dict() self.model_factory = ModelFactory() GLOBAL_CONTEXT = None def sf_global_context(...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/env_info.py
env_info.py
.py
4,868
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/env_info.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/env_info.py
2372a74818869ec4c6a938b19ccaa677a62c3f16
Python
2026-05-04T01:21:43.201618
from __future__ import annotations import multiprocessing import os import pickle from dataclasses import dataclass from os.path import join from typing import Dict, List, Optional import gymnasium as gym from sample_factory.algo.utils.action_distributions import calc_num_actions from sample_factory.algo.utils.conte...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/gymnasium_utils.py
gymnasium_utils.py
.py
4,491
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/gymnasium_utils.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/gymnasium_utils.py
d8a83cbe6d1713c0b15153d97d9e3e4fe112f8ac
Python
2026-05-04T01:21:44.408206
""" Compatibility layer for Gym -> Gymnasium transition. Adapted from Stable Baselines3, Tianshou, and Shimmy https://github.com/Farama-Foundation/Shimmy """ import warnings from inspect import signature from typing import Union import gymnasium from sample_factory.utils.utils import log try: import gym # pyty...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/heartbeat.py
heartbeat.py
.py
1,170
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/heartbeat.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/heartbeat.py
64b66ce01724b5fe864cb43d1c34f351c17c33bb
Python
2026-05-04T01:21:45.645201
from signal_slot.signal_slot import EventLoop, EventLoopObject, Timer, process_name, signal from sample_factory.utils.utils import log class HeartbeatStoppableEventLoopObject(EventLoopObject): def __init__(self, evt_loop: EventLoop, unique_name: str, interval_sec: int = 10): EventLoopObject.__init__(self...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/make_env.py
make_env.py
.py
15,276
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/make_env.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/make_env.py
d5decc3374b89e97ffca2036ab1c9a31e85717d8
Python
2026-05-04T01:21:47.056445
from __future__ import annotations from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import gymnasium as gym import numpy as np import torch from gymnasium import Wrapper, spaces from gymnasium.core import ActType, ObsType from torch import Tensor from sample_factory.algo.utils.tensor_ut...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/misc.py
misc.py
.py
1,086
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/misc.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/misc.py
8fd0c0dfac24a2f647f58f7ecc33bee8b7b42b8a
Python
2026-05-04T01:21:48.401770
import torch from sample_factory.utils.typing import PolicyID from sample_factory.utils.utils import memory_consumption_mb EPS = 1e-8 # stats dictionary keys EPISODIC = "episodic" LEARNER_ENV_STEPS = "learner_env_steps" TRAIN_STATS = "train" TIMING_STATS = "timing" STATS_KEY = "stats" SAMPLES_COLLECTED = "samples_c...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/model_sharing.py
model_sharing.py
.py
6,052
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/model_sharing.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/model_sharing.py
ae77c50d269c9d0800740bbf4921fd9b5667c071
Python
2026-05-04T01:21:49.720923
""" Utilities for sharing model parameters between components. """ import sys from typing import Optional import torch from torch import Tensor from sample_factory.algo.utils.multiprocessing_utils import get_lock, get_mp_ctx from sample_factory.model.actor_critic import create_actor_critic from sample_factory.utils....
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/multiprocessing_utils.py
multiprocessing_utils.py
.py
886
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/multiprocessing_utils.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/multiprocessing_utils.py
4909480e9934a5606e7fa56fccea314ba51f6f0a
Python
2026-05-04T01:21:50.962833
import multiprocessing from multiprocessing.context import BaseContext from typing import Optional from sample_factory.utils.utils import static_vars @static_vars(mp_ctx=None) def get_mp_ctx(serial: bool) -> Optional[BaseContext]: if serial: return None if get_mp_ctx.mp_ctx is None: get_mp_c...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/optimizers.py
optimizers.py
.py
6,270
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/optimizers.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/optimizers.py
5128c6e19af9402090dcf735ec4bd3c5246ff3fc
Python
2026-05-04T01:21:52.311822
""" Courtesy of https://github.com/shacklettbp/bps-nav See section 3.4 in https://arxiv.org/pdf/2103.07013.pdf """ import math from typing import Callable, Optional, Tuple import torch from torch.optim import Optimizer class Lamb(Optimizer): def __init__( self, params, bias_correction=T...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/rl_utils.py
rl_utils.py
.py
3,805
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/rl_utils.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/rl_utils.py
c4af3e8677f809d5eb8f6655b8f94a4d157bc056
Python
2026-05-04T01:21:53.624210
from __future__ import annotations from typing import Dict, Optional, Sequence, Union import numpy as np import torch from torch import Tensor from torch.nn import Module from sample_factory.algo.utils.env_info import EnvInfo from sample_factory.algo.utils.tensor_dict import TensorDict from sample_factory.algo.utils...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/running_mean_std.py
running_mean_std.py
.py
5,907
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/running_mean_std.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/running_mean_std.py
fd3173a5da4c59afad75b3ed86f5376c3eec672e
Python
2026-05-04T01:21:55.007199
""" PyTorch module that keeps track of tensor statistics and uses it to normalize data. All credit goes to https://github.com/Denys88/rl_games (only slightly changed here, mostly with in-place operations) Thanks a lot, great module! """ from typing import Dict, Final, List, Optional, Union import gymnasium as gym imp...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/shared_buffers.py
shared_buffers.py
.py
11,124
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/shared_buffers.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/shared_buffers.py
01a5ea718a3eef4fb44f1f65dae76f37003456d7
Python
2026-05-04T01:21:56.491448
from __future__ import annotations import math from typing import Dict, List, Tuple import torch from gymnasium import spaces from signal_slot.queue_utils import get_queue from torch import Tensor from sample_factory.algo.sampling.sampling_utils import rollout_worker_device from sample_factory.algo.utils.action_dist...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/spaces/discretized.py
discretized.py
.py
449
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/spaces/discretized.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/spaces/discretized.py
3cc9f404e1758d1458e0d78be6fafc58b2d94ead
Python
2026-05-04T01:21:57.822535
from gymnasium.spaces import Discrete class Discretized(Discrete): def __init__(self, n, min_action, max_action): super().__init__(n) self.min_action = min_action self.max_action = max_action def to_continuous(self, discrete_action): step = (self.max_action - self.min_action)...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/tensor_dict.py
tensor_dict.py
.py
5,277
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/tensor_dict.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/tensor_dict.py
fe38c6443449772a55dff5951d5bd3b0a91b9b8b
Python
2026-05-04T01:21:58.982779
from __future__ import annotations from typing import Dict, Iterable, List, Optional import numpy as np import torch from torch import Tensor from sample_factory.algo.utils.misc import MAGIC_FLOAT, MAGIC_INT from sample_factory.utils.dicts import ( copy_dict_structure, iter_dicts_recursively, iterate_rec...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/tensor_utils.py
tensor_utils.py
.py
1,081
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/tensor_utils.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/tensor_utils.py
1efbbf0aafba9b9c3cbbf76203e850f91dddccf4
Python
2026-05-04T01:22:00.178378
from __future__ import annotations from typing import Any, Dict, List import numpy as np import torch from torch import Tensor def clone_tensor(t: Tensor | np.ndarray) -> Tensor | np.ndarray: if isinstance(t, Tensor): return t.clone().detach() else: return np.copy(t) def unsqueeze_tensor(t...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/algo/utils/torch_utils.py
torch_utils.py
.py
1,741
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/algo/utils/torch_utils.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/algo/utils/torch_utils.py
b587320f0130f75e5c956542088302d326f345b9
Python
2026-05-04T01:22:01.509185
from __future__ import annotations from typing import Optional import numpy as np import torch from sample_factory.utils.attr_dict import AttrDict from sample_factory.utils.typing import Config def init_torch_runtime(cfg: AttrDict, max_num_threads: Optional[int] = 1): torch.multiprocessing.set_sharing_strategy...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/cfg/arguments.py
arguments.py
.py
11,454
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/cfg/arguments.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/cfg/arguments.py
fdba29eac242b22ce5bea5cc8e5560885e31f43f
Python
2026-05-04T01:22:03.045223
import argparse import copy import json import os import sys from typing import List, Optional, Tuple from sample_factory.algo.utils.env_info import EnvInfo from sample_factory.algo.utils.rl_utils import total_num_agents from sample_factory.cfg.cfg import ( add_basic_cli_args, add_default_env_args, add_eva...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/cfg/cfg.py
cfg.py
.py
36,348
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/cfg/cfg.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/cfg/cfg.py
dbbd3f1fc4a881bcf8ca4d7fc0a36c166e578a9b
Python
2026-05-04T01:22:04.651985
import multiprocessing import os from argparse import ArgumentParser from os.path import join from sample_factory.utils.utils import str2bool def add_basic_cli_args(p: ArgumentParser): p.add_argument("-h", "--help", action="store_true", help="Print the help message", required=False) p.add_argument("--algo", ...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/cfg/configurable.py
configurable.py
.py
146
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/cfg/configurable.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/cfg/configurable.py
1c7329e11be1195301711cae69fc49cb56a6b809
Python
2026-05-04T01:22:05.754670
from sample_factory.utils.attr_dict import AttrDict class Configurable: def __init__(self, cfg: AttrDict): self.cfg: AttrDict = cfg
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/enjoy.py
enjoy.py
.py
11,979
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/enjoy.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/enjoy.py
cd927ef33bcb143f2522a817f7f294cc74e18d2c
Python
2026-05-04T01:22:07.393268
import time from collections import deque from typing import Dict, Optional, Tuple import gymnasium as gym import numpy as np import torch from torch import Tensor from sample_factory.algo.learning.learner import Learner from sample_factory.algo.sampling.batched_sampling import preprocess_actions from sample_factory....
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/envs/create_env.py
create_env.py
.py
1,685
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/envs/create_env.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/envs/create_env.py
c38c0fe5264bf1379aa948814720e0f2143e6a53
Python
2026-05-04T01:22:08.676952
from __future__ import annotations from typing import Optional from sample_factory.algo.utils.context import global_env_registry from sample_factory.algo.utils.gymnasium_utils import patch_non_gymnasium_env from sample_factory.envs.env_wrappers import EpisodeCounterWrapper from sample_factory.utils.attr_dict import A...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/envs/env_utils.py
env_utils.py
.py
5,247
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/envs/env_utils.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/envs/env_utils.py
12835a54ca088a9aff25fd65f0e10a01c5740af7
Python
2026-05-04T01:22:10.009230
from __future__ import annotations from functools import wraps from time import sleep from typing import Any, Dict, Optional from sample_factory.algo.utils.context import global_env_registry from sample_factory.utils.typing import CreateEnvFunc from sample_factory.utils.utils import is_module_available, log def reg...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/envs/env_wrappers.py
env_wrappers.py
.py
16,234
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/envs/env_wrappers.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/envs/env_wrappers.py
5326df053429acd195f60d4706090d33aa56251a
Python
2026-05-04T01:22:11.547136
""" Gym env wrappers that make the environment suitable for the RL algorithms. """ import json import os from os.path import join from typing import Any, Dict, Tuple, Union import cv2 import gymnasium as gym import numpy as np from gymnasium import ObservationWrapper, RewardWrapper, spaces from sample_factory.envs....
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/envs/pettingzoo_envs.py
pettingzoo_envs.py
.py
2,931
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/envs/pettingzoo_envs.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/envs/pettingzoo_envs.py
2571b40fcf24c2f3d39ff741ab84748b2578220d
Python
2026-05-04T01:22:12.875574
""" Gym env wrappers for PettingZoo -> Gymnasium transition. """ import gymnasium as gym class PettingZooParallelEnv(gym.Env): def __init__(self, env): if not all_equal([env.observation_space(a) for a in env.possible_agents]): raise ValueError("All observation spaces must be equal") ...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/eval.py
eval.py
.py
4,419
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/eval.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/eval.py
7f128ab284f5c90e0cf05e93ebcb9e71c58850e1
Python
2026-05-04T01:22:14.116810
import json import time from collections import deque from pathlib import Path from typing import Deque import numpy as np import pandas as pd from signal_slot.signal_slot import StatusCode from sample_factory.algo.sampling.evaluation_sampling_api import EvalSamplingAPI from sample_factory.algo.utils.env_info import ...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/export_onnx.py
export_onnx.py
.py
7,026
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/export_onnx.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/export_onnx.py
b3bbe6fcc08cbdc1719a69ab4a77550d67d05cad
Python
2026-05-04T01:22:15.411460
import types from typing import List import gymnasium as gym import torch import torch.nn as nn import torch.onnx from torch import Tensor from sample_factory.algo.learning.learner import Learner from sample_factory.algo.sampling.batched_sampling import preprocess_actions from sample_factory.algo.utils.action_distrib...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/huggingface/huggingface_utils.py
huggingface_utils.py
.py
4,762
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/huggingface/huggingface_utils.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/huggingface/huggingface_utils.py
2f3d60eaad1754f1117b3c2f4847300ec585e569
Python
2026-05-04T01:22:16.767586
import os import cv2 import numpy as np from huggingface_hub import HfApi, Repository, repocard, upload_folder from sample_factory.utils.typing import Config from sample_factory.utils.utils import log, project_tmp_dir MIN_FRAME_SIZE = 180 def generate_replay_video(dir_path: str, frames: list, fps: int, cfg: Config...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/huggingface/load_from_hub.py
load_from_hub.py
.py
669
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/huggingface/load_from_hub.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/huggingface/load_from_hub.py
408d817e073e412c611c52a6b107af6ae6c5f289
Python
2026-05-04T01:22:18.098206
import argparse from sample_factory.huggingface.huggingface_utils import load_from_hf def main(): parser = argparse.ArgumentParser() parser.add_argument( "-r", "--hf_repository", help="Repo id of the model repository from the Hugging Face Hub in the form user_name/repo_name", ...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/huggingface/push_to_hub.py
push_to_hub.py
.py
1,884
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/huggingface/push_to_hub.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/huggingface/push_to_hub.py
4f2666433fe2a76ab0c5a0a23c3cff5ca7f729d6
Python
2026-05-04T01:22:19.429360
import argparse import json import os import sys from sample_factory.huggingface.huggingface_utils import generate_model_card, push_to_hf from sample_factory.utils.attr_dict import AttrDict def main(): parser = argparse.ArgumentParser() parser.add_argument( "-r", "--hf_repository", he...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/launcher/launcher_utils.py
launcher_utils.py
.py
154
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/launcher/launcher_utils.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/launcher/launcher_utils.py
36e7279f5fefb9d9e39af1a6e014b8b894193e3e
Python
2026-05-04T01:22:20.760712
import random from typing import List def seeds(num_seeds: int) -> List[int]: return [random.randrange(1000000, 9999999) for _ in range(num_seeds)]
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/launcher/run.py
run.py
.py
2,742
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/launcher/run.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/launcher/run.py
06ef7441fadf1b5673906b1f4d8a145b07419442
Python
2026-05-04T01:22:22.091698
import argparse import importlib import sys from sample_factory.algo.utils.misc import ExperimentStatus from sample_factory.launcher.run_ngc import add_ngc_args, run_ngc from sample_factory.launcher.run_processes import add_os_parallelism_args, run from sample_factory.launcher.run_slurm import add_slurm_args, run_slur...
alex-petrenko/sample-factory
https://github.com/alex-petrenko/sample-factory
https://api.github.com/repos/alex-petrenko/sample-factory
alex-petrenko
sample-factory
High throughput synchronous and asynchronous reinforcement learning
993
149
993
mit
master
2019-06-20T00:59:01
2026-05-03T15:40:19
[ "reinforcement-learning" ]
{ "Python": 959582, "Jupyter Notebook": 7779, "Shell": 1969, "Makefile": 1668 }
false
32
sample_factory/launcher/run_description.py
run_description.py
.py
7,490
https://github.com/alex-petrenko/sample-factory/blob/master/sample_factory/launcher/run_description.py
https://raw.githubusercontent.com/alex-petrenko/sample-factory/master/sample_factory/launcher/run_description.py
0f10f65334a133664c9f8f50cd1d9f79faf31b08
Python
2026-05-04T01:22:23.628153
import os import re from collections import OrderedDict from os.path import join import numpy as np from sample_factory.utils.utils import log class ParamGenerator: def __init__(self): pass def generate_params(self, randomize=True): """Supposed to be a generator (so should yield dicts of pa...
agiresearch/A-mem
https://github.com/agiresearch/A-mem
https://api.github.com/repos/agiresearch/A-mem
agiresearch
A-mem
A-MEM: Agentic Memory for LLM Agents
994
108
994
mit
main
2025-02-25T20:13:43
2026-05-03T18:52:12
[ "agent", "llm", "memory" ]
{ "Python": 65870 }
false
13
agentic_memory/llm_controller.py
llm_controller.py
.py
3,810
https://github.com/agiresearch/A-mem/blob/main/agentic_memory/llm_controller.py
https://raw.githubusercontent.com/agiresearch/A-mem/main/agentic_memory/llm_controller.py
6211f6100e1cba75462c94fcd07f49d5edcd6e09
Python
2026-05-04T01:22:28.586553
from typing import Dict, Optional, Literal, Any import os import json from abc import ABC, abstractmethod from litellm import completion class BaseLLMController(ABC): @abstractmethod def get_completion(self, prompt: str) -> str: """Get completion from LLM""" pass class OpenAIController(BaseLLM...
agiresearch/A-mem
https://github.com/agiresearch/A-mem
https://api.github.com/repos/agiresearch/A-mem
agiresearch
A-mem
A-MEM: Agentic Memory for LLM Agents
994
108
994
mit
main
2025-02-25T20:13:43
2026-05-03T18:52:12
[ "agent", "llm", "memory" ]
{ "Python": 65870 }
false
13
agentic_memory/memory_system.py
memory_system.py
.py
32,697
https://github.com/agiresearch/A-mem/blob/main/agentic_memory/memory_system.py
https://raw.githubusercontent.com/agiresearch/A-mem/main/agentic_memory/memory_system.py
594b2f94c2bbdccc439f8294aa797a1e22d9db56
Python
2026-05-04T01:22:31.291208
import keyword from typing import List, Dict, Optional, Any, Tuple import uuid from datetime import datetime from .llm_controller import LLMController from .retrievers import ChromaRetriever import json import logging from rank_bm25 import BM25Okapi from sentence_transformers import SentenceTransformer import numpy as ...
agiresearch/A-mem
https://github.com/agiresearch/A-mem
https://api.github.com/repos/agiresearch/A-mem
agiresearch
A-mem
A-MEM: Agentic Memory for LLM Agents
994
108
994
mit
main
2025-02-25T20:13:43
2026-05-03T18:52:12
[ "agent", "llm", "memory" ]
{ "Python": 65870 }
false
13
agentic_memory/retrievers.py
retrievers.py
.py
10,661
https://github.com/agiresearch/A-mem/blob/main/agentic_memory/retrievers.py
https://raw.githubusercontent.com/agiresearch/A-mem/main/agentic_memory/retrievers.py
3fdc993c91885755cef7b4a036dc69aeeafd1e3c
Python
2026-05-04T01:22:32.741512
import json from pathlib import Path from typing import Dict, List, Optional import ast import tempfile import atexit import chromadb from chromadb.config import Settings from chromadb.utils.embedding_functions import SentenceTransformerEmbeddingFunction from nltk.tokenize import word_tokenize def simple_tokenize(te...
agiresearch/A-mem
https://github.com/agiresearch/A-mem
https://api.github.com/repos/agiresearch/A-mem
agiresearch
A-mem
A-MEM: Agentic Memory for LLM Agents
994
108
994
mit
main
2025-02-25T20:13:43
2026-05-03T18:52:12
[ "agent", "llm", "memory" ]
{ "Python": 65870 }
false
13
examples/sovereign_memory.py
sovereign_memory.py
.py
1,700
https://github.com/agiresearch/A-mem/blob/main/examples/sovereign_memory.py
https://raw.githubusercontent.com/agiresearch/A-mem/main/examples/sovereign_memory.py
21c61d74556229d3ec7eea0f9014c73bbe54c535
Python
2026-05-04T01:22:33.969964
import os import sys # Ensure we can import from source sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from agentic_memory.memory_system import AgenticMemorySystem def main(): print("🧠 Initializing A-mem Sovereign System (Local)...") # Initialize with local backend # N...
agiresearch/A-mem
https://github.com/agiresearch/A-mem
https://api.github.com/repos/agiresearch/A-mem
agiresearch
A-mem
A-MEM: Agentic Memory for LLM Agents
994
108
994
mit
main
2025-02-25T20:13:43
2026-05-03T18:52:12
[ "agent", "llm", "memory" ]
{ "Python": 65870 }
false
13
tests/conftest.py
conftest.py
.py
1,376
https://github.com/agiresearch/A-mem/blob/main/tests/conftest.py
https://raw.githubusercontent.com/agiresearch/A-mem/main/tests/conftest.py
e18a804379b2ce4bfd8891822729c02009583e55
Python
2026-05-04T01:22:35.301476
import pytest import tempfile import shutil from pathlib import Path from agentic_memory.retrievers import ChromaRetriever, PersistentChromaRetriever @pytest.fixture def retriever(): """Fixture providing a clean ChromaRetriever instance.""" retriever = ChromaRetriever(collection_name="test_memories") yie...
agiresearch/A-mem
https://github.com/agiresearch/A-mem
https://api.github.com/repos/agiresearch/A-mem
agiresearch
A-mem
A-MEM: Agentic Memory for LLM Agents
994
108
994
mit
main
2025-02-25T20:13:43
2026-05-03T18:52:12
[ "agent", "llm", "memory" ]
{ "Python": 65870 }
false
13
tests/test_memory_system.py
test_memory_system.py
.py
10,019
https://github.com/agiresearch/A-mem/blob/main/tests/test_memory_system.py
https://raw.githubusercontent.com/agiresearch/A-mem/main/tests/test_memory_system.py
03c8b898bdf08f73f897197c463ae164b92d4c74
Python
2026-05-04T01:22:36.837764
import unittest from agentic_memory.memory_system import AgenticMemorySystem, MemoryNote from datetime import datetime class TestAgenticMemorySystem(unittest.TestCase): def setUp(self): """Set up test environment before each test.""" self.memory_system = AgenticMemorySystem( model_name=...
agiresearch/A-mem
https://github.com/agiresearch/A-mem
https://api.github.com/repos/agiresearch/A-mem
agiresearch
A-mem
A-MEM: Agentic Memory for LLM Agents
994
108
994
mit
main
2025-02-25T20:13:43
2026-05-03T18:52:12
[ "agent", "llm", "memory" ]
{ "Python": 65870 }
false
13
tests/test_retriever.py
test_retriever.py
.py
6,647
https://github.com/agiresearch/A-mem/blob/main/tests/test_retriever.py
https://raw.githubusercontent.com/agiresearch/A-mem/main/tests/test_retriever.py
f8227d901c4ee80b28100d9faec4844bcc811655
Python
2026-05-04T01:22:38.485985
import pytest from agentic_memory.retrievers import PersistentChromaRetriever def test_initialization(retriever): """Test ChromaRetriever initializes correctly.""" assert retriever.collection is not None assert retriever.embedding_function is not None def test_add_document(retriever, sample_metadata): ...
agiresearch/A-mem
https://github.com/agiresearch/A-mem
https://api.github.com/repos/agiresearch/A-mem
agiresearch
A-mem
A-MEM: Agentic Memory for LLM Agents
994
108
994
mit
main
2025-02-25T20:13:43
2026-05-03T18:52:12
[ "agent", "llm", "memory" ]
{ "Python": 65870 }
false
13
tests/test_utils.py
test_utils.py
.py
658
https://github.com/agiresearch/A-mem/blob/main/tests/test_utils.py
https://raw.githubusercontent.com/agiresearch/A-mem/main/tests/test_utils.py
778c2d30a05866f5d772138b0bfc6514a749c2a9
Python
2026-05-04T01:22:39.921727
"""Test utilities for the memory system.""" from typing import List from agentic_memory.llm_controller import BaseLLMController class MockLLMController(BaseLLMController): """Mock LLM controller for testing""" def __init__(self): self.mock_response = "{}" def get_completion(self, prompt: s...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
examples/chatgpt-clone/app.py
app.py
.py
2,570
https://github.com/ajndkr/lanarky/blob/main/examples/chatgpt-clone/app.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/examples/chatgpt-clone/app.py
5d7d89a2fd6cc4cca6392d58cf7ee1c3c9d3f219
Python
2026-05-04T01:22:44.210865
import gradio as gr from lanarky import Lanarky from lanarky.adapters.openai.resources import ChatCompletionResource from lanarky.adapters.openai.routing import OpenAIAPIRouter from lanarky.clients import StreamingClient app = Lanarky() router = OpenAIAPIRouter() @router.post("/chat") def chat(system: str = "You ar...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
examples/paulGPT/app.py
app.py
.py
3,037
https://github.com/ajndkr/lanarky/blob/main/examples/paulGPT/app.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/examples/paulGPT/app.py
ab1f00a9def48d31dfa635b3b7234a00bbb9b349
Python
2026-05-04T01:22:45.446318
import json import gradio as gr from langchain.chains import RetrievalQA from langchain.chat_models import ChatOpenAI from langchain.embeddings.openai import OpenAIEmbeddings from langchain.vectorstores.faiss import FAISS from lanarky import Lanarky from lanarky.adapters.langchain.routing import LangchainAPIRouter fr...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/langchain/__init__.py
__init__.py
.py
174
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/langchain/__init__.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/langchain/__init__.py
64e76440403200416b5df620eea1fe35aafb6232
Python
2026-05-04T01:22:46.771115
from importlib.util import find_spec if not find_spec("langchain"): raise ImportError( "run `pip install lanarky[langchain]` to use the langchain adapter" )
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/langchain/callbacks.py
callbacks.py
.py
15,037
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/langchain/callbacks.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/langchain/callbacks.py
48c1f1443e0966cdfdc95db0763324c263b8c1a7
Python
2026-05-04T01:22:48.164648
from typing import Any, Optional from fastapi.websockets import WebSocket from langchain.callbacks.base import AsyncCallbackHandler from langchain.callbacks.streaming_stdout_final_only import ( FinalStreamingStdOutCallbackHandler, ) from langchain.globals import get_llm_cache from langchain.schema.document import ...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/langchain/dependencies.py
dependencies.py
.py
1,293
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/langchain/dependencies.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/langchain/dependencies.py
e401afe546782aa3ddd4bb6a2e07d7a80ca68b81
Python
2026-05-04T01:22:49.369975
from typing import Any, Callable, Optional from fastapi import params from langchain.chains.base import Chain from lanarky.adapters.langchain.utils import create_request_model, create_response_model from lanarky.utils import model_dump def Depends( dependency: Optional[Callable[..., Any]], *, dependency...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/langchain/responses.py
responses.py
.py
3,408
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/langchain/responses.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/langchain/responses.py
f2a1ce2b134b9e12eda52b7a3796f51f9ea00956
Python
2026-05-04T01:22:50.662418
import asyncio from functools import partial from typing import Any from fastapi import status from langchain.chains.base import Chain from starlette.types import Send from lanarky.events import Events, ServerSentEvent, ensure_bytes from lanarky.logging import logger from lanarky.responses import HTTPStatusDetail fro...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/langchain/routing.py
routing.py
.py
3,375
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/langchain/routing.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/langchain/routing.py
83ab8a1d8bb8ec10e9ab0bab7851ad78bfed5456
Python
2026-05-04T01:22:51.829647
import inspect from typing import Any, Callable, Optional, Sequence from fastapi import params from fastapi.datastructures import Default from fastapi.routing import APIRoute, APIRouter, APIWebSocketRoute from .utils import build_factory_api_endpoint, build_factory_websocket_endpoint class LangchainAPIRoute(APIRout...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/langchain/utils.py
utils.py
.py
7,915
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/langchain/utils.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/langchain/utils.py
b20967d974002f3b9cf3f4985de077201714263f
Python
2026-05-04T01:22:53.055475
import re from typing import Any, Awaitable, Callable from fastapi import Depends from langchain.agents import AgentExecutor from langchain.chains.base import Chain from langchain.schema.document import Document from pydantic import BaseModel, create_model from starlette.routing import compile_path from lanarky.adapt...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/openai/__init__.py
__init__.py
.py
151
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/openai/__init__.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/openai/__init__.py
1d28f1c39ad23bbc8ffb0a7a68b3847946d444ce
Python
2026-05-04T01:22:54.348812
from importlib.util import find_spec if not find_spec("openai"): raise ImportError("run `pip install lanarky[openai]` to use the openai adapter")
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/openai/dependencies.py
dependencies.py
.py
1,356
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/openai/dependencies.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/openai/dependencies.py
769e20ab4381dbe7e7a9313d76a338e3ae4c8ced
Python
2026-05-04T01:22:55.680551
from typing import Any, Callable, Optional from fastapi import params from lanarky.utils import model_dump from .resources import OpenAIResource from .utils import create_request_model, create_response_model def Depends( dependency: Optional[Callable[..., Any]], *, dependency_kwargs: dict[str, Any] = {...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/openai/resources.py
resources.py
.py
3,565
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/openai/resources.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/openai/resources.py
438aaab7b8bfd42bd7b61991c3852f47d05d4a23
Python
2026-05-04T01:22:57.011555
from abc import abstractmethod from typing import Any, Generator from openai import AsyncOpenAI from openai.types.chat import ChatCompletion, ChatCompletionChunk from pydantic import BaseModel, Field from lanarky.utils import model_dump class Message(BaseModel): role: str = Field(pattern=r"^(user|assistant)$") ...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/openai/responses.py
responses.py
.py
2,731
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/openai/responses.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/openai/responses.py
4aec17458af12e5bd56a8b26f21a5345d685b25a
Python
2026-05-04T01:22:58.343553
from typing import Any from fastapi import status from starlette.types import Send from lanarky.adapters.openai.resources import Message from lanarky.events import Events, ServerSentEvent, ensure_bytes from lanarky.logging import logger from lanarky.responses import HTTPStatusDetail from lanarky.responses import Stre...
ajndkr/lanarky
https://github.com/ajndkr/lanarky
https://api.github.com/repos/ajndkr/lanarky
ajndkr
lanarky
The web framework for building LLM microservices [deprecated]
992
76
992
mit
main
2023-04-07T05:36:32
2026-04-27T21:23:15
[ "deprecated-repo", "fastapi", "llmops", "microservices", "python3", "web" ]
{ "Python": 92508, "Makefile": 1101 }
false
9
lanarky/adapters/openai/routing.py
routing.py
.py
3,405
https://github.com/ajndkr/lanarky/blob/main/lanarky/adapters/openai/routing.py
https://raw.githubusercontent.com/ajndkr/lanarky/main/lanarky/adapters/openai/routing.py
579fc5656aa42f8fed484691e7282983e798be94
Python
2026-05-04T01:22:59.571406
import inspect from typing import Any, Callable, Optional, Sequence from fastapi import params from fastapi.datastructures import Default from fastapi.routing import APIRoute, APIRouter, APIWebSocketRoute from .utils import build_factory_api_endpoint, build_factory_websocket_endpoint class OpenAIAPIRoute(APIRoute):...