Text Generation
Transformers
PyTorch
French
English
llama
legal
code
text-generation-inference
art
text2text-generation
Instructions to use croissantllm/base_50k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use croissantllm/base_50k with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="croissantllm/base_50k")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("croissantllm/base_50k") model = AutoModelForCausalLM.from_pretrained("croissantllm/base_50k", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use croissantllm/base_50k with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "croissantllm/base_50k" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "croissantllm/base_50k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/croissantllm/base_50k
- SGLang
How to use croissantllm/base_50k 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 "croissantllm/base_50k" \ --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": "croissantllm/base_50k", "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 "croissantllm/base_50k" \ --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": "croissantllm/base_50k", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use croissantllm/base_50k with Docker Model Runner:
docker model run hf.co/croissantllm/base_50k
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
datasets:
|
| 4 |
+
- cerebras/SlimPajama-627B
|
| 5 |
+
- oscar-corpus/OSCAR-2301
|
| 6 |
+
- bigcode/starcoderdata
|
| 7 |
+
language:
|
| 8 |
+
- fr
|
| 9 |
+
- en
|
| 10 |
+
pipeline_tag: text-generation
|
| 11 |
+
tags:
|
| 12 |
+
- legal
|
| 13 |
+
- art
|
| 14 |
+
- code
|
| 15 |
+
- finance
|
| 16 |
+
- medical
|
| 17 |
+
- text-generation-inference
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# CroissantLLM: A not so flaky bilingual 1.3B model
|
| 21 |
+
|
| 22 |
+
An experimental mode trained on a small subsplit of the final data.
|
| 23 |
+
|
| 24 |
+
### Usage
|
| 25 |
+
|
| 26 |
+
```python
|
| 27 |
+
model_name = "croissantllm/base_50k"
|
| 28 |
+
|
| 29 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype=torch.float16, device_map="auto")
|
| 30 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 31 |
+
|
| 32 |
+
inputs = tokenizer("His name is Bob. -> Il s'appelle Bob.\nHe is heading to the market. -> Il va au marché.\nWe are heading to the beach, let's go together. ->", return_tensors="pt").to(model.device)
|
| 33 |
+
tokens = model.generate(**inputs, max_length=100, do_sample=True, top_p=0.95, top_k=60, temperature=0.5)
|
| 34 |
+
print(tokenizer.decode(tokens[0]))
|
| 35 |
+
|
| 36 |
+
# remove bos token
|
| 37 |
+
inputs = tokenizer("France -> Paris, Italie -> Rome, Allemagne -> Berlin, Espagne ->", return_tensors="pt", add_special_tokens=False).to(model.device)
|
| 38 |
+
tokens = model.generate(**inputs, max_length=250, do_sample=True, top_p=0.95, top_k=60)
|
| 39 |
+
print(tokenizer.decode(tokens[0]))
|
| 40 |
+
```
|