text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
<jupyter_start><jupyter_text>Jupyter Notebook>[Jupyter Notebook](https://en.wikipedia.org/wiki/Project_JupyterApplications) (formerly `IPython Notebook`) is a web-based interactive computational environment for creating notebook documents.This notebook covers how to load data from a `Jupyter notebook (.html)` into a fo...
langchain/docs/docs/integrations/document_loaders/jupyter_notebook.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/jupyter_notebook.ipynb", "repo_id": "langchain", "token_count": 341 }
105
// 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/indexnode/indexnode_service_test.go/0
{ "file_path": "milvus/internal/indexnode/indexnode_service_test.go", "repo_id": "milvus", "token_count": 1331 }
1,720
# coding=utf-8 # Copyright 2022 NVIDIA and 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 # # Un...
transformers/src/transformers/models/groupvit/modeling_groupvit.py/0
{ "file_path": "transformers/src/transformers/models/groupvit/modeling_groupvit.py", "repo_id": "transformers", "token_count": 29453 }
628
# Elasticsearch > [Elasticsearch](https://www.elastic.co/elasticsearch/) is a distributed, RESTful search and analytics engine. > It provides a distributed, multi-tenant-capable full-text search engine with an HTTP web interface and schema-free > JSON documents. ## Installation and Setup There are two ways to get st...
langchain/docs/docs/integrations/providers/elasticsearch.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/elasticsearch.mdx", "repo_id": "langchain", "token_count": 530 }
132
from langchain_community.llms.ai21 import AI21, AI21PenaltyData __all__ = ["AI21PenaltyData", "AI21"]
langchain/libs/langchain/langchain/llms/ai21.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/ai21.py", "repo_id": "langchain", "token_count": 38 }
509
# Vision Transformer (ViT) The **Vision Transformer** is a model for image classification that employs a Transformer-like architecture over patches of the image. This includes the use of [Multi-Head Attention](https://paperswithcode.com/method/multi-head-attention), [Scaled Dot-Product Attention](https://paperswithcod...
pytorch-image-models/docs/models/.templates/models/vision-transformer.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/vision-transformer.md", "repo_id": "pytorch-image-models", "token_count": 3834 }
350
from langchain_community.chat_message_histories.cassandra import ( CassandraChatMessageHistory, ) __all__ = ["CassandraChatMessageHistory"]
langchain/libs/langchain/langchain/memory/chat_message_histories/cassandra.py/0
{ "file_path": "langchain/libs/langchain/langchain/memory/chat_message_histories/cassandra.py", "repo_id": "langchain", "token_count": 43 }
528
python_sources()
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-redis/llama_index/storage/docstore/redis/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-redis/llama_index/storage/docstore/redis/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,461
import { InvokeEndpointCommand, InvokeEndpointWithResponseStreamCommand, SageMakerRuntimeClient, SageMakerRuntimeClientConfig, } from "@aws-sdk/client-sagemaker-runtime"; import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager"; import { GenerationChunk } from "@langchain/core/outputs"; impo...
langchainjs/libs/langchain-community/src/llms/sagemaker_endpoint.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/llms/sagemaker_endpoint.ts", "repo_id": "langchainjs", "token_count": 2994 }
1,027
// Code generated by mockery v2.32.4. DO NOT EDIT. package datacoord import ( context "context" datapb "github.com/milvus-io/milvus/internal/proto/datapb" mock "github.com/stretchr/testify/mock" ) // NMockHandler is an autogenerated mock type for the Handler type type NMockHandler struct { mock.Mock } type NMo...
milvus/internal/datacoord/mock_handler.go/0
{ "file_path": "milvus/internal/datacoord/mock_handler.go", "repo_id": "milvus", "token_count": 3236 }
1,830
from llama_index.core.llms.base import BaseLLM from llama_index.llms.langchain import LangChainLLM def test_embedding_class(): names_of_base_classes = [b.__name__ for b in LangChainLLM.__mro__] assert BaseLLM.__name__ in names_of_base_classes
llama_index/llama-index-integrations/llms/llama-index-llms-langchain/tests/test_llms_langchain.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-langchain/tests/test_llms_langchain.py", "repo_id": "llama_index", "token_count": 95 }
1,357
"""Interface with the LangChain Hub.""" from __future__ import annotations from typing import TYPE_CHECKING, Any, Optional from langchain_core.load.dump import dumps from langchain_core.load.load import loads if TYPE_CHECKING: from langchainhub import Client def _get_client(api_url: Optional[str] = None, api_k...
langchain/libs/langchain/langchain/hub.py/0
{ "file_path": "langchain/libs/langchain/langchain/hub.py", "repo_id": "langchain", "token_count": 1055 }
533
# 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/speech_to_text/feature_extraction_speech_to_text.py/0
{ "file_path": "transformers/src/transformers/models/speech_to_text/feature_extraction_speech_to_text.py", "repo_id": "transformers", "token_count": 5608 }
660
// 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/querycoordv2/checkers/index_checker.go/0
{ "file_path": "milvus/internal/querycoordv2/checkers/index_checker.go", "repo_id": "milvus", "token_count": 2060 }
1,839
""" Split BatchNorm A PyTorch BatchNorm layer that splits input batch into N equal parts and passes each through a separate BN layer. The first split is passed through the parent BN layers with weight/bias keys the same as the original BN. All other splits pass through BN sub-layers under the '.aux_bn' namespace. Thi...
pytorch-image-models/timm/layers/split_batchnorm.py/0
{ "file_path": "pytorch-image-models/timm/layers/split_batchnorm.py", "repo_id": "pytorch-image-models", "token_count": 1394 }
348
package proxy import ( "context" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/pkg...
milvus/internal/proxy/task_insert_test.go/0
{ "file_path": "milvus/internal/proxy/task_insert_test.go", "repo_id": "milvus", "token_count": 4189 }
1,751
{ "langchain/schema/messages/AIMessage": "langchain_core/messages/ai/AIMessage", "langchain/schema/messages/AIMessageChunk": "langchain_core/messages/ai/AIMessageChunk", "langchain/schema/messages/BaseMessage": "langchain_core/messages/base/BaseMessage", "langchain/schema/messages/BaseMessageChunk": "langchain_...
langchainjs/langchain/src/load/tests/data/important_imports.json/0
{ "file_path": "langchainjs/langchain/src/load/tests/data/important_imports.json", "repo_id": "langchainjs", "token_count": 3236 }
947
from llama_index.core.llama_pack import BaseLlamaPack from llama_index.packs.auto_merging_retriever import AutoMergingRetrieverPack def test_class(): names_of_base_classes = [b.__name__ for b in AutoMergingRetrieverPack.__mro__] assert BaseLlamaPack.__name__ in names_of_base_classes
llama_index/llama-index-packs/llama-index-packs-auto-merging-retriever/tests/test_packs_auto_merging_retriever.py/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-auto-merging-retriever/tests/test_packs_auto_merging_retriever.py", "repo_id": "llama_index", "token_count": 107 }
1,775
from langchain_community.retrievers.outline import OutlineRetriever __all__ = ["OutlineRetriever"]
langchain/libs/langchain/langchain/retrievers/outline.py/0
{ "file_path": "langchain/libs/langchain/langchain/retrievers/outline.py", "repo_id": "langchain", "token_count": 32 }
558
<jupyter_start><jupyter_text>ImagesThis covers how to load images such as `JPG` or `PNG` into a document format that we can use downstream. Using Unstructured<jupyter_code>%pip install --upgrade --quiet pdfminer from langchain_community.document_loaders.image import UnstructuredImageLoader loader = UnstructuredImageL...
langchain/docs/docs/integrations/document_loaders/image.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/image.ipynb", "repo_id": "langchain", "token_count": 238 }
116
[ { "details": { "best_of_sequences": null, "finish_reason": "length", "generated_tokens": 10, "prefill": [ { "id": 1, "logprob": null, "text": "<s>" }, { "id": 1024, "logprob": -10.578125, "text": "name" ...
text-generation-inference/integration-tests/models/__snapshots__/test_grammar_llama/test_flash_llama_grammar_load.json/0
{ "file_path": "text-generation-inference/integration-tests/models/__snapshots__/test_grammar_llama/test_flash_llama_grammar_load.json", "repo_id": "text-generation-inference", "token_count": 6602 }
396
from typing import List import requests from langchain_core.callbacks.manager import CallbackManagerForRetrieverRun from langchain_core.documents.base import Document from langchain_core.retrievers import BaseRetriever class BreebsRetriever(BaseRetriever): """A retriever class for `Breebs`. See https://www....
langchain/libs/community/langchain_community/retrievers/breebs.py/0
{ "file_path": "langchain/libs/community/langchain_community/retrievers/breebs.py", "repo_id": "langchain", "token_count": 699 }
285
from mongo_parent_document_retrieval.chain import chain __all__ = ["chain"]
langchain/templates/mongo-parent-document-retrieval/mongo_parent_document_retrieval/__init__.py/0
{ "file_path": "langchain/templates/mongo-parent-document-retrieval/mongo_parent_document_retrieval/__init__.py", "repo_id": "langchain", "token_count": 25 }
653
## Textual Inversion fine-tuning example [Textual inversion](https://arxiv.org/abs/2208.01618) is a method to personalize text2image models like stable diffusion on your own images using just 3-5 examples. The `textual_inversion.py` script shows how to implement the training procedure and adapt it for stable diffusion...
diffusers/examples/textual_inversion/README.md/0
{ "file_path": "diffusers/examples/textual_inversion/README.md", "repo_id": "diffusers", "token_count": 1736 }
201
from langchain_community.document_loaders.azure_blob_storage_file import ( AzureBlobStorageFileLoader, ) __all__ = ["AzureBlobStorageFileLoader"]
langchain/libs/langchain/langchain/document_loaders/azure_blob_storage_file.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/azure_blob_storage_file.py", "repo_id": "langchain", "token_count": 51 }
509
<jupyter_start><jupyter_text>Rockset Vector StoreAs a real-time search and analytics database, Rockset uses indexing to deliver scalable and performant personalization, product search, semantic search, chatbot applications, and more.Since Rockset is purpose-built for real-time, you can build these responsive applicatio...
llama_index/docs/examples/vector_stores/RocksetIndexDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/vector_stores/RocksetIndexDemo.ipynb", "repo_id": "llama_index", "token_count": 1898 }
1,113
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-dynamodb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-dynamodb/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,519
# CIP-10112023: Authorization ## Status Current Status: `Under Discussion` ## **Motivation** The motivation for introducing an authorization feature in Chroma is to address the lack of a proper authorization model that many users are struggling with, especially those who deploy production apps. Additionally, as Chr...
chroma/docs/cip/CIP-10112023_Authorization.md/0
{ "file_path": "chroma/docs/cip/CIP-10112023_Authorization.md", "repo_id": "chroma", "token_count": 3243 }
38
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # 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 cop...
transformers/examples/legacy/multiple_choice/utils_multiple_choice.py/0
{ "file_path": "transformers/examples/legacy/multiple_choice/utils_multiple_choice.py", "repo_id": "transformers", "token_count": 10031 }
543
import { test, expect } from "@jest/globals"; import "@tensorflow/tfjs-backend-cpu"; import { TensorFlowEmbeddings } from "../tensorflow.js"; import { HNSWLib } from "../../vectorstores/hnswlib.js"; test("TensorflowEmbeddings", async () => { const embeddings = new TensorFlowEmbeddings(); const texts = [ "Hell...
langchainjs/libs/langchain-community/src/embeddings/tests/tensorflow.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/embeddings/tests/tensorflow.int.test.ts", "repo_id": "langchainjs", "token_count": 382 }
954
<!--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...
peft/docs/source/developer_guides/lora.md/0
{ "file_path": "peft/docs/source/developer_guides/lora.md", "repo_id": "peft", "token_count": 2633 }
320
"""**Document Transformers** are classes to transform Documents. **Document Transformers** usually used to transform a lot of Documents in a single run. **Class hierarchy:** .. code-block:: BaseDocumentTransformer --> <name> # Examples: DoctranQATransformer, DoctranTextTranslator **Main helpers:** .. code-bl...
langchain/libs/community/langchain_community/document_transformers/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_transformers/__init__.py", "repo_id": "langchain", "token_count": 604 }
253
python_sources()
llama_index/llama-index-integrations/llms/llama-index-llms-localai/llama_index/llms/localai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-localai/llama_index/llms/localai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,266
apiVersion: chaos-mesh.org/v1alpha1 kind: PodChaos metadata: name: test-minio-pod-failure namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: release: milvus-chaos app: minio mode: fixed value: "1" action: pod-failure duration: 2m gracePeriod: ...
milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_minio_pod_failure.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/pod_failure/chaos_minio_pod_failure.yaml", "repo_id": "milvus", "token_count": 133 }
1,965
package indexparamcheck type binFlatChecker struct { binaryVectorBaseChecker } func (c binFlatChecker) CheckTrain(params map[string]string) error { return c.binaryVectorBaseChecker.CheckTrain(params) } func (c binFlatChecker) StaticCheck(params map[string]string) error { return c.staticCheck(params) } func newBi...
milvus/pkg/util/indexparamcheck/bin_flat_checker.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/bin_flat_checker.go", "repo_id": "milvus", "token_count": 128 }
1,829
import pytest @pytest.fixture(scope="module") def flash_llama_gptq_handle(launcher): with launcher("huggingface/llama-7b-gptq", num_shard=2, quantize="gptq") as handle: yield handle @pytest.fixture(scope="module") async def flash_llama_gptq(flash_llama_gptq_handle): await flash_llama_gptq_handle.hea...
text-generation-inference/integration-tests/models/test_flash_llama_gptq.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_flash_llama_gptq.py", "repo_id": "text-generation-inference", "token_count": 723 }
406
# coding=utf-8 # Copyright 2020 Google and 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...
transformers/src/transformers/models/pegasus/tokenization_pegasus.py/0
{ "file_path": "transformers/src/transformers/models/pegasus/tokenization_pegasus.py", "repo_id": "transformers", "token_count": 5716 }
726
import { ChatOpenAI } from "@langchain/openai"; import { ChatPromptTemplate } from "@langchain/core/prompts"; import { HttpResponseOutputParser } from "langchain/output_parsers"; const TEMPLATE = `You are a pirate named Patchy. All responses must be extremely verbose and in pirate dialect. {input}`; const prompt = C...
langchainjs/examples/src/guides/deployment/streaming.ts/0
{ "file_path": "langchainjs/examples/src/guides/deployment/streaming.ts", "repo_id": "langchainjs", "token_count": 222 }
792
// 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/util/importutilv2/numpy/reader.go/0
{ "file_path": "milvus/internal/util/importutilv2/numpy/reader.go", "repo_id": "milvus", "token_count": 1273 }
2,021
{ "name": "test-exports-esbuild", "version": "0.0.0", "workspaces": [ "libs/*" ], "private": true, "description": "Tests for the things exported by the langchain package", "main": "./index.mjs", "type": "module", "scripts": { "build": "tsc", "test": "yarn run test:esm && yarn run test:cjs"...
langchainjs/environment_tests/test-exports-esbuild/package.json/0
{ "file_path": "langchainjs/environment_tests/test-exports-esbuild/package.json", "repo_id": "langchainjs", "token_count": 576 }
832
# 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...
transformers/utils/notification_service_doc_tests.py/0
{ "file_path": "transformers/utils/notification_service_doc_tests.py", "repo_id": "transformers", "token_count": 6457 }
767
from langchain_community.callbacks.whylabs_callback import ( WhyLabsCallbackHandler, ) __all__ = ["WhyLabsCallbackHandler"]
langchain/libs/langchain/langchain/callbacks/whylabs_callback.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/whylabs_callback.py", "repo_id": "langchain", "token_count": 42 }
475
/* eslint-disable no-process-env */ /* eslint-disable @typescript-eslint/no-non-null-assertion */ /* eslint-disable no-promise-executor-return */ import { test } from "@jest/globals"; import { Pinecone } from "@pinecone-database/pinecone"; import { Document } from "@langchain/core/documents"; import { OpenAIEmbeddings,...
langchainjs/langchain/src/retrievers/self_query/tests/pinecone_self_query.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/self_query/tests/pinecone_self_query.int.test.ts", "repo_id": "langchainjs", "token_count": 7973 }
905
<!--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/it/perf_infer_cpu.md/0
{ "file_path": "transformers/docs/source/it/perf_infer_cpu.md", "repo_id": "transformers", "token_count": 1497 }
520
# coding=utf-8 # Copyright 2023 The Espnet authors, IMS Toucan 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....
transformers/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py/0
{ "file_path": "transformers/src/transformers/models/fastspeech2_conformer/modeling_fastspeech2_conformer.py", "repo_id": "transformers", "token_count": 33081 }
687
/* eslint-disable */ /** * Generated `api` utility. * * THIS CODE IS AUTOMATICALLY GENERATED. * * Generated by convex@1.3.1. * To regenerate, run `npx convex dev`. * @module */ import type { ApiFromModules, FilterApi, FunctionReference, } from "convex/server"; /** * A utility for referencing Convex fun...
langchainjs/examples/src/embeddings/convex/_generated/api.d.ts/0
{ "file_path": "langchainjs/examples/src/embeddings/convex/_generated/api.d.ts", "repo_id": "langchainjs", "token_count": 235 }
788
"""Chain for applying self-critique using the SmartGPT workflow.""" from typing import Any, Dict, List, Optional, Tuple, Type from langchain.base_language import BaseLanguageModel from langchain.callbacks.manager import CallbackManagerForChainRun from langchain.chains.base import Chain from langchain.input import get_...
langchain/libs/experimental/langchain_experimental/smart_llm/base.py/0
{ "file_path": "langchain/libs/experimental/langchain_experimental/smart_llm/base.py", "repo_id": "langchain", "token_count": 6150 }
426
// 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/metrics/querynode_metrics.go/0
{ "file_path": "milvus/pkg/metrics/querynode_metrics.go", "repo_id": "milvus", "token_count": 6511 }
2,035
import pytest from tokenizers import ByteLevelBPETokenizer from ..utils import data_dir, multiprocessing_with_parallelism, roberta_files class TestByteLevelBPE: def test_basic_encode(self, roberta_files): tokenizer = ByteLevelBPETokenizer.from_file(roberta_files["vocab"], roberta_files["merges"]) ...
tokenizers/bindings/python/tests/implementations/test_byte_level_bpe.py/0
{ "file_path": "tokenizers/bindings/python/tests/implementations/test_byte_level_bpe.py", "repo_id": "tokenizers", "token_count": 1658 }
420
// 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/http/server_test.go/0
{ "file_path": "milvus/internal/http/server_test.go", "repo_id": "milvus", "token_count": 3129 }
1,802
use candle::{DType, Device, Tensor}; use candle_nn::VarBuilder; use candle_transformers::generation::LogitsProcessor; use candle_transformers::models::mixformer::{Config, MixFormerSequentialForCausalLM as MixFormer}; use candle_transformers::models::quantized_mixformer::MixFormerSequentialForCausalLM as QMixFormer; use...
candle/candle-wasm-examples/phi/src/bin/m.rs/0
{ "file_path": "candle/candle-wasm-examples/phi/src/bin/m.rs", "repo_id": "candle", "token_count": 2646 }
84
from __future__ import annotations import json from typing import Optional, Type import requests import yaml from langchain_core.callbacks import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, ) from langchain_core.pydantic_v1 import BaseModel from langchain_core.tools import BaseTool class Ap...
langchain/libs/community/langchain_community/tools/plugin.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/plugin.py", "repo_id": "langchain", "token_count": 1208 }
298
<script lang="ts"> import { navigating } from "$app/stores"; import { createEventDispatcher } from "svelte"; import { browser } from "$app/environment"; import { base } from "$app/paths"; import { page } from "$app/stores"; import CarbonClose from "~icons/carbon/close"; import CarbonTextAlignJustify from "~icon...
chat-ui/src/lib/components/MobileNav.svelte/0
{ "file_path": "chat-ui/src/lib/components/MobileNav.svelte", "repo_id": "chat-ui", "token_count": 692 }
91
"""Fake Chat Model wrapper for testing purposes.""" import re from typing import Any, AsyncIterator, Dict, Iterator, List, Optional, cast from langchain_core.language_models.chat_models import BaseChatModel, SimpleChatModel from langchain_core.messages import ( AIMessage, AIMessageChunk, BaseMessage, ) fro...
langchain/libs/langchain/tests/unit_tests/llms/fake_chat_model.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/llms/fake_chat_model.py", "repo_id": "langchain", "token_count": 3719 }
625
# coding=utf-8 # Copyright 2020 Microsoft and 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...
transformers/src/transformers/models/deberta/tokenization_deberta.py/0
{ "file_path": "transformers/src/transformers/models/deberta/tokenization_deberta.py", "repo_id": "transformers", "token_count": 8267 }
642
from langchain_community.document_loaders.imsdb import IMSDbLoader __all__ = ["IMSDbLoader"]
langchain/libs/langchain/langchain/document_loaders/imsdb.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/imsdb.py", "repo_id": "langchain", "token_count": 31 }
492
from dataclasses import dataclass from typing import List, Union import numpy as np import PIL.Image from ...utils import BaseOutput, is_flax_available @dataclass class StableDiffusionXLPipelineOutput(BaseOutput): """ Output class for Stable Diffusion pipelines. Args: images (`List[PIL.Image.Im...
diffusers/src/diffusers/pipelines/stable_diffusion_xl/pipeline_output.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/stable_diffusion_xl/pipeline_output.py", "repo_id": "diffusers", "token_count": 401 }
265
import torch from transformers import PreTrainedModel from .custom_configuration import CustomConfig, NoSuperInitConfig class CustomModel(PreTrainedModel): config_class = CustomConfig def __init__(self, config): super().__init__(config) self.linear = torch.nn.Linear(config.hidden_size, conf...
transformers/utils/test_module/custom_modeling.py/0
{ "file_path": "transformers/utils/test_module/custom_modeling.py", "repo_id": "transformers", "token_count": 289 }
848
// import { promisify } from 'util' import { BPE, Tokenizer, mergeEncodings, slice } from '../../' describe('slice', () => { const text = 'My name is John 👋' const sliceText = slice.bind({}, text) it('returns the full text when no params', () => { const sliced = sliceText() expect(sliced).toEqual(text...
tokenizers/bindings/node/lib/bindings/utils.test.ts/0
{ "file_path": "tokenizers/bindings/node/lib/bindings/utils.test.ts", "repo_id": "tokenizers", "token_count": 1866 }
438
# coding=utf-8 # 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 requir...
transformers/tests/models/git/test_modeling_git.py/0
{ "file_path": "transformers/tests/models/git/test_modeling_git.py", "repo_id": "transformers", "token_count": 9579 }
786
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. # # 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....
datasets/metrics/code_eval/code_eval.py/0
{ "file_path": "datasets/metrics/code_eval/code_eval.py", "repo_id": "datasets", "token_count": 3175 }
127
# Sharing and Loading Models From the Hugging Face Hub The `timm` library has a built-in integration with the Hugging Face Hub, making it easy to share and load models from the 🤗 Hub. In this short guide, we'll see how to: 1. Share a `timm` model on the Hub 2. How to load that model back from the Hub ## Authent...
pytorch-image-models/hfdocs/source/hf_hub.mdx/0
{ "file_path": "pytorch-image-models/hfdocs/source/hf_hub.mdx", "repo_id": "pytorch-image-models", "token_count": 594 }
323
use crate::quantized_nn::{layer_norm, linear, Linear}; pub use crate::quantized_var_builder::VarBuilder; use candle::{DType, Device, IndexOp, Module, Result, Tensor, D}; use candle_nn::Activation; pub use crate::models::mixformer::Config; const MAX_SEQ_LEN: usize = 4096; #[derive(Debug, Clone)] struct Embedding { ...
candle/candle-transformers/src/models/quantized_mixformer.rs/0
{ "file_path": "candle/candle-transformers/src/models/quantized_mixformer.rs", "repo_id": "candle", "token_count": 5892 }
75
# 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...
accelerate/src/accelerate/utils/bnb.py/0
{ "file_path": "accelerate/src/accelerate/utils/bnb.py", "repo_id": "accelerate", "token_count": 8764 }
12
# 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.8 # Install apt libs - copied from https://github.com/huggingface/accelerate/blob/main/docker/acc...
peft/docker/peft-gpu-bnb-latest/Dockerfile/0
{ "file_path": "peft/docker/peft-gpu-bnb-latest/Dockerfile", "repo_id": "peft", "token_count": 816 }
320
<jupyter_start><jupyter_text>Zilliz>[Zilliz Cloud](https://zilliz.com/doc/quick_start) is a fully managed service on cloud for `LF AI Milvus®`,This notebook shows how to use functionality related to the Zilliz Cloud managed vector database.To run, you should have a `Zilliz Cloud` instance up and running. Here are the [...
langchain/docs/docs/integrations/vectorstores/zilliz.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/zilliz.ipynb", "repo_id": "langchain", "token_count": 721 }
188
<!--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/te/quicktour.md/0
{ "file_path": "transformers/docs/source/te/quicktour.md", "repo_id": "transformers", "token_count": 37552 }
509
import subprocess def test_hello_world(): subprocess.run( "python examples/hello_world.py", shell=True, check=True, )
trl/tests/test_e2e.py/0
{ "file_path": "trl/tests/test_e2e.py", "repo_id": "trl", "token_count": 69 }
813
from typing import Union from langchain_core.agents import AgentAction, AgentFinish from langchain.agents import AgentOutputParser class XMLAgentOutputParser(AgentOutputParser): """Parses tool invocations and final answers in XML format. Expects output to be in one of two formats. If the output signal...
langchain/libs/langchain/langchain/agents/output_parsers/xml.py/0
{ "file_path": "langchain/libs/langchain/langchain/agents/output_parsers/xml.py", "repo_id": "langchain", "token_count": 666 }
444
import pytest from typing import Generator, List, Callable, Iterator, Type, cast from chromadb.config import System, Settings from chromadb.test.conftest import ProducerFn from chromadb.types import ( SubmitEmbeddingRecord, VectorQuery, Operation, ScalarEncoding, Segment, SegmentScope, SeqId...
chroma/chromadb/test/segment/test_vector.py/0
{ "file_path": "chroma/chromadb/test/segment/test_vector.py", "repo_id": "chroma", "token_count": 8538 }
26
/* eslint-disable import/no-extraneous-dependencies */ import fs from "fs"; import path from "path"; import { blue, green } from "picocolors"; export function isFolderEmpty(root: string, name: string): boolean { const validFiles = [ ".DS_Store", ".git", ".gitattributes", ".gitignore", ".gitlab-ci...
langchainjs/libs/create-langchain-integration/helpers/is-folder-empty.ts/0
{ "file_path": "langchainjs/libs/create-langchain-integration/helpers/is-folder-empty.ts", "repo_id": "langchainjs", "token_count": 624 }
985
<jupyter_start><jupyter_text>Metadata Extraction and Augmentation w/ MarvinThis notebook walks through using [`Marvin`](https://github.com/PrefectHQ/marvin) to extract and augment metadata from text. Marvin uses the LLM to identify and extract metadata. Metadata can be anything from additional and enhanced questions a...
llama_index/docs/examples/metadata_extraction/MarvinMetadataExtractorDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/metadata_extraction/MarvinMetadataExtractorDemo.ipynb", "repo_id": "llama_index", "token_count": 1301 }
1,072
import sys from pymilvus import db from utils.api_request import api_request from check.func_check import ResponseChecker class ApiDatabaseWrapper: """ wrapper of database """ database = db def create_database(self, db_name, using="default", timeout=None, check_task=None, check_items=None): fun...
milvus/tests/python_client/base/database_wrapper.py/0
{ "file_path": "milvus/tests/python_client/base/database_wrapper.py", "repo_id": "milvus", "token_count": 628 }
1,881
# 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/pndm/test_pndm.py/0
{ "file_path": "diffusers/tests/pipelines/pndm/test_pndm.py", "repo_id": "diffusers", "token_count": 1317 }
272
import logging from typing import Any, AsyncIterator, Iterator, List, Optional from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import ( BaseChatModel, agenerate_from_stream, generate_from_stream, ) fro...
langchain/libs/community/langchain_community/chat_models/gigachat.py/0
{ "file_path": "langchain/libs/community/langchain_community/chat_models/gigachat.py", "repo_id": "langchain", "token_count": 2659 }
220
# 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/controlnet.py/0
{ "file_path": "diffusers/src/diffusers/models/controlnet.py", "repo_id": "diffusers", "token_count": 18788 }
227
package segments import ( "context" "testing" "github.com/stretchr/testify/suite" "github.com/milvus-io/milvus-proto/go-api/v2/schemapb" "github.com/milvus-io/milvus/internal/proto/datapb" "github.com/milvus-io/milvus/internal/proto/querypb" storage "github.com/milvus-io/milvus/internal/storage" "github.com/...
milvus/internal/querynodev2/segments/segment_test.go/0
{ "file_path": "milvus/internal/querynodev2/segments/segment_test.go", "repo_id": "milvus", "token_count": 1890 }
1,778
from functools import wraps from enum import Enum from typing import Any, Callable, Dict, Optional, Sequence, Union from opentelemetry import trace from opentelemetry.sdk.resources import SERVICE_NAME, Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import ( BatchSpa...
chroma/chromadb/telemetry/opentelemetry/__init__.py/0
{ "file_path": "chroma/chromadb/telemetry/opentelemetry/__init__.py", "repo_id": "chroma", "token_count": 2147 }
18
/* eslint-disable import/first */ /* eslint-disable import/no-duplicates */ import { CheerioWebBaseLoader } from "langchain/document_loaders/web/cheerio"; import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; const chatModel = new ChatOpenAI({}); const embeddings = new OpenAIEmbeddings({}); const loader ...
langchainjs/examples/src/get_started/quickstart2.ts/0
{ "file_path": "langchainjs/examples/src/get_started/quickstart2.ts", "repo_id": "langchainjs", "token_count": 1144 }
791
# Copyright 2024 Katherine Crowson and 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...
diffusers/src/diffusers/schedulers/scheduling_euler_discrete_flax.py/0
{ "file_path": "diffusers/src/diffusers/schedulers/scheduling_euler_discrete_flax.py", "repo_id": "diffusers", "token_count": 4573 }
265
# Prompt templates These are the templates used to format the conversation history for different models used in HuggingChat. Set them in your `.env.local` [like so](https://github.com/huggingface/chat-ui#chatprompttemplate). ## Llama 2 ```env <s>[INST] <<SYS>>\n{{preprompt}}\n<</SYS>>\n\n{{#each messages}}{{#ifUser}...
chat-ui/PROMPTS.md/0
{ "file_path": "chat-ui/PROMPTS.md", "repo_id": "chat-ui", "token_count": 1012 }
90
# 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/vq_model.py/0
{ "file_path": "diffusers/src/diffusers/models/vq_model.py", "repo_id": "diffusers", "token_count": 3139 }
240
// 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/SealedIndexingRecord.h/0
{ "file_path": "milvus/internal/core/src/segcore/SealedIndexingRecord.h", "repo_id": "milvus", "token_count": 846 }
1,883
# coding=utf-8 # Copyright 2022 Salesforce authors, The EleutherAI, and HuggingFace Teams. 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/l...
transformers/src/transformers/models/codegen/modeling_codegen.py/0
{ "file_path": "transformers/src/transformers/models/codegen/modeling_codegen.py", "repo_id": "transformers", "token_count": 13901 }
580
# 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/hubert/convert_hubert_original_pytorch_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/hubert/convert_hubert_original_pytorch_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 4728 }
629
Query Bundle ============ .. automodule:: llama_index.core.indices.query.schema :members: QueryBundle :inherited-members: :exclude-members:
llama_index/docs/api_reference/query/query_bundle.rst/0
{ "file_path": "llama_index/docs/api_reference/query/query_bundle.rst", "repo_id": "llama_index", "token_count": 54 }
1,113
""" Next-ViT As described in https://arxiv.org/abs/2207.05501 Next-ViT model defs and weights adapted from https://github.com/bytedance/Next-ViT, original copyright below """ # Copyright (c) ByteDance Inc. All rights reserved. from functools import partial import torch import torch.nn.functional as F from torch impo...
pytorch-image-models/timm/models/nextvit.py/0
{ "file_path": "pytorch-image-models/timm/models/nextvit.py", "repo_id": "pytorch-image-models", "token_count": 12168 }
366
"""Test Beam API wrapper.""" from langchain_community.llms.beam import Beam def test_beam_call() -> None: """Test valid call to Beam.""" llm = Beam( model_name="gpt2", name="langchain-gpt2", cpu=8, memory="32Gi", gpu="A10G", python_version="python3.8", ...
langchain/libs/community/tests/integration_tests/llms/test_beam.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_beam.py", "repo_id": "langchain", "token_count": 348 }
354
{ "extends": "next/core-web-vitals" }
langchain-template-supabase/.eslintrc.json/0
{ "file_path": "langchain-template-supabase/.eslintrc.json", "repo_id": "langchain-template-supabase", "token_count": 20 }
68
"""Azure CosmosDB MongoDB vCore Vector store index. An index that is built on top of an existing vector store. """ import logging import os from typing import Any, Dict, List, Optional, cast import pymongo from llama_index.core.schema import BaseNode, MetadataMode, TextNode from llama_index.core.vector_stores.types ...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azurecosmosmongo/llama_index/vector_stores/azurecosmosmongo/base.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-azurecosmosmongo/llama_index/vector_stores/azurecosmosmongo/base.py", "repo_id": "llama_index", "token_count": 4232 }
1,513
- sections: - local: index title: 🧨 Diffusers - local: quicktour title: 快速入门 - local: stable_diffusion title: 有效和高效的扩散 - local: installation title: 安装 title: 开始
diffusers/docs/source/zh/_toctree.yml/0
{ "file_path": "diffusers/docs/source/zh/_toctree.yml", "repo_id": "diffusers", "token_count": 100 }
194
from __future__ import annotations import json import logging from typing import ( TYPE_CHECKING, Any, AsyncIterator, Callable, Dict, Iterator, List, Optional, ) from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseLoader from langcha...
langchain/libs/community/langchain_community/document_loaders/astradb.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/astradb.py", "repo_id": "langchain", "token_count": 1598 }
243
import { OpenAI } from "@langchain/openai"; export const run = async () => { const modelA = new OpenAI(); // `call` is a simple string-in, string-out method for interacting with the model. const resA = await modelA.call( "What would be a good company name a company that makes colorful socks?" ); console....
langchainjs/examples/src/models/llm/llm.ts/0
{ "file_path": "langchainjs/examples/src/models/llm/llm.ts", "repo_id": "langchainjs", "token_count": 871 }
838
package indexparamcheck import ( "fmt" "strconv" ) // scaNNChecker checks if a SCANN index can be built. type scaNNChecker struct { ivfBaseChecker } // CheckTrain checks if SCANN index can be built with the specific index parameters. func (c *scaNNChecker) CheckTrain(params map[string]string) error { if err := c...
milvus/pkg/util/indexparamcheck/scann_checker.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/scann_checker.go", "repo_id": "milvus", "token_count": 334 }
1,940
type UUID = ReturnType<typeof crypto.randomUUID>; export function randomUUID(): UUID { // Only on old safari / ios if (!("randomUUID" in crypto)) { return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, (c) => ( Number(c) ^ (crypto.getRandomValues(new Uint8Array(1))[0] & (15 >> (Number(c) / 4))...
chat-ui/src/lib/utils/randomUuid.ts/0
{ "file_path": "chat-ui/src/lib/utils/randomUuid.ts", "repo_id": "chat-ui", "token_count": 166 }
96
"""Init params."""
llama_index/llama-index-core/tests/tools/__init__.py/0
{ "file_path": "llama_index/llama-index-core/tests/tools/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,159
<jupyter_start><jupyter_text>Test Vicuna* `Background`: https://python.langchain.com/en/latest/modules/models/llms/integrations/llamacpp.html* Reproduce the logic that happens in API of the `auto-evaluator`<jupyter_code>!pip install llama-cpp-python import glob, os from langchain.llms import LlamaCpp from langchain.llm...
auto-evaluator/api/Test_Inference.ipynb/0
{ "file_path": "auto-evaluator/api/Test_Inference.ipynb", "repo_id": "auto-evaluator", "token_count": 4090 }
0
import { ChatPromptTemplate, MessagesPlaceholder, } from "@langchain/core/prompts"; import { ChatOpenAI } from "@langchain/openai"; import Exa from "exa-js"; import { AgentExecutor, createOpenAIFunctionsAgent } from "langchain/agents"; import { createRetrieverTool } from "langchain/tools/retriever"; import { ExaRet...
langchainjs/examples/src/tools/exa_agent.ts/0
{ "file_path": "langchainjs/examples/src/tools/exa_agent.ts", "repo_id": "langchainjs", "token_count": 469 }
843
# SimpleDirectoryReader `SimpleDirectoryReader` is the simplest way to load data from local files into LlamaIndex. For production use cases it's more likely that you'll want to use one of the many Readers available on [LlamaHub](https://llamalab.com/hub), but `SimpleDirectoryReader` is a great way to get started. ## ...
llama_index/docs/module_guides/loading/simpledirectoryreader.md/0
{ "file_path": "llama_index/docs/module_guides/loading/simpledirectoryreader.md", "repo_id": "llama_index", "token_count": 1486 }
1,102
<jupyter_start><jupyter_text>Knowledge Graph IndexThis tutorial gives a basic overview of how to use our `KnowledgeGraphIndex`, which handlesautomated knowledge graph construction from unstructured text as well as entity-based querying.If you would like to query knowledge graphs in more flexible ways, including pre-exi...
llama_index/docs/examples/index_structs/knowledge_graph/KnowledgeGraphDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/index_structs/knowledge_graph/KnowledgeGraphDemo.ipynb", "repo_id": "llama_index", "token_count": 1454 }
1,188