Downloads · 30 days
33
1% of all-time downloads
moyix/csrc_774m
csrc_774m is a text generation model from moyix. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as cc0-1.0.
This is a GPT2 774M model trained on the C/C++ code of the top 10,000 most popular packages in Debian, according to the Debian Popularity Contest. The source files were deduplicated using a process similar to the Open…
Downloads · 30 days
33
1% of all-time downloads
All-time downloads
4.2K
Public
Repo size
6.3 GB
Likes
6
Public
Click a slice to open those files.
.bin3.1 GB · 100%
From the Hugging Face model README
This is a GPT2 774M model trained on the C/C++ code of the top 10,000 most popular packages in Debian, according to the Debian Popularity Contest. The source files were deduplicated using a process similar to the OpenWebText preprocessing (basically a locality-sensitive hash to detect near-duplicates). The model was originally trained using NVIDIA's Megatron-LM but has been converted to Huggingface. Note that the tokenizer is not the standard GPT2 BPE vocab, but one that has been trained for this dataset; the tokenizer is also available from this repository.
The processed dataset (in JSON format) can be found here: csrc_dataset_large.json.gz.
This model was used to generate snippets for the web site This Code Does Not Exist.
>>> import torch
>>> from transformers import AutoModelForCausalLM, AutoTokenizer
>>> model = AutoModelForCausalLM.from_pretrained("moyix/csrc_774m")
>>> device = torch.device("cuda")
>>> model.to(device)
>>> tokenizer = AutoTokenizer.from_pretrained("moyix/csrc_774m")
>>> prompt = tokenizer.encode('// say hello\nvoid hello() {', return_tensors="pt")
>>> output = model.generate(input_ids=prompt.to(device), max_length=32, num_return_sequences=1, do_sample=True, num_beams=4)
>>> print(tokenizer.decode(output[0].tolist(),clean_up_tokenization_spaces=True))
// say hello
void hello() {
std::cout << "hello" << std::endl;
}
int main() {