text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
""" Model Registry Hacked together by / Copyright 2020 Ross Wightman """ import fnmatch import re import sys import warnings from collections import defaultdict, deque from copy import deepcopy from dataclasses import replace from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Sequence, Union, Tuple...
pytorch-image-models/timm/models/_registry.py/0
{ "file_path": "pytorch-image-models/timm/models/_registry.py", "repo_id": "pytorch-image-models", "token_count": 5428 }
374
import { logVersion010MigrationWarning } from "../util/entrypoint_deprecation.js"; /* #__PURE__ */ logVersion010MigrationWarning({ oldEntrypointName: "tools/aws_sfn", }); export * from "@langchain/community/tools/aws_sfn";
langchainjs/langchain/src/tools/aws_sfn.ts/0
{ "file_path": "langchainjs/langchain/src/tools/aws_sfn.ts", "repo_id": "langchainjs", "token_count": 74 }
971
use crate::{DType, DeviceLocation, Layout, MetalError, Shape}; #[derive(Debug, Clone)] pub struct MatMulUnexpectedStriding { pub lhs_l: Layout, pub rhs_l: Layout, pub bmnk: (usize, usize, usize, usize), pub msg: &'static str, } /// Main library error type. #[derive(thiserror::Error, Debug)] pub enum E...
candle/candle-core/src/error.rs/0
{ "file_path": "candle/candle-core/src/error.rs", "repo_id": "candle", "token_count": 3254 }
31
# flake8: noqa PREFIX = """You are an agent designed to write and execute python code to answer questions. You have access to a python REPL, which you can use to execute python code. If you get an error, debug your code and try again. Only use the output of your code to answer the question. You might know the answer ...
langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/python/prompt.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/agents/agent_toolkits/python/prompt.py", "repo_id": "langchain", "token_count": 129 }
413
<jupyter_start><jupyter_text>Aim CallbackAim is an easy-to-use & supercharged open-source AI metadata tracker it logs all your AI metadata (experiments, prompts, etc) enables a UI to compare & observe them and SDK to query them programmatically. For more please see the [Github page](https://github.com/aimhubio/aim).In ...
llama_index/docs/examples/callbacks/AimCallback.ipynb/0
{ "file_path": "llama_index/docs/examples/callbacks/AimCallback.ipynb", "repo_id": "llama_index", "token_count": 680 }
1,124
// 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/rules.go/0
{ "file_path": "milvus/pkg/rules.go", "repo_id": "milvus", "token_count": 6196 }
2,045
export WANDB_ENTITY=huggingface export WANDB_PROJECT=trl bash $BENCHMARK_SCRIPT > output.txt # Extract Job IDs into an array job_ids=($(grep "Job ID:" output.txt | awk '{print $3}')) # Extract WANDB_TAGS into an array WANDB_TAGS=($(grep "WANDB_TAGS:" output.txt | awk '{print $2}')) WANDB_TAGS=($(echo $WANDB_TAGS | tr...
trl/benchmark/benchmark_and_report.sh/0
{ "file_path": "trl/benchmark/benchmark_and_report.sh", "repo_id": "trl", "token_count": 387 }
874
from langchain_mistralai import __all__ EXPECTED_ALL = ["ChatMistralAI", "MistralAIEmbeddings"] def test_all_imports() -> None: assert sorted(EXPECTED_ALL) == sorted(__all__)
langchain/libs/partners/mistralai/tests/unit_tests/test_imports.py/0
{ "file_path": "langchain/libs/partners/mistralai/tests/unit_tests/test_imports.py", "repo_id": "langchain", "token_count": 68 }
628
# __init__.py from llama_index.tools.slack.base import ( SlackToolSpec, ) __all__ = ["SlackToolSpec"]
llama_index/llama-index-integrations/tools/llama-index-tools-slack/llama_index/tools/slack/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-slack/llama_index/tools/slack/__init__.py", "repo_id": "llama_index", "token_count": 44 }
1,497
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/indices/query/query_transform/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/query/query_transform/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,568
<!--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...
transformers/docs/source/en/model_doc/mobilenet_v2.md/0
{ "file_path": "transformers/docs/source/en/model_doc/mobilenet_v2.md", "repo_id": "transformers", "token_count": 1747 }
496
import re import pytest from langchain.evaluation import RegexMatchStringEvaluator @pytest.fixture def regex_match_string_evaluator() -> RegexMatchStringEvaluator: """Create a RegexMatchStringEvaluator with default configuration.""" return RegexMatchStringEvaluator() @pytest.fixture def regex_match_string...
langchain/libs/langchain/tests/unit_tests/evaluation/regex_match/test_base.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/evaluation/regex_match/test_base.py", "repo_id": "langchain", "token_count": 496 }
624
use candle_transformers::models::segment_anything::sam; use wasm_bindgen::prelude::*; pub use sam::{Sam, IMAGE_SIZE}; #[wasm_bindgen] extern "C" { // Use `js_namespace` here to bind `console.log(..)` instead of just // `log(..)` #[wasm_bindgen(js_namespace = console)] pub fn log(s: &str); } #[macro_e...
candle/candle-wasm-examples/segment-anything/src/lib.rs/0
{ "file_path": "candle/candle-wasm-examples/segment-anything/src/lib.rs", "repo_id": "candle", "token_count": 213 }
85
package kv import ( "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus/pkg/util/typeutil" ) func Test_mockSnapshotKV_Save(t *testing.T) { t.Run("func not set", func(t *testing.T) { snapshot := NewMockSnapshotKV() err := snapshot.Save("k", "v", 0) assert.NoError(t, err) }) t.Run(...
milvus/internal/kv/mock_snapshot_kv_test.go/0
{ "file_path": "milvus/internal/kv/mock_snapshot_kv_test.go", "repo_id": "milvus", "token_count": 1044 }
1,939
# 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/convert_graph_to_onnx.py/0
{ "file_path": "transformers/src/transformers/convert_graph_to_onnx.py", "repo_id": "transformers", "token_count": 7904 }
630
python_tests()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-ollama/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-ollama/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,371
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; # Wikipedia tool The `WikipediaQueryRun` tool connects your agents and chains to Wikipedia. ## Usage import ToolExample from "@examples/tools/wikipedia.ts"; <CodeBlock language="typescript">{ToolExample}</CodeBlock>
langchainjs/docs/core_docs/docs/integrations/tools/wikipedia.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/tools/wikipedia.mdx", "repo_id": "langchainjs", "token_count": 88 }
716
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team. # # 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...
transformers/src/transformers/pipelines/base.py/0
{ "file_path": "transformers/src/transformers/pipelines/base.py", "repo_id": "transformers", "token_count": 22804 }
747
import { zodToJsonSchema } from "zod-to-json-schema"; import fs from "fs"; import { z } from "zod"; import { AgentAction, AgentFinish, AgentStep } from "@langchain/core/agents"; import { AIMessage } from "@langchain/core/messages"; import { OpenAIEmbeddings, ChatOpenAI } from "@langchain/openai"; import { convertToOpen...
langchainjs/langchain/src/agents/tests/structured_output_runnables.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/agents/tests/structured_output_runnables.int.test.ts", "repo_id": "langchainjs", "token_count": 1605 }
897
import { MemoryVectorStore } from "langchain/vectorstores/memory"; import { OpenAIEmbeddings } from "@langchain/openai"; import { similarity } from "ml-distance"; const vectorStore = await MemoryVectorStore.fromTexts( ["Hello world", "Bye bye", "hello nice world"], [{ id: 2 }, { id: 1 }, { id: 3 }], new OpenAIEm...
langchainjs/examples/src/indexes/vector_stores/memory_custom_similarity.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/memory_custom_similarity.ts", "repo_id": "langchainjs", "token_count": 145 }
786
from llama_index.core.program.llm_prompt_program import BaseLLMFunctionProgram from llama_index.program.guidance import GuidancePydanticProgram def test_class(): names_of_base_classes = [b.__name__ for b in GuidancePydanticProgram.__mro__] assert BaseLLMFunctionProgram.__name__ in names_of_base_classes
llama_index/llama-index-integrations/program/llama-index-program-guidance/tests/test_program_guidance.py/0
{ "file_path": "llama_index/llama-index-integrations/program/llama-index-program-guidance/tests/test_program_guidance.py", "repo_id": "llama_index", "token_count": 105 }
1,254
// Copyright (C) 2019-2020 Zilliz. 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 l...
milvus/internal/core/src/segcore/plan_c.h/0
{ "file_path": "milvus/internal/core/src/segcore/plan_c.h", "repo_id": "milvus", "token_count": 762 }
1,750
import pytest from base.client_base import TestcaseBase from common import common_func as cf from common import common_type as ct from common.common_type import CaseLabel from utils.util_log import test_log as log # customer rg rg_name_0 = "RG_0" rg_name_1 = "RG_1" # coll name coll_name_1 = "ResourceGroup_111" coll_...
milvus/tests/python_client/chaos/testcases/test_chaos_resource_group.py/0
{ "file_path": "milvus/tests/python_client/chaos/testcases/test_chaos_resource_group.py", "repo_id": "milvus", "token_count": 5127 }
2,175
from typing import List, Optional import aiohttp import requests from langchain_core.callbacks import ( AsyncCallbackManagerForRetrieverRun, CallbackManagerForRetrieverRun, ) from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever class DataberryRetriever(BaseRetriev...
langchain/libs/community/langchain_community/retrievers/databerry.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/databerry.py", "repo_id": "langchain", "token_count": 1247 }
272
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/indices/tree/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/tree/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,522
<jupyter_start><jupyter_text>Document Summary IndexThis demo showcases the document summary index, over Wikipedia articles on different cities.The document summary index will extract a summary from each document and store that summary, as well as all nodes corresponding to the document.Retrieval can be performed throug...
llama_index/docs/examples/index_structs/doc_summary/DocSummary.ipynb/0
{ "file_path": "llama_index/docs/examples/index_structs/doc_summary/DocSummary.ipynb", "repo_id": "llama_index", "token_count": 2182 }
1,104
#include <torch/extension.h> #include "ATen/ATen.h" typedef at::BFloat16 bf16; void cuda_forward(int B, int T, int C, float *w, float *u, float *k, float *v, float *y); void cuda_forward_bf16(int B, int T, int C, float *w, bf16 *u, bf16 *k, bf16 *v, bf16 *y); void cuda_forward_with_state(int B, int T, int C, float *w,...
transformers/src/transformers/kernels/rwkv/wkv_op.cpp/0
{ "file_path": "transformers/src/transformers/kernels/rwkv/wkv_op.cpp", "repo_id": "transformers", "token_count": 1807 }
565
export { insecureHash } from "./js-sha1/hash.js";
langchainjs/langchain-core/src/utils/hash.ts/0
{ "file_path": "langchainjs/langchain-core/src/utils/hash.ts", "repo_id": "langchainjs", "token_count": 18 }
845
import { AgentStep } from "@langchain/core/agents"; /** * Construct the scratchpad that lets the agent continue its thought process. * @param intermediateSteps * @param observationPrefix * @param llmPrefix * @returns a string with the formatted observations and agent logs */ export function formatLogToString( ...
langchainjs/langchain/src/agents/format_scratchpad/log.ts/0
{ "file_path": "langchainjs/langchain/src/agents/format_scratchpad/log.ts", "repo_id": "langchainjs", "token_count": 221 }
941
import { ChatPromptTemplate } from "@langchain/core/prompts"; import { ChatOpenAI } from "@langchain/openai"; import { createStructuredOutputRunnable } from "langchain/chains/openai_functions"; import { JsonOutputFunctionsParser } from "langchain/output_parsers"; const jsonSchema = { title: "Person", description: ...
langchainjs/examples/src/chains/openai_functions_json_schema.ts/0
{ "file_path": "langchainjs/examples/src/chains/openai_functions_json_schema.ts", "repo_id": "langchainjs", "token_count": 411 }
791
# Building Hardware Optimized ChromaDB Image The default Chroma DB image comes with binary distribution of hnsw lib which is not optimized to take advantage of certain CPU architectures (Intel-based) with AVX support. This can be improved by building an image with hnsw rebuilt from source. To do that run: ```bash doc...
chroma/examples/advanced/hadrware-optimized-image.md/0
{ "file_path": "chroma/examples/advanced/hadrware-optimized-image.md", "repo_id": "chroma", "token_count": 108 }
35
# Vercel KV This example demonstrates how to setup chat history storage using the `VercelKVStore` `BaseStore` integration. ## Setup ```bash npm2yarn npm install @vercel/kv ``` ## Usage import CodeBlock from "@theme/CodeBlock"; import Example from "@examples/stores/vercel_kv_storage.ts"; <CodeBlock language="types...
langchainjs/docs/core_docs/docs/integrations/stores/vercel_kv_storage.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/stores/vercel_kv_storage.mdx", "repo_id": "langchainjs", "token_count": 112 }
788
"""Vector store index types.""" from enum import Enum class ManagedIndexQueryMode(str, Enum): """Vector store query mode.""" DEFAULT = "default" MMR = "mmr"
llama_index/llama-index-legacy/llama_index/legacy/indices/managed/types.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/managed/types.py", "repo_id": "llama_index", "token_count": 59 }
1,718
#[cfg(feature = "mkl")] extern crate intel_mkl_src; #[cfg(feature = "accelerate")] extern crate accelerate_src; use candle::test_utils::to_vec0_round; use candle::{Device, Result, Tensor}; /* Equivalent python code: import torch import torch.nn.functional as F input = torch.tensor([ [ 1.1050, 0.3013, -1.5394, -...
candle/candle-nn/tests/loss.rs/0
{ "file_path": "candle/candle-nn/tests/loss.rs", "repo_id": "candle", "token_count": 1344 }
63
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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...
transformers/utils/check_doctest_list.py/0
{ "file_path": "transformers/utils/check_doctest_list.py", "repo_id": "transformers", "token_count": 1179 }
844
"""GraphQL Reader.""" from typing import Dict, List, Optional import yaml from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class GraphQLReader(BaseReader): """GraphQL reader. Combines all GraphQL results into the Document used by LlamaIndex. Args: ...
llama_index/llama-index-integrations/readers/llama-index-readers-graphql/llama_index/readers/graphql/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-graphql/llama_index/readers/graphql/base.py", "repo_id": "llama_index", "token_count": 905 }
1,330
from llama_index.packs.ragatouille_retriever.base import RAGatouilleRetrieverPack __all__ = ["RAGatouilleRetrieverPack"]
llama_index/llama-index-packs/llama-index-packs-ragatouille-retriever/llama_index/packs/ragatouille_retriever/__init__.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-ragatouille-retriever/llama_index/packs/ragatouille_retriever/__init__.py", "repo_id": "llama_index", "token_count": 45 }
1,678
# OpenAPI Tool This tool loads an OpenAPI spec and allow the Agent to retrieve endpoints and details about endpoints. The RequestsToolSpec can also be laoded into the agent to allow the agent to hit the nessecary endpoints with a REST request. ## Usage This tool has more extensive example usage documented in a Jupyt...
llama_index/llama-index-integrations/tools/llama-index-tools-openapi/README.md/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-openapi/README.md", "repo_id": "llama_index", "token_count": 456 }
1,521
"""Simple graph store index.""" import json import logging import os from dataclasses import dataclass, field from typing import Any, Dict, List, Optional import fsspec from dataclasses_json import DataClassJsonMixin from llama_index.core.graph_stores.types import ( DEFAULT_PERSIST_DIR, DEFAULT_PERSIST_FNAME,...
llama_index/llama-index-core/llama_index/core/graph_stores/simple.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/graph_stores/simple.py", "repo_id": "llama_index", "token_count": 2770 }
1,188
import json from langchain_community.utilities import Portkey def test_Config() -> None: headers = Portkey.Config( api_key="test_api_key", environment="test_environment", user="test_user", organisation="test_organisation", prompt="test_prompt", retry_count=3, ...
langchain/libs/community/tests/integration_tests/utilities/test_portkey.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/utilities/test_portkey.py", "repo_id": "langchain", "token_count": 413 }
370
"""The tokenizer used by the GPT-SW3 models.""" import os import re import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torc...
transformers/src/transformers/models/gpt_sw3/tokenization_gpt_sw3.py/0
{ "file_path": "transformers/src/transformers/models/gpt_sw3/tokenization_gpt_sw3.py", "repo_id": "transformers", "token_count": 6418 }
673
# Copyright 2023-present the HuggingFace Inc. team. # # 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...
peft/src/peft/tuners/lora/layer.py/0
{ "file_path": "peft/src/peft/tuners/lora/layer.py", "repo_id": "peft", "token_count": 14009 }
336
python_sources()
llama_index/llama-index-core/llama_index/core/query_pipeline/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_pipeline/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,145
python_tests( name="tests", )
llama_index/llama-index-core/tests/objects/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/objects/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,163
# coding=utf-8 # Copyright 2022 Meta 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 # #...
transformers/src/transformers/models/esm/modeling_esmfold.py/0
{ "file_path": "transformers/src/transformers/models/esm/modeling_esmfold.py", "repo_id": "transformers", "token_count": 42462 }
642
# coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. # # 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...
diffusers/utils/check_copies.py/0
{ "file_path": "diffusers/utils/check_copies.py", "repo_id": "diffusers", "token_count": 3397 }
291
""" Github readers utils. This module contains utility functions for the Github readers. """ import asyncio import os import time from abc import ABC, abstractmethod from typing import List, Tuple from llama_index.legacy.readers.github_readers.github_api_client import ( GitBlobResponseModel, GithubClient, ...
llama_index/llama-index-legacy/llama_index/legacy/readers/github_readers/utils.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/github_readers/utils.py", "repo_id": "llama_index", "token_count": 2353 }
1,607
<jupyter_start><jupyter_text>OpenClip[OpenClip](https://github.com/mlfoundations/open_clip/tree/main) is an source implementation of OpenAI's CLIP.These multi-modal embeddings can be used to embed images or text.<jupyter_code>%pip install --upgrade --quiet langchain-experimental %pip install --upgrade --quiet pillow ...
langchain/docs/docs/integrations/text_embedding/open_clip.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/text_embedding/open_clip.ipynb", "repo_id": "langchain", "token_count": 1701 }
178
# Generated content DO NOT EDIT from .. import pre_tokenizers PreTokenizer = pre_tokenizers.PreTokenizer BertPreTokenizer = pre_tokenizers.BertPreTokenizer ByteLevel = pre_tokenizers.ByteLevel CharDelimiterSplit = pre_tokenizers.CharDelimiterSplit Digits = pre_tokenizers.Digits Metaspace = pre_tokenizers.Metaspace Pun...
tokenizers/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.py/0
{ "file_path": "tokenizers/bindings/python/py_src/tokenizers/pre_tokenizers/__init__.py", "repo_id": "tokenizers", "token_count": 177 }
422
// Copyright (C) 2019-2020 Zilliz. 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 l...
milvus/internal/core/src/query/SearchOnGrowing.cpp/0
{ "file_path": "milvus/internal/core/src/query/SearchOnGrowing.cpp", "repo_id": "milvus", "token_count": 2947 }
1,652
# Wordpress Loader This loader fetches the text from Wordpress blog posts using the Wordpress API. It also uses the BeautifulSoup library to parse the HTML and extract the text from the articles. ## Usage To use this loader, you need to pass base url of the Wordpress installation (e.g. `https://www.mysite.com`), a u...
llama_index/llama-index-integrations/readers/llama-index-readers-wordpress/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-wordpress/README.md", "repo_id": "llama_index", "token_count": 312 }
1,545
# coding=utf-8 # Copyright 2023 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/vitdet/configuration_vitdet.py/0
{ "file_path": "transformers/src/transformers/models/vitdet/configuration_vitdet.py", "repo_id": "transformers", "token_count": 2892 }
672
"""Combine documents by doing a first pass and then refining on more documents.""" from __future__ import annotations from typing import Any, Dict, List, Tuple from langchain_core.callbacks import Callbacks from langchain_core.documents import Document from langchain_core.prompts import BasePromptTemplate, format_do...
langchain/libs/langchain/langchain/chains/combine_documents/refine.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/combine_documents/refine.py", "repo_id": "langchain", "token_count": 3687 }
486
<!--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...
transformers/docs/source/en/tasks/audio_classification.md/0
{ "file_path": "transformers/docs/source/en/tasks/audio_classification.md", "repo_id": "transformers", "token_count": 4267 }
524
use std::fmt::Debug; use std::sync::Arc; use futures::Stream; use futures::StreamExt; use tokio::runtime::Builder; use tokio::{pin, select}; use super::ComponentRuntime; // use super::executor::StreamComponentExecutor; use super::sender::{self, Sender, Wrapper}; use super::{executor, ComponentContext}; use super::{ex...
chroma/rust/worker/src/system/system.rs/0
{ "file_path": "chroma/rust/worker/src/system/system.rs", "repo_id": "chroma", "token_count": 1907 }
63
# Time-Weighted Retriever A Time-Weighted Retriever is a retriever that takes into account recency in addition to similarity. The scoring algorithm is: ```typescript let score = (1.0 - this.decayRate) ** hoursPassed + vectorRelevance; ``` Notably, `hoursPassed` above refers to the time since the object in the retrie...
langchainjs/docs/core_docs/docs/integrations/retrievers/time-weighted-retriever.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/retrievers/time-weighted-retriever.mdx", "repo_id": "langchainjs", "token_count": 388 }
712
cff-version: "1.2.0" date-released: 2020-10 message: "If you use this software, please cite it using these metadata." title: "Transformers: State-of-the-Art Natural Language Processing" url: "https://github.com/huggingface/transformers" authors: - family-names: Wolf given-names: Thomas - family-names: Debut ...
transformers/CITATION.cff/0
{ "file_path": "transformers/CITATION.cff", "repo_id": "transformers", "token_count": 824 }
466
<!--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/quicktour.md/0
{ "file_path": "diffusers/docs/source/pt/quicktour.md", "repo_id": "diffusers", "token_count": 6766 }
184
import { TavilySearchResults } from "@langchain/community/tools/tavily_search"; import { ChatOpenAI } from "@langchain/openai"; import type { ChatPromptTemplate } from "@langchain/core/prompts"; import { AIMessage, HumanMessage } from "@langchain/core/messages"; import { pull } from "langchain/hub"; import { AgentExec...
langchainjs/examples/src/agents/openai_functions.ts/0
{ "file_path": "langchainjs/examples/src/agents/openai_functions.ts", "repo_id": "langchainjs", "token_count": 427 }
811
from typing import Any, Callable, List, Literal, Optional, Type import pytest from langchain_core.pydantic_v1 import BaseModel, Field from langchain_core.tools import BaseTool, tool from langchain_core.utils.function_calling import convert_to_openai_function @pytest.fixture() def pydantic() -> Type[BaseModel]: ...
langchain/libs/core/tests/unit_tests/utils/test_function_calling.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/utils/test_function_calling.py", "repo_id": "langchain", "token_count": 1105 }
433
--- hide_table_of_contents: true --- # Contextual compression One challenge with retrieval is that usually you don't know the specific queries your document storage system will face when you ingest data into the system. This means that the information most relevant to a query may be buried in a document with a lot of...
langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/contextual_compression.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/retrievers/contextual_compression.mdx", "repo_id": "langchainjs", "token_count": 903 }
756
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-yelp/llama_index/tools/yelp/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-yelp/llama_index/tools/yelp/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,539
python_sources()
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-txtai/llama_index/vector_stores/txtai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-txtai/llama_index/vector_stores/txtai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,544
//! Embedding Layer. use candle::{Result, Tensor}; #[derive(Clone, Debug)] pub struct Embedding { embeddings: Tensor, hidden_size: usize, } impl Embedding { pub fn new(embeddings: Tensor, hidden_size: usize) -> Self { Self { embeddings, hidden_size, } } pub...
candle/candle-nn/src/embedding.rs/0
{ "file_path": "candle/candle-nn/src/embedding.rs", "repo_id": "candle", "token_count": 571 }
62
<!--- Copyright 2021 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 ...
transformers/examples/research_projects/jax-projects/hybrid_clip/README.md/0
{ "file_path": "transformers/examples/research_projects/jax-projects/hybrid_clip/README.md", "repo_id": "transformers", "token_count": 2302 }
563
<jupyter_start><jupyter_text>Fine-tune large models using 🤗 `peft` adapters, `transformers` & `bitsandbytes`In this tutorial we will cover how we can fine-tune large language models using the very recent `peft` library and `bitsandbytes` for loading large models in 8-bit.The fine-tuning method will rely on a recent me...
peft/examples/int8_training/Finetune_opt_bnb_peft.ipynb/0
{ "file_path": "peft/examples/int8_training/Finetune_opt_bnb_peft.ipynb", "repo_id": "peft", "token_count": 2723 }
300
package httpserver import ( "encoding/json" "testing" "github.com/stretchr/testify/assert" "github.com/milvus-io/milvus-proto/go-api/v2/milvuspb" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" ) func TestFieldData_AsSchemapb(t *testing.T) { t.Run("varchar_ok", func(t *testing.T) { fieldData := Field...
milvus/internal/distributed/proxy/httpserver/wrap_request_test.go/0
{ "file_path": "milvus/internal/distributed/proxy/httpserver/wrap_request_test.go", "repo_id": "milvus", "token_count": 3579 }
1,789
"""ChatModel wrapper which returns user input as the response..""" from io import StringIO from typing import Any, Callable, Dict, List, Mapping, Optional import yaml from langchain_core.callbacks import ( CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import BaseChatModel from langch...
langchain/libs/community/langchain_community/chat_models/human.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/human.py", "repo_id": "langchain", "token_count": 1531 }
236
//! Datasets & Dataloaders for Candle pub mod batcher; pub mod hub; pub mod nlp; pub mod vision; pub use batcher::Batcher;
candle/candle-datasets/src/lib.rs/0
{ "file_path": "candle/candle-datasets/src/lib.rs", "repo_id": "candle", "token_count": 45 }
41
<!--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/en/model_doc/clvp.md/0
{ "file_path": "transformers/docs/source/en/model_doc/clvp.md", "repo_id": "transformers", "token_count": 1339 }
479
"""Download llama-pack as template.""" import logging import os import subprocess import sys from importlib import util from pathlib import Path from typing import Any, Optional, Union import requests from llama_index.core.download.utils import ( ChangeDirectory, get_file_content, get_source_files_list, ...
llama_index/llama-index-core/llama_index/core/download/pack.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/download/pack.py", "repo_id": "llama_index", "token_count": 2065 }
1,170
from llama_index.callbacks.promptlayer.base import PromptLayerHandler __all__ = ["PromptLayerHandler"]
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-promptlayer/llama_index/callbacks/promptlayer/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-promptlayer/llama_index/callbacks/promptlayer/__init__.py", "repo_id": "llama_index", "token_count": 31 }
1,348
from langchain_community.retrievers.tfidf import TFIDFRetriever __all__ = ["TFIDFRetriever"]
langchain/libs/langchain/langchain/retrievers/tfidf.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/tfidf.py", "repo_id": "langchain", "token_count": 35 }
537
# Scripts and Tools The following scripts and commands may be used during segcore development. ## code format - under milvus/internal/core directory - run `./run_clang_format .` to format cpp code - to call clang-format-10, need to install `apt install clang-format-10` in advance - call `build-support/add_...
milvus/docs/design_docs/segcore/scripts_and_tools.md/0
{ "file_path": "milvus/docs/design_docs/segcore/scripts_and_tools.md", "repo_id": "milvus", "token_count": 205 }
1,736
"""Tool for the Nuclia Understanding API. Installation: ```bash pip install --upgrade protobuf pip install nucliadb-protos ``` """ import asyncio import base64 import logging import mimetypes import os from typing import Any, Dict, Optional, Type, Union import requests from langchain_core.callbacks import (...
langchain/libs/community/langchain_community/tools/nuclia/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/nuclia/tool.py", "repo_id": "langchain", "token_count": 3835 }
289
- name: datanode docker_container: name: datanode image: "{{image}}" command: "milvus run datanode" env: ETCD_ENDPOINTS: "{{ETCD_ENDPOINTS}}" MINIO_ADDRESS: "{{MINIO_ADDRESS}}" PULSAR_ADDRESS: "{{PULSAR_ADDRESS}}" METRICS_PORT: "9092" network_mode: "{{nodes_network}}" #Use...
milvus/deployments/docker/cluster-distributed-deployment/roles/deploy-datanode/tasks/main.yml/0
{ "file_path": "milvus/deployments/docker/cluster-distributed-deployment/roles/deploy-datanode/tasks/main.yml", "repo_id": "milvus", "token_count": 174 }
1,717
import { OpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { RetrievalQAChain, loadQAMapReduceChain } from "langchain/chains"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { RecursiveCharacterTextSplitter } from "langchain/text_splitter"; import * as fs from "fs"; // Initialize...
langchainjs/examples/src/chains/retrieval_qa_custom_legacy.ts/0
{ "file_path": "langchainjs/examples/src/chains/retrieval_qa_custom_legacy.ts", "repo_id": "langchainjs", "token_count": 447 }
779
# coding=utf-8 # Copyright 2022 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/whisper/test_feature_extraction_whisper.py/0
{ "file_path": "transformers/tests/models/whisper/test_feature_extraction_whisper.py", "repo_id": "transformers", "token_count": 5032 }
825
# 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/utils/test_dynamic_module_utils.py/0
{ "file_path": "transformers/tests/utils/test_dynamic_module_utils.py", "repo_id": "transformers", "token_count": 918 }
795
<jupyter_start><jupyter_text>Multi-Modal LLM using Google's Gemini model for image understanding and build Retrieval Augmented Generation with LlamaIndexIn this notebook, we show how to use Google's Gemini Vision models for image understanding.First, we show several functions we are now supporting for Gemini:* `complet...
llama_index/docs/examples/multi_modal/gemini.ipynb/0
{ "file_path": "llama_index/docs/examples/multi_modal/gemini.ipynb", "repo_id": "llama_index", "token_count": 3799 }
1,115
import * as fs from "fs"; import * as path from "path"; // This lists all the entrypoints for the library. Each key corresponds to an // importable path, eg. `import { Foo } from "langsmith/client"`. // The value is the path to the file in `src/` that exports the entrypoint. // This is used to generate the `exports` f...
langsmith-sdk/js/scripts/create-entrypoints.js/0
{ "file_path": "langsmith-sdk/js/scripts/create-entrypoints.js", "repo_id": "langsmith-sdk", "token_count": 1363 }
1,025
{ "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 20, "prefill": [ { "id": 589, "logprob": null, "text": "def" }, { "id": 3226, "logprob": -8.5859375, "text": " ge" }, { "id": 2...
text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder_gptq/test_flash_starcoder_gptq.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_flash_starcoder_gptq/test_flash_starcoder_gptq.json", "repo_id": "text-generation-inference", "token_count": 2389 }
365
"""Hybrid Fusion Retriever Pack.""" import os from typing import Any, Dict, List from llama_index.core.indices.service_context import ServiceContext from llama_index.core.indices.vector_store import VectorStoreIndex from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.query_engine import Re...
llama_index/llama-index-packs/llama-index-packs-fusion-retriever/llama_index/packs/fusion_retriever/hybrid_fusion/base.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-fusion-retriever/llama_index/packs/fusion_retriever/hybrid_fusion/base.py", "repo_id": "llama_index", "token_count": 1442 }
1,787
from neo4j_semantic_layer import agent_executor if __name__ == "__main__": original_query = "What do you know about person John?" followup_query = "John Travolta" chat_history = [ ( "What do you know about person John?", "I found multiple people named John. Could you please ...
langchain/templates/neo4j-semantic-layer/main.py/0
{ "file_path": "langchain/templates/neo4j-semantic-layer/main.py", "repo_id": "langchain", "token_count": 273 }
699
# ruff: noqa # Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors. # # 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/LICE...
datasets/src/datasets/__init__.py/0
{ "file_path": "datasets/src/datasets/__init__.py", "repo_id": "datasets", "token_count": 772 }
137
# MobileNet v2 **MobileNetV2** is a convolutional neural network architecture that seeks to perform well on mobile devices. It is based on an [inverted residual structure](https://paperswithcode.com/method/inverted-residual-block) where the residual connections are between the bottleneck layers. The intermediate expa...
pytorch-image-models/docs/models/.templates/models/mobilenet-v2.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/mobilenet-v2.md", "repo_id": "pytorch-image-models", "token_count": 2583 }
338
Knowledge Graph Query Engine ============================ .. automodule:: llama_index.core.query_engine.knowledge_graph_query_engine :members: :inherited-members:
llama_index/docs/api_reference/query/query_engines/knowledge_graph_query_engine.rst/0
{ "file_path": "llama_index/docs/api_reference/query/query_engines/knowledge_graph_query_engine.rst", "repo_id": "llama_index", "token_count": 50 }
1,038
"""Test recursive queries.""" import asyncio from typing import Any, Dict, List import pytest from llama_index.legacy.data_structs.data_structs import IndexStruct from llama_index.legacy.embeddings.base import BaseEmbedding from llama_index.legacy.indices.composability.graph import ComposableGraph from llama_index.le...
llama_index/llama-index-legacy/tests/indices/query/test_compose_vector.py/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/query/test_compose_vector.py", "repo_id": "llama_index", "token_count": 5659 }
1,662
# How do Unity ML-Agents work? [[how-mlagents-works]] Before training our agent, we need to understand **what ML-Agents is and how it works**. ## What is Unity ML-Agents? [[what-is-mlagents]] [Unity ML-Agents](https://github.com/Unity-Technologies/ml-agents) is a toolkit for the game engine Unity that **allows us to...
deep-rl-class/units/en/unit5/how-mlagents-works.mdx/0
{ "file_path": "deep-rl-class/units/en/unit5/how-mlagents-works.mdx", "repo_id": "deep-rl-class", "token_count": 1276 }
161
from typing import Any, Dict, Tuple import pytest from langchain.chains.query_constructor.ir import ( Comparator, Comparison, Operation, Operator, StructuredQuery, ) from langchain.retrievers.self_query.milvus import MilvusTranslator DEFAULT_TRANSLATOR = MilvusTranslator() @pytest.mark.parametr...
langchain/libs/langchain/tests/unit_tests/retrievers/self_query/test_milvus.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/retrievers/self_query/test_milvus.py", "repo_id": "langchain", "token_count": 1557 }
612
// 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/datacoord/index_builder_test.go/0
{ "file_path": "milvus/internal/datacoord/index_builder_test.go", "repo_id": "milvus", "token_count": 20370 }
1,692
<jupyter_start><jupyter_text>Fast tokenizers in the QA pipeline (PyTorch) Installez les bibliothèques 🤗 *Transformers* et 🤗 *Datasets* pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] from transformers import pipeline question_answerer = pipeline("question-answering", model...
notebooks/course/fr/chapter6/section3b_pt.ipynb/0
{ "file_path": "notebooks/course/fr/chapter6/section3b_pt.ipynb", "repo_id": "notebooks", "token_count": 2740 }
313
# LlamaIndex Postprocessor Integration: Longllmlingua
llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-longllmlingua/README.md/0
{ "file_path": "llama_index/llama-index-integrations/postprocessor/llama-index-postprocessor-longllmlingua/README.md", "repo_id": "llama_index", "token_count": 14 }
1,436
"""Init params."""
llama_index/llama-index-legacy/llama_index/legacy/indices/common/struct_store/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/indices/common/struct_store/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,658
import json from typing import Any, Callable, Dict, List, Optional, Sequence from llama_index.legacy.bridge.pydantic import Field, PrivateAttr from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.core.llms.types import ( ChatMessage, ChatResponse, ChatResponseAsyncGen, ChatR...
llama_index/llama-index-legacy/llama_index/legacy/llms/vllm.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/llms/vllm.py", "repo_id": "llama_index", "token_count": 6310 }
1,580
#!/usr/bin/env python # coding=utf-8 # Copyright 2022 The Microsoft 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.apac...
transformers/examples/research_projects/tapex/run_tabfact_with_tapex.py/0
{ "file_path": "transformers/examples/research_projects/tapex/run_tabfact_with_tapex.py", "repo_id": "transformers", "token_count": 7840 }
604
accuracy: collections: - server: db_config.primary_path: /test/milvus/db_data_011/sift_50m_128_l2_sq8 cache_config.cpu_cache_capacity: 32GB engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 1 gpu_resource_config.enable: false gpu_resou...
milvus/tests/benchmark/milvus_benchmark/suites/011_sift50m_acc.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/011_sift50m_acc.yaml", "repo_id": "milvus", "token_count": 318 }
1,876
python_sources() python_test_utils( name="test_utils", ) python_tests( name="tests", skip_tests=True, )
llama_index/llama-index-legacy/tests/indices/document_summary/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/tests/indices/document_summary/BUILD", "repo_id": "llama_index", "token_count": 52 }
1,796
"""OpenAI chat wrapper.""" from __future__ import annotations import logging import os import sys from typing import ( Any, AsyncIterator, Callable, Dict, Iterator, List, Literal, Mapping, Optional, Sequence, Tuple, Type, TypedDict, Union, cast, ) import op...
langchain/libs/partners/openai/langchain_openai/chat_models/base.py/0
{ "file_path": "langchain/libs/partners/openai/langchain_openai/chat_models/base.py", "repo_id": "langchain", "token_count": 12321 }
637
<jupyter_start><jupyter_text>Multiple callback handlersIn the previous examples, we passed in callback handlers upon creation of an object by using `callbacks=`. In this case, the callbacks will be scoped to that particular object. However, in many cases, it is advantageous to pass in handlers instead when running the ...
langchain/docs/docs/modules/callbacks/multiple_callbacks.ipynb/0
{ "file_path": "langchain/docs/docs/modules/callbacks/multiple_callbacks.ipynb", "repo_id": "langchain", "token_count": 1346 }
204