← 开源
Shark-NLP

OpenICL

OpenICL is an open-source framework to facilitate research, development, and prototyping of in-context learning.

AI EngineeringPrompt & ScaffoldPython
在 GitHub 打开
增长势头
+-124 小时新增 Star-0.2%
588
Star
32
Fork
+-1
本周
5
贡献者
创建于 2023-02-25 · 更新于 2026-10-15 · 今日第 19176 名
主要开发者
numbmelonyxwang8775LividWo

Shark-NLP/OpenICL 排名第 19,176,有 588 个星标。

同类别比较

Shark-NLP/OpenICL 排名第 19,176,此处有 8 个同类条目;NextAdminHQ/nextjs-admin-dashboard 排名第 19,175。

同类别比较
名称排名指标
GMGNAI/gmgn-skills19,165
语言:
Python
星标数:
614
分叉数:
105
augmentedstartups/AS-One19,166
语言:
Python
星标数:
607
分叉数:
106
简介:
Easy & Modular Computer Vision Detectors, Trackers & SAM - Run YOLOv9,v8,v7,v6,v5,R,X in under 10 lines of code.
RageAgainstThePixel/com.openai.unity19,172
语言:
C#
星标数:
597
分叉数:
87
简介:
A Non-Official OpenAI Rest Client for Unity (UPM)
NextAdminHQ/nextjs-admin-dashboard19,175
语言:
TypeScript
星标数:
589
分叉数:
259
简介:
AI-Native Next.js admin dashboard template and UI components that come with pre-built elements, components, pages, high-quality design, integrations, and much more.
JunyaoHu/common_metrics_on_video_quality19,181
语言:
Python
星标数:
586
分叉数:
25
简介:
You can easily calculate FVD, PSNR, SSIM, LPIPS for evaluating the quality of generated or predicted videos.
webfansplz/vite-plugin-vue-mcp19,186
语言:
Vue
星标数:
578
分叉数:
33
简介:
Vite plugin that enables a MCP server helping models to understand your Vue app better.
solana-foundation/solana-dev-skill19,187
语言:
TypeScript
星标数:
577
分叉数:
138
简介:
Skills for agentic development on Solana
SpeechColab/Leaderboard19,199
语言:
Python
星标数:
556
分叉数:
73
简介:
SpeechIO Leaderboard: a large, robust, comprehensive, benchmarking platform for Automatic Speech Recognition.
关键参数与规格
关键参数与规格
参数值
语言Python
类别AI Engineering
子类别Prompt & Scaffold
星标数588
分叉数32
贡献者5
创建日期2023-02-25
更新日期2026-10-15
1 天星标数-1
7 天星标数-1
排名19,176
上次排名16,255
排名变化-2,921
7 天星标排名17,898
上次 7 天星标排名15,554
7 天星标排名变化-2,344
总星标排名17,045
上次总星标排名16,985
总星标排名变化-60
国家China
README 摘录

Users can easily incorporate different retrieval and inference methods, as well as different prompt instructions into their workflow. 8** Support LLaMA and self-consistency Installation Note: OpenICL requires Python 3. 8+ **Using Pip** **Installation for local development:** Quick Start Following example shows you how to perform ICL on sentiment classification dataset. For more detailed information about (such as string-type template) , please see tutorial1. Step 3: Initialize the Retriever Here we use the popular TopK method to build the retriever

. Step 4: Initialize the Inferencer Step 5: Inference and scoring Docs **(updating. )** OpenICL Documentation Citation If you find this repository helpful, feel free to cite our paper:

常见问题

记录了多少星标和分叉?

Shark-NLP/OpenICL 有 588 个星标和 32 个分叉。

仓库排名是多少?

Shark-NLP/OpenICL 排名第 19,176。

记录的语言和类别是什么?

Shark-NLP/OpenICL 有 588 个星标,语言为 Python,类别为 AI Engineering。

哪个仓库排名最接近?

Shark-NLP/OpenICL 与 NextAdminHQ/nextjs-admin-dashboard 比较,后者排名第 19,175,有 589 个星标。

README


Overview • Installation • Paper • Examples • Docs • Citation

Overview

OpenICL provides an easy interface for in-context learning, with many state-of-the-art retrieval and inference methods built in to facilitate systematic comparison of LMs and fast research prototyping. Users can easily incorporate different retrieval and inference methods, as well as different prompt instructions into their workflow.

What's News

  • v0.1.8 Support LLaMA and self-consistency

Installation

Note: OpenICL requires Python 3.8+

Using Pip

pip install openicl

Installation for local development:

git clone https://github.com/Shark-NLP/OpenICL
cd OpenICL
pip install -e .

Quick Start

Following example shows you how to perform ICL on sentiment classification dataset. More examples and tutorials can be found at examples

Step 1: Load and prepare data

from datasets import load_dataset
from openicl import DatasetReader

# Loading dataset from huggingface
dataset = load_dataset('gpt3mix/sst2')

# Define a DatasetReader, with specified column names where input and output are stored.
data = DatasetReader(dataset, input_columns=['text'], output_column='label')

Step 2: Define the prompt template (Optional)

from openicl import PromptTemplate
tp_dict = {
    0: "Positive Movie Review: ",
    1: "Negative Movie Review: " 
}

template = PromptTemplate(tp_dict, {'text': ''}, ice_token='')

The placeholder and will be replaced by in-context examples and testing input, respectively. For more detailed information about PromptTemplate (such as string-type template) , please see tutorial1.

Step 3: Initialize the Retriever

from openicl import TopkRetriever
# Define a retriever using the previous `DataLoader`.
# `ice_num` stands for the number of data in in-context examples.
retriever = TopkRetriever(data, ice_num=8)

Here we use the popular TopK method to build the retriever.

Step 4: Initialize the Inferencer

from openicl import PPLInferencer
inferencer = PPLInferencer(model_name='distilgpt2')

Step 5: Inference and scoring

from openicl import AccEvaluator
# the inferencer requires retriever to collect in-context examples, as well as a template to wrap up these examples.
predictions = inferencer.inference(retriever, ice_template=template)
# compute accuracy for the prediction
score = AccEvaluator().score(predictions=predictions, references=data.references)
print(score)

Docs

(updating...)

OpenICL Documentation

Citation

If you find this repository helpful, feel free to cite our paper:

@article{wu2023openicl,
  title={OpenICL: An Open-Source Framework for In-context Learning},
  author={Zhenyu Wu, Yaoxiang Wang, Jiacheng Ye, Jiangtao Feng, Jingjing Xu, Yu Qiao, Zhiyong Wu},
  journal={arXiv preprint arXiv:2303.02913},
  year={2023}
}
排名相邻
同类项目