serve.utils
Seafoam
Bases: Base
Source code in src/python/easydel/serve/utils.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
__init__(*, primary_hue=colors.emerald, secondary_hue=colors.blue, neutral_hue=colors.gray, spacing_size=sizes.spacing_md, radius_size=sizes.radius_md, text_size=sizes.text_lg, font=(fonts.GoogleFont('Quicksand'), 'ui-sans-serif', 'sans-serif'), font_mono=(fonts.GoogleFont('IBM Plex Mono'), 'ui-monospace', 'monospace'))
The init function is called when the class is instantiated. It sets up the object with all of its instance variables and other things it needs to function properly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
self |
Represent the instance of the object |
required | |
* |
Unpack the list of parameters into a tuple |
required | |
primary_hue |
Union[Color, str]
|
Union[colors.Color,str]: Set the primary color of the theme |
emerald
|
secondary_hue |
Union[Color, str]
|
Union[colors.Color,str]: Set the secondary color of the theme |
blue
|
neutral_hue |
Union[Color, str]
|
Union[colors.Color,str]: Set the neutral color of the theme |
gray
|
spacing_size |
Union[Size, str]
|
Union[sizes.Size,str]: Set the spacing size of the theme |
spacing_md
|
radius_size |
Union[Size, str]
|
Union[sizes.Size,str]: Set the radius of the buttons and other elements |
radius_md
|
text_size |
Union[Size, str]
|
Union[sizes.Size,str]: Set the size of the text in the app |
text_lg
|
Returns:
Type | Description |
---|---|
The class object |
Source code in src/python/easydel/serve/utils.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
create_generate_function(model, generation_config, params, generation_partition_spec=PartitionSpec(('dp', 'fsdp'), 'sp'), output_partition_spec=PartitionSpec(('dp', 'fsdp'), 'sp'), logits_processor=None, return_prediction_only=True)
Create a sharded function for text generation using a Flax model.
:param model :EasyDeLFlaxPretrainedModel: The Flax model used for text generation.
:param generation_config :GenerationConfig: Configuration for text generation.
:param params :dict or jax.tree_util.PyTreeDef: Parameters of the model or a PyTree representing the model's
parameters.
:param generation_partition_spec :PartitionSpec: Sharding specification for generation inputs. Defaults to
PartitionSpec(("dp", "fsdp"), "sp").
:param output_partition_spec: PartitionSpec: Sharding specification for output sequences. Defaults to
PartitionSpec(("dp", "fsdp"), "sp").
:param logits_processor :LogitsProcessor: Processor for model logits. Defaults to None.
:param return_prediction_only :bool: Whether to return only the generated sequences. Defaults to True.
Returns:
Type | Description |
---|---|
Callable[[Union[dict, PyTreeDef], Array, Array], Array]
|
Callable[[Any, chex.Array, chex.Array], chex.Array]: Sharded function for text generation. |
Source code in src/python/easydel/serve/utils.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
|
get_partitions(tree)
Retrieve sharding specifications for model parameters.
Source code in src/python/easydel/serve/utils.py
120 121 122 123 124 125 126 127 128 129 130 |
|