text
stringlengths
3
1.68M
id
stringlengths
13
169
metadata
dict
__index_level_0__
int64
0
2.21k
// 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/task.go/0
{ "file_path": "milvus/internal/rootcoord/task.go", "repo_id": "milvus", "token_count": 771 }
1,788
<jupyter_start><jupyter_text>Multi-Agent Simulated Environment: Petting ZooIn this example, we show how to define multi-agent simulations with simulated environments. Like [ours single-agent example with Gymnasium](https://python.langchain.com/en/latest/use_cases/agent_simulations/gymnasium.html), we create an agent-en...
langchain/cookbook/petting_zoo.ipynb/0
{ "file_path": "langchain/cookbook/petting_zoo.ipynb", "repo_id": "langchain", "token_count": 4304 }
81
# ruff: noqa: E402 """Main entrypoint into package.""" import warnings from importlib import metadata from typing import Any, Optional from langchain_core._api.deprecation import surface_langchain_deprecation_warnings try: __version__ = metadata.version(__package__) except metadata.PackageNotFoundError: # Cas...
langchain/libs/langchain/langchain/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/__init__.py", "repo_id": "langchain", "token_count": 5443 }
461
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-azcognitive-search/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-azcognitive-search/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,340
// 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/core/src/common/Array.h/0
{ "file_path": "milvus/internal/core/src/common/Array.h", "repo_id": "milvus", "token_count": 12829 }
1,730
import type { BaseLanguageModelInterface } from "@langchain/core/language_models/base"; import { ChainValues } from "@langchain/core/utils/types"; import { BasePromptTemplate } from "@langchain/core/prompts"; import { CallbackManagerForChainRun } from "@langchain/core/callbacks/manager"; import { LLMChain } from "../.....
langchainjs/langchain/src/chains/router/llm_router.ts/0
{ "file_path": "langchainjs/langchain/src/chains/router/llm_router.ts", "repo_id": "langchainjs", "token_count": 751 }
930
# LlamaIndex Callbacks Integration: PromptLayer
llama_index/llama-index-integrations/callbacks/llama-index-callbacks-promptlayer/README.md/0
{ "file_path": "llama_index/llama-index-integrations/callbacks/llama-index-callbacks-promptlayer/README.md", "repo_id": "llama_index", "token_count": 11 }
1,184
from llama_index.core.readers.base import BaseReader from llama_index.readers.make_com import MakeWrapper def test_class(): names_of_base_classes = [b.__name__ for b in MakeWrapper.__mro__] assert BaseReader.__name__ in names_of_base_classes
llama_index/llama-index-integrations/readers/llama-index-readers-make-com/tests/test_readers_make_com.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-make-com/tests/test_readers_make_com.py", "repo_id": "llama_index", "token_count": 89 }
1,475
python_sources()
llama_index/llama-index-legacy/llama_index/legacy/readers/chatgpt_plugin/BUILD/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/readers/chatgpt_plugin/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,591
#!/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/convert_model_to_fp16.py/0
{ "file_path": "transformers/examples/legacy/seq2seq/convert_model_to_fp16.py", "repo_id": "transformers", "token_count": 450 }
517
import { ChatOpenAI } from "@langchain/openai"; import { StringOutputParser } from "@langchain/core/output_parsers"; import { RunnableSequence } from "@langchain/core/runnables"; const chain = RunnableSequence.from([ new ChatOpenAI({ temperature: 0 }), new StringOutputParser(), ]); const stream = await chain.stre...
langchainjs/examples/src/prompts/string_output_parser_sequence.ts/0
{ "file_path": "langchainjs/examples/src/prompts/string_output_parser_sequence.ts", "repo_id": "langchainjs", "token_count": 125 }
845
<!--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/vit_msn.md/0
{ "file_path": "transformers/docs/source/en/model_doc/vit_msn.md", "repo_id": "transformers", "token_count": 1191 }
505
python_sources()
llama_index/llama-index-packs/llama-index-packs-panel-chatbot/llama_index/packs/panel_chatbot/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-panel-chatbot/llama_index/packs/panel_chatbot/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,806
"""SceneXplain API toolkit."""
langchain/libs/langchain/langchain/tools/scenexplain/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/scenexplain/__init__.py", "repo_id": "langchain", "token_count": 10 }
585
// 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/flush_task_counter.go/0
{ "file_path": "milvus/internal/datanode/flush_task_counter.go", "repo_id": "milvus", "token_count": 683 }
1,972
"""Fake Chat Model wrapper for testing purposes.""" from typing import Any, Dict, List, Optional from langchain_core.callbacks import ( AsyncCallbackManagerForLLMRun, CallbackManagerForLLMRun, ) from langchain_core.language_models.chat_models import SimpleChatModel from langchain_core.messages import AIMessage...
langchain/libs/community/tests/unit_tests/llms/fake_chat_model.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/llms/fake_chat_model.py", "repo_id": "langchain", "token_count": 502 }
407
#!/usr/bin/env python """Example LangChain server exposes a retriever.""" from fastapi import FastAPI from langchain.embeddings import OpenAIEmbeddings from langchain.vectorstores import FAISS from langserve import add_routes vectorstore = FAISS.from_texts( ["cats like fish", "dogs like sticks"], embedding=OpenAI...
langserve/examples/retrieval/server.py/0
{ "file_path": "langserve/examples/retrieval/server.py", "repo_id": "langserve", "token_count": 248 }
1,044
package syncmgr import ( "context" "math/rand" "strconv" "testing" "time" "github.com/samber/lo" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" "go.uber.org/atomic" "github.com/milvus-io/milvus-proto/go-api/v2/commonpb" "github.com/milvus-io/milvus-proto/go-api/v2/msgpb" "github.c...
milvus/internal/datanode/syncmgr/sync_manager_test.go/0
{ "file_path": "milvus/internal/datanode/syncmgr/sync_manager_test.go", "repo_id": "milvus", "token_count": 3909 }
1,782
<jupyter_start><jupyter_text>Ensemble Retrieval GuideOftentimes when building a RAG applications there are many retreival parameters/strategies to decide from (from chunk size to vector vs. keyword vs. hybrid search, for instance).Thought: what if we could try a bunch of strategies at once, and have any AI/reranker/LLM...
llama_index/docs/examples/retrievers/ensemble_retrieval.ipynb/0
{ "file_path": "llama_index/docs/examples/retrievers/ensemble_retrieval.ipynb", "repo_id": "llama_index", "token_count": 4190 }
1,079
python_tests()
llama_index/llama-index-integrations/readers/llama-index-readers-kaltura/tests/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-kaltura/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,388
import logging from typing import AsyncIterator, Optional, Sequence, Union import orjson from langchain_core.messages import ( AIMessage, AIMessageChunk, AnyMessage, BaseMessage, BaseMessageChunk, ChatMessage, ChatMessageChunk, FunctionMessage, FunctionMessageChunk, HumanMessage...
opengpts/backend/app/stream.py/0
{ "file_path": "opengpts/backend/app/stream.py", "repo_id": "opengpts", "token_count": 2141 }
1,995
<jupyter_start><jupyter_text>Résumé (PyTorch) Installez les bibliothèques 🤗 *Datasets* et 🤗 *Transformers* pour exécuter ce *notebook*.<jupyter_code>!pip install datasets transformers[sentencepiece] !pip install accelerate # Pour exécuter l'entraînement sur TPU, vous devez décommenter la ligne suivante : # !pip insta...
notebooks/course/fr/chapter7/section5_pt.ipynb/0
{ "file_path": "notebooks/course/fr/chapter7/section5_pt.ipynb", "repo_id": "notebooks", "token_count": 4623 }
292
# NASNet **NASNet** is a type of convolutional neural network discovered through neural architecture search. The building blocks consist of normal and reduction cells. {% include 'code_snippets.md' %} ## How do I train this model? You can follow the [timm recipe scripts](https://rwightman.github.io/pytorch-image-mo...
pytorch-image-models/docs/models/.templates/models/nasnet.md/0
{ "file_path": "pytorch-image-models/docs/models/.templates/models/nasnet.md", "repo_id": "pytorch-image-models", "token_count": 730 }
331
# coding=utf-8 # Copyright 2020 The Trax 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/reformer/tokenization_reformer_fast.py/0
{ "file_path": "transformers/src/transformers/models/reformer/tokenization_reformer_fast.py", "repo_id": "transformers", "token_count": 1954 }
722
# coding=utf-8 # Copyright 2021 The Fairseq Authors, Microsoft 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...
transformers/src/transformers/models/wavlm/configuration_wavlm.py/0
{ "file_path": "transformers/src/transformers/models/wavlm/configuration_wavlm.py", "repo_id": "transformers", "token_count": 7367 }
675
# 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/realm/__init__.py/0
{ "file_path": "transformers/src/transformers/models/realm/__init__.py", "repo_id": "transformers", "token_count": 1040 }
649
// 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/config/event_dispatcher_test.go/0
{ "file_path": "milvus/pkg/config/event_dispatcher_test.go", "repo_id": "milvus", "token_count": 1604 }
1,815
python_sources()
llama_index/llama-index-integrations/tools/llama-index-tools-python-file/llama_index/tools/python_file/BUILD/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-python-file/llama_index/tools/python_file/BUILD", "repo_id": "llama_index", "token_count": 6 }
1,494
# coding=utf-8 # Copyright 2020 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/tapas/convert_tapas_original_tf_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/tapas/convert_tapas_original_tf_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 1935 }
738
search_performance: collections: # sift_1b - server: db_config.primary_path: /test/milvus/db_data_gpu/sift_1b_2048_128_l2_sq8 cache_config.cpu_cache_capacity: 150 engine_config.use_blas_threshold: 1100 engine_config.gpu_search_threshold: 200 gpu_resource_config....
milvus/tests/benchmark/milvus_benchmark/suites/cpu_search_performance_sift1b.yaml/0
{ "file_path": "milvus/tests/benchmark/milvus_benchmark/suites/cpu_search_performance_sift1b.yaml", "repo_id": "milvus", "token_count": 350 }
2,007
// 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/create_collection_task.go/0
{ "file_path": "milvus/internal/rootcoord/create_collection_task.go", "repo_id": "milvus", "token_count": 7172 }
1,880
<jupyter_start><jupyter_text>Llama API [Llama API](https://www.llama-api.com/) is a hosted API for Llama 2 with function calling support. Setup To start, go to https://www.llama-api.com/ to obtain an API key If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip in...
llama_index/docs/examples/llm/llama_api.ipynb/0
{ "file_path": "llama_index/docs/examples/llm/llama_api.ipynb", "repo_id": "llama_index", "token_count": 1353 }
1,194
<jupyter_start><jupyter_text>EmailThis notebook shows how to load email (`.eml`) or `Microsoft Outlook` (`.msg`) files. Using Unstructured<jupyter_code>%pip install --upgrade --quiet unstructured from langchain_community.document_loaders import UnstructuredEmailLoader loader = UnstructuredEmailLoader("example_data/fa...
langchain/docs/docs/integrations/document_loaders/email.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/email.ipynb", "repo_id": "langchain", "token_count": 483 }
111
# coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
diffusers/examples/kandinsky2_2/text_to_image/train_text_to_image_lora_decoder.py/0
{ "file_path": "diffusers/examples/kandinsky2_2/text_to_image/train_text_to_image_lora_decoder.py", "repo_id": "diffusers", "token_count": 14871 }
217
"""Gmail tools.""" from langchain_community.tools.gmail.create_draft import GmailCreateDraft from langchain_community.tools.gmail.get_message import GmailGetMessage from langchain_community.tools.gmail.get_thread import GmailGetThread from langchain_community.tools.gmail.search import GmailSearch from langchain_commun...
langchain/libs/langchain/langchain/tools/gmail/__init__.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/gmail/__init__.py", "repo_id": "langchain", "token_count": 153 }
559
"""Knowledge Graph Index. Build a KG by extracting triplets, and leveraging the KG during query-time. """ import logging from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple from llama_index.core.base.base_retriever import BaseRetriever from llama_index.core.base.embeddings.base import BaseEmbedd...
llama_index/llama-index-core/llama_index/core/indices/knowledge_graph/base.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/indices/knowledge_graph/base.py", "repo_id": "llama_index", "token_count": 6481 }
1,217
from langchain_community.document_loaders.async_html import ( AsyncHtmlLoader, ) __all__ = ["AsyncHtmlLoader"]
langchain/libs/langchain/langchain/document_loaders/async_html.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/async_html.py", "repo_id": "langchain", "token_count": 42 }
484
package metautil import ( "path" "strconv" "strings" "github.com/milvus-io/milvus/pkg/common" "github.com/milvus-io/milvus/pkg/util/typeutil" ) const pathSep = "/" func BuildInsertLogPath(rootPath string, collectionID, partitionID, segmentID, fieldID, logID typeutil.UniqueID) string { k := JoinIDPath(collecti...
milvus/pkg/util/metautil/binlog.go/0
{ "file_path": "milvus/pkg/util/metautil/binlog.go", "repo_id": "milvus", "token_count": 631 }
1,845
kind: StressChaos apiVersion: chaos-mesh.org/v1alpha1 metadata: name: test-datanode-memory-stress namespace: chaos-testing spec: selector: namespaces: - chaos-testing labelSelectors: app.kubernetes.io/name: milvus app.kubernetes.io/instance: mic-memory app.kubernetes.io/component: ...
milvus/tests/python_client/chaos/chaos_objects/memory_stress/chaos_datanode_memory_stress.yaml/0
{ "file_path": "milvus/tests/python_client/chaos/chaos_objects/memory_stress/chaos_datanode_memory_stress.yaml", "repo_id": "milvus", "token_count": 170 }
1,894
"""Tests for correct functioning of callbacks."""
langchain/libs/community/tests/unit_tests/callbacks/__init__.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/callbacks/__init__.py", "repo_id": "langchain", "token_count": 12 }
360
<jupyter_start><jupyter_text>Scoring EvaluatorThe Scoring Evaluator instructs a language model to assess your model's predictions on a specified scale (default is 1-10) based on your custom criteria or rubric. This feature provides a nuanced evaluation instead of a simplistic binary score, aiding in evaluating models a...
langchain/docs/docs/guides/evaluation/string/scoring_eval_chain.ipynb/0
{ "file_path": "langchain/docs/docs/guides/evaluation/string/scoring_eval_chain.ipynb", "repo_id": "langchain", "token_count": 1844 }
94
"""Test transform chain.""" from typing import Dict import pytest from langchain.chains.transform import TransformChain def dummy_transform(inputs: Dict[str, str]) -> Dict[str, str]: """Transform a dummy input for tests.""" outputs = inputs outputs["greeting"] = f"{inputs['first_name']} {inputs['last_na...
langchain/libs/langchain/tests/unit_tests/chains/test_transform.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/chains/test_transform.py", "repo_id": "langchain", "token_count": 461 }
601
"""Test Clarifai vector store functionality.""" import time from langchain_core.documents import Document from langchain_community.vectorstores import Clarifai def test_clarifai_with_from_texts() -> None: """Test end to end construction and search.""" texts = ["foo", "bar", "baz"] USER_ID = "minhajul" ...
langchain/libs/community/tests/integration_tests/vectorstores/test_clarifai.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_clarifai.py", "repo_id": "langchain", "token_count": 1204 }
354
""" TanH Scheduler TanH schedule with warmup, cycle/restarts, noise. Hacked together by / Copyright 2021 Ross Wightman """ import logging import math import numpy as np import torch from .scheduler import Scheduler _logger = logging.getLogger(__name__) class TanhLRScheduler(Scheduler): """ Hyberbolic-Tan...
pytorch-image-models/timm/scheduler/tanh_lr.py/0
{ "file_path": "pytorch-image-models/timm/scheduler/tanh_lr.py", "repo_id": "pytorch-image-models", "token_count": 1960 }
374
--- sidebar_position: 4 --- # Large databases In order to write valid queries against a database, we need to feed the model the table names, table schemas, and feature values for it to query over. When there are many tables, columns, and/or high-cardinality columns, it becomes impossible for us to dump the full infor...
langchainjs/docs/core_docs/docs/use_cases/sql/large_db.mdx/0
{ "file_path": "langchainjs/docs/core_docs/docs/use_cases/sql/large_db.mdx", "repo_id": "langchainjs", "token_count": 1069 }
744
from __future__ import annotations from enum import Enum from os import getenv from time import sleep from types import ModuleType from typing import Any, List, Type, TypeVar import rockset from llama_index.core.schema import BaseNode from llama_index.core.vector_stores.types import ( VectorStore, VectorStore...
llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/llama_index/vector_stores/rocksetdb/base.py/0
{ "file_path": "llama_index/llama-index-integrations/vector_stores/llama-index-vector-stores-rocksetdb/llama_index/vector_stores/rocksetdb/base.py", "repo_id": "llama_index", "token_count": 5891 }
1,570
"use node"; import { TextLoader } from "langchain/document_loaders/fs/text"; import { CacheBackedEmbeddings } from "langchain/embeddings/cache_backed"; import { OpenAIEmbeddings } from "@langchain/openai"; import { ConvexKVStore } from "@langchain/community/storage/convex"; import { RecursiveCharacterTextSplitter } fr...
langchainjs/examples/src/embeddings/convex/cache_backed_convex.ts/0
{ "file_path": "langchainjs/examples/src/embeddings/convex/cache_backed_convex.ts", "repo_id": "langchainjs", "token_count": 633 }
834
# coding=utf-8 # Copyright 2024 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...
diffusers/scripts/convert_ncsnpp_original_checkpoint_to_diffusers.py/0
{ "file_path": "diffusers/scripts/convert_ncsnpp_original_checkpoint_to_diffusers.py", "repo_id": "diffusers", "token_count": 3607 }
205
# 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/image_transforms.py/0
{ "file_path": "transformers/src/transformers/image_transforms.py", "repo_id": "transformers", "token_count": 13239 }
573
pub(crate) mod config; mod distributed_hnsw_segment; mod segment_ingestor; mod segment_manager; pub(crate) use segment_ingestor::*; pub(crate) use segment_manager::*;
chroma/rust/worker/src/segment/mod.rs/0
{ "file_path": "chroma/rust/worker/src/segment/mod.rs", "repo_id": "chroma", "token_count": 62 }
59
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/tests/pipelines/test_pipelines_text_generation.py/0
{ "file_path": "transformers/tests/pipelines/test_pipelines_text_generation.py", "repo_id": "transformers", "token_count": 7393 }
840
Author: [@vasudevgupta7](https://github.com/thevasudevgupta/) ## Intro In this project, we fine-tuned [**BigBird**](https://arxiv.org/abs/2007.14062) on [**natural-questions**](https://huggingface.co/datasets/natural_questions) dataset for **question-answering** task on long documents. **BigBird**, is a **sparse-att...
transformers/examples/research_projects/jax-projects/big_bird/README.md/0
{ "file_path": "transformers/examples/research_projects/jax-projects/big_bird/README.md", "repo_id": "transformers", "token_count": 824 }
563
<!--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/es/create_a_model.md/0
{ "file_path": "transformers/docs/source/es/create_a_model.md", "repo_id": "transformers", "token_count": 6185 }
504
#!/usr/bin/env bash export PYTHONPATH="../":"${PYTHONPATH}" python finetune.py \ --learning_rate=3e-5 \ --fp16 \ --do_train \ --val_check_interval=0.25 \ --adam_eps 1e-06 \ --num_train_epochs 6 --src_lang en_XX --tgt_lang ro_RO \ --data_dir $ENRO_DIR \ --max_source_length $MAX_LEN --max...
transformers/examples/research_projects/seq2seq-distillation/train_mbart_cc25_enro.sh/0
{ "file_path": "transformers/examples/research_projects/seq2seq-distillation/train_mbart_cc25_enro.sh", "repo_id": "transformers", "token_count": 273 }
555
// Utility for marking only some keys of an interface as optional // Compare to Partial<T> which marks all keys as optional export type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
langchainjs/langchain/src/types/type-utils.ts/0
{ "file_path": "langchainjs/langchain/src/types/type-utils.ts", "repo_id": "langchainjs", "token_count": 58 }
998
<jupyter_start><jupyter_text>HuggingFace LLM - Camel-5b If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.<jupyter_code>%pip install llama-index-llms-huggingface !pip install llama-index import logging import sys logging.basicConfig(stream=sys.stdout, level=logging.INFO) logging...
llama_index/docs/examples/customization/llms/SimpleIndexDemo-Huggingface_camel.ipynb/0
{ "file_path": "llama_index/docs/examples/customization/llms/SimpleIndexDemo-Huggingface_camel.ipynb", "repo_id": "llama_index", "token_count": 1227 }
1,092
// 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/broker_test.go/0
{ "file_path": "milvus/internal/rootcoord/broker_test.go", "repo_id": "milvus", "token_count": 4561 }
1,776
from langchain_community.llms.openlm import OpenLM def test_openlm_call() -> None: """Test valid call to openlm.""" llm = OpenLM(model_name="dolly-v2-7b", max_tokens=10) output = llm(prompt="Say foo:") assert isinstance(output, str)
langchain/libs/community/tests/integration_tests/llms/test_openlm.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/llms/test_openlm.py", "repo_id": "langchain", "token_count": 103 }
343
from langchain_community.document_loaders.psychic import PsychicLoader __all__ = ["PsychicLoader"]
langchain/libs/langchain/langchain/document_loaders/psychic.py/0
{ "file_path": "langchain/libs/langchain/langchain/document_loaders/psychic.py", "repo_id": "langchain", "token_count": 28 }
498
from langchain_community.tools.multion.create_session import ( CreateSessionSchema, MultionCreateSession, ) __all__ = ["CreateSessionSchema", "MultionCreateSession"]
langchain/libs/langchain/langchain/tools/multion/create_session.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/multion/create_session.py", "repo_id": "langchain", "token_count": 55 }
581
""" Filter Response Norm in PyTorch Based on `Filter Response Normalization Layer` - https://arxiv.org/abs/1911.09737 Hacked together by / Copyright 2021 Ross Wightman """ import torch import torch.nn as nn from .create_act import create_act_layer from .trace_utils import _assert def inv_instance_rms(x, eps: float...
pytorch-image-models/timm/layers/filter_response_norm.py/0
{ "file_path": "pytorch-image-models/timm/layers/filter_response_norm.py", "repo_id": "pytorch-image-models", "token_count": 1182 }
388
from typing import Any, Sequence from llama_index.legacy.prompts.mixin import PromptDictType from llama_index.legacy.response_synthesizers.base import BaseSynthesizer from llama_index.legacy.types import RESPONSE_TEXT_TYPE class NoText(BaseSynthesizer): def _get_prompts(self) -> PromptDictType: """Get pr...
llama_index/llama-index-legacy/llama_index/legacy/response_synthesizers/no_text.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/response_synthesizers/no_text.py", "repo_id": "llama_index", "token_count": 346 }
1,598
from langchain_community.tools.google_finance.tool import GoogleFinanceQueryRun __all__ = ["GoogleFinanceQueryRun"]
langchain/libs/langchain/langchain/tools/google_finance/tool.py/0
{ "file_path": "langchain/libs/langchain/langchain/tools/google_finance/tool.py", "repo_id": "langchain", "token_count": 34 }
589
from typing import Callable, List, Optional, Union from llama_index.legacy.bridge.pydantic import Field from llama_index.legacy.callbacks import CallbackManager from llama_index.legacy.core.embeddings.base import ( DEFAULT_EMBED_BATCH_SIZE, BaseEmbedding, Embedding, ) from llama_index.legacy.embeddings.hug...
llama_index/llama-index-legacy/llama_index/legacy/embeddings/text_embeddings_inference.py/0
{ "file_path": "llama_index/llama-index-legacy/llama_index/legacy/embeddings/text_embeddings_inference.py", "repo_id": "llama_index", "token_count": 2356 }
1,703
from langchain_core.agents import AgentAction from langchain.agents.format_scratchpad.xml import format_xml def test_single_agent_action_observation() -> None: # Arrange agent_action = AgentAction(tool="Tool1", tool_input="Input1", log="Log1") observation = "Observation1" intermediate_steps = [(agent...
langchain/libs/langchain/tests/unit_tests/agents/format_scratchpad/test_xml.py/0
{ "file_path": "langchain/libs/langchain/tests/unit_tests/agents/format_scratchpad/test_xml.py", "repo_id": "langchain", "token_count": 473 }
629
"""FlyteKit callback handler.""" from __future__ import annotations import logging from copy import deepcopy from typing import TYPE_CHECKING, Any, Dict, List, Tuple from langchain_core.agents import AgentAction, AgentFinish from langchain_core.callbacks import BaseCallbackHandler from langchain_core.outputs import L...
langchain/libs/community/langchain_community/callbacks/flyte_callback.py/0
{ "file_path": "langchain/libs/community/langchain_community/callbacks/flyte_callback.py", "repo_id": "langchain", "token_count": 6229 }
227
# 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/tests/repo_utils/test_tests_fetcher.py/0
{ "file_path": "transformers/tests/repo_utils/test_tests_fetcher.py", "repo_id": "transformers", "token_count": 18132 }
843
## init file from llama_index.tools.openai.image_generation.base import ( OpenAIImageGenerationToolSpec, ) __all__ = ["OpenAIImageGenerationToolSpec"]
llama_index/llama-index-integrations/tools/llama-index-tools-openai/llama_index/tools/openai/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-openai/llama_index/tools/openai/__init__.py", "repo_id": "llama_index", "token_count": 52 }
1,492
import collections import types import numpy as np from ..utils import ( add_end_docstrings, is_tensorflow_probability_available, is_tf_available, is_torch_available, requires_backends, ) from .base import ArgumentHandler, Dataset, Pipeline, PipelineException, build_pipeline_init_args if is_torc...
transformers/src/transformers/pipelines/table_question_answering.py/0
{ "file_path": "transformers/src/transformers/pipelines/table_question_answering.py", "repo_id": "transformers", "token_count": 9202 }
763
import os from pathlib import Path from langchain_community.document_loaders import UnstructuredXMLLoader EXAMPLE_DIRECTORY = file_path = Path(__file__).parent.parent / "examples" def test_unstructured_xml_loader() -> None: """Test unstructured loader.""" file_path = os.path.join(EXAMPLE_DIRECTORY, "factboo...
langchain/libs/community/tests/integration_tests/document_loaders/test_xml.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/document_loaders/test_xml.py", "repo_id": "langchain", "token_count": 154 }
346
# flake8: noqa from langchain_core.documents import Document from langchain_community.vectorstores.vearch import Vearch from tests.integration_tests.vectorstores.fake_embeddings import FakeEmbeddings def test_vearch() -> None: """ Test end to end create vearch ,store vector into it and search """ tex...
langchain/libs/community/tests/integration_tests/vectorstores/test_vearch.py/0
{ "file_path": "langchain/libs/community/tests/integration_tests/vectorstores/test_vearch.py", "repo_id": "langchain", "token_count": 2276 }
361
python_tests()
llama_index/llama-index-packs/llama-index-packs-agents-llm-compiler/tests/BUILD/0
{ "file_path": "llama_index/llama-index-packs/llama-index-packs-agents-llm-compiler/tests/BUILD", "repo_id": "llama_index", "token_count": 5 }
1,572
import { MomentoVectorIndex } from "@langchain/community/vectorstores/momento_vector_index"; // For browser/edge, adjust this to import from "@gomomento/sdk-web"; import { PreviewVectorIndexClient, VectorIndexConfigurations, CredentialProvider, } from "@gomomento/sdk"; import { OpenAIEmbeddings } from "@langchain...
langchainjs/examples/src/indexes/vector_stores/momento_vector_index/fromExisting.ts/0
{ "file_path": "langchainjs/examples/src/indexes/vector_stores/momento_vector_index/fromExisting.ts", "repo_id": "langchainjs", "token_count": 296 }
829
// 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/pkg/util/paramtable/base_table_test.go/0
{ "file_path": "milvus/pkg/util/paramtable/base_table_test.go", "repo_id": "milvus", "token_count": 1434 }
1,921
export * from "@langchain/core/runnables/remote";
langchainjs/langchain/src/runnables/remote.ts/0
{ "file_path": "langchainjs/langchain/src/runnables/remote.ts", "repo_id": "langchainjs", "token_count": 16 }
947
pub(crate) mod config; mod ingest; mod message_id; mod scheduler; // Re-export the ingest provider for use in the worker pub(crate) use ingest::*; pub(crate) use scheduler::*;
chroma/rust/worker/src/ingest/mod.rs/0
{ "file_path": "chroma/rust/worker/src/ingest/mod.rs", "repo_id": "chroma", "token_count": 61 }
58
"""Apify Actor reader.""" from typing import Callable, Dict, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from llama_index.readers.apify.dataset.base import ApifyDataset class ApifyActor(BaseReader): """Apify Actor reader. Calls an Actor on...
llama_index/llama-index-integrations/readers/llama-index-readers-apify/llama_index/readers/apify/actor/base.py/0
{ "file_path": "llama_index/llama-index-integrations/readers/llama-index-readers-apify/llama_index/readers/apify/actor/base.py", "repo_id": "llama_index", "token_count": 913 }
1,331
# Copyright 2020 The HuggingFace Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
datasets/metrics/seqeval/seqeval.py/0
{ "file_path": "datasets/metrics/seqeval/seqeval.py", "repo_id": "datasets", "token_count": 2504 }
135
"""Init file.""" from llama_index.core.query_engine.pandas.output_parser import ( PandasInstructionParser, ) from llama_index.core.query_engine.pandas.pandas_query_engine import ( PandasQueryEngine, ) __all__ = ["PandasInstructionParser", "PandasQueryEngine"]
llama_index/llama-index-core/llama_index/core/query_engine/pandas/__init__.py/0
{ "file_path": "llama_index/llama-index-core/llama_index/core/query_engine/pandas/__init__.py", "repo_id": "llama_index", "token_count": 97 }
1,198
<jupyter_start><jupyter_text>AZLyrics>[AZLyrics](https://www.azlyrics.com/) is a large, legal, every day growing collection of lyrics.This covers how to load AZLyrics webpages into a document format that we can use downstream.<jupyter_code>from langchain_community.document_loaders import AZLyricsLoader loader = AZLyric...
langchain/docs/docs/integrations/document_loaders/azlyrics.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/document_loaders/azlyrics.ipynb", "repo_id": "langchain", "token_count": 140 }
94
"""Tests for the Google Cloud DocAI parser.""" from unittest.mock import MagicMock, patch import pytest from langchain_community.document_loaders.parsers import ( AzureAIDocumentIntelligenceParser, ) @pytest.mark.requires("azure", "azure.ai", "azure.ai.documentintelligence") @patch("azure.ai.documentintelligenc...
langchain/libs/community/tests/unit_tests/document_loaders/parsers/test_doc_intelligence.py/0
{ "file_path": "langchain/libs/community/tests/unit_tests/document_loaders/parsers/test_doc_intelligence.py", "repo_id": "langchain", "token_count": 350 }
372
<jupyter_start><jupyter_text>Titan Takeoff Pro`TitanML` helps businesses build and deploy better, smaller, cheaper, and faster NLP models through our training, compression, and inference optimization platform.>Note: These docs are for the Pro version of Titan Takeoff. For the community version, see the page for Titan T...
langchain/docs/docs/integrations/llms/titan_takeoff_pro.ipynb/0
{ "file_path": "langchain/docs/docs/integrations/llms/titan_takeoff_pro.ipynb", "repo_id": "langchain", "token_count": 664 }
133
[tool.poetry] name = "chain-of-note-wiki" version = "0.0.1" description = "Implementation of Chain of Note prompting for Wikipedia." authors = [] readme = "README.md" [tool.poetry.dependencies] python = ">=3.8.1,<4.0" langchain = "^0.1" anthropic = "^0.7.0" wikipedia = "^1.4.0" langchainhub = "^0.1.14" [tool.poetry.g...
langchain/templates/chain-of-note-wiki/pyproject.toml/0
{ "file_path": "langchain/templates/chain-of-note-wiki/pyproject.toml", "repo_id": "langchain", "token_count": 308 }
668
from llama_index.tools.exa.base import ExaToolSpec __all__ = ["ExaToolSpec"]
llama_index/llama-index-integrations/tools/llama-index-tools-exa/llama_index/tools/exa/__init__.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-exa/llama_index/tools/exa/__init__.py", "repo_id": "llama_index", "token_count": 30 }
1,482
<!--Copyright 2023 The HuggingFace Team. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed...
transformers/docs/source/en/model_doc/vivit.md/0
{ "file_path": "transformers/docs/source/en/model_doc/vivit.md", "repo_id": "transformers", "token_count": 618 }
459
# Zero-shot classifier distillation Author: @joeddav This script provides a way to improve the speed and memory performance of a zero-shot classifier by training a more efficient student model from the zero-shot teacher's predictions over an unlabeled dataset. The zero-shot classification pipeline uses a model pre-...
transformers/examples/research_projects/zero-shot-distillation/README.md/0
{ "file_path": "transformers/examples/research_projects/zero-shot-distillation/README.md", "repo_id": "transformers", "token_count": 2467 }
621
from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.tavily_research import TavilyToolSpec def test_class(): names_of_base_classes = [b.__name__ for b in TavilyToolSpec.__mro__] assert BaseToolSpec.__name__ in names_of_base_classes
llama_index/llama-index-integrations/tools/llama-index-tools-tavily-research/tests/test_tools_tavily_research.py/0
{ "file_path": "llama_index/llama-index-integrations/tools/llama-index-tools-tavily-research/tests/test_tools_tavily_research.py", "repo_id": "llama_index", "token_count": 97 }
1,633
from candle import Tensor, QTensor, DType from typing import ( Dict, Tuple, Any, Optional, Union, Iterator, Set, overload, Mapping, TypeVar, List, ) from collections import OrderedDict, namedtuple TensorLike = Union[Tensor, QTensor] T = TypeVar("T", bound="Module") class _...
candle/candle-pyo3/py_src/candle/nn/module.py/0
{ "file_path": "candle/candle-pyo3/py_src/candle/nn/module.py", "repo_id": "candle", "token_count": 12028 }
61
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger HIGHLIGHT_MESSAGE_PRE = """<<<<<<< This should probably be modified because it mentions: """ HIGHLIGHT_MESSAGE_POST = """======= >>>>>>>...
datasets/src/datasets/commands/convert.py/0
{ "file_path": "datasets/src/datasets/commands/convert.py", "repo_id": "datasets", "token_count": 3822 }
134
# Backwards compatibility. from langchain_core.language_models import BaseLanguageModel from langchain_core.language_models.llms import ( LLM, BaseLLM, ) __all__ = [ "BaseLanguageModel", "BaseLLM", "LLM", ]
langchain/libs/langchain/langchain/llms/base.py/0
{ "file_path": "langchain/libs/langchain/langchain/llms/base.py", "repo_id": "langchain", "token_count": 87 }
544
# SegmentGrowing Growing segment has the following additional interfaces: 1. `PreInsert(size) -> reservedOffset`: serial interface, which reserves space for future insertion and returns the `reservedOffset`. 2. `Insert(reservedOffset, size, ...Data...)`: write `...Data...` into range `[reservedOffset, reservedOffset...
milvus/docs/design_docs/segcore/segment_growing.md/0
{ "file_path": "milvus/docs/design_docs/segcore/segment_growing.md", "repo_id": "milvus", "token_count": 879 }
1,723
#!/usr/bin/env python # coding=utf-8 # Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LI...
diffusers/examples/dreambooth/train_dreambooth.py/0
{ "file_path": "diffusers/examples/dreambooth/train_dreambooth.py", "repo_id": "diffusers", "token_count": 25331 }
215
package utils import ( "k8s.io/client-go/dynamic" "k8s.io/client-go/kubernetes" "k8s.io/client-go/kubernetes/fake" "k8s.io/client-go/rest" ) func GetTestKubenertesInterface() (kubernetes.Interface, error) { clientset := fake.NewSimpleClientset() return clientset, nil } func getKubernetesConfig() (*rest.Config,...
chroma/go/coordinator/internal/utils/kubernetes.go/0
{ "file_path": "chroma/go/coordinator/internal/utils/kubernetes.go", "repo_id": "chroma", "token_count": 398 }
55
# 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/gptsan_japanese/convert_gptsan_tf_checkpoint_to_pytorch.py/0
{ "file_path": "transformers/src/transformers/models/gptsan_japanese/convert_gptsan_tf_checkpoint_to_pytorch.py", "repo_id": "transformers", "token_count": 5113 }
674
import { z } from "zod"; import type { EmbeddingEndpoint } from "../embeddingEndpoints"; import type { Tensor, Pipeline } from "@xenova/transformers"; import { pipeline } from "@xenova/transformers"; export const embeddingEndpointTransformersJSParametersSchema = z.object({ weight: z.number().int().positive().default(...
chat-ui/src/lib/server/embeddingEndpoints/transformersjs/embeddingEndpoints.ts/0
{ "file_path": "chat-ui/src/lib/server/embeddingEndpoints/transformersjs/embeddingEndpoints.ts", "repo_id": "chat-ui", "token_count": 483 }
105
<!--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/data2vec.md/0
{ "file_path": "transformers/docs/source/en/model_doc/data2vec.md", "repo_id": "transformers", "token_count": 2027 }
452
# Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
transformers/examples/legacy/seq2seq/train_distilbart_cnn.sh/0
{ "file_path": "transformers/examples/legacy/seq2seq/train_distilbart_cnn.sh", "repo_id": "transformers", "token_count": 541 }
545
package notification import ( "context" "sort" "github.com/chroma/chroma-coordinator/internal/model" ) type MemoryNotificationStore struct { notifications map[string][]model.Notification } var _ NotificationStore = &MemoryNotificationStore{} func NewMemoryNotificationStore() *MemoryNotificationStore { return ...
chroma/go/coordinator/internal/notification/memory_notification_store.go/0
{ "file_path": "chroma/go/coordinator/internal/notification/memory_notification_store.go", "repo_id": "chroma", "token_count": 641 }
52
import os from typing import Dict, Optional from ai21 import AI21Client from langchain_core.pydantic_v1 import BaseModel, Field, SecretStr, root_validator from langchain_core.utils import convert_to_secret_str _DEFAULT_TIMEOUT_SEC = 300 class AI21Base(BaseModel): class Config: arbitrary_types_allowed = ...
langchain/libs/partners/ai21/langchain_ai21/ai21_base.py/0
{ "file_path": "langchain/libs/partners/ai21/langchain_ai21/ai21_base.py", "repo_id": "langchain", "token_count": 657 }
677
from pydantic import BaseModel from typing import Any, Dict, List, Optional from chromadb.api.types import ( CollectionMetadata, Include, ) class AddEmbedding(BaseModel): # Pydantic doesn't handle Union types cleanly like Embeddings which has # Union[int, float] so we use Any here to ensure data is pa...
chroma/chromadb/server/fastapi/types.py/0
{ "file_path": "chroma/chromadb/server/fastapi/types.py", "repo_id": "chroma", "token_count": 742 }
21