repo
stringlengths
7
90
file_url
stringlengths
81
315
file_path
stringlengths
4
228
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:38:15
2026-01-05 02:33:18
truncated
bool
2 classes
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/search/google_search.py
app/tool/search/google_search.py
from typing import List from googlesearch import search from app.tool.search.base import SearchItem, WebSearchEngine class GoogleSearchEngine(WebSearchEngine): def perform_search( self, query: str, num_results: int = 10, *args, **kwargs ) -> List[SearchItem]: """ Google search engine...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/search/baidu_search.py
app/tool/search/baidu_search.py
from typing import List from baidusearch.baidusearch import search from app.tool.search.base import SearchItem, WebSearchEngine class BaiduSearchEngine(WebSearchEngine): def perform_search( self, query: str, num_results: int = 10, *args, **kwargs ) -> List[SearchItem]: """ Baidu sear...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/search/__init__.py
app/tool/search/__init__.py
from app.tool.search.baidu_search import BaiduSearchEngine from app.tool.search.base import WebSearchEngine from app.tool.search.bing_search import BingSearchEngine from app.tool.search.duckduckgo_search import DuckDuckGoSearchEngine from app.tool.search.google_search import GoogleSearchEngine __all__ = [ "WebSea...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/search/base.py
app/tool/search/base.py
from typing import List, Optional from pydantic import BaseModel, Field class SearchItem(BaseModel): """Represents a single search result item""" title: str = Field(description="The title of the search result") url: str = Field(description="The URL of the search result") description: Optional[str] =...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/search/bing_search.py
app/tool/search/bing_search.py
from typing import List, Optional, Tuple import requests from bs4 import BeautifulSoup from app.logger import logger from app.tool.search.base import SearchItem, WebSearchEngine ABSTRACT_MAX_LENGTH = 300 USER_AGENTS = [ "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/sandbox/sb_shell_tool.py
app/tool/sandbox/sb_shell_tool.py
import asyncio import time from typing import Any, Dict, Optional, TypeVar from uuid import uuid4 from app.daytona.tool_base import Sandbox, SandboxToolsBase from app.tool.base import ToolResult from app.utils.logger import logger Context = TypeVar("Context") _SHELL_DESCRIPTION = """\ Execute a shell command in the ...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/sandbox/sb_files_tool.py
app/tool/sandbox/sb_files_tool.py
import asyncio from typing import Optional, TypeVar from pydantic import Field from app.daytona.tool_base import Sandbox, SandboxToolsBase from app.tool.base import ToolResult from app.utils.files_utils import clean_path, should_exclude_file from app.utils.logger import logger Context = TypeVar("Context") _FILES_D...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/sandbox/sb_browser_tool.py
app/tool/sandbox/sb_browser_tool.py
import base64 import io import json import traceback from typing import Optional # Add this import for Optional from PIL import Image from pydantic import Field from app.daytona.tool_base import ( # Ensure Sandbox is imported correctly Sandbox, SandboxToolsBase, ThreadMessage, ) from app.tool.base impor...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/app/tool/sandbox/sb_vision_tool.py
app/tool/sandbox/sb_vision_tool.py
import base64 import mimetypes import os from io import BytesIO from typing import Optional from PIL import Image from pydantic import Field from app.daytona.tool_base import Sandbox, SandboxToolsBase, ThreadMessage from app.tool.base import ToolResult # 最大文件大小(原图10MB,压缩后5MB) MAX_IMAGE_SIZE = 10 * 1024 * 1024 MAX_C...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/tests/sandbox/test_sandbox.py
tests/sandbox/test_sandbox.py
import pytest import pytest_asyncio from app.sandbox.core.sandbox import DockerSandbox, SandboxSettings @pytest.fixture(scope="module") def sandbox_config(): """Creates sandbox configuration for testing.""" return SandboxSettings( image="python:3.12-slim", work_dir="/workspace", memor...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/tests/sandbox/test_docker_terminal.py
tests/sandbox/test_docker_terminal.py
"""Tests for the AsyncDockerizedTerminal implementation.""" import docker import pytest import pytest_asyncio from app.sandbox.core.terminal import AsyncDockerizedTerminal @pytest.fixture(scope="module") def docker_client(): """Fixture providing a Docker client.""" return docker.from_env() @pytest_asyncio...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/tests/sandbox/test_sandbox_manager.py
tests/sandbox/test_sandbox_manager.py
import asyncio import os import tempfile from typing import AsyncGenerator import pytest import pytest_asyncio from app.sandbox.core.manager import SandboxManager @pytest_asyncio.fixture(scope="function") async def manager() -> AsyncGenerator[SandboxManager, None]: """Creates a sandbox manager instance. Us...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/tests/sandbox/test_client.py
tests/sandbox/test_client.py
import tempfile from pathlib import Path from typing import AsyncGenerator import pytest import pytest_asyncio from app.config import SandboxSettings from app.sandbox.client import LocalSandboxClient, create_sandbox_client @pytest_asyncio.fixture(scope="function") async def local_client() -> AsyncGenerator[LocalSan...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/examples/benchmarks/__init__.py
examples/benchmarks/__init__.py
""" OpenManus benchmark system for standardized agent evaluation. """
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/protocol/a2a/__init__.py
protocol/a2a/__init__.py
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/protocol/a2a/app/agent_executor.py
protocol/a2a/app/agent_executor.py
import logging from typing import Awaitable, Callable from a2a.server.agent_execution import AgentExecutor, RequestContext from a2a.server.events import EventQueue from a2a.types import ( InvalidParamsError, Part, Task, TextPart, UnsupportedOperationError, ) from a2a.utils import completed_task, ne...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/protocol/a2a/app/main.py
protocol/a2a/app/main.py
import argparse import asyncio import logging from typing import Optional import httpx from a2a.server.apps import A2AStarletteApplication from a2a.server.request_handlers import DefaultRequestHandler from a2a.server.tasks import InMemoryPushNotifier, InMemoryTaskStore from a2a.types import AgentCapabilities, AgentCar...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/protocol/a2a/app/__init__.py
protocol/a2a/app/__init__.py
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
FoundationAgents/OpenManus
https://github.com/FoundationAgents/OpenManus/blob/52a13f2a57d8c7f6737eefb02ccf569594d44273/protocol/a2a/app/agent.py
protocol/a2a/app/agent.py
from typing import Any, AsyncIterable, ClassVar, Dict, List, Literal from pydantic import BaseModel from app.agent.manus import Manus class ResponseFormat(BaseModel): """Respond to the user in this format.""" status: Literal["input_required", "completed", "error"] = "input_required" message: str clas...
python
MIT
52a13f2a57d8c7f6737eefb02ccf569594d44273
2026-01-04T14:39:27.873507Z
false
xai-org/grok-1
https://github.com/xai-org/grok-1/blob/7050ed204b8206bb8645c7b7bbef7252f79561b0/run.py
run.py
# Copyright 2024 X.AI Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
python
Apache-2.0
7050ed204b8206bb8645c7b7bbef7252f79561b0
2026-01-04T14:39:29.368501Z
false
xai-org/grok-1
https://github.com/xai-org/grok-1/blob/7050ed204b8206bb8645c7b7bbef7252f79561b0/model.py
model.py
# Copyright 2024 X.AI Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
python
Apache-2.0
7050ed204b8206bb8645c7b7bbef7252f79561b0
2026-01-04T14:39:29.368501Z
true
xai-org/grok-1
https://github.com/xai-org/grok-1/blob/7050ed204b8206bb8645c7b7bbef7252f79561b0/checkpoint.py
checkpoint.py
# Copyright 2024 X.AI Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
python
Apache-2.0
7050ed204b8206bb8645c7b7bbef7252f79561b0
2026-01-04T14:39:29.368501Z
false
xai-org/grok-1
https://github.com/xai-org/grok-1/blob/7050ed204b8206bb8645c7b7bbef7252f79561b0/runners.py
runners.py
# Copyright 2024 X.AI Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
python
Apache-2.0
7050ed204b8206bb8645c7b7bbef7252f79561b0
2026-01-04T14:39:29.368501Z
false
charlax/professional-programming
https://github.com/charlax/professional-programming/blob/d6f158fefbc9ccc1136311f845c927da9983e8b8/antipatterns/python-examples/reraise_exceptions_bad.py
antipatterns/python-examples/reraise_exceptions_bad.py
from collections import namedtuple Bread = namedtuple("Bread", "color") class ToastException(Exception): pass def toast(bread): try: put_in_toaster(bread) except: raise ToastException("Could not toast bread") def put_in_toaster(bread): brad.color = "light_brown" # Note the typo ...
python
MIT
d6f158fefbc9ccc1136311f845c927da9983e8b8
2026-01-04T14:39:30.087892Z
false
charlax/professional-programming
https://github.com/charlax/professional-programming/blob/d6f158fefbc9ccc1136311f845c927da9983e8b8/antipatterns/python-examples/reraise_exceptions_good.py
antipatterns/python-examples/reraise_exceptions_good.py
from collections import namedtuple Bread = namedtuple("Bread", "color") class ToastException(Exception): pass def toast(bread): try: put_in_toaster(bread) except: print("Got exception while trying to toast") raise def put_in_toaster(bread): brad.color = "light_brown" # No...
python
MIT
d6f158fefbc9ccc1136311f845c927da9983e8b8
2026-01-04T14:39:30.087892Z
false
charlax/professional-programming
https://github.com/charlax/professional-programming/blob/d6f158fefbc9ccc1136311f845c927da9983e8b8/antipatterns/sqlalchemy-examples/exists.py
antipatterns/sqlalchemy-examples/exists.py
from sqlalchemy import create_engine from sqlalchemy import Column, Integer, String from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base engine = create_engine("sqlite:///:memory:", echo=True) Session = sessionmaker(bind=engine) Base = declarative_base() class Toaster(Base...
python
MIT
d6f158fefbc9ccc1136311f845c927da9983e8b8
2026-01-04T14:39:30.087892Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth-cli.py
unsloth-cli.py
#!/usr/bin/env python3 """ 🦥 Starter Script for Fine-Tuning FastLanguageModel with Unsloth This script is designed as a starting point for fine-tuning your models using unsloth. It includes configurable options for model loading, PEFT parameters, training arguments, and model saving/pushing functionalities. You wi...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/scripts/run_ruff_format.py
scripts/run_ruff_format.py
#!/usr/bin/env python3 """Run `ruff format` followed by kwarg spacing enforcement.""" from __future__ import annotations import subprocess import sys from pathlib import Path HERE = Path(__file__).resolve().parent def main(argv: list[str]) -> int: files = [arg for arg in argv if Path(arg).exists()] if not ...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/scripts/enforce_kwargs_spacing.py
scripts/enforce_kwargs_spacing.py
#!/usr/bin/env python3 """Ensure keyword arguments use spaces around '=', prune redundant pass statements.""" from __future__ import annotations import ast import argparse import io import sys import tokenize from collections import defaultdict from pathlib import Path def enforce_spacing(text: str) -> tuple[str, b...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/test_model_registry.py
tests/test_model_registry.py
""" Test model registration methods Checks that model registration methods work for respective models as well as all models The check is performed - by registering the models - checking that the instantiated models can be found on huggingface hub by querying for the model id """ from dataclasses import dataclass im...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/__init__.py
tests/__init__.py
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/qlora/test_hf_qlora_train_and_merge.py
tests/qlora/test_hf_qlora_train_and_merge.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/qlora/test_unsloth_qlora_train_and_merge.py
tests/qlora/test_unsloth_qlora_train_and_merge.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/test_unsloth_save.py
tests/saving/test_unsloth_save.py
import json import os import shutil import tempfile import pytest import importlib from unsloth import FastLanguageModel, FastModel model_to_test = [ # Text Models "unsloth/tinyllama", "unsloth/tinyllama-bnb-4bit", "unsloth/Qwen2.5-0.5B-Instruct", "unsloth/Qwen2.5-0.5B-Instruct-bnb-4bit", "uns...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/language_models/test_save_merged_grpo_model.py
tests/saving/language_models/test_save_merged_grpo_model.py
# -*- coding: utf-8 -*- """test_Llama3_1_(3B)_GRPO_LoRA (1).ipynb ### Unsloth """ from unsloth import FastLanguageModel import torch import sys from pathlib import Path import multiprocessing as mp import gc from multiprocessing import Queue REPO_ROOT = Path(__file__).parents[3] sys.path.insert(0, str(REPO_ROOT)) ...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/language_models/test_push_to_hub_merged.py
tests/saving/language_models/test_push_to_hub_merged.py
from unsloth import FastLanguageModel, FastVisionModel, UnslothVisionDataCollator from unsloth.chat_templates import get_chat_template from trl import SFTTrainer, SFTConfig from transformers import ( DataCollatorForLanguageModeling, DataCollatorForSeq2Seq, TrainingArguments, ) from datasets import load_data...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/language_models/test_merge_4bit_validation.py
tests/saving/language_models/test_merge_4bit_validation.py
from unsloth import FastLanguageModel from unsloth.chat_templates import get_chat_template from trl import SFTTrainer, SFTConfig from transformers import DataCollatorForSeq2Seq, TrainingArguments from datasets import load_dataset import torch import sys from pathlib import Path REPO_ROOT = Path(__file__).parents[3] sy...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/language_models/test_merged_model_perplexity_qwen_2.5.py
tests/saving/language_models/test_merged_model_perplexity_qwen_2.5.py
from unsloth import FastLanguageModel, FastVisionModel, UnslothVisionDataCollator from unsloth.chat_templates import get_chat_template from trl import SFTTrainer, SFTConfig from transformers import ( DataCollatorForLanguageModeling, DataCollatorForSeq2Seq, TrainingArguments, ) from datasets import load_data...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/language_models/test_merged_model_perplexity_llama-3.1-8b.py
tests/saving/language_models/test_merged_model_perplexity_llama-3.1-8b.py
from unsloth import FastLanguageModel, FastVisionModel, UnslothVisionDataCollator from unsloth.chat_templates import get_chat_template from trl import SFTTrainer, SFTConfig from transformers import ( DataCollatorForLanguageModeling, DataCollatorForSeq2Seq, TrainingArguments, ) from datasets import load_data...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/language_models/test_merge_model_perplexity_llama-3.2.py
tests/saving/language_models/test_merge_model_perplexity_llama-3.2.py
from unsloth import FastLanguageModel, FastVisionModel, UnslothVisionDataCollator from unsloth.chat_templates import get_chat_template from trl import SFTTrainer, SFTConfig from transformers import ( DataCollatorForLanguageModeling, DataCollatorForSeq2Seq, TrainingArguments, ) from datasets import load_data...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/language_models/test_merge_model_perplexity_mistral.py
tests/saving/language_models/test_merge_model_perplexity_mistral.py
from unsloth import FastLanguageModel, FastVisionModel, UnslothVisionDataCollator from unsloth.chat_templates import get_chat_template from trl import SFTTrainer, SFTConfig from transformers import ( DataCollatorForLanguageModeling, DataCollatorForSeq2Seq, TrainingArguments, ) from datasets import load_data...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/language_models/test_merge_model_perplexity_phi_4.py
tests/saving/language_models/test_merge_model_perplexity_phi_4.py
from unsloth import FastLanguageModel, FastVisionModel, UnslothVisionDataCollator from unsloth.chat_templates import get_chat_template from trl import SFTTrainer, SFTConfig from transformers import ( DataCollatorForLanguageModeling, DataCollatorForSeq2Seq, TrainingArguments, ) from datasets import load_data...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/language_models/test_push_to_hub_merged_sharded_index_file.py
tests/saving/language_models/test_push_to_hub_merged_sharded_index_file.py
from unsloth import FastLanguageModel, FastVisionModel, UnslothVisionDataCollator from unsloth.chat_templates import get_chat_template from trl import SFTTrainer, SFTConfig from transformers import ( DataCollatorForLanguageModeling, DataCollatorForSeq2Seq, TrainingArguments, ) from datasets import load_data...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/non_peft/test_whisper_non_peft.py
tests/saving/non_peft/test_whisper_non_peft.py
from unsloth import FastLanguageModel, FastModel from transformers import AutoModelForCausalLM, WhisperForConditionalGeneration from peft import PeftModel from pathlib import Path import sys import warnings REPO_ROOT = Path(__file__).parents[3] sys.path.insert(0, str(REPO_ROOT)) from tests.utils.cleanup_utils import ...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/non_peft/test_mistral_non_peft.py
tests/saving/non_peft/test_mistral_non_peft.py
from unsloth import FastLanguageModel from transformers import AutoModelForCausalLM from peft import PeftModel from pathlib import Path import sys import warnings REPO_ROOT = Path(__file__).parents[3] sys.path.insert(0, str(REPO_ROOT)) from tests.utils.cleanup_utils import safe_remove_directory print(f"\n{'='*80}")...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/vision_models/test_push_to_hub_merged.py
tests/saving/vision_models/test_push_to_hub_merged.py
## Import required libraries from unsloth import FastVisionModel, is_bf16_supported from unsloth.trainer import UnslothVisionDataCollator import torch import os from datasets import load_dataset from trl import SFTTrainer, SFTConfig import sys from pathlib import Path REPO_ROOT = Path(__file__).parents[3] sys.path...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/vision_models/test_save_merge_qwen2.5vl32B_model_ocr_benchmark.py
tests/saving/vision_models/test_save_merge_qwen2.5vl32B_model_ocr_benchmark.py
# -*- coding: utf-8 -*- from unsloth import FastVisionModel import torch from qwen_vl_utils import process_vision_info import os from datasets import load_dataset from trl import SFTTrainer, SFTConfig import sys from pathlib import Path REPO_ROOT = Path(__file__).parents[3] sys.path.insert(0, str(REPO_ROOT)) from...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/vision_models/test_index_file_sharded_model.py
tests/saving/vision_models/test_index_file_sharded_model.py
## Import required libraries from unsloth import FastVisionModel, is_bf16_supported from unsloth.trainer import UnslothVisionDataCollator import torch import os from datasets import load_dataset from trl import SFTTrainer, SFTConfig from huggingface_hub import HfFileSystem import sys from pathlib import Path REPO_R...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/vision_models/test_save_merge_vision_model_ocr_benchmark.py
tests/saving/vision_models/test_save_merge_vision_model_ocr_benchmark.py
# -*- coding: utf-8 -*- from unsloth import FastVisionModel import torch from qwen_vl_utils import process_vision_info import os from datasets import load_dataset from trl import SFTTrainer, SFTConfig import sys from pathlib import Path REPO_ROOT = Path(__file__).parents[3] sys.path.insert(0, str(REPO_ROOT)) from...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/text_to_speech_models/test_lasa.py
tests/saving/text_to_speech_models/test_lasa.py
from unsloth import FastLanguageModel, FastModel from transformers import CsmForConditionalGeneration import torch # ruff: noqa import sys from pathlib import Path from peft import PeftModel import warnings import requests REPO_ROOT = Path(__file__).parents[3] sys.path.insert(0, str(REPO_ROOT)) from tests.utils.cl...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/text_to_speech_models/test_whisper.py
tests/saving/text_to_speech_models/test_whisper.py
from unsloth import FastLanguageModel, FastModel from transformers import WhisperForConditionalGeneration, WhisperProcessor import torch # ruff: noqa import sys from pathlib import Path from peft import PeftModel import warnings import requests REPO_ROOT = Path(__file__).parents[3] sys.path.insert(0, str(REPO_ROOT))...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/text_to_speech_models/test_csm.py
tests/saving/text_to_speech_models/test_csm.py
from unsloth import FastLanguageModel, FastModel from transformers import CsmForConditionalGeneration import torch # ruff: noqa import sys from pathlib import Path from peft import PeftModel import warnings import requests REPO_ROOT = Path(__file__).parents[3] sys.path.insert(0, str(REPO_ROOT)) from tests.utils.clea...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/text_to_speech_models/test_orpheus.py
tests/saving/text_to_speech_models/test_orpheus.py
from unsloth import FastLanguageModel, FastModel from transformers import CsmForConditionalGeneration import torch # ruff: noqa import sys from pathlib import Path from peft import PeftModel import warnings import requests REPO_ROOT = Path(__file__).parents[3] sys.path.insert(0, str(REPO_ROOT)) from tests.utils.clea...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/gpt-oss-merge/test_merged_model.py
tests/saving/gpt-oss-merge/test_merged_model.py
# inference_on_merged.py from unsloth import FastLanguageModel from transformers import TextStreamer import torch import gc import os import shutil def safe_remove_directory(path): try: if os.path.exists(path) and os.path.isdir(path): shutil.rmtree(path) return True else: ...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/saving/gpt-oss-merge/train_and_merge.py
tests/saving/gpt-oss-merge/train_and_merge.py
# train_and_merge.py from unsloth import FastLanguageModel from trl import SFTTrainer, SFTConfig from datasets import load_dataset import torch import gc import os import shutil def safe_remove_directory(path): try: if os.path.exists(path) and os.path.isdir(path): shutil.rmtree(path) ...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/data_utils.py
tests/utils/data_utils.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/perplexity_eval.py
tests/utils/perplexity_eval.py
from tqdm import tqdm import torch import pandas as pd model_comparison_results = {} # return the perplexity of the model on the dataset # The perplexity is computed on each example, individually, with a sliding window for examples longer than 512 tokens. def ppl_model(model, tokenizer, dataset): nlls = [] m...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/test_qat.py
tests/utils/test_qat.py
from unsloth import FastLanguageModel from typing import Dict import pytest import torch from torchao.quantization.qat import FakeQuantizedLinear from torchao.quantization.qat.fake_quantizer import ( FakeQuantizerBase, Float8FakeQuantizer, Int4WeightPreshuffledFakeQuantizer, ) class _CountingFakeQuantiz...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/os_utils.py
tests/utils/os_utils.py
import subprocess import sys import os import shutil import importlib def detect_package_manager(): """Detect the available package manager""" package_managers = { "apt": "/usr/bin/apt", "yum": "/usr/bin/yum", "dnf": "/usr/bin/dnf", "pacman": "/usr/bin/pacman", "zypper"...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/test_attention_masks.py
tests/utils/test_attention_masks.py
# Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or #...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/ocr_eval.py
tests/utils/ocr_eval.py
""" OCR Model Evaluation Module This module provides functionality to evaluate OCR models on datasets with word error rate (WER) and character error rate (CER) metrics. """ import os import torch from tqdm import tqdm import pandas as pd from jiwer import wer, cer from qwen_vl_utils import process_vision_info import ...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/hf_utils.py
tests/utils/hf_utils.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/test_packing.py
tests/utils/test_packing.py
# Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or #...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/__init__.py
tests/utils/__init__.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/aime_eval.py
tests/utils/aime_eval.py
""" AIME Dataset Evaluation Module This module provides functions to evaluate language models on the combined AIME dataset (test2024 + test2025-I + test2025-II). """ import json import requests import os import re import logging from typing import List, Dict, Any from tqdm import tqdm from vllm import SamplingParams ...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/tests/utils/cleanup_utils.py
tests/utils/cleanup_utils.py
import gc import logging import os import shutil import torch import sys import warnings def clear_memory(variables_to_clear = None, verbose = False, clear_all_caches = True): """ Comprehensive memory clearing for persistent memory leaks. Args: variables_to_clear: List of variable names to clear ...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/device_type.py
unsloth/device_type.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/tokenizer_utils.py
unsloth/tokenizer_utils.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/trainer.py
unsloth/trainer.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/_auto_install.py
unsloth/_auto_install.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/__init__.py
unsloth/__init__.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/ollama_template_mappers.py
unsloth/ollama_template_mappers.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/chat_templates.py
unsloth/chat_templates.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/import_fixes.py
unsloth/import_fixes.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/save.py
unsloth/save.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/qwen2.py
unsloth/models/qwen2.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/loader_utils.py
unsloth/models/loader_utils.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/gemma.py
unsloth/models/gemma.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/vision.py
unsloth/models/vision.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/loader.py
unsloth/models/loader.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/llama.py
unsloth/models/llama.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/qwen3_moe.py
unsloth/models/qwen3_moe.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/qwen3.py
unsloth/models/qwen3.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/rl_replacements.py
unsloth/models/rl_replacements.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/granite.py
unsloth/models/granite.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/falcon_h1.py
unsloth/models/falcon_h1.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/mapper.py
unsloth/models/mapper.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/cohere.py
unsloth/models/cohere.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/__init__.py
unsloth/models/__init__.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/rl.py
unsloth/models/rl.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/llama4.py
unsloth/models/llama4.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/gemma2.py
unsloth/models/gemma2.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/mistral.py
unsloth/models/mistral.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/_utils.py
unsloth/models/_utils.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
true
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/models/dpo.py
unsloth/models/dpo.py
# Copyright 2023-present Daniel Han-Chen & the Unsloth team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/utils/attention_dispatch.py
unsloth/utils/attention_dispatch.py
# Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or #...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/utils/packing.py
unsloth/utils/packing.py
# Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or #...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/utils/__init__.py
unsloth/utils/__init__.py
# Copyright 2023-present Daniel Han-Chen, Michael Han-Chen & the Unsloth team. All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or #...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/utils/hf_hub.py
unsloth/utils/hf_hub.py
from huggingface_hub import HfApi, ModelInfo _HFAPI: HfApi = None POPULARITY_PROPERTIES = [ "downloads", "downloadsAllTime", "trendingScore", "likes", ] THOUSAND = 1000 MILLION = 1000000 BILLION = 1000000000 def formatted_int(value: int) -> str: if value < THOUSAND: return str(value) ...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false
unslothai/unsloth
https://github.com/unslothai/unsloth/blob/85bfdaf7ab3c32f95f98f3e3927164797fcc6d46/unsloth/registry/_qwen.py
unsloth/registry/_qwen.py
from unsloth.registry.registry import ModelInfo, ModelMeta, QuantType, _register_models _IS_QWEN_2_5_REGISTERED = False _IS_QWEN_2_5_VL_REGISTERED = False _IS_QWEN_QWQ_REGISTERED = False class QwenModelInfo(ModelInfo): @classmethod def construct_model_name(cls, base_name, version, size, quant_type, instruct_...
python
Apache-2.0
85bfdaf7ab3c32f95f98f3e3927164797fcc6d46
2026-01-04T14:39:29.397284Z
false