Instructions to use Kukedlc/NeuralExperiment-7b-MagicCoder-v7 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Kukedlc/NeuralExperiment-7b-MagicCoder-v7 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Kukedlc/NeuralExperiment-7b-MagicCoder-v7")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Kukedlc/NeuralExperiment-7b-MagicCoder-v7") model = AutoModelForCausalLM.from_pretrained("Kukedlc/NeuralExperiment-7b-MagicCoder-v7") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Kukedlc/NeuralExperiment-7b-MagicCoder-v7 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Kukedlc/NeuralExperiment-7b-MagicCoder-v7" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Kukedlc/NeuralExperiment-7b-MagicCoder-v7", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Kukedlc/NeuralExperiment-7b-MagicCoder-v7
- SGLang
How to use Kukedlc/NeuralExperiment-7b-MagicCoder-v7 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 "Kukedlc/NeuralExperiment-7b-MagicCoder-v7" \ --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": "Kukedlc/NeuralExperiment-7b-MagicCoder-v7", "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 "Kukedlc/NeuralExperiment-7b-MagicCoder-v7" \ --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": "Kukedlc/NeuralExperiment-7b-MagicCoder-v7", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Kukedlc/NeuralExperiment-7b-MagicCoder-v7 with Docker Model Runner:
docker model run hf.co/Kukedlc/NeuralExperiment-7b-MagicCoder-v7
Update README.md
Browse files
README.md
CHANGED
|
@@ -34,4 +34,27 @@ Each dataset contributed 20,000 data points to the training process, ensuring a
|
|
| 34 |
- If interested in contributing or experimenting with this model, please feel free to reach out or access the code directly from my Kaggle profile.
|
| 35 |
|
| 36 |
## Contact Information
|
| 37 |
-
- For any inquiries, suggestions, or collaboration proposals, please contact
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
- If interested in contributing or experimenting with this model, please feel free to reach out or access the code directly from my Kaggle profile.
|
| 35 |
|
| 36 |
## Contact Information
|
| 37 |
+
- For any inquiries, suggestions, or collaboration proposals, please contact me!
|
| 38 |
+
|
| 39 |
+
```python
|
| 40 |
+
!pip install -qU transformers accelerate
|
| 41 |
+
|
| 42 |
+
from transformers import AutoTokenizer
|
| 43 |
+
import transformers
|
| 44 |
+
import torch
|
| 45 |
+
|
| 46 |
+
model = "Kukedlc/NeuralExperiment-7b-MagicCoder-v7"
|
| 47 |
+
messages = [{"role": "user", "content": "What is a large language model?"}]
|
| 48 |
+
|
| 49 |
+
tokenizer = AutoTokenizer.from_pretrained(model)
|
| 50 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 51 |
+
pipeline = transformers.pipeline(
|
| 52 |
+
"text-generation",
|
| 53 |
+
model=model,
|
| 54 |
+
torch_dtype=torch.float16,
|
| 55 |
+
device_map="auto",
|
| 56 |
+
)
|
| 57 |
+
|
| 58 |
+
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
|
| 59 |
+
print(outputs[0]["generated_text"])
|
| 60 |
+
```
|