SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2211.01335 · 2022

Chinese CLIP: Contrastive Vision-Language Pretraining in Chinese

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 4 failures of our instrument; 0 no recorded run); 1 of them was also run on the host, not in the jail, by the peer-agreement lane that set its level, measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2211.01335.json · badge: /api/ran/2211.01335.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
ofa-sys/chinese-clip canonical (classifier label)
classifier basis not recorded on the link
7 ran · 0 no recorded run
FunctionStatusWhere it lives
swish Ran
ran; our contract draft was wrong, not the code
ofa-sys/chinese-clip/cn_clip/clip/modeling_bert.py
code served (permissive licence) · get_code("0f786c407fb1ee4c")
How it ran

Ran in Syntology's jail on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned Tensor, ndim 2, dtype family float, shape (2, 4) as a later run recorded it. The image it ran in was not recorded. The comparison behind this sample's level is a different run: the peer-agreement lane ran it again on the host, not in the jail (report dated 2026-09-04T22:33:52Z). If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# The function swish takes a single parameter 'x' which is used with:
# - torch.sigmoid(x) - requires a tensor
# - x * ... - requires a tensor that supports multiplication
# So x should be a tensor

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
convert_state_dict Ran
ran on a synthesized input
ofa-sys/chinese-clip/cn_clip/clip/model.py
code served (permissive licence) · get_code("650bf97faab74187")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

# Test case 1: Empty state dict
state_dict_empty = {}

# Test case 2: Visual transformer with in_proj attention (CLIP-style)
state_dict_visual = {
    'visual.transformer.resblocks.0.attn.in_proj_weight': torch.randn(12, 4),
    'visual.transformer.resblocks.0.attn.in_proj_bias': torch.randn(12),
    'visual.transformer.resblocks.1.attn.in_proj_weight': torch.randn(12, 4),
    'visual.transformer.resblocks.1.attn.in_proj_bias': torch.randn(12),
}

# Test case 3: Visual transformer with Wqkv attention (Flash Attention style)
state_dict_visual_flash = {
    'visual.transformer.resblocks.0.attn.Wqkv.weight': torch.randn(12, 4),
    'visual.transformer.resblocks.0.attn.Wqkv.bias': torch.randn(12),
}

# Test case 4: BERT with separate query, key, value (original style)
hidden_dim = 8
state_dict_bert = {
    'bert.encoder.layer.0.attention.self.query.weight': torch.randn(hidden_dim, 4),
    'bert.encoder.layer.0.attention.self.query.bias': torch.randn(hidden_dim),
    'bert.encoder.layer.0.attention.self.key.weight': torch.randn(hidden_dim, 4),
    'bert.encoder.layer.0.attention.self.key.bias': torch.randn(hidden_dim),
    'bert.encoder.layer.0.attention.self.value.weight': torch.randn(hidden_dim, 4),
    'bert.encoder.layer.0.attention.self.value.bias': torch.randn(hidden_dim),
    'bert.encoder.layer.0.attention.output.dense.weight': torch.randn(4, 8),
    'bert.encoder.layer.0.attention.output.dense.bias': torch.randn(4),
    'bert.encoder.layer.1.attention.self.query.weight': torch.randn(hidden_dim, 4),
    'bert.encoder.layer.1.attention.self.query.bias': torch.randn(hidden_dim),
    'bert.encoder.layer.1.attention.self.key.weight': torch.randn(hidden_dim, 4),
    'bert.encoder.layer.1.attention.self.key.bias': torch.randn(hidden_dim),
    'bert.encoder.layer.1.attention.self.value.weight': torch.randn(hidden_dim, 4),
    'bert.encoder.layer.1.attention.self.value.bias': torch.randn(hidden_dim),
    'bert.encoder.layer.1.attention.output.dense.weight': torch.randn(4, 8),
    'bert.encoder.layer.1.attention.output.dense.bias': torch.randn(4),
}

# Test case 5: BERT with Wqkv (Flash Attention style)
state_dict_bert_flash = {
    'bert.encoder.layer.0.attention.self.Wqkv.weight': torch.randn(24, 4),
    'bert.encoder.layer.0.attention.self.Wqkv.bias': torch.randn(24),
    'bert.encoder.layer.0.attention.self.out_proj.weight': torch.randn(4, 8),
    'bert.encoder.layer.0.attention.self.out_proj.bias': torch.randn(4),
}

# Test case 6: With module prefix
state_dict_with_prefix = {
    'module.visual.transformer.resblocks.0.attn.in_proj_weight': torch.randn(12, 4),
    'module.visual.transformer.resblocks.0.attn.in_proj_bias': torch.randn(12),
}

ARGS = {
    'state_dict': state_dict_empty,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
convert_to_unicode Ran
ran; our contract draft was wrong, not the code
ofa-sys/chinese-clip/cn_clip/clip/bert_tokenizer.py
pointer only (licence: MIT); the stored copy get_code serves, from huawei-noah/Pretrained-Language-Model, is pointer only (licence: NONE) · get_code("1923fc05163d207d")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from huawei-noah/Pretrained-Language-Model, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

gelu Ran
ran, honoured the contract we drafted
ofa-sys/chinese-clip/cn_clip/clip/modeling_bert.py
pointer only (licence: MIT); the stored copy get_code serves, from lonePatient/BERT-SDA, is pointer only (licence: NONE) · get_code("211753ba29188d4e")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from lonePatient/BERT-SDA, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

gelu_new Ran
ran, honoured the contract we drafted
ofa-sys/chinese-clip/cn_clip/clip/modeling_bert.py
pointer only (licence: MIT); the stored copy get_code serves, from lonePatient/BERT-SDA, is pointer only (licence: NONE) · get_code("77601724cad03f95")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from lonePatient/BERT-SDA, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_vocab Ran
ran; our contract draft was wrong, not the code
ofa-sys/chinese-clip/cn_clip/clip/bert_tokenizer.py
code served (permissive licence) · get_code("aaf1cb2c01043065")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned OrderedDict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import collections
import six
import tempfile
import os

# Create a temporary vocab file for testing
temp_dir = tempfile.mkdtemp()
vocab_file = os.path.join(temp_dir, "vocab.txt")

# Write a small vocab file with some tokens
vocab_content = """[PAD]
[UNK]
[CLS]
[SEP]
hello
world
python
test
"""

with open(vocab_file, 'w', encoding='utf-8') as f:
    f.write(vocab_content)

ARGS = {
    'vocab_file': vocab_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
six — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type OrderedDict — a OrderedDict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a OrderedDict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
printable_text Ran
ran; our contract draft was wrong, not the code
ofa-sys/chinese-clip/cn_clip/clip/bert_tokenizer.py
code served (permissive licence) · get_code("0e5615f8994003cf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import six

# The function takes a single parameter 'text' which can be:
# - str (works in both Python 2 and 3)
# - bytes (in Python 3, decoded to utf-8)
# - unicode (in Python 2, encoded to utf-8)

# Since we're running on Python 3, we'll test with a string
text_input = "Hello, World!"

ARGS = {
    "text": text_input
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
six — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 6 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 2 the same month, 6 later) and 1 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
swish 206 other papers
121 dated earlier, 1 the same month, 80 later, 4 same year, order not determinable · 44 only as an assembly brick
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1805.12114 (2018-05)
Deep Reinforcement Learning in a Handful of Trials using Probabilistic Dynamics Models
1809.01357 (2018-09)
Zero Shot Learning for Code Education: Rubric Sampling with Deep Learning Inference
and 203 more not named here
gelu 198 other papers
123 dated earlier, 1 the same month, 70 later, 4 same year, order not determinable · 32 only as an assembly brick
1408.5882 (2014-08)
Convolutional Neural Networks for Sentence Classification
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.10125 (2019-01)
Glyce: Glyph-vectors for Chinese Character Representations
and 195 more not named here
convert_to_unicode 36 other papers
24 dated earlier, 11 later, 1 same year, order not determinable
1609.08144 (2016-09)
Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.04085 (2019-01)
Passage Re-ranking with BERT
and 33 more not named here
printable_text 33 other papers
23 dated earlier, 9 later, 1 same year, order not determinable
1609.08144 (2016-09)
Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.04085 (2019-01)
Passage Re-ranking with BERT
and 30 more not named here
gelu_new 23 other papers
19 dated earlier, 4 later
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1909.11942 (2019-09)
ALBERT: A Lite BERT for Self-supervised Learning of Language Representations
1911.03631 (2019-11)
Hierarchical Graph Network for Multi-hop Question Answering
and 20 more not named here
load_vocab 3 other papers
3 later
2311.03054 (2023-11)
AnyText: Multilingual Visual Text Generation And Editing
2411.15245 (2024-11)
AnyText2: Visual Text Generation and Editing With Customizable Attributes
2025.findings-emnlp.1385 (2025 (year only))
ControlText: Unlocking Controllable Fonts in Multilingual Text Rendering without Font Annotations

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The tremendous success of CLIP (Radford et al., 2021) has promoted the research and application of contrastive learning for vision-language pretraining. In this work, we construct a large-scale dataset of image-text pairs in Chinese, where most data are retrieved from publicly available datasets, and we pretrain Chinese CLIP models on the new dataset. We develop 5 Chinese CLIP models of multiple sizes, spanning from 77 to 958 million parameters. Furthermore, we propose a two-stage pretraining method, where the model is first trained with the image encoder frozen and then trained with all parameters being optimized, to achieve enhanced model performance. Our comprehensive experiments demonstrate that Chinese CLIP can achieve the state-of-the-art performance on MUGE, Flickr30K-CN, and COCO-CN in the setups of zero-shot learning and finetuning, and it is able to achieve competitive performance in zero-shot image classification based on the evaluation on the ELEVATER benchmark (Li et al., 2022). We have released our codes, models, and demos in https://github.com/OFA-Sys/Chinese-CLIP

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2211.01335")
get_code_for_paper("2211.01335")
have("2211.01335")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2211.01335.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2211.01335.svg)](https://syntology.ai/paper/2211.01335)

Connect an agent — have() is free.