Text Generation
Transformers
Safetensors
English
qwen2
code
conversational
text-generation-inference
Instructions to use yang-z/CodeV-QW-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yang-z/CodeV-QW-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yang-z/CodeV-QW-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yang-z/CodeV-QW-7B") model = AutoModelForCausalLM.from_pretrained("yang-z/CodeV-QW-7B") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use yang-z/CodeV-QW-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yang-z/CodeV-QW-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yang-z/CodeV-QW-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yang-z/CodeV-QW-7B
- SGLang
How to use yang-z/CodeV-QW-7B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "yang-z/CodeV-QW-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yang-z/CodeV-QW-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "yang-z/CodeV-QW-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yang-z/CodeV-QW-7B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yang-z/CodeV-QW-7B with Docker Model Runner:
docker model run hf.co/yang-z/CodeV-QW-7B
Improve model card - Add pipeline tag, library name, link Github repository and project page
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,13 +1,16 @@
|
|
| 1 |
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
language:
|
| 4 |
- en
|
|
|
|
| 5 |
metrics:
|
| 6 |
- accuracy
|
| 7 |
tags:
|
| 8 |
- code
|
| 9 |
arxiv: 2407.10424
|
|
|
|
|
|
|
| 10 |
---
|
|
|
|
| 11 |
<div align="center">
|
| 12 |
<img src="./assets/logo.png" style="zoom:25%;" />
|
| 13 |
</div>
|
|
@@ -18,7 +21,6 @@ arxiv: 2407.10424
|
|
| 18 |
|
| 19 |
CodeV is an innovative series of open-source, instruction-tuned Large Language Models (LLMs) specifically designed for the generation of high-quality Verilog code, addressing the challenges faced by existing models in this domain. **(This repo is under development)**
|
| 20 |
|
| 21 |
-
|
| 22 |
## Models and Datasets
|
| 23 |
|
| 24 |
| | Base Model | CodeV |
|
|
@@ -38,35 +40,26 @@ from transformers import pipeline
|
|
| 38 |
|
| 39 |
import torch
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
prompt= "FILL IN THE QUESTION"
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
generator = pipeline(
|
| 48 |
-
|
| 49 |
model="CODEV",
|
| 50 |
-
|
| 51 |
task="text-generation",
|
| 52 |
-
|
| 53 |
torch_dtype=torch.bfloat16,
|
| 54 |
-
|
| 55 |
device_map="auto",
|
| 56 |
-
|
| 57 |
)
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
result = generator(prompt , max_length=2048, num_return_sequences=1, temperature=0.0)
|
| 62 |
-
|
| 63 |
response = result[0]["generated_text"]
|
| 64 |
-
|
| 65 |
print("Response:", response)
|
| 66 |
```
|
| 67 |
## Paper
|
| 68 |
**Arxiv:** <https://arxiv.org/abs/2407.10424>
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
Please cite the paper if you use the models from CodeV.
|
| 71 |
|
| 72 |
```
|
|
@@ -85,4 +78,4 @@ Please cite the paper if you use the models from CodeV.
|
|
| 85 |
* [Magicoder](https://github.com/ise-uiuc/magicoder): Training code, original datasets and data decontamination
|
| 86 |
* [DeepSeek-Coder](https://github.com/deepseek-ai/DeepSeek-Coder): Base model for CodeV-DeepSeek
|
| 87 |
* [CodeLlama](https://ai.meta.com/research/publications/code-llama-open-foundation-models-for-code/): Base model for CodeLlama
|
| 88 |
-
* [CodeQwen](https://github.com/QwenLM/CodeQwen1.5): CodeV-CodeQwen
|
|
|
|
| 1 |
---
|
|
|
|
| 2 |
language:
|
| 3 |
- en
|
| 4 |
+
license: apache-2.0
|
| 5 |
metrics:
|
| 6 |
- accuracy
|
| 7 |
tags:
|
| 8 |
- code
|
| 9 |
arxiv: 2407.10424
|
| 10 |
+
library_name: transformers
|
| 11 |
+
pipeline_tag: text-generation
|
| 12 |
---
|
| 13 |
+
|
| 14 |
<div align="center">
|
| 15 |
<img src="./assets/logo.png" style="zoom:25%;" />
|
| 16 |
</div>
|
|
|
|
| 21 |
|
| 22 |
CodeV is an innovative series of open-source, instruction-tuned Large Language Models (LLMs) specifically designed for the generation of high-quality Verilog code, addressing the challenges faced by existing models in this domain. **(This repo is under development)**
|
| 23 |
|
|
|
|
| 24 |
## Models and Datasets
|
| 25 |
|
| 26 |
| | Base Model | CodeV |
|
|
|
|
| 40 |
|
| 41 |
import torch
|
| 42 |
|
|
|
|
|
|
|
| 43 |
prompt= "FILL IN THE QUESTION"
|
| 44 |
|
|
|
|
|
|
|
| 45 |
generator = pipeline(
|
|
|
|
| 46 |
model="CODEV",
|
|
|
|
| 47 |
task="text-generation",
|
|
|
|
| 48 |
torch_dtype=torch.bfloat16,
|
|
|
|
| 49 |
device_map="auto",
|
|
|
|
| 50 |
)
|
| 51 |
|
|
|
|
|
|
|
| 52 |
result = generator(prompt , max_length=2048, num_return_sequences=1, temperature=0.0)
|
|
|
|
| 53 |
response = result[0]["generated_text"]
|
|
|
|
| 54 |
print("Response:", response)
|
| 55 |
```
|
| 56 |
## Paper
|
| 57 |
**Arxiv:** <https://arxiv.org/abs/2407.10424>
|
| 58 |
|
| 59 |
+
Project page: https://iprc-dip.github.io/CodeV-R1
|
| 60 |
+
|
| 61 |
+
Code: https://github.com/iprc-dip/CodeV
|
| 62 |
+
|
| 63 |
Please cite the paper if you use the models from CodeV.
|
| 64 |
|
| 65 |
```
|
|
|
|
| 78 |
* [Magicoder](https://github.com/ise-uiuc/magicoder): Training code, original datasets and data decontamination
|
| 79 |
* [DeepSeek-Coder](https://github.com/deepseek-ai/DeepSeek-Coder): Base model for CodeV-DeepSeek
|
| 80 |
* [CodeLlama](https://ai.meta.com/research/publications/code-llama-open-foundation-models-for-code/): Base model for CodeLlama
|
| 81 |
+
* [CodeQwen](https://github.com/QwenLM/CodeQwen1.5): CodeV-CodeQwen
|