Text Generation
Transformers
PyTorch
English
gpt_neox
code
knowledge extraction
tiny
small
C
text-generation-inference
Instructions to use Mxode/Pythia-70m-C-Language-KnowledgeExtract with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Mxode/Pythia-70m-C-Language-KnowledgeExtract with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Mxode/Pythia-70m-C-Language-KnowledgeExtract")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Mxode/Pythia-70m-C-Language-KnowledgeExtract") model = AutoModelForCausalLM.from_pretrained("Mxode/Pythia-70m-C-Language-KnowledgeExtract", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Mxode/Pythia-70m-C-Language-KnowledgeExtract with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Mxode/Pythia-70m-C-Language-KnowledgeExtract" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mxode/Pythia-70m-C-Language-KnowledgeExtract", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Mxode/Pythia-70m-C-Language-KnowledgeExtract
- SGLang
How to use Mxode/Pythia-70m-C-Language-KnowledgeExtract 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 "Mxode/Pythia-70m-C-Language-KnowledgeExtract" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mxode/Pythia-70m-C-Language-KnowledgeExtract", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "Mxode/Pythia-70m-C-Language-KnowledgeExtract" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Mxode/Pythia-70m-C-Language-KnowledgeExtract", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Mxode/Pythia-70m-C-Language-KnowledgeExtract with Docker Model Runner:
docker model run hf.co/Mxode/Pythia-70m-C-Language-KnowledgeExtract
Update README.md
Browse files
README.md
CHANGED
|
@@ -23,7 +23,8 @@ device = 'cuda'
|
|
| 23 |
model = GPTNeoXForCausalLM.from_pretrained(model_name_or_path).to(device)
|
| 24 |
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
| 25 |
|
| 26 |
-
|
|
|
|
| 27 |
# any c-lang pieces you like, could be partial functions or statements
|
| 28 |
input_content = '''```c
|
| 29 |
int partition(int arr[], int low, int high) {
|
|
@@ -78,7 +79,7 @@ for i in range(30): # maybe 20 times or less enough too
|
|
| 78 |
pad_token_id=tokenizer.eos_token_id,
|
| 79 |
max_new_tokens=32,
|
| 80 |
do_sample=True,
|
| 81 |
-
temperature=2.0,
|
| 82 |
top_p=0.95,
|
| 83 |
top_k=30,
|
| 84 |
)
|
|
@@ -87,5 +88,11 @@ for i in range(30): # maybe 20 times or less enough too
|
|
| 87 |
|
| 88 |
print(ans_dict)
|
| 89 |
### output as below, could take high-freq answers
|
| 90 |
-
### {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
```
|
|
|
|
| 23 |
model = GPTNeoXForCausalLM.from_pretrained(model_name_or_path).to(device)
|
| 24 |
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
| 25 |
|
| 26 |
+
# instruction template
|
| 27 |
+
instruction = '[Summarize the knowledge points in the code below]\n'
|
| 28 |
# any c-lang pieces you like, could be partial functions or statements
|
| 29 |
input_content = '''```c
|
| 30 |
int partition(int arr[], int low, int high) {
|
|
|
|
| 79 |
pad_token_id=tokenizer.eos_token_id,
|
| 80 |
max_new_tokens=32,
|
| 81 |
do_sample=True,
|
| 82 |
+
temperature=2.0, # high temperature for diversity
|
| 83 |
top_p=0.95,
|
| 84 |
top_k=30,
|
| 85 |
)
|
|
|
|
| 88 |
|
| 89 |
print(ans_dict)
|
| 90 |
### output as below, could take high-freq answers
|
| 91 |
+
### {
|
| 92 |
+
### 'Backtracking': 1,
|
| 93 |
+
### 'Heap': 1,
|
| 94 |
+
### 'Quick sort': 25,
|
| 95 |
+
### 'Recurrence': 2,
|
| 96 |
+
### 'Queue': 1
|
| 97 |
+
###}
|
| 98 |
```
|