Instructions to use NadavShaked/D_Nikud with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NadavShaked/D_Nikud with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="NadavShaked/D_Nikud")# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("NadavShaked/D_Nikud") model = AutoModel.from_pretrained("NadavShaked/D_Nikud", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use NadavShaked/D_Nikud with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NadavShaked/D_Nikud" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NadavShaked/D_Nikud", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/NadavShaked/D_Nikud
- SGLang
How to use NadavShaked/D_Nikud 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 "NadavShaked/D_Nikud" \ --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": "NadavShaked/D_Nikud", "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 "NadavShaked/D_Nikud" \ --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": "NadavShaked/D_Nikud", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use NadavShaked/D_Nikud with Docker Model Runner:
docker model run hf.co/NadavShaked/D_Nikud
| # general | |
| import os | |
| # visual | |
| import matplotlib.pyplot as plt | |
| cols = ["precision", "recall", "f1-score", "support"] | |
| def generate_plot_by_nikud_dagesh_sin_dict(nikud_dagesh_sin_dict, title, y_axis, plot_folder=None): | |
| # Create a figure and axis | |
| plt.figure(figsize=(8, 6)) | |
| plt.title(title) | |
| ax = plt.gca() | |
| indexes = list(range(1, len(nikud_dagesh_sin_dict["nikud"]) + 1)) | |
| # Plot data series with different colors and labels | |
| ax.plot(indexes, nikud_dagesh_sin_dict["nikud"], color='blue', label='Nikud') | |
| ax.plot(indexes, nikud_dagesh_sin_dict["dagesh"], color='green', label='Dagesh') | |
| ax.plot(indexes, nikud_dagesh_sin_dict["sin"], color='red', label='Sin') | |
| # Add legend | |
| ax.legend() | |
| # Set labels and title | |
| ax.set_xlabel('Epoch') | |
| ax.set_ylabel(y_axis) | |
| if plot_folder is None: | |
| plt.show() | |
| else: | |
| plt.savefig(os.path.join(plot_folder, f'{title.replace(" ", "_")}_plot.jpg')) | |
| def generate_word_and_letter_accuracy_plot(word_and_letter_accuracy_dict, title, plot_folder=None): | |
| # Create a figure and axis | |
| plt.figure(figsize=(8, 6)) | |
| plt.title(title) | |
| ax = plt.gca() | |
| indexes = list(range(1, len(word_and_letter_accuracy_dict["all_nikud_letter"]) + 1)) | |
| # Plot data series with different colors and labels | |
| ax.plot(indexes, word_and_letter_accuracy_dict["all_nikud_letter"], color='blue', label='Letter') | |
| ax.plot(indexes, word_and_letter_accuracy_dict["all_nikud_word"], color='green', label='Word') | |
| # Add legend | |
| ax.legend() | |
| # Set labels and title | |
| ax.set_xlabel("Epoch") | |
| ax.set_ylabel("Accuracy") | |
| if plot_folder is None: | |
| plt.show() | |
| else: | |
| plt.savefig(os.path.join(plot_folder, 'word_and_letter_accuracy_plot.jpg')) | |