Instructions to use iko-01/marocknewAI1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use iko-01/marocknewAI1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="iko-01/marocknewAI1")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("iko-01/marocknewAI1") model = AutoModelForCausalLM.from_pretrained("iko-01/marocknewAI1", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use iko-01/marocknewAI1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "iko-01/marocknewAI1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "iko-01/marocknewAI1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/iko-01/marocknewAI1
- SGLang
How to use iko-01/marocknewAI1 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 "iko-01/marocknewAI1" \ --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": "iko-01/marocknewAI1", "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 "iko-01/marocknewAI1" \ --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": "iko-01/marocknewAI1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use iko-01/marocknewAI1 with Docker Model Runner:
docker model run hf.co/iko-01/marocknewAI1
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- ar
|
| 5 |
+
base_model:
|
| 6 |
+
- iko-01/marocAI
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
library_name: transformers
|
| 9 |
+
tags:
|
| 10 |
+
- maroc
|
| 11 |
+
- AI
|
| 12 |
+
- learn
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
HOW TO USE IT :
|
| 18 |
+
```python
|
| 19 |
+
TEST_PROMPTS = [
|
| 20 |
+
"اشنو هو الذكاء الاصطناعي (AI) بصفة عامة؟",
|
| 21 |
+
# U CAN ADD MORE Q in darija moroccain !
|
| 22 |
+
|
| 23 |
+
def generate_answer(prompt, max_new_tokens=150):
|
| 24 |
+
full_prompt = f"Question: {prompt}\nAnswer:\n"
|
| 25 |
+
out = pipe(full_prompt, max_new_tokens=max_new_tokens, do_sample=False)[0]['generated_text']
|
| 26 |
+
if out.startswith(full_prompt):
|
| 27 |
+
generated = out[len(full_prompt):]
|
| 28 |
+
else:
|
| 29 |
+
generated = out.split('Answer:')[-1]
|
| 30 |
+
if '\n\n' in generated:
|
| 31 |
+
generated = generated.split('\n\n')[0].strip()
|
| 32 |
+
return generated.strip()
|
| 33 |
+
|
| 34 |
+
results = {p: generate_answer(p) for p in TEST_PROMPTS}
|
| 35 |
+
|
| 36 |
+
html_blocks = []
|
| 37 |
+
for q,a in results.items():
|
| 38 |
+
html_blocks.append(f"<h3>Question:</h3><p>{q}</p><h3>Answer:</h3><p class='ans'>{a.replace('\n','<br/>')}</p><hr/>")
|
| 39 |
+
|
| 40 |
+
html = """
|
| 41 |
+
<div>
|
| 42 |
+
<button onclick="var els=document.getElementsByClassName('ans'); for(var i=0;i<els.length;i++){els[i].style.fontSize=(parseInt(window.getComputedStyle(els[i]).fontSize)+4)+'px'}">A+ (increase)</button>
|
| 43 |
+
<button onclick="var els=document.getElementsByClassName('ans'); for(var i=0;i<els.length;i++){els[i].style.fontSize=(parseInt(window.getComputedStyle(els[i]).fontSize)-4)+'px'}">A- (decrease)</button>
|
| 44 |
+
<div style='margin-top:10px'>{content}</div>
|
| 45 |
+
</div>
|
| 46 |
+
""".replace('{content}', ''.join(html_blocks))
|
| 47 |
+
print(html)
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
- this is bad model witch Eval loss: 1.7146, Perplexity: 5.55
|