text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# coding=utf-8 # Copyright 2021, The Microsoft Research Asia MarkupLM Team 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/LICENSE-2.0 # # Unles...
transformers/src/transformers/models/markuplm/configuration_markuplm.py/0
{ "file_path": "transformers/src/transformers/models/markuplm/configuration_markuplm.py", "repo_id": "transformers", "token_count": 2942 }
709
import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCallback, TrainingArguments, ...
transformers/examples/research_projects/codeparrot/examples/train_complexity_predictor.py/0
{ "file_path": "transformers/examples/research_projects/codeparrot/examples/train_complexity_predictor.py", "repo_id": "transformers", "token_count": 1799 }
570
import sys import re import logging import traceback import argparse from yaml import full_load, dump import config import utils def parse_server_tag(server_tag): """ paser server tag from server config""" # tag format: "8c"/"8c16m"/"8c16m1g" if server_tag[-1] == "c": p = r"(\d+)c" elif server...
milvus/tests/benchmark/milvus_benchmark/update.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/update.py", "repo_id": "milvus", "token_count": 4287 }
1,876
import re from typing import Union from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from langchain.agents.agent import AgentOutputParser from langchain.agents.mrkl.prompt import FORMAT_INSTRUCTIONS FINAL_ANSWER_ACTION = "Final Answer:" MISSING_ACT...
langchain/libs/langchain/langchain/agents/mrkl/output_parser.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/mrkl/output_parser.py", "repo_id": "langchain", "token_count": 1582 }
445
"""Storage classes.""" from llama_index.legacy.storage.storage_context import StorageContext __all__ = [ "StorageContext", ]
llama_index/llama-index-legacy/llama_index/legacy/storage/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/storage/__init__.py", "repo_id": "llama_index", "token_count": 42 }
1,539
/// This follows the lines of: /// https://github.com/johnma2006/mamba-minimal/blob/master/model.py /// Simple, minimal implementation of Mamba in one file of PyTorch. use candle::{IndexOp, Module, Result, Tensor, D}; use candle_nn::{RmsNorm, VarBuilder}; use candle_transformers::models::with_tracing::{linear, linear_...
candle/candle-examples/examples/mamba-minimal/model.rs/0
{ "file_path": "candle/candle-examples/examples/mamba-minimal/model.rs", "repo_id": "candle", "token_count": 3488 }
50
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; # Google Calendar Tool The Google Calendar Tools allow your agent to create and view Google Calendar events from a linked calendar. ## Setup To use the Google Calendar Tools you need to install the following official peer dependency: `...
langchainjs/docs/core_docs/docs/integrations/tools/google_calendar.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/tools/google_calendar.mdx", "repo_id": "langchainjs", "token_count": 200 }
715
# test_watermark_logits_processor.py import os import numpy as np import torch from text_generation_server.utils.watermark import WatermarkLogitsProcessor GAMMA = os.getenv("WATERMARK_GAMMA", 0.5) DELTA = os.getenv("WATERMARK_DELTA", 2.0) def test_seed_rng(): input_ids = [101, 2036, 3731, 102, 2003, 103] p...
text-generation-inference/server/tests/utils/test_watermark.py/0
{ "file_path": "text-generation-inference/server/tests/utils/test_watermark.py", "repo_id": "text-generation-inference", "token_count": 781 }
420
<jupyter_start><jupyter_text>Memory in AgentThis notebook goes over adding memory to an Agent. Before going through this notebook, please walkthrough the following notebooks, as this will build on top of both of them:- [Memory in LLMChain](/docs/modules/memory/adding_memory)- [Custom Agents](/docs/modules/agents/how_to...
langchain/docs/docs/modules/memory/agent_with_memory.ipynb/0
{ "file_path": "langchain/docs/docs/modules/memory/agent_with_memory.ipynb", "repo_id": "langchain", "token_count": 1846 }
194
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-metaphor/llama_index/tools/metaphor/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,622
# 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/__init__.py/0
{ "file_path": "diffusers/src/diffusers/models/__init__.py", "repo_id": "diffusers", "token_count": 1723 }
241
<jupyter_start><jupyter_text>AWS S3 Directory>[Amazon Simple Storage Service (Amazon S3)](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders.html) is an object storage service>[AWS S3 Directory](https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-folders.html)This covers how to load document ob...
langchain/docs/docs/integrations/document_loaders/aws_s3_directory.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/aws_s3_directory.ipynb", "repo_id": "langchain", "token_count": 441 }
103
// Copyright 2021 PingCAP, 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 agreed to i...
milvus/pkg/log/zap_test_logger.go/0
{ "file_path": "milvus/pkg/log/zap_test_logger.go", "repo_id": "milvus", "token_count": 805 }
1,915
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-cogniswitch/llama_index/tools/cogniswitch/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-cogniswitch/llama_index/tools/cogniswitch/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,618
--- sidebar_position: 0 --- # Welcome Contributors Hi there! Thank you for even being interested in contributing to LangChain. As an open-source project in a rapidly developing field, we are extremely open to contributions, whether they involve new features, improved infrastructure, better documentation, or bug fixes....
langchain/docs/docs/contributing/index.mdx/0
{ "file_path": "langchain/docs/docs/contributing/index.mdx", "repo_id": "langchain", "token_count": 687 }
82
package console import ( "fmt" "os" "github.com/mgutz/ansi" ) func Success(msg string) { colorOut(msg, "green") } func Error(msg string) { colorOut(msg, "red") } func Warning(msg string) { colorOut(msg, "yellow") } func Exit(msg string, options ...ExitOption) { opts := append([]ExitOption{}, options...) o...
milvus/cmd/tools/migration/console/console.go/0
{ "file_path": "milvus/cmd/tools/migration/console/console.go", "repo_id": "milvus", "token_count": 280 }
1,897
# coding=utf-8 # Copyright 2021 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/models/segformer/convert_segformer_original_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/segformer/convert_segformer_original_to_pytorch.py", "repo_id": "transformers", "token_count": 8906 }
719
# Builds GPU docker image of PyTorch # Uses multi-staged approach to reduce size # Stage 1 # Use base conda image to reduce time FROM continuumio/miniconda3:latest AS compile-image # Specify py version ENV PYTHON_VERSION=3.10 # Install apt libs - copied from https://github.com/huggingface/accelerate/blob/main/docker/ac...
trl/docker/trl-latest-gpu/Dockerfile/0
{ "file_path": "trl/docker/trl-latest-gpu/Dockerfile", "repo_id": "trl", "token_count": 774 }
782
import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def get_duration(func): def wrapper(*args, **kwargs): starttime = timeit.default_timer() _ = func(*args, **kwargs) delta = timeit.default_timer()...
datasets/benchmarks/utils.py/0
{ "file_path": "datasets/benchmarks/utils.py", "repo_id": "datasets", "token_count": 927 }
128
"""Unit tests for agents.""" from typing import Any, Dict, List, Optional from langchain_core.agents import AgentAction, AgentStep from langchain_core.language_models.llms import LLM from langchain_core.messages import AIMessage, HumanMessage from langchain_core.runnables.utils import add from langchain_core.tools im...
langchain/libs/langchain/tests/unit_tests/agents/test_agent_async.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/test_agent_async.py", "repo_id": "langchain", "token_count": 5370 }
618
from llama_index.core.llms.base import BaseLLM from llama_index.llms.sagemaker_endpoint import SageMakerLLM def test_embedding_class(): names_of_base_classes = [b.__name__ for b in SageMakerLLM.__mro__] assert BaseLLM.__name__ in names_of_base_classes
llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/tests/test_llms_sagemaker_endpoint.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/tests/test_llms_sagemaker_endpoint.py", "repo_id": "llama_index", "token_count": 99 }
1,303
from llama_index.vector_stores.milvus.base import MilvusVectorStore __all__ = ["MilvusVectorStore"]
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/llama_index/vector_stores/milvus/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/llama_index/vector_stores/milvus/__init__.py", "repo_id": "llama_index", "token_count": 35 }
1,525
"""DashScope embeddings file.""" import logging from enum import Enum from http import HTTPStatus from typing import Any, Dict, List, Optional, Union from pydantic import PrivateAttr from llama_index.legacy.embeddings.multi_modal_base import MultiModalEmbedding from llama_index.legacy.schema import ImageType logger...
llama_index/llama-index-legacy/llama_index/legacy/embeddings/dashscope.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/embeddings/dashscope.py", "repo_id": "llama_index", "token_count": 4479 }
1,649
import importlib import inspect import logging import os from abc import ABC from graphlib import TopologicalSorter from typing import Optional, List, Any, Dict, Set, Iterable, Union from typing import Type, TypeVar, cast from overrides import EnforceOverrides from overrides import override from typing_extensions impo...
chroma/chromadb/config.py/0
{ "file_path": "chroma/chromadb/config.py", "repo_id": "chroma", "token_count": 6890 }
14
[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 = ["SemanticScholarReader"] contains_example = false import_path = "llama_index.readers.seman...
llama_index/llama-index-integrations/readers/llama-index-readers-semanticscholar/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-semanticscholar/pyproject.toml", "repo_id": "llama_index", "token_count": 705 }
1,416
import datasets from tokenizers import Tokenizer, models, normalizers, pre_tokenizers, trainers # Build a tokenizer bpe_tokenizer = Tokenizer(models.BPE()) bpe_tokenizer.pre_tokenizer = pre_tokenizers.Whitespace() bpe_tokenizer.normalizer = normalizers.Lowercase() # Initialize a dataset dataset = datasets.load_data...
tokenizers/bindings/python/examples/train_with_datasets.py/0
{ "file_path": "tokenizers/bindings/python/examples/train_with_datasets.py", "repo_id": "tokenizers", "token_count": 209 }
440
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-mbox/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-mbox/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,404
# 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 applicabl...
trl/trl/import_utils.py/0
{ "file_path": "trl/trl/import_utils.py", "repo_id": "trl", "token_count": 1125 }
792
"""Base index classes.""" import logging from abc import ABC, abstractmethod from typing import Any, Dict, Generic, List, Optional, Sequence, Type, TypeVar from llama_index.core.base.base_query_engine import BaseQueryEngine from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.callbacks...
llama_index/llama-index-core/llama_index/core/indices/base.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/base.py", "repo_id": "llama_index", "token_count": 7589 }
1,259
from langchain_community.agent_toolkits.gitlab.toolkit import GitLabToolkit __all__ = ["GitLabToolkit"]
langchain/libs/langchain/langchain/agents/agent_toolkits/gitlab/toolkit.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/gitlab/toolkit.py", "repo_id": "langchain", "token_count": 36 }
458
"""Sleep tool."""
langchain/libs/langchain/langchain/tools/sleep/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/sleep/__init__.py", "repo_id": "langchain", "token_count": 6 }
598
# 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/pipelines/musicldm/pipeline_musicldm.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/musicldm/pipeline_musicldm.py", "repo_id": "diffusers", "token_count": 13583 }
239
import { test, expect } from "@jest/globals"; import { GoogleVertexAIMultimodalEmbeddings, GoogleVertexAIMedia, } from "../googlevertexai.js"; test("mediaToInstance text", async () => { const e = new GoogleVertexAIMultimodalEmbeddings(); const media: GoogleVertexAIMedia = { text: "just text", }; const...
langchainjs/langchain/src/experimental/multimodal_embeddings/tests/googlevertexai.test.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/multimodal_embeddings/tests/googlevertexai.test.ts", "repo_id": "langchainjs", "token_count": 271 }
898
# 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/auto/__init__.py/0
{ "file_path": "transformers/src/transformers/models/auto/__init__.py", "repo_id": "transformers", "token_count": 8231 }
632
# coding=utf-8 # Copyright 2021 The Fairseq 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/licenses/...
transformers/src/transformers/models/hubert/modeling_tf_hubert.py/0
{ "file_path": "transformers/src/transformers/models/hubert/modeling_tf_hubert.py", "repo_id": "transformers", "token_count": 31265 }
697
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; import EmbeddingDistance from "@examples/guides/evaluation/string/embedding_distance.ts"; # Embedding Distance To measure semantic similarity (or dissimilarity) between a prediction and a reference label string, you could use a vector dis...
langchainjs/docs/core_docs/docs/guides/evaluation/string/embedding_distance.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/guides/evaluation/string/embedding_distance.mdx", "repo_id": "langchainjs", "token_count": 165 }
720
// 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/util/metricsinfo/cache.go/0
{ "file_path": "milvus/pkg/util/metricsinfo/cache.go", "repo_id": "milvus", "token_count": 1289 }
1,943
# Zep ## [Fast, Scalable Building Blocks for LLM Apps](http://www.getzep.com) Zep is an open source platform for productionizing LLM apps. Go from a prototype built in LangChain or LlamaIndex, or a custom app, to production in minutes without rewriting code. Key Features: - **Fast!** Zep operates independently of th...
langchain/docs/docs/integrations/providers/zep.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/zep.mdx", "repo_id": "langchain", "token_count": 1023 }
151
#define WARP_SIZE 32 #define FULL_MASK 0xffffffff #define OPTIMAL_THREADS 256 __global__ void index_max_cuda_kernel( float *index_vals, // [batch_size, 32, num_block] int *indices, // [batch_size, num_block] float *max_vals, // [batch_size, A_num_block * 32] float *max_vals_scatter, //...
transformers/src/transformers/kernels/mra/cuda_kernel.h/0
{ "file_path": "transformers/src/transformers/kernels/mra/cuda_kernel.h", "repo_id": "transformers", "token_count": 729 }
626
# coding=utf-8 # Copyright 2018 The HuggingFace Inc. team, Microsoft Corporation. # Copyright (c) 2018, NVIDIA CORPORATION. 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 ...
transformers/src/transformers/models/mpnet/configuration_mpnet.py/0
{ "file_path": "transformers/src/transformers/models/mpnet/configuration_mpnet.py", "repo_id": "transformers", "token_count": 1977 }
668
[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 = ["DynamoDBVectorStore"] contains_example = false import_path = "llama_index.vector_stores.d...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-dynamodb/pyproject.toml/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-dynamodb/pyproject.toml", "repo_id": "llama_index", "token_count": 669 }
1,555
from enum import Enum from functools import wraps from typing import Any, Callable, Dict, List, Optional, Set, Tuple, Union from langchain_community.utilities.redis import TokenEscaper # disable mypy error for dunder method overrides # mypy: disable-error-code="override" class RedisFilterOperator(Enum): """Redi...
langchain/libs/community/langchain_community/vectorstores/redis/filters.py/0
{ "file_path": "langchain/libs/community/langchain_community/vectorstores/redis/filters.py", "repo_id": "langchain", "token_count": 6984 }
313
# 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/audioldm/test_audioldm.py/0
{ "file_path": "diffusers/tests/pipelines/audioldm/test_audioldm.py", "repo_id": "diffusers", "token_count": 7498 }
249
import { Client } from "langsmith"; import { BaseRun, RunCreate, RunUpdate as BaseRunUpdate, KVMap, } from "langsmith/schemas"; import { getEnvironmentVariable, getRuntimeEnvironment } from "../utils/env.js"; import { BaseTracer } from "./base.js"; import { BaseCallbackHandlerInput } from "../callbacks/base.js"...
langchainjs/langchain-core/src/tracers/tracer_langchain.ts/0
{ "file_path": "langchainjs/langchain-core/src/tracers/tracer_langchain.ts", "repo_id": "langchainjs", "token_count": 879 }
869
# Memgraph ## Setup ### Install LangChain dependencies Install the dependencies needed for Memgraph: import IntegrationInstallTooltip from "@mdx_components/integration_install_tooltip.mdx"; <IntegrationInstallTooltip></IntegrationInstallTooltip> ```bash npm2yarn npm install @langchain/openai neo4j-driver @langcha...
langchainjs/docs/core_docs/docs/modules/data_connection/experimental/graph_databases/memgraph.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/modules/data_connection/experimental/graph_databases/memgraph.mdx", "repo_id": "langchainjs", "token_count": 621 }
732
from .adabelief import AdaBelief from .adafactor import Adafactor from .adahessian import Adahessian from .adamp import AdamP from .adamw import AdamW from .adan import Adan from .lamb import Lamb from .lars import Lars from .lookahead import Lookahead from .madgrad import MADGRAD from .nadam import Nadam from .nvnovog...
pytorch-image-models/timm/optim/__init__.py/0
{ "file_path": "pytorch-image-models/timm/optim/__init__.py", "repo_id": "pytorch-image-models", "token_count": 170 }
405
<jupyter_start><jupyter_text>Adding moderationThis shows how to add in moderation (or other safeguards) around your LLM application.<jupyter_code>%pip install --upgrade --quiet langchain langchain-openai from langchain.chains import OpenAIModerationChain from langchain_core.prompts import ChatPromptTemplate from langc...
langchain/docs/docs/expression_language/cookbook/moderation.ipynb/0
{ "file_path": "langchain/docs/docs/expression_language/cookbook/moderation.ipynb", "repo_id": "langchain", "token_count": 200 }
87
# THIS FILE HAS BEEN AUTOGENERATED. To update: # 1. modify the `_deps` dict in setup.py # 2. run `make deps_table_update`` deps = { "Pillow": "Pillow>=10.0.1,<=15.0", "accelerate": "accelerate>=0.21.0", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "codecarbon": "codecarbon==1.2.0", "co...
transformers/src/transformers/dependency_versions_table.py/0
{ "file_path": "transformers/src/transformers/dependency_versions_table.py", "repo_id": "transformers", "token_count": 1755 }
570
#!/usr/bin/env python # coding=utf-8 # 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-...
transformers/examples/tensorflow/contrastive-image-text/run_clip.py/0
{ "file_path": "transformers/examples/tensorflow/contrastive-image-text/run_clip.py", "repo_id": "transformers", "token_count": 11224 }
582
// 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/data_sync_service_test.go/0
{ "file_path": "milvus/internal/datanode/data_sync_service_test.go", "repo_id": "milvus", "token_count": 5900 }
1,920
#! /bin/bash # Note: This is run as root cd ~ export enable_auth="${enable_auth}" export basic_auth_credentials="${basic_auth_credentials}" export auth_type="${auth_type}" export token_auth_credentials="${token_auth_credentials}" apt-get update -y apt-get install -y ca-certificates curl gnupg lsb-release mkdir -m 075...
chroma/examples/deployments/aws-terraform/startup.sh/0
{ "file_path": "chroma/examples/deployments/aws-terraform/startup.sh", "repo_id": "chroma", "token_count": 828 }
41
from langchain_community.document_loaders.html_bs import BSHTMLLoader __all__ = ["BSHTMLLoader"]
langchain/libs/langchain/langchain/document_loaders/html_bs.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/html_bs.py", "repo_id": "langchain", "token_count": 36 }
529
{ "name": "tokenizers-win32-ia32-msvc", "version": "0.13.4-rc1", "os": [ "win32" ], "cpu": [ "ia32" ], "main": "tokenizers.win32-ia32-msvc.node", "files": [ "tokenizers.win32-ia32-msvc.node" ], "description": "Tokenizers platform specific bindings", "keywords": [ "napi-rs", "NA...
tokenizers/bindings/node/npm/win32-ia32-msvc/package.json/0
{ "file_path": "tokenizers/bindings/node/npm/win32-ia32-msvc/package.json", "repo_id": "tokenizers", "token_count": 277 }
441
import { TogetherAIEmbeddings } from "@langchain/community/embeddings/togetherai"; const embeddings = new TogetherAIEmbeddings({ apiKey: process.env.TOGETHER_AI_API_KEY, // Default value modelName: "togethercomputer/m2-bert-80M-8k-retrieval", // Default value }); const res = await embeddings.embedQuery( "What w...
langchainjs/examples/src/embeddings/togetherai.ts/0
{ "file_path": "langchainjs/examples/src/embeddings/togetherai.ts", "repo_id": "langchainjs", "token_count": 130 }
860
import copy import json from typing import Any, Dict, List, Optional, Type, Union import jsonpatch from langchain_core.exceptions import OutputParserException from langchain_core.output_parsers import ( BaseCumulativeTransformOutputParser, BaseGenerationOutputParser, ) from langchain_core.output_parsers.json i...
langchain/libs/langchain/langchain/output_parsers/openai_functions.py/0
{ "file_path": "langchain/libs/langchain/langchain/output_parsers/openai_functions.py", "repo_id": "langchain", "token_count": 3645 }
560
#!/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/t2i_adapter/train_t2i_adapter_sdxl.py/0
{ "file_path": "diffusers/examples/t2i_adapter/train_t2i_adapter_sdxl.py", "repo_id": "diffusers", "token_count": 23101 }
229
from langchain_community.docstore.base import AddableMixin, Docstore __all__ = ["Docstore", "AddableMixin"]
langchain/libs/langchain/langchain/docstore/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/docstore/base.py", "repo_id": "langchain", "token_count": 35 }
520
"""Pass input through a moderation endpoint.""" from typing import Any, Dict, List, Optional from langchain_core.callbacks import CallbackManagerForChainRun from langchain_core.pydantic_v1 import root_validator from langchain_core.utils import get_from_dict_or_env from langchain.chains.base import Chain class OpenA...
langchain/libs/langchain/langchain/chains/moderation.py/0
{ "file_path": "langchain/libs/langchain/langchain/chains/moderation.py", "repo_id": "langchain", "token_count": 1293 }
464
from collections import Counter import datasets import transformers from transformers.convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from transformers.utils import logging logging.set_verbosity_info() TOKENIZER_CLASSES = { name: (getattr(transformers, name), getattr(transformers, name + "Fast")) for nam...
transformers/scripts/check_tokenizers.py/0
{ "file_path": "transformers/scripts/check_tokenizers.py", "repo_id": "transformers", "token_count": 2563 }
600
"""MutliOn Client API tools.""" from langchain_community.tools.multion.close_session import MultionCloseSession from langchain_community.tools.multion.create_session import MultionCreateSession from langchain_community.tools.multion.update_session import MultionUpdateSession __all__ = ["MultionCreateSession", "Multion...
langchain/libs/langchain/langchain/tools/multion/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/multion/__init__.py", "repo_id": "langchain", "token_count": 94 }
593
# coding=utf-8 # Copyright 2021 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/models/big_bird/convert_bigbird_original_tf_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/big_bird/convert_bigbird_original_tf_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 901 }
570
search_performance: collections: - server: db_config.primary_path: /test/milvus/db_data_011/sift_10m_128_l2_hnsw cache_config.cpu_cache_capacity: 32GB engine_config.use_blas_threshold: 0 wal_enable: true collection_name: sift_10m_128_l2 run_count: 2 top_ks: ...
milvus/tests/benchmark/milvus_benchmark/suites/011_cpu_search_sift10m_hnsw.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/011_cpu_search_sift10m_hnsw.yaml", "repo_id": "milvus", "token_count": 561 }
2,086
.. _Ref-Struct-Store: Structured Index Configuration ============================== Our structured indices are documented in :ref:`Ref-Indices-StructStore`. Below, we provide a reference of the classes that are used to configure our structured indices. .. automodule:: llama_index.core.utilities.sql_wrapper :membe...
llama_index/docs/api_reference/struct_store.rst/0
{ "file_path": "llama_index/docs/api_reference/struct_store.rst", "repo_id": "llama_index", "token_count": 174 }
1,042
<!--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/main_classes/model.md/0
{ "file_path": "transformers/docs/source/ja/main_classes/model.md", "repo_id": "transformers", "token_count": 3297 }
542
<jupyter_start><jupyter_text>Recursive Retriever + Query Engine Demo In this demo, we walk through a use case of showcasing our "RecursiveRetriever" module over hierarchical data.The concept of recursive retrieval is that we not only explore the directly most relevant nodes, but also explorenode relationships to additi...
llama_index/docs/examples/query_engine/pdf_tables/recursive_retriever.ipynb/0
{ "file_path": "llama_index/docs/examples/query_engine/pdf_tables/recursive_retriever.ipynb", "repo_id": "llama_index", "token_count": 2068 }
1,128
"""Integration test for llm-based relevant doc filtering.""" from langchain_community.chat_models import ChatOpenAI from langchain_core.documents import Document from langchain.retrievers.document_compressors import LLMChainFilter def test_llm_chain_filter() -> None: texts = [ "What happened to all of my...
langchain/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_chain_filter.py/0
{ "file_path": "langchain/libs/langchain/tests/integration_tests/retrievers/document_compressors/test_chain_filter.py", "repo_id": "langchain", "token_count": 252 }
584
# Testing mixed int8 quantization ![HFxbitsandbytes.png](https://cdn-uploads.huggingface.co/production/uploads/1660567705337-62441d1d9fdefb55a0b7d12c.png) The following is the recipe on how to effectively debug `bitsandbytes` integration on Hugging Face `transformers`. ## Library requirements + `transformers>=4.22....
transformers/tests/quantization/bnb/README.md/0
{ "file_path": "transformers/tests/quantization/bnb/README.md", "repo_id": "transformers", "token_count": 1405 }
752
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/llms/llama-index-llms-xinference/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-xinference/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,321
import inspect import warnings from typing import Any, Dict import pytest from langchain_core._api.deprecation import deprecated, warn_deprecated from langchain_core.pydantic_v1 import BaseModel @pytest.mark.parametrize( "kwargs, expected_message", [ ( { "since": "1.0.0",...
langchain/libs/core/tests/unit_tests/_api/test_deprecation.py/0
{ "file_path": "langchain/libs/core/tests/unit_tests/_api/test_deprecation.py", "repo_id": "langchain", "token_count": 5784 }
402
#!/bin/bash # 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...
milvus/tests/scripts/ci_logs.sh/0
{ "file_path": "milvus/tests/scripts/ci_logs.sh", "repo_id": "milvus", "token_count": 1288 }
1,979
// 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/querynodev2/collector/counter.go/0
{ "file_path": "milvus/internal/querynodev2/collector/counter.go", "repo_id": "milvus", "token_count": 575 }
2,040
# 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 law or ag...
milvus/internal/core/cmake/ThirdPartyPackages.cmake/0
{ "file_path": "milvus/internal/core/cmake/ThirdPartyPackages.cmake", "repo_id": "milvus", "token_count": 1545 }
1,638
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azurecosmosmongo/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azurecosmosmongo/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,647
""" DeiT - Data-efficient Image Transformers DeiT model defs and weights from https://github.com/facebookresearch/deit, original copyright below paper: `DeiT: Data-efficient Image Transformers` - https://arxiv.org/abs/2012.12877 paper: `DeiT III: Revenge of the ViT` - https://arxiv.org/abs/2204.07118 Modifications ...
pytorch-image-models/timm/models/deit.py/0
{ "file_path": "pytorch-image-models/timm/models/deit.py", "repo_id": "pytorch-image-models", "token_count": 8300 }
400
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.streamlit_chatbot import StreamlitChatPack def test_class(): names_of_base_classes = [b.__name__ for b in StreamlitChatPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/tests/test_packs_streamlit_chatbot.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-streamlit-chatbot/tests/test_packs_streamlit_chatbot.py", "repo_id": "llama_index", "token_count": 98 }
1,732
python_sources() python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image_deplot/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image_deplot/BUILD", "repo_id": "llama_index", "token_count": 24 }
1,316
import { RemoteRunnable } from "@langchain/core/runnables/remote"; const remoteChain = new RemoteRunnable({ // url: "https://your_hostname.com/path", url: "https://chat-langchain-backend.langchain.dev/chat", }); const logStream = await remoteChain.streamLog( { question: "What is a document loader?", }, ...
langchainjs/examples/src/ecosystem/langsmith_stream_log.ts/0
{ "file_path": "langchainjs/examples/src/ecosystem/langsmith_stream_log.ts", "repo_id": "langchainjs", "token_count": 2224 }
770
# LlamaIndex Docstore Integration: Redis Docstore
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-redis/README.md/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-redis/README.md", "repo_id": "llama_index", "token_count": 13 }
1,491
package command import ( "context" "github.com/milvus-io/milvus/cmd/tools/migration/configs" "github.com/milvus-io/milvus/cmd/tools/migration/console" "github.com/milvus-io/milvus/cmd/tools/migration/migration" ) func Run(c *configs.Config) { ctx := context.Background() runner := migration.NewRunner(ctx, c) c...
milvus/cmd/tools/migration/command/run.go/0
{ "file_path": "milvus/cmd/tools/migration/command/run.go", "repo_id": "milvus", "token_count": 347 }
1,703
<jupyter_start><jupyter_code>%load_ext autoreload %autoreload 2<jupyter_output>The autoreload extension is already loaded. To reload it, use: %reload_ext autoreload<jupyter_text>DocugamiThis notebook covers how to load documents from `Docugami`. See [README](./README.md) for more details, and the advantages of using ...
llama_index/llama-index-integrations/readers/llama-index-readers-docugami/examples/docugami.ipynb/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-docugami/examples/docugami.ipynb", "repo_id": "llama_index", "token_count": 2789 }
1,285
# 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/adalora/layer.py/0
{ "file_path": "peft/src/peft/tuners/adalora/layer.py", "repo_id": "peft", "token_count": 6956 }
334
.. _Ref-Storage-Docstore: Document Store ===================== .. automodule:: llama_index.core.storage.docstore :members: :inherited-members:
llama_index/docs/api_reference/storage/docstore.rst/0
{ "file_path": "llama_index/docs/api_reference/storage/docstore.rst", "repo_id": "llama_index", "token_count": 52 }
1,117
# __package_name__ This package contains the LangChain integration with __ModuleName__ ## Installation ```bash pip install -U __package_name__ ``` And you should configure credentials by setting the following environment variables: * TODO: fill this out ## Chat Models `Chat__ModuleName__` class exposes chat mode...
langchain/libs/cli/langchain_cli/integration_template/README.md/0
{ "file_path": "langchain/libs/cli/langchain_cli/integration_template/README.md", "repo_id": "langchain", "token_count": 289 }
198
# 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/models/test_modeling_common.py/0
{ "file_path": "diffusers/tests/models/test_modeling_common.py", "repo_id": "diffusers", "token_count": 13953 }
265
kind: NetworkChaos apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-minio-network-latency namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: release: milvus-chaos app: minio mode: all action: delay delay: latency: 200ms correlation:...
milvus/tests/python_client/chaos/chaos_objects/network_latency/chaos_minio_network_latency.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/network_latency/chaos_minio_network_latency.yaml", "repo_id": "milvus", "token_count": 217 }
2,107
# ResNet-D **ResNet-D** is a modification on the [ResNet](https://paperswithcode.com/method/resnet) architecture that utilises an [average pooling](https://paperswithcode.com/method/average-pooling) tweak for downsampling. The motivation is that in the unmodified ResNet, the [1×1 convolution](https://paperswithcode.co...
pytorch-image-models/docs/models/.templates/models/resnet-d.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/resnet-d.md", "repo_id": "pytorch-image-models", "token_count": 3126 }
332
"""Configuration file for the Sphinx documentation builder.""" # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup --------...
langchain/docs/api_reference/conf.py/0
{ "file_path": "langchain/docs/api_reference/conf.py", "repo_id": "langchain", "token_count": 2064 }
84
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-milvus/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,663
# coding=utf-8 # Copyright 2022 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/models/swinv2/convert_swinv2_timm_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/swinv2/convert_swinv2_timm_to_pytorch.py", "repo_id": "transformers", "token_count": 3494 }
750
"""Test chat model integration.""" from typing import List, Optional from unittest.mock import Mock, call import pytest from ai21 import MissingApiKeyError from ai21.models import ChatMessage, Penalty, RoleType from langchain_core.messages import ( AIMessage, BaseMessage, HumanMessage, SystemMessage, )...
langchain/libs/partners/ai21/tests/unit_tests/test_chat_models.py/0
{ "file_path": "langchain/libs/partners/ai21/tests/unit_tests/test_chat_models.py", "repo_id": "langchain", "token_count": 3441 }
647
<!--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/en/training/kandinsky.md/0
{ "file_path": "diffusers/docs/source/en/training/kandinsky.md", "repo_id": "diffusers", "token_count": 5045 }
184
<jupyter_start><jupyter_text>Auto Merging RetrieverIn this notebook, we showcase our `AutoMergingRetriever`, which looks at a set of leaf nodes and recursively "merges" subsets of leaf nodes that reference a parent node beyond a given threshold. This allows us to consolidate potentially disparate, smaller contexts into...
llama_index/docs/examples/retrievers/auto_merging_retriever.ipynb/0
{ "file_path": "llama_index/docs/examples/retrievers/auto_merging_retriever.ipynb", "repo_id": "llama_index", "token_count": 3028 }
1,141
import { OpenAI } from "@langchain/openai"; import { PromptTemplate } from "@langchain/core/prompts"; import { CustomListOutputParser } from "@langchain/core/output_parsers"; // With a `CustomListOutputParser`, we can parse a list with a specific length and separator. const parser = new CustomListOutputParser({ length...
langchainjs/examples/src/prompts/custom_list_parser.ts/0
{ "file_path": "langchainjs/examples/src/prompts/custom_list_parser.ts", "repo_id": "langchainjs", "token_count": 389 }
842
import { Runnable, type RunnableBatchOptions } from "./base.js"; import { IterableReadableStream } from "../utils/stream.js"; import type { RunnableConfig } from "./config.js"; export type RouterInput = { key: string; // eslint-disable-next-line @typescript-eslint/no-explicit-any input: any; }; /** * A runnabl...
langchainjs/langchain-core/src/runnables/router.ts/0
{ "file_path": "langchainjs/langchain-core/src/runnables/router.ts", "repo_id": "langchainjs", "token_count": 1252 }
880
// Code generated by mockery v2.32.4. DO NOT EDIT. package mocks import ( context "context" commonpb "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" clientv3 "go.etcd.io/etcd/client/v3" internalpb "github.com/milvus-io/milvus/internal/proto/internalpb" milvuspb "github.com/milvus-io/milvus-proto/go-api...
milvus/internal/mocks/mock_querynode.go/0
{ "file_path": "milvus/internal/mocks/mock_querynode.go", "repo_id": "milvus", "token_count": 22542 }
1,947
export { type FewShotPromptTemplateInput, FewShotPromptTemplate, type FewShotChatMessagePromptTemplateInput, FewShotChatMessagePromptTemplate, } from "@langchain/core/prompts";
langchainjs/langchain/src/prompts/few_shot.ts/0
{ "file_path": "langchainjs/langchain/src/prompts/few_shot.ts", "repo_id": "langchainjs", "token_count": 56 }
913
<jupyter_start><jupyter_text>Bonus Unit 1: Let's train Huggy the Dog 🐶 to fetch a stick In this notebook, we'll reinforce what we learned in the first Unit by **teaching Huggy the Dog to fetch the stick and then play with it directly in your browser**⬇️ Here is an example of what **you will achieve at the end of the u...
deep-rl-class/notebooks/bonus-unit1/bonus-unit1.ipynb/0
{ "file_path": "deep-rl-class/notebooks/bonus-unit1/bonus-unit1.ipynb", "repo_id": "deep-rl-class", "token_count": 3113 }
152
import gc import inspect import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, LatentConsistencyModelImg2ImgPipeline, LCMScheduler, UNet2DConditionModel, ) from diffusers.utils.testing_...
diffusers/tests/pipelines/latent_consistency_models/test_latent_consistency_models_img2img.py/0
{ "file_path": "diffusers/tests/pipelines/latent_consistency_models/test_latent_consistency_models_img2img.py", "repo_id": "diffusers", "token_count": 4946 }
280
from langchain_community.embeddings.dashscope import ( DashScopeEmbeddings, ) __all__ = ["DashScopeEmbeddings"]
langchain/libs/langchain/langchain/embeddings/dashscope.py/0
{ "file_path": "langchain/libs/langchain/langchain/embeddings/dashscope.py", "repo_id": "langchain", "token_count": 40 }
523
<!--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/en/using-diffusers/callback.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/callback.md", "repo_id": "diffusers", "token_count": 1609 }
193