text stringlengths 3 1.68M | id stringlengths 13 169 | metadata dict | __index_level_0__ int64 0 2.21k |
|---|---|---|---|
# Copyright 2022 The Music Spectrogram Diffusion Authors.
# 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... | diffusers/src/diffusers/pipelines/deprecated/spectrogram_diffusion/midi_utils.py/0 | {
"file_path": "diffusers/src/diffusers/pipelines/deprecated/spectrogram_diffusion/midi_utils.py",
"repo_id": "diffusers",
"token_count": 10185
} | 248 |
python_sources()
| llama_index/llama-index-core/llama_index/core/indices/vector_store/retrievers/auto_retriever/BUILD/0 | {
"file_path": "llama_index/llama-index-core/llama_index/core/indices/vector_store/retrievers/auto_retriever/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,270 |
"""Init file."""
from llama_index.legacy.core.query_pipeline.components import (
ArgPackComponent,
FnComponent,
InputComponent,
KwargPackComponent,
)
from llama_index.legacy.core.query_pipeline.query_component import (
CustomQueryComponent,
Link,
QueryComponent,
)
from llama_index.legacy.qu... | llama_index/llama-index-legacy/llama_index/legacy/query_pipeline/__init__.py/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/query_pipeline/__init__.py",
"repo_id": "llama_index",
"token_count": 402
} | 1,756 |
# openai-functions-agent
This template creates an agent that uses OpenAI function calling to communicate its decisions on what actions to take.
This example creates an agent that can optionally look up information on the internet using Tavily's search engine.
## Environment Setup
The following environment variabl... | langchain/templates/openai-functions-agent/README.md/0 | {
"file_path": "langchain/templates/openai-functions-agent/README.md",
"repo_id": "langchain",
"token_count": 666
} | 719 |
import os
from typing import BinaryIO, Optional, Union
import numpy as np
import pyarrow.parquet as pq
from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config
from ..features.features import FeatureType, _visit
from ..formatting import query_table
from ..packaged_modules import _PACKAGED_DATASETS_MO... | datasets/src/datasets/io/parquet.py/0 | {
"file_path": "datasets/src/datasets/io/parquet.py",
"repo_id": "datasets",
"token_count": 2566
} | 153 |
# Logical Fallacy chain
This example shows how to remove logical fallacies from model output.
## Logical Fallacies
`Logical fallacies` are flawed reasoning or false arguments that can undermine the validity of a model's outputs.
Examples include circular reasoning, false
dichotomies, ad hominem attacks, etc. Mach... | langchain/docs/docs/guides/safety/logical_fallacy_chain.mdx/0 | {
"file_path": "langchain/docs/docs/guides/safety/logical_fallacy_chain.mdx",
"repo_id": "langchain",
"token_count": 882
} | 91 |
import { Redis } from "ioredis";
import { test, expect } from "@jest/globals";
import { OpenAI, ChatOpenAI } from "@langchain/openai";
import { RedisCache } from "../ioredis.js";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let client: any;
describe("Test RedisCache", () => {
beforeAll(async () =... | langchainjs/libs/langchain-community/src/caches/tests/ioredis.int.test.ts/0 | {
"file_path": "langchainjs/libs/langchain-community/src/caches/tests/ioredis.int.test.ts",
"repo_id": "langchainjs",
"token_count": 416
} | 1,015 |
"""Test OCI Data Science Model Deployment Endpoint."""
import pytest
import responses
from pytest_mock import MockerFixture
from langchain_community.llms import OCIModelDeploymentTGI, OCIModelDeploymentVLLM
@pytest.mark.requires("ads")
@responses.activate
def test_call_vllm(mocker: MockerFixture) -> None:
"""Tes... | langchain/libs/community/tests/unit_tests/llms/test_oci_model_deployment_endpoint.py/0 | {
"file_path": "langchain/libs/community/tests/unit_tests/llms/test_oci_model_deployment_endpoint.py",
"repo_id": "langchain",
"token_count": 562
} | 378 |
# 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/src/transformers/models/glpn/image_processing_glpn.py/0 | {
"file_path": "transformers/src/transformers/models/glpn/image_processing_glpn.py",
"repo_id": "transformers",
"token_count": 4257
} | 639 |
import { FakeListLLM } from "langchain/llms/fake";
/**
* The FakeListLLM can be used to simulate ordered predefined responses.
*/
const llm = new FakeListLLM({
responses: ["I'll callback later.", "You 'console' them!"],
});
const firstResponse = await llm.call("You want to hear a JavasSript joke?");
const second... | langchainjs/examples/src/models/llm/fake.ts/0 | {
"file_path": "langchainjs/examples/src/models/llm/fake.ts",
"repo_id": "langchainjs",
"token_count": 398
} | 902 |
# coding=utf-8
# Copyright 2023 Meta AI and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | transformers/src/transformers/models/vitdet/modeling_vitdet.py/0 | {
"file_path": "transformers/src/transformers/models/vitdet/modeling_vitdet.py",
"repo_id": "transformers",
"token_count": 14730
} | 671 |
from langchain_community.agent_toolkits.jira.toolkit import JiraToolkit
__all__ = ["JiraToolkit"]
| langchain/libs/langchain/langchain/agents/agent_toolkits/jira/toolkit.py/0 | {
"file_path": "langchain/libs/langchain/langchain/agents/agent_toolkits/jira/toolkit.py",
"repo_id": "langchain",
"token_count": 35
} | 434 |
import importlib.util
import os
import tempfile
from pathlib import Path
import pytest
from llama_index.legacy.readers.file.html_reader import HTMLTagReader
@pytest.fixture()
def html_str() -> str:
return """
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="wi... | llama_index/llama-index-legacy/tests/readers/test_html_reader.py/0 | {
"file_path": "llama_index/llama-index-legacy/tests/readers/test_html_reader.py",
"repo_id": "llama_index",
"token_count": 945
} | 1,815 |
from langchain_community.vectorstores.clarifai import Clarifai
__all__ = ["Clarifai"]
| langchain/libs/langchain/langchain/vectorstores/clarifai.py/0 | {
"file_path": "langchain/libs/langchain/langchain/vectorstores/clarifai.py",
"repo_id": "langchain",
"token_count": 29
} | 582 |
#include <metal_stdlib>
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;
strided_i += (idx % dims[dim_idx]) * str... | candle/candle-metal-kernels/src/cast.metal/0 | {
"file_path": "candle/candle-metal-kernels/src/cast.metal",
"repo_id": "candle",
"token_count": 1523
} | 58 |
<jupyter_start><jupyter_text>Chunk + Document Hybrid Retrieval with Long-Context Embeddings (Together.ai) This notebook shows how to use long-context together.ai embedding models for advanced RAG. We index each document by running the embedding model over the entire document text, as well as embedding each chunk. We th... | llama_index/docs/examples/retrievers/multi_doc_together_hybrid.ipynb/0 | {
"file_path": "llama_index/docs/examples/retrievers/multi_doc_together_hybrid.ipynb",
"repo_id": "llama_index",
"token_count": 4382
} | 1,211 |
#!/usr/bin/env python
# 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... | transformers/examples/legacy/seq2seq/run_eval_search.py/0 | {
"file_path": "transformers/examples/legacy/seq2seq/run_eval_search.py",
"repo_id": "transformers",
"token_count": 2316
} | 573 |
# coding=utf-8
# 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 requir... | transformers/tests/models/bert_japanese/test_tokenization_bert_japanese.py/0 | {
"file_path": "transformers/tests/models/bert_japanese/test_tokenization_bert_japanese.py",
"repo_id": "transformers",
"token_count": 10414
} | 785 |
python_sources()
| llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-typeform/llama_index/readers/airbyte_typeform/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-airbyte-typeform/llama_index/readers/airbyte_typeform/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,371 |
python_sources()
| llama_index/llama-index-integrations/tools/llama-index-tools-google/llama_index/tools/google/gmail/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-google/llama_index/tools/google/gmail/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,513 |
#!/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/commands/accelerate_cli.py/0 | {
"file_path": "accelerate/src/accelerate/commands/accelerate_cli.py",
"repo_id": "accelerate",
"token_count": 551
} | 7 |
python_sources()
| llama_index/llama-index-integrations/embeddings/llama-index-embeddings-openai/llama_index/embeddings/openai/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-openai/llama_index/embeddings/openai/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,194 |
python_sources()
| llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/llama_index/llms/sagemaker_endpoint/BUILD/0 | {
"file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-sagemaker-endpoint/llama_index/llms/sagemaker_endpoint/BUILD",
"repo_id": "llama_index",
"token_count": 6
} | 1,302 |
from candle import Tensor
from candle import rand
import pytest
def test_absolute_shapes_are_valid():
a = rand((10, 20))
assert a.shape == (10, 20)
b = rand(10, 20)
assert b.shape == (10, 20)
pytest.raises(OverflowError, lambda: rand((10, 20, -1)))
pytest.raises(OverflowError, lambda: rand(-1... | candle/candle-pyo3/tests/native/test_shape.py/0 | {
"file_path": "candle/candle-pyo3/tests/native/test_shape.py",
"repo_id": "candle",
"token_count": 385
} | 65 |
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | transformers/src/transformers/models/efficientformer/__init__.py/0 | {
"file_path": "transformers/src/transformers/models/efficientformer/__init__.py",
"repo_id": "transformers",
"token_count": 1330
} | 638 |
# coding=utf-8
# Copyright 2021 Google Research and The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICE... | transformers/src/transformers/models/big_bird/modeling_big_bird.py/0 | {
"file_path": "transformers/src/transformers/models/big_bird/modeling_big_bird.py",
"repo_id": "transformers",
"token_count": 65081
} | 573 |
// 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/cache/local_cache.go/0 | {
"file_path": "milvus/pkg/util/cache/local_cache.go",
"repo_id": "milvus",
"token_count": 5920
} | 1,927 |
#
# Copyright 2024 The HuggingFace Inc. team.
# SPDX-FileCopyrightText: Copyright (c) 1993-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... | diffusers/examples/community/stable_diffusion_tensorrt_img2img.py/0 | {
"file_path": "diffusers/examples/community/stable_diffusion_tensorrt_img2img.py",
"repo_id": "diffusers",
"token_count": 19790
} | 216 |
from llama_index.packs.snowflake_query_engine.base import SnowflakeQueryEnginePack
__all__ = ["SnowflakeQueryEnginePack"]
| llama_index/llama-index-packs/llama-index-packs-snowflake-query-engine/llama_index/packs/snowflake_query_engine/__init__.py/0 | {
"file_path": "llama_index/llama-index-packs/llama-index-packs-snowflake-query-engine/llama_index/packs/snowflake_query_engine/__init__.py",
"repo_id": "llama_index",
"token_count": 37
} | 1,606 |
package grpccoordinator
import (
"context"
"github.com/chroma/chroma-coordinator/internal/common"
"github.com/chroma/chroma-coordinator/internal/model"
"github.com/chroma/chroma-coordinator/internal/proto/coordinatorpb"
)
func (s *Server) CreateDatabase(ctx context.Context, req *coordinatorpb.CreateDatabaseReque... | chroma/go/coordinator/internal/grpccoordinator/tenant_database_service.go/0 | {
"file_path": "chroma/go/coordinator/internal/grpccoordinator/tenant_database_service.go",
"repo_id": "chroma",
"token_count": 1005
} | 46 |
import {
BaseChatMemory,
BaseChatMemoryInput,
} from "@langchain/community/memory/chat_memory";
import {
InputValues,
MemoryVariables,
BaseMemory,
OutputValues,
} from "@langchain/core/memory";
/**
* Interface that defines the shape of the input object that the
* CombinedMemory constructor accepts. It ex... | langchainjs/langchain/src/memory/combined_memory.ts/0 | {
"file_path": "langchainjs/langchain/src/memory/combined_memory.ts",
"repo_id": "langchainjs",
"token_count": 1351
} | 948 |
"""Init file."""
| llama_index/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/minio_client/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-minio/llama_index/readers/minio/minio_client/__init__.py",
"repo_id": "llama_index",
"token_count": 6
} | 1,411 |
from __future__ import annotations
from typing import Any, Dict
def merge_dicts(left: Dict[str, Any], right: Dict[str, Any]) -> Dict[str, Any]:
"""Merge two dicts, handling specific scenarios where a key exists in both
dictionaries but has a value of None in 'left'. In such cases, the method uses the
val... | langchain/libs/core/langchain_core/utils/_merge.py/0 | {
"file_path": "langchain/libs/core/langchain_core/utils/_merge.py",
"repo_id": "langchain",
"token_count": 712
} | 422 |
# coding=utf-8
# Copyright 2022 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/src/transformers/models/conditional_detr/convert_conditional_detr_original_pytorch_checkpoint_to_pytorch.py/0 | {
"file_path": "transformers/src/transformers/models/conditional_detr/convert_conditional_detr_original_pytorch_checkpoint_to_pytorch.py",
"repo_id": "transformers",
"token_count": 6952
} | 622 |
# flake8: noqa
TMDB_DOCS = """API documentation:
Endpoint: https://api.themoviedb.org/3
GET /search/movie
This API is for searching movies.
Query parameters table:
language | string | Pass a ISO 639-1 value to display translated data for the fields that support it. minLength: 2, pattern: ([a-z]{2})-([A-Z]{2}), defaul... | langchain/libs/langchain/langchain/chains/api/tmdb_docs.py/0 | {
"file_path": "langchain/libs/langchain/langchain/chains/api/tmdb_docs.py",
"repo_id": "langchain",
"token_count": 413
} | 499 |
from llama_index.readers.graphdb_cypher.base import GraphDBCypherReader
__all__ = ["GraphDBCypherReader"]
| llama_index/llama-index-integrations/readers/llama-index-readers-graphdb-cypher/llama_index/readers/graphdb_cypher/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-graphdb-cypher/llama_index/readers/graphdb_cypher/__init__.py",
"repo_id": "llama_index",
"token_count": 38
} | 1,308 |
[package]
name = "candle-datasets"
version.workspace = true
edition.workspace = true
description.workspace = true
repository.workspace = true
keywords.workspace = true
categories.workspace = true
license.workspace = true
readme = "README.md"
[dependencies]
byteorder = { workspace = true }
candle = { workspace = true }... | candle/candle-datasets/Cargo.toml/0 | {
"file_path": "candle/candle-datasets/Cargo.toml",
"repo_id": "candle",
"token_count": 201
} | 36 |
# coding=utf-8
# Copyright 2023 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/tools/test_text_to_speech.py/0 | {
"file_path": "transformers/tests/tools/test_text_to_speech.py",
"repo_id": "transformers",
"token_count": 745
} | 862 |
# This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class ImageProcessingMixin(metaclass=DummyObject):
_backends = ["vision"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["vision"])
class ImageFeatureExtract... | transformers/src/transformers/utils/dummy_vision_objects.py/0 | {
"file_path": "transformers/src/transformers/utils/dummy_vision_objects.py",
"repo_id": "transformers",
"token_count": 5489
} | 717 |
use super::{
lattice::Lattice,
trainer::UnigramTrainer,
trie::{Trie, TrieBuilder},
};
use crate::tokenizer::{Model, Result, Token};
use crate::utils::cache::Cache;
use std::collections::HashMap;
use std::convert::TryInto;
use std::fs::read_to_string;
use std::path::{Path, PathBuf};
type TokenMap = HashMap... | tokenizers/tokenizers/src/models/unigram/model.rs/0 | {
"file_path": "tokenizers/tokenizers/src/models/unigram/model.rs",
"repo_id": "tokenizers",
"token_count": 11900
} | 465 |
import math
import numbers
import random
import warnings
from typing import List, Sequence, Tuple, Union
import torch
import torchvision.transforms.functional as F
try:
from torchvision.transforms.functional import InterpolationMode
has_interpolation_mode = True
except ImportError:
has_interpolation_mode =... | pytorch-image-models/timm/data/transforms.py/0 | {
"file_path": "pytorch-image-models/timm/data/transforms.py",
"repo_id": "pytorch-image-models",
"token_count": 8644
} | 341 |
# Copyright 2024 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | diffusers/src/diffusers/models/resnet_flax.py/0 | {
"file_path": "diffusers/src/diffusers/models/resnet_flax.py",
"repo_id": "diffusers",
"token_count": 1884
} | 236 |
<jupyter_start><jupyter_text>**Fine-tuning for Image Classification with 🤗 Transformers**This notebook shows how to fine-tune any pretrained Vision model for Image Classification on a custom dataset. The idea is to add a randomly initialized classification head on top of a pre-trained encoder, and fine-tune the model ... | notebooks/examples/image_classification-tf.ipynb/0 | {
"file_path": "notebooks/examples/image_classification-tf.ipynb",
"repo_id": "notebooks",
"token_count": 9526
} | 310 |
# !pip install opencv-python transformers accelerate
import argparse
import cv2
import numpy as np
import torch
from controlnetxs import ControlNetXSModel
from PIL import Image
from pipeline_controlnet_xs import StableDiffusionControlNetXSPipeline
from diffusers.utils import load_image
parser = argparse.ArgumentPar... | diffusers/examples/research_projects/controlnetxs/infer_sd_controlnetxs.py/0 | {
"file_path": "diffusers/examples/research_projects/controlnetxs/infer_sd_controlnetxs.py",
"repo_id": "diffusers",
"token_count": 646
} | 213 |
export {
type RunnableFunc,
type RunnableLike,
type RunnableBatchOptions,
type RunnableRetryFailedAttemptHandler,
Runnable,
type RunnableInterface,
type RunnableBindingArgs,
RunnableBinding,
RunnableEach,
RunnableRetry,
RunnableSequence,
RunnableMap,
RunnableParallel,
RunnableLambda,
Runna... | langchainjs/langchain-core/src/runnables/index.ts/0 | {
"file_path": "langchainjs/langchain-core/src/runnables/index.ts",
"repo_id": "langchainjs",
"token_count": 296
} | 831 |
.. _Ref-Indices:
Indices
=======
This doc shows both the overarching class used to represent an index. These
classes allow for index creation, insertion, and also querying.
We first show the different index subclasses.
We then show the base class that all indices inherit from, which contains
parameters and methods co... | llama_index/docs/api_reference/indices.rst/0 | {
"file_path": "llama_index/docs/api_reference/indices.rst",
"repo_id": "llama_index",
"token_count": 220
} | 1,076 |
import logging
import os
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type, Union
from deprecated import deprecated
from llama_index.core.base.llms.types import ChatMessage
from llama_index.core.bridge.pydantic import BaseModel
from llama_index.core.llms.generic_utils import get_from_param_... | llama_index/llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/utils.py/0 | {
"file_path": "llama_index/llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/utils.py",
"repo_id": "llama_index",
"token_count": 4452
} | 1,310 |
import pytest
def pytest_addoption(parser):
parser.addoption("--chaos_type", action="store", default="pod_kill", help="chaos_type")
parser.addoption("--role_type", action="store", default="activated", help="role_type")
parser.addoption("--target_component", action="store", default="querynode", help="targe... | milvus/tests/python_client/chaos/conftest.py/0 | {
"file_path": "milvus/tests/python_client/chaos/conftest.py",
"repo_id": "milvus",
"token_count": 719
} | 1,969 |
""" EfficientViT (by MSRA)
Paper: `EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention`
- https://arxiv.org/abs/2305.07027
Adapted from official impl at https://github.com/microsoft/Cream/tree/main/EfficientViT
"""
__all__ = ['EfficientVitMsra']
import itertools
from collections impor... | pytorch-image-models/timm/models/efficientvit_msra.py/0 | {
"file_path": "pytorch-image-models/timm/models/efficientvit_msra.py",
"repo_id": "pytorch-image-models",
"token_count": 11871
} | 397 |
"""Test GradientAI."""
import sys
from typing import Any
from unittest.mock import MagicMock, patch
import pytest
from llama_index.legacy.core.llms.types import CompletionResponse
from llama_index.legacy.llms.gradient import (
GradientBaseModelLLM,
GradientModelAdapterLLM,
)
class GradientModel(MagicMock):
... | llama_index/llama-index-legacy/tests/llms/test_gradient.py/0 | {
"file_path": "llama_index/llama-index-legacy/tests/llms/test_gradient.py",
"repo_id": "llama_index",
"token_count": 1587
} | 1,626 |
---
sidebar_class_name: hidden
---
# Self-critique chain with constitutional AI
The ConstitutionalChain is a chain that ensures the output of a language model adheres to a predefined set of constitutional principles. By incorporating specific rules and guidelines, the ConstitutionalChain filters and modifies the gene... | langchainjs/docs/core_docs/docs/modules/chains/additional/constitutional_chain.mdx/0 | {
"file_path": "langchainjs/docs/core_docs/docs/modules/chains/additional/constitutional_chain.mdx",
"repo_id": "langchainjs",
"token_count": 233
} | 751 |
// 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/mq/msgstream/msgstream.go/0 | {
"file_path": "milvus/pkg/mq/msgstream/msgstream.go",
"repo_id": "milvus",
"token_count": 792
} | 1,820 |
import logging
from typing import Optional
from llama_index.legacy.callbacks.base import CallbackManager
from llama_index.legacy.core.base_query_engine import BaseQueryEngine
from llama_index.legacy.core.response.schema import RESPONSE_TYPE, Response
from llama_index.legacy.evaluation.base import BaseEvaluator
from ll... | llama_index/llama-index-legacy/llama_index/legacy/query_engine/retry_query_engine.py/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/query_engine/retry_query_engine.py",
"repo_id": "llama_index",
"token_count": 2218
} | 1,755 |
import { WebPDFLoader } from "langchain/document_loaders/web/pdf";
const blob = new Blob(); // e.g. from a file input
const loader = new WebPDFLoader(blob);
const docs = await loader.load();
console.log({ docs });
| langchainjs/examples/src/document_loaders/web_pdf.ts/0 | {
"file_path": "langchainjs/examples/src/document_loaders/web_pdf.ts",
"repo_id": "langchainjs",
"token_count": 74
} | 769 |
# coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/utils/get_test_info.py/0 | {
"file_path": "transformers/utils/get_test_info.py",
"repo_id": "transformers",
"token_count": 2577
} | 800 |
// 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/storage/payload_writer.go/0 | {
"file_path": "milvus/internal/storage/payload_writer.go",
"repo_id": "milvus",
"token_count": 5285
} | 2,066 |
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use th... | milvus/internal/datanode/metacache/meta_cache.go/0 | {
"file_path": "milvus/internal/datanode/metacache/meta_cache.go",
"repo_id": "milvus",
"token_count": 2765
} | 1,705 |
#!/usr/bin/env python3
""" Bulk Model Script Runner
Run validation or benchmark script in separate process for each model
Benchmark all 'vit*' models:
python bulk_runner.py --model-list 'vit*' --results-file vit_bench.csv benchmark.py --amp -b 512
Validate all models:
python bulk_runner.py --model-list all --resul... | pytorch-image-models/bulk_runner.py/0 | {
"file_path": "pytorch-image-models/bulk_runner.py",
"repo_id": "pytorch-image-models",
"token_count": 3409
} | 356 |
"""Data struct for document summary index."""
from dataclasses import dataclass, field
from typing import Dict, List
from llama_index.core.data_structs.data_structs import IndexStruct
from llama_index.core.data_structs.struct_type import IndexStructType
from llama_index.core.schema import BaseNode
@dataclass
class ... | llama_index/llama-index-core/llama_index/core/data_structs/document_summary.py/0 | {
"file_path": "llama_index/llama-index-core/llama_index/core/data_structs/document_summary.py",
"repo_id": "llama_index",
"token_count": 1112
} | 1,182 |
label: 'Privacy'
| langchain/docs/docs/guides/privacy/_category_.yml/0 | {
"file_path": "langchain/docs/docs/guides/privacy/_category_.yml",
"repo_id": "langchain",
"token_count": 6
} | 95 |
import { ChatCohere } from "@langchain/cohere";
import { HumanMessage } from "@langchain/core/messages";
const model = new ChatCohere({
apiKey: process.env.COHERE_API_KEY, // Default
model: "command", // Default
});
const documents = [
{
title: "Harrison's work",
snippet: "Harrison worked at Kensho as a... | langchainjs/examples/src/models/chat/cohere/rag.ts/0 | {
"file_path": "langchainjs/examples/src/models/chat/cohere/rag.ts",
"repo_id": "langchainjs",
"token_count": 303
} | 828 |
# coding=utf-8
# Copyright 2019 HuggingFace Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | transformers/tests/tokenization/test_tokenization_fast.py/0 | {
"file_path": "transformers/tests/tokenization/test_tokenization_fast.py",
"repo_id": "transformers",
"token_count": 5163
} | 805 |
import { ChatWindow } from "@/components/ChatWindow";
export default function Home() {
const InfoCard = (
<div className="p-4 md:p-8 rounded bg-[#25252d] w-full max-h-[85%] overflow-hidden">
<h1 className="text-3xl md:text-4xl mb-4">
⚒️ LangSmith + Next.js Feedback Example 🦜🔗
</h1>
<u... | langsmith-cookbook/feedback-examples/nextjs/app/page.tsx/0 | {
"file_path": "langsmith-cookbook/feedback-examples/nextjs/app/page.tsx",
"repo_id": "langsmith-cookbook",
"token_count": 1399
} | 1,019 |
<jupyter_start><jupyter_text>Answer Relevancy and Context Relevancy Evaluations In this notebook, we demonstrate how to utilize the `AnswerRelevancyEvaluator` and `ContextRelevancyEvaluator` classes to get a measure on the relevancy of a generated answer and retrieved contexts, respectively, to a given user query. Both... | llama_index/docs/examples/evaluation/answer_and_context_relevancy.ipynb/0 | {
"file_path": "llama_index/docs/examples/evaluation/answer_and_context_relevancy.ipynb",
"repo_id": "llama_index",
"token_count": 2256
} | 1,117 |
GIT_ROOT ?= $(shell git rev-parse --show-toplevel)
help: ## Show all Makefile targets.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-30s\033[0m %s\n", $$1, $$2}'
format: ## Run code autoformatters (black).
pre-commit install
git ls-files | xargs pre-commit ru... | llama_index/Makefile/0 | {
"file_path": "llama_index/Makefile",
"repo_id": "llama_index",
"token_count": 441
} | 1,030 |
"""Prompts for comparing the outputs of two models for a given question.
This prompt is used to compare two responses and evaluate which one best follows the instructions
and answers the question. The prompt is based on the paper from
Zheng, et. al. https://arxiv.org/abs/2306.05685
"""
# flake8: noqa
from langchain_co... | langchain/libs/langchain/langchain/evaluation/comparison/prompt.py/0 | {
"file_path": "langchain/libs/langchain/langchain/evaluation/comparison/prompt.py",
"repo_id": "langchain",
"token_count": 746
} | 550 |
import { describe, expect, test, jest } from "@jest/globals";
import { PoolConfig } from "pg";
import { PostgresRecordManager } from "../postgres.js";
describe.skip("PostgresRecordManager", () => {
const tableName = "upsertion_record";
let recordManager: PostgresRecordManager;
beforeAll(async () => {
const ... | langchainjs/libs/langchain-community/src/indexes/tests/postgres.int.test.ts/0 | {
"file_path": "langchainjs/libs/langchain-community/src/indexes/tests/postgres.int.test.ts",
"repo_id": "langchainjs",
"token_count": 2251
} | 990 |
<!--Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed... | transformers/docs/source/it/autoclass_tutorial.md/0 | {
"file_path": "transformers/docs/source/it/autoclass_tutorial.md",
"repo_id": "transformers",
"token_count": 1933
} | 485 |
import warnings
from typing import List
from unittest.mock import patch
from langchain_community.tools.shell.tool import ShellInput, ShellTool
# Test data
test_commands = ["echo 'Hello, World!'", "echo 'Another command'"]
def test_shell_input_validation() -> None:
shell_input = ShellInput(commands=test_commands... | langchain/libs/community/tests/unit_tests/tools/shell/test_shell.py/0 | {
"file_path": "langchain/libs/community/tests/unit_tests/tools/shell/test_shell.py",
"repo_id": "langchain",
"token_count": 1125
} | 393 |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/src/transformers/models/visual_bert/configuration_visual_bert.py/0 | {
"file_path": "transformers/src/transformers/models/visual_bert/configuration_visual_bert.py",
"repo_id": "transformers",
"token_count": 2970
} | 708 |
import { type ClientOptions, OpenAIClient, toFile } from "@langchain/openai";
import { Document } from "@langchain/core/documents";
import { BufferLoader } from "./buffer.js";
const MODEL_NAME = "whisper-1";
/**
* @example
* ```typescript
* const loader = new OpenAIWhisperAudio(
* "./src/document_loaders/examp... | langchainjs/langchain/src/document_loaders/fs/openai_whisper_audio.ts/0 | {
"file_path": "langchainjs/langchain/src/document_loaders/fs/openai_whisper_audio.ts",
"repo_id": "langchainjs",
"token_count": 450
} | 891 |
use std::time::{Duration, Instant};
use text_generation_client::{
Batch, CachedBatch, ClientError, NextTokenChooserParameters, Request, ShardedClient,
StoppingCriteriaParameters,
};
use tokenizers::{Tokenizer, TruncationDirection};
use tokio::sync::{broadcast, mpsc};
const LOREM_IPSUM: &str = "Lorem ipsum dolo... | text-generation-inference/benchmark/src/generation.rs/0 | {
"file_path": "text-generation-inference/benchmark/src/generation.rs",
"repo_id": "text-generation-inference",
"token_count": 3201
} | 417 |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | transformers/src/transformers/models/layoutxlm/tokenization_layoutxlm_fast.py/0 | {
"file_path": "transformers/src/transformers/models/layoutxlm/tokenization_layoutxlm_fast.py",
"repo_id": "transformers",
"token_count": 17923
} | 622 |
from llama_index.evaluation.tonic_validate.answer_consistency import (
AnswerConsistencyEvaluator,
)
from llama_index.evaluation.tonic_validate.answer_consistency_binary import (
AnswerConsistencyBinaryEvaluator,
)
from llama_index.evaluation.tonic_validate.answer_similarity import (
AnswerSimilarityEvaluat... | llama_index/llama-index-integrations/evaluation/llama-index-evaluation-tonic-validate/llama_index/evaluation/tonic_validate/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/evaluation/llama-index-evaluation-tonic-validate/llama_index/evaluation/tonic_validate/__init__.py",
"repo_id": "llama_index",
"token_count": 385
} | 1,201 |
[tool.poetry]
name = "rag-pinecone"
version = "0.1.0"
description = "RAG using Pinecone"
authors = [
"Lance Martin <lance@langchain.dev>",
]
readme = "README.md"
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
langchain = "^0.1"
openai = "<2"
tiktoken = ">=0.5.1"
pinecone-client = ">=2.2.4"
[tool.poetry.group.... | langchain/templates/rag-pinecone/pyproject.toml/0 | {
"file_path": "langchain/templates/rag-pinecone/pyproject.toml",
"repo_id": "langchain",
"token_count": 288
} | 664 |
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnableBranch
from .blurb_matcher import book_rec_chain
from .chat import chat
from .library_info import library_info
from .rag import librarian_rag
chain = (
ChatP... | langchain/templates/cohere-librarian/cohere_librarian/router.py/0 | {
"file_path": "langchain/templates/cohere-librarian/cohere_librarian/router.py",
"repo_id": "langchain",
"token_count": 382
} | 644 |
export const IS_DEV = process.env.NODE_ENV === "development";
export const API_URL = process.env.NEXT_PUBLIC_API_URL;
| auto-evaluator/nextjs/utils/variables.ts/0 | {
"file_path": "auto-evaluator/nextjs/utils/variables.ts",
"repo_id": "auto-evaluator",
"token_count": 41
} | 3 |
[build-system]
build-backend = "poetry.core.masonry.api"
requires = ["poetry-core"]
[tool.codespell]
check-filenames = true
check-hidden = true
skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"
[tool.llamahub]
classes = ["AsyncAzureOpenAI", "AzureOpenAI", "AzureOpenAIEmbedding"]
contains_example = false
import... | llama_index/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/pyproject.toml/0 | {
"file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-azure-openai/pyproject.toml",
"repo_id": "llama_index",
"token_count": 705
} | 1,175 |
from llama_index.storage.docstore.redis.base import RedisDocumentStore
__all__ = ["RedisDocumentStore"]
| llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-redis/llama_index/storage/docstore/redis/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/storage/docstore/llama-index-storage-docstore-redis/llama_index/storage/docstore/redis/__init__.py",
"repo_id": "llama_index",
"token_count": 33
} | 1,457 |
import threading
import pytest
import os
import time
import json
from time import sleep
from pathlib import Path
from minio import Minio
from pymilvus import connections
from chaos.checker import (InsertChecker, SearchChecker, QueryChecker, BulkInsertChecker, Op)
from common.cus_resource_opts import CustomResourceOper... | milvus/tests/python_client/bulk_insert/test_bulk_insert_with_requests.py/0 | {
"file_path": "milvus/tests/python_client/bulk_insert/test_bulk_insert_with_requests.py",
"repo_id": "milvus",
"token_count": 2770
} | 1,985 |
import { MaskingTransformer } from "./transformer.js";
/**
* Configuration type for MaskingParser.
*/
export type MaskingParserConfig = {
transformers?: MaskingTransformer[];
defaultHashFunction?: HashFunction;
onMaskingStart?: HookFunction;
onMaskingEnd?: HookFunction;
onRehydratingStart?: HookFunction;
... | langchainjs/langchain/src/experimental/masking/types.ts/0 | {
"file_path": "langchainjs/langchain/src/experimental/masking/types.ts",
"repo_id": "langchainjs",
"token_count": 225
} | 961 |
use candle::{DType, IndexOp, Result, Tensor, D};
use candle_nn::{
batch_norm, conv2d, conv2d_no_bias, BatchNorm, Conv2d, Conv2dConfig, Module, VarBuilder,
};
use image::DynamicImage;
// Model architecture from https://github.com/ultralytics/ultralytics/issues/189
// https://github.com/tinygrad/tinygrad/blob/master... | candle/candle-wasm-examples/yolo/src/model.rs/0 | {
"file_path": "candle/candle-wasm-examples/yolo/src/model.rs",
"repo_id": "candle",
"token_count": 14731
} | 78 |
// Licensed to the LF AI & Data foundation under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use th... | milvus/internal/querynodev2/pipeline/delete_node.go/0 | {
"file_path": "milvus/internal/querynodev2/pipeline/delete_node.go",
"repo_id": "milvus",
"token_count": 1205
} | 1,771 |
"""Beautiful Soup Web scraper."""
import logging
from typing import Any, Callable, Dict, List, Optional, Tuple
from urllib.parse import urljoin
from llama_index.core.readers.base import BasePydanticReader
from llama_index.core.schema import Document
logger = logging.getLogger(__name__)
def _substack_reader(soup: A... | llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/beautiful_soup_web/base.py/0 | {
"file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-web/llama_index/readers/web/beautiful_soup_web/base.py",
"repo_id": "llama_index",
"token_count": 3067
} | 1,566 |
---
aString: {{var}}
anArray:
- element
- {{varElement}}
aDict:
dictId1: 'val'
dictId2: '{{varVal}}'
tags: [ 'tag', '{{varTag}}' ]
---
Frontmatter contains template variables.
| langchain/libs/community/tests/unit_tests/document_loaders/sample_documents/obsidian/template_var_frontmatter.md/0 | {
"file_path": "langchain/libs/community/tests/unit_tests/document_loaders/sample_documents/obsidian/template_var_frontmatter.md",
"repo_id": "langchain",
"token_count": 72
} | 374 |
"""Test Playground."""
from typing import List
import pytest
from llama_index.core.base.embeddings.base import BaseEmbedding
from llama_index.core.indices.list.base import SummaryIndex
from llama_index.core.indices.tree.base import TreeIndex
from llama_index.core.indices.vector_store.base import VectorStoreIndex
from... | llama_index/llama-index-core/tests/playground/test_base.py/0 | {
"file_path": "llama_index/llama-index-core/tests/playground/test_base.py",
"repo_id": "llama_index",
"token_count": 2223
} | 1,240 |
# coding=utf-8
# Copyright 2023 The Mega Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | transformers/src/transformers/models/mega/modeling_mega.py/0 | {
"file_path": "transformers/src/transformers/models/mega/modeling_mega.py",
"repo_id": "transformers",
"token_count": 45877
} | 664 |
from typing import List, Optional, Sequence, cast
from llama_index.legacy.llm_predictor.base import LLMPredictorType
from llama_index.legacy.output_parsers.base import StructuredOutput
from llama_index.legacy.prompts.base import BasePromptTemplate, PromptTemplate
from llama_index.legacy.prompts.mixin import PromptDict... | llama_index/llama-index-legacy/llama_index/legacy/question_gen/llm_generators.py/0 | {
"file_path": "llama_index/llama-index-legacy/llama_index/legacy/question_gen/llm_generators.py",
"repo_id": "llama_index",
"token_count": 1484
} | 1,630 |
# ChangeLog
## [0.9.45.post1] - 2024-02-07
### New Features
- Upgraded deeplake vector database to use BasePydanticVectorStore (#10504)
### Bug Fixes / Nits
- Fix MD parser for inconsistency tables (#10488)
- Fix ImportError for pypdf in MetadataExtractionSEC.ipynb (#10491)
## [0.9.45] - 2024-02-07
### New Featu... | llama_index/llama-index-legacy/CHANGELOG.md/0 | {
"file_path": "llama_index/llama-index-legacy/CHANGELOG.md",
"repo_id": "llama_index",
"token_count": 23927
} | 1,633 |
"""Parsing utils to go from string to AgentAction or Agent Finish.
AgentAction means that an action should be taken.
This contains the name of the tool to use, the input to pass to that tool,
and a `log` variable (which contains a log of the agent's thinking).
AgentFinish means that a response should be given.
This c... | langchain/libs/langchain/langchain/agents/output_parsers/__init__.py/0 | {
"file_path": "langchain/libs/langchain/langchain/agents/output_parsers/__init__.py",
"repo_id": "langchain",
"token_count": 373
} | 444 |
"""Hypothetical Document Embeddings.
https://arxiv.org/abs/2212.10496
"""
| langchain/libs/langchain/langchain/chains/hyde/__init__.py/0 | {
"file_path": "langchain/libs/langchain/langchain/chains/hyde/__init__.py",
"repo_id": "langchain",
"token_count": 29
} | 460 |
# Fleet Context Embeddings - Building a Hybrid Search Engine for the Llamaindex Library
In this guide, we will be using Fleet Context to download the embeddings for LlamaIndex's documentation and build a hybrid dense/sparse vector retrieval engine on top of it.
<br><br>
## Pre-requisites
```
!pip install llama-inde... | llama_index/docs/community/integrations/fleet_libraries_context.md/0 | {
"file_path": "llama_index/docs/community/integrations/fleet_libraries_context.md",
"repo_id": "llama_index",
"token_count": 2032
} | 1,065 |
# Training a masked language model end-to-end from scratch on TPUs
In this example, we're going to demonstrate how to train a TensorFlow model from 🤗 Transformers from scratch. If you're interested in some background theory on training Hugging Face models with TensorFlow on TPU, please check out our
[tutorial doc](h... | transformers/examples/tensorflow/language-modeling-tpu/README.md/0 | {
"file_path": "transformers/examples/tensorflow/language-modeling-tpu/README.md",
"repo_id": "transformers",
"token_count": 1947
} | 550 |
from llama_index.embeddings.huggingface_optimum_intel.base import IntelEmbedding
__all__ = ["IntelEmbedding"]
| llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum-intel/llama_index/embeddings/huggingface_optimum_intel/__init__.py/0 | {
"file_path": "llama_index/llama-index-integrations/embeddings/llama-index-embeddings-huggingface-optimum-intel/llama_index/embeddings/huggingface_optimum_intel/__init__.py",
"repo_id": "llama_index",
"token_count": 39
} | 1,184 |
# coding=utf-8
# Copyright 2022 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | transformers/tests/models/rembert/test_tokenization_rembert.py/0 | {
"file_path": "transformers/tests/models/rembert/test_tokenization_rembert.py",
"repo_id": "transformers",
"token_count": 6741
} | 766 |
## Using ONNX models in Candle
This example demonstrates how to run [ONNX](https://github.com/onnx/onnx) based models in Candle.
It contains small variants of two models, [SqueezeNet](https://arxiv.org/pdf/1602.07360.pdf) (default) and [EfficientNet](https://arxiv.org/pdf/1905.11946.pdf).
You can run the examples wi... | candle/candle-examples/examples/onnx/README.md/0 | {
"file_path": "candle/candle-examples/examples/onnx/README.md",
"repo_id": "candle",
"token_count": 832
} | 45 |
"""GMail tool spec."""
import base64
import email
from email.message import EmailMessage
from typing import Any, List, Optional
from llama_index.core.schema import Document
from llama_index.core.tools.tool_spec.base import BaseToolSpec
SCOPES = [
"https://www.googleapis.com/auth/gmail.compose",
"https://www.... | llama_index/llama-index-integrations/tools/llama-index-tools-google/llama_index/tools/google/gmail/base.py/0 | {
"file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-google/llama_index/tools/google/gmail/base.py",
"repo_id": "llama_index",
"token_count": 4140
} | 1,486 |
"""Chain that calls Google Places API.
"""
import logging
from typing import Any, Dict, Optional
from langchain_core.pydantic_v1 import BaseModel, Extra, root_validator
from langchain_core.utils import get_from_dict_or_env
class GooglePlacesAPIWrapper(BaseModel):
"""Wrapper around Google Places API.
To use... | langchain/libs/community/langchain_community/utilities/google_places_api.py/0 | {
"file_path": "langchain/libs/community/langchain_community/utilities/google_places_api.py",
"repo_id": "langchain",
"token_count": 1741
} | 299 |
from typing import List, Optional
import fsspec
from llama_index.core.bridge.pydantic import BaseModel, Field
from llama_index.core.schema import BaseNode
from llama_index.core.storage.docstore.utils import doc_to_json, json_to_doc
from llama_index.core.storage.kvstore import (
SimpleKVStore as SimpleCache,
)
from... | llama_index/llama-index-core/llama_index/core/ingestion/cache.py/0 | {
"file_path": "llama_index/llama-index-core/llama_index/core/ingestion/cache.py",
"repo_id": "llama_index",
"token_count": 1038
} | 1,225 |
# coding=utf-8
# Copyright 2018 Hao Tan, Mohit Bansal, and the HuggingFace 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 r... | transformers/src/transformers/models/lxmert/modeling_lxmert.py/0 | {
"file_path": "transformers/src/transformers/models/lxmert/modeling_lxmert.py",
"repo_id": "transformers",
"token_count": 27624
} | 626 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.