text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# Copyright 2023 The HuggingFace 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 required by applicabl...
transformers/tests/models/pix2struct/test_processor_pix2struct.py/0
{ "file_path": "transformers/tests/models/pix2struct/test_processor_pix2struct.py", "repo_id": "transformers", "token_count": 2857 }
806
import { test, expect } from "@jest/globals"; import { CohereEmbeddings } from "../embeddings.js"; test("Test CohereEmbeddings.embedQuery", async () => { const embeddings = new CohereEmbeddings(); const res = await embeddings.embedQuery("Hello world"); expect(typeof res[0]).toBe("number"); }); test("Test Cohere...
langchainjs/libs/langchain-cohere/src/tests/embeddings.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-cohere/src/tests/embeddings.int.test.ts", "repo_id": "langchainjs", "token_count": 373 }
973
# flake8: noqa from langchain_core.prompts.prompt import PromptTemplate EXAMPLES = [ """Setup: You are now playing a fast paced round of TextWorld! Here is your task for today. First of all, you could, like, try to travel east. After that, take the binder from the locker. With the binder, place the binder on the m...
langchain/libs/langchain/langchain/agents/react/textworld_prompt.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/react/textworld_prompt.py", "repo_id": "langchain", "token_count": 568 }
470
python_tests()
llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-neo4j/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/graph_stores/llama-index-graph-stores-neo4j/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,335
"""RAG Fusion Pipeline.""" from typing import Any, Dict, List, Optional from llama_index.core import Document, ServiceContext, VectorStoreIndex from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.llms.llm import LLM from llama_index.core.node_parser import SentenceSplitter from llama_inde...
llama_index/llama-index-packs/llama-index-packs-rag-fusion-query-pipeline/llama_index/packs/rag_fusion_query_pipeline/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-rag-fusion-query-pipeline/llama_index/packs/rag_fusion_query_pipeline/base.py", "repo_id": "llama_index", "token_count": 1888 }
1,667
"""Prompt template that contains few shot examples.""" from __future__ import annotations from pathlib import Path from typing import Any, Dict, List, Literal, Optional, Union from langchain_core.messages import BaseMessage, get_buffer_string from langchain_core.prompts.chat import ( BaseChatPromptTemplate, ...
langchain/libs/core/langchain_core/prompts/few_shot.py/0
{ "file_path": "langchain/libs/core/langchain_core/prompts/few_shot.py", "repo_id": "langchain", "token_count": 5012 }
427
<jupyter_start><jupyter_text>Cassandra [Cassandra](https://cassandra.apache.org/) is a NoSQL, row-oriented, highly scalable and highly available database.Starting with version 5.0, the database ships with [vector search capabilities](https://cassandra.apache.org/doc/trunk/cassandra/vector-search/overview.html). Overvi...
langchain/docs/docs/integrations/document_loaders/cassandra.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/cassandra.ipynb", "repo_id": "langchain", "token_count": 831 }
99
[package] name = "candle-onnx" version = "0.4.0" edition = "2021" description = "ONNX support for Candle" repository = "https://github.com/huggingface/candle" keywords = ["blas", "tensor", "machine-learning"] categories = ["science"] license = "MIT OR Apache-2.0" [dependencies] candle = { path = "../candle-core", pac...
candle/candle-onnx/Cargo.toml/0
{ "file_path": "candle/candle-onnx/Cargo.toml", "repo_id": "candle", "token_count": 242 }
70
from langchain_community.document_loaders.telegram import ( TelegramChatApiLoader, TelegramChatFileLoader, concatenate_rows, text_to_docs, ) __all__ = [ "concatenate_rows", "TelegramChatFileLoader", "text_to_docs", "TelegramChatApiLoader", ]
langchain/libs/langchain/langchain/document_loaders/telegram.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/telegram.py", "repo_id": "langchain", "token_count": 112 }
494
<jupyter_start><jupyter_text>ReAct Agent - A Simple Intro with Calculator ToolsThis is a notebook that showcases the ReAct agent over very simple calculator tools (no fancy RAG pipelines or API calls).We show how it can reason step-by-step over different tools to achieve the end goal. If you're opening this Notebook on...
llama_index/docs/examples/agent/react_agent.ipynb/0
{ "file_path": "llama_index/docs/examples/agent/react_agent.ipynb", "repo_id": "llama_index", "token_count": 2154 }
1,043
""" Wrapper around scikit-learn NearestNeighbors implementation. The vector store can be persisted in json, bson or parquet format. """ import json import math import os from abc import ABC, abstractmethod from typing import Any, Dict, Iterable, List, Literal, Optional, Tuple, Type from uuid import uuid4 from langch...
langchain/libs/community/langchain_community/vectorstores/sklearn.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/sklearn.py", "repo_id": "langchain", "token_count": 5544 }
312
from langchain_core.output_parsers import BaseOutputParser class BooleanOutputParser(BaseOutputParser[bool]): """Parse the output of an LLM call to a boolean.""" true_val: str = "YES" """The string value that should be parsed as True.""" false_val: str = "NO" """The string value that should be pa...
langchain/libs/langchain/langchain/output_parsers/boolean.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/boolean.py", "repo_id": "langchain", "token_count": 438 }
525
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # 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 ag...
diffusers/tests/pipelines/stable_diffusion_sag/test_stable_diffusion_sag.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_sag/test_stable_diffusion_sag.py", "repo_id": "diffusers", "token_count": 3475 }
276
#!/bin/bash # ref: github.com/milvus-io/milvus/docker/buidler/cpu/centos7/Dockerfile github.com/milvus-io/milvus/docker/openblas/centos7/Dockerfile # Install devltoolset yum install -y epel-release centos-release-scl-rh && yum install -y wget make automake \ devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-g...
milvus/build/rpm/setup-env.sh/0
{ "file_path": "milvus/build/rpm/setup-env.sh", "repo_id": "milvus", "token_count": 1211 }
1,706
<jupyter_start><jupyter_code># Setup OpenAI Agent import openai openai.api_key = "sk-your-key" from llama_index.agent import OpenAIAgent from llama_index.tools.azure_speech.base import AzureSpeechToolSpec from llama_index.tools.azure_translate.base import AzureTranslateToolSpec speech_tool = AzureSpeechToolSpec(speec...
llama_index/llama-index-integrations/tools/llama-index-tools-azure-speech/examples/azure_speech.ipynb/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-azure-speech/examples/azure_speech.ipynb", "repo_id": "llama_index", "token_count": 638 }
1,504
import os from pathlib import Path from langchain_community.vectorstores import Chroma from langchain_experimental.open_clip import OpenCLIPEmbeddings # Load images img_dump_path = Path(__file__).parent / "docs/" rel_img_dump_path = img_dump_path.relative_to(Path.cwd()) image_uris = sorted( [ os.path.join...
langchain/templates/rag-multi-modal-local/ingest.py/0
{ "file_path": "langchain/templates/rag-multi-modal-local/ingest.py", "repo_id": "langchain", "token_count": 400 }
679
import time import uuid from typing import Any, Dict, Optional import numpy as np def parse_input( input_text: str, tokenizer: Any, end_id: int, remove_input_padding: bool ) -> Any: try: import torch except ImportError: raise ImportError("nvidia_tensorrt requires `pip install torch`.") ...
llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-tensorrt/llama_index/llms/nvidia_tensorrt/utils.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-nvidia-tensorrt/llama_index/llms/nvidia_tensorrt/utils.py", "repo_id": "llama_index", "token_count": 1194 }
1,408
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. 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/LI...
diffusers/examples/dreambooth/train_dreambooth_lora.py/0
{ "file_path": "diffusers/examples/dreambooth/train_dreambooth_lora.py", "repo_id": "diffusers", "token_count": 25990 }
213
"""Init params."""
llama_index/llama-index-legacy/llama_index/legacy/agent/custom/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/custom/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,686
# order by contributions reviewers: - godchen0212 - czs007 - xige-16 - cydrain - bigsheeper - scsven - DragonDriver approvers: - maintainers
milvus/internal/distributed/OWNERS/0
{ "file_path": "milvus/internal/distributed/OWNERS", "repo_id": "milvus", "token_count": 62 }
1,706
import pytest from langchain_core.outputs.llm_result import LLMResult from langchain_core.tracers.context import collect_runs from tests.unit_tests.fake.callbacks import ( BaseFakeCallbackHandler, FakeAsyncCallbackHandler, FakeCallbackHandler, ) from tests.unit_tests.fake.llm import FakeListLLM, FakeStream...
langchain/libs/core/tests/unit_tests/language_models/llms/test_base.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/language_models/llms/test_base.py", "repo_id": "langchain", "token_count": 1819 }
406
"""Test the FileMove tool.""" from pathlib import Path from tempfile import TemporaryDirectory from langchain_community.tools.file_management.move import MoveFileTool from langchain_community.tools.file_management.utils import ( INVALID_PATH_TEMPLATE, ) def test_move_file_with_root_dir() -> None: """Test th...
langchain/libs/community/tests/unit_tests/tools/file_management/test_move.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/tools/file_management/test_move.py", "repo_id": "langchain", "token_count": 780 }
385
from langchain_community.embeddings import OpenAIEmbeddings from langchain_community.vectorstores import FAISS from langchain.retrievers.contextual_compression import ContextualCompressionRetriever from langchain.retrievers.document_compressors import EmbeddingsFilter def test_contextual_compression_retriever_get_re...
langchain/libs/langchain/tests/integration_tests/retrievers/test_contextual_compression.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/retrievers/test_contextual_compression.py", "repo_id": "langchain", "token_count": 385 }
626
from typing import Dict, Type from llama_index.core.base.embeddings.base import BaseEmbedding from llama_index.core.embeddings.mock_embed_model import MockEmbedding RECOGNIZED_EMBEDDINGS: Dict[str, Type[BaseEmbedding]] = { MockEmbedding.class_name(): MockEmbedding, } def load_embed_model(data: dict) -> BaseEmbe...
llama_index/llama-index-core/llama_index/core/embeddings/loading.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/embeddings/loading.py", "repo_id": "llama_index", "token_count": 275 }
1,114
# Introduction <CourseFloatingBanner unit={0} classNames="absolute z-10 right-0 top-0" /> ## Welcome to the course on diffusion models 🤗 ! ## What to expect? In this free course, you will: - 👩‍🎓 Study the theory behind diffusion models - 🧨 Learn how to generate images and audio with the popular 🤗 Diffu...
diffusion-models-class/units/en/unit0/1.mdx/0
{ "file_path": "diffusion-models-class/units/en/unit0/1.mdx", "repo_id": "diffusion-models-class", "token_count": 1359 }
287
# Web Explorer This is a lightweight app using the [Web Research Retriever](https://github.com/langchain-ai/langchain/pull/8102). ## Setup You only need to supply a few things. In `settings()` function, supply: * Search: Select the search tool you want to use (e.g., GoogleSearchAPIWrapper). * Vectorstore: Select t...
web-explorer/README.md/0
{ "file_path": "web-explorer/README.md", "repo_id": "web-explorer", "token_count": 467 }
1,994
# flake8: noqa # The description of the chain you are exposing. This will be used by ChatGPT to decide when to call it. ENDPOINT_DESCRIPTION = "" # The name of your endpoint that you are exposing. ENDPOINT_NAME = "" # The input key for the chain. The user input will get mapped to this key. INPUT_NAME = "" # The output ...
langchain-aiplugin/template/constants.py/0
{ "file_path": "langchain-aiplugin/template/constants.py", "repo_id": "langchain-aiplugin", "token_count": 210 }
62
# coding=utf-8 # Copyright 2020 The HuggingFace 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 requir...
transformers/tests/models/openai/test_modeling_openai.py/0
{ "file_path": "transformers/tests/models/openai/test_modeling_openai.py", "repo_id": "transformers", "token_count": 5450 }
742
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. 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 r...
transformers/src/transformers/models/lilt/modeling_lilt.py/0
{ "file_path": "transformers/src/transformers/models/lilt/modeling_lilt.py", "repo_id": "transformers", "token_count": 22248 }
636
<!--Copyright 2023 The HuggingFace 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 required by applicable law or agreed...
transformers/docs/source/ja/model_doc/blip-2.md/0
{ "file_path": "transformers/docs/source/ja/model_doc/blip-2.md", "repo_id": "transformers", "token_count": 2258 }
491
""" PyTorch implementation of DualPathNetworks Based on original MXNet implementation https://github.com/cypw/DPNs with many ideas from another PyTorch implementation https://github.com/oyam/pytorch-DPNs. This implementation is compatible with the pretrained weights from cypw's MXNet implementation. Hacked together b...
pytorch-image-models/timm/models/dpn.py/0
{ "file_path": "pytorch-image-models/timm/models/dpn.py", "repo_id": "pytorch-image-models", "token_count": 6985 }
372
import { logVersion010MigrationWarning } from "../../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "stores/message/redis", newEntrypointName: "", newPackageName: "@langchain/redis", }); export * from "@langchain/community/stores/message/redis";
langchainjs/langchain/src/stores/message/redis.ts/0
{ "file_path": "langchainjs/langchain/src/stores/message/redis.ts", "repo_id": "langchainjs", "token_count": 97 }
927
# Copyright 2024 The HuggingFace 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 required by applicabl...
diffusers/src/diffusers/models/autoencoders/autoencoder_asym_kl.py/0
{ "file_path": "diffusers/src/diffusers/models/autoencoders/autoencoder_asym_kl.py", "repo_id": "diffusers", "token_count": 3208 }
223
search_performance: collections: - server: db_config.primary_path: /test/milvus/db_data_7/sift_50m_2048_128_l2_sq8_wal cache_config.cpu_cache_capacity: 32 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 0 gpu_resource_config.enable: true ...
milvus/tests/benchmark/milvus_benchmark/suites/metric.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/metric.yaml", "repo_id": "milvus", "token_count": 805 }
1,977
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-anyscale/llama_index/llms/anyscale/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-anyscale/llama_index/llms/anyscale/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,248
# order by contributions reviewers: - sunby - czs007 - XuanYang-cn approvers: - maintainers
milvus/pkg/log/OWNERS/0
{ "file_path": "milvus/pkg/log/OWNERS", "repo_id": "milvus", "token_count": 37 }
1,914
"""Init params.""" from llama_index.legacy.readers.chatgpt_plugin.base import ChatGPTRetrievalPluginReader __all__ = ["ChatGPTRetrievalPluginReader"]
llama_index/llama-index-legacy/llama_index/legacy/readers/chatgpt_plugin/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/chatgpt_plugin/__init__.py", "repo_id": "llama_index", "token_count": 52 }
1,592
{ "modelname": "TemplateBI", "uppercase_modelname": "TEMPLATE_BI", "lowercase_modelname": "template_bi", "camelcase_modelname": "TemplateBi", "authors": "The HuggingFace Team", "checkpoint_identifier": "bi-brand-new-bert-base-cased", "tokenizer_type": "Standalone", "generate_tensorflow_pytorch_and_flax"...
transformers/templates/adding_a_new_model/tests/standalone.json/0
{ "file_path": "transformers/templates/adding_a_new_model/tests/standalone.json", "repo_id": "transformers", "token_count": 155 }
696
import importlib import logging import pkgutil from typing import Union, Dict, Type, Callable # noqa: F401 from chromadb.auth import ( ClientAuthConfigurationProvider, ClientAuthCredentialsProvider, ClientAuthProtocolAdapter, ServerAuthProvider, ServerAuthConfigurationProvider, ServerAuthCrede...
chroma/chromadb/auth/registry.py/0
{ "file_path": "chroma/chromadb/auth/registry.py", "repo_id": "chroma", "token_count": 2016 }
14
#!/usr/bin/env bash BUILD_UNITTEST="OFF" while getopts "p:s:t:h" arg; do case $arg in p) INSTALL_PREFIX=$OPTARG ;; s) SOURCE_DIR=$OPTARG ;; t) BUILD_UNITTEST=$OPTARG ;; h) # help echo " parameter: -p: install prefix -s: source directory -t: ON means build with unittest -h: help us...
milvus/scripts/azure_build.sh/0
{ "file_path": "milvus/scripts/azure_build.sh", "repo_id": "milvus", "token_count": 519 }
1,929
# SE-ResNet **SE ResNet** is a variant of a [ResNet](https://www.paperswithcode.com/method/resnet) that employs [squeeze-and-excitation blocks](https://paperswithcode.com/method/squeeze-and-excitation-block) to enable the network to perform dynamic channel-wise feature recalibration. {% include 'code_snippets.md' %} ...
pytorch-image-models/docs/models/.templates/models/se-resnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/se-resnet.md", "repo_id": "pytorch-image-models", "token_count": 1371 }
347
from langchain_community.vectorstores.scann import ( ScaNN, ) __all__ = ["ScaNN"]
langchain/libs/langchain/langchain/vectorstores/scann.py/0
{ "file_path": "langchain/libs/langchain/langchain/vectorstores/scann.py", "repo_id": "langchain", "token_count": 35 }
606
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. 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 r...
transformers/src/transformers/models/lilt/configuration_lilt.py/0
{ "file_path": "transformers/src/transformers/models/lilt/configuration_lilt.py", "repo_id": "transformers", "token_count": 2571 }
650
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/agent/runner/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/runner/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,504
[build-system] build-backend = "poetry.core.masonry.api" requires = ["poetry-core"] [tool.codespell] check-filenames = true check-hidden = true skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb" [tool.llamahub] classes = ["ZephyrQueryEnginePack"] contains_example = false import_path = "llama_index.packs.zephyr_...
llama_index/llama-index-packs/llama-index-packs-zephyr-query-engine/pyproject.toml/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-zephyr-query-engine/pyproject.toml", "repo_id": "llama_index", "token_count": 760 }
1,697
python_tests()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-singlestoredb/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-singlestoredb/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,621
build_performance: collections: - server: db_config.primary_path: /test/milvus/db_data_070/sift_50m_1024_128_l2_sq8h_wal cache_config.cpu_cache_capacity: 32 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: true ...
milvus/tests/benchmark/milvus_benchmark/suites/cpu_build_performance.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/cpu_build_performance.yaml", "repo_id": "milvus", "token_count": 313 }
1,871
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-file/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,354
from llama_index.core.base.base_retriever import BaseRetriever from llama_index.retrievers.pathway.base import PathwayRetriever def test_class(): names_of_base_classes = [b.__name__ for b in PathwayRetriever.__mro__] assert BaseRetriever.__name__ in names_of_base_classes
llama_index/llama-index-integrations/retrievers/llama-index-retrievers-pathway/tests/test_retrievers_pathway_retriever.py/0
{ "file_path": "llama_index/llama-index-integrations/retrievers/llama-index-retrievers-pathway/tests/test_retrievers_pathway_retriever.py", "repo_id": "llama_index", "token_count": 102 }
1,409
python_tests()
llama_index/llama-index-integrations/tools/llama-index-tools-ionic-shopping/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-ionic-shopping/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,427
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from transformers.configuration_utils import PretrainedConfig from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_attn from text_generation_server.utils.layers im...
text-generation-inference/server/text_generation_server/models/custom_modeling/flash_phi_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_phi_modeling.py", "repo_id": "text-generation-inference", "token_count": 6560 }
414
import logging import langsmith import streamlit as st from langchain import callbacks, chat_models from langchain.prompts import ChatPromptTemplate logging.basicConfig(level=logging.INFO) st.set_page_config( page_title="LangSmith Trace Tutor", page_icon="🦜", initial_sidebar_state="collapsed", ) """# Us...
langsmith-cookbook/tracing-examples/show-trace-url-streamlit/main.py/0
{ "file_path": "langsmith-cookbook/tracing-examples/show-trace-url-streamlit/main.py", "repo_id": "langsmith-cookbook", "token_count": 682 }
1,141
# Copyright 2020 The HuggingFace 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 required by applicabl...
transformers/src/transformers/models/marian/convert_marian_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/marian/convert_marian_to_pytorch.py", "repo_id": "transformers", "token_count": 12637 }
687
<!--Copyright 2024 The HuggingFace 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 required by applicable law or agreed...
diffusers/docs/source/ko/installation.md/0
{ "file_path": "diffusers/docs/source/ko/installation.md", "repo_id": "diffusers", "token_count": 3687 }
192
import time import os from datetime import timedelta from loguru import logger from pathlib import Path from typing import Optional, List from huggingface_hub import file_download, hf_api, HfApi, hf_hub_download from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE from huggingface_hub.utils import ( LocalE...
text-generation-inference/server/text_generation_server/utils/hub.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/utils/hub.py", "repo_id": "text-generation-inference", "token_count": 3435 }
402
import { ChatMinimax } from "@langchain/community/chat_models/minimax"; import { HumanMessage } from "@langchain/core/messages"; // Use abab5.5 const abab5_5 = new ChatMinimax({ modelName: "abab5.5-chat", botSetting: [ { bot_name: "MM Assistant", content: "MM Assistant is an AI Assistant developed ...
langchainjs/examples/src/models/chat/integration_minimax.ts/0
{ "file_path": "langchainjs/examples/src/models/chat/integration_minimax.ts", "repo_id": "langchainjs", "token_count": 512 }
867
<!--Copyright 2024 The HuggingFace 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 required by applicable law or agreed...
diffusers/docs/source/pt/index.md/0
{ "file_path": "diffusers/docs/source/pt/index.md", "repo_id": "diffusers", "token_count": 1653 }
201
<!--Copyright 2022 The HuggingFace 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 required by applicable law or agreed...
accelerate/docs/source/index.md/0
{ "file_path": "accelerate/docs/source/index.md", "repo_id": "accelerate", "token_count": 1371 }
3
#!/usr/bin/env python # coding=utf-8 # Copyright 2022 The HuggingFace Inc. 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/LI...
transformers/examples/pytorch/image-pretraining/run_mim.py/0
{ "file_path": "transformers/examples/pytorch/image-pretraining/run_mim.py", "repo_id": "transformers", "token_count": 8028 }
524
# Quick Tour The easiest way of getting started is using the official Docker container. Install Docker following [their installation instructions](https://docs.docker.com/get-docker/). Let's say you want to deploy [Falcon-7B Instruct](https://huggingface.co/tiiuae/falcon-7b-instruct) model with TGI. Here is an exampl...
text-generation-inference/docs/source/quicktour.md/0
{ "file_path": "text-generation-inference/docs/source/quicktour.md", "repo_id": "text-generation-inference", "token_count": 1205 }
361
# coding=utf-8 # Copyright 2023 The Pop2Piano Authors and The HuggingFace Inc. 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/license...
transformers/src/transformers/models/pop2piano/modeling_pop2piano.py/0
{ "file_path": "transformers/src/transformers/models/pop2piano/modeling_pop2piano.py", "repo_id": "transformers", "token_count": 28646 }
682
# Copyright 2024 The HuggingFace 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 required by applicabl...
diffusers/scripts/convert_stable_diffusion_checkpoint_to_onnx.py/0
{ "file_path": "diffusers/scripts/convert_stable_diffusion_checkpoint_to_onnx.py", "repo_id": "diffusers", "token_count": 4384 }
218
import os import random import tempfile import unittest import numpy as np import pandas as pd import pyarrow as pa import pytest from absl.testing import parameterized import datasets from datasets.arrow_writer import ArrowWriter from datasets.features import Array2D, Array3D, Array4D, Array5D, Value from datasets.f...
datasets/tests/features/test_array_xd.py/0
{ "file_path": "datasets/tests/features/test_array_xd.py", "repo_id": "datasets", "token_count": 9826 }
147
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/pkg/config/etcd_source_test.go/0
{ "file_path": "milvus/pkg/config/etcd_source_test.go", "repo_id": "milvus", "token_count": 1035 }
1,911
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/datanode/syncmgr/taskv2.go/0
{ "file_path": "milvus/internal/datanode/syncmgr/taskv2.go", "repo_id": "milvus", "token_count": 2429 }
1,980
# CSV files This example goes over how to load data from CSV files. The second argument is the `column` name to extract from the CSV file. One document will be created for each row in the CSV file. When `column` is not specified, each row is converted into a key/value pair with each key/value pair outputted to a new l...
langchainjs/docs/core_docs/docs/integrations/document_loaders/file_loaders/csv.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/document_loaders/file_loaders/csv.mdx", "repo_id": "langchainjs", "token_count": 684 }
712
--- sidebar_position: 5 --- # Examples 🚧 _Docs under construction_ 🚧 Below are some examples for inspecting and checking different chains. import DocCardList from "@theme/DocCardList"; <DocCardList />
langchain/docs/docs/guides/evaluation/examples/index.mdx/0
{ "file_path": "langchain/docs/docs/guides/evaluation/examples/index.mdx", "repo_id": "langchain", "token_count": 61 }
93
# MnasNet **MnasNet** is a type of convolutional neural network optimized for mobile devices that is discovered through mobile neural architecture search, which explicitly incorporates model latency into the main objective so that the search can identify a model that achieves a good trade-off between accuracy and late...
pytorch-image-models/docs/models/.templates/models/mnasnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/mnasnet.md", "repo_id": "pytorch-image-models", "token_count": 1292 }
347
<jupyter_start><jupyter_text>Déboguer le pipeline d'entraînementCe chapitre portant sur le débogage, la langue nous importe peu ici. Nous nous intéressons surtout à la logique du code pour comprendre d'où provient l'erreur. Installez les bibliothèques 🤗 Transformers et 🤗 Datasets pour exécuter ce *notebook*.<jupyter_...
notebooks/course/fr/chapter8/section4.ipynb/0
{ "file_path": "notebooks/course/fr/chapter8/section4.ipynb", "repo_id": "notebooks", "token_count": 3404 }
293
# Dealing with Rate Limits Some LLM providers have rate limits. If you exceed the rate limit, you'll get an error. To help you deal with this, LangChain provides a `maxConcurrency` option when instantiating an LLM. This option allows you to specify the maximum number of concurrent requests you want to make to the LLM ...
langchainjs/docs/core_docs/docs/modules/model_io/llms/dealing_with_rate_limits.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/model_io/llms/dealing_with_rate_limits.mdx", "repo_id": "langchainjs", "token_count": 304 }
817
import json from types import SimpleNamespace from typing import Any, Dict, Optional, Sequence import requests CLASS_QUERY = """ SELECT DISTINCT ?elem ?com WHERE { ?instance a ?elem . OPTIONAL { ?instance rdf:type/rdfs:subClassOf* ?elem } . #FILTER (isIRI(?elem)) . OPTIONAL { ?elem rdfs:comment ?com filter (lang...
langchain/libs/community/langchain_community/graphs/neptune_rdf_graph.py/0
{ "file_path": "langchain/libs/community/langchain_community/graphs/neptune_rdf_graph.py", "repo_id": "langchain", "token_count": 3900 }
263
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 ag...
transformers/tests/models/nougat/test_image_processing_nougat.py/0
{ "file_path": "transformers/tests/models/nougat/test_image_processing_nougat.py", "repo_id": "transformers", "token_count": 3133 }
760
[tool.poetry] name = "rag-chroma-multi-modal-multi-vector" version = "0.1.0" description = "Multi-modal RAG using Chroma and multi-vector retriever" authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = ">=0.0.353,<0.2" openai = "<2"...
langchain/templates/rag-chroma-multi-modal-multi-vector/pyproject.toml/0
{ "file_path": "langchain/templates/rag-chroma-multi-modal-multi-vector/pyproject.toml", "repo_id": "langchain", "token_count": 385 }
652
# coding=utf-8 # Copyright 2022 Facebook AI and The HuggingFace Inc. 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-...
transformers/src/transformers/models/vit_mae/configuration_vit_mae.py/0
{ "file_path": "transformers/src/transformers/models/vit_mae/configuration_vit_mae.py", "repo_id": "transformers", "token_count": 2504 }
686
from typing import Dict from pytest_mock import MockerFixture from langchain_community.embeddings import InfinityEmbeddings _MODEL_ID = "BAAI/bge-small" _INFINITY_BASE_URL = "https://localhost/api" _DOCUMENTS = [ "pizza", "another pizza", "a document", "another pizza", "super long document with m...
langchain/libs/community/tests/unit_tests/embeddings/test_infinity.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/embeddings/test_infinity.py", "repo_id": "langchain", "token_count": 1208 }
373
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/proxy/msg_pack.go/0
{ "file_path": "milvus/internal/proxy/msg_pack.go", "repo_id": "milvus", "token_count": 3505 }
1,746
use crate::utils::SysRegex; use crate::{Offsets, Result}; use regex::Regex; /// Pattern used to split a NormalizedString pub trait Pattern { /// Slice the given string in a list of pattern match positions, with /// a boolean indicating whether this is a match or not. /// /// This method *must* cover th...
tokenizers/tokenizers/src/tokenizer/pattern.rs/0
{ "file_path": "tokenizers/tokenizers/src/tokenizer/pattern.rs", "repo_id": "tokenizers", "token_count": 3903 }
470
# ruff: noqa: E501 import os from datetime import timedelta from langchain.chains.query_constructor.base import AttributeInfo from langchain.retrievers.self_query.base import SelfQueryRetriever from langchain_community.chat_models import ChatOpenAI from langchain_community.embeddings.openai import OpenAIEmbeddings fr...
langchain/templates/rag-timescale-hybrid-search-time/rag_timescale_hybrid_search_time/chain.py/0
{ "file_path": "langchain/templates/rag-timescale-hybrid-search-time/rag_timescale_hybrid_search_time/chain.py", "repo_id": "langchain", "token_count": 1183 }
674
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-postgres/llama_index/vector_stores/postgres/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-postgres/llama_index/vector_stores/postgres/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,616
import random import threading import time from time import sleep import pytest import datetime from pymilvus import connections from base.collection_wrapper import ApiCollectionWrapper from base.utility_wrapper import ApiUtilityWrapper from chaos.checker import Op, CollectionCreateChecker, InsertFlushChecker, IndexC...
milvus/tests/python_client/chaos/test_chaos_memory_stress.py/0
{ "file_path": "milvus/tests/python_client/chaos/test_chaos_memory_stress.py", "repo_id": "milvus", "token_count": 14033 }
1,996
package datanode import ( "testing" "github.com/cockroachdb/errors" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" "github.com/milvus-io/milvus/pkg/mq/msgstream" "github.com/milvus-io/milvus/pkg/util/tsoutil" ) type MqStatsUpdaterSuite struct { suite.Suite producer *msgstream.MockMs...
milvus/internal/datanode/stats_updater_test.go/0
{ "file_path": "milvus/internal/datanode/stats_updater_test.go", "repo_id": "milvus", "token_count": 647 }
1,780
# Licensed to the LF AI & Data foundation under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not use this fil...
milvus/scripts/run_docker.sh/0
{ "file_path": "milvus/scripts/run_docker.sh", "repo_id": "milvus", "token_count": 582 }
1,953
/** * Formatting function definitions for calculating openai function defination token usage. * * https://github.com/hmarr/openai-chat-tokens/blob/main/src/functions.ts * (c) 2023 Harry Marr * MIT license */ import { FunctionDefinition } from "@azure/openai"; export interface FunctionDef extends Omit<FunctionDe...
langchainjs/libs/langchain-azure-openai/src/utils/openai-format-fndef.ts/0
{ "file_path": "langchainjs/libs/langchain-azure-openai/src/utils/openai-format-fndef.ts", "repo_id": "langchainjs", "token_count": 1326 }
1,043
python_tests()
llama_index/llama-index-packs/llama-index-packs-zephyr-query-engine/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-zephyr-query-engine/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,617
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-azstorage-blob/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-azstorage-blob/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,410
import { dev } from "$app/environment"; import { base } from "$app/paths"; import { COOKIE_NAME } from "$env/static/private"; import { collections } from "$lib/server/database"; import { redirect } from "@sveltejs/kit"; export const actions = { async default({ cookies, locals }) { await collections.sessions.deleteO...
chat-ui/src/routes/logout/+page.server.ts/0
{ "file_path": "chat-ui/src/routes/logout/+page.server.ts", "repo_id": "chat-ui", "token_count": 203 }
104
[tool.poetry] name = "rag-self-query" version = "0.0.1" description = "RAG with metadata filtering using self-query retriever on Elasticsearch vector store" authors = [] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" openai = "<2" elasticsearch = "^8.10.0" sentence-transform...
langchain/templates/rag-self-query/pyproject.toml/0
{ "file_path": "langchain/templates/rag-self-query/pyproject.toml", "repo_id": "langchain", "token_count": 325 }
687
<jupyter_start><jupyter_text>Semantic Scholar API ToolThis notebook demos how to use the semantic scholar tool with an agent.<jupyter_code># start by installing semanticscholar api %pip install --upgrade --quiet semanticscholar from langchain import hub from langchain.agents import AgentExecutor, create_openai_functio...
langchain/docs/docs/integrations/tools/semanticscholar.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/tools/semanticscholar.ipynb", "repo_id": "langchain", "token_count": 623 }
178
# candle-distilbert DistilBert is a distiled version of the Bert model. ## Sentence embeddings DistilBert is used to compute the sentence embeddings for a prompt. The model weights are downloaded from the hub on the first run. ```bash cargo run --example distilbert --release -- --prompt "Here is a test sentence" >...
candle/candle-examples/examples/distilbert/README.md/0
{ "file_path": "candle/candle-examples/examples/distilbert/README.md", "repo_id": "candle", "token_count": 367 }
44
"""Test Redis cache functionality.""" import uuid from contextlib import asynccontextmanager, contextmanager from typing import AsyncGenerator, Generator, List, Optional, cast import pytest from langchain_community.cache import AsyncRedisCache, RedisCache, RedisSemanticCache from langchain_core.embeddings import Embe...
langchain/libs/langchain/tests/integration_tests/cache/test_redis_cache.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/cache/test_redis_cache.py", "repo_id": "langchain", "token_count": 4848 }
579
[package] name = "candle-kernels" version = "0.4.0" edition = "2021" description = "CUDA kernels for Candle" repository = "https://github.com/huggingface/candle" keywords = ["blas", "tensor", "machine-learning"] categories = ["science"] license = "MIT OR Apache-2.0" [dependencies] [build-dependencies] bindgen_cuda =...
candle/candle-kernels/Cargo.toml/0
{ "file_path": "candle/candle-kernels/Cargo.toml", "repo_id": "candle", "token_count": 126 }
52
import { SimpleChatModel, type BaseChatModelParams, } from "@langchain/core/language_models/chat_models"; import type { BaseLanguageModelCallOptions } from "@langchain/core/language_models/base"; import { AIMessageChunk, BaseMessage, ChatMessage, } from "@langchain/core/messages"; import { ChatGenerationChunk...
langchainjs/libs/langchain-community/src/chat_models/cloudflare_workersai.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/chat_models/cloudflare_workersai.ts", "repo_id": "langchainjs", "token_count": 2861 }
948
import json from typing import Iterable, List import requests def get_response(response: requests.Response) -> List[str]: data = json.loads(response.content) return data["text"] def post_http_request( api_url: str, sampling_params: dict = {}, stream: bool = False ) -> requests.Response: headers = {...
llama_index/llama-index-legacy/llama_index/legacy/llms/vllm_utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/vllm_utils.py", "repo_id": "llama_index", "token_count": 279 }
1,527
accuracy: collections: - server: db_config.primary_path: /test/milvus/db_data_7/sift_10m_1024_128_l2_nsg_wal cache_config.cpu_cache_capacity: 50 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: false gpu_...
milvus/tests/benchmark/milvus_benchmark/suites/cpu_accuracy_nsg.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/cpu_accuracy_nsg.yaml", "repo_id": "milvus", "token_count": 334 }
1,880
"""Pathway reader.""" from typing import List, Optional, Union from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class PathwayReader(BaseReader): """Pathway reader. Retrieve documents from Pathway data indexing pipeline. Args: host (str): The URI...
llama_index/llama-index-integrations/readers/llama-index-readers-pathway/llama_index/readers/pathway/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-pathway/llama_index/readers/pathway/base.py", "repo_id": "llama_index", "token_count": 741 }
1,426
--- tags: journal/entry, obsidian --- No other content than the frontmatter.
langchainjs/langchain/src/document_loaders/tests/example_data/obsidian/frontmatter.md/0
{ "file_path": "langchainjs/langchain/src/document_loaders/tests/example_data/obsidian/frontmatter.md", "repo_id": "langchainjs", "token_count": 23 }
970
"""Chains for evaluating ReAct style agents.""" from langchain.evaluation.agents.trajectory_eval_chain import TrajectoryEvalChain __all__ = ["TrajectoryEvalChain"]
langchain/libs/langchain/langchain/evaluation/agents/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/evaluation/agents/__init__.py", "repo_id": "langchain", "token_count": 50 }
527
<jupyter_start><jupyter_text>Datetime parserThis OutputParser can be used to parse LLM output into datetime format.<jupyter_code>from langchain.output_parsers import DatetimeOutputParser from langchain.prompts import PromptTemplate from langchain_openai import OpenAI output_parser = DatetimeOutputParser() template = ""...
langchain/docs/docs/modules/model_io/output_parsers/types/datetime.ipynb/0
{ "file_path": "langchain/docs/docs/modules/model_io/output_parsers/types/datetime.ipynb", "repo_id": "langchain", "token_count": 213 }
206
""" Model creation / weight loading / state_dict helpers Hacked together by / Copyright 2020 Ross Wightman """ import logging import os from collections import OrderedDict from typing import Any, Callable, Dict, Optional, Union import torch try: import safetensors.torch _has_safetensors = True except ImportEr...
pytorch-image-models/timm/models/_helpers.py/0
{ "file_path": "pytorch-image-models/timm/models/_helpers.py", "repo_id": "pytorch-image-models", "token_count": 2546 }
381
# Copyright 2023 Mistral AI and The HuggingFace Inc. 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 r...
transformers/src/transformers/models/mixtral/convert_mixtral_weights_to_hf.py/0
{ "file_path": "transformers/src/transformers/models/mixtral/convert_mixtral_weights_to_hf.py", "repo_id": "transformers", "token_count": 3952 }
633