Instructions to use Floobin/TSwifty-SN6 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Floobin/TSwifty-SN6 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Floobin/TSwifty-SN6") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Floobin/TSwifty-SN6") model = AutoModelForCausalLM.from_pretrained("Floobin/TSwifty-SN6", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Floobin/TSwifty-SN6 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Floobin/TSwifty-SN6" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Floobin/TSwifty-SN6", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Floobin/TSwifty-SN6
- SGLang
How to use Floobin/TSwifty-SN6 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 "Floobin/TSwifty-SN6" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Floobin/TSwifty-SN6", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "Floobin/TSwifty-SN6" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Floobin/TSwifty-SN6", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Floobin/TSwifty-SN6 with Docker Model Runner:
docker model run hf.co/Floobin/TSwifty-SN6
| import dask | |
| from distributed.client import Client, _get_global_client | |
| from distributed.worker import Worker | |
| from fsspec import filesystem | |
| from fsspec.spec import AbstractBufferedFile, AbstractFileSystem | |
| from fsspec.utils import infer_storage_options | |
| def _get_client(client): | |
| if client is None: | |
| return _get_global_client() | |
| elif isinstance(client, Client): | |
| return client | |
| else: | |
| # e.g., connection string | |
| return Client(client) | |
| def _in_worker(): | |
| return bool(Worker._instances) | |
| class DaskWorkerFileSystem(AbstractFileSystem): | |
| """View files accessible to a worker as any other remote file-system | |
| When instances are run on the worker, uses the real filesystem. When | |
| run on the client, they call the worker to provide information or data. | |
| **Warning** this implementation is experimental, and read-only for now. | |
| """ | |
| def __init__( | |
| self, target_protocol=None, target_options=None, fs=None, client=None, **kwargs | |
| ): | |
| super().__init__(**kwargs) | |
| if not (fs is None) ^ (target_protocol is None): | |
| raise ValueError( | |
| "Please provide one of filesystem instance (fs) or" | |
| " target_protocol, not both" | |
| ) | |
| self.target_protocol = target_protocol | |
| self.target_options = target_options | |
| self.worker = None | |
| self.client = client | |
| self.fs = fs | |
| self._determine_worker() | |
| def _get_kwargs_from_urls(path): | |
| so = infer_storage_options(path) | |
| if "host" in so and "port" in so: | |
| return {"client": f"{so['host']}:{so['port']}"} | |
| else: | |
| return {} | |
| def _determine_worker(self): | |
| if _in_worker(): | |
| self.worker = True | |
| if self.fs is None: | |
| self.fs = filesystem( | |
| self.target_protocol, **(self.target_options or {}) | |
| ) | |
| else: | |
| self.worker = False | |
| self.client = _get_client(self.client) | |
| self.rfs = dask.delayed(self) | |
| def mkdir(self, *args, **kwargs): | |
| if self.worker: | |
| self.fs.mkdir(*args, **kwargs) | |
| else: | |
| self.rfs.mkdir(*args, **kwargs).compute() | |
| def rm(self, *args, **kwargs): | |
| if self.worker: | |
| self.fs.rm(*args, **kwargs) | |
| else: | |
| self.rfs.rm(*args, **kwargs).compute() | |
| def copy(self, *args, **kwargs): | |
| if self.worker: | |
| self.fs.copy(*args, **kwargs) | |
| else: | |
| self.rfs.copy(*args, **kwargs).compute() | |
| def mv(self, *args, **kwargs): | |
| if self.worker: | |
| self.fs.mv(*args, **kwargs) | |
| else: | |
| self.rfs.mv(*args, **kwargs).compute() | |
| def ls(self, *args, **kwargs): | |
| if self.worker: | |
| return self.fs.ls(*args, **kwargs) | |
| else: | |
| return self.rfs.ls(*args, **kwargs).compute() | |
| def _open( | |
| self, | |
| path, | |
| mode="rb", | |
| block_size=None, | |
| autocommit=True, | |
| cache_options=None, | |
| **kwargs, | |
| ): | |
| if self.worker: | |
| return self.fs._open( | |
| path, | |
| mode=mode, | |
| block_size=block_size, | |
| autocommit=autocommit, | |
| cache_options=cache_options, | |
| **kwargs, | |
| ) | |
| else: | |
| return DaskFile( | |
| fs=self, | |
| path=path, | |
| mode=mode, | |
| block_size=block_size, | |
| autocommit=autocommit, | |
| cache_options=cache_options, | |
| **kwargs, | |
| ) | |
| def fetch_range(self, path, mode, start, end): | |
| if self.worker: | |
| with self._open(path, mode) as f: | |
| f.seek(start) | |
| return f.read(end - start) | |
| else: | |
| return self.rfs.fetch_range(path, mode, start, end).compute() | |
| class DaskFile(AbstractBufferedFile): | |
| def __init__(self, mode="rb", **kwargs): | |
| if mode != "rb": | |
| raise ValueError('Remote dask files can only be opened in "rb" mode') | |
| super().__init__(**kwargs) | |
| def _upload_chunk(self, final=False): | |
| pass | |
| def _initiate_upload(self): | |
| """Create remote file/upload""" | |
| pass | |
| def _fetch_range(self, start, end): | |
| """Get the specified set of bytes from remote""" | |
| return self.fs.fetch_range(self.path, self.mode, start, end) | |