text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
""" Vision OutLOoker (VOLO) implementation Paper: `VOLO: Vision Outlooker for Visual Recognition` - https://arxiv.org/abs/2106.13112 Code adapted from official impl at https://github.com/sail-sg/volo, original copyright in comment below Modifications and additions for timm by / Copyright 2022, Ross Wightman """ # Co...
pytorch-image-models/timm/models/volo.py/0
{ "file_path": "pytorch-image-models/timm/models/volo.py", "repo_id": "pytorch-image-models", "token_count": 15802 }
384
use candle::{Result, Tensor}; /// The negative log likelihood loss. /// /// Arguments /// /// * [inp]: The input tensor of dimensions `N, C` where `N` is the batch size and `C` the number /// of categories. This is expected to contain log probabilities. /// * [target]: The ground truth labels as a tensor of u...
candle/candle-nn/src/loss.rs/0
{ "file_path": "candle/candle-nn/src/loss.rs", "repo_id": "candle", "token_count": 1040 }
63
<!--Copyright 2022 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/trajectory_transformer.md/0
{ "file_path": "transformers/docs/source/en/model_doc/trajectory_transformer.md", "repo_id": "transformers", "token_count": 776 }
471
--- hide_table_of_contents: true --- # Subtitles This example goes over how to load data from subtitle files. One document will be created for each subtitles file. ## Setup ```bash npm2yarn npm install srt-parser-2 ``` ## Usage ```typescript import { SRTLoader } from "langchain/document_loaders/fs/srt"; const lo...
langchainjs/docs/core_docs/docs/integrations/document_loaders/file_loaders/subtitles.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/document_loaders/file_loaders/subtitles.mdx", "repo_id": "langchainjs", "token_count": 171 }
703
use crate::utils::SysRegex; use serde::{Deserialize, Deserializer, Serialize}; use crate::tokenizer::{ pattern::Invert, PreTokenizedString, PreTokenizer, Result, SplitDelimiterBehavior, }; /// Represents the different patterns that `Split` can use #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, Eq)] pub...
tokenizers/tokenizers/src/pre_tokenizers/split.rs/0
{ "file_path": "tokenizers/tokenizers/src/pre_tokenizers/split.rs", "repo_id": "tokenizers", "token_count": 4038 }
461
import { BufferMemory } from "langchain/memory"; import { RedisChatMessageHistory } from "@langchain/community/stores/message/ioredis"; import { ChatOpenAI } from "@langchain/openai"; import { ConversationChain } from "langchain/chains"; const memory = new BufferMemory({ chatHistory: new RedisChatMessageHistory({ ...
langchainjs/examples/src/memory/redis.ts/0
{ "file_path": "langchainjs/examples/src/memory/redis.ts", "repo_id": "langchainjs", "token_count": 352 }
840
import os import pytest from langchain_core.messages import AIMessage, HumanMessage from langchain_community.chat_message_histories import TiDBChatMessageHistory try: CONNECTION_STRING = os.getenv("TEST_TiDB_CHAT_URL", "") if CONNECTION_STRING == "": raise OSError("TEST_TiDB_URL environment variable...
langchain/libs/community/tests/integration_tests/chat_message_histories/test_tidb.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/chat_message_histories/test_tidb.py", "repo_id": "langchain", "token_count": 1452 }
317
from llama_index.embeddings.nomic.base import NomicEmbedding __all__ = ["NomicEmbedding"]
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-nomic/llama_index/embeddings/nomic/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-nomic/llama_index/embeddings/nomic/__init__.py", "repo_id": "llama_index", "token_count": 34 }
1,321
# 🦜🍎️ LangChain Core [![Downloads](https://static.pepy.tech/badge/langchain_core/month)](https://pepy.tech/project/langchain_core) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) ## Quick Install ```bash pip install langchain-core ``` ## What is it? Lan...
langchain/libs/core/README.md/0
{ "file_path": "langchain/libs/core/README.md", "repo_id": "langchain", "token_count": 1348 }
388
# 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/kandinsky/pipeline_kandinsky_combined.py/0
{ "file_path": "diffusers/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_combined.py", "repo_id": "diffusers", "token_count": 16909 }
226
from typing import Callable, Union from langchain_core.documents import Document from langchain_community.docstore.base import Docstore class DocstoreFn(Docstore): """Langchain Docstore via arbitrary lookup function. This is useful when: * it's expensive to construct an InMemoryDocstore/dict * yo...
langchain/libs/community/langchain_community/docstore/arbitrary_fn.py/0
{ "file_path": "langchain/libs/community/langchain_community/docstore/arbitrary_fn.py", "repo_id": "langchain", "token_count": 422 }
239
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
transformers/src/transformers/quantizers/quantizer_gptq.py/0
{ "file_path": "transformers/src/transformers/quantizers/quantizer_gptq.py", "repo_id": "transformers", "token_count": 1447 }
689
import {check} from 'k6'; import http from 'k6/http'; import {Trend} from 'k6/metrics'; const host = __ENV.HOST || '127.0.0.1:3000'; const totalTime = new Trend('total_time', true); const validationTime = new Trend('validation_time', true); const queueTime = new Trend('queue_time', true); const inferenceTime = new Tr...
text-generation-inference/load_tests/starcoder_load.js/0
{ "file_path": "text-generation-inference/load_tests/starcoder_load.js", "repo_id": "text-generation-inference", "token_count": 835 }
372
#include <metal_stdlib> #include <metal_math> # using namespace metal; METAL_FUNC uint get_strided_index( uint idx, constant size_t &num_dims, constant size_t *dims, constant size_t *strides ) { uint strided_i = 0; for (uint d = 0; d < num_dims; d++) { uint dim_idx = num_dims - 1 - d; ...
candle/candle-metal-kernels/src/unary.metal/0
{ "file_path": "candle/candle-metal-kernels/src/unary.metal", "repo_id": "candle", "token_count": 1956 }
55
# The Deep Q-Network (DQN) [[deep-q-network]] This is the architecture of our Deep Q-Learning network: <img src="https://huggingface.co/datasets/huggingface-deep-rl-course/course-images/resolve/main/en/unit4/deep-q-network.jpg" alt="Deep Q Network"/> As input, we take a **stack of 4 frames** passed through the netwo...
deep-rl-class/units/en/unit3/deep-q-network.mdx/0
{ "file_path": "deep-rl-class/units/en/unit3/deep-q-network.mdx", "repo_id": "deep-rl-class", "token_count": 888 }
169
from threading import Thread from typing import Any, Callable, Generator, Optional, Sequence from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, ChatResponseAsyncGen, ChatResponseGen, CompletionResponse, CompletionResponseAsyncGen, CompletionResponseGen, LLMMetadat...
llama_index/llama-index-integrations/llms/llama-index-llms-langchain/llama_index/llms/langchain/base.py/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-langchain/llama_index/llms/langchain/base.py", "repo_id": "llama_index", "token_count": 3417 }
1,299
import random import logging # import math from locust import TaskSet, task from . import utils logger = logging.getLogger("milvus_benchmark.runners.locust_tasks") class Tasks(TaskSet): @task def query(self): """ search interface """ op = "query" # X = utils.generate_vectors(self.para...
milvus/tests/benchmark/milvus_benchmark/runners/locust_tasks.py/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/runners/locust_tasks.py", "repo_id": "milvus", "token_count": 1529 }
2,080
"""Tool for the SceneXplain API.""" from typing import Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.pydantic_v1 import BaseModel, Field from langchain_core.tools import BaseTool from langchain_community.utilities.scenexplain import SceneXplainAPIWrapper class SceneXpla...
langchain/libs/community/langchain_community/tools/scenexplain/tool.py/0
{ "file_path": "langchain/libs/community/langchain_community/tools/scenexplain/tool.py", "repo_id": "langchain", "token_count": 359 }
307
// 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/importutil/import_wrapper_test.go/0
{ "file_path": "milvus/internal/util/importutil/import_wrapper_test.go", "repo_id": "milvus", "token_count": 13832 }
1,899
<jupyter_start><jupyter_text>WhatsAppThis notebook shows how to use the WhatsApp chat loader. This class helps map exported WhatsApp conversations to LangChain chat messages.The process has three steps:1. Export the chat conversations to computer2. Create the `WhatsAppChatLoader` with the file path pointed to the json ...
langchain/docs/docs/integrations/chat_loaders/whatsapp.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/chat_loaders/whatsapp.ipynb", "repo_id": "langchain", "token_count": 1083 }
92
// 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/session/cluster.go/0
{ "file_path": "milvus/internal/querycoordv2/session/cluster.go", "repo_id": "milvus", "token_count": 3971 }
1,759
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
peft/docs/source/task_guides/ia3.md/0
{ "file_path": "peft/docs/source/task_guides/ia3.md", "repo_id": "peft", "token_count": 3197 }
296
import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict _TestCommandArgs = namedtuple( "_TestCommandArgs", [ "dataset", "name",...
datasets/tests/commands/test_test.py/0
{ "file_path": "datasets/tests/commands/test_test.py", "repo_id": "datasets", "token_count": 1511 }
144
import { BaseLanguageModel } from "@langchain/core/language_models/base"; import { RunnableConfig } from "@langchain/core/runnables"; import { Example, Run } from "langsmith"; import { EvaluationResult, RunEvaluator } from "langsmith/evaluation"; import { Criteria as CriteriaType } from "../evaluation/index.js"; import...
langchainjs/langchain/src/smith/config.ts/0
{ "file_path": "langchainjs/langchain/src/smith/config.ts", "repo_id": "langchainjs", "token_count": 3331 }
923
// Licensed to the LF AI & Data foundation under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may not use th...
milvus/internal/proxy/impl_test.go/0
{ "file_path": "milvus/internal/proxy/impl_test.go", "repo_id": "milvus", "token_count": 20257 }
1,738
from pathlib import Path from typing import Dict def find_and_replace(source: str, replacements: Dict[str, str]) -> str: rtn = source # replace keys in deterministic alphabetical order finds = sorted(replacements.keys()) for find in finds: replace = replacements[find] rtn = rtn.replac...
langchain/libs/cli/langchain_cli/utils/find_replace.py/0
{ "file_path": "langchain/libs/cli/langchain_cli/utils/find_replace.py", "repo_id": "langchain", "token_count": 331 }
202
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/issues/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-github/llama_index/readers/github/issues/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,375
<jupyter_start><jupyter_text>Textual-inversion fine-tuning for Stable Diffusion using d🧨ffusers This notebook shows how to "teach" Stable Diffusion a new concept via textual-inversion using 🤗 Hugging Face [🧨 Diffusers library](https://github.com/huggingface/diffusers). _By using just 3-5 images you can teach new con...
notebooks/diffusers/sd_textual_inversion_training.ipynb/0
{ "file_path": "notebooks/diffusers/sd_textual_inversion_training.ipynb", "repo_id": "notebooks", "token_count": 10904 }
290
# Milvus Code Review Guide All PRs are checked in automatically by the sre-robot, with the following conditions: 1. DCO check passed 2. All test passed and code coverage check passed, with a `ci-passed` label - Notes: If there is a `[skip e2e]` tag in the commit message, it skips running e2e tests automatically, ...
milvus/CODE_REVIEW.md/0
{ "file_path": "milvus/CODE_REVIEW.md", "repo_id": "milvus", "token_count": 857 }
1,618
export * from "./chat_models.js"; export * from "./llms.js"; export * from "./auth.js"; export * from "./connection.js"; export * from "./types.js"; export * from "./utils/stream.js"; export * from "./utils/common.js";
langchainjs/libs/langchain-google-common/src/index.ts/0
{ "file_path": "langchainjs/libs/langchain-google-common/src/index.ts", "repo_id": "langchainjs", "token_count": 78 }
1,015
# 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...
accelerate/manim_animations/big_model_inference/stage_4.py/0
{ "file_path": "accelerate/manim_animations/big_model_inference/stage_4.py", "repo_id": "accelerate", "token_count": 2919 }
8
<jupyter_start><jupyter_text>Returning Structured OutputThis notebook covers how to have an agent return a structured output.By default, most of the agents return a single string.It can often be useful to have an agent return something with more structure.A good example of this is an agent tasked with doing question-an...
langchain/docs/docs/modules/agents/how_to/agent_structured.ipynb/0
{ "file_path": "langchain/docs/docs/modules/agents/how_to/agent_structured.ipynb", "repo_id": "langchain", "token_count": 2324 }
188
python_sources()
llama_index/llama-index-core/llama_index/core/query_engine/flare/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_engine/flare/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,135
python_sources()
llama_index/llama-index-core/llama_index/core/query_engine/pandas/BUILD/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_engine/pandas/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,210
python_sources()
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-cohere/llama_index/embeddings/cohere/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-cohere/llama_index/embeddings/cohere/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,255
<!--Copyright 2024 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
diffusers/docs/source/en/using-diffusers/schedulers.md/0
{ "file_path": "diffusers/docs/source/en/using-diffusers/schedulers.md", "repo_id": "diffusers", "token_count": 3997 }
192
from langchain_community.utils.ernie_functions import ( FunctionDescription, ToolDescription, convert_pydantic_to_ernie_function, convert_pydantic_to_ernie_tool, ) __all__ = [ "FunctionDescription", "ToolDescription", "convert_pydantic_to_ernie_function", "convert_pydantic_to_ernie_tool...
langchain/libs/langchain/langchain/utils/ernie_functions.py/0
{ "file_path": "langchain/libs/langchain/langchain/utils/ernie_functions.py", "repo_id": "langchain", "token_count": 129 }
609
<jupyter_start><jupyter_text>WordPiece tokenizationAucun modèle en français utilise WordPiece. Nous utilisons ici CamemBERT utilise SentencePiece. Installez les bibliothèques 🤗 *Transformers* et 🤗 *Datasets* pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] corpus = [ "C'...
notebooks/course/fr/chapter6/section6.ipynb/0
{ "file_path": "notebooks/course/fr/chapter6/section6.ipynb", "repo_id": "notebooks", "token_count": 1867 }
299
import { OpenAI } from "@langchain/openai"; import { LLMChain } from "langchain/chains"; import { PromptTemplate } from "@langchain/core/prompts"; // Create a new LLMChain from a PromptTemplate and an LLM in streaming mode. const model = new OpenAI({ temperature: 0.9, streaming: true }); const prompt = PromptTemplate....
langchainjs/examples/src/chains/llm_chain_cancellation.ts/0
{ "file_path": "langchainjs/examples/src/chains/llm_chain_cancellation.ts", "repo_id": "langchainjs", "token_count": 317 }
800
# candle-resnet A candle implementation of inference using a pre-trained [ResNet](https://arxiv.org/abs/1512.03385). This uses a classification head trained on the ImageNet dataset and returns the probabilities for the top-5 classes. ## Running an example ``` $ cargo run --example resnet --release -- --image tiger.j...
candle/candle-examples/examples/resnet/README.md/0
{ "file_path": "candle/candle-examples/examples/resnet/README.md", "repo_id": "candle", "token_count": 204 }
45
mod health; /// Text Generation Inference Webserver mod infer; mod queue; pub mod server; mod validation; use infer::{Infer, InferError, InferStreamResponse}; use queue::{Entry, Queue}; use serde::{Deserialize, Serialize}; use tokio::sync::OwnedSemaphorePermit; use tokio_stream::wrappers::UnboundedReceiverStream; use ...
text-generation-inference/router/src/lib.rs/0
{ "file_path": "text-generation-inference/router/src/lib.rs", "repo_id": "text-generation-inference", "token_count": 10761 }
386
from langchain_community.llms.textgen import TextGen __all__ = ["TextGen"]
langchain/libs/langchain/langchain/llms/textgen.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/textgen.py", "repo_id": "langchain", "token_count": 25 }
516
# Text Generation Inference Text Generation Inference (TGI) is a toolkit for deploying and serving Large Language Models (LLMs). TGI enables high-performance text generation for the most popular open-source LLMs, including Llama, Falcon, StarCoder, BLOOM, GPT-NeoX, and T5. ![Text Generation Inference](https://hugging...
text-generation-inference/docs/source/index.md/0
{ "file_path": "text-generation-inference/docs/source/index.md", "repo_id": "text-generation-inference", "token_count": 544 }
390
python_tests( name="tests", )
llama_index/llama-index-experimental/tests/param_tuner/BUILD/0
{ "file_path": "llama_index/llama-index-experimental/tests/param_tuner/BUILD", "repo_id": "llama_index", "token_count": 15 }
1,333
<jupyter_start><jupyter_text>Custom Cohere Reranker This notebook provides a tutorial on building the Cohere Custom Re-ranker using LlamaIndex abstractions. Upon completion, you'll be able to create a Custom re-ranker and utilize it for enhanced data retrieval.**Important:** This notebook offers a guide for Cohere Cust...
llama_index/docs/examples/finetuning/rerankers/cohere_custom_reranker.ipynb/0
{ "file_path": "llama_index/docs/examples/finetuning/rerankers/cohere_custom_reranker.ipynb", "repo_id": "llama_index", "token_count": 5232 }
1,121
"""Unit test for Google Trends API Wrapper.""" import os from unittest.mock import patch from langchain_community.utilities.google_trends import GoogleTrendsAPIWrapper @patch("serpapi.SerpApiClient.get_json") def test_unexpected_response(mocked_serpapiclient): # type: ignore[no-untyped-def] os.environ["SERPAPI_...
langchain/libs/community/tests/integration_tests/utilities/test_google_trends.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/utilities/test_google_trends.py", "repo_id": "langchain", "token_count": 813 }
366
// 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/storage/TencentCloudCredentialsProvider.cpp/0
{ "file_path": "milvus/internal/core/src/storage/TencentCloudCredentialsProvider.cpp", "repo_id": "milvus", "token_count": 3250 }
1,667
import argparse import math import os import shlex import subprocess import uuid from distutils.util import strtobool import requests def parse_args(): # fmt: off parser = argparse.ArgumentParser() parser.add_argument("--command", type=str, default="", help="the command to run") parser.add_ar...
trl/benchmark/benchmark.py/0
{ "file_path": "trl/benchmark/benchmark.py", "repo_id": "trl", "token_count": 2824 }
769
# Milvus 2.x vs. 1.x: Cloud-native, distributed architecture, highly scalable, and more <table class="comparison"> <thead> <tr> <th>&nbsp;</th> <th>Milvus 1.x</th> <th>Milvus 2.x</th> </tr> <tr> <th>Architecture</th> <td>Shared storage</td> <td>Cloud native</td> </tr> </thead> <tbody> <tr> <th>Scala...
milvus/milvus20vs1x.md/0
{ "file_path": "milvus/milvus20vs1x.md", "repo_id": "milvus", "token_count": 1713 }
1,878
import { type ClientOptions } from "openai"; import { type BaseLLMParams } from "@langchain/core/language_models/llms"; import { OpenAI } from "../llms.js"; import type { OpenAIInput, AzureOpenAIInput, LegacyOpenAIInput, } from "../types.js"; export class AzureOpenAI extends OpenAI { get lc_aliases(): Record<s...
langchainjs/libs/langchain-openai/src/azure/llms.ts/0
{ "file_path": "langchainjs/libs/langchain-openai/src/azure/llms.ts", "repo_id": "langchainjs", "token_count": 809 }
1,038
"""Loads data from OneDrive""" from __future__ import annotations import logging from typing import TYPE_CHECKING, Iterator, List, Optional, Sequence, Union from langchain_core.documents import Document from langchain_core.pydantic_v1 import Field from langchain_community.document_loaders.base_o365 import ( O365...
langchain/libs/community/langchain_community/document_loaders/onedrive.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/onedrive.py", "repo_id": "langchain", "token_count": 1369 }
242
# Yelp Tool This tool connects to Yelp and allows the Agent to search for business and fetch the reviews. ## Usage This tool has more extensive example usage documented in a Jupyter notebook [here](https://github.com/emptycrown/llama-hub/tree/main/llama_hub/tools/notebooks/yelp.ipynb) Here's an example usage of the...
llama_index/llama-index-integrations/tools/llama-index-tools-yelp/README.md/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-yelp/README.md", "repo_id": "llama_index", "token_count": 292 }
1,642
"""Test MosaicML API wrapper.""" import re import pytest from langchain_community.llms.mosaicml import PROMPT_FOR_GENERATION_FORMAT, MosaicML def test_mosaicml_llm_call() -> None: """Test valid call to MosaicML.""" llm = MosaicML(model_kwargs={}) output = llm("Say foo:") assert isinstance(output, st...
langchain/libs/community/tests/integration_tests/llms/test_mosaicml.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_mosaicml.py", "repo_id": "langchain", "token_count": 1070 }
339
# 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/upernet/test_modeling_upernet.py/0
{ "file_path": "transformers/tests/models/upernet/test_modeling_upernet.py", "repo_id": "transformers", "token_count": 4945 }
775
poetry_requirements( name="poetry", )
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-ollama/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-ollama/BUILD", "repo_id": "llama_index", "token_count": 18 }
1,370
"""**Prompt** is the input to the model. Prompt is often constructed from multiple components. Prompt classes and functions make constructing and working with prompts easy. **Class hierarchy:** .. code-block:: BasePromptTemplate --> PipelinePromptTemplate StringPromptTemplate --> Pro...
langchain/libs/langchain/langchain/prompts/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/prompts/__init__.py", "repo_id": "langchain", "token_count": 1126 }
535
# 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/efficientnet/convert_efficientnet_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/efficientnet/convert_efficientnet_to_pytorch.py", "repo_id": "transformers", "token_count": 5603 }
639
<jupyter_start><jupyter_text>BigQuery Vector Search> [**BigQuery Vector Search**](https://cloud.google.com/bigquery/docs/vector-search-intro) lets you use GoogleSQL to do semantic search, using vector indexes for fast approximate results, or using brute force for exact results.This tutorial illustrates how to work with...
langchain/docs/docs/integrations/vectorstores/bigquery_vector_search.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/vectorstores/bigquery_vector_search.ipynb", "repo_id": "langchain", "token_count": 1562 }
174
poetry_requirements( name="poetry", ) python_requirements( name="reqs", )
llama_index/llama-index-integrations/readers/llama-index-readers-zendesk/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-zendesk/BUILD", "repo_id": "llama_index", "token_count": 36 }
1,478
from tokenizers import Tokenizer from tokenizers.models import BPE from tokenizers.pre_tokenizers import Whitespace from tokenizers.trainers import BpeTrainer from ..utils import data_dir, doc_wiki_tokenizer disable_printing = True original_print = print def print(*args, **kwargs): if not disable_printing: ...
tokenizers/bindings/python/tests/documentation/test_quicktour.py/0
{ "file_path": "tokenizers/bindings/python/tests/documentation/test_quicktour.py", "repo_id": "tokenizers", "token_count": 3324 }
453
<!--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/camembert.md/0
{ "file_path": "transformers/docs/source/en/model_doc/camembert.md", "repo_id": "transformers", "token_count": 1309 }
440
--- hide_table_of_contents: true --- import CodeBlock from "@theme/CodeBlock"; # Web Browser Tool The Webbrowser Tool gives your agent the ability to visit a website and extract information. It is described to the agent as ``` useful for when you need to find something on or summarize a webpage. input should be a c...
langchainjs/docs/core_docs/docs/integrations/tools/webbrowser.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/integrations/tools/webbrowser.mdx", "repo_id": "langchainjs", "token_count": 371 }
740
label: "How to" position: 4
langchainjs/docs/core_docs/docs/expression_language/how_to/_category_.yml/0
{ "file_path": "langchainjs/docs/core_docs/docs/expression_language/how_to/_category_.yml", "repo_id": "langchainjs", "token_count": 11 }
717
import { expect, test } from "@jest/globals"; import chroma from "./initClient"; import { IncludeEnum } from "../src/types"; import { EMBEDDINGS, IDS, METADATAS, DOCUMENTS } from "./data"; import { IEmbeddingFunction } from "../src/embeddings/IEmbeddingFunction"; export class TestEmbeddingFunction implements IEmbeddi...
chroma/clients/js/test/query.collection.test.ts/0
{ "file_path": "chroma/clients/js/test/query.collection.test.ts", "repo_id": "chroma", "token_count": 2058 }
32
// 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/rootcoord/import_manager_test.go/0
{ "file_path": "milvus/internal/rootcoord/import_manager_test.go", "repo_id": "milvus", "token_count": 15315 }
1,920
// 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/metastore/kv/binlog/binlog_test.go/0
{ "file_path": "milvus/internal/metastore/kv/binlog/binlog_test.go", "repo_id": "milvus", "token_count": 3538 }
1,825
# LlamaIndex Embeddings Integration: Google
llama_index/llama-index-integrations/embeddings/llama-index-embeddings-google/README.md/0
{ "file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-google/README.md", "repo_id": "llama_index", "token_count": 11 }
1,258
import { FaissStore } from "@langchain/community/vectorstores/faiss"; 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 lo...
langchainjs/examples/src/indexes/vector_stores/faiss_fromdocs.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/faiss_fromdocs.ts", "repo_id": "langchainjs", "token_count": 172 }
874
from langchain_community.callbacks.comet_ml_callback import ( CometCallbackHandler, ) __all__ = [ "CometCallbackHandler", ]
langchain/libs/langchain/langchain/callbacks/comet_ml_callback.py/0
{ "file_path": "langchain/libs/langchain/langchain/callbacks/comet_ml_callback.py", "repo_id": "langchain", "token_count": 47 }
456
""" RMSProp modified to behave like Tensorflow impl Originally cut & paste from PyTorch RMSProp https://github.com/pytorch/pytorch/blob/063946d2b3f3f1e953a2a3b54e0b34f1393de295/torch/optim/rmsprop.py Licensed under BSD-Clause 3 (ish), https://github.com/pytorch/pytorch/blob/master/LICENSE Modifications Copyright 2021...
pytorch-image-models/timm/optim/rmsprop_tf.py/0
{ "file_path": "pytorch-image-models/timm/optim/rmsprop_tf.py", "repo_id": "pytorch-image-models", "token_count": 2901 }
394
python_sources() python_tests( name="tests", )
llama_index/llama-index-core/tests/storage/index_store/BUILD/0
{ "file_path": "llama_index/llama-index-core/tests/storage/index_store/BUILD", "repo_id": "llama_index", "token_count": 22 }
1,215
from __future__ import print_function import os from kubernetes import client, config from kubernetes.client.rest import ApiException from utils.util_log import test_log as log from common.common_type import in_cluster_env _GROUP = 'milvus.io' _VERSION = 'v1alpha1' _NAMESPACE = "default" class CustomResourceOperat...
milvus/tests/python_client/common/cus_resource_opts.py/0
{ "file_path": "milvus/tests/python_client/common/cus_resource_opts.py", "repo_id": "milvus", "token_count": 2424 }
2,177
import pathlib from langchain_community.chat_loaders import slack, utils def test_slack_chat_loader() -> None: chat_path = pathlib.Path(__file__).parents[2] / "examples" / "slack_export.zip" loader = slack.SlackChatLoader(str(chat_path)) chat_sessions = list( utils.map_ai_messages(loader.lazy_lo...
langchain/libs/community/tests/unit_tests/chat_loaders/test_slack.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/chat_loaders/test_slack.py", "repo_id": "langchain", "token_count": 225 }
366
from typing import List, Optional, Sequence from llama_index.core.base.base_query_engine import BaseQueryEngine from llama_index.core.base.response.schema import RESPONSE_TYPE from llama_index.core.callbacks.base import CallbackManager from llama_index.core.indices.query.query_transform.base import BaseQueryTransform ...
llama_index/llama-index-core/llama_index/core/query_engine/transform_query_engine.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_engine/transform_query_engine.py", "repo_id": "llama_index", "token_count": 1381 }
1,197
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, }
langsmith-cookbook/feedback-examples/nextjs/postcss.config.js/0
{ "file_path": "langsmith-cookbook/feedback-examples/nextjs/postcss.config.js", "repo_id": "langsmith-cookbook", "token_count": 38 }
1,056
# coding=utf-8 # Copyright 2024 HuggingFace Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ag...
diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py/0
{ "file_path": "diffusers/tests/pipelines/stable_diffusion_2/test_stable_diffusion_latent_upscale.py", "repo_id": "diffusers", "token_count": 4989 }
290
<!--- 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 ...
transformers/examples/tensorflow/contrastive-image-text/README.md/0
{ "file_path": "transformers/examples/tensorflow/contrastive-image-text/README.md", "repo_id": "transformers", "token_count": 1054 }
609
# LlamaIndex Llms Integration: Vertex
llama_index/llama-index-integrations/llms/llama-index-llms-vertex/README.md/0
{ "file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-vertex/README.md", "repo_id": "llama_index", "token_count": 11 }
1,304
{ "name": "test-exports-cf", "version": "0.0.0", "workspaces": [ "libs/*" ], "devDependencies": { "@cloudflare/workers-types": "^4.20230321.0" }, "dependencies": { "@langchain/anthropic": "workspace:*", "@langchain/community": "workspace:*", "@langchain/core": "workspace:*", "@lang...
langchainjs/environment_tests/test-exports-cf/package.json/0
{ "file_path": "langchainjs/environment_tests/test-exports-cf/package.json", "repo_id": "langchainjs", "token_count": 328 }
830
# 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/decision_transformer/test_modeling_decision_transformer.py/0
{ "file_path": "transformers/tests/models/decision_transformer/test_modeling_decision_transformer.py", "repo_id": "transformers", "token_count": 4241 }
812
<!--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/pt/pipeline_tutorial.md/0
{ "file_path": "transformers/docs/source/pt/pipeline_tutorial.md", "repo_id": "transformers", "token_count": 2374 }
503
python_sources()
llama_index/llama-index-integrations/readers/llama-index-readers-txtai/llama_index/readers/txtai/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-txtai/llama_index/readers/txtai/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,563
"""Test Bookend AI embeddings.""" from langchain_community.embeddings.bookend import BookendEmbeddings def test_bookend_embedding_documents() -> None: """Test Bookend AI embeddings for documents.""" documents = ["foo bar", "bar foo"] embedding = BookendEmbeddings( domain="<bookend_domain>", ...
langchain/libs/community/tests/integration_tests/embeddings/test_bookend.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/embeddings/test_bookend.py", "repo_id": "langchain", "token_count": 348 }
360
from ._registry import * import warnings warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.models", DeprecationWarning)
pytorch-image-models/timm/models/registry.py/0
{ "file_path": "pytorch-image-models/timm/models/registry.py", "repo_id": "pytorch-image-models", "token_count": 43 }
388
"""Module for parsing text files..""" from typing import Iterator from langchain_core.documents import Document from langchain_community.document_loaders.base import BaseBlobParser from langchain_community.document_loaders.blob_loaders import Blob class TextParser(BaseBlobParser): """Parser for text blobs.""" ...
langchain/libs/community/langchain_community/document_loaders/parsers/txt.py/0
{ "file_path": "langchain/libs/community/langchain_community/document_loaders/parsers/txt.py", "repo_id": "langchain", "token_count": 159 }
265
package indexparamcheck import ( "fmt" "strconv" ) // ivfPQChecker checks if a IVF_PQ index can be built. type ivfPQChecker struct { ivfBaseChecker } // CheckTrain checks if ivf-pq index can be built with the specific index parameters. func (c *ivfPQChecker) CheckTrain(params map[string]string) error { if err :=...
milvus/pkg/util/indexparamcheck/ivf_pq_checker.go/0
{ "file_path": "milvus/pkg/util/indexparamcheck/ivf_pq_checker.go", "repo_id": "milvus", "token_count": 584 }
1,831
import { OpenAI } from "@langchain/openai"; import { StructuredOutputParser, RegexParser, CombiningOutputParser, } from "langchain/output_parsers"; import { PromptTemplate } from "@langchain/core/prompts"; const answerParser = StructuredOutputParser.fromNamesAndDescriptions({ answer: "answer to the user's ques...
langchainjs/examples/src/prompts/combining_parser.ts/0
{ "file_path": "langchainjs/examples/src/prompts/combining_parser.ts", "repo_id": "langchainjs", "token_count": 773 }
877
"""Pinecone reader.""" from typing import Any, Dict, List, Optional from llama_index.legacy.readers.base import BaseReader from llama_index.legacy.schema import Document class PineconeReader(BaseReader): """Pinecone reader. Args: api_key (str): Pinecone API key. environment (str): Pinecone ...
llama_index/llama-index-legacy/llama_index/legacy/readers/pinecone.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/pinecone.py", "repo_id": "llama_index", "token_count": 788 }
1,533
import candle import torch # convert from candle tensor to torch tensor t = candle.randn((3, 512, 512)) torch_tensor = t.to_torch() print(torch_tensor) print(type(torch_tensor)) # convert from torch tensor to candle tensor t = torch.randn((3, 512, 512)) candle_tensor = candle.Tensor(t) print(candle_tensor) print(type...
candle/candle-pyo3/test_pytorch.py/0
{ "file_path": "candle/candle-pyo3/test_pytorch.py", "repo_id": "candle", "token_count": 126 }
75
{ "openapi": "3.1.0", "info": { "title": "WolframAlpha", "version": "v1.7" }, "servers": [ { "url": "https://www.wolframalpha.com", "description": "The WolframAlpha server" } ], "paths": { "/api/v1/spoken.jsp": { "get": { "operationI...
langchain/libs/langchain/tests/unit_tests/examples/test_specs/wolframcloud/apispec.json/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/examples/test_specs/wolframcloud/apispec.json", "repo_id": "langchain", "token_count": 4747 }
640
# 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...
trl/trl/trainer/reward_trainer.py/0
{ "file_path": "trl/trl/trainer/reward_trainer.py", "repo_id": "trl", "token_count": 5943 }
782
<jupyter_start><jupyter_text>Hugging Face LLMsThere are many ways to interface with LLMs from [Hugging Face](https://huggingface.co/).Hugging Face itself provides several Python packages to enable access,which LlamaIndex wraps into `LLM` entities:- The [`transformers`](https://github.com/huggingface/transformers) packa...
llama_index/docs/examples/llm/huggingface.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/huggingface.ipynb", "repo_id": "llama_index", "token_count": 1154 }
1,143
"""Azure OpenAI embeddings wrapper.""" from __future__ import annotations import os import warnings from typing import Callable, Dict, Optional, Union from langchain_core._api.deprecation import deprecated from langchain_core.pydantic_v1 import Field, root_validator from langchain_core.utils import get_from_dict_or_e...
langchain/libs/community/langchain_community/embeddings/azure_openai.py/0
{ "file_path": "langchain/libs/community/langchain_community/embeddings/azure_openai.py", "repo_id": "langchain", "token_count": 3483 }
255
# coding=utf-8 # Copyright 2019-present, Facebook, Inc 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 # # Un...
transformers/src/transformers/models/xlm/modeling_xlm.py/0
{ "file_path": "transformers/src/transformers/models/xlm/modeling_xlm.py", "repo_id": "transformers", "token_count": 24030 }
772
import pytest @pytest.fixture(scope="module") def mt0_base_handle(launcher): with launcher("bigscience/mt0-base") as handle: yield handle @pytest.fixture(scope="module") async def mt0_base(mt0_base_handle): await mt0_base_handle.health(300) return mt0_base_handle.client @pytest.mark.asyncio as...
text-generation-inference/integration-tests/models/test_mt0_base.py/0
{ "file_path": "text-generation-inference/integration-tests/models/test_mt0_base.py", "repo_id": "text-generation-inference", "token_count": 713 }
428
[tool.poetry] name = "sql-llamacpp" version = "0.1.0" description = "Private QA with a SQL database using natural language and a local LLM via llama.cpp" authors = [ "Lance Martin <lance@langchain.dev>", ] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" llama-cpp-python =...
langchain/templates/sql-llamacpp/pyproject.toml/0
{ "file_path": "langchain/templates/sql-llamacpp/pyproject.toml", "repo_id": "langchain", "token_count": 280 }
708
# coding=utf-8 # Copyright 2020-present the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
transformers/src/transformers/trainer_utils.py/0
{ "file_path": "transformers/src/transformers/trainer_utils.py", "repo_id": "transformers", "token_count": 11573 }
688
import { expect, test } from "@jest/globals"; import { OpenAIEmbeddings } from "@langchain/openai"; import { VercelPostgres } from "../vercel_postgres.js"; let vercelPostgresStore: VercelPostgres; const config = { tableName: "testvercelvectorstorelangchain2", columns: { idColumnName: "id", vectorColumnNam...
langchainjs/libs/langchain-community/src/vectorstores/tests/vercel_postgres.int.test.ts/0
{ "file_path": "langchainjs/libs/langchain-community/src/vectorstores/tests/vercel_postgres.int.test.ts", "repo_id": "langchainjs", "token_count": 1233 }
975
<jupyter_start><jupyter_text>Tokenisation *Byte-Pair Encoding* Installez les bibliothèques 🤗 *Transformers* et 🤗 *Datasets* pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] corpus = [ "C'est le cours d'Hugging Face.", "Ce chapitre traite de la tokenisation.", "Ce...
notebooks/course/fr/chapter6/section5.ipynb/0
{ "file_path": "notebooks/course/fr/chapter6/section5.ipynb", "repo_id": "notebooks", "token_count": 1572 }
301
/****************************************************************************** * Copyright (c) 2023, Tri Dao. ******************************************************************************/ #pragma once #include <cuda.h> #include <vector> constexpr int TOTAL_DIM = 0; constexpr int H_DIM = 1; constexpr int D_DIM =...
candle/candle-flash-attn/kernels/flash.h/0
{ "file_path": "candle/candle-flash-attn/kernels/flash.h", "repo_id": "candle", "token_count": 2033 }
56