Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCoder series #1880

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ysjprojects
Copy link
Contributor

OpenCoder is an open and reproducible code LLM family which includes 1.5B and 8B base and chat models, supporting both English and Chinese languages. Starting from scratch, OpenCoder is trained on 2.5 trillion tokens composed of 90% raw code and 10% code-related web data, reaching the performance of top-tier code LLMs. We provide not only model weights and inference code, but also the reproducible training data, the complete data processing pipeline, rigorous experimental ablation results, and detailed training protocols. Empowering researchers to build and innovate, OpenCoder is your open foundation for advancing code AI.

State of the art code LLM that beats Qwen2.5-Coder of equivalent size.

https://opencoder-llm.github.io/
https://arxiv.org/pdf/2411.04905

https://huggingface.co/infly/OpenCoder-1.5B
https://huggingface.co/infly/OpenCoder-1.5B-Instruct
https://huggingface.co/infly/OpenCoder-8B
https://huggingface.co/infly/OpenCoder-8B-Instruct

Issue #1858

@@ -45,7 +45,7 @@ def test_tokenizer_against_hf(config):
(checkpoint_dir / file).symlink_to(hf_file)

theirs = AutoTokenizer.from_pretrained(
repo_id, cache_dir=cache_dir / "hf", local_files_only=True, token=access_token
repo_id, cache_dir=cache_dir / "hf", local_files_only=True, token=access_token, trust_remote_code=True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
repo_id, cache_dir=cache_dir / "hf", local_files_only=True, token=access_token, trust_remote_code=True
repo_id, cache_dir=cache_dir / "hf", local_files_only=False, token=access_token, trust_remote_code=True

Not sure how exactly it works inside, but I suspect that it wants to download additional files (since trust_remove_code is True) and limiting to only local files prevents it.

@Andrei-Aksionov
Copy link
Collaborator

Hello @ysjprojects

Thanks for another great PR.

But, in this case, it's a bit difficult.
The repo for this model only contains tokenizer.model, which is the tokenizer vocab file for SentencePiece.
In addition to this, there are additional tokens that aren't in the vocab, but in the added_tokens.json.
The problem is that it's a pain to extend SentencePiece, once the tokenizer is already trained.

How does HF team extends SentencePiece. Well, they don't 🙂.
AutoTokenizer converts from SentencePiece to Tokenizers format and then extends the vocabulary.

In practice that means that this model might generate tokens infinitely, since one of the bos tokens are in added_tokens.json and thus the tokenizer doesn't know about them 🫠.

@ysjprojects
Copy link
Contributor Author

Hello @ysjprojects

Thanks for another great PR.

But, in this case, it's a bit difficult. The repo for this model only contains tokenizer.model, which is the tokenizer vocab file for SentencePiece. In addition to this, there are additional tokens that aren't in the vocab, but in the added_tokens.json. The problem is that it's a pain to extend SentencePiece, once the tokenizer is already trained.

How does HF team extends SentencePiece. Well, they don't 🙂. AutoTokenizer converts from SentencePiece to Tokenizers format and then extends the vocabulary.

In practice that means that this model might generate tokens infinitely, since one of the bos tokens are in added_tokens.json and thus the tokenizer doesn't know about them 🫠.

I see. In that case would you consider this problem completely intractable or just requires a lot of work?

@Andrei-Aksionov
Copy link
Collaborator

I see. In that case would you consider this problem completely intractable or just requires a lot of work?

There is nothing intractable about it 🙂.
We just need to support all the conversion steps from AutoTokenizer, since we need to match it.

Or, we can cheat a little bit for now, and just check if there is only tokenizer.model available, but also added_tokens.json, then just load into AutoTokenizer, save into tokenizer.json and proceed with initialization. Later we can extend the logic to get rid of AutoTokenizer and have more control.

But, what bothers me, is that in the repo there is another file - tokenization_inflm.py. As I see it, it contains a custom logic for tokenization, as-like *_modeling.py files that you might have encountered with other models (for custom model implementation, that is not yet supported by HF).

For now, I raised a question in their repo. Perhaps there is an easier way to do all this 🤷.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants