text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
# LlamaIndex Readers Integration: Deeplake
llama_index/llama-index-integrations/readers/llama-index-readers-deeplake/README.md/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-deeplake/README.md", "repo_id": "llama_index", "token_count": 11 }
1,357
use crate::model::{Cache, Config, Llama}; use candle::{DType, Device, Result}; use candle_datasets::nlp::tinystories::{Dataset, DatasetRandomIter}; use candle_nn::Optimizer; fn valid_loss( dataset: &Dataset, model: &Llama, args: &crate::TrainingCmd, device: &Device, ) -> Result<f64> { let iter = Da...
candle/candle-examples/examples/llama2-c/training.rs/0
{ "file_path": "candle/candle-examples/examples/llama2-c/training.rs", "repo_id": "candle", "token_count": 1126 }
44
"""Init params."""
llama_index/llama-index-legacy/llama_index/legacy/agent/legacy/__init__.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/agent/legacy/__init__.py", "repo_id": "llama_index", "token_count": 6 }
1,544
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/readers/llama-index-readers-myscale/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-myscale/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,525
# Depth estimation Depth estimation datasets are used to train a model to approximate the relative distance of every pixel in an image from the camera, also known as depth. The applications enabled by these datasets primarily lie in areas like visual machine perception and perception in robotics. Example applications ...
datasets/docs/source/depth_estimation.mdx/0
{ "file_path": "datasets/docs/source/depth_estimation.mdx", "repo_id": "datasets", "token_count": 2848 }
111
import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { formatDocumentsAsString } from "langchain/util/document"; import { StringOutputParser } from "@langchain/core/output_parsers"; import { RunnablePassthrough, RunnableSequenc...
langchainjs/examples/src/guides/expression_language/interface_stream_log.ts/0
{ "file_path": "langchainjs/examples/src/guides/expression_language/interface_stream_log.ts", "repo_id": "langchainjs", "token_count": 4696 }
796
fn main() { pyo3_build_config::add_extension_module_link_args(); }
candle/candle-pyo3/build.rs/0
{ "file_path": "candle/candle-pyo3/build.rs", "repo_id": "candle", "token_count": 30 }
64
#!/usr/bin/env python # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
transformers/examples/flax/speech-recognition/run_flax_speech_recognition_seq2seq.py/0
{ "file_path": "transformers/examples/flax/speech-recognition/run_flax_speech_recognition_seq2seq.py", "repo_id": "transformers", "token_count": 14764 }
575
import torch import torch.distributed from torch import nn from transformers.activations import ACT2FN from typing import Optional, List, Tuple from text_generation_server.utils import paged_attention, flash_attn from text_generation_server.utils.layers import ( TensorParallelRowLinear, TensorParallelColumnLi...
text-generation-inference/server/text_generation_server/models/custom_modeling/flash_santacoder_modeling.py/0
{ "file_path": "text-generation-inference/server/text_generation_server/models/custom_modeling/flash_santacoder_modeling.py", "repo_id": "text-generation-inference", "token_count": 8137 }
401
# rag-conversation-zep This template demonstrates building a RAG conversation app using Zep. Included in this template: - Populating a [Zep Document Collection](https://docs.getzep.com/sdk/documents/) with a set of documents (a Collection is analogous to an index in other Vector Databases). - Using Zep's [integrated...
langchain/templates/rag-conversation-zep/README.md/0
{ "file_path": "langchain/templates/rag-conversation-zep/README.md", "repo_id": "langchain", "token_count": 1127 }
728
use crate::models::with_tracing::Linear; use candle::{DType, Device, IndexOp, Module, Result, Tensor, D}; use candle_nn::VarBuilder; #[derive(Debug, Clone)] pub struct Config { pub num_layers: usize, pub padded_vocab_size: usize, pub hidden_size: usize, pub ffn_hidden_size: usize, pub kv_channels: ...
candle/candle-transformers/src/models/chatglm.rs/0
{ "file_path": "candle/candle-transformers/src/models/chatglm.rs", "repo_id": "candle", "token_count": 10458 }
77
import { Cluster, QueryResult } from "couchbase"; import { Document } from "@langchain/core/documents"; import { BaseDocumentLoader, DocumentLoader } from "../base.js"; /** * loader for couchbase document */ export class CouchbaseDocumentLoader extends BaseDocumentLoader implements DocumentLoader { private clu...
langchainjs/langchain/src/document_loaders/web/couchbase.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/web/couchbase.ts", "repo_id": "langchainjs", "token_count": 845 }
911
# coding=utf-8 # Copyright 2021 Iz Beltagy, Matthew E. Peters, Arman Cohan 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://w...
transformers/src/transformers/models/led/modeling_tf_led.py/0
{ "file_path": "transformers/src/transformers/models/led/modeling_tf_led.py", "repo_id": "transformers", "token_count": 55120 }
680
<img src="https://repository-images.githubusercontent.com/208728772/998c09ca-cfa6-4c01-ac75-3dfad7f4862b" alt="milvus banner"> <div class="column" align="middle"> <a href="https://discord.com/invite/8uyFbECzPX"><img height="20" src="https://img.shields.io/badge/Discord-%235865F2.svg?style=for-the-badge&logo=discord&...
milvus/README.md/0
{ "file_path": "milvus/README.md", "repo_id": "milvus", "token_count": 20705 }
1,884
""" Quick n Simple Image Folder, Tarfile based DataSet Hacked together by / Copyright 2019, Ross Wightman """ import io import logging from typing import Optional import torch import torch.utils.data as data from PIL import Image from .readers import create_reader _logger = logging.getLogger(__name__) _ERROR_RETR...
pytorch-image-models/timm/data/dataset.py/0
{ "file_path": "pytorch-image-models/timm/data/dataset.py", "repo_id": "pytorch-image-models", "token_count": 2918 }
386
<jupyter_start><jupyter_text>Faiss Reader If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-readers-faiss !pip install llama-index import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging.getLogger().addH...
llama_index/docs/examples/data_connectors/FaissDemo.ipynb/0
{ "file_path": "llama_index/docs/examples/data_connectors/FaissDemo.ipynb", "repo_id": "llama_index", "token_count": 826 }
1,047
// 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/typeutil/skip_list_test.go/0
{ "file_path": "milvus/pkg/util/typeutil/skip_list_test.go", "repo_id": "milvus", "token_count": 1475 }
1,845
"""Simple Reader that loads highlights from Readwise.io.""" import datetime import json from typing import List, Optional import requests from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document def _get_readwise_data(api_key: str, updated_after: Optional[datetime.datetime] ...
llama_index/llama-index-integrations/readers/llama-index-readers-readwise/llama_index/readers/readwise/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-readwise/llama_index/readers/readwise/base.py", "repo_id": "llama_index", "token_count": 751 }
1,411
import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AnimateDiffVideoToVideoPipeline, AutoencoderKL, DDIMScheduler, MotionAdapter, UNet2DConditionModel, UNetMotionMod...
diffusers/tests/pipelines/animatediff/test_animatediff_video2video.py/0
{ "file_path": "diffusers/tests/pipelines/animatediff/test_animatediff_video2video.py", "repo_id": "diffusers", "token_count": 4543 }
274
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/pegasus_x/test_modeling_pegasus_x.py/0
{ "file_path": "transformers/tests/models/pegasus_x/test_modeling_pegasus_x.py", "repo_id": "transformers", "token_count": 16624 }
743
<!--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/tasks_explained.md/0
{ "file_path": "transformers/docs/source/ja/tasks_explained.md", "repo_id": "transformers", "token_count": 16553 }
549
poetry_requirements( name="poetry", ) python_sources( interpreter_constraints=["==3.10.*"], )
llama_index/llama-index-integrations/llms/llama-index-llms-watsonx/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-watsonx/BUILD", "repo_id": "llama_index", "token_count": 48 }
1,249
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-weather/llama_index/tools/weather/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-weather/llama_index/tools/weather/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,535
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/src/transformers/models/beit/__init__.py/0
{ "file_path": "transformers/src/transformers/models/beit/__init__.py", "repo_id": "transformers", "token_count": 1337 }
635
<jupyter_start><jupyter_code>import argparse import os import torch from torch.optim import AdamW from torch.utils.data import DataLoader import peft import evaluate from datasets import load_dataset from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed ...
peft/examples/sequence_classification/IA3.ipynb/0
{ "file_path": "peft/examples/sequence_classification/IA3.ipynb", "repo_id": "peft", "token_count": 1903 }
320
import { ClickHouseStore } from "@langchain/community/vectorstores/clickhouse"; import { OpenAIEmbeddings } from "@langchain/openai"; // Initialize ClickHouse store const vectorStore = await ClickHouseStore.fromExistingIndex( new OpenAIEmbeddings(), { host: process.env.CLICKHOUSE_HOST || "localhost", port:...
langchainjs/examples/src/indexes/vector_stores/clickhouse_search.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/clickhouse_search.ts", "repo_id": "langchainjs", "token_count": 348 }
872
from typing import Generator from unittest.mock import patch import chromadb from chromadb.config import Settings from chromadb.api import ClientAPI import chromadb.server.fastapi import pytest import tempfile @pytest.fixture def ephemeral_api() -> Generator[ClientAPI, None, None]: client = chromadb.EphemeralClie...
chroma/chromadb/test/test_client.py/0
{ "file_path": "chroma/chromadb/test/test_client.py", "repo_id": "chroma", "token_count": 816 }
24
import asyncio from threading import Thread from typing import Any, List, Optional, Type from llama_index.core.base.llms.types import ChatMessage from llama_index.core.callbacks import CallbackManager, trace_method from llama_index.core.chat_engine.types import ( AgentChatResponse, BaseChatEngine, Streamin...
llama_index/llama-index-core/llama_index/core/chat_engine/simple.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/chat_engine/simple.py", "repo_id": "llama_index", "token_count": 2707 }
1,118
# 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/controlnet/pipeline_controlnet_sd_xl.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/controlnet/pipeline_controlnet_sd_xl.py", "repo_id": "diffusers", "token_count": 34011 }
244
"""Router retriever.""" import asyncio import logging from typing import List, Optional, Sequence from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.base.base_selector import BaseSelector from llama_index.core.callbacks.schema import CBEventType, EventPayload from llama_index.core.ll...
llama_index/llama-index-core/llama_index/core/retrievers/router_retriever.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/retrievers/router_retriever.py", "repo_id": "llama_index", "token_count": 2763 }
1,296
<!--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 applicable law or agreed...
transformers/docs/source/en/model_doc/flaubert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/flaubert.md", "repo_id": "transformers", "token_count": 1382 }
462
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/query_engine/pandas/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/query_engine/pandas/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,604
import { SimpleSequentialChain, LLMChain } from "langchain/chains"; import { OpenAI } from "@langchain/openai"; import { PromptTemplate } from "@langchain/core/prompts"; // This is an LLMChain to write a synopsis given a title of a play. const llm = new OpenAI({ temperature: 0 }); const template = `You are a playwrigh...
langchainjs/examples/src/chains/simple_sequential_chain.ts/0
{ "file_path": "langchainjs/examples/src/chains/simple_sequential_chain.ts", "repo_id": "langchainjs", "token_count": 635 }
804
# coding=utf-8 # Copyright 2018 LXMERT Authors, The Hugging Face 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 b...
transformers/tests/models/lxmert/test_modeling_lxmert.py/0
{ "file_path": "transformers/tests/models/lxmert/test_modeling_lxmert.py", "repo_id": "transformers", "token_count": 15109 }
794
from __future__ import annotations import importlib.util import logging from typing import ( Any, AsyncIterator, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union, ) from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRu...
langchain/libs/partners/mistralai/langchain_mistralai/chat_models.py/0
{ "file_path": "langchain/libs/partners/mistralai/langchain_mistralai/chat_models.py", "repo_id": "langchain", "token_count": 5881 }
627
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-azcognitive-search/llama_index/readers/azcognitive_search/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-azcognitive-search/llama_index/readers/azcognitive_search/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,337
/* eslint-disable no-process-env */ import { test, expect } from "@jest/globals"; import { Document } from "@langchain/core/documents"; import { ClickHouseStore } from "../clickhouse.js"; // Import OpenAIEmbeddings if you have a valid OpenAI API key import { HuggingFaceInferenceEmbeddings } from "../../embeddings/hf.j...
langchainjs/libs/langchain-community/src/vectorstores/tests/clickhouse.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/clickhouse.int.test.ts", "repo_id": "langchainjs", "token_count": 1201 }
1,051
"""Google Cloud Tools.""" from langchain_community.tools.google_cloud.texttospeech import ( GoogleCloudTextToSpeechTool, ) __all__ = ["GoogleCloudTextToSpeechTool"]
langchain/libs/community/langchain_community/tools/google_cloud/__init__.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/google_cloud/__init__.py", "repo_id": "langchain", "token_count": 57 }
309
mod array; mod data_type; mod hashset_collector; mod index_reader; mod index_reader_c; mod index_writer; mod index_writer_c; mod linkedlist_collector; mod util; mod util_c; mod vec_collector; pub fn add(left: usize, right: usize) -> usize { left + right } #[cfg(test)] mod tests { use super::*; #[test] ...
milvus/internal/core/thirdparty/tantivy/tantivy-binding/src/lib.rs/0
{ "file_path": "milvus/internal/core/thirdparty/tantivy/tantivy-binding/src/lib.rs", "repo_id": "milvus", "token_count": 180 }
1,673
import { Anthropic, type ClientOptions } from "@anthropic-ai/sdk"; import type { Stream } from "@anthropic-ai/sdk/streaming"; import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager"; import { AIMessage, AIMessageChunk, type BaseMessage, } from "@langchain/core/messages"; import { ChatGenerat...
langchainjs/libs/langchain-anthropic/src/chat_models.ts/0
{ "file_path": "langchainjs/libs/langchain-anthropic/src/chat_models.ts", "repo_id": "langchainjs", "token_count": 5375 }
956
// Copyright (C) 2019-2020 Zilliz. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance // with the License. You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable l...
milvus/internal/core/src/query/generated/ExecPlanNodeVisitor.h/0
{ "file_path": "milvus/internal/core/src/query/generated/ExecPlanNodeVisitor.h", "repo_id": "milvus", "token_count": 1845 }
1,794
import { Document } from "@langchain/core/documents"; import { RemoteRetriever, RemoteRetrieverParams, RemoteRetrieverValues, } from "@langchain/community/retrievers/remote"; /** * @deprecated * Interface for the filter parameters used when querying the * ChatGPTRetrievalPlugin server. */ export interface Ch...
langchainjs/langchain/src/retrievers/remote/chatgpt-plugin.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/remote/chatgpt-plugin.ts", "repo_id": "langchainjs", "token_count": 1009 }
981
from typing import Any, Dict, List class KuzuGraph: """Kùzu wrapper for graph operations. *Security note*: Make sure that the database connection uses credentials that are narrowly-scoped to only include necessary permissions. Failure to do so may result in data corruption or loss, since the ...
langchain/libs/community/langchain_community/graphs/kuzu_graph.py/0
{ "file_path": "langchain/libs/community/langchain_community/graphs/kuzu_graph.py", "repo_id": "langchain", "token_count": 1776 }
281
# Flush Collection The `Flush` operation is used to make sure that inserted data will be written into persistent storage. This document will introduce how the `Flush` operation works in `Milvus 2.0`. The following figure shows the execution flow of `Flush`. ![flush_collections](./graphs/flush_data_coord.png) 1. First...
milvus/docs/design_docs/20211109-milvus_flush_collections.md/0
{ "file_path": "milvus/docs/design_docs/20211109-milvus_flush_collections.md", "repo_id": "milvus", "token_count": 1754 }
1,766
# self-query-supabase This templates allows natural language structured quering of Supabase. [Supabase](https://supabase.com/docs) is an open-source alternative to Firebase, built on top of [PostgreSQL](https://en.wikipedia.org/wiki/PostgreSQL). It uses [pgvector](https://github.com/pgvector/pgvector) to store em...
langchain/templates/self-query-supabase/README.md/0
{ "file_path": "langchain/templates/self-query-supabase/README.md", "repo_id": "langchain", "token_count": 1267 }
698
apiVersion: chaos-mesh.org/v1alpha1 kind: PodChaos metadata: name: test-standalone-container-kill namespace: chaos-testing spec: action: container-kill mode: one containerName: 'standalone' selector: namespaces: - chaos-testing # target namespace of milvus deployment labelSelectors: ...
milvus/tests/python_client/chaos/chaos_objects/container_kill/chaos_standalone_container_kill.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/container_kill/chaos_standalone_container_kill.yaml", "repo_id": "milvus", "token_count": 182 }
1,883
# 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/ddpm/pipeline_ddpm.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/ddpm/pipeline_ddpm.py", "repo_id": "diffusers", "token_count": 2059 }
245
import glob import os import shutil import time import warnings from pathlib import Path from typing import List, Optional, Tuple, Union import pyarrow as pa import datasets import datasets.config import datasets.data_files from datasets.naming import filenames_for_dataset_split logger = datasets.utils.logging.get_...
datasets/src/datasets/packaged_modules/cache/cache.py/0
{ "file_path": "datasets/src/datasets/packaged_modules/cache/cache.py", "repo_id": "datasets", "token_count": 3777 }
134
from llama_index.llms.ollama.base import Ollama __all__ = ["Ollama"]
llama_index/llama-index-integrations/llms/llama-index-llms-ollama/llama_index/llms/ollama/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-ollama/llama_index/llms/ollama/__init__.py", "repo_id": "llama_index", "token_count": 29 }
1,410
import platform from functools import lru_cache @lru_cache(maxsize=1) def get_runtime_environment() -> dict: """Get information about the LangChain runtime environment.""" # Lazy import to avoid circular imports from langchain_core import __version__ return { "library_version": __version__, ...
langchain/libs/core/langchain_core/env.py/0
{ "file_path": "langchain/libs/core/langchain_core/env.py", "repo_id": "langchain", "token_count": 170 }
389
"""Unstructured element node parser.""" from typing import Any, Callable, List, Optional import pandas as pd from llama_index.core.callbacks.base import CallbackManager from llama_index.core.node_parser.relational.base_element import ( DEFAULT_SUMMARY_QUERY_STR, BaseElementNodeParser, Element, ) from llam...
llama_index/llama-index-core/llama_index/core/node_parser/relational/unstructured_element.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/node_parser/relational/unstructured_element.py", "repo_id": "llama_index", "token_count": 2050 }
1,279
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Demo App</title> <script type="module" src="app.ts"></script> <link rel="stylesheet" href="https://unpkg.com/sakura.css/css/sakura.css" type="text/css" /> </head> <body> <h3>Page intentionally left bl...
chroma/clients/js/examples/browser/index.html/0
{ "file_path": "chroma/clients/js/examples/browser/index.html", "repo_id": "chroma", "token_count": 379 }
32
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-deepeval/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-deepeval/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,291
from typing import TYPE_CHECKING from langchain_community.document_loaders.parsers.language.tree_sitter_segmenter import ( # noqa: E501 TreeSitterSegmenter, ) if TYPE_CHECKING: from tree_sitter import Language CHUNK_QUERY = """ [ (method) @method (module) @module (class) @class ...
langchain/libs/community/langchain_community/document_loaders/parsers/language/ruby.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/parsers/language/ruby.py", "repo_id": "langchain", "token_count": 284 }
264
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.bing_search import BingSearchToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in BingSearchToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-bing-search/tests/test_tools_bing_search.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-bing-search/tests/test_tools_bing_search.py", "repo_id": "llama_index", "token_count": 95 }
1,476
from llama_index.readers.file.image.base import ImageReader __all__ = ["ImageReader"]
llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-file/llama_index/readers/file/image/__init__.py", "repo_id": "llama_index", "token_count": 28 }
1,436
from transformers import AutoModelForCausalLM, AutoTokenizer import torch def model_fn(model_dir): # load model and processor from model_dir model = AutoModelForCausalLM.from_pretrained(model_dir, device_map="auto", load_in_8bit=True) tokenizer = AutoTokenizer.from_pretrained(model_dir) return model,...
notebooks/sagemaker/24_train_bloom_peft_lora/scripts/inference.py/0
{ "file_path": "notebooks/sagemaker/24_train_bloom_peft_lora/scripts/inference.py", "repo_id": "notebooks", "token_count": 348 }
321
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
transformers/tests/models/patchtst/test_modeling_patchtst.py/0
{ "file_path": "transformers/tests/models/patchtst/test_modeling_patchtst.py", "repo_id": "transformers", "token_count": 6808 }
744
# Copyright (C) 2019-2022 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/build/docker/builder/gpu/ubuntu20.04/Dockerfile/0
{ "file_path": "milvus/build/docker/builder/gpu/ubuntu20.04/Dockerfile", "repo_id": "milvus", "token_count": 1828 }
1,747
/* eslint-disable no-process-env */ import { expect, test } from "@jest/globals"; import { OpenAIEmbeddings, ChatOpenAI } from "@langchain/openai"; import { ConversationalRetrievalQAChain } from "../../chains/conversational_retrieval_chain.js"; import { BufferMemory } from "../../memory/buffer_memory.js"; import { Memo...
langchainjs/langchain/src/retrievers/tests/score_threshold.int.test.ts/0
{ "file_path": "langchainjs/langchain/src/retrievers/tests/score_threshold.int.test.ts", "repo_id": "langchainjs", "token_count": 1279 }
946
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-zapier/llama_index/tools/zapier/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-zapier/llama_index/tools/zapier/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,591
from langchain_community.llms.bittensor import NIBittensorLLM __all__ = ["NIBittensorLLM"]
langchain/libs/langchain/langchain/llms/bittensor.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/bittensor.py", "repo_id": "langchain", "token_count": 34 }
518
import os from typing import Any, Dict, Iterator, List, Optional, Union from langchain_core.documents import Document from langchain_core.utils import get_from_dict_or_env from langchain_community.document_loaders import PyPDFLoader from langchain_community.document_loaders.base import BaseLoader class RSpaceLoader...
langchain/libs/community/langchain_community/document_loaders/rspace.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/rspace.py", "repo_id": "langchain", "token_count": 2237 }
267
import { test, expect } from "@jest/globals"; import { z } from "zod"; import { StructuredTool } from "@langchain/core/tools"; import { getPrompt } from "../prompt_generator.js"; import { Calculator } from "../../../tools/calculator.js"; import { ReadFileTool, WriteFileTool } from "../../../tools/fs.js"; import { InMe...
langchainjs/langchain/src/experimental/autogpt/tests/prompt_generator.test.ts/0
{ "file_path": "langchainjs/langchain/src/experimental/autogpt/tests/prompt_generator.test.ts", "repo_id": "langchainjs", "token_count": 1147 }
893
import { ChatOpenAI } from "@langchain/openai"; import { createOpenAIFunctionsAgent, AgentExecutor } from "langchain/agents"; import { pull } from "langchain/hub"; import type { ChatPromptTemplate } from "@langchain/core/prompts"; const model = new ChatOpenAI({ openAIApiKey: "sk-XXXX", }); const prompt = await pull...
langchainjs/environment_tests/test-exports-tsc/main.ts/0
{ "file_path": "langchainjs/environment_tests/test-exports-tsc/main.ts", "repo_id": "langchainjs", "token_count": 189 }
749
""" AvgPool2d w/ Same Padding Hacked together by / Copyright 2020 Ross Wightman """ import torch import torch.nn as nn import torch.nn.functional as F from typing import List, Tuple, Optional from .helpers import to_2tuple from .padding import pad_same, get_padding_value def avg_pool2d_same(x, kernel_size: List[int...
pytorch-image-models/timm/layers/pool2d_same.py/0
{ "file_path": "pytorch-image-models/timm/layers/pool2d_same.py", "repo_id": "pytorch-image-models", "token_count": 1294 }
347
import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai"; import { CharacterTextSplitter } from "langchain/text_splitter"; import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { ChatPromptTemplate } from "@langchain/core/prompts"; import { createStuffDocumentsChain } from "langchain/chain...
langchainjs/examples/src/indexes/text_splitter_with_chunk_header.ts/0
{ "file_path": "langchainjs/examples/src/indexes/text_splitter_with_chunk_header.ts", "repo_id": "langchainjs", "token_count": 949 }
812
#!/usr/bin/env python # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unles...
accelerate/src/accelerate/test_utils/scripts/test_script.py/0
{ "file_path": "accelerate/src/accelerate/test_utils/scripts/test_script.py", "repo_id": "accelerate", "token_count": 11562 }
18
#!/usr/bin/env python2 # Licensed to the Apache Software Foundation (ASF) 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 # "L...
milvus/internal/core/build-support/run_clang_format.py/0
{ "file_path": "milvus/internal/core/build-support/run_clang_format.py", "repo_id": "milvus", "token_count": 2416 }
1,915
from llama_index.core.base.llms.types import ChatMessage, MessageRole from llama_index.core.chat_engine.simple import SimpleChatEngine from llama_index.core.service_context import ServiceContext def test_simple_chat_engine( mock_service_context: ServiceContext, ) -> None: engine = SimpleChatEngine.from_defaul...
llama_index/llama-index-core/tests/chat_engine/test_simple.py/0
{ "file_path": "llama_index/llama-index-core/tests/chat_engine/test_simple.py", "repo_id": "llama_index", "token_count": 517 }
1,308
# Training customization TRL is designed with modularity in mind so that users to be able to efficiently customize the training loop for their needs. Below are some examples on how you can apply and test different techniques. ## Train on multiple GPUs / nodes The trainers in TRL use 🤗 Accelerate to enable distribut...
trl/docs/source/customization.mdx/0
{ "file_path": "trl/docs/source/customization.mdx", "repo_id": "trl", "token_count": 2835 }
853
# rag-timescale-conversation This template is used for [conversational](https://python.langchain.com/docs/expression_language/cookbook/retrieval#conversational-retrieval-chain) [retrieval](https://python.langchain.com/docs/use_cases/question_answering/), which is one of the most popular LLM use-cases. It passes both...
langchain/templates/rag-timescale-conversation/README.md/0
{ "file_path": "langchain/templates/rag-timescale-conversation/README.md", "repo_id": "langchain", "token_count": 933 }
708
import time import random import pdb import threading import logging import json from multiprocessing import Pool, Process import pytest from utils.util_pymilvus import get_milvus, restart_server, gen_entities, gen_unique_str, default_nb from common.constants import default_fields, default_entities from common.common_t...
milvus/tests/python_client/testcases/stability/test_restart.py/0
{ "file_path": "milvus/tests/python_client/testcases/stability/test_restart.py", "repo_id": "milvus", "token_count": 6218 }
2,127
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-mongodb/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-mongodb/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,592
python_tests()
llama_index/llama-index-integrations/program/llama-index-program-guidance/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/program/llama-index-program-guidance/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,321
import os from typing import Any, Callable, Dict, Optional, Sequence import requests from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, ChatResponseGen, CompletionResponse, CompletionResponseGen, LLMMetadata, ) from llama_index.core.bridge.pydantic import Field, PrivateAt...
llama_index/llama-index-integrations/llms/llama-index-llms-llama-cpp/llama_index/llms/llama_cpp/base.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-llama-cpp/llama_index/llms/llama_cpp/base.py", "repo_id": "llama_index", "token_count": 4224 }
1,358
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
transformers/src/transformers/models/dpt/convert_dpt_swinv2_to_hf.py/0
{ "file_path": "transformers/src/transformers/models/dpt/convert_dpt_swinv2_to_hf.py", "repo_id": "transformers", "token_count": 6687 }
596
# These kubernetes manifests are UNDER ACTIVE DEVELOPMENT and are not yet ready for production use. # They will be used for the upcoming distributed version of chroma. They are not even ready # for testing yet. Please do not use them unless you are working on the distributed version of chroma.
chroma/k8s/WARNING.md/0
{ "file_path": "chroma/k8s/WARNING.md", "repo_id": "chroma", "token_count": 69 }
53
# Notion DB >[Notion](https://www.notion.so/) is a collaboration platform with modified Markdown support that integrates kanban > boards, tasks, wikis and databases. It is an all-in-one workspace for notetaking, knowledge and data management, > and project and task management. ## Installation and Setup All instruc...
langchain/docs/docs/integrations/providers/notion.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/notion.mdx", "repo_id": "langchain", "token_count": 221 }
147
from .autoencoder_asym_kl import AsymmetricAutoencoderKL from .autoencoder_kl import AutoencoderKL from .autoencoder_kl_temporal_decoder import AutoencoderKLTemporalDecoder from .autoencoder_tiny import AutoencoderTiny from .consistency_decoder_vae import ConsistencyDecoderVAE
diffusers/src/diffusers/models/autoencoders/__init__.py/0
{ "file_path": "diffusers/src/diffusers/models/autoencoders/__init__.py", "repo_id": "diffusers", "token_count": 99 }
212
{ "input_variables": ["foo"], "template": "This is a {foo} test.", "bad_var": 1 }
langchain/libs/core/tests/unit_tests/prompts/prompt_extra_args.json/0
{ "file_path": "langchain/libs/core/tests/unit_tests/prompts/prompt_extra_args.json", "repo_id": "langchain", "token_count": 36 }
428
import { HNSWLib } from "@langchain/community/vectorstores/hnswlib"; import { OpenAIEmbeddings } from "@langchain/openai"; import { TextLoader } from "langchain/document_loaders/fs/text"; // Create docs with a loader const loader = new TextLoader("src/document_loaders/example_data/example.txt"); const docs = await loa...
langchainjs/examples/src/indexes/vector_stores/hnswlib_fromdocs.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/hnswlib_fromdocs.ts", "repo_id": "langchainjs", "token_count": 167 }
875
from langchain_community.callbacks.labelstudio_callback import ( LabelStudioCallbackHandler, LabelStudioMode, get_default_label_configs, ) __all__ = ["LabelStudioMode", "get_default_label_configs", "LabelStudioCallbackHandler"]
langchain/libs/langchain/langchain/callbacks/labelstudio_callback.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/labelstudio_callback.py", "repo_id": "langchain", "token_count": 76 }
452
# Vectara >[Vectara](https://vectara.com/) is the trusted GenAI platform for developers. It provides a simple API to build GenAI applications > for semantic search or RAG (Retreieval augmented generation). **Vectara Overview:** - `Vectara` is developer-first API platform for building trusted GenAI applications. - To...
langchain/docs/docs/integrations/providers/vectara/index.mdx/0
{ "file_path": "langchain/docs/docs/integrations/providers/vectara/index.mdx", "repo_id": "langchain", "token_count": 1532 }
160
import "./globals.css"; import { Public_Sans } from "next/font/google"; import { Navbar } from "@/components/Navbar"; const publicSans = Public_Sans({ subsets: ["latin"] }); export default function RootLayout({ children, }: { children: React.ReactNode; }) { return ( <html lang="en"> <head> <t...
langchain-nextjs-template/app/layout.tsx/0
{ "file_path": "langchain-nextjs-template/app/layout.tsx", "repo_id": "langchain-nextjs-template", "token_count": 684 }
69
"""Minio file and directory reader. A loader that fetches a file or iterates through a directory on Minio. """ import tempfile from pathlib import Path from typing import Any, Callable, Dict, List, Optional, Union from llama_index.core.readers import SimpleDirectoryReader from llama_index.core.readers.base import B...
llama_index/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/minio_client/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/minio_client/base.py", "repo_id": "llama_index", "token_count": 2594 }
1,354
import { useCallback, useEffect, useReducer, useState } from "react"; import orderBy from "lodash/orderBy"; import { v4 as uuidv4 } from "uuid"; export interface Config { assistant_id: string; name: string; updated_at: string; config: { configurable?: { tools?: string[]; [key: string]: unknown;...
opengpts/frontend/src/hooks/useConfigList.ts/0
{ "file_path": "opengpts/frontend/src/hooks/useConfigList.ts", "repo_id": "opengpts", "token_count": 1489 }
1,999
import fs from "node:fs/promises"; import { rollup } from "rollup"; import { ExportsMapValue, PackageJSON, TreeShakingArgs } from "./types.js"; async function getPackageJson(): Promise<PackageJSON> { return JSON.parse(await fs.readFile("package.json", "utf-8")); } async function listEntrypoints() { const { export...
langchainjs/libs/langchain-scripts/src/check-tree-shaking.ts/0
{ "file_path": "langchainjs/libs/langchain-scripts/src/check-tree-shaking.ts", "repo_id": "langchainjs", "token_count": 1075 }
1,109
<jupyter_start><jupyter_text>Chat Prompts Customization If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-llms-openai !pip install llama-index<jupyter_output><empty_output><jupyter_text>Prompt SetupBelow, we take the default prompts and cust...
llama_index/docs/examples/customization/prompts/chat_prompts.ipynb/0
{ "file_path": "llama_index/docs/examples/customization/prompts/chat_prompts.ipynb", "repo_id": "llama_index", "token_count": 1313 }
1,046
# Consistency Training `train_cm_ct_unconditional.py` trains a consistency model (CM) from scratch following the consistency training (CT) algorithm introduced in [Consistency Models](https://arxiv.org/abs/2303.01469) and refined in [Improved Techniques for Training Consistency Models](https://arxiv.org/abs/2310.14189...
diffusers/examples/research_projects/consistency_training/README.md/0
{ "file_path": "diffusers/examples/research_projects/consistency_training/README.md", "repo_id": "diffusers", "token_count": 413 }
215
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.azure_translate import AzureTranslateToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in AzureTranslateToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-azure-translate/tests/test_tools_azure_translate.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-azure-translate/tests/test_tools_azure_translate.py", "repo_id": "llama_index", "token_count": 99 }
1,416
export { type SerializedPromptTemplate, type SerializedFewShotTemplate, type SerializedBasePromptTemplate, } from "@langchain/core/prompts";
langchainjs/langchain/src/prompts/serde.ts/0
{ "file_path": "langchainjs/langchain/src/prompts/serde.ts", "repo_id": "langchainjs", "token_count": 44 }
914
import type { readFile as ReadFileT } from "node:fs/promises"; import { Document } from "@langchain/core/documents"; import { getEnv } from "@langchain/core/utils/env"; import { BaseDocumentLoader } from "../base.js"; /** * Abstract class that extends the `BaseDocumentLoader` class. It * represents a document loader...
langchainjs/langchain/src/document_loaders/fs/buffer.ts/0
{ "file_path": "langchainjs/langchain/src/document_loaders/fs/buffer.ts", "repo_id": "langchainjs", "token_count": 875 }
901
<jupyter_start><jupyter_text>Connect to template<jupyter_code>from langserve.client import RemoteRunnable rag_app_pinecone = RemoteRunnable("http://localhost:8001/rag_pinecone_rerank") rag_app_pinecone.invoke("How does agent memory work?")<jupyter_output><empty_output>
langchain/templates/rag-pinecone-rerank/rag_pinecone_rerank.ipynb/0
{ "file_path": "langchain/templates/rag-pinecone-rerank/rag_pinecone_rerank.ipynb", "repo_id": "langchain", "token_count": 95 }
668
""" On one node, launch with `deepspeed --num_gpus N idefics_zero3_finetuning.py` by replacing N with the number of your GPUs For several nodes, using Slurm, a template script is provided at `examples/idefics/idefics_zero3_finetuning/slurm_script_idefics_zero3_finetuning_multinode.slurm` For more information, follow ...
notebooks/examples/idefics/idefics_zero3_finetuning/idefics_zero3_finetuning.py/0
{ "file_path": "notebooks/examples/idefics/idefics_zero3_finetuning/idefics_zero3_finetuning.py", "repo_id": "notebooks", "token_count": 1980 }
306
package syncmgr import ( "github.com/samber/lo" "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/internal/allocator" "github.com/milvus-io/milvus/internal/datanode/metacache" "github.com/milvus-io/milvus/internal/proto/datapb...
milvus/internal/datanode/syncmgr/options.go/0
{ "file_path": "milvus/internal/datanode/syncmgr/options.go", "repo_id": "milvus", "token_count": 1138 }
1,708
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/custom_tools.md/0
{ "file_path": "transformers/docs/source/en/custom_tools.md", "repo_id": "transformers", "token_count": 8661 }
496
package indexparamcheck import "fmt" // raftIVFChecker checks if a RAFT_IVF_Flat index can be built. type raftIVFFlatChecker struct { ivfBaseChecker } // CheckTrain checks if ivf-flat index can be built with the specific index parameters. func (c *raftIVFFlatChecker) CheckTrain(params map[string]string) error { if...
milvus/pkg/util/indexparamcheck/raft_ivf_flat_checker.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/raft_ivf_flat_checker.go", "repo_id": "milvus", "token_count": 217 }
1,907
<jupyter_start><jupyter_text>Replicate - Vicuna 13B Setup If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-llms-replicate !pip install llama-index<jupyter_output><empty_output><jupyter_text>Make sure you have the `REPLICATE_API_TOKEN` envi...
llama_index/docs/examples/llm/vicuna.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/vicuna.ipynb", "repo_id": "llama_index", "token_count": 1260 }
1,112
<jupyter_start><jupyter_text>Typesense> [Typesense](https://typesense.org) is an open-source, in-memory search engine, that you can either [self-host](https://typesense.org/docs/guide/install-typesenseoption-2-local-machine-self-hosting) or run on [Typesense Cloud](https://cloud.typesense.org/).>> Typesense focuses on ...
langchain/docs/docs/integrations/vectorstores/typesense.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/typesense.ipynb", "repo_id": "langchain", "token_count": 825 }
195