index
int64
0
0
repo_id
stringclasses
351 values
file_path
stringlengths
26
186
content
stringlengths
1
990k
0
hf_public_repos/api-inference-community
hf_public_repos/api-inference-community/tests/test_audio.py
import os from unittest import TestCase import numpy as np from api_inference_community.validation import ffmpeg_convert, normalize_payload_audio class ValidationTestCase(TestCase): def read(self, filename: str) -> bytes: dirname = os.path.dirname(os.path.abspath(__file__)) filename = os.path.joi...
0
hf_public_repos/api-inference-community
hf_public_repos/api-inference-community/tests/test_normalizers.py
from unittest import TestCase import torch from api_inference_community.normalizers import speaker_diarization_normalize class NormalizersTestCase(TestCase): def test_speaker_diarization_dummy(self): tensor = torch.zeros((10, 2)) outputs = speaker_diarization_normalize( tensor, 16000,...
0
hf_public_repos/api-inference-community
hf_public_repos/api-inference-community/tests/test_nlp.py
import json from unittest import TestCase from api_inference_community.validation import normalize_payload_nlp from parameterized import parameterized from pydantic import ValidationError class ValidationTestCase(TestCase): def test_malformed_input(self): bpayload = b"\xc3\x28" with self.assertRa...
0
hf_public_repos/api-inference-community
hf_public_repos/api-inference-community/tests/test_image.py
import os from unittest import TestCase import PIL from api_inference_community.validation import normalize_payload_image class ValidationTestCase(TestCase): def test_original_imagefile(self): dirname = os.path.dirname(os.path.abspath(__file__)) filename = os.path.join(dirname, "samples", "plane....
0
hf_public_repos/api-inference-community
hf_public_repos/api-inference-community/tests/test_routes.py
import io import json import logging import os from base64 import b64encode from unittest import TestCase import numpy as np from api_inference_community.routes import pipeline_route, status_ok from PIL import Image from starlette.applications import Starlette from starlette.routing import Route from starlette.testcli...
0
hf_public_repos/api-inference-community
hf_public_repos/api-inference-community/tests/test_dockers.py
import base64 import json import os import subprocess import time import unittest import uuid from collections import Counter from typing import Any, Optional import httpx class DockerPopen(subprocess.Popen): def __exit__(self, exc_type, exc_val, traceback): self.terminate() self.wait(20) ...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/setfit/Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.8 LABEL maintainer="Tom Aarsen <tom.aarsen@huggingface.co>" # Add any system dependency here # RUN apt-get update -y && apt-get install libXXX -y COPY ./requirements.txt /app RUN pip install --no-cache-dir -r requirements.txt COPY ./prestart.sh /app/ # Most DL models are quite...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/setfit/requirements.txt
starlette==0.27.0 git+https://github.com/huggingface/api-inference-community.git@f06a71e72e92caeebabaeced979eacb3542bf2ca huggingface_hub==0.20.2 setfit==1.0.3
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/setfit/prestart.sh
python app/main.py
0
hf_public_repos/api-inference-community/docker_images/setfit
hf_public_repos/api-inference-community/docker_images/setfit/app/main.py
import functools import logging import os import pathlib from typing import Dict, Type from api_inference_community import hub from api_inference_community.routes import pipeline_route, status_ok from app.pipelines import Pipeline, TextClassificationPipeline from huggingface_hub import constants from starlette.applica...
0
hf_public_repos/api-inference-community/docker_images/setfit/app
hf_public_repos/api-inference-community/docker_images/setfit/app/pipelines/base.py
from abc import ABC, abstractmethod from typing import Any class Pipeline(ABC): @abstractmethod def __init__(self, model_id: str): raise NotImplementedError("Pipelines should implement an __init__ method") @abstractmethod def __call__(self, inputs: Any) -> Any: raise NotImplementedErr...
0
hf_public_repos/api-inference-community/docker_images/setfit/app
hf_public_repos/api-inference-community/docker_images/setfit/app/pipelines/__init__.py
from app.pipelines.base import Pipeline, PipelineException from app.pipelines.text_classification import TextClassificationPipeline
0
hf_public_repos/api-inference-community/docker_images/setfit/app
hf_public_repos/api-inference-community/docker_images/setfit/app/pipelines/text_classification.py
from typing import Dict, List from app.pipelines import Pipeline from setfit import SetFitModel class TextClassificationPipeline(Pipeline): def __init__( self, model_id: str, ) -> None: self.model = SetFitModel.from_pretrained(model_id) def __call__(self, inputs: str) -> List[Dic...
0
hf_public_repos/api-inference-community/docker_images/setfit
hf_public_repos/api-inference-community/docker_images/setfit/tests/test_docker_build.py
import os import subprocess from unittest import TestCase class cd: """Context manager for changing the current working directory""" def __init__(self, newPath): self.newPath = os.path.expanduser(newPath) def __enter__(self): self.savedPath = os.getcwd() os.chdir(self.newPath) ...
0
hf_public_repos/api-inference-community/docker_images/setfit
hf_public_repos/api-inference-community/docker_images/setfit/tests/test_api.py
import os from typing import Dict from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS, get_pipeline # Must contain at least one example of each implemented pipeline # Tests do not check the actual values of the model output, so small dummy # models are recommended for faster tests. TESTABLE_MODE...
0
hf_public_repos/api-inference-community/docker_images/setfit
hf_public_repos/api-inference-community/docker_images/setfit/tests/test_api_text_classification.py
import json import os from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS from starlette.testclient import TestClient from tests.test_api import TESTABLE_MODELS @skipIf( "text-classification" not in ALLOWED_TASKS, "text-classification not implemented", ) class TextClassificationTestCase(...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/diffusers/Dockerfile
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04 LABEL maintainer="Nicolas Patry <nicolas@huggingface.co>" # Add any system dependency here # RUN apt-get update -y && apt-get install libXXX -y ENV DEBIAN_FRONTEND=noninteractive # Install prerequisites RUN apt-get update && \ apt-get install -y build-essential ...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/diffusers/requirements.txt
starlette==0.27.0 api-inference-community==0.0.36 # to be replaced with diffusers 0.31.0 as soon as released git+https://github.com/huggingface/diffusers.git@0f079b932d4382ad6675593f9a140b2a74c8cfb4 transformers==4.41.2 accelerate==0.31.0 hf_transfer==0.1.3 pydantic>=2 ftfy==6.1.1 sentencepiece==0.1.97 scipy==1.10.0 to...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/diffusers/prestart.sh
echo "Prestart start at " $(date) METRICS_ENABLED=${METRICS_ENABLED:-"0"} if [ "$METRICS_ENABLED" = "1" ];then echo "Spawning metrics server" gunicorn -k "uvicorn.workers.UvicornWorker" --bind :${METRICS_PORT:-9400} "app.healthchecks:app" & pid=$! echo "Metrics server pid: $pid" fi echo "Prestart don...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/app/idle.py
import asyncio import contextlib import logging import os import signal import time LOG = logging.getLogger(__name__) LAST_START = None LAST_END = None UNLOAD_IDLE = os.getenv("UNLOAD_IDLE", "").lower() in ("1", "true") IDLE_TIMEOUT = int(os.getenv("IDLE_TIMEOUT", 15)) async def live_check_loop(): global LAST...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/app/healthchecks.py
""" This file allows users to spawn some side service helping with giving a better view on the main ASGI app status. The issue with the status route of the main application is that it gets unresponsive as soon as all workers get busy. Thus, you cannot really use the said route as a healthcheck to decide whether your ap...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/app/main.py
import asyncio import functools import logging import os from typing import Dict, Type from api_inference_community.routes import pipeline_route, status_ok from app import idle from app.pipelines import ImageToImagePipeline, Pipeline, TextToImagePipeline from starlette.applications import Starlette from starlette.midd...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/app/lora.py
import logging import torch.nn as nn from app import offline from safetensors.torch import load_file logger = logging.getLogger(__name__) class LoRAPipelineMixin(offline.OfflineBestEffortMixin): @staticmethod def _get_lora_weight_name(model_data): weight_name_candidate = LoRAPipelineMixin._lora_wei...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/app/timing.py
import logging from functools import wraps from time import time logger = logging.getLogger(__name__) def timing(f): @wraps(f) def inner(*args, **kwargs): start = time() try: ret = f(*args, **kwargs) finally: end = time() logger.debug("Func: %r too...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/app/offline.py
import json import logging import os from huggingface_hub import file_download, hf_api, hf_hub_download, model_info, utils logger = logging.getLogger(__name__) class OfflineBestEffortMixin(object): def _hub_repo_file(self, repo_id, filename, repo_type="model"): if self.offline_preferred: tr...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/app/validation.py
import re STR_TO_BOOL = re.compile(r"^\s*true|yes|1\s*$", re.IGNORECASE) def str_to_bool(s): return STR_TO_BOOL.match(str(s))
0
hf_public_repos/api-inference-community/docker_images/diffusers/app
hf_public_repos/api-inference-community/docker_images/diffusers/app/pipelines/image_to_image.py
import json import logging import os import torch from app import idle, offline, timing, validation from app.pipelines import Pipeline from diffusers import ( AltDiffusionImg2ImgPipeline, AltDiffusionPipeline, AutoPipelineForImage2Image, ControlNetModel, DiffusionPipeline, DPMSolverMultistepSch...
0
hf_public_repos/api-inference-community/docker_images/diffusers/app
hf_public_repos/api-inference-community/docker_images/diffusers/app/pipelines/base.py
from abc import ABC, abstractmethod from typing import Any class Pipeline(ABC): @abstractmethod def __init__(self, model_id: str): raise NotImplementedError("Pipelines should implement an __init__ method") @abstractmethod def __call__(self, inputs: Any) -> Any: raise NotImplementedErr...
0
hf_public_repos/api-inference-community/docker_images/diffusers/app
hf_public_repos/api-inference-community/docker_images/diffusers/app/pipelines/__init__.py
from app.pipelines.base import Pipeline, PipelineException # isort:skip from app.pipelines.image_to_image import ImageToImagePipeline from app.pipelines.text_to_image import TextToImagePipeline
0
hf_public_repos/api-inference-community/docker_images/diffusers/app
hf_public_repos/api-inference-community/docker_images/diffusers/app/pipelines/text_to_image.py
import importlib import json import logging import os from typing import TYPE_CHECKING import torch from app import idle, lora, offline, timing, validation from app.pipelines import Pipeline from diffusers import ( AutoencoderKL, AutoPipelineForText2Image, DiffusionPipeline, EulerAncestralDiscreteSched...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/tests/test_api_text_to_image.py
import os from io import BytesIO from unittest import TestCase, skipIf import PIL from app.main import ALLOWED_TASKS from parameterized import parameterized_class from starlette.testclient import TestClient from tests.test_api import TESTABLE_MODELS @skipIf( "text-to-image" not in ALLOWED_TASKS, "text-to-ima...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/tests/test_api_image_to_image.py
import base64 import os from io import BytesIO from unittest import TestCase, skipIf import PIL from app.main import ALLOWED_TASKS from parameterized import parameterized_class from starlette.testclient import TestClient from tests.test_api import TESTABLE_MODELS @skipIf( "image-to-image" not in ALLOWED_TASKS, ...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/tests/test_docker_build.py
import os import subprocess from unittest import TestCase class cd: """Context manager for changing the current working directory""" def __init__(self, newPath): self.newPath = os.path.expanduser(newPath) def __enter__(self): self.savedPath = os.getcwd() os.chdir(self.newPath) ...
0
hf_public_repos/api-inference-community/docker_images/diffusers
hf_public_repos/api-inference-community/docker_images/diffusers/tests/test_api.py
import os from typing import Dict, List from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS, get_pipeline # Must contain at least one example of each implemented pipeline # Tests do not check the actual values of the model output, so small dummy # models are recommended for faster tests. TESTABL...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/mindspore/Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.8 LABEL maintainer="me <me@example.com>" # Add any system dependency here RUN apt-get update -y && apt-get install libglib2.0-dev libsm6 libxrender1 libgl1-mesa-glx -y COPY requirements.txt /app RUN /usr/local/bin/python -m pip install --upgrade pip && \ pip install --no-cac...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/mindspore/requirements.txt
starlette==0.27.0 api-inference-community==0.0.25 huggingface_hub==0.11.0 tinyms>=0.3.2
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/mindspore/prestart.sh
python app/main.py
0
hf_public_repos/api-inference-community/docker_images/mindspore
hf_public_repos/api-inference-community/docker_images/mindspore/app/main.py
import functools import logging import os from typing import Dict, Type from api_inference_community.routes import pipeline_route, status_ok from app.pipelines import ImageClassificationPipeline, Pipeline from starlette.applications import Starlette from starlette.middleware import Middleware from starlette.middleware...
0
hf_public_repos/api-inference-community/docker_images/mindspore/app
hf_public_repos/api-inference-community/docker_images/mindspore/app/pipelines/base.py
from abc import ABC, abstractmethod from typing import Any, Optional class Pipeline(ABC): task: Optional[str] = None model_id: Optional[str] = None @abstractmethod def __init__(self, model_id: str): raise NotImplementedError("Pipelines should implement an __init__ method") @abstractmetho...
0
hf_public_repos/api-inference-community/docker_images/mindspore/app
hf_public_repos/api-inference-community/docker_images/mindspore/app/pipelines/image_classification.py
import json import os from typing import TYPE_CHECKING, Any, Dict, List import tinyms as ts from app.pipelines import Pipeline from huggingface_hub import snapshot_download from tinyms import Tensor, model, vision from tinyms.primitives import Softmax if TYPE_CHECKING: from PIL import Image ALLOWED_MODEL = { ...
0
hf_public_repos/api-inference-community/docker_images/mindspore/app
hf_public_repos/api-inference-community/docker_images/mindspore/app/pipelines/__init__.py
from app.pipelines.base import Pipeline, PipelineException # isort:skip from app.pipelines.image_classification import ImageClassificationPipeline
0
hf_public_repos/api-inference-community/docker_images/mindspore
hf_public_repos/api-inference-community/docker_images/mindspore/tests/test_api_image_classification.py
import json import os from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS from starlette.testclient import TestClient from tests.test_api import TESTABLE_MODELS @skipIf( "image-classification" not in ALLOWED_TASKS, "image-classification not implemented", ) class ImageClassificationTestCa...
0
hf_public_repos/api-inference-community/docker_images/mindspore
hf_public_repos/api-inference-community/docker_images/mindspore/tests/test_docker_build.py
import os import subprocess from unittest import TestCase class cd: """Context manager for changing the current working directory""" def __init__(self, newPath): self.newPath = os.path.expanduser(newPath) def __enter__(self): self.savedPath = os.getcwd() os.chdir(self.newPath) ...
0
hf_public_repos/api-inference-community/docker_images/mindspore
hf_public_repos/api-inference-community/docker_images/mindspore/tests/test_api.py
import os from typing import Dict from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS, get_pipeline # Must contain at least one example of each implemented pipeline # Tests do not check the actual values of the model output, so small dummy # models are recommended for faster tests. TESTABLE_MODE...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/peft/Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.8 LABEL maintainer="Nicolas Patry <nicolas@huggingface.co>" # Add any system dependency here # RUN apt-get update -y && apt-get install libXXX -y RUN pip install --no-cache-dir torch==2.0.1 COPY ./requirements.txt /app RUN pip install --no-cache-dir -r requirements.txt # Uncomm...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/peft/requirements.txt
starlette==0.27.0 api-inference-community==0.0.31 huggingface_hub==0.18.0 safetensors==0.3.1 peft==0.6.2 transformers==4.35.2 accelerate>=0.21.0 hf_transfer==0.1.3 pydantic==1.8.2 ftfy==6.1.1 sentencepiece==0.1.97 scipy==1.10.0 torch==2.0.1 pydantic<2 #Dummy.
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/peft/prestart.sh
echo "Prestart start at " $(date) python app/main.py echo "Prestart done at " $(date)
0
hf_public_repos/api-inference-community/docker_images/peft
hf_public_repos/api-inference-community/docker_images/peft/app/idle.py
import asyncio import contextlib import logging import os import signal import time LOG = logging.getLogger(__name__) LAST_START = None LAST_END = None UNLOAD_IDLE = os.getenv("UNLOAD_IDLE", "").lower() in ("1", "true") IDLE_TIMEOUT = int(os.getenv("IDLE_TIMEOUT", 15)) async def live_check_loop(): global LAST...
0
hf_public_repos/api-inference-community/docker_images/peft
hf_public_repos/api-inference-community/docker_images/peft/app/main.py
import asyncio import functools import logging import os from typing import Dict, Type from api_inference_community.routes import pipeline_route, status_ok from app import idle from app.pipelines import Pipeline, TextGenerationPipeline from starlette.applications import Starlette from starlette.middleware import Middl...
0
hf_public_repos/api-inference-community/docker_images/peft
hf_public_repos/api-inference-community/docker_images/peft/app/timing.py
import logging from functools import wraps from time import time logger = logging.getLogger(__name__) def timing(f): @wraps(f) def inner(*args, **kwargs): start = time() try: ret = f(*args, **kwargs) finally: end = time() logger.debug("Func: %r too...
0
hf_public_repos/api-inference-community/docker_images/peft/app
hf_public_repos/api-inference-community/docker_images/peft/app/pipelines/text_generation.py
import logging import os import torch from app import idle, timing from app.pipelines import Pipeline from huggingface_hub import model_info from peft import PeftModel from transformers import AutoModelForCausalLM, AutoTokenizer logger = logging.getLogger(__name__) class TextGenerationPipeline(Pipeline): def _...
0
hf_public_repos/api-inference-community/docker_images/peft/app
hf_public_repos/api-inference-community/docker_images/peft/app/pipelines/base.py
from abc import ABC, abstractmethod from typing import Any class Pipeline(ABC): @abstractmethod def __init__(self, model_id: str): raise NotImplementedError("Pipelines should implement an __init__ method") @abstractmethod def __call__(self, inputs: Any) -> Any: raise NotImplementedErr...
0
hf_public_repos/api-inference-community/docker_images/peft/app
hf_public_repos/api-inference-community/docker_images/peft/app/pipelines/__init__.py
from app.pipelines.base import Pipeline, PipelineException # isort:skip from app.pipelines.text_generation import TextGenerationPipeline
0
hf_public_repos/api-inference-community/docker_images/peft
hf_public_repos/api-inference-community/docker_images/peft/tests/test_api_text_generation.py
import json import os from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS from starlette.testclient import TestClient from tests.test_api import TESTABLE_MODELS @skipIf( "text-generation" not in ALLOWED_TASKS, "text-generation not implemented", ) class TextGenerationTestCase(TestCase): ...
0
hf_public_repos/api-inference-community/docker_images/peft
hf_public_repos/api-inference-community/docker_images/peft/tests/test_api.py
import os from typing import Dict from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS, get_pipeline # Must contain at least one example of each implemented pipeline # Tests do not check the actual values of the model output, so small dummy # models are recommended for faster tests. TESTABLE_MODE...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/pyannote_audio/Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.8 LABEL maintainer="Hervé Bredin <herve.bredin@irit.fr>" # Add any system dependency here # RUN apt-get update -y && apt-get install libXXX -y RUN apt-get update -y && apt-get install ffmpeg -y COPY ./requirements.txt /app RUN pip install --no-cache-dir -r requirements.txt COPY ...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/pyannote_audio/requirements.txt
starlette==0.27.0 api-inference-community==0.0.25 torch==1.13.1 torchvision==0.12.0 torchaudio==0.11.0 torchtext==0.12.0 speechbrain==0.5.12 pyannote-audio==2.0.1 huggingface_hub==0.8.1
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/pyannote_audio/prestart.sh
python app/main.py
0
hf_public_repos/api-inference-community/docker_images/pyannote_audio
hf_public_repos/api-inference-community/docker_images/pyannote_audio/app/main.py
import functools import logging import os from typing import Dict, Type from api_inference_community.routes import pipeline_route, status_ok from app.pipelines import AutomaticSpeechRecognitionPipeline, Pipeline from starlette.applications import Starlette from starlette.middleware import Middleware from starlette.mid...
0
hf_public_repos/api-inference-community/docker_images/pyannote_audio/app
hf_public_repos/api-inference-community/docker_images/pyannote_audio/app/pipelines/base.py
from abc import ABC, abstractmethod from typing import Any class Pipeline(ABC): @abstractmethod def __init__(self, model_id: str): raise NotImplementedError("Pipelines should implement an __init__ method") @abstractmethod def __call__(self, inputs: Any) -> Any: raise NotImplementedErr...
0
hf_public_repos/api-inference-community/docker_images/pyannote_audio/app
hf_public_repos/api-inference-community/docker_images/pyannote_audio/app/pipelines/__init__.py
from app.pipelines.base import Pipeline, PipelineException # isort:skip from app.pipelines.automatic_speech_recognition import ( AutomaticSpeechRecognitionPipeline, )
0
hf_public_repos/api-inference-community/docker_images/pyannote_audio/app
hf_public_repos/api-inference-community/docker_images/pyannote_audio/app/pipelines/automatic_speech_recognition.py
from typing import Dict import numpy as np import torch from app.pipelines import Pipeline from pyannote.audio import Pipeline as Pypeline class AutomaticSpeechRecognitionPipeline(Pipeline): def __init__(self, model_id: str): # IMPLEMENT_THIS # Preload all the elements you are going to need at in...
0
hf_public_repos/api-inference-community/docker_images/pyannote_audio
hf_public_repos/api-inference-community/docker_images/pyannote_audio/tests/test_api_automatic_speech_recognition.py
import json import os from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS from starlette.testclient import TestClient from tests.test_api import TESTABLE_MODELS @skipIf( "automatic-speech-recognition" not in ALLOWED_TASKS, "automatic-speech-recognition not implemented", ) class Automatic...
0
hf_public_repos/api-inference-community/docker_images/pyannote_audio
hf_public_repos/api-inference-community/docker_images/pyannote_audio/tests/test_docker_build.py
import os import subprocess from unittest import TestCase class cd: """Context manager for changing the current working directory""" def __init__(self, newPath): self.newPath = os.path.expanduser(newPath) def __enter__(self): self.savedPath = os.getcwd() os.chdir(self.newPath) ...
0
hf_public_repos/api-inference-community/docker_images/pyannote_audio
hf_public_repos/api-inference-community/docker_images/pyannote_audio/tests/test_api.py
import os from typing import Dict from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS, get_pipeline # Must contain at least one example of each implemented pipeline # Tests do not check the actual values of the model output, so small dummy # models are recommended for faster tests. TESTABLE_MODE...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/allennlp/Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.8 LABEL maintainer="me <me@example.com>" # Add any system dependency here # RUN apt-get update -y && apt-get install libXXX -y COPY ./requirements.txt /app RUN pip install --no-cache-dir -r requirements.txt RUN pip install spacy && python -m spacy download en_core_web_sm COPY ....
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/allennlp/requirements.txt
starlette==0.27.0 numpy==1.22.0 allennlp>=2.5.0,<3.0.0 # Even though it is not imported, it is actually required. allennlp_models>=2.5.0,<3.0.0 api-inference-community==0.0.23 huggingface_hub==0.5.1
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/allennlp/prestart.sh
python app/main.py
0
hf_public_repos/api-inference-community/docker_images/allennlp
hf_public_repos/api-inference-community/docker_images/allennlp/app/main.py
import functools import logging import os from typing import Dict, Type from api_inference_community.routes import pipeline_route, status_ok from app.pipelines import Pipeline, QuestionAnsweringPipeline from starlette.applications import Starlette from starlette.middleware import Middleware from starlette.middleware.g...
0
hf_public_repos/api-inference-community/docker_images/allennlp/app
hf_public_repos/api-inference-community/docker_images/allennlp/app/pipelines/base.py
from abc import ABC, abstractmethod from typing import Any, Optional class Pipeline(ABC): task: Optional[str] = None model_id: Optional[str] = None @abstractmethod def __init__(self, model_id: str): raise NotImplementedError("Pipelines should implement an __init__ method") @abstractmetho...
0
hf_public_repos/api-inference-community/docker_images/allennlp/app
hf_public_repos/api-inference-community/docker_images/allennlp/app/pipelines/question_answering.py
import os import shutil from typing import Any, Dict # Even though it is not imported, it is actually required, it downloads some stuff. import allennlp_models # noqa: F401 from allennlp.predictors.predictor import Predictor from app.pipelines import Pipeline class QuestionAnsweringPipeline(Pipeline): def __ini...
0
hf_public_repos/api-inference-community/docker_images/allennlp/app
hf_public_repos/api-inference-community/docker_images/allennlp/app/pipelines/__init__.py
from app.pipelines.base import Pipeline, PipelineException # isort:skip from app.pipelines.question_answering import QuestionAnsweringPipeline
0
hf_public_repos/api-inference-community/docker_images/allennlp
hf_public_repos/api-inference-community/docker_images/allennlp/tests/test_docker_build.py
import os import subprocess from unittest import TestCase class cd: """Context manager for changing the current working directory""" def __init__(self, newPath): self.newPath = os.path.expanduser(newPath) def __enter__(self): self.savedPath = os.getcwd() os.chdir(self.newPath) ...
0
hf_public_repos/api-inference-community/docker_images/allennlp
hf_public_repos/api-inference-community/docker_images/allennlp/tests/test_api.py
import os from typing import Dict from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS, get_pipeline # Must contain at least one example of each implemented pipeline # Tests do not check the actual values of the model output, so small dummy # models are recommended for faster tests. TESTABLE_MODE...
0
hf_public_repos/api-inference-community/docker_images/allennlp
hf_public_repos/api-inference-community/docker_images/allennlp/tests/test_api_question_answering.py
import json import os from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS from starlette.testclient import TestClient from tests.test_api import TESTABLE_MODELS @skipIf( "question-answering" not in ALLOWED_TASKS, "question-answering not implemented", ) class QuestionAnsweringTestCase(Tes...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/fairseq/Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.8 LABEL maintainer="me <me@example.com>" # Add any system dependency here # RUN apt-get update -y && apt-get install libXXX -y RUN apt-get update -y && apt-get install ffmpeg espeak-ng -y RUN pip install --no-cache-dir numpy==1.22 torch==1.11 COPY ./requirements.txt /app RUN pip...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/fairseq/requirements.txt
api-inference-community==0.0.23 g2p_en==2.1.0 g2pc==0.9.9.3 phonemizer==2.2.1 librosa==0.8.1 hanziconv==0.3.2 sentencepiece==0.1.96 # Dummy comment to trigger automatic deploy. git+https://github.com/facebookresearch/fairseq.git@d47119871c2ac9a0a0aa2904dd8cfc1929b113d9#egg=fairseq huggingface_hub==0.5.1
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/fairseq/prestart.sh
python app/main.py
0
hf_public_repos/api-inference-community/docker_images/fairseq
hf_public_repos/api-inference-community/docker_images/fairseq/app/main.py
import functools import logging import os from typing import Dict, Type from api_inference_community.routes import pipeline_route, status_ok from app.pipelines import Pipeline, SpeechToSpeechPipeline, TextToSpeechPipeline from starlette.applications import Starlette from starlette.middleware import Middleware from sta...
0
hf_public_repos/api-inference-community/docker_images/fairseq/app
hf_public_repos/api-inference-community/docker_images/fairseq/app/pipelines/audio_to_audio.py
import json import os from pathlib import Path from typing import List, Tuple import numpy as np import torch from app.pipelines import Pipeline from app.pipelines.utils import ARG_OVERRIDES_MAP from fairseq import hub_utils from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub from fairseq.mod...
0
hf_public_repos/api-inference-community/docker_images/fairseq/app
hf_public_repos/api-inference-community/docker_images/fairseq/app/pipelines/text_to_speech.py
import os from typing import Tuple import numpy as np from app.pipelines import Pipeline from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub from fairseq.models.text_to_speech.hub_interface import TTSHubInterface class TextToSpeechPipeline(Pipeline): def __init__(self, model_id: str): ...
0
hf_public_repos/api-inference-community/docker_images/fairseq/app
hf_public_repos/api-inference-community/docker_images/fairseq/app/pipelines/base.py
from abc import ABC, abstractmethod from typing import Any class Pipeline(ABC): @abstractmethod def __init__(self, model_id: str): raise NotImplementedError("Pipelines should implement an __init__ method") @abstractmethod def __call__(self, inputs: Any) -> Any: raise NotImplementedErr...
0
hf_public_repos/api-inference-community/docker_images/fairseq/app
hf_public_repos/api-inference-community/docker_images/fairseq/app/pipelines/utils.py
ARG_OVERRIDES_MAP = { "facebook/xm_transformer_s2ut_800m-es-en-st-asr-bt_h1_2022": { "config_yaml": "config.yaml", "task": "speech_to_text", } }
0
hf_public_repos/api-inference-community/docker_images/fairseq/app
hf_public_repos/api-inference-community/docker_images/fairseq/app/pipelines/__init__.py
from app.pipelines.base import Pipeline, PipelineException # isort:skip from app.pipelines.audio_to_audio import SpeechToSpeechPipeline from app.pipelines.text_to_speech import TextToSpeechPipeline
0
hf_public_repos/api-inference-community/docker_images/fairseq
hf_public_repos/api-inference-community/docker_images/fairseq/tests/test_api_text_to_speech.py
import os from unittest import TestCase, skipIf from api_inference_community.validation import ffmpeg_read from app.main import ALLOWED_TASKS from starlette.testclient import TestClient from tests.test_api import TESTABLE_MODELS @skipIf( "text-to-speech" not in ALLOWED_TASKS, "text-to-speech not implemented"...
0
hf_public_repos/api-inference-community/docker_images/fairseq
hf_public_repos/api-inference-community/docker_images/fairseq/tests/test_docker_build.py
import os import subprocess from unittest import TestCase class cd: """Context manager for changing the current working directory""" def __init__(self, newPath): self.newPath = os.path.expanduser(newPath) def __enter__(self): self.savedPath = os.getcwd() os.chdir(self.newPath) ...
0
hf_public_repos/api-inference-community/docker_images/fairseq
hf_public_repos/api-inference-community/docker_images/fairseq/tests/test_api.py
import os from typing import Dict from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS, get_pipeline # Must contain at least one example of each implemented pipeline # Tests do not check the actual values of the model output, so small dummy # models are recommended for faster tests. TESTABLE_MODE...
0
hf_public_repos/api-inference-community/docker_images/fairseq
hf_public_repos/api-inference-community/docker_images/fairseq/tests/test_api_audio_to_audio.py
import base64 import json import os from unittest import TestCase, skipIf from api_inference_community.validation import ffmpeg_read from app.main import ALLOWED_TASKS from starlette.testclient import TestClient from tests.test_api import TESTABLE_MODELS @skipIf( "audio-to-audio" not in ALLOWED_TASKS, "audio...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/open_clip/Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.8 LABEL maintainer="me <me@example.com>" # Add any system dependency here # RUN apt-get update -y && apt-get install libXXX -y COPY ./requirements.txt /app RUN pip install --no-cache-dir -r requirements.txt COPY ./prestart.sh /app/ # Most DL models are quite large in terms of ...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/open_clip/requirements.txt
starlette==0.27.0 api-inference-community==0.0.32 huggingface_hub>=0.12.1 timm>=0.9.10 transformers>=4.34.0 open_clip_torch>=2.23.0 #dummy.
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/open_clip/prestart.sh
python app/main.py
0
hf_public_repos/api-inference-community/docker_images/open_clip
hf_public_repos/api-inference-community/docker_images/open_clip/app/main.py
import functools import logging import os from typing import Dict, Type from api_inference_community.routes import pipeline_route, status_ok from app.pipelines import Pipeline, ZeroShotImageClassificationPipeline from starlette.applications import Starlette from starlette.middleware import Middleware from starlette.mi...
0
hf_public_repos/api-inference-community/docker_images/open_clip/app
hf_public_repos/api-inference-community/docker_images/open_clip/app/pipelines/zero_shot_image_classification.py
import json from typing import Any, Dict, List, Optional import open_clip import torch import torch.nn.functional as F from app.pipelines import Pipeline from open_clip.pretrained import download_pretrained_from_hf from PIL import Image class ZeroShotImageClassificationPipeline(Pipeline): def __init__(self, mode...
0
hf_public_repos/api-inference-community/docker_images/open_clip/app
hf_public_repos/api-inference-community/docker_images/open_clip/app/pipelines/base.py
from abc import ABC, abstractmethod from typing import Any, Optional class Pipeline(ABC): task: Optional[str] = None model_id: Optional[str] = None @abstractmethod def __init__(self, model_id: str): raise NotImplementedError("Pipelines should implement an __init__ method") @abstractmetho...
0
hf_public_repos/api-inference-community/docker_images/open_clip/app
hf_public_repos/api-inference-community/docker_images/open_clip/app/pipelines/__init__.py
from app.pipelines.base import Pipeline, PipelineException # isort:skip from app.pipelines.zero_shot_image_classification import ( ZeroShotImageClassificationPipeline, )
0
hf_public_repos/api-inference-community/docker_images/open_clip
hf_public_repos/api-inference-community/docker_images/open_clip/tests/test_docker_build.py
import os import subprocess from unittest import TestCase class cd: """Context manager for changing the current working directory""" def __init__(self, newPath): self.newPath = os.path.expanduser(newPath) def __enter__(self): self.savedPath = os.getcwd() os.chdir(self.newPath) ...
0
hf_public_repos/api-inference-community/docker_images/open_clip
hf_public_repos/api-inference-community/docker_images/open_clip/tests/test_api.py
import os from typing import Dict from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS, get_pipeline # Must contain at least one example of each implemented pipeline # Tests do not check the actual values of the model output, so small dummy # models are recommended for faster tests. TESTABLE_MODE...
0
hf_public_repos/api-inference-community/docker_images/open_clip
hf_public_repos/api-inference-community/docker_images/open_clip/tests/test_api_zero_shot_image_classification.py
import json import os from base64 import b64encode from unittest import TestCase, skipIf from app.main import ALLOWED_TASKS from parameterized import parameterized_class from starlette.testclient import TestClient from tests.test_api import TESTABLE_MODELS @skipIf( "zero-shot-image-classification" not in ALLOWED...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/doctr/Dockerfile
FROM tiangolo/uvicorn-gunicorn:python3.8 LABEL maintainer="me <me@example.com>" # Add any system dependency here RUN apt-get update -y && apt-get install libgl1-mesa-glx -y RUN pip install --no-cache-dir -U pip RUN pip install --no-cache-dir torch==1.11 torchvision==0.12 COPY ./requirements.txt /app RUN pip install -...
0
hf_public_repos/api-inference-community/docker_images
hf_public_repos/api-inference-community/docker_images/doctr/requirements.txt
starlette==0.27.0 api-inference-community==0.0.23 python-doctr[torch]==0.5.1 huggingface_hub==0.5.1